Repository navigation
feat(rules): generate and improve rules through the v2 API (0.12.0, stack 2/6) - #412
Conversation
|
@claude /review |
|
Claude finished @theCodeDrift's task in 6m 29s —— View job Review completeReview mode: incremental — read 0 prior review thread(s) before reviewing.
SummaryThis slice moves Three things worth a look, left as inline comments on
Nothing else stood out as a correctness, security, or test-coverage gap: path-safety, case-folding, symlink handling, and directory-replacement semantics in |
… every served file
…fuse a generated status with no revisions request_not_found on poll names the CLI's own request id, never a rule id, so RULE_NOT_FOUND's remedy (re-check the directory name) was wrong; the remedy is to resubmit. A generated status without revisions threw a raw TypeError; it is now an invalid response, not a silent zero-rule success.
2a153e4 to
52f441f
Compare
All three findings are answered in their threads: the — AI Coding Agent |
Stack (root → tip):
Stack 2/6 of the v2 rule API migration. It merges down into #411, which reaches
mainonce, carrying the whole stack. See #411 for why.What changes
rule create/rule improveuse v2 generation (rules/generate.ts). The CLI submits, polls byrequestId, then fetches each produced rule's head byruleId. The head is fetched withoutrevision=, so a Free plan is never refused for a rule it just generated. Every rule is verified before any is written, so one bad rule leaves the tree untouched.rules/verify-delivery.ts). The servedrevisionIdmust match the one polling reported, and a runtime set'ssignaturemust equal itscheck.tsentry. Anything else refuses the whole rule..tests/included (the rules team confirmed fixtures always ship). Parent directories are created as files are written.--jsonconsumers:rule create --jsonprintsrequestIdplusrules(the rule ids, which are directory names), and no longer printsruleId, which always held the request id.rule improve's inputruleIdis the directory name.404 rule_not_foundbecomesRULE_NOT_FOUND.failedorunsupportedprints the server'serroras given, with control characters stripped.create-remote-rule,improve-rule,rule-meta, and theruleindex now say the rule id is the directory name and is never the request id. Each topic version is bumped.The v1 single-
contentwriters stay until #415, because the v1 repair insidecheckstill calls them until #413 removes it.Tests
The command-level tests now drive the real command against a stubbed v2 server (
test/support/v2-server.ts), which signs served sets with the CLI's own hash. The #280 envelope guard now covers a tampered served rule. New tests cover:failederrorRULE_NOT_FOUNDon improvepnpm typecheck,pnpm lint, and the full suite (110 files, 1,852 tests) pass.Review fixes
request_not_foundwhile polling reportsNETWORK_ERROR, with a message to resubmit. That id is the CLI's own request id, never a rule id, soRULE_NOT_FOUND's remedy ("re-check the directory name") was wrong.generatedstatus with norevisionsis reported as an invalid response instead of a rawTypeError. It deliberately doesn't fall back to an empty list, which would report a successful delivery of zero rules.Refs TSKL-307