feat(rules): generate and improve rules through the v2 API (0.12.0, stack 2/5) - #412
Open
thecodedrift wants to merge 1 commit into
Open
thecodedrift wants to merge 1 commit into
thecodedrift wants to merge 1 commit into
Conversation
… every served file
This branch has not been deployed
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.
Stack (root → tip):
Stack 2/5 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 slice 5, because the v1 repair insidecheckstill calls them until slice 3 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.Refs TSKL-307