feat(contract): name every op a cmd may carry, and home the app's own codes - #868
Merged
Conversation
… codes The registry gains an ops block — site.mode.set and battery.hold, each with the scope its grant must carry. The pair was hand-written twice, here beside the dispatcher and again in the app's simulator, and nothing compared the copies. The generator now renders the block as RegistryOps and TestRegistryOpsMatchCommandTable holds defaultOps() to it, the same arrangement mode tiers already have. client_errors takes in E_NO_ACK, E_NO_ANSWER and E_BAD_BODY, the three app-raised codes that sat outside the registry. The box generates nothing from that block; the copy changes because the file is one file in two repositories, byte for byte. Contract-pair: srcfl/ftw-webapp@claude/admiring-pike-1cd1cc Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Member
Author
|
App side: https://github.com/srcfl/ftw-webapp/pulls?q=head%3Aclaude%2Fadmiring-pike-1cd1cc — see the PR just opened from that branch. |
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.
Contract-pair: srcfl/ftw-webapp@claude/admiring-pike-1cd1cc
Pairs with srcfl/ftw-webapp#18 — the two copies of
contract/registry.yamlare one file and must merge together.What
Two additions to the registry, mirrored byte for byte on the app side.
An
opsblock.site.mode.setandbattery.holdcrossed the wire as hand-written strings on both sides, and the scope each op demands was written twice more: indefaultOps()beside this dispatcher and again in the app's simulator. Nothing compared the copies. The block now names each op and its scope. The generator renders it asRegistryOps— data, not constants, following theRegistryModeTiersprecedent: generating a constant for an op no code handles yet only invites someone to use it.TestRegistryOpsMatchCommandTableholdsdefaultOps()to the map: every op this box accepts must be declared, with the same scope. Containment rather than equality, deliberately — the registry may name an op ahead of the box.battery.holdis exactly that today: an app may say it, this box rejects it withE_UNKNOWN_OP, andTestAnUnknownOpIsRejectedNotIgnoredpins that answer (its comment now says why that name).Homes in
client_errors.E_NO_ACK,E_NO_ANSWERandE_BAD_BODYare codes the app raises for itself; they sat outside the registry although its header claims every such code has a home there. They now sit besideE_RESPONSE_TOO_LARGE. The box generates nothing from that block and must never send one of them — the copy here changes only because the file is one file in two repositories.Tests
TestRegistryOpsMatchCommandTable— verified red first with a mutated scope in the generated map, then green.go generate ./internal/...re-run;TestContractGenIsCurrentgreen.make verifyran the full suite clean: vet, every Go package, optimizer contract, compose migration.🤖 Generated with Claude Code