Skip to content

Add rule authoring/editing UI backed by the rule-drafts API#403

Draft
julietshen wants to merge 2 commits into
roostorg:mainfrom
julietshen:julietshen/rule-editor-ui
Draft

Add rule authoring/editing UI backed by the rule-drafts API#403
julietshen wants to merge 2 commits into
roostorg:mainfrom
julietshen:julietshen/rule-editor-ui

Conversation

@julietshen

Copy link
Copy Markdown
Member

Stacked on #402. Review that first; this PR's diff will show #402's commits until it merges.

Adds a RuleEditorPage at /rules/new and /rules/edit?path=<file>, built on the rule-drafts API.

  • Rule Builder view: form-based conditions and outcomes compiled to SML client-side, with the vocabulary (features, UDFs, effects) fetched from the running engine. Editing an existing file first round-trips it through /rule-drafts/parse-into-builder; files outside the builder's subset fall back to the Code Editor.
  • Code Editor view: plain SML editing for anything the builder can't represent.
  • Live validation against the engine's AST validator (600ms debounce) with structured inline errors and a missing-imports quick fix.
  • Submit posts to /rule-drafts/submit and surfaces the review URL returned by the configured backend.
  • RulesPage gains an "Add rule" button, per-rule Edit links, and a pending-drafts banner fed by /rule-drafts/pending (soft-fails when no backend is configured).

Security/correctness hardening in the SML generator: backslashes and newlines are escaped (not just quotes) before interpolation, the rule name is constrained to an SML identifier before it reaches the generated file and the submit gate, and switching between Builder and Code Editor now carries content across so a tab flip can't submit stale or empty source.

Checklist

  • pnpm run typecheck, pnpm run lint (0 errors), pnpm run format:check pass
  • Updated CHANGELOG.md

julietshen and others added 2 commits July 2, 2026 10:51
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
New RuleEditorPage at /rules/new and /rules/edit?path=<file>:

- Rule Builder view: form-based conditions and outcomes compiled to SML
  client-side, with vocabulary (features, UDFs, effects) fetched from
  the engine; falls back to a plain Code Editor view for any SML the
  builder subset can't represent (decided via /parse-into-builder)
- Live validation against the engine's AST validator with a 600ms
  debounce, structured inline errors, and a missing-imports quick fix
- Submit posts the draft to /rule-drafts/submit and surfaces the
  resulting review URL; RulesPage gains an Add rule button, per-rule
  Edit links, and a pending-drafts banner fed by /rule-drafts/pending

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VZ4RQtuHCCgurfpjfPXXAM
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 85a67af0-229c-4ce2-a4e4-0813aae9cdde

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant