Skip to content

D3 — three verdicts, so the headline cannot say yes to a trader the answer is warning about - #26

Merged
napkinstack-agent[bot] merged 12 commits into
mainfrom
d3/three-verdicts
Sep 23, 2026
Merged

napkinstack-agent[bot] merged 12 commits into
mainfrom
d3/three-verdicts

Conversation

@napkinstack-agent

@napkinstack-agent napkinstack-agent Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

D3 — three verdicts, so the headline cannot say yes to a trader the answer is warning about


Module

modules/screening — exactly one.

  • This pull request touches a single module
  • ⚠️ Cross-module

Deliverable

Deliverable: D3

What it changes

The command answered COPYABLE or NOT COPYABLE, and the middle case had nowhere to go: a
trader whose fee burden the same answer was warning would decide the member's result still got a
headline saying yes, and an exit code of 0 with it.

Three verdicts now, and four exit codes ordered by severity (PDR-0002, accepted here):

Verdict Exit
COPYABLE 0
COPYABLE WITH RESERVATIONS (…) 1
NOT COPYABLE (…) 2
no verdict — nothing on stdout, the reason on stderr 3

The reservations — fees, reproducibility, concentration, extrapolation — are named in
the headline
, so the first line alone is actionable. The renumbering is a breaking change to
this command's interface, made now, before anything consumes it, so that a script keeping the
idiom it already has — if code == 0 — stops getting a zero for a trader the command was
warning it about.

Four amendments to PDR-0002 ride with it, and the last three exist because verification
refused the branch:

  1. The extrapolation ceiling. A 30-day question answered from 2.4 hours of fills is stretched
    by a factor of 319, and the answer printed 125.34% of their ticket per month in fees as
    though it were a measurement. extrapolation became the fourth reservation past 3×, and
    past 30× there is no verdict at all — the ceiling is checked before any verdict is formed,
    the floor included.
  2. NO VERDICT is the name of an absence, and the absence is what is printed. Empty stdout,
    the reason on stderr, exit 3. The behaviour was already this; what was wrong is that a README
    had restated an acceptance criterion on the author's own authority. Asked directly, the
    decider kept the behaviour, and the decision is recorded where decisions live.
  3. What "nothing on stdout" promises, and what it cannot — with its own corrections, twice. See
    the verification section.
  4. --help is the exception, and the only one — named in the PDR at last, having been in the
    README since the table was written.

Oracle

  • The success criterion was written before the implementation — D3's six acceptance
    criteria were fixed when cycle 02 was framed
  • It was seen failing, for the right reason — every fix commit on this branch records the
    revert it was measured against, verified before the run rather than assumed
  • It passes now — all 32 rows of the sheet below, at the head commit

Kind of oracle: unit test · fitness function · explored against the live venue


Review budget

  • Lines changed (excluding generated): 1171 (1144 added, 27 removed)
  • Files touched: 9
  • Within budget
  • ⚠️ Over budget — label applied.

Justification. Indivisible at the seam that matters: every intermediate point is an exit-code
scheme that means two things at once. Splitting the third verdict from the renumbering would
merge a state where COPYABLE WITH RESERVATIONS returns the same 0 as COPYABLE, which is the
defect this deliverable exists to remove.

For the reviewer's attention budget: 596 lines are tests, 282 are the PDR and the READMEs,
and 291 are behaviour across cli.py, model.py and verdict.py. Seven of the twelve
commits are answers to verification findings, and each is readable on its own. The last three
commits change no code at all
— git diff 6109baa..HEAD -- modules/screening/src modules/screening/tests is empty, verified blob by blob by the verifier at each head.


Contracts

  • No contract affected

Verification — six runs, five refusals, and what they were all about

Under ADR-0003, a high read-only module gets one adversarial round; this branch had six
before that rule existed, and what follows is the confirmation run at the head, which the ADR says
is not a round. Five earlier confirmation runs refused this branch. Each found something real,
each is recorded here, and they were all one class: a statement asserted more absolutely than
the thing it describes.
The first three were the code making that mistake. The last two were the
document.

At What it found Closed by
b41e6f6 httpx.Client was built one line outside the try guarding the reads. https_proxy=socks5://… without socksio, or SSL_CERT_FILE naming a missing file, killed the command with exit 1 — which this deliverable made mean COPYABLE WITH RESERVATIONS — on an empty stdout. A configuration error returned a qualified yes about a trader whose fills were never read 4dd1230
71acb63 The backstop's own reporting print was unguarded: a broken stderr pipe raised BrokenPipeError out of it and the process exited 1 again; and 2>&- closes fd 2, so sys.stderr is None and print(file=None) wrote the reason to stdout, 59 bytes under exit 3 7fd0914
7fd0914 argparse.error calls print_usage(sys.stderr), which substitutes stdout when that is None: six ordinary malformed command lines put 46 bytes of usage: … where the verdict goes. The previous commit's guard covered every write in that file, and argparse is not in that file 6109baa
6109baa Three claims in the amendment written in that same commit: PYTHONINSPECT replaces the exit code and only the finaliser's 120 was excluded; the "undeliverable verdict → 120" sentence missed that the command's own 3 is the common case; guarantee 3 was absolute where input validation is a follow-up 3483b26
3483b26 The correction reached for an absolute again — stdout genuinely empty is true when an encoder refuses the answer whole, false when a reader closes a pipe partway and the bytes already written stay. And guarantee 1 still said no partial answer under an antecedent the amendment itself had just split e0af8e6
e0af8e6 Guarantee 1, correctly narrowed to no verdict formed, still listed not a usage line — and --help forms no verdict and writes 451 bytes of usage to stdout. Older than the branch; the narrowing is what pulled it into view 2d9fee9

The fix that ended the sequence was not another clause. At e0af8e6 the guarantees gained one
sentence above all three: they speak about what the command chooses to write; bytes already
handed to the operating system, before a reader went away or a stream refused the rest, are not a
choice.
That closes a family instead of an instance, and the verifier then bounded it rather
than accepting it — enumerating the module's writes statically, instrumenting 18 paths with a
recording sys.stdout, and cross-checking bytes at the descriptor. Exactly two origins exist: the
render, after a verdict, and argparse's help action. Both are now named in the document. That is
row 32, and it is the reason there is no seventh instance of this family to find.

What the record says about the author. Several of the defects on this branch were introduced by
the author inside later fixes, and the reason the first survived six rounds is worth reading twice:
all 20 main(...) calls in the suite passed client=, so the single line an administrator's
own invocation runs was exercised by no test at all. Seventy-five green tests were green on a path
nobody takes. Four of the six refusals were then about sentences rather than code — the same habit,
moved into prose. That is what ADR-0002 and ADR-0003 were written about, and this branch is the
evidence for both.


Definition of Done

  • Oracle green
  • Lint, format, types — nstack check screening, exit 0, read on its own exit status
  • Unit tests — 81 passed, nstack test screening exit 0
  • Build — n/a
  • Contract tests — n/a, no contract
  • Fitness functions — nstack fitness exit 0, compliant
  • Integration tests (per risk) — live against the venue, row 29
  • Security analysis — the client carries no credential and cannot sign (ADR-0002); the module
    authenticates nowhere and reads only public endpoints
  • Accessibility — n/a, no UI
  • E2E on critical journeys — the administrator's whole journey is this one command
  • Observability added — not done. Recorded as a follow-up, carried from cycle 01
  • Rollback verified — n/a, nothing is deployed
  • Affected documentation updated — PDR-0002's four amendments, the module README
  • Diff self-reviewed line by line

Test sheet

Scenarios from D3's six acceptance criteria, written before the code, plus the attacks the
confirmation runs built on top of them. Filled in by a delegated verifier session under
ADR-0002, not the author, at the head commit. Fixtures are the verifier's own, written from
scratch on httpx.MockTransport; none of the author's were imported or trusted. Exit codes were
read without a pipe, except where a pipe is the attack, and then from PIPESTATUS[0].

Verifier: session ad21b91a7adfcf8d5

Plainly, about that identifier. The harness gives a delegated session no session id of its
own: CLAUDE_CODE_SESSION_ID in its shell holds the parent's, which is the Agent-Session
trailer on every commit here, and it refused to sign with it. The string above is the identifier
the harness assigns the delegation, which the verifier established from the harness's own record
of the run. It is not the same kind of identifier T2 compares against. See the signal at the end.

# Given · when · then Kind Result Evidence Commit
1 Given the claim that this commit touches nothing outside the decision record · when the trees are compared · then only the PDR moved explored passed git diff e0af8e6..2d9fee9 -- modules/ returns 0 bytes; --name-only lists only docs/pdr/0002-three-verdicts-not-two.md, +11 lines; ls-tree -r over the whole repo with docs/ excluded diffs clean 2d9fee9
2 Given --bogus, no args, address only, --ticket with no value, --ticket 500 alone, an extra positional · when run with >out 2>&- · then exit 3 and out is 0 bytes explored passed 6 shapes x 20 repetitions = 120 runs through the installed console script, deviations from (exit 3, 0 bytes) = 0 2d9fee9
3 Given --help and -h · when run · then the usage is on stdout, exit 0, stderr empty explored passed both exit=0 stdout=451B stderr=0B, first line usage: screening [-h] --ticket TICKET address 2d9fee9
4 Given a usage error and a working stderr · when run · then it explains itself on stderr and writes nothing to stdout explored passed --bogus and no-args 120 B on stderr, address-only 111 B, all three stdout=0B 2d9fee9
5 Given a sys.stderr whose write raises RuntimeError, TypeError, ValueError or OSError, or which has no write, or whose write returns None · when run on the parser and venue routes · then no code that names a verdict explored passed 6 hostile objects x 2 routes = 12 runs, every one exit=3 stdout=0B, flush left intact so the finaliser is not involved 2d9fee9
6 Given sys.stderr replaced by None · when a malformed command line is parsed · then exit 3 and nothing on stdout explored passed exit=3 stdout=0B; this is the route that put 46 bytes of usage on stdout at 7fd0914 2d9fee9
7 Given fd 1 closed, and fd 1 and fd 2 both closed · when run on the parser and venue routes · then exit 3 explored passed 4 combinations all exit=3; with fd 1 closed and fd 2 open the reason still reaches stderr, 120 B parser and 59 B venue 2d9fee9
8 Given fifteen ordinary environment variables covering proxy, TLS, warnings, dev mode, output encoding, COLUMNS, TZ, optimize, verbose and locale · when run on both no-verdict routes · then exit 3 and 0 bytes on stdout explored passed 15 variables x 2 routes = 30 runs, zero deviations from (exit 3, 0 bytes); this is the class that produced exit 1 at b41e6f6 2d9fee9
9 Given PYTHONINSPECT=1 · when run on either no-verdict route · then the process exits 1 and the amendment's account of why is accurate in every clause explored passed both routes exit=1 stdout=0B; instrumenting the return value shows main() returning 3 while the process exits 1; control PYTHONINSPECT=1 python -c "sys.exit(N)" exits 1 for N of 0, 1, 2, 3 2d9fee9
10 Given 22 hostile --ticket values including nan, inf, 1e400, 1e100000, empty, abc, 5,000, an Arabic-Indic digit and 0E-500 · when run with the venue unreachable · then exit 3 and 0 bytes on stdout explored passed 22 values, deviations from (exit 3, 0 bytes) = 0 2d9fee9
11 Given the same hostile tickets against a venue that answers · when a verdict is formed · then the exit code always matches the headline printed explored passed 10 values: 0, -5, -0, 0E-500 give exit 3 with empty stdout; .5, +5, 1e-100000, the Arabic-Indic digit give exit 2 under NOT COPYABLE; 1_000 and 1e400 give exit 0 under COPYABLE 2d9fee9
12 Given 150 fuzzed venue answers with malformed rows, NaN, Infinity, null, dict-for-list, statuses 429, 500, 503, 404, 204 and coin names literally "COPYABLE" · when run · then every exit is in 0 to 3, exit 3 pairs only with empty stdout, no traceback, and no verdict word reaches stdout from a venue string explored passed 150 seeds: anomalies=0 word_leaks=0 2d9fee9
13 Given a sys.stdout that raises on write, is None, or is a silent sink · when run on the no-verdict and parser routes · then exit 3 and the real fd 1 stays empty explored passed 5 hostile objects x 2 routes = 10 runs, all exit=3 realfd1=0B 2d9fee9
14 Given an answer larger than the pipe buffer into a reader that closes after 40 bytes · when the write dies partway · then the bytes already handed to the operating system are outside the guarantees, and guarantee 1 names the route explored passed 3 of 3 reproductions cmd_exit=3 from PIPESTATUS[0], stdout_seen=40B, first bytes COPYABLE — 0xabc at a 10,000,000,000,0; the class sentence excludes bytes handed over before a reader went away and guarantee 1 names the route; control with a normal answer exits 0 2d9fee9
15 Given PYTHONIOENCODING=ascii, latin-1 or cp037, or LC_ALL=en_US.ISO-8859-1, and a trader whose data forms a clean COPYABLE · when run · then exit 3 with stdout empty, the half the bullet attributes to the encoder explored passed all four exit=3 stdout=0B; the 133 KB answer under ascii also leaves stdout at 0 bytes, confirming the encoder refuses the chunk whole; utf-8 control exits 0 with 396 B 2d9fee9
16 Given an address containing a newline and the words NOT COPYABLE · when a COPYABLE verdict is formed · then the words on stdout are the caller's own, as amended guarantee 3 states explored passed stdout line 1 COPYABLE — x, line 2 NOT COPYABLE — you at a 1 ticket at a 500 ticket, exit 0 2d9fee9
17 Given a trader who clears the floor and trips no reservation · when the command runs · then the verdict is COPYABLE and the exit code is 0 explored passed the verifier's own httpx.MockTransport fixture, 30 fills over 30 days at notional 4 000, all taker: COPYABLE — 0xabc at a 500 ticket, exit=0 stdout=396B stderr=0B 2d9fee9
18 Given a trader who clears the floor with a fee burden above the alert · when the command runs · then the verdict is COPYABLE WITH RESERVATIONS, the fee reservation is named on the first line, and the exit code is 1 explored passed 30 fills at notional 150 000: COPYABLE WITH RESERVATIONS (fees), body 6.52% of their ticket per month in fees, exit=1 stdout=514B 2d9fee9
19 Given a trader who clears the floor with more than half their fills posted · when the command runs · then the verdict is COPYABLE WITH RESERVATIONS and the reproducibility reservation is named explored passed 20 of 30 posted: COPYABLE WITH RESERVATIONS (reproducibility), body 67% of the fills were posted rather than taken, exit=1 stdout=536B 2d9fee9
20 Given a trader whose volume landed on a third or less of the days · when the command runs · then the verdict is COPYABLE WITH RESERVATIONS and the concentration reservation is named explored passed fills on 5 of 30 days spanning the window: COPYABLE WITH RESERVATIONS (concentration), exit=1 stdout=594B 2d9fee9
21 Given a trader who does not clear the floor · when the command runs · then the verdict is NOT COPYABLE and the exit code is 2, whatever the reservations say explored passed notional 1 000 so the scaled order is 5 USDC: NOT COPYABLE, body 100% of this trader's orders fall under the venue's 10 USDC floor, exit=2 stdout=516B; with a fee reservation also applying, NOT COPYABLE (fees) still exit 2 2d9fee9
22 Given the venue cannot be read · when the command runs · then there is no verdict, the exit code is 3, and stdout is empty explored passed 15 shapes — 500, 503, 429, non-JSON, JSON null, connect error, read timeout, dict where a list belongs, unparseable fill, accountValue of NaN, 0, Infinity, -5 and missing, and no fills at all — every one exit=3 stdout=0B 2d9fee9
23 Given a window stretched past 30 times and a floor that also fails · when the command runs · then the ceiling outranks the floor and there is no verdict explored passed 0.23 and 0.07 days read with the floor failing: exit=3 stdout=0B, stderr the venue returned 0.23 days of a 30-day window; control at the same notional with a complete window gives NOT COPYABLE (fees) exit 2 2d9fee9
24 Given a window stretched between 3 and 30 times · when the command runs · then the extrapolation reservation is named and the verdict is still given explored passed density sweep: 27.8 and 16.0 days read give (fees) only; 9.3, 4.6 and 1.1 days give (fees, extrapolation) at exit 1; 0.46 and 0.23 days are refused at exit 3 with 0 bytes 2d9fee9
25 Given test_a_malformed_command_line_never_writes_to_stdout · when it is run against 7fd0914's cli.py in a fresh scratch copy and against this head · then it fails there and passes here automated passed scratch copy confirmed different before any result was read, c5064b2f… against head 0055598d…; at 7fd0914 FAILED … AssertionError: [] wrote to stdout, pytest exit 1; at this head pytest exit 0 2d9fee9
26 Given test_help_still_goes_to_stdout_and_exits_zero · when it is run against both revisions · then it passes either way, being a regression guard rather than a discriminating test automated passed at 7fd0914 the run reports the other test as the only failure; at this head both pass, pytest exit 0 2d9fee9
27 Given the module's check verb · when it is run on its own exit status with no pipe · then it passes automated passed nstack check screening EXIT=0 — ruff format 16 files, ruff check all passed, mypy no issues in 10 source files 2d9fee9
28 Given the module's test verb · when it is run on its own exit status with no pipe · then it passes automated passed nstack test screening EXIT=0 — 81 passed in 12.58s 2d9fee9
29 Given the real venue and a real trader · when the command runs once · then it answers consistently with its own figures explored passed 0x102d1d1a6240581a809bac9b9b4dff2eafe8c058 at a 500 ticket: NOT COPYABLE (fees, extrapolation), exit 2, 7 939 fills, 20 of a 20 heavy-read budget, 9.2 days read, stretch 3.3x, stdout=1065B stderr=0B 2d9fee9
30 Given --help · when it runs, forming no verdict and writing a usage line to stdout · then the guarantees name it as the exception rather than denying it explored passed the clause "--help is the exception to the first two, and the only one" now stands after the three bullets, naming the usage on stdout, the exit 0 and the measured routes; measured again here at exit=0 stdout=451B stderr=0B 2d9fee9
31 Given every abbreviation of and combination with the help flag, and the near-misses that resemble it · when each is run · then all reach the same help behaviour the exception names, and none of the near-misses escapes into it explored passed 13 routes reach help, all exit=0 stdout=451B stderr=0B: --help, -h, --h, --he, --hel, -hh, --bogus --help, --help --bogus, 0xabc --help, --help --ticket, 0xabc --ticket 500 --help, -h --ticket nan, 0xabc --ticket 500 -h extra. 6 near-misses stay outside, all exit=3 stdout=0B: --help=x, -- --help, --ticket 500 -- --help, --HELP, --hE, the bare positional help. Repeated with fd 2 closed for seven of the help routes, all exit=0 stdout=451B 2d9fee9
32 Given the claim that the module has exactly two places that can write to stdout · when the module is enumerated statically and every path is instrumented dynamically · then the claim holds and both places are accounted for by the document explored passed Static: the only executable writes in all five source files are cli.py:71 print(reason, file=stream) with stream = sys.stderr and an early return when it is None, and cli.py:218 print(_render(...)); no sys.stdout, os.write, logging, warnings, traceback, input, pprint or breakpoint anywhere, and no subparser or version action. Dynamic: 18 paths instrumented with a recording sys.stdout capturing the stack of every write; exactly two distinct origins appear — cli.py:218 on the two verdict paths only, and argparse's _print_message via print_help via _HelpAction.__call__ on the six help paths only; _say reached stdout on no path. Descriptor cross-check: bytes counted at sys.stdout equal bytes landing on fd 1 exactly, 396/396 on a verdict, 451/451 on help, 0/0 on no verdict 2d9fee9

The attack surface behind those rows: 120 repeated malformed command lines, 15
unreadable-venue shapes, 30 environment runs, 22 hostile tickets, 150 fuzzed venue answers, 12
hostile-stderr and 10 hostile-stdout configurations, 13 help routes and 6 near-misses, and 18
instrumented paths — "no route where the module's own code produced a code naming a verdict it
had not formed, and no route where it put a byte on stdout without one."


Follow-ups recorded, not fixed here

Per ADR-0003: blockers are fixed, everything else is recorded rather than tidied inside the fix.

  1. The clause says "nine routes to it were measured". That is a true record of the run that
    measured nine; the run at this head measured thirteen, all behaving identically, plus six
    near-misses that stay outside. The sentence claims a measurement, not a total — worth making
    exact the next time that paragraph is touched, not worth a head of its own.
  2. -hh and 0xabc --ticket 500 -h extra exit 0. They would be usage errors at exit 3
    without the help flag, and the help action pre-empts the error. Ordinary argparse, and it is
    help — but this branch contains a commit called "Stop a typo reading as a verdict", so it is
    written down.
  3. The headline says COPYABLE over a body that is warning, at exactly the documented
    thresholds: 20% of orders under the floor, 50% of fills posted, volume on 11 of 30 days. Each
    conforms to PDR-0002, and the deliverable's own title asks whether the thresholds are in the
    right place. Belongs with the PDR's success-criterion review.
  4. A reservation's sentence is printed in the body even when the reservation has not fired, so
    "the sentence is present" is not a reliable signal that it did.
  5. Unvalidated input, which is now load-bearing for two of the guarantees' caveats: the address
    is echoed into the headline as typed, so a caller can read its own NOT COPYABLE back;
    --ticket .5 renders as at a 0 ticket; 1e400 prints 400 digits; -5 and 0 reach the
    venue before being refused; and an answer past 64 KB needs 1e100000, which is what makes the
    partial-write route reachable at all. The day the address comes from a list the caller did not
    write is the day this stops being a follow-up — the PDR says so.
  6. Exit 120 when a stream cannot be flushed, and PYTHONINSPECT replacing the code. Named in
    the PDR as outside the command's reach; recorded here so they are not rediscovered as defects.
  7. An internal defect surfaces as no verdict, indistinguishable by exit code from an
    unreadable venue. The trade is deliberate — the alternative is a crash at exit 1, which means a
    qualified yes — and it is on the record rather than hidden.
  8. crossed is not type-checked where px and sz are: a venue returning the string
    "false" would read as a taker. Not reachable with the venue as it behaves today.
  9. Two messages leak an exception repr where the others are written for a human.
  10. Observability, carried from cycle 01: the retry-rate metric, the unrecorded 429 deviation,
    and operations.md's 60s budget being per call where cli.main makes several.

Summary

DONE
A third verdict, COPYABLE WITH RESERVATIONS, naming which of four reservations applies in the
headline itself. Exit codes renumbered by severity, 0/1/2/3. An extrapolation ceiling that refuses
to answer at all past 30×, checked before any verdict is formed. Three fixes to defects found by
independent verification — the client built outside the guard, the reporting print deciding the
exit code, argparse's usage line reaching stdout — and three corrections to the decision record
that the same verification refused. Four amendments to PDR-0002.

VERIFIED
nstack check screening 0, nstack test screening 0 (81 tests), nstack fitness compliant —
each read on its own exit status, never through a pipe. Six delegated confirmation runs; the sheet
above is the sixth, all 32 rows at the head commit. One live run against the venue per run.

ASSUMED
That the thresholds — 80% floor coverage, 5% fees, half the fills posted, a third of the days, 3×
and 30× stretch — are in the right places. They are one set of numbers for every administrator,
they were sampled against live traders, and no member has yet used any of this.

NOT VERIFIED
Nothing here was seen by an administrator. The module answers a question nobody has been observed
to ask: D1 stays deferred, and the copying module does not exist. The 120 and PYTHONINSPECT
exit paths are outside the command's reach and are stated rather than fixed.

RISKS
The middle verdict will be common — most real traders sampled land in it — and a state that applies
to most cases risks being read as noise. The exit-code renumbering is breaking, and it is done now
precisely because nothing consumes it yet. Ten follow-ups above are real, and a follow-up list
nobody reads is the failure mode ADR-0003 names. And the cycle owes a harder sentence than any of
these: this is a tool for choosing traders, built with no evidence that a member wants to copy one.


Signals to report

  • I had to look at another module's implementation
  • A kernel or playbook rule got in my way for no good reason
  • A quality gate blocked without improving quality
  • A rule applied by hand would be worth automating

The signal, measured rather than supposed. A delegated verifier session has no identifier of
its own that it can read: CLAUDE_CODE_SESSION_ID in its shell holds the parent's id — the
same value every Agent-Session trailer on this branch carries. Each run established its own
identity from the harness's subagent records instead, and each said so unprompted, including that
CI would refuse the parent's id and be right to. So T2, which compares the sheet's verifier against
the commits' authors, cannot detect that a verifier is a child of the session that wrote the
code
. ADR-0002 already records this as owed and calls the mitigation social rather than
mechanical; this branch is what that looks like in numbers — six delegated runs, five refusals,
four distinct agent identifiers, and not one session identifier among them.

A second signal, about T4 rather than T2. Three of the six runs were spent re-measuring 30-odd
rows because a documentation commit moved the head, and T4 requires every row to carry it. The rule
is right — a sheet dated on another commit proves nothing — but a change that touches no module
file could be recognised as one that cannot invalidate a module's sheet. git diff -- modules/
being empty is mechanical to check, and each of those three runs verified it by hand before
trusting it.

napkinstack-agent Bot and others added 9 commits September 21, 2026 16:15
Live, the command printed COPYABLE and exited 0 directly above a line saying
the fees, not the strategy, would decide this member's result. PDR-0002 was
written for that and never built. It is built now, and accepted.

COPYABLE clears the floor and trips nothing. COPYABLE WITH RESERVATIONS clears
the floor and names what it is reserving about, on the first line, so the
headline alone is actionable — the middle verdict will be the common one and a
vague caution would be read as noise. NOT COPYABLE does not clear the floor,
whatever else is true: impossible beats expensive, and the reservations are
still printed so an administrator learns why twice over. Exit codes run by
severity, 0/1/2/3, a breaking change made before anything consumes it.

A fourth reservation and a ceiling, decided while implementing and recorded as
an amendment to the PDR rather than left in the code. The PDR said a cut-short
window changes nothing beyond naming the figures extrapolated. Running it live
showed otherwise: a 30-day question answered from 2.4 hours is stretched by
319, and the command printed `125.34% of their ticket per month in fees` as
though it were a measurement. Past 3x that is a reservation; past 30x there is
no verdict, which is the case this PDR already defined as "the data cannot
support an answer", now given a threshold so it can be applied rather than
argued about.

Two defects found while writing the tests, both in code that was already
merged or about to be:

`traded on 31 of the 30 days read`. UTC day buckets, so a window exactly
`window_days` long can straddle one bucket more than it has days. S10 pinned
this on the path where the window is inferred; this is the other path, and it
was printing an impossible sentence to an administrator.

And the extrapolation reservation could never have fired in production. The
command passes `window_days=None` when the window is cut short — correctly, so
the monthly figures extrapolate from what was read rather than from what was
asked for — which left the stretch measured against itself, always 1. It
worked in every unit test because those pass the window directly. `assess` now
takes the window that was *requested* as its own argument, and a CLI test
drives the whole path so the reservation cannot go quiet again.

Live on the trader this module is tested against, at 14:14 UTC:
`COPYABLE WITH RESERVATIONS (fees, extrapolation)`, exit 1.

Fifty-six tests.

Agent-Session: session_01NGwPYhV6fYZhjrh41GNfJy
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NGwPYhV6fYZhjrh41GNfJy
…reates

Three blocking findings from verification, all in the interface this PDR
exists to define, plus the small ones that share their root.

The first is a regression I introduced. Renumbering by severity gave 2 to
NOT COPYABLE — and argparse already exits 2 on a usage error. A missing
--ticket or a mistyped flag made the command say "this trader cannot be copied
at this ticket" to a script that reads the code and never sees a sentence.
`--ticket nan` was worse: it escaped as an uncaught exception, which Python
exits 1 for, and 1 now means COPYABLE WITH RESERVATIONS. A crash read as a
qualified yes. Both are now no verdict, which is what a malformed question
deserves, and `Infinity` no longer prints a full verdict headed `at a Infinity
ticket`.

The second is that the middle verdict's own exit code was pinned by nothing.
Setting EXIT_WITH_RESERVATIONS = 2 — collapsing it onto NOT COPYABLE, the
exact distinction this decision exists to create — left the whole suite green.
The one CLI assertion touching it admitted `code in (1, 2)`, which is the sixth
fixture of mine on this module to prove nothing. That the fee reservation lands
on the *first line* was asserted nowhere either, and the ceiling had no CLI test
at all: its unit test passes a combination `main` never produces, so the
production path to it was unpinned — the same shape as the defect D3 was
written to fix.

Seven mutants that survived the suite before now fail it: the middle exit code,
the four thresholds flipped from > to >=, the ceiling flipped, and deleting the
days clamp.

The third is that PDR-0002 names updating the module README with the four
verdicts and their codes as an impact of this decision, in so many words, and
it was not done. A breaking interface change was shipped with no user-facing
record of what it broke. The README now carries both tables.

Two more from the same report, fixed rather than deferred: the floor beats the
ceiling, because whether orders clear 10 USDC is read straight off the
notionals and needs no extrapolation, and the PDR says the floor alone decides;
and the refusal message printed a stretch of 30.00002 as `30`, a number the
rule says is not refused.

And one the wording did not settle, now settled in the PDR: concentration
counts against the days actually read, not the days asked for, because a
reservation is a statement about what was observed — counting against a window
never read would be the mistake this module spent a cycle removing.

