Skip to content

row 155: the usage-tap fault latch leaves the contract; the door returns the fault beside its units and the kernel counts it - #1030

Merged
MattJackson merged 7 commits into
predevfrom
lane-p3-llm-codec-tap-latch
Oct 14, 2026
Merged

MattJackson merged 7 commits into
predevfrom
lane-p3-llm-codec-tap-latch

Conversation

@MattJackson

@MattJackson MattJackson commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Row 155 (lane-p3-llm), coordinator/contract-ABI ruling. busbar-contract is the ABI's home of shapes and holds no state (BUSBAR-1.6.0.md Part 4; spec l.3701: "Services are reached only through the host tables handed at open"; l.4589: no static/OnceLock in the contract). This PR removes the usage-tap fault latch from crates/busbar-contract/src/codec.rs: USAGE_TAP_FAULT_REPORTER and USAGE_TAP_FAULT_LATCH.

Base: predev. This PR does not need #1028's CodecHost threading. It does rewrite the OperationHandler::extract_usage signature hunk that draft #1028 also edits (#1028 adds host). Rule 23 applies because #1028 is a draft: whichever of the two lands second adds the other's change to the signature.

The seam (ruling: counted kernel-side from the door's return)

  • Contract: the statics are gone, along with install_usage_tap_fault_reporter, install_usage_tap_fault_latch, report_usage_tap_decode_failure, usage_tap_fault_should_warn and both fn-pointer types.
    • codec::UsageTapFault (Decode / BadJson / UnknownProtocol, each with its reason() label) is the fault as data.
    • OperationHandler::extract_usage now returns Result<Option<TokenUsage>, UsageTapFault>. The default and the chat cell return the fault and report nothing.
  • Plane ABI: OnPieceOut::tap_fault: u8 (TAP_FAULT_NONE/DECODE/BAD_JSON/UNKNOWN_PROTOCOL), next to the units the answer reports.
    • It is laid in the padding after fault, the way fault itself was laid after need (pre-tag v1). Size stays 216. Only _fault_reserved moves (181 to 182, [u8;3] to [u8;2]).
    • A closed enum (coordinator condition): 0 = none, then the named reasons. check_on_piece refuses a fault only on a non-READY answer. The kernel reads any other value as reason="unknown" (UsageTapFault::reason_of): counted and warned once, never ignored and never read as none.
    • Layout change is pre-release at the unchanged plane ABI version (accepted). The golden and the header are updated in this PR.
    • check_on_piece accepts only a known code, and only on a READY answer. The layout golden and the C header are updated by hand, exactly as the generator renders them.
  • Door (busbar-plane-llm): the relay's end keeps the tap's fault, and so do Piece and the door's Answer. deliver writes it with mem::take, like the breaker reading, so it goes out on ONE window of the answer however many windows the reply takes.
  • Linked engine (busbar-llm, the default build's llm path): it drives the plane's Relay itself, so its stream end hands end.tap_fault to busbar_kernel::handlers::usage_tap_fault under the relay's ingress dialect. The import rides the engine's existing busbar_kernel::handlers line, so the ports-only count is unchanged.
  • Kernel: the route driver reads tap_fault off each READY answer and calls the steps' new usage_tap_fault(ctx, dialect, reason) (DriverSteps/AttemptSteps). The root's DoorSteps maps the dialect index to its name and calls busbar_kernel::handlers::usage_tap_fault(protocol, reason).
    • That function makes the same busbar_billing_tap_decode_fail_total{protocol,reason} increment, one per fault, and uses the same process-wide warn-once set (usage_tap_decode_fail_should_warn). The route tests also pin an unknown byte read as unknown.
  • Hot vtable: the tap_fault_latch slot stays in the layout but is retired. SERVICES no longer serves it, arm no longer installs it, and the REASON_CAP/kept interning that existed only for it is deleted.

Bytes and counts unchanged

  • Wire bytes and billed units are unchanged. A tap fault still bills what it billed: the same fallback to read_response, the cut-short reported usage, or the floor.
  • The counter name, labels and increments are unchanged: one per fault, under the same three reasons.
  • Logs: the warn-once line is now the kernel's (USAGE_TAP_DECODE_FAILED, with protocol and reason). The codec's own coded line (USAGE_TAP_BAD_JSON / UNKNOWN_PROTOCOL / DECODE_FAILED) now logs per request at debug. The diagnostic catalog is untouched.

RED

  1. codec::UsageTapFault's compile_fail doctests: report_usage_tap_decode_failure(..) and usage_tap_fault_should_warn(..) no longer exist, so the contract holds no such port or static.
  2. crates/busbar-plane-llm/tests/conformance.rs::a_usage_tap_fault_rides_one_window_of_the_doors_answer: the linked AND the dropped-in door relay a non-JSON same-dialect 2xx through a 16-byte reply window. Exactly ONE window carries tap_fault=TAP_FAULT_BAD_JSON, so the kernel, which counts each answer's fault, counts it once. The transcript line now prints tap_fault=.
  3. Door to kernel counter: busbar-kernel/tests/support/plane_driver_cases.rs::a_usage_tap_fault_the_door_returns_reaches_the_kernel_counter. It drives the kernel double and the LINKED and DROPPED test plane through the one loop. A door answering a bad_json fault, and one answering a byte outside the vocabulary, each reach busbar_billing_tap_decode_fail_total once per unit, under bad_json and unknown. An answer carrying none counts none.
  4. busbar-kernel/src/plane_driver/tests/route_tests.rs::an_answers_usage_tap_fault_reads_as_the_reason_the_kernel_counts and proto/tests/installed_tests.rs::a_usage_tap_fault_counts_one_increment_under_its_reason: one fault is one increment, under its reason, warned once.
  5. abi/tests/plane_check_tests.rs::a_usage_tap_fault_rides_only_a_ready_answer: a fault on a non-READY answer is refused, and a code past the vocabulary is admitted (counted as unknown).
  6. codec/tests/usage_tap_count_tests.rs: each tap path returns its own fault. The test host arms no latch.
  7. The contract-stateless gate: a static put back is a NEW finding.

Ledger (before → after)

  • qa/contract-stateless.toml: 44 → 39 rows. Struck:
  • qa/abi-freeze.toml: crates/busbar-contract/src/abi/hot 6224 → 6100 lines. The latch slot's host and plane halves and their test are deleted.

Overlap (rule 20)

Nothing was run locally (cargo fmt only); ModernCI is the proof.

… beside its units and the kernel counts it

The codec's USAGE_TAP_FAULT_REPORTER and USAGE_TAP_FAULT_LATCH statics, their install and report
ports, and the hot vtable's tap_fault_latch service are gone. OperationHandler::extract_usage returns
the fault (UsageTapFault: decode, bad_json, unknown_protocol) as data; the llm door carries it on
OnPieceOut::tap_fault (laid in the padding after fault, pre-tag v1, size unchanged), once per answer;
the kernel's route driver hands it to the steps, and the root counts it on
busbar_billing_tap_decode_fail_total{protocol,reason} under the unit's dialect and warns once per
(protocol, reason).

qa/contract-stateless.toml 44 -> 39 rows (codec.rs USAGE_TAP_FAULT_LATCH, USAGE_TAP_FAULT_REPORTER;
services.rs KEPT, FILLING, once-cell OnceLock). qa/abi-freeze.toml hot 6224 -> 6100.
…he kernel's count too

The default build serves the llm plane through busbar-llm's engine, which drives the plane's Relay
itself: its stream end now counts end.tap_fault through busbar_kernel::handlers::usage_tap_fault
under the relay's ingress dialect, the same increment the contract latch made before. The import
rides the engine's existing busbar_kernel::handlers line (ports-only count unchanged).
…T_NONE by path; the kernel test sits mid-file)
…ther value as reason=unknown, and a door's fault reaches the kernel counter (RED)

Coordinator conditions on the #1030 seam: OnPieceOut::tap_fault is 0 = none plus the named reasons;
check_on_piece no longer refuses a value past the vocabulary (only a fault on a non-READY answer),
and UsageTapFault::reason_of reads any other value as reason="unknown", counted and warned once,
never ignored and never read as none. RED: plane_driver_cases' a_usage_tap_fault_the_door_returns_
reaches_the_kernel_counter drives the kernel double and the linked and dropped test plane through
the one loop: a door answering a bad_json fault, and one answering an unknown byte, each reach
busbar_billing_tap_decode_fail_total once per unit under their reason.
…hrough busbar_kernel::handlers::usage_tap_fault, the same kernel counter path; merged origin/predev
…t (the call names it by path); merged origin/predev
@MattJackson
MattJackson merged commit bad5943 into predev Oct 14, 2026
1 check passed
@MattJackson
MattJackson deleted the lane-p3-llm-codec-tap-latch branch October 14, 2026 18:16
MattJackson added a commit that referenced this pull request Oct 14, 2026
qa/abi-freeze.toml conflicted on the abi/hot row: base 6224, predev 6100 (-124, its own hot drains:
services.rs, host.rs and their tests), this branch 5965 (-259, the shapes moved to abi/shared.rs).
The two drains touch different files, so both deltas apply: 6100 + 5965 - 6224 = 5841. The merged
tree measures that exactly (every line of every file under abi/hot, counted by hand, since xtask is
not run on the laptop). The cold row is unchanged at 272: neither side touched it.

The decl.rs stub waivers stay as #898 re-keyed them: predev did not touch decl.rs, so those lines
did not move.
MattJackson added a commit that referenced this pull request Oct 14, 2026
…: both sides' hunks kept

- crates/busbar-contract/src/abi/plane/check.rs: the import list carries #787's MAX_METRIC_LANES,
  ROUTE_CARRIES_OWN_TOKEN, ROUTE_SCOPE_LOCAL and TAIL_REFUSED_PIECE with predev's TAP_FAULT_NONE.
- crates/busbar-kernel/src/plane_driver/route.rs: the Answer copy carries #787's metric_pool,
  metric_lane and wait_member with predev's tap_fault (OnPieceOut holds all four: tap_fault in the
  old padding byte, the spans appended; the layout golden and header agree at 181/182 and 216..240).
- crates/busbar-kernel/tests/common/mod.rs: TestUnits keeps #787's `resolved` and predev's
  `tap_faults`; its one DriverSteps impl answers both `resolved` and `usage_tap_fault`.

Stale-copy check over every file either side changed since 1d111f2: a file only one side
changed is that side's copy exactly, and no file both changed fell back to the base or to one
side alone.
MattJackson added a commit that referenced this pull request Oct 15, 2026
- busbar-plane-llm tests: WholeCtx and ReplyCtx initializers state translate_cap (the default
  cap, as the in-crate tests already do), the reply rig's Piece copy carries tap_fault, and the
  dialect's auth-failure status is already a u16 (no as_u16) (#1030/#1031 against the rehomed
  exchange tests).
- busbar build.rs: a test-linked door row's module is the one its plane-door row names in
  linked-entry (busbar_plane_a2a::agent_door, busbar_plane_mcp::plane_door), not an assumed
  <crate>::plane_door (E0433 in out/test_linked.rs after FLIP-A2A).
- root serve_door_far: the far end's conn::Piece states declared_len (#1032).
- root serve_tests session_door: DoorReach takes its secret seam as a shared Arc (#787's
  per-hop credential re-resolution).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant