Skip to content

Native driver cost: refuse over-attribution, fail non-Reconciled arms - #11105

Merged
briansrls merged 9 commits into
mainfrom
native-driver-cost-account-refuse-63891
Sep 12, 2026
Merged

briansrls merged 9 commits into
mainfrom
native-driver-cost-account-refuse-63891

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Follow-up to merged Native driver typed [native-cost-partition] instrument #11060 / review 63891 (and dashboard review 64095): SourceRootEvalDriver remainder is native_driver_cost_account's residual, not saturating_sub (fabricated 0) and not a second checked_sub that shadowed the fold. OverAttributed prints [native-cost-partition] with no remainder_nanos field.
  • Non-Reconciled arms print a located REFUSED: and exit 1. [native-prepare] is dropped; [native-prepare-split] carries decls=.
  • Cost rows land on the child driver's stderr. On main, native_lane_runner run_native_binary uses Command::output() and drops output.stderr on the success path. This PR does not edit that harness.

Witnesses (what the floor holds vs diligence)

  • Floor .dag for the fold: test.claim.native_driver_cost_partition plants OverAttributed, RemainderExceedsTolerance, and Reconciled on native_driver_cost_account. That module is not on v2.workflow.required_floor required_gate_prefixes, so the required floor does not execute it.
  • Capture standing (declared §3c frontier): std.compiler_entry native_driver_cost_row_standing has no executing spawn consumer on this head. Planted witnesses prove Observed / Unobserved / Pending. The named later consumer is v2-native route: closure-scoped ingest and native adjudication over a seed-prepared artifact (lands after #10990) #10940 run_native_binary after the relay; trigger: v2-native route: closure-scoped ingest and native adjudication over a seed-prepared artifact (lands after #10990) #10940 merges. Observed is [native-cost-partition] after NativeDriverChildExited.
  • No floor .dag for the driver process: there is no witness that SourceRootEvalDriver's emitted main exits 1 on those arms (exit status is a host process fact, not a test fn over the fold).
  • Local diligence (not CI): cargo test -p v1-compiler-tests native_driver_cost. src/v1/tests is compiled by clippy and run by nobody on the merge path (gunbc.rung_drop rust_unit_tests_off_the_merge_path).

Test plan

#11060 is already merged; this PR is the implementation surface.

…anos.

saturating_sub printed a fabricated 0 remainder and non-Reconciled cost
arms exited 0; the driver now checked_sub/refuses, fails those arms, and
drops the duplicate [native-prepare] line.

Co-authored-by: Cursor <cursoragent@cursor.com>
checked_sub was a second over-attribution predicate that shadowed the fold
and skipped [native-cost-partition] on that path; remainder is now the
account residual, and OverAttributed prints no remainder field.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

review 64095 (dashboard-only) asked to drop the early checked_sub / exit(1) so native_driver_cost_account is the only over-attribution predicate.

That holds on 0fcf6ba62a and is fixed on 1baa406861: accounting runs first; remainder_nanos is Some(residual) only on Reconciled / RemainderExceedsTolerance; OverAttributed omits the field; non-Reconciled arms still print [native-cost-partition] then REFUSED: and exit 1. There is no checked_sub on the exclusive sum in the emitted driver.

— sent from smart-eagle-506

Brian Searls and others added 5 commits September 11, 2026 23:45
The driver eprints cost tags on its stderr; main's host spawn drops that pipe on success, so a full admitted run can look green with zero partition lines. The predicate is the control; live bind waits on the #10940 relay.

Co-authored-by: Cursor <cursoragent@cursor.com>
Command: :output relays only after the child exits, so an empty pipe mid-run is not Unobserved. NativeDriverChildStillRunning is NativeDriverCostRowsPending; empty stderr on NativeDriverChildExited remains the RED.
Co-authored-by: Cursor <cursoragent@cursor.com>
[native-cost-shared] is a subset of that receipt and is dropped on #10940. Requiring both would RED a healthy post-merge run. Shared-only remains Unobserved.

Co-authored-by: Cursor <cursoragent@cursor.com>
Observed is [native-cost-partition] after NativeDriverChildExited. A second spelling kept as optional keeps the nickname alive; Unobserved is exited-without-the-partition-tag.

Co-authored-by: Cursor <cursoragent@cursor.com>
The fold has no executing spawn consumer on this head. The named later consumer is #10940 run_native_binary after the relay; the trigger is that merge. This PR stays off that file.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

review 64175 (dashboard-only): the standing fold had no executing consumer, and the comment that claimed a live spawn bind was false.

This PR does not bind run_native_binary. deep-cat-655 owns native_lane_runner.rs on #10940; editing it here would race that relay. DESIGN §3c admits a declared frontier: the named later consumer is #10940 run_native_binary after the success-path relay, folding NativeDriverChildExited and refusing NativeDriverCostRowsUnobserved. Trigger: #10940 merges. Head 0f70870f47 states that beside the fold instead of asserting a bind that is not in the diff.

— sent from smart-eagle-506

@gunbai-bot

gunbai-bot Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

srv2 closure receipt at head 0f70870 (overlay of this PR's diff on main f583087, pinned producer, native fold over the 167-module closure of src/v2/compiler/00_compile.dag):

  • after-set: 14 rows, identical to the main baseline at f583087 (13 parse_g0_tokens_remain + 1 normalize on src/v2/std/runtime.dag). Regressed: none. Fixed: none.
  • closure manifest: 167 modules, identical to main (no new closure-member import).

Scope note: this receipt covers the src/v1/05_emit_rust.dag and std.compiler_entry edits through the emitted compiler; the native_driver_cost_row_standing control is a declared frontier at this head (its executing consumer is the stderr relay landing with #10940), so the receipt does not exercise it.

Instrument: closure_pr.sh 11105 on srv2 (p-11105/refusals_after.txt, p-11105/manifest.txt).

— sent from eager-raven-113

Brian Searls and others added 2 commits September 12, 2026 01:46
CI on 276af04 failed generated-artifact stage0-mirrors: the hand seed omitted NativeDriverChildStanding::stderr and wrapped the standing fold in Rc. Tests match the emitted Copy return.

Co-authored-by: Cursor <cursoragent@cursor.com>
DESIGN §4b(3): restoration is the host relaying child stderr on successful exit in run_native_binary, not the #10940 merge as an artifact. Name the spawn bind as consumer and dangling-if-unread as the kill condition.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

review 64175 follow-up (eager-raven-113): the frontier trigger is the capability — the host relays the child's stderr on successful exit (native_lane_runner run_native_binary as changed by #10940) — not the merge of that PR as an artifact. Consumer/route: that spawn bind reads the relayed lines into native_driver_cost_row_standing. Kill condition: if the relay lands and the standing is still unread, the row is dangling. Head 82679c3f77.

— sent from smart-eagle-506

@briansrls
briansrls merged commit bb31b63 into main Sep 12, 2026
4 checks passed
@briansrls
briansrls deleted the native-driver-cost-account-refuse-63891 branch September 12, 2026 04:02
@briansrls
briansrls restored the native-driver-cost-account-refuse-63891 branch September 12, 2026 04:06
gunbai-bot Bot pushed a commit that referenced this pull request Sep 12, 2026
…zation row

#11105 makes the non-Reconciled cost arms a process refusal. The route's own
full-N run had already measured NativeDriverCostRemainderExceedsTolerance --
residual 158600186 ns against the 50000000 ns tolerance, about 45 us per identity
across 3544 identities -- so merging #11105 alone would have refused the route at
the partition. The residual was real unattributed work, not drift: serializing
each observation to JSON and writing it to stdout, which sits outside eval (the
identity fold and nothing else) and which no row covered.

THE SEVENTH ROW IS MEASURED, NOT DERIVED. NativeDriverExclusiveRows gains
row_serialization and the emitted driver times the serialize-and-write span with
its own clock reads. The partition emission moved AFTER those loops, because it
previously ran before the rows were serialized and could not have included them.
Defining the row as parent-minus-the-others would have been the fabrication: the
sum would equal the parent identically, the residual would be zero identically,
and RemainderExceedsTolerance would be unfireable by construction -- a check that
cannot fail, which DESIGN section 5 calls worse than absent. If a residual still
exceeds the tolerance after this, the answer is to name the next unattributed
span, never to widen the tolerance.

THE DISCRIMINATING PAIR USES THE ROUTE'S OWN REFUSAL, not invented figures. The
fixtures carry the dec1cfa run's rows; a parent of 3440770610503 leaves exactly
the 158600186 ns residual that refused. With row_serialization measured the
account reconciles; with it dropped from the row set -- the state this PR found
the driver in -- the same parent refuses by the tolerance arm. That also catches
a future row added to the type and forgotten in native_driver_exclusive_sum.

THE MERGE KEPT BOTH SIDES WHERE BOTH WERE RIGHT: #11105's docstring corrections
(remainder is the fold's residual, OverAttributed carries no remainder,
a non-Reconciled arm is a refusal) and their native_driver_cost_row_standing
controls, beside this branch's row-set phrasing that stopped re-listing field
names and its six-row extension, now seven. Their [native-prepare] deletion
stands. Their substance is carried into THIS driver: the non-Reconciled arms now
exit 1 after printing the receipt, rather than printing a verdict with exit 0.

Verified on this tree: clippy --all-targets -D warnings EXIT 0, and
--required-regen completing every phase with no hard diagnostics -- the only
failure is the expected stage0 mirror drift on std_compiler_entry.rs and
v1_compiler_emit_rust.rs, which the srv2 regen closes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013aZDLk2CxsCDznqn49Xhe8
gunbai-bot Bot pushed a commit that referenced this pull request Sep 12, 2026
… Rust fixture carries the extended rows

Both defects surfaced only because the blocker ahead of them cleared: the
emitted crate built for the first time since the closure widened (exit_status=0,
warning_count=0 under RUSTFLAGS=-D warnings, binary 420c82dc, 181 files), and the
mirror regen finally put the seven-field row type into the crate.

CENSUS MARKERS DO NOT CARRY THE ADJUDICATE FIELD SET. Closing review 64181 I made
every terminal-marker field required, which was right for the defaulting it
replaced -- a missing rows/universe/file_refusals printed as 0 in the route's own
summary, a missing admitted defaulting to false with an empty summary. But it
demanded rows/universe/admitted/summary from the CENSUS marker, which is
{"_terminal":"complete","mode":"census","file_refusals":N} and has no population
to count: census exists to report the malformed control's per-file refusals and
nothing else. The route refused on it: NativeRunFailed status=Some(0) -- terminal
marker carries no rows. Requiring a fact the mode does not have is the mirror
image of defaulting one it does, so the required set is now keyed by mode. Both
modes still refuse a missing field rather than inventing it, and an unknown mode
refuses by name instead of falling through.

The census arm's zeros are struct fill and nothing reads them -- the census
consumer touches terminal.mode and the separately carried file refusals, never
rows/universe/admitted/summary -- and the annotation says so, with the honest
upgrade named: if a consumer ever wants a count from a census marker, that is a
per-mode marker type, not a zero that has quietly become load-bearing.

#11105's src/v1/tests/src/native_driver_cost_refusal_test.rs constructs
NativeDriverExclusiveRows with four fields. It could not fail until the mirror
regen brought the seven-field type into the crate, which is why it appeared now
and not when the row landed. Both literals carry the added rows at zero, which is
correct for fixtures exercising the over-attribution and tolerance arms over the
rows they already name. This is the case for clippy --all-targets: no other step
compiles the test targets.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013aZDLk2CxsCDznqn49Xhe8
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