Skip to content

Remove redundant plugin operation result flags - #10

Merged
gabek merged 3 commits into
mainfrom
gek/plugin-result-errors
Aug 2, 2026
Merged

Remove redundant plugin operation result flags#10
gabek merged 3 commits into
mainfrom
gek/plugin-result-errors

Conversation

@gabek

@gabek gabek commented Aug 2, 2026

Copy link
Copy Markdown
Member

This removes the redundant ok field from plugin operation results. The presence of error already carries the complete success or failure state.

  • Remove ok from filesystem, SQL, and video configuration result payloads
  • Keep failure reasons in error and preserve existing failure behavior
  • Update the serialized plugin contract and focused contract tests
Focused verification passed for issue #5089.

I 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

gabek added 2 commits August 1, 2026 17:50
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.
Copilot AI review requested due to automatic review settings August 2, 2026 01:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ok from filesystem + videoConfig (and related contract/docs), using error presence as the success/failure signal.
  • Add storage.sql permission and owncast.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.

Comment thread sdks/js/index.js
Comment thread sdks/js/index.js
Comment thread sdks/python/owncast_plugin/__init__.py Outdated
@gabek
gabek merged commit 384971c into main Aug 2, 2026
73 checks passed
@gabek
gabek deleted the gek/plugin-result-errors branch August 2, 2026 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request (Plugins): Objects that are defined as { ok, error? } should drop "ok" for consistency.

2 participants