feat(web): close #701 and #702 — the mark reconciliation pinned, the attestation chip, and a staleness verdict - #744
Merged
Conversation
…attestation chip, and a staleness verdict The three gaps the acceptance audit found. Each was a criterion nothing in the suite could fail on. #701: THE RECONCILIATION WAS DOCUMENTED AND UNPINNED `commands/positions.py` has claimed since it shipped that "THE MARK IS THE RAILS' MARK, AND THAT IS THE POINT", and nothing asserted it. Now both real paths run against one seeded book and the numbers are compared. Writing it found why it needed writing: THE TWO SIDES READ DIFFERENT TABLES. `agent._held_position` derives the holding from FILLED LIVE ORDERS -- the audit log, the same source `guards.py` uses -- while the page reads the `positions` table's tranches. A real cycle writes both. The first cut of the test seeded only the tranche, so the rails saw an empty order log and reported `unrealized` as zero, which is a true statement about nothing. A coarser series is seeded alongside the finest and holds a different close, so the test is about the GRANULARITY CHOICE rather than about there being one candle in the database. The absent case is pinned too, because that is where two implementations of one idea usually part company: the rails contribute zero for a holding valued at cost, the page reports `None` for a figure it has no mark for, and the total is what rail 11 read. #701: THE ATTESTATION CHIP, ON #718's WINDOW The page had a freshness chip and no attestation chip -- the issue asked for both. #718 recorded `attest_due_ts`, `keel doctor` reads it, and the page did not. FOUR states, not a boolean, because the middle two are different facts: absent is `unattested` (which `screen_asset` already REJECTS, so a quiet blank would say the opposite of the gate that governs the holding), a recorded window that has passed is `expired`, one about to is `due`, and `attested` covers both "in date" and "no window recorded" -- which #718 made a legitimate state rather than a missing one. The threshold is IMPORTED from doctor rather than restated: a page warning at one horizon beside a `keel doctor` warning at another would have an operator believing whichever they read last. And every state is WARN or UNKNOWN, never BAD, which is doctor's own choice for this column: an expired window vetoes nothing, and a red chip would tell an operator the opposite. Beside the entry gate, never merged with it. One is a claim about the WORLD and the other about DATA, they disagree in both directions, and a flagged row must say which. #702: A STALENESS VERDICT THAT DOES NOT CRY WOLF ON THIS DEPLOYMENT Every stamp crossed as `moment(...)`, unconditionally NEUTRAL. Nothing compared an as-of against now, so a reading from last week rendered exactly like one from a minute ago -- the page told you WHEN and left you to do the subtraction, which Rule 2 says is Python's job. The obvious threshold is wrong here, and the deployment proves it. The config ships `interval_sec: 900` and the live profile is driven by a wrapper that runs the agent ONCE PER UTC DAY -- the scheduler fires more often and the wrapper decides. A window scaled off the config value alone would mark that deployment stale for about twenty-three and a half hours out of every twenty-four, while it worked perfectly. `agent._finest_granularity` records the identical hazard for the identical reason: a slow series "would spuriously flag a perfectly healthy feed as stale". So the window is three intervals of the LARGER of the configured cadence and the deployment's own observed one -- the MEDIAN gap between recent readings, because a mean would let one week-long outage widen the window permanently. Three rather than two: a single missed cycle is a restart, not a stop. Fewer than two readings is `None`, not "fast": one reading is no cadence, and the honest answer with nothing to compare against is "not known". A deployment that has never cycled is UNKNOWN and never stale -- a reading that does not exist is not an old one. `current` is NEUTRAL and never GOOD. A fresh reading is the ordinary state, and grading it green would make the absence of green read as a fault on every page that has just started. Twelve mutants killed, including: the page marking at a coarser series than the rails, an expired window reading as attested, an absent attestation reading as attested, a NULL window treated as expired, the page inventing its own approaching threshold, the attestation read going per row, an expired attestation graded bad, the stale window ignoring the observed cadence, the cadence using a mean, a never-cycled deployment called stale, a fresh reading graded good, and the badge dropping the age. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KZZxmspQXe5qJ9FAsG13s6
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.
Closes #701. Closes #702.
The three gaps the acceptance audit found. Each was a criterion nothing in the suite could fail on.
#701 — the reconciliation was documented and unpinned
commands/positions.pyhas claimed since it shipped that "THE MARK IS THE RAILS' MARK, AND THAT IS THE POINT", and nothing asserted it. Both real paths now run against one seeded book and the numbers are compared.Writing it found why it needed writing: the two sides read different tables.
agent._held_positionderives the holding from filled live orders — the audit log, the same sourceguards.pyuses — while the page reads thepositionstable's tranches. A real cycle writes both. My first cut seeded only the tranche, so the rails saw an empty order log and reportedunrealizedas zero — a true statement about nothing.A coarser series is seeded alongside the finest and holds a different close, so the test is about the granularity choice rather than about there being one candle in the database. The absent case is pinned too, because that's where two implementations of one idea usually part company.
#701 — the attestation chip, on #718's window
The page had a freshness chip and no attestation chip; the issue asked for both. #718 recorded
attest_due_tsandkeel doctorreads it — the page didn't.Four states, not a boolean, because the middle two are different facts:
unattested(whichscreen_assetalready rejects, so a quiet blank would say the opposite of the gate governing the holding),expired,due, andattested— which covers both "in date" and "no window recorded", a legitimate state #718 made deliberately.The threshold is imported from doctor, not restated: a page warning at one horizon beside a
keel doctorwarning at another would have an operator believing whichever they read last. Every state isWARNorUNKNOWN, neverBAD— doctor's own choice for this column, because an expired window vetoes nothing and a red chip would say otherwise.Beside the entry gate, never merged with it: one is a claim about the world, the other about data, they disagree in both directions, and a flagged row must say which.
#702 — a staleness verdict that doesn't cry wolf on this deployment
Every stamp crossed as
moment(...), unconditionallyNEUTRAL. A reading from last week rendered exactly like one from a minute ago — the page told you when and left you to do the subtraction, which Rule 2 says is Python's job.The obvious threshold is wrong here, and this deployment proves it. The config ships
interval_sec: 900; the live profile is driven by a wrapper that runs the agent once per UTC day — the scheduler fires more often and the wrapper decides. A window scaled off the config value alone would mark that deployment stale for ~23½ hours out of every 24, while it worked perfectly.agent._finest_granularityrecords the identical hazard for the identical reason: a slow series "would spuriously flag a perfectly healthy feed as stale."So the window is three intervals of the larger of the configured cadence and the deployment's own observed one — the median gap between recent readings, because a mean would let one week-long outage widen the window permanently. Three rather than two: a single missed cycle is a restart, not a stop.
Fewer than two readings is
None, not "fast" — one reading is no cadence. A deployment that has never cycled isUNKNOWN, never stale: a reading that does not exist is not an old one. AndcurrentisNEUTRAL, neverGOOD— a fresh reading is the ordinary state, and grading it green would make the absence of green read as a fault on every page that has just started.Gates
E501is pre-existing indocs/experiments/)bad· the stale window ignoring the observed cadence · the cadence using a mean · a never-cycled deployment called stale · a fresh reading gradedgood· the badge dropping the age🤖 Generated with Claude Code
https://claude.ai/code/session_01KZZxmspQXe5qJ9FAsG13s6