An AI coding agent adds features and fixes over dozens or hundreds of changes. Where does the new code land? Why do a few classes end up swallowing almost everything near them?
That is what this study asks. To keep it concrete, we use a physical picture. Every word in it is a measured number.
- Births. Opening a new class for new code instead of adding to an existing one.
- Mass and size. How many earlier changes put code in a class, and how much code sits inside it.
- Sinew. Repeated changes to a class keep binding to the same core fields and methods. It happens more often than chance would explain.
- Forcing. New code binds to a class's own members. Once it touches that class's state or methods, it could not easily live somewhere else.
- The loop, event horizon, and black hole. Suppose sinew raises the odds that arriving code is forced. Suppose forced code adds more sinew. Past an event horizon, half of the arriving code is forced. The class becomes a black hole that pulls in nearly everything near it.
We test two forms of code on the same problems. Spring uses handlers and methods. OfficeFloor uses function injection, which opens new classes for new functions. Alongside that comparison, we test forecasts. Can these forces predict where code goes and which classes turn into black holes better than code shape and quality metrics?
Why build and lock the pipeline first
In an earlier study (placement-gravity-study) and a later Petclinic exploration, we built the hypotheses after looking at the data. Looking at data to invent hypotheses proves nothing if you test them on the same data.
So for this study, the confirmatory data are locked in the code. runs.yaml marks the confirmatory datasets as confirmation. Those are ui-primary for Paper A, and open-source-human-confirm and open-source-agent for Paper B. The scripts refuse to fetch, measure, fit, or even list them until a manual git tag named plan-v1 is an ancestor of HEAD.
Phase 0 builds the measuring and modelling pipeline first. Then it tests the pipeline on synthetic worlds where we already know the true numbers.
How we know the model and tests work
step02_selftest.sh ran four checks. All results come from labnotes/briefs/phase0.md.
1. Automated tests and the code lock
From results/selftest/TESTS.md, all 33 tests passed in 167.78s. There were 2 RuntimeWarning overflow messages in placement_choice/model/fitting.py. The suite includes the test proving the lock blocks confirmatory data before plan-v1.
2. Recovering known forces
From results/selftest/recovery/RECOVERY.md, we generated 100 synthetic datasets of 10 chains each. Each dataset came from known birth, choice, and forcing weights. We ran them back through the measurement pipeline (placement_choice.model.recovery) and fitted the model. A parameter passes when its 95% interval covers the true value at least 85% of the time, targeting 95%.
All 14 checks passed.
birth.onehad true value-1.0. Mean estimate was-0.991with coverage0.940.birth.mutativehad true value-0.5. Mean estimate was-0.504with coverage0.960.choice.masshad true value1.5. Mean estimate was1.491with coverage0.890.choice.sizehad true value0.5. Mean estimate was0.505with coverage0.950.choice.homehad true value0.7. Mean estimate was0.725with coverage0.950.choice.sinewhad true value-0.3. Mean estimate was-0.307with coverage0.920.forcing.sinewhad true value0.6. Mean estimate was0.592with coverage0.950.forcing.masshad true value-0.3. Mean estimate was-0.305with coverage0.940.loop.forced_minus_chosenmust sit above0. Its mean was0.601with SD0.235.
This check caught a real bug from our earlier Petclinic exploration. Sometimes one checkpoint places new lines into several existing classes at once. The exploration treated the other chosen classes as rejected alternatives. That biased every choice weight toward zero. Replacing it with a set likelihood summed over drawing orders removed the bias. This is recorded in PLAN.md §11 row 5.
3. Testing the tests where there is nothing to find
From results/selftest/size/SIZE.md, we ran placement_choice.model.size on 100 synthetic datasets per world. Each dataset had 10 chains per arm and 200 bootstrap draws. A test fails the check if it passes in more than 10% of runs.
- A world with no force. Here sinew does not raise forcing, while each class keeps a lasting leaning of its own (SD
1.5on the logit).H1passed in7.0%.H3within a class passed in7.0%on the first arm and0.0%on both arms.H4passed in0.0%. All passed the check. - Why pooling classes fails. We also ran the old pooled slope beside the table. It mixed differences between classes with changes inside a class. It falsely passed in
23.0%of runs. That is whyH3now tests within a class (PLAN.md§11 row 10). - A world on the edge of the band. Here the first arm's sinew slope is
0.8of the second arm's. TheH3"one law" test passed in0.0%.
4. Checking the Python fit against R
From results/selftest/crosscheck/CROSSCHECK.md, we fitted the same conditional logit data in Python and in R using survival::clogit and mclogit.
masswas1.397081in all three, with SE0.161326.sizewas0.415097, with SE0.137825.homewas1.330063, with SE0.472059.sinewwas-0.369249, with SE0.122586.
The largest gap was 4.02e-09 on estimates (tolerance 0.0001) and 1.95e-10 on standard errors (tolerance 0.001).
What comes next
The pipeline passed every synthetic check. This brief ran on a dirty tree at commit e68b0f770, so we will rerun on a clean commit before registration. Next is Phase 1. We run all eight exploratory Petclinic datasets through the real pipeline using ./step03_pin_chains.sh through ./step07_phase1_report.sh. That will show what holds, what changes, and what needs work before looking at open source histories.
No comments:
Post a Comment