Sixty-five tests.

Agent-Session: session_01NGwPYhV6fYZhjrh41GNfJy
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NGwPYhV6fYZhjrh41GNfJy
…ushed

`nstack check` reported twelve mypy errors and the commit went out anyway. The
shell chain tested the exit status of `tail`, not of the check — so the gate
ran, failed, printed its failure, and the `&&` that followed saw a successful
`tail`. The check did its job; I did not read it.

The errors themselves were trivial: a `**dict` splat into `_reservations`
erases the argument types. It is a keyword-only helper with defaults now, which
is also easier to read than four dictionary merges.

Recording the how rather than only the what, because a gate whose output is
printed and not read is the same as no gate, and this is the second time this
week a figure went out unchecked because I chained a command onto the wrong
exit status.

Agent-Session: session_01NGwPYhV6fYZhjrh41GNfJy
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NGwPYhV6fYZhjrh41GNfJy
…amendment

A verifier refused this branch over a change nobody asked for, and was right.

Last round I made the floor beat the extrapolation ceiling, reasoning that
whether orders clear 10 USDC is read straight off the notionals and needs no
extrapolation. That reasoning is false. The notionals read are the ones inside
the window the venue actually returned, so `refused_share` and `minimum_ticket`
computed from half an hour are inferences printed as facts about a trader — the
exact move the amendment I had written five hours earlier forbids one section
above.

What it produced, measured: `NOT COPYABLE` above
`8352.24% of their ticket per month in fees` and `extrapolated ... by a factor
of 823.3`. The amendment's own dated success criterion says no administrator is
ever shown a figure stretched past 30x. I violated it within the hour, in the
same file, and then pinned it with a test so the nonsense became the contract.

The ceiling is checked before any verdict is formed again. `NO VERDICT` is the
most severe outcome and the exit codes already said so. "The floor alone
decides NOT COPYABLE" means nothing OTHER than the floor may produce that
verdict; it is not a statement of precedence over the absence of one, and the
PDR now says which it is, along with why the reasoning that looked like a
justification was wrong.

The README table written last round to close a blocker asserted `Past 30x there
is no verdict at all`, which my own change had just made false. It is true
again. Two more drifts in the same tables are fixed: `COPYABLE` claimed the
orders clear the floor when the code tolerates up to 20% refused, and the
`NOT COPYABLE` row lacked the reservations the command actually prints after it.

Five mutants the verifier found surviving are now caught. Two of them are the
reservation ORDER — swapping fees and reproducibility, or moving fees last,
left all sixty-five tests green, while the test named
`..._named_on_the_first_line_not_merely_somewhere` asserted only that the word
appeared, on a fixture that tripped one reservation. The seventh fixture on
this module to read like a guarantee and prove nothing. The order is now
asserted whole, on a fixture where all four fire.

Also from the report: the floor boundary at exactly the coverage target is
pinned, since D3 made it the sole gate for exit 2; `--help` returns 0 instead of
raising through a function typed `-> int`; the dead `ArithmeticError` branch is
removed rather than left as an untested brace; and the dead `calendar_days > 0`
guard goes with it.

Sixty-eight tests.

Agent-Session: session_01NGwPYhV6fYZhjrh41GNfJy
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NGwPYhV6fYZhjrh41GNfJy
…g nothing

Three blockers, all of them created by my cleanup last round, and the pattern
is the same in each: I removed a protection while believing I was tidying.

B1. I deleted the `ArithmeticError` handler and wrote that `is_finite()`
"already stops every case". That is false. `is_finite()` guards `--ticket`;
every other number in `assess` comes from the venue. A verifier walked
`accountValue: "NaN"`, `accountValue: "Infinity"`, a `px: "NaN"` fill and a
zero-notional fill straight through to an uncaught decimal error — which the
process reports as exit 1, and this deliverable is what made 1 mean COPYABLE
WITH RESERVATIONS. My own test docstring says a crash must never read as a
qualified yes.

`assess` now refuses all four with reasons, checking finiteness before any
comparison because `Decimal("NaN") <= 0` does not answer False, it raises. The
zero-notional case needs no exotic input: enough of them inside the coverage
target and the minimum ticket divides by zero. The handler is back as a
backstop for the fifth shape nobody has thought of, and a test forces it rather
than leaving a brace nobody can show does anything.

B2. The reservation order was asserted on the private helper, one layer below
the headline the decision is about. Sorting the tuple inside `_render` passed
every test. Asserted through the command now — and my first attempt at that
test used `fees, reproducibility`, which are already in alphabetical order, so
sorting left it identical and it proved nothing. It uses `fees, concentration`,
where the decision's order and alphabetical order disagree.

B3. Rewriting the floor-versus-ceiling test deleted the only assertion of the
literal `NOT COPYABLE`; renaming the verdict passed the whole suite. Restored.
Fixing a blocker should not cost coverage that already existed.

Also pinned, each verified against a mutant with the patch confirmed applied
first: the 10 USDC notional boundary, `EXTRAPOLATION_ALERT` against the literal
3 rather than against itself, and the one line deciding whether the monthly
figures are measured or extrapolated — my first test of that used fills
spanning the full window, where both wirings agree.

Smaller: a posted share of 0.4% printed `0% of the fills were posted ... a
copier cannot reproduce them`, warning about nothing; the README says what
`--help` returns, since 0 is otherwise the code for COPYABLE; and
`modules/screening/.coverage`, a SQLite file carrying one workstation's
absolute paths, is out of the index and into `.gitignore` — the file the
`.gitignore` comment describes by name.

Seventy-five tests.

Agent-Session: session_01NGwPYhV6fYZhjrh41GNfJy
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NGwPYhV6fYZhjrh41GNfJy
…a qualified yes

The confirmation run refused this branch, and was right. Two ordinary environment
variables — `https_proxy=socks5://...` with no `socksio` installed, and
`SSL_CERT_FILE` naming a file that is not there — killed the command with exit
**1**, which this deliverable is what made mean COPYABLE WITH RESERVATIONS. An
empty stdout and a qualified yes about a trader whose fills were never read:
strictly worse than the two-state answer D3 replaced, because it invents an
opinion out of a configuration error.

`venue.client()` was built one line before the `try` that guards the reads, so
nothing caught it. `venue`'s own handlers are narrower than they look as well —
they catch `httpx.HTTPError`, and `httpx.StreamError` is a `RuntimeError`.

The reason it went unseen for six rounds is the part worth recording: **every
one of the twenty `main(...)` calls in the suite passes `client=`**. The single
line the administrator's own invocation runs was run by no test at all, and
seventy-five green tests were green on a path nobody takes. I wrote the same
argument into this file last round, about `ArithmeticError`, and then left the
identical hole one call earlier.

So `main` is now a backstop over `_decide`: any unhandled exception prints its
reason and returns the no-verdict code. Same reasoning as the `ArithmeticError`
handler, applied to the command instead of to `assess`.

Both tests were seen failing against the unpatched file — `FileNotFoundError`
escaping from the SSL context, and a `RuntimeError` from the transport — with
the revert confirmed before the run rather than assumed. The first one passes no
`client=`, on purpose.

Verified on its own exit status, not through a pipe: 77 passed, `nstack check
screening` 0, and the four reproductions now exit 3 with an empty stdout.

Agent-Session: 4151570f-613e-475f-ba3f-b465b35d9a83
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The confirmation run found that this PDR and D3's sixth criterion both say
*"the verdict is NO VERDICT"*, while the command prints those two words nowhere:
empty stdout, `no verdict: <reason>` on stderr, exit 3. The module's README,
written on this branch, had already restated the criterion as
`*(nothing on stdout)*` — which is the right reading and the wrong route. An
expected result had been changed by the author, in a README, with nobody's
agreement visible.

Asked directly, the decider kept the behaviour: stdout carries the answer a
script consumes, stderr the explanation a human reads, and when there is no
answer stdout is empty so nothing read back can be mistaken for a verdict. It is
the concern that renumbered the exit codes, applied to the output.

Recorded in the PDR, where decisions live. No code, no test, no threshold, and
the README is left alone — it now follows this document instead of amending it.

Agent-Session: 4151570f-613e-475f-ba3f-b465b35d9a83
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ng the exit code

The confirmation run at `71acb63` refused the branch again, on the fix's own
reporting line, and both of its findings reproduce exactly as written.

**Exit 1 on an empty stdout, still reachable.** `... 2>&1 >/dev/null | true`
with an unbuffered stderr — `PYTHONUNBUFFERED=1` is ordinary in a container
image — raises `BrokenPipeError` out of `print`. It escaped `main`, including out
of the backstop I added last commit, which is precisely where a failure lands
last, and CPython exits **1**: COPYABLE WITH RESERVATIONS, decided by a reader
that consumed nothing. Measured 5/5 through the installed command, and under the
same `https_proxy=socks5://...` environment this branch was refused over two
commits ago.

**The reason landing on stdout.** `... 2>&-` closes fd 2, CPython sets
`sys.stderr` to `None`, and `print(file=None)` writes to stdout: 59 bytes of
explanation where the verdict goes, under exit 3. The amendment I recorded one
commit ago says stdout is empty when there is no answer, so nothing read back can
be mistaken for one. It was not universally true of the code it described.

Neither was introduced by the backstop — both are byte-identical at `b41e6f6`
and older than this deliverable. That is not a reason to leave them: this is the
fourth blocker of the same class on this branch, and the invariant is one line
from holding.

Every write to stderr in the file goes through `_say` now: nothing when there is
no stderr — never stdout as a fallback — and a suppressed `OSError` when the
write fails. The exit code carries the answer alone.

Both tests were seen failing against the unguarded file, the revert verified
before the run: `BrokenPipeError` escaping, and the reason landing on stdout.

Verified on their own exit status: 79 passed, `nstack check screening` 0, the two
reproductions now exit 3 (five runs each, stdout 0 bytes), and the four original
ones still exit 3. Live at this head: `NOT COPYABLE (fees)`, exit 2, 9805 fills
read over a window ending today, 9 heavy reads of a 20 budget.

Agent-Session: 4151570f-613e-475f-ba3f-b465b35d9a83
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…actually hold

Fifth finding of one class, and the decider's call was to close it and stop the
class rather than close it and wait for the sixth.

**argparse was outside the guard.** `ArgumentParser.error` calls
`print_usage(sys.stderr)`; with fd 2 closed `sys.stderr` is `None` and
`print_usage` substitutes **stdout**, so six ordinary malformed command lines put
46 bytes of `usage: ...` where the verdict goes, under exit 3. Last commit's
guard covered every write in this file — and argparse is not in this file, which
is exactly the gap the previous confirmation run named. The parser now reports
through `_say` and exits with no message of its own. `--help` stays on stdout,
451 bytes, exit 0; a usage error with a working stderr still explains itself
there.

**`_say` suppresses `Exception`, not `(OSError, ValueError)`.** The same report
reached exit 1 — a code that names a verdict — through a `sys.stderr` whose
`write` raised `RuntimeError`. It found no route to that through a shell, and one
character closes it. `KeyboardInterrupt` and `SystemExit` are `BaseException` and
still leave.

**And the promise is bordered.** *"It writes nothing at all on stdout"* is a claim
about every way a process can be started, and three confirmation runs walked into
it one layer at a time: this file's prints, the backstop's print, argparse's usage
line — and then CPython's finaliser, which writes its own message and exits 120
when it cannot flush a stream. That fourth layer is not reachable from inside the
module. A promise the code cannot keep produces refusals for ever, so the PDR now
states the three guarantees the command does hold — nothing of ours on stdout
without a verdict, the exit code as the interface, no verdict word unless that
verdict was formed — and names 120 as a verdict that could not be delivered
rather than an opinion. The README says so where a script author reads it.

The stdout test was seen failing against the unpatched parser, on all four
malformed shapes, the revert confirmed first. The `--help` test is a regression
guard, not a discriminating one: it passes either way, and it is there because
routing the parser's errors is exactly the change that could have taken `--help`
off stdout with them.

Verified on their own exit status: 81 passed, `nstack check screening` 0, and
`screening --bogus >out 2>&-` now exits 3 with stdout at 0 bytes.

Agent-Session: 4151570f-613e-475f-ba3f-b465b35d9a83
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@napkinstack-agent napkinstack-agent Bot added the over-budget Beyond the review budget — the exception, counted label Sep 22, 2026
The run at `6109baa` returned `merge`, with no blocker, and three findings that
are all one thing: the amendment I wrote in that same commit says more than the
code does, or less than the interpreter does.

**A verdict that cannot be delivered comes back two ways, and I named the rarer
one.** I wrote that it surfaces as `120`. That is the flush failing. When the
*write* fails — `PYTHONIOENCODING=ascii` cannot encode the em dash in the
headline — the backstop returns **3**, which is one of the four codes and reads
as *the data cannot support an answer* about a trader whose data supported one
perfectly. It fails safe, and it is the common case. Now written as both.

**`PYTHONINSPECT=1` replaces the exit code with 1.** CPython re-enters the REPL
and discards the program's status; the command returns 3 and the process exits 1.
Not this command deciding — `python -c "sys.exit(3)"` does the same — and not
undoable from inside the process. My exclusion list named only the 120, so the
next run would have filed this as new. Named as the general case instead.

**Guarantee 3 was absolute where input validation is a follow-up.** The address
is echoed into the headline as typed, so an address carrying a newline and the
words `NOT COPYABLE` prints a complete headline for a verdict never formed. Now
"no word this command chooses", with the caveat stated and the reason it is not
fixed here — unvalidated input is a recorded follow-up and this deliverable is
already over budget. What the venue says still never reaches stdout: 150 fuzzed
answers with coin names literally `"COPYABLE"` leaked nothing.

No code, no test, no threshold. `nstack check screening` 0; the module is
untouched at `git diff 6109baa HEAD -- modules/screening/src modules/screening/tests`.

T4 makes this commit reprint the sheet: it is dated at the head, and the head
moved. The confirmation run is being repeated rather than the sheet edited.

Agent-Session: 4151570f-613e-475f-ba3f-b465b35d9a83
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…dy gone

Sixth finding on this branch and the fourth in prose rather than in code. The
re-confirmation at `3483b26` passed 28 of 29 rows — every acceptance criterion,
both gates, the live run, the module byte-identical to the head it had already
accepted — and refused the twenty-ninth, which is a sentence I wrote in the
commit whose only content was sentences.

I claimed that when the write fails the backstop returns 3 with **stdout
genuinely empty**. True for the case I named: an encoder that cannot take the em
dash refuses the answer whole, measured up to 133 KB. False for the other member
of the same class: a reader closing a pipe partway through an answer larger than
the buffer leaves the bytes already written — exit 3 over 40 bytes reading
`COPYABLE — …`, three reproductions out of three. I named a class in the heading
and described one member under it.

The verifier also caught what that did to the guarantee above, which I had not
reread in the light of my own amendment: it says *no partial answer* under *when
there is no verdict*, while the paragraph below now establishes that **3 is also
what a formed verdict returns when it cannot be delivered**. The two sentences
had come apart in writing, in the same document, on the same day.

So the correction is made once, at the top, for all three guarantees: they speak
about what the command **chooses** to write. Bytes already handed to the
operating system, before a reader went away or a stream refused the rest, are not
a choice. The first guarantee now says *no verdict formed* rather than *no
verdict*, and names the route where exit 3 and a non-empty stdout coexist. The
bullet says which half of its class leaves stdout empty and which does not, with
both measurements.

Closing the class rather than the instance is what the `PYTHONINSPECT` paragraph
got right two commits ago and what this one got wrong; a per-instance clause is
how a document produces a refusal per round.

No code, no test, no threshold. `nstack check screening` 0, and
`git diff 3483b26..HEAD -- modules/` is empty.

T4 reprints the sheet again: the head moved, so the twenty-nine rows are being
re-measured rather than relabelled.

Agent-Session: 4151570f-613e-475f-ba3f-b465b35d9a83
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The class sentence worked — row 14 passes, and the verifier bounded rather than
asserted it: the module writes to stdout from exactly two places, `_say`, which
only ever touches stderr, and the render call, which runs only after a verdict
exists. So bytes of an answer can reach stdout unchosen only through a write that
started and did not finish, which is the family the sentence excludes.

It did not reach a different absolute three paragraphs above. Guarantee 1 lists
*"not a usage line"*, and `--help` writes 451 bytes of usage to stdout and forms
no verdict. Nine routes to it, from `-h` to `0xabc --ticket 500 --help`, all
print the usage and exit 0.

**Older than this branch, and sharpened by my own correction.** The guarantee said
*"when there is no verdict"*, which could be read as the `NO VERDICT` outcome —
the thing that exits 3 — and `--help` argued its way out of that reading.
Narrowing it to *no verdict formed* was right and load-bearing, and it pulled
`--help` squarely inside a sentence that then denied what it does. The command was
never wrong here; three drafts of this paragraph were.

Named as the exception to the first two guarantees, since it also exits 0 where 0
means COPYABLE — the one exit 0 that is not a verdict, which the README has said
since the day the table was written. An exception rather than a defect because it
says nothing about a trader: a caller who asked how to run the command is not a
caller being told an answer.

The verifier's own note on this, worth keeping: it measured `--help` on all three
of its sheets and never read it against the bullet three paragraphs down. The
sequence has produced six findings of one family, every one a sentence more
absolute than the code. Having enumerated the two writes, it does not see a
seventh.

No code, no test, no threshold. `nstack check screening` 0, and
`git diff e0af8e6..HEAD -- modules/` is empty.

Agent-Session: 4151570f-613e-475f-ba3f-b465b35d9a83
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@napkinstack-agent
napkinstack-agent Bot merged commit 8277dca into main Sep 23, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

over-budget Beyond the review budget — the exception, counted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants