Skip to content

Commit 8a44f0c

Browse files
committed
fix(create-spec): correct the stateful impact claim, add Phase 10a re-run
Three corrections found by re-checking claims I had asserted rather than verified. 1. stateful is NOT read on the subscription path either. check_stateful.sh told the reader a stateful: 0 write "goes to a single provider instead of all of them". For a SUBSCRIBE-tagged method that is wrong, and wrong the same way the hanging_api claim was: GetStateful is unreachable from the subscription path. It appears in rpcsmartrouter_server.go, recovery_probe.go, unified_relay_state_machine.go and common.go -- and in neither subscription manager, exactly like GetRelayTimeout. But it does not follow that the flag is inert there, which is where this differs from hanging_api. ApiHasStatefulCategory (base_chain_parser.go:549, reached via rpcsmartrouter_server.go:456) looks the method up by NAME, independent of transport, and the cross-validation policy guard uses it to reject an enabled per-method CV policy on a write. So the write list still FAILs on subscription methods rather than short-circuiting them the way check_hanging_api.sh rule 1 does -- hanging_api has no equivalent name-keyed reader, stateful does. The message and header now say precisely which effects are unary-only and which are not. 2. Phase 10a: re-run the offline gates after the fixer. Gate 9 runs in Phase 6, before Phase 10. The only post-fix validation was `jq .`, so any defect the FIXER introduces shipped unguarded -- and the fixer is the step most likely to introduce these, because it applies field-level instructions without surrounding context. check_hanging_api.sh rule 3 is the clearest case: told only "a hanging API needs a timeout_ms", the natural response is a flat 30000, which on a CU-1000 method shortens the relay budget instead of lengthening it. That is the mistake made by hand while writing MAG-3389, and the guard against it could not fire where it mattered. Phase 10a re-runs check_method_schema, check_hanging_api, check_stateful and check_unused_fields, all offline and sub-second. It also finally wires check_disabled_count.sh (PR #133), which was left unwired for precisely this timing reason. 3. "Every FAIL is a genuine defect" was overstated. monad and optimism carry eth_sendTransaction at enabled: false, so those 2 of the 29 rows are latent, not live. Corrected to 27 live and 2 latent -- the same distinction that applies to a disabled method anywhere. Also: a rest collection with no collection_data.type could not match a verb-keyed curated entry and skipped both lists in silence. Every rest collection in the catalogue currently has one; if that ever stops being true it now emits an INFO row instead of passing quietly. All 16 suites pass.
1 parent b3497d7 commit 8a44f0c

3 files changed

Lines changed: 48 additions & 3 deletions

File tree

‎.claude/skills/create-spec/SKILL.md‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,26 @@ echo "jq exit: $?"
547547
548548
If exit non-zero: outcome = `BROKEN_AFTER_FIX`. Present the snapshot path (`/tmp/spec_<chain>_pre_fix.json`), the `jq` error, and the fixer's diff to the user. STOP. Do not proceed to Phase 10b.
549549
550+
### Phase 10a — re-run the offline static gates
551+
552+
Valid JSON is not the same as a valid spec. The Phase 6 gates ran **before** the fixer, so any defect the fixer itself introduces is unguarded — and the fixer is exactly the step most likely to introduce these, because it applies field-level instructions without the surrounding context:
553+
554+
- *"`hanging_api: true` needs a `timeout_ms`"* → a reflexive `timeout_ms: 30000` on a CU-1000 API **shortens** the relay budget, because `timeout_ms` replaces the CU term rather than adding to it. This exact mistake was made by hand while writing MAG-3389.
555+
- *"disable the methods that failed the probe"* → a disabled count that no longer matches the PR body's claim.
556+
- A `stateful` flipped on the wrong side of a fix.
557+
558+
These four scripts are offline, take under a second each, and need no network:
559+
560+
```bash
561+
for check in check_method_schema check_hanging_api check_stateful check_unused_fields; do
562+
bash .claude/skills/create-spec/scripts/$check.sh <chain>.json \
563+
|| echo "POST-FIX GATE FAILED: $check"
564+
done
565+
bash .claude/skills/create-spec/scripts/check_disabled_count.sh <chain>.json --expect <N>
566+
```
567+
568+
Any FAIL row here is a fixer-introduced regression, not an original defect. Feed it back as a CRITICAL item and re-run the fixer on that item alone — do not carry it into Phase 10b. `check_stateful.sh`'s `=== INFO ===` rows are advisory and never block.
569+
550570
## Phase 10b — Smoke regression test (delegated subagent)
551571
552572
Same delegation pattern as Phase 8 — a single `general-purpose` subagent re-boots the dockerized smart-router against the FIXED spec on disk and re-probes a deterministic minimal set to detect regressions. The orchestrator does NOT run docker or compare classifications inline.

‎.claude/skills/create-spec/TESTING.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ Unlike `hanging_api` this cannot be settled from the router source — *"does th
251251

252252
REST entries are keyed `"TYPE /path"` where the verb disambiguates: `GET /cosmos/tx/v1beta1/txs` is a query, `POST` to the same path is BroadcastTx. The verb resolves a name collision — it does **not** classify. Treating POST as "is a write" is precisely the bug that put four read endpoints on the write path in `cosmossdk.json`.
253253

254-
Calibration over the 140-spec catalogue: **29 FAIL rows in 16 specs, 11 INFO rows** — every FAIL a genuine defect (the 10 specs with the watch pair at `0`, `babylon`/`kava`/`sei` on `decode/amino`, `monad`/`optimism` on `eth_sendTransaction`, and `cosmossdk`'s four REST reads).
254+
**These two scripts also run again in Phase 10a**, after the fixer. Gate 9 fires in Phase 6, *before* any fix is applied, so a defect the fixer introduces would otherwise ship unguarded — and the fixer is the step most likely to introduce exactly these, since it applies field-level instructions without surrounding context. `check_hanging_api.sh` rule 3 is the clearest case: told only *"a hanging API needs a `timeout_ms`"*, the natural response is a flat `30000`, which on a CU-1000 method shortens the budget rather than lengthening it.
255+
256+
Calibration over the 140-spec catalogue: **29 FAIL rows in 16 specs, 11 INFO rows** — every FAIL a genuine defect (the 10 specs with the watch pair at `0`, `babylon`/`kava`/`sei` on `decode/amino`, `monad`/`optimism` on `eth_sendTransaction`, and `cosmossdk`'s four REST reads). Two of the 29 — `monad` and `optimism`'s `eth_sendTransaction` — are `enabled: false`, so they are latent rather than live; the other 27 are on enabled methods.
255257

256258
**Scope.** Candidate file only, which is how the pipeline uses it. 152 APIs across ~30 established specs (`ethereum`, `cosmossdk`, `tendermint`, `solana`, `kusama` …) predate rule 2 and would fail if it were run over the whole repo; that is a separate cleanup, tracked in MAG-3389, not this gate's job.
257259

‎.claude/skills/create-spec/scripts/check_stateful.sh‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@
1212
# stateful: 0 on a write -> the broadcast goes to ONE provider. No
1313
# multi-provider redundancy on the path where it
1414
# matters most. (avt/bsx, MAG-3389.)
15+
#
16+
# Scope caveat, verified: the per-relay effects above are UNARY-ONLY. Like
17+
# GetRelayTimeout, GetStateful is unreachable from the subscription path --
18+
# it appears in rpcsmartrouter_server.go, recovery_probe.go,
19+
# unified_relay_state_machine.go and common.go, and in none of the
20+
# subscription managers. So on a SUBSCRIBE-tagged method such as
21+
# author_submitAndWatchExtrinsic, provider fan-out does NOT depend on this
22+
# flag. What does still read it there is ApiHasStatefulCategory
23+
# (base_chain_parser.go:549, via rpcsmartrouter_server.go:456): a lookup by
24+
# method NAME, transport-independent, used by the cross-validation policy
25+
# guard to reject an enabled per-method CV policy on a write. That is why
26+
# the write list still FAILs on subscription methods rather than skipping
27+
# them the way check_hanging_api.sh rule 1 does -- hanging_api has no
28+
# equivalent name-keyed reader.
1529
# stateful: 1 on a read -> every read is fanned out to all providers, billed
1630
# accordingly, and loses cross-validation.
1731
# (cosmossdk's simulate/encode/decode, MAG-3389.)
@@ -151,12 +165,21 @@ while IFS=$'\t' read -r idx iface ctype name st; do
151165
[[ -z "$name" || "$name" == "null" ]] && continue
152166
ROW="$idx/$iface/$name"
153167
KEY="$name"
154-
[[ "$iface" == "rest" && -n "$ctype" && "$ctype" != "-" ]] && KEY="$ctype $name"
168+
if [[ "$iface" == "rest" ]]; then
169+
if [[ -n "$ctype" && "$ctype" != "-" ]]; then
170+
KEY="$ctype $name"
171+
else
172+
# No verb to key on, so a curated REST entry cannot match and the row would
173+
# skip both lists in silence. Every rest collection in the catalogue
174+
# currently carries a type; say so out loud if one ever does not.
175+
INFO+=("$ROW|rest collection has no collection_data.type, so verb-keyed write/read rules cannot be applied to it — check this method's stateful by hand")
176+
fi
177+
fi
155178

156179
# 1. curated write list
157180
if in_list "$KEY" "${WRITE_METHODS[@]}" || in_list "$name" "${WRITE_METHODS[@]}"; then
158181
if [[ "$st" != "1" ]]; then
159-
FAIL+=("$ROW|broadcasts a transaction but stateful=${st}; must be 1, or the write goes to a single provider instead of all of them")
182+
FAIL+=("$ROW|broadcasts a transaction but stateful=${st}; must be 1 — it gates write routing on the unary path (GetSessions / CONSISTENCY_SELECT_ALL_PROVIDERS) and the cross-validation policy guard (ApiHasStatefulCategory), a name lookup that applies on every transport including subscriptions")
160183
else
161184
PASS+=("$ROW|write, stateful=1")
162185
fi

0 commit comments

Comments
 (0)