Remove redundant plugin operation result flags - #10
Merged
Conversation
Expose storage.sql through the JavaScript and Python SDKs, the local host runtime, and the scenario test harness. Add matching author guidance and a chat leaderboard example in both languages.
There was a problem hiding this comment.
Pull request overview
This PR updates the Owncast plugin SDK contract to remove redundant { ok, error? } operation-result flags in favor of { error? } (success = no error), and extends the SDK/runtime/docs to cover storage.sql (private per-plugin SQLite) across JS/Python, including dev/test host support.
Changes:
- Remove
okfrom filesystem + videoConfig (and related contract/docs), usingerrorpresence as the success/failure signal. - Add
storage.sqlpermission andowncast.sql.*APIs to both JS and Python SDKs. - Add an in-memory per-plugin SQLite implementation for non-production hosts, plus new worked examples and scenario tests.
Reviewed changes
Copilot reviewed 44 out of 48 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| sdks/python/owncast_plugin/template/AGENTS.md | Documents storage.sql permission and owncast.sql.* behavior for Python plugin authors. |
| sdks/python/owncast_plugin/template/.agents/skills/create-owncast-plugin-py/SKILL.md | Updates the Python plugin-authoring skill guidance to include storage.sql. |
| sdks/python/owncast_plugin/init.py | Adds Python owncast.sql API, introduces _operation_result, and updates fs/videoConfig write semantics around {error?} results. |
| sdks/js/index.js | Adds storage.sql permission + owncast.sql.* APIs; centralizes {error?} op-result parsing and updates fs/videoConfig to use it. |
| sdks/js/index.d.ts | Updates FsResult to drop ok; adds storage.sql types and owncast.sql API typings; clarifies videoConfig.write throwing semantics. |
| sdks/js/create-owncast-plugin/template/AGENTS.md | Updates JS template guidance to include storage.sql and SQL behavioral notes. |
| sdks/js/create-owncast-plugin/template/.agents/skills/create-owncast-plugin-js/SKILL.md | Updates the JS plugin-authoring skill guidance to include storage.sql. |
| host-runtime/sqlstore/sqlstore.go | New in-memory per-plugin SQLite store (pure-Go driver) for dev/test/demo hosts to support storage.sql. |
| host-runtime/sqlstore/sqlstore_test.go | Tests that the pure-Go store matches production value-size limits. |
| host-runtime/plugin/testing/sql.go | Wires storage.sql into the scenario test MockHost via the shared sqlstore implementation. |
| host-runtime/plugin/testing/sql_test.go | Adds tests for SQL round-trips, isolation, limit behavior, and production-like error text/refusals. |
| host-runtime/plugin/testing/runner.go | Ensures SQL store cleanup during scenario runs/load checks. |
| host-runtime/plugin/testing/mocks.go | Extends MockHost HostEnv to implement SQLExec/SQLQuery and manage lifecycle. |
| host-runtime/main.go | Updates demo host filesystem path docs and wires in an in-memory SQL store for storage.sql. |
| host-runtime/go.sum | Adds checksums for new sqlstore dependencies and bumps Owncast dependency revision. |
| host-runtime/go.mod | Adds modernc.org/sqlite dependency and updates Owncast dependency revision. |
| host-runtime/cmd/owncast-plugin-serve/main.go | Updates dev-data root path and wires in an in-memory SQL store for storage.sql. |
| examples/python/README.md | Adds the Python chat-leaderboard example entry. |
| examples/python/file-manager/src/plugin.py | Updates fs write/delete handling to check error instead of ok. |
| examples/python/file-manager/README.md | Updates filesystem sandbox path docs. |
| examples/python/file-manager/public/admin/index.html | Updates filesystem sandbox path displayed in UI. |
| examples/python/file-manager/INSTRUCTIONS.md | Updates filesystem sandbox path in instructions. |
| examples/python/file-manager/tests/files.test.json | Adds scenario asserting missing-file delete surfaces the host error. |
| examples/python/chat-leaderboard/src/plugin.py | New Python SQL leaderboard example plugin using owncast.sql.*. |
| examples/python/chat-leaderboard/README.md | Documents the Python SQL leaderboard example and storage.sql behavior. |
| examples/python/chat-leaderboard/plugin.manifest.json | Declares storage.sql + chat.send permissions for the Python leaderboard example. |
| examples/python/chat-leaderboard/INSTRUCTIONS.md | User-facing instructions for the Python leaderboard example. |
| examples/python/chat-leaderboard/tests/chat-leaderboard.test.json | Scenario tests for SQL-backed leaderboard behavior in Python. |
| examples/python/all-permissions-test/plugin.manifest.json | Adds storage.sql to the “all permissions” Python manifest. |
| examples/js/README.md | Adds the JS chat-leaderboard example entry. |
| examples/js/file-manager/src/plugin.js | Updates fs write/delete handling to check error instead of ok. |
| examples/js/file-manager/README.md | Updates filesystem sandbox path docs. |
| examples/js/file-manager/public/admin/index.html | Updates filesystem sandbox path displayed in UI. |
| examples/js/file-manager/INSTRUCTIONS.md | Updates filesystem sandbox path in instructions. |
| examples/js/file-manager/tests/files.test.json | Adds scenario asserting missing-file delete surfaces the host error. |
| examples/js/chat-leaderboard/src/plugin.js | New JS SQL leaderboard example plugin using owncast.sql.*. |
| examples/js/chat-leaderboard/README.md | Documents the JS SQL leaderboard example and storage.sql behavior. |
| examples/js/chat-leaderboard/plugin.manifest.json | Declares storage.sql + chat.send permissions for the JS leaderboard example. |
| examples/js/chat-leaderboard/package.json | Adds build/test/serve scripts and links SDK for the JS leaderboard example. |
| examples/js/chat-leaderboard/package-lock.json | Locks local dependency graph for the JS leaderboard example. |
| examples/js/chat-leaderboard/INSTRUCTIONS.md | User-facing instructions for the JS leaderboard example. |
| examples/js/chat-leaderboard/tests/chat-leaderboard.test.json | Scenario tests for SQL-backed leaderboard behavior in JS. |
| examples/js/all-permissions-test/plugin.manifest.json | Adds storage.sql to the “all permissions” JS manifest. |
| engines/javascript/engine.d.ts | Adds SQL host function imports for the JS engine typing. |
| engines/build_py.py | Adds storage.sql host functions to the generated Python engine import table. |
| docs/WIRE_PROTOCOL.md | Updates filesystem paths, removes ok from operation results, and documents storage.sql wire protocol and limits. |
| docs/PLUGIN_AUTHOR_GUIDE.md | Updates fs/videoConfig behavior docs, adds storage.sql author guide section, and adds SQL-related limits. |
| docs/ARCHITECTURE.md | Explains how storage.sql differs in non-production hosts while preserving shared validation/limits. |
Files not reviewed (1)
- examples/js/chat-leaderboard/package-lock.json: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This removes the redundant
okfield from plugin operation results. The presence oferroralready carries the complete success or failure state.okfrom filesystem, SQL, and video configuration result payloadserrorand preserve existing failure behaviorI ran the focused plugin Go tests and rebuilt the affected shared engines. The SDK scenario coverage for file operations passes.
This branch is based on the SQL SDK change already on the stack where required. It does not change unrelated plugin behavior.
Fixes owncast/owncast#5089