Wednesday, 2 December 2026

Petclinic Through the Real Pipeline: What Held, What Changed, and What Did Not

In Phase 1, we ran all eight exploratory Petclinic datasets through the scripted pipeline (step03 to step07). Each dataset compares Spring and OfficeFloor solving the same problems under four agent strategies. Then we placed the new numbers beside our earlier scratch scripts in results/phase1/COMPARISON.md.

Phase 1 uses stricter definitions than the scratch scripts. Sinew now measures return to core members beyond chance (cores.py). H3 is tested within a class. Forced code ignores dependency injection because a field is a field. Handlers are removed. Following the study's rules, findings against OfficeFloor and against our hypotheses sit right beside the ones that support them.

1. The picture: same amount of code, very different places

Across all eight Petclinic datasets (results/model/<dataset>/REPORT.md), Spring and OfficeFloor wrote about the same amount of new code per problem. The Spring over OfficeFloor ratio of new code per problem (S1) ran from 0.73 in petclinic-just-solve-202608081920 to 1.02 in petclinic-impact_gated-202609010045.

Where that code landed stayed very different (results/phase1/COMPARISON.md and REPORT.md).

  • Top three class share (S1). Concentration in the top three classes was 1.46 to 3.23 times higher in Spring across the eight datasets. In petclinic-just-solve-202608100006, top three share was 0.80 in Spring and 0.25 in OfficeFloor. Effective classes were 4.12 in Spring and 26.04 in OfficeFloor.
  • The method level (D4). A fair critique of OfficeFloor is that a single function class in OfficeFloor looks like a method in Spring. If you count methods instead of classes, the gap shrinks a lot. OfficeFloor placed 90% to 97% of new lines into new methods, compared with 74% to 91% in Spring. Top three share over methods was 0.03 to 0.09 in OfficeFloor and 0.08 to 0.30 in Spring. The study tests encapsulation at the class level and reports method spread beside it as shape (PLAN.md §11 row 23).

2. Births (H1) and the simulation (H8)

The clearest and steadiest difference across all eight datasets is how often each form opens a new class.

  • H1 (odds of a new class, Spring vs. OfficeFloor). The odds ratio ran from 0.03 to 0.52 across all eight datasets (p = 0.005 in every one, passing Holm in all eight). In petclinic-just-solve-202608100006, OfficeFloor's birth rate was 0.64 (0.70 on additive units, 0.45 on mutative units). Spring's birth rate was 0.14 (0.15 additive, 0.10 mutative).
  • Swapping births in simulation (H8). In petclinic-just-solve-202608100006, giving Spring OfficeFloor's birth rate moves simulated effective classes from 5.93 (4.74 to 7.32) to 30.23 (21.37 to 38.17). Giving OfficeFloor Spring's birth rate drops it from 53.02 (42.73 to 60.99) to 9.41 (7.04 to 12.22).
  • Where the model falls short. The simulation makes both forms spread out too much compared with reality. It simulates 53.02 effective classes against 26.04 observed in OfficeFloor (2.04 times higher). In Spring it simulates 5.93 against 4.12 observed (1.44 times higher). Births and the four core forces miss how much the problem itself points new code back to the same classes. The extended fit confirms this, giving problem relevance a weight of 3.72 in OfficeFloor and 1.65 in Spring in just-solve-202608100006.

3. Size, sinew, the loop, and black holes

Here is what held across the eight runs, followed by where the numbers did not go our way.

  • Black holes by volume (H4). Spring minus OfficeFloor black hole volume share was 0.00 in the short 20 checkpoint 202608011310 run and 0.30 to 0.66 across the seven 60 checkpoint runs. It passed Holm in 5 of 8 datasets (p = 0.005 to 0.020). In petclinic-just-solve-202608100006, Spring's black hole volume share was 0.66 (with 0.55 in the single largest black hole) against 0.00 in OfficeFloor.
  • The loop (H7). In Spring, forced placements gained 0.41 to 0.93 more sinew than chosen ones (p = 0.005 to 0.020 in 7 of 8 runs). In OfficeFloor, the gap was -0.07 to 0.07 (p = 0.368 to 1.000, never passing) because OfficeFloor rarely built sinew over 60 checkpoints.
  • Size (H2) and direction (S3). Size pulled harder in Spring in 6 of 8 runs (0.06 to 0.84 weight difference). However, it went slightly the other way in impact_gated-202609010045 (-0.20) and cohesion-prompt-202609160027 (-0.22). Cross lagged S3 (forces leading shape minus shape leading forces) was positive (p = 0.005 to 0.015) in 7 of 8 OfficeFloor runs (0.11 to 0.19) and 6 of 8 Spring runs (0.05 to 0.09).
  • PMD God classes. In Spring, between 9% (impact_gated-202609010045) and 100% (just-solve-202608081920) of black holes were flagged PMD GodClass at the end. In just-solve-202608100006, 45% of Spring's black holes that were clean at the 60% split became God classes by the end. Only 8% of similar sized non black holes did (difference 0.37, p = 0.010).

Two big warnings: H3 within a class and S2 forecasts

