Skip to content

adapter: gate the reversal exit cancel on candidate owners instead of every historical id - #563

Closed
luisleo526 wants to merge 12 commits into
mainfrom
reversal-exit-owner-gate
Closed

luisleo526 wants to merge 12 commits into
mainfrom
reversal-exit-owner-gate

Conversation

@luisleo526

Copy link
Copy Markdown
Collaborator

scratch store: advance_handles consumes handle numbers without creating records

CommandScratchStore::advance_handles(count) reaches the same logical
allocation state as count successful new-key puts followed by erasing
those records: live handles, bytes, count and ordered digest are
unchanged, the state digest includes the advanced allocation counter, and
the work is independent of count. Handle exhaustion fails at the same point
as puts. A property test covers equivalence, transactions, rollback and
the overflow edge.

Co-Authored-By: Claude Sonnet 5.5 [email protected]

adapter: gate the reversal exit cancel on candidate owners instead of every historical id

A reversing entry cancelled the exits of every cohort id the run had ever
seen, which made each reversal cost grow with the number of distinct entry
ids. The cancel now visits only ids that can own a queued exit (pending
bracket legs, COOF requests, shadow rows, relative and anchored legs, live
exit rows), keeps the old sorted owner order, reserves the same scratch
handles through advance_handles, and keeps erasing empty bracket families.
Debug builds check every skipped id against the old per-store predicates.

A public-run test compares the gated path with the retained old loop on
five owner cases (live, empty, COOF, anchored, pending-bound): trades,
report and equity bytes, hash reads and reversal count match, and the
cancel-call count stays zero as distinct ids grow.

Co-Authored-By: Claude Sonnet 5.5 [email protected]

🤖 Generated with Claude Code

luisleo526 and others added 12 commits October 28, 2026 03:18
…ng records

CommandScratchStore::advance_handles(count) reaches the same logical
allocation state as count successful new-key puts followed by erasing
those records: live handles, bytes, count and ordered digest are
unchanged, the state digest includes the advanced allocation counter, and
the work is independent of count. Handle exhaustion fails at the same point
as puts. A property test covers equivalence, transactions, rollback and
the overflow edge.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… every historical id

A reversing entry cancelled the exits of every cohort id the run had ever
seen, which made each reversal cost grow with the number of distinct entry
ids. The cancel now visits only ids that can own a queued exit (pending
bracket legs, COOF requests, shadow rows, relative and anchored legs, live
exit rows), keeps the old sorted owner order, reserves the same scratch
handles through advance_handles, and keeps erasing empty bracket families.
Debug builds check every skipped id against the old per-store predicates.

A public-run test compares the gated path with the retained old loop on
five owner cases (live, empty, COOF, anchored, pending-bound): trades,
report and equity bytes, hash reads and reversal count match, and the
cancel-call count stays zero as distinct ids grow.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The gate tested cohort membership with find(), which runs the implicit spill pass and restores a spilled row into the resident set. DiskResidentIdTable::contains() reads the index alone, so the gate no longer restores or spills any cohort row.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
test_private_fixture_reads pins a token at tests/CMakeLists.txt:3301. The two new registrations added two lines above it and failed that check. The reversal-gate row now replaces one comment line it folds, and the bulk-advance row joins the existing report-failure registration, so the file keeps its line count.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…n-bound manifest

The reversal exit-owner gate replaced the loop that built closed_cohorts, so its stale manifest entry and site records are removed. The gate's new local vectors (the selection scratch rows and the owner list) get open, unreviewed entries: the owner list is bounded by the queued exit rows, not by a constant, so nothing is marked bounded. The site inventory gains the matching records and the matches assignment.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The reversal exit-owner gate adds two manifest entries (the scratch handle selection and the owner list) and removes one stale entry, so the unreviewed count is 1278 against a ceiling of 1277. The ceiling moves to 1278. No site, entry or bound changes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…nt of the real-tree gate test

The real-tree gate test pins the number of open manifest entries. The manifest changed in this branch, so the pinned count moves to the number the gate now reports. No other change.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ling bound

Each applied reversal now checks its exit owners against the logical id table without restoring spilled rows. That probe descends a tree whose depth grows with the number of ids stored, so the 6000-to-24000-bar wall ratio rises a little above the linear 4.0: full release runs on the lab gave 5.02 to 5.06 against the old bound of 5.0, while the same run on main passed. The bound moves to 5.5, which still fails any super-linear growth (a quadratic run gives 16.0), and the comment says why.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… one place

The bound comment now gives the lab measurements (main 4.45 to 4.84, this branch 4.50 to 5.06), says that the log-depth id probe accounts for at most a factor of about 1.16 and that the rest is memory-hierarchy growth and noise, and that 5.5 still fails a quadratic run (16.0). The header line that still said "under 5" points at that comment. Comments only; no code or constant changes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
luisleo526 added a commit that referenced this pull request Oct 28, 2026
…aling, UDT graphs, metrics replay and the CI admission fix (#616)

This lands twelve engine pull requests as one change, verified and measured once on the combined tree:

- #593 scratch: a fixed write-through read cache for the adapter's id tables
- #594 live runner: a delta report stream by default, and report-path work that does not rescan closed trades
- #597 live runner: typed pre-growth stop for the ledger budget and flat pending counts
- #608 run_json: reserve the report channel, so strategy output on fd 1 cannot corrupt a report
- #586 Pine UDT object graphs on the paged object Store
- #578 native order: dormant working book, flat per-point cost for never-filled orders
- #579 adapter: skip roster passes and empty-family scans that cannot change anything
- #599 adapter: read projected pending orders through one cached duplicate index
- #563 adapter: gate the reversal exit cancel on candidate owners instead of every historical id
- #591 report sink: retire sealed closed-trade rows on sink routes when the module opts in
- #596 metrics: stream the bar Sharpe and Sortino through an ordered, packed return replay
- #615 ci: accept release.yml's matrix runner under its fetched path in PR admission

Fixes found while testing the combined tree are in the final commits: the retiring ledger's cache sizing, a residency witness that bounds sink-run heap by the declared cache cap and checks zero growth at 100k, 200k and 1M trades, a test fix for a descriptor reuse race, and a standing-orders timing grid whose 20,000-order point is tracked in #621. The member pull requests are closed as landed here.
@luisleo526

Copy link
Copy Markdown
Collaborator Author

Landed in #616 (squash a991b4e on main), which carries this change with one verify and one parity run on the combined tree.

@luisleo526 luisleo526 closed this Oct 28, 2026
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