Skip to content

3.x.x: launch load-harness frontends at the production initial-job admission (#275) - #497

Merged
djh58 merged 4 commits into
3.x.xfrom
djh58/prism-b275-harness-admission
Sep 22, 2026
Merged

djh58 merged 4 commits into
3.x.xfrom
djh58/prism-b275-harness-admission

Conversation

@djh58

@djh58 djh58 commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Refs #275. Harness-only: crates/qbit-prism-load configuration, CLI, launch environment, side-report provenance, docs and tests. No server source, alert files or perf-worker artifacts.

What changed

The harness sized PRISM_STRATUM_MAX_PENDING_INITIAL_JOBS to sessions_per_frontend + 16 (128 at least), so a 2,000-session frontend ran with 2,016 initial-job permits while production runs the server default of 128. That let every session build its first job at once and, on the real process, inflated the post-publish delivery tail by 50–190 ms against the default (#275 profiling, section 6 of the two-frontends write-up).

  • --stratum-max-pending-initial-jobs <N>, default 128 (the server's own default). Positive, and at most the connection cap the harness derives (2 × sessions_per_frontend + 64, at least 384): the server refuses to start with more permits than connections, so the harness refuses the pair at entry with the cap named.
  • One derivation, one reader. Args::stratum_limits is the only place the listener limits are derived; validate checks it, run::shared_environment exports it, and the child's environment is cleared, so the value the process reads is the validated one. No environment variable is read by the harness for this.
  • Provenance. The side report records, per frontend, frontend_environment[].stratum_admission: the launched value read back from the process's own environment, its source (default or the flag), the production default and the pre-flag value for the run's shape. An unstatable value is null, never 0. honest_value_notes gains a note. The capacity-evidence artifact is untouched: the validator's 16 configuration keys do not include the admission.
  • Old evidence keeps its meaning. Passing the old value (2016 for 2,000 sessions on one frontend, 1016 for two, 516 for four) reproduces it. The README flag table, the honest-values section and docs/prism-throughput-measurements.md say which admission those runs used.

Untouched: the endpoint, the 400k population, 2,000 sessions, every deadline, receipt reconciliation, and the load gates.

Tests

  • the_initial_job_admission_defaults_to_production_and_is_bounded_at_entry: omitted → 128; 2016 and 1 accepted; 0, above-cap (2,016 on four frontends, cap 1,064), -1, abc, 1.5, empty refused; the error names the cap and the sessions per frontend.
  • the_initial_job_admission_reaches_a_launched_frontend_as_the_flag_or_its_default: the run's own launch path (shared_environment → frontend_environment → Frontend::launch) against a stand-in server that echoes what it read, for omitted/2016/1, with PRISM_STRATUM_MAX_PENDING_INITIAL_JOBS=7 set in the harness's own environment and shown not to reach the child; the provenance block for each case; the evidence configuration block unchanged.
  • an_admission_the_launch_environment_cannot_state_is_null_not_zero.

cargo test --locked -p qbit-prism-load (123 passed), cargo clippy --all-targets -D warnings, cargo fmt --check: clean.

Real-process proof (in progress)

A release server and harness are being built from this commit and a 2,000-session, one-frontend, 400k-window short run at the default admission (128) is queued under the shared heavy lock. Its side report (sessions_with_work, every session holding work before the first phase, the reconnect phase's completions, and frontend_environment[0].stratum_admission) will be posted here with the binaries' SHA-256. That run proves configuration and admission of all 2,000 sessions only; it is not a performance comparison.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

djh58 and others added 3 commits September 22, 2026 15:27
…mission (#275)

The harness sized PRISM_STRATUM_MAX_PENDING_INITIAL_JOBS to
sessions_per_frontend + 16 (128 at least), so a 2,000-session frontend
ran with 2,016 permits while production runs the server default of 128.
That let every session build its first job at once and, on the real
process, inflated the post-publish delivery tail by 50-190 ms against
the default, so #275's real-process figures were taken at an admission
production never runs.

Add --stratum-max-pending-initial-jobs, defaulting to 128 and validated
at entry against the connection cap the harness derives (the server
refuses more permits than connections). The flag and its default are
the only sources: Args::stratum_limits is the one derivation, validate
checks it, shared_environment exports it and the child's environment
is cleared, so the value the process reads is the validated one. The
side report records, per frontend, the launched value read back from
its environment, its source (default or the flag), the production
default and the pre-flag value for the run's shape, with a null rather
than a zero when the launch environment cannot state it. The
capacity-evidence artifact is unchanged: the validator's 16 keys do not
include the admission.

Evidence taken before the flag keeps its meaning: pass the old value to
reproduce it, and the README, the honest-value notes and the throughput
measurements doc say which admission such runs used. The endpoint, the
400k population, 2,000 sessions, deadlines, receipt reconciliation and
the load gates are untouched.

Tests: the flag omitted, nondefault (2016, 1) and invalid (0, above the
cap, non-numeric) at entry; the value reaching a really launched
process, through the run's own launch path against a stand-in that
echoes what it read, with a value in the harness's own environment
shown not to leak; and the provenance block's null-not-zero.

Refs #275

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…and state the permit queue honestly (#275)

/code-review on #497: `std::env::set_var` inside a threaded test binary
races libc's `getenv` in other tests (the reason it became unsafe in
edition 2024), and the property it served -- no second reader between
the flag and the frontend -- is `Command::env_clear` in
`Frontend::spawn`. The launch test now shows that on a variable the
test process really inherits from Cargo, `CARGO_MANIFEST_DIR`, echoed
by the stand-in as unset.

The README said each queued session waits behind at most 128 builds;
the permit queue is first-in, first-out, so the last of 2,000 waits
behind every earlier waiter, inside the server's 30 s initial-job
timeout. It now says so, and what a slow database or a much larger
session count does to the tail.

Refs #275

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…d the admission once (#275)

Thermo-nuclear pass on #497, run inline: the pre-flag sizing
(sessions_per_frontend + 16, at least 128) was inlined in the side
report's block while every other shape-derived limit lives on
StratumLimits, and the topology block repeated the per-frontend
admission record, so one report carried the same fact from two sources
(the arguments and the launch environment). The formula is now a
StratumLimits method, and the per-frontend block -- read back from the
environment the process was launched with -- is the one record.

Refs #275

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@djh58

djh58 commented Sep 22, 2026

Copy link
Copy Markdown
Member Author

Real-process proof: 2,000 sessions admitted at the default (128)

Two runs on this host, both under the shared measurement lock, one frontend, 2,000 sessions, 400k-window, release binaries, managed PostgreSQL 16.15.

Binaries. Server built from this branch with cargo build --locked --release (server source is untouched by the PR): sha256 b75af8931eaa92dc37922937d136b7b7e5fa6317922cb1f2d8b00ac3437508ef, byte-identical to the pinned base build the #275 profiling used, server_revision_evidence: established. Harness at 7d242ad: sha256 99b8c5d984df0976088d3550266d5f3a15625f49ed91d7b7d3f80e73253aa0bb (run 2); run 1 used the harness built at b566cd6 (a15c1903…), whose launch path is identical.

Run 2 (comparable shape, same arguments as the #275 two-frontends 128-permit arm): --replication none --frontends 1 --sessions 2000 --window-shares 400000 --external-tips 4 --warmup-seconds 60 --plan short --rate 1 --steady-state-seconds 60 --reconnect-seconds 60 --slow-database-seconds 60 --runtime-workers 8 --db-max-connections 16 --blockpoll-seconds 2, flag omitted.

  • frontend_environment[0].stratum_admission: max_pending_initial_jobs: 128, max_connections: 4064, source: "default", production_default: 128, pre_flag_harness_value: 2016; launched env PRISM_STRATUM_MAX_PENDING_INITIAL_JOBS=128.
  • Every session held work before the first phase (the run's own gate); client.connects: 2013 (2,000 initial + 13 reconnects), disconnects: 0, failure_count: 0.
  • Time to usable work, four external tips: sessions_with_work 2000/2000 on each; slowest session 1237 / 1216 / 1216 / 1210 ms after the node's tip stamp (p50 1135 / 1109 / 1115 / 1102). The profile's 128-permit arm on the pinned base measured 1228–1271 ms; the 2016-permit arm 1265–1490 ms.
  • Reconnect phase: 13 completed, 0 failed attempts, p99 13.3 ms.
  • Rejections: none in any phase; 11 no-response submits in slow_database (the base arms show 4–12), so the artifact self-check reports the usual slow-phase shortfall and nothing else. Harness exit 0; durability findings, ACK/commit divergence, unknown-outcome and no-response commits all 0.

Run 1 (my first shape: --rate 50 --replication async, otherwise as above, 3 tips): the admission result is the same (2000/2000 on every tip at 1244–1301 ms, 13/13 reconnects, 0 disconnects, 0 rejections in warm-up, steady state and reconnect). Its slow_database phase rejected 2,654 of 2,999 offers with share was not confirmed by the database (server log: share commit deadline passed before COMMIT was sent, ACK p50 13.1 s) plus 212 no-responses. That is the base server's commit path at 50 shares/s through a 400k window under the 10 ms proxy delay with a 16-connection pool, not admission: no first-job builds happen in that phase, and the same binary at 1 share/s (run 2, and every base arm) shows none. Reported here so nobody reads run 1's invalid artifact as an admission finding.

Both runs prove configuration and admission of all 2,000 sessions only; neither is a performance comparison.

…art-phase caveat (#275)

Independent adversarial review of #497 (Fable, on adeef89):

- The throughput measurements doc gave the pre-flag admission as
  sessions_per_frontend + 16 without the 128 floor, so the 200-session
  premise probes, which ran the floor, would have been "reproduced" at
  116. The row now states the floor and says which rows need the flag.
- The README's test summary said 16 configuration keys; the server's
  CONFIGURATION_KEYS has 17 and the test asserts against its length.
- The README's honest-values note covered the setup queue but not the
  reconnect phase's drained restart, where a frontend's whole session
  set re-enters the same permit queue: reconnect p50/max are not
  comparable across the admission-flag boundary either, and it says so.

Docs only; no source change, so the 2,000-session proof on 7d242ad
stands.

Refs #275

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@djh58

djh58 commented Sep 22, 2026 •

Copy link
Copy Markdown
Member Author

Deep-review ledger (final round)

Head reviewed: 1339971 (docs-only on 7d242ad; source unchanged since 7d242ad, so the 2,000-session proof above stands). Stakes: low, harness configuration and reporting only.

Lanes

Lane Status Findings
/code-review medium run inline by the author (not independent) 2, both fixed (adeef89)
Thermo-nuclear quality pass run inline by the author (not independent) 2, both fixed (7d242ad)
Fable adversarial independent reviewer, on adeef89; the adeef89..1339971 delta (formula moved onto StratumLimits, topology duplicate removed, docs) was not covered by that lane 4 minor plus a restart-phase caveat, no blocker: 3 fixed (1339971), 2 rejected
Coordinator delta review independent, on the docs-only delta 7d242ad..1339971 none
Codex adversarial not run: no verified capacity on the host —
CI green on 7d242ad (attempt 2 after an infrastructure flake) and on 1339971 (attempt 2 after a timing flake) 2 flakes, re-run

Dispositions

Id Claim Disposition
code-review-1 std::env::set_var inside a threaded test binary races libc getenv; the property it served is already env_clear fixed: the launch test now shows the cleared environment on a variable Cargo really inherits
code-review-2 README said each queued session waits behind "at most 128 builds"; the permit queue is FIFO inside the 30 s initial-job timeout fixed: README restated
thermo-1 pre-flag admission formula inlined in the report code instead of on StratumLimits fixed: StratumLimits::pre_flag_max_pending_initial_jobs
thermo-2 topology duplicated the per-frontend stratum_admission record (two sources for one fact) fixed: per-frontend block, read back from the launch environment, is the one record
fable-adv-1 measurements doc gave the pre-flag formula without the 128 floor, so the 200-session premise probes would be "reproduced" at 116 fixed: floor stated, rows that need the flag named
fable-adv-2 stratum_limits arithmetic overflows at --sessions ≥ 2^63 (debug panic in validate, release wrap) rejected: pre-existing arithmetic relocated from the run path; reachable only with 2^63 sessions; a --sessions upper bound is outside this PR
fable-adv-3 admission block reports source: "default" even when the launched value is null rejected: unreachable through the harness (the launch path always sets the key and a restart reuses the same map); null is the honest unknown, and source names where the run's argument came from
fable-adv-4 README said 16 configuration keys; the validator has 17 fixed
fable-adv-restart README did not say reconnect p50/max are not comparable across the admission-flag boundary (the drained restart re-enters the permit queue) fixed: README caveat added
ci-1 Python unit tests (shard 3) failed on 7d242ad attempt 1: toolchain metadata download timed out before any test ran rejected as a flake; re-run passed
ci-2 Rust PostgreSQL contracts (shard 0) failed on 1339971 attempt 1: candidate_storm::drained_rows_cost_the_same_statements_at_the_baseline_and_storm_cardinalities, "a pooled connection opened inside the measured window" rejected: a server-side timing guard (#438) in code this PR does not touch; the same test passed on 7d242ad; re-run

No open findings. Not merged by me.

@djh58
djh58 merged commit a42f519 into 3.x.x Sep 22, 2026
38 of 41 checks passed
djh58 added a commit that referenced this pull request Sep 28, 2026
…nd a per-PR smoke run (#521 item 6) (#536)

* 3.x.x: load-harness realism, checked-in presets, a nightly workflow and a per-PR smoke run (#521 item 6)

qbit-prism-load gains a realistic population, all of it off by default so
every existing run takes its old code paths byte for byte:

- --recipients N and --recipient-weights uniform|zipf:s|pareto:a|
  whale:f+<dist>: distinct payout addresses whose sessions and seeded
  window shares follow the weights. The window's recipients are the live
  sessions' addresses, with the programs the server derives for them.
- --session-hashrate-sigma and --session-difficulty vardiff:<ratio>: each
  session asks for its own difficulty with d= in its Stratum password. The
  configured difficulty is the window difficulty over the mean offered
  multiplier, so the window keeps its length.
- --template-bits: a harder fake network, so a three-order spread over a
  400k window stays above 2^-32, the least a share target can express. The
  entry check refuses a spread below that floor.
- --arrival bursty:cv1,cv60,max: per-second and per-minute rate bursts.
- --pool-fee-bps: the pool fee on, as mainnet runs it.
- --seed: every draw is reproducible.
- --plan tips: warm-up only, with no artifact.

The side report records the generated and driven population per address,
and each phase's realised arrival.

Presets in crates/qbit-prism-load/presets pin every result flag. The
harness and a test both refuse a preset that omits one or leaves it to a
default. There are 16: the #271 D1 20k fixture, #275's tip-delivery
benchmark, a 500-address variant of each, #473's eight D1 cells exactly as
run on a193705 (pre-#497 admission), mainnet-floor, growth-5x,
growth-20x and the smoke preset. qbit-prism-load-gate holds a run to its
preset's gates: exit 0, reconciliation, per-phase shortfall, #473's rule
where asked, and the tip-to-last-notify p99. It prints #473's verdict-table
columns.

.github/workflows/prism-load-nightly.yml runs the nightly presets on 8 vCPU
runners, and any selection on dispatch. It records pg_test_fsync, uploads
the reports and writes a job summary. Its live-nightly job runs the opt-in
live_regtest variants listed in test/prism-nightly-gated-tests.txt and
proves them with the gate manifest.

The per-PR smoke run is a gated test that drives the smoke preset against a
debug server and adds about a minute to its shard.

Refs #521, #473

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* 3.x.x: refuse a pinned preset flag on the command line, and gate reconciliation as the harness defines it (#521)

A preset flag pinned false or null is left off the expanded command line,
so clap never saw it twice. The command line could then set it and run a
different workload under the preset's name and SHA-256: --recipients, a
burst, --mid-flight-kill or --database-url on tip-275, for example.
expand_command_line now refuses any flag the preset pins, whatever its
value.

The gate failed a run whose reconciliation had a committed share without
an acknowledgement, although the harness explains each one and exits 0 for
a submit whose answer the drain window cut off. It now gates acknowledged
shares missing from PostgreSQL. It reports those commits beside their
explanations. An unexplained commit is still a durability finding, and a
divergence inside the run still exits 5, and both remain gated.

Refs #521

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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