Repository navigation
Conversation
The sealed loop builds one ProjectionRNGRegistry per run and puts it on
each period's context; its cost per person draw grows with the horizon.
OP1's harness wrapper now gives every slot (the exit and birth adapters
included) that context with one DirectRNGStreams of the same draw and
horizon in its place, built at the first period, after checking that the
loop's registry is the same object every period. The loop's positional
module generators are untouched, and no sealed file changes.
_project, run_production and run_gate take rng_streams ("direct" by
default, or "registry" for differential checks); OpenPopulationResult
records the mode and the class that served the draws.
tests/open_population/test_stream_injection.py pins the coordinator's
conditions: introspected interface parity; an alias-aware AST scan of
src/populace_dynamics/ outside open_population/ for type checks on the
registry, which skips the two closed modules by path before reading them
and reports only path, line and node kind; a fresh-process check that a
projection imports neither closed module; and projection-hash identity
between the two classes over three sizes, three draws and two horizons
(2027 and 2100), with a Hypothesis extension.
The scan finds one existing sealed check, mortality_observer.py:381
(type(registry) is not ProjectionRNGRegistry, present since e4e512e). It
raises rather than diverging; the test pins it and two behaviour tests show
the refusal, so an OP1 run composing that observer passes
rng_streams="registry".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Condition 3 of the injection ruling: OP1's slots now draw their person and tagged streams from DirectRNGStreams, so the stream differential covers every period 0 to n at horizons 0, 1, 7 and 75, all eight modules, draws 0, 1 and 9, and every method. Both generator comparisons now also check bit_generator.state before and after drawing. A bad-address grid on the same horizons compares refusal type and message, and a Hypothesis test draws addresses, valid or not, across them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
op1_run_size.py now runs each invented size in three modes: registry (adapters and emigration on ProjectionRNGRegistry), direct_emigration (OP1 before the injection) and direct (the default). Each record names the stream classes the adapters and the exit adapter were observed to receive, the SHA-256 of streams.py, harness.py and exits.py, and the process CPU time, and profiles the adapters' direct draws with disjoint setup wrappers. The script stops if a mode runs another class or if the modes' projection hashes differ. The committed op1_run_size.json is unchanged; the host rerun replaces it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Section 6 of op1_report.md records the mechanism, the four invariants, each of the coordinator's five conditions with its tests and evidence, the one sealed type check the scan found (mortality_observer.py:381) and its disposition, the commands and results of this build's runs, and a restricted-files statement. Section 2 notes that it measured OP1 as merged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Self-review found that a module binding overwritten on every fixed-point pass could grow without end on a cycle such as "a = b.c; b = a", which would hang the scan on such a module. Module bindings now keep their first value, so each pass only adds names; a negative case pins it. A comparison now counts when any of its operators, not only the first, is an identity, equality or membership test; a chained spelling pins it. The report's counts follow: 442 passed and 1 strict xfail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d49d081's message said the report's counts followed, but its report edit had failed, so only the test change landed. This commit adds them: 32 spellings and nine negatives, a binding cycle among them; chained comparisons; and 442 passed and 1 strict xfail, with all 76 of the new module's tests rerun after that change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The main session reran op1_run_size.py on the host at 441b9f7 with sizes 25, 100 and 400. The three stream modes give the same projection hash at each size, matching section 2's hashes, and the direct default takes 3.13 s at 400 people against 26.50 s on the registry. The run goes to op1_run_size_injection.json so that op1_run_size.json stays the evidence for section 2's two-mode run. Section 6 reports the run and the host's test rerun. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Keep the observer's loud refusal of the direct class, and re-raise it under the default as IdOrStreamCollision naming rng_streams="registry", chained from the sealed error. Only that exact plain ValueError is re-raised; run_production's and run_gate's docstrings say composing observe_mortality needs the registry mode. - Compare the scan's hits with the pinned set exactly, as sorted lists. - Skip the depletion-cut modules (bridge/depletion_cut*.py) by path, like the two closed modules. Tests pin the pattern and its three matches, check the tree's excluded set by directory listing, and check after a fresh projection that no depletion_cut module was imported. - Run the 2100 identity grid over the full product of sizes and draws. - Report the rulings, the host rerun (346 passed, 1 xfail) and six mutants. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ct-r1) - Scan: a catch-all now reports every other mention of the class, its name or its module's name outside imports, docstrings, __all__, annotations and construction. The specific checks follow checking-function aliases, class info in containers, unions, + joins, subscripts and named expressions, loop and attribute bindings, name and module comparisons, match values, quoted dispatch hints and private-attribute reads. - The text filter is gone; inert literal containers are pruned after parsing, with a differential test and a Hypothesis property showing that pruning changes no result. The real tree still gives exactly the pinned hit. - 58 invented spellings, all twelve of the review's among them; 56 run and answer differently for the two classes. 16 negatives. - The binding test compares every PeriodContext field with the loop's own context, so a changed draw index, metadata or ordinals fails it. - Section 6: the review's findings and fixes, the scan's coverage and limits, RSS within 1.4 MB, base 9cced8f and three evidence files, the generator helpers and entrant years stated exactly, refreshed line references and the host results. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review inject-r2 found static checks the scan missed outside its stated limits. The scan now tracks DirectRNGStreams as well as the registry, treats each read of a place the catch-all trusts as a specific check, and reads text built from literals through a bounded folder. All 38 of r2's checks give hits, and the real-tree pin is unchanged. Following the coordinator's suggestion, the guarantee is now behavioural. A pinned census lists the 23 sealed places that reach a context's streams. The ten runnable readers and the composition helper run on invented inputs with both classes, under Hypothesis, and their outputs are compared exactly. Section 6 of the report presents the scan as a heuristic with four stated classes of limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rs, flag deep literal code - The folder's limits now apply to each value it computes; a source literal is kept as written. A module's folded values share a 1 MiB budget, past which the scan stops with an error naming the module. Edge, literal and budget tests pin each limit. - A property's setter, getter or deleter is trusted only on a property defined above it in the same class body; register stays trusted by spelling, and the report says so. - Literal code is parsed five levels deep; a call whose code would be a sixth level is reported as dynamic code. - Each folder method and builtin has a call checked against Python, and the Hypothesis grammar takes the one-argument and width methods. - The class-info, instance and module-path walks keep their own stacks, so chains thousands of links long scan without RecursionError. - Four spellings a mutant sweep found unpinned: class info read by a method and rebuilt, and an instance bound in a conditional and in a boolean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Against master 172f690, tests/open_population adds 457 node ids (432 in test_stream_injection.py, 25 in test_streams.py) and removes none; all collect as unit. unit moves from 18,789 to 19,246 and the total from 25,359 to 25,816. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Section 6 now names master 172f690 as the base, lists the two tier files the recount sets, describes the merge and the recount, and records the host run at ec888be: tests/open_population 694 passed and 1 strict xfail, the seven-path command 1,022 passed, 2 skipped and 1 strict xfail, 24 of 25 scan mutants killed (the survivor makes a path no module has), and the old-vs-new scan differential with only its intended differences. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 of 7 tasks
This branch was successfully deployed
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.
Draft: waiting on independent review and CI. Follow-up to #566. Head
305b171b. OP1's adapters now take their person and tagged draws fromDirectRNGStreamsby default instead of the sealedProjectionRNGRegistry. The projection is the same draw for draw; the direct class is cheaper.rng_streams="registry"keeps OP1's behavior from #566.No sealed code changes. Against master
172f690fthe branch changes nine files:open_population/harness.py,open_population/gates.py,tests/open_population/test_streams.py, the newtests/open_population/test_stream_injection.py,op1_report.md(new §6),op1_run_size.py, the newop1_run_size_injection.json, and the two tier files the recount sets (tests/tier_counts.json,tests/README-tiers.md). Engine, baselines,cola_track_a,track_b,gates.yaml,runs,scriptsandtests/estimatesare unchanged.How it works
engine/loop.py:216–217), so the substitution lives in OP1's wrapper,_AdapterStreams(open_population/harness.py).DirectRNGStreamswith the registry's draw index and horizon. Every slot of a period then receives onedataclasses.replace(context, rng_registry=<direct>); every other field is the loop's own object._project,run_productionandrun_gatetakerng_streams: Literal["registry", "direct"] = "direct". Any other value is refused before anything runs.OpenPopulationResultrecords the mode and the class that served the slots.IdOrStreamCollisionnamingrng_streams="registry", chained from the original. Only that exact plainValueErroris re-raised; every other error passes through unchanged.Invariants
bit_generator.stateand draws); at every bad address both refuse with the same exception type and message.The guarantee is behavioural: invariant 2 at every address, the reader runs, and invariant 1 end to end. The scan is a heuristic beside them; §6 of the report states its limits as four classes (values made at run time, introspection of run-time values, files read as data, and code it does not read).
Tests
test_stream_injection.py(new, 432 tests, unit tier):rng_registry,person_generatororcomposition_rngs_from_registry, each with the run that checks it or the reason none does. The ten runnable readers (mortality, SES mortality, earnings with three invented models, both claiming steps,di_aware_claiming, ASFR births, DI uniforms, the fertility capture andPeriodContext.person_generator) andcomposition_rngs_from_registryrun on invented inputs with both classes, 12 Hypothesis examples each, and their outputs are compared exactly. Another test checks each reader's output depends on the draw index;src/populace_dynamics/, a heuristic that tracks both classes. Specific checks name each kind of type check and each read of a place the catch-all trusts (__all__, docstrings, annotations, namespaces, source text, dynamic code, member introspection). Under them a catch-all reports every other use of either class, of an instance, of a module object that can reach one, and of their names as text once literal expressions are folded by a bounded folder;PeriodContextfield exceptrng_registrywith the loop's own context.test_streams.py: the generator comparisons also checkbit_generator.state, so the existing exhaustive grid and Hypothesis tests check state too.bridge/depletion_cut*.py), so their input does not depend on who runs them. Tests pin the pattern and its three matches, and a fresh-interpreter test checks that no production or gate run imports any of them.The one sealed type check
The scan finds one:
mortality_observer.py:381refuses any context whose registry is not exactly aProjectionRNGRegistry. It raisesValueErrorbefore drawing, so it fails loudly. An OP1 run that composes this observer must passrng_streams="registry";run_production's andrun_gate's docstrings say so, and no entry point composes it. The scan's hits must equal this one pinned entry exactly, so a new, moved or removed check fails the test.Measurement
On the host, the three stream modes give the same projection hash at 25, 100 and 400 people, the same hashes as #566. At 400 people the default takes 3.13 s, against 26.50 s with every draw on the registry and 17.60 s for OP1 as merged. Peak RSS is 192 to 203 MB in every mode.
Plan
8634858c): keep the observer's loud refusal with a clearer OP1 error; full 2100 grid; depletion-cut exclusion.8634858c:tests/open_population346 passed and 1 strict xfail; the seven-path command 665 passed, 2 skipped and 1 strict xfail. Six mutants of the new code are killed.8634858c: REVISE. One major (static type checks the old scan missed) and three minor (a field mutant the binding test missed; an RSS figure; evidence wording).33e383b4: the two-layer scan, the field-by-field binding test and the report corrections. Host rerun:tests/open_population437 passed and 1 strict xfail; the seven-path command 756 passed, 2 skipped and 1 strict xfail; the real-tree scan still finds exactly the one pinned check. Thirteen more mutants are killed.33e383b4: REVISE. One major (13 more static checks escaped the scan outside its stated limits), one minor (no bytes regression) and a nit.5a4fc14c: the scan tracks both classes and checks reads of the places it trusts; a bounded literal folder; bytes spellings. Following the coordinator's suggestion, the guarantee is now behavioural: the reader census and runs above, with the scan presented as a heuristic. Host rerun:tests/open_population614 passed and 1 strict xfail; the seven-path command 933 passed, 2 skipped and 1 strict xfail; the real-tree scan still finds exactly the one pinned check, and all 38 of r2's checks give hits. 32 scan and folder mutants and three stream mutants are killed.5a4fc14c: APPROVE, with one minor finding (the folder's limits were stated without their scope) and two nits (accessor decorators trusted by name; nested literal code parsed five levels deep, unstated). It also noted that droppingpartitionfrom the folder failed no test and that long+chains raisedRecursionErrorin the scan.56fa57ca: the folder's scope stated, with a 1 MiB per-module budget; accessors trusted only on a property above them; adynamic-codehit past five levels; a call to each folder method and builtin; stack-based walks; four spellings a mutant sweep found unpinned.619282e7merges master172f690fwithout conflicts (its tree is the onegit merge-treewrites), andec888be7recounts.tests/open_populationcollects 457 more node ids than master (432 new, 25 intest_streams.py), allunit, sounitmoves from 18,789 to 19,246 and the total to 25,816.ec888be7(305b171bchanges only the report):tests/open_population694 passed and 1 strict xfail; the seven-path command 1,022 passed, 2 skipped and 1 strict xfail (master's Track B change adds nine); collection 695, allunit; the real-tree scan still finds exactly the one pinned check, and every module's folded values weigh under a sixty-fourth of the budget; all 38 of r2's checks give hits; the scan at5a4fc14cand now agree on 155 of 163 invented sources, the eight differences being the intended accessor and depth cases, and on the real tree; 24 of 25 mutants of the r3 fixes are killed (the survivor makes a path that startsNone., which no module has), and all three stream mutants.305b171b(GPT-6.1 Sol), covering the r3 fixes, the merge and the recount.305b171b, the tier-policy test included.🤖 Generated with Claude Code