Repository navigation
Propose checks from a rule on save, confirmed, edited or rejected by its author - #2669
Merged
Merged
Conversation
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.
Closes #2650
What
The second slice of F-RUL (#2419), RUL-04 with MDL-03: saving a rule proposes checks that enforce it, and the author confirms, edits or rejects each one. It builds on the rule book of #2643 and the job handler conformance suite now in v2.
FluentCMS.Core.Rules):RuleCompilerasks the model on a newrulesprofile.RuleCompileJob(rules.compile) runs the compile as the check engine, on behalf of the person who saved the rule.EngineJobslists it for the check engine. The payload only names the version; whether the job is still that version's compile comes from what is stored. If its last attempt throws, it records the version advisory, so a version never stays compiling.IRuleChecks:rulesprofile is configured, and otherwise an advisory compile at once.RuleCompilationsandRuleCheckProposals, with migrations for SQLite and PostgreSQL; a proposal's definition isjsonbon PostgreSQL.check.createdandcheck.activatedevents, the proposal's decision andrule.check_confirmedcommit together. The examples run before the unit of work, so no model call happens inside it.CheckDirectory.ListActiveAsyncleaves out a check confirmed from a rule while the rule is not active at the version the check was proposed for. So the check run,check_draftand the inline-or-job decision all follow the rule's state.Why
RUL-04 turns a rule's prose into checks the author can trust: the system proposes, a person decides (D17). The next slice labels rules enforced or advisory and gives agents the rule book with its compiled checks, which needs to know which checks serve which rule and version.
Choices worth a look:
replacedrather than deleting them, so a number the author read always names the same proposal. It first moves the compile to its new job, which waits for a compile that is recording at the same time, so that compile's proposals are replaced too.<rule slug>-<number>, not from the model. The author can give another name when confirming.Tests
Unit:
rulesprofile on the author's behalf, with the rule's text and scope only in the data sections.rules.compilepasses the job handler conformance suite.payload_invalid.Integration, each on SQLite and PostgreSQL:
rule.compilednames the model and the prompt hash.The full suite ran locally against a
postgres:17container as well as SQLite, and markdownlint passes. No new package. Tests use a fake model provider: no real model calls, no keys, no network.Checklist
v2