Two findings cut against a clean story. Both shape what happens next.

  1. H3 within a class mostly failed to pass on 60 checkpoints.
    In the old scratch scripts, the pooled sinew slope looked strong in Spring (0.38 to 1.46 here too). Once we tested within a class instead (PLAN.md §11 row 10), the picture changed.
    • In Spring, the within class sinew slope ran from -0.24 to 0.42. Seven of eight intervals crossed zero. Only cohesion-prompt-202609160027 passed on its own (0.29, p = 0.015), and not after Holm. Among changes that also edit a class's own lines, the slope was noisy or negative (-0.85 to 98.92).
    • In OfficeFloor, too few classes had sinew. The slope was not estimable in 3 runs, strongly negative in just-solve-202608100006 (-15.00), flat or negative in 3 runs (-0.33, -0.10, 0.28), and positive in impact_gated-202609031757 (1.13, p = 0.008).
    • What this triggers in Gate 2 (PLAN.md §8.5). Sixty checkpoints of Petclinic are too short to settle H3 within a class. By the pre written Gate 2 rules, H3 now depends on whether the long open source histories in Phase 2 (open-source-explore) show a clear positive slope.
  2. S2 held out forecasts lost to single metrics in OfficeFloor, and often in Spring.
    • On H9, shape added almost nothing over the forces (-0.44 to 0.02 of the forces' gain over guessing, p = 0.005 to 0.015 in all 8 runs and both arms).
    • On S2 (where held out code goes), the best single metric beat the forces model in all 8 OfficeFloor runs. Forces minus the best metric was -0.10 to -0.29 log probability per choice, reversed in 7 of 8 runs. In Spring it was negative or near zero in 5 of 8 runs (-0.79 to 0.10). In just-solve-202608100006, metrics (-3.601 OfficeFloor, -1.518 Spring) and mass alone (-3.622 OfficeFloor, -1.821 Spring) outscored the full forces model (-3.682 OfficeFloor, -1.873 Spring). Adding sinew to change count helped Spring's forecast in 6 of 8 runs (+0.06 to +0.43, p = 0.005), while adding 0.00 in OfficeFloor (p = 1.000).

4. What changed from the exploration and why

Putting exploration/petclinic/ beside the real pipeline (results/phase1/COMPARISON.md) showed two clear patterns.

  • Physical outcomes held closely. In just-solve-202608100006, Spring's top three share was 0.80 vs 0.80, and OfficeFloor's was 0.24 vs 0.25. Effective classes were 4.00 vs 4.12 in Spring and 27.20 vs 26.04 in OfficeFloor. Births were 0.13 vs 0.13 in Spring and 0.61 vs 0.64 in OfficeFloor.
  • Model weights shifted where bugs and definitions changed. Fixing the set likelihood bias and dropping the single endpoint handler term raised choice weights sharply. In just-solve-202608100006, choice home rose from 0.29 to 1.15 in Spring and from 0.50 to 4.29 in OfficeFloor. OfficeFloor's choice volume flipped from -3.70 to 0.52 once shape stand ins left the core fit. Redefining sinew shrunk Spring's event horizon from 9.20 to 4.48 and moved OfficeFloor's forcing sinew from 1.07 to -14.30 because almost no OfficeFloor classes built a core.

5. Sinew from change alone: gas clouds, single cores, and several cores

Gate 5 in PLAN.md §8.5 asked a sharp question. Is our new definition of sinew (cores.py) just mass in disguise?

Phase 1 gave a clear answer.

  • The shuffle test is clean. We kept each class's exact mass and shuffled which members each change bound at random. Sinew collapsed to 0.00 to 0.02 across all eight datasets in both forms. Compare that with real Spring sinew of 0.14 to 0.55 among classes with enough changes to tell. Returning to core members is real structure, not raw change count.
  • Mass explains less than half of sinew in most runs. R² of log sinew on log mass in Spring was 0.25 to 0.53. Seven of eight runs sat below Gate 5's 0.5 cutoff, with cohesion-prompt-202609160027 at 0.53. In OfficeFloor it was 0.07 to 0.36.
  • Class kinds at the end. In OfficeFloor, 77% to 100% of evolving classes were gas clouds (no core), 0% to 4% were single core, and 0% had several cores. In Spring, 43% to 74% were gas clouds, 12% to 52% were single core, and 0% to 3% had several cores. In just-solve-202608100006, 94% of Spring's black holes had a single core (6% had several cores and 0% were gas).

What this means next

Phase 1 confirmed the birth gap (H1), the dispersion gap (S1), the black hole volume gap in 60 checkpoint runs (H4), and that sinew captures genuine core re use rather than mass. At the same time, it left two big open questions before any freeze. H3's within class slope was too weak or noisy over 60 checkpoints to confirm, and S2's placement forecast lost to simple metrics and mass in OfficeFloor and most Spring runs.

Next is Phase 2 (open-source-explore). We are now measuring 283 real open source Java repositories with long commit histories to see whether within class forcing and the forces' forecast edge appear over real timelines.

Building the Measuring Stick Before Looking at the Data

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.one had true value -1.0. Mean estimate was -0.991 with coverage 0.940.
  • birth.mutative had true value -0.5. Mean estimate was -0.504 with coverage 0.960.
  • choice.mass had true value 1.5. Mean estimate was 1.491 with coverage 0.890.
  • choice.size had true value 0.5. Mean estimate was 0.505 with coverage 0.950.
  • choice.home had true value 0.7. Mean estimate was 0.725 with coverage 0.950.
  • choice.sinew had true value -0.3. Mean estimate was -0.307 with coverage 0.920.
  • forcing.sinew had true value 0.6. Mean estimate was 0.592 with coverage 0.950.
  • forcing.mass had true value -0.3. Mean estimate was -0.305 with coverage 0.940.
  • loop.forced_minus_chosen must sit above 0. Its mean was 0.601 with SD 0.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.5 on the logit). H1 passed in 7.0%. H3 within a class passed in 7.0% on the first arm and 0.0% on both arms. H4 passed in 0.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 why H3 now 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.8 of the second arm's. The H3 "one law" test passed in 0.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.

  • mass was 1.397081 in all three, with SE 0.161326.
  • size was 0.415097, with SE 0.137825.
  • home was 1.330063, with SE 0.472059.
  • sinew was -0.369249, with SE 0.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.