Add rule-drafts API with pluggable submission backends (GitHub, local)#402
Draft
julietshen wants to merge 1 commit into
Draft
Add rule-drafts API with pluggable submission backends (GitHub, local)#402julietshen wants to merge 1 commit into
julietshen wants to merge 1 commit into
Conversation
New ui-api blueprint for authoring SML rule drafts from the UI: - /rule-drafts/source, /validate, /vocabulary, /submit, /pending, /parse-into-builder, all gated by a new CAN_EDIT_RULE_DRAFTS ability - Drafts are spliced into the engine's loaded sources and re-run through the same AST validation the engine uses, both on validate and again server-side on submit - Submission routes through a RuleSubmissionBackend Protocol selected by OSPREY_RULES_SUBMISSION_BACKEND: github (opens a PR via the REST API, supports GitHub Enterprise), local (writes to a mounted rules dir), and null (fail-fast default so an unconfigured install never writes) - Adopter docs for the env vars in docs/user/manage.md Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VZ4RQtuHCCgurfpjfPXXAM
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Jul 2, 2026
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.
Adds a ui-api blueprint for authoring SML rule drafts from the UI, with submission routed through a pluggable backend so each deployment can pick where drafts go for review.
Endpoints (all gated by a new
CAN_EDIT_RULE_DRAFTSability, granted tosuper_user):GET /rule-drafts/source- fetch a loaded SML filePOST /rule-drafts/validate- splice the draft into the engine's loaded sources and re-run the same AST validation the engine uses; returns structured errors plus suggested importsGET /rule-drafts/vocabulary- features, UDFs (with signatures), and in-use effects, for editor autocompletePOST /rule-drafts/submit- re-validates server-side, then hands the draft to the configured backendGET /rule-drafts/pending- list drafts currently in reviewPOST /rule-drafts/parse-into-builder- decide whether a file fits the form-based builder subset (used by the UI in a follow-up PR)Backends implement the
RuleSubmissionBackendProtocol and are selected byOSPREY_RULES_SUBMISSION_BACKEND:null(default): every call fails fast with 503, so an unconfigured install never writes anythinggithub: opens a PR via the REST API; supports GitHub Enterprise viaOSPREY_GITHUB_API_URLlocal: writes into a mounted rules directory for deployments whose pipeline already syncs oneAdopter docs (env vars per backend) are in
docs/user/manage.md.This is the base of a stack. Follow-ups: the rule-editor UI, a GitLab backend, and a Tangled (ATProto) backend.
Checklist
./run-tests.sh osprey_worker/src/osprey/worker/ui_api/osprey/views/tests/test_rule_drafts.py)uv run ruff check .passesuv tool run fawltydeps --check-unused --pyenv .venvpassesCHANGELOG.md