Sunday, 29 November 2026

Placement gravity, closed: what petclinic showed, and the forces it pointed to

Placement gravity was registered to ask whether new code gets to choose where it goes, or is pulled into the place that already holds its data. I've now read its petclinic replications, and I'm closing the study as registered. Its main test, the OfficeHQ runs, hasn't been read. It goes to a new study, still unread, with a plan that will be registered before anyone looks at it. This post covers what petclinic showed, what I found when I looked at the same data a different way, and why that's a new study rather than another revision of this one.

What the registered tests said

Petclinic was never the main test. It's a replication: one application, 60 change requests, grown by the agent under Spring and under OfficeFloor, with seven sets of runs readable for a verdict (four agent conditions, some repeated). Each set of runs is decided on its own. Here's how the hypotheses fared across the seven:

  • H1, the force. Not supported in any of the seven. OfficeFloor was forced less in every one: half-way through the stream, its rate of forced placements was between 0.06 and 0.53 of Spring's. But the hypothesis also said the gap would widen as the code grew, and it didn't. It narrowed. OfficeFloor's forcing caught up as its code grew.
  • H2, a core draws code in. Supported in four of seven.
  • H3, the encapsulation fills. Supported in six of seven, reversed in one.
  • H4, function injection forms no core. Supported in three of seven.
  • H5, surface against volume. Reversed in six of seven, not supported in the seventh. For the same amount of logic, OfficeFloor added more link weight than Spring, and the gap grew. That's the drift I described from the practice chain: the agent writing OfficeFloor helper methods that call each other. It was real, and it held in the replications.
  • H6, shape does not draw code in. Supported in four of seven; the rest unresolved or not supported.
  • H7, co-change spread does not see the force. Unresolved in five, not supported in two.

Every verdict, with its intervals, is in the study's results index, produced by its scripts. Taken together, they don't support the study's story as it was written. Some parts held (the encapsulation fills; forcing is lower with function injection), and the central claim, that the gap widens, failed.

There's also a limit I should have weighed more. Petclinic sends every rule through one endpoint, POST /api/owners. One handler in one controller receives nearly everything. It's a weak place to learn how code spreads across many handlers.

Looking at the same data differently

After the verdicts were in, I asked a different question of the same data: not "how often is code forced?" but "each time new code is written, which class does it go into, and why?"

That's a choice among every class in the codebase, and there's a well-known model for choices: McFadden's conditional logit, from econometrics, built in the 1970s to predict how people choose between ways to travel. Each option gets a score from its features, and the chance of choosing it follows from the scores. The well-known "rich get richer" model of network growth, preferential attachment, turns out to be its simplest case, with size as the only feature. So the model lets several forces compete for each placement and says how strongly each one pulls.

I'm describing this carefully, because it's exploration after the fact. I built the model while looking at these data, so nothing below supports anything. It's where the next study's hypotheses come from. The numbers come from scripts kept with the new study, and they'll be regenerated by its full pipeline before they're relied on.

  • The problem sets the amount; the form sets the place. Both frameworks added about the same code per change request (Spring's amount was 0.80 to 0.97 of OfficeFloor's). But Spring put 71 to 87% of it into its top three classes, against OfficeFloor's 23 to 31%.
  • Births. When new lines went into a class, Spring opened a brand-new class only 12 to 15% of the time. OfficeFloor did so 54 to 64% of the time.
  • Mass. Where new code went was led by where earlier code had gone, in both frameworks.
  • Sinew forces. The more of a class's fields and methods earlier code was tied to (its sinew), the more likely new code arriving there was forced. The slope was about the same in both frameworks. And a forced placement added five to thirty times as much sinew as a chosen one, so the two feed each other.
  • Swap the births and you swap the frameworks. Simulating each framework with the other's birth rate swapped their concentration: Spring spread out, and OfficeFloor bunched up.

If that holds up, it changes where I'd say function injection helps. It doesn't seem to change the law by which sinew forces code. It changes how often new code starts somewhere new, so fewer classes ever gather enough mass to fall into that loop.

Why a new study, not another revision

I could have amended the plan again. I don't think that would be honest. The new model isn't a tweak to a hypothesis. It's a different question, and I found it by looking at data the old plan had already been read on. Amending a registered plan around what you've just seen is exactly what registration is meant to stop.

So the old study closes as registered, with its verdicts as they stand, including the ones against OfficeFloor. The new one starts from a clean plan, and its confirmatory data are the OfficeHQ runs, which have still not been read, plus open-source samples nobody has looked at.

The new study: placement choice

The new plan is written in the language of physics, because each word is a measured quantity:

  • Birth: new code opening a new class.
  • Mass: how much code a class has gathered, and how often new code has gone there before.
  • Sinew: the data of a class that the code in it is tied to.
  • Forced: new code that had no other class it could go into.
  • The loop: sinew forces code in, and forced code adds sinew.
  • The event horizon: the point where most new code reaching a class is forced. Past it, the class is a black hole.

It also makes a claim against the usual way of judging code. Shape and other code-quality metrics (long methods, complexity, coupling, god-class rules) describe the shape of the solution after it has formed around its problem. The forces are what cause concentration. So the study tests whether the forces forecast where code will go, and which classes will become black holes, better than the quality metrics do.

There are two parts, planned together and registered once:

  • The physics of placement, on the OfficeHQ runs (Spring against OfficeFloor, ten chains each, 250 change requests): births, the pull of mass, sinew forcing under both frameworks, and how many classes pass the event horizon.
  • Forces, not shape, on open-source histories: whether the forces forecast black holes better than size or change hotspots, and better than the quality metrics.

How it will be run

Everything runs on the exploration data first, through the same scripts the real data will go through. That way the code and its results are tested where a mistake costs nothing:

  1. Build. The pipeline and its tests, including fitting data simulated from known forces and checking the model gets them back.
  2. Petclinic. The exploration above, rerun by the real scripts. Its numbers must come back, or each difference gets explained.
  3. Open-source exploration. A first sample of histories.
  4. Freeze. The open decisions settled, and the plan tagged. That's the registration.
  5. Confirmation. The OfficeHQ runs, then the confirming open-source samples.

There'll be a lab note like this one at each step. Every number in them will come from a script's output, with the file named, and each output will record the commit, the inputs and the seeds that made it. The lock on the confirmatory data is in the code: the scripts refuse to read it until the registration tag exists.

Guarding against myself, again

I created OfficeFloor, and this note is about a study whose central claim failed. Moving on from it could look like walking away from a result I didn't like. So, to be clear:

  • The old study's verdicts stay published as they fell, including H5, where OfficeFloor did worse.
  • The new hypotheses came from exploration and are labelled that way. They're only tested on data nobody has read.
  • One of the new study's main hypotheses predicts no difference between the frameworks: that sinew forces code by the same law in both. If OfficeFloor turns out to escape that law, the hypothesis fails.

The old study, its plan and every result are in placement-gravity-study. The new plan, still a draft, is PLAN.md in placement-choice-study, with the exploration it came from beside it.

No comments:

Post a Comment