Repository navigation
Description
Overview
Phase 2 (of 4) of the test-mode size-realistic-samples feature: implement the PYAUTO_TEST_MODE_SAMPLES knob so PYAUTO_TEST_MODE=2/3 bypass runs write a samples.csv whose row count and byte size match a production Nautilus SLaM stage (N ~ 10k–100k), making cold SLaM runs instant while keeping resume-overhead profiling honest. The design is locked — implement D1–D4 from the phase 1 issue verbatim: #1378 (comment) (phase 1 record: PyAutoMind complete/2026/07/test-mode-representative-samples-phase-1-design.md).
Blocked at creation: PyAutoFit is claimed by aggregator-sqlite (#1377). Parked in PyAutoMind planned.md; starts when the claim frees.
Plan
- PyAutoConf (PR 1, merges first):
test_mode_samples()accessor inautoconf/test_mode.pynext totest_mode_level()— env varPYAUTO_TEST_MODE_SAMPLES, default 4,N < 4raisesValueError. - PyAutoFit (PR 2): re-export via the
autofit/non_linear/test_mode.pyshim; extend_build_fake_samples—N == 4keeps today's literal branch byte-identical;N > 4vectorized numpy synthesis (seed 0, prior-median row 0,logL_i = best − i, weights∝ exp(−i/(N/10))normalized) through the productionSample.from_lists → SamplesPDF → write_tablepath. - Tests: the 7-item numpy-only list from D3 (exact 4-sample back-compat; summary/chaining; save→load round-trip; aggregator + database at N=1000; functional N=50k, no hard timing asserts;
N=3 → ValueError).
Detailed implementation plan
Affected Repositories
- PyAutoFit (primary)
- PyAutoConf (accessor; merge first — dependency direction autofit → autoconf)
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./PyAutoFit | main | clean — claimed by aggregator-sqlite (#1377) |
| ./PyAutoConf | main | clean |
Branch: feature/test-mode-representative-samples · Worktree: ~/Code/PyAutoLabs-wt/test-mode-representative-samples/ (created by /start_library once unblocked)
Implementation Steps
- PyAutoConf
autoconf/test_mode.py: addtest_mode_samples()(D1 semantics; docstring in the module's existing register). - PyAutoFit
autofit/non_linear/test_mode.py: add to import +__all__. - PyAutoFit
autofit/non_linear/search/abstract_search.py_build_fake_samples: keep theN == 4literal branch untouched; add theN > 4vectorized branch per D2 (numpy(N, D)scatterp·(1+1e-3·G), zero-handling as today, best-first monotone logL, normalized exp-decay weights,log_prior = 0). - Tests per D3 in
test_autofit/non_linear/(numpy-only; no JAX anywhere). - Note in the PR's API-change summary: new env var, default-unset behaviour unchanged — phases 3 (autolens_profiling recipe) and 4 (docs) consume it.
Key Files
PyAutoConf/autoconf/test_mode.py— new accessor (D1)PyAutoFit/autofit/non_linear/test_mode.py— shim re-exportPyAutoFit/autofit/non_linear/search/abstract_search.py—_build_fake_samples(D2)
Guard-rails from the design (do not re-derive)
- Bypass write path applies no weight pruning (
samples_above_weight_threshold_fromis updater.py-only); the D2 weight floorw_min ≈ (10/N)e⁻¹⁰ ≥ 4.5e-10keeps threshold-applying loads safe for N ≤ 1e5 (threshold1.0e-10). - Parity target measured: 10,187 rows × 21 cols = 9.07 MB (
hst_fastsource_lp[1]). - Mode 3 (
logL_best = -1e99) must work unchanged in both branches.
Original Prompt
Click to expand starting prompt
Test-mode representative outputs — Phase 2: core API
Type: feature
Target: autofit
Repos:
- PyAutoFit
- PyAutoConf
Difficulty: medium
Autonomy: supervised
Priority: normal
Status: formalised
Phase 2 of 4 of draft/feature/autofit/test_mode_representative_outputs_size_realistic.md.
Implements the D1–D4 decisions locked in phase 1 (..._phase_1_design.md) — do not
reopen them. Blocked until phase 1's decisions are posted.
Scope
- Implement the sample-count knob (per D1) — default 4, so existing behaviour is
byte-identical when the knob is unset. Touch @PyAutoConf only if D1 placed the
accessor next totest_mode_level()inautoconf/test_mode.py. - Extend
_build_fake_samplesin @PyAutoFit
(autofit/non_linear/search/abstract_search.py) to synthesize N samples per the
D2 recipe. Vectorized numpy — no per-Sample python loops; N=50k must generate
in seconds or the feature defeats its purpose. - Unit tests for the D3 downstream contract at large N:
samples.summary()
quantiles,result.model/result.instancechaining, multi-batch structural
guarantees; plus default-unset back-compat (exactly today's 4 samples). Library
unit tests are numpy-only — no JAX. - Aggregator scrape / database load on a large-N synthetic output verified as part
of the ship gate (workspace_test if a library unit test can't cover it cleanly).
Ship
ship_library: PyAutoFit PR (+ PyAutoConf PR if touched, merged first per the
dependency graph). The PR's API-change summary unblocks phase 3.
Activity
Jammy2211 commentedon Jul 17, 2026
Library PRs created — implementation of the locked D1–D4 design is complete:
test_mode_samples()accessor (merge first)_build_fake_samplesN>4 branch + 7 unit testsGate: PyAutoConf 138 passed; PyAutoFit full suite 1493 passed / 1 skipped; e2e bypass fit at N=10,000 in 1.7 s (samples.csv 10,000 rows / 1.31 MB, min weight 4.5e-8, chaining intact). Heart RED acked by human for PR-open (5 pre-existing unrelated reasons; same set as the 2026-07-16 CTI/COOLEST ships).
Workspace impact: added-only, default-off — no existing script uses the new env var, no migration needed. The downstream legs are already scoped as phase 3 (autolens_profiling pipeline_resume recipe) and phase 4 (docs), issued after these merge.
Jammy2211 commentedon Jul 17, 2026
Shipped and merged — PyAutoLabs/PyAutoNerves#126 (2026-07-17T06:29:36Z) then #1381 (06:29:44Z), per the dependency order.
PYAUTO_TEST_MODE_SAMPLESis live on bothmains. Next: phase 3 (autolens_profilingpipeline_resumerecipe — the paused slam-resume-profiling task #70 is the natural consumer) and phase 4 (docs). Completion record: PyAutoMindcomplete/2026/07/test-mode-representative-samples-phase-2-core-api.md.