Context
docs/output/class-hierarchy.json is written by buildScripts/docs/generateDocsJson.mjs:447-451 with indent: 0, so all 712 entries occupy a single 36,770-byte line. Git cannot 3-way merge a single line. The consequence is that any two PRs that each add a class conflict on this file, no matter how unrelated their code — and the conflict carries no semantic disagreement whatsoever.
Observed tonight while computing a merge order across the 12 open PRs. #18253 and #18258 conflict in both merge directions:
after #18253 -> #18258 : CONFLICT (content): Merge conflict in docs/output/class-hierarchy.json
after #18258 -> #18253 : CONFLICT (content): Merge conflict in docs/output/class-hierarchy.json
Decoding the map at all three revisions shows the two sides are disjoint (dev = 712 entries):
| PR |
adds |
removes |
| #18253 |
Neo.dashboard.dock.window.TopologySeams → Neo.core.Base |
none |
| #18258 |
Neo.toolbar.ActionButton → Neo.button.Base |
none |
Two additions that do not disagree about anything, reported as a content conflict purely because they land on the same line.
This is not the first occurrence. On 2026-08-22, PR #17562 conflicted on this same file against #17557, from the same cause — each side had added a class (Neo.list.Buffered on one side, a rename on the other). Two independent occurrences on the same artifact.
The Problem
The cost is not the conflict itself; it is that the correct resolution is non-obvious and the wrong one is invisible.
Because the file is generated, hand-merging it is always wrong even when it produces plausible-looking output — a dropped entry inside a 36KB single-line JSON blob has no visual signature. The correct resolution is npm run generate-docs-json, and the freshness property (does re-running the generator now produce no diff?) is a different question from conflict-freedom. An agent or contributor who resolves by inspection rather than by regeneration produces a file that is conflict-free and wrong.
The class-hierarchy-freshness workflow does run on push: dev as well as on pull requests, so a bad resolution is caught — but it is caught by turning dev red after the merge, not by preventing it. The guard is a backstop, not a substitute for the file being mergeable in the first place.
As the swarm's PR throughput rises, the collision rate rises with it: tonight 2 of 12 open PRs added a class, and every such pair is a guaranteed conflict.
The Architectural Reality
- Producer:
buildScripts/docs/generateDocsJson.mjs:447-451 — writeJSON({path: './docs/output/class-hierarchy.json', indent: 0, force: true}, hierarchyJson). Keys are already sorted (sortedKeys.forEach at :441), so the file has a stable, deterministic key order. That ordering is what makes a line-per-entry form well-behaved under merge: disjoint insertions land at different line offsets.
- Consumer:
ai/services/knowledge-base/helpers/classHierarchyContract.mjs in neomjs/neo-agent-brain, via loadClassHierarchy() → fs.readJson(hierarchyPath). The load is a parse, so it is insensitive to whitespace.
- Why the file is tracked at all:
#16600. extends is hashed into every Knowledge Base chunk id (KB_DatabaseService.createContentHash), so a plane that cannot read the hierarchy re-identifies the whole corpus. Tracking fixes absence and introduces staleness in its place, which is what class-hierarchy-freshness guards.
- Critically, the hash input is the
extends VALUE, not the file's bytes. DatabaseService.mjs:162 hashes a content string built from parsed values; nothing under ai/services/knowledge-base/ hashes the raw file. Whitespace is therefore invisible to the identity contract — re-serializing cannot re-identify a single chunk.
This is the question that has to be answered before touching the file at all, and it answers in the safe direction.
The Fix
Change indent: 0 to indent: 1 at buildScripts/docs/generateDocsJson.mjs:449, and commit the regenerated docs/output/class-hierarchy.json in the same change (required by class-hierarchy-freshness, which compares the committed file against what the generator produces now).
Verified by control/treatment on the three real revisions from tonight, one variable changed:
| serialization |
git merge-file (dev base, #18253 vs #18258) |
result |
indent: 0 (as shipped) |
CONFLICT |
— |
indent: 1 |
CLEAN |
both entries present, valid JSON, 714 keys |
The merged pretty-printed output carries Neo.dashboard.dock.window.TopologySeams at line 247 and Neo.toolbar.ActionButton at line 489 — the union, with no manual intervention.
indent: 1 rather than indent: 4 keeps the size growth to one leading space per entry; the file goes from one line to 714, which is the entire point.
Contract Ledger Matrix
| Target Surface |
Source of Authority |
Proposed Behavior |
Fallback |
Docs |
Evidence |
docs/output/class-hierarchy.json (on-disk form) |
generateDocsJson.mjs:447-451 |
one key per line, keys still sorted |
none needed — no consumer reads bytes |
workflow header comment in .github/workflows/class-hierarchy-freshness.yml needs no change (it describes staleness, not format) |
indent: 0 → indent: 1 is the only producer edit |
loadClassHierarchy({hierarchyPath}) |
classHierarchyContract.mjs:40-46 (neo-agent-brain) |
unchanged |
unchanged |
unchanged |
reads via fs.readJson; parse is whitespace-insensitive |
| KB chunk identity |
DatabaseService.mjs:162, #16600 |
unchanged |
unchanged |
unchanged |
hash input is the parsed extends value, not file bytes; no createHash over the file exists |
class-hierarchy-freshness guard |
.github/workflows/class-hierarchy-freshness.yml:84 |
unchanged |
unchanged |
unchanged |
git diff --exit-code on the file — passes as long as the regenerated file is committed |
Decision Record impact
none. No ADR under learn/agentos/decisions/ governs this artifact's serialization. The change is aligned-with #16600's rationale for tracking the file: it makes the tracked artifact mergeable without altering what makes it identity-bearing.
Acceptance Criteria
Out of Scope
- The portal data files under
apps/portal/resources/data/**. Several are single-line and far larger (tickets/idMap.json at 469KB), but they are data-sync pipeline output — written by the pipeline, which AGENTS.md §critical_gates 3 names as the explicit direct-commit exception, not co-edited by two feature PRs. The collision profile is different and they are not covered here.
- The same conflict class in
neomjs/neo-agent-brain (config-leaf-parity.json, retry-bound-registry.json have both produced this conflict historically). Different repo, different owners; if it is worth a systematic pass, that belongs there rather than bundled into a neo build-script change.
- Any change to what the generator computes, to
all.json, or to the freshness workflow's triggers.
Avoided Traps
- Hand-merging the file. Always wrong for a generated artifact, and uniquely dangerous here because a dropped entry in a single-line 36KB blob is invisible on inspection. The resolution is regeneration; this ticket removes the need for one.
- Assuming whitespace is load-bearing because
#16600 calls the file an identity input. It is an identity input by its parsed content. Reading the incident framing without checking DatabaseService.mjs:162 would have blocked this fix on a risk that does not exist.
- Treating this as a merge-order problem. It cannot be sequenced away: the conflict is guaranteed for every class-adding pair, so ordering only chooses which PR pays it.
- Reaching for
indent: 4. Solves the merge property identically while inflating a tracked file for no benefit.
Related
#16600 — why this file is tracked at all; the chunk-identity rationale this change is verified against.
#18253, #18258 — the pair whose conflict surfaced this. Neither is blocked by this ticket; their conflict resolves by regeneration today.
- PR
#17562 / #17557 (2026-08-22) — the prior independent occurrence, same file, same cause.
Handoff Retrieval Hints
query_raw_memories: "class-hierarchy.json generated artifact merge conflict single line serialization" — surfaces both occurrences and the take-dev-then-regenerate resolution discipline.
- Producer anchor:
buildScripts/docs/generateDocsJson.mjs:447-451. Consumer anchor: ai/services/knowledge-base/helpers/classHierarchyContract.mjs:40-46 in neomjs/neo-agent-brain.
- Reproducer: fetch two PR heads that each add a class into namespaced refs, then
git merge-tree --write-tree the second against a synthesized merge of the first.
Ownership
unowned-rationale: Found by the nightshift heartbeat while computing a merge order, not while working this surface. The heartbeat's finish-or-release rule forbids claiming a lane it cannot complete in the same run, and this needs a code change plus a regenerated artifact plus a merge-property test — more than a heartbeat should start and drop. Parked deliberately, fully specified, free for any seat to take.
Live latest-open sweep: checked the latest 20 open issues at 2026-09-04T04:49Z; no equivalent found. A2A claim sweep over the last 30 messages (window 04:14Z-04:48Z): no [lane-claim]/[lane-intent] on this scope. Memory Core rationale sweep: 8 results, surfacing the 2026-08-22 occurrence as prior art rather than a prior decision against fixing it. Own-assignment sweep: 20 open issues assigned to me, none on this surface.
Context
docs/output/class-hierarchy.jsonis written bybuildScripts/docs/generateDocsJson.mjs:447-451withindent: 0, so all 712 entries occupy a single 36,770-byte line. Git cannot 3-way merge a single line. The consequence is that any two PRs that each add a class conflict on this file, no matter how unrelated their code — and the conflict carries no semantic disagreement whatsoever.Observed tonight while computing a merge order across the 12 open PRs. #18253 and #18258 conflict in both merge directions:
Decoding the map at all three revisions shows the two sides are disjoint (dev = 712 entries):
Neo.dashboard.dock.window.TopologySeams→Neo.core.BaseNeo.toolbar.ActionButton→Neo.button.BaseTwo additions that do not disagree about anything, reported as a content conflict purely because they land on the same line.
This is not the first occurrence. On 2026-08-22, PR
#17562conflicted on this same file against#17557, from the same cause — each side had added a class (Neo.list.Bufferedon one side, a rename on the other). Two independent occurrences on the same artifact.The Problem
The cost is not the conflict itself; it is that the correct resolution is non-obvious and the wrong one is invisible.
Because the file is generated, hand-merging it is always wrong even when it produces plausible-looking output — a dropped entry inside a 36KB single-line JSON blob has no visual signature. The correct resolution is
npm run generate-docs-json, and the freshness property (does re-running the generator now produce no diff?) is a different question from conflict-freedom. An agent or contributor who resolves by inspection rather than by regeneration produces a file that is conflict-free and wrong.The
class-hierarchy-freshnessworkflow does run onpush: devas well as on pull requests, so a bad resolution is caught — but it is caught by turningdevred after the merge, not by preventing it. The guard is a backstop, not a substitute for the file being mergeable in the first place.As the swarm's PR throughput rises, the collision rate rises with it: tonight 2 of 12 open PRs added a class, and every such pair is a guaranteed conflict.
The Architectural Reality
buildScripts/docs/generateDocsJson.mjs:447-451—writeJSON({path: './docs/output/class-hierarchy.json', indent: 0, force: true}, hierarchyJson). Keys are already sorted (sortedKeys.forEachat:441), so the file has a stable, deterministic key order. That ordering is what makes a line-per-entry form well-behaved under merge: disjoint insertions land at different line offsets.ai/services/knowledge-base/helpers/classHierarchyContract.mjsinneomjs/neo-agent-brain, vialoadClassHierarchy()→fs.readJson(hierarchyPath). The load is a parse, so it is insensitive to whitespace.#16600.extendsis hashed into every Knowledge Base chunk id (KB_DatabaseService.createContentHash), so a plane that cannot read the hierarchy re-identifies the whole corpus. Tracking fixes absence and introduces staleness in its place, which is whatclass-hierarchy-freshnessguards.extendsVALUE, not the file's bytes.DatabaseService.mjs:162hashes a content string built from parsed values; nothing underai/services/knowledge-base/hashes the raw file. Whitespace is therefore invisible to the identity contract — re-serializing cannot re-identify a single chunk.This is the question that has to be answered before touching the file at all, and it answers in the safe direction.
The Fix
Change
indent: 0toindent: 1atbuildScripts/docs/generateDocsJson.mjs:449, and commit the regenerateddocs/output/class-hierarchy.jsonin the same change (required byclass-hierarchy-freshness, which compares the committed file against what the generator produces now).Verified by control/treatment on the three real revisions from tonight, one variable changed:
git merge-file(dev base, #18253 vs #18258)indent: 0(as shipped)indent: 1The merged pretty-printed output carries
Neo.dashboard.dock.window.TopologySeamsat line 247 andNeo.toolbar.ActionButtonat line 489 — the union, with no manual intervention.indent: 1rather thanindent: 4keeps the size growth to one leading space per entry; the file goes from one line to 714, which is the entire point.Contract Ledger Matrix
docs/output/class-hierarchy.json(on-disk form)generateDocsJson.mjs:447-451.github/workflows/class-hierarchy-freshness.ymlneeds no change (it describes staleness, not format)indent: 0→indent: 1is the only producer editloadClassHierarchy({hierarchyPath})classHierarchyContract.mjs:40-46(neo-agent-brain)fs.readJson; parse is whitespace-insensitiveDatabaseService.mjs:162,#16600extendsvalue, not file bytes; nocreateHashover the file existsclass-hierarchy-freshnessguard.github/workflows/class-hierarchy-freshness.yml:84git diff --exit-codeon the file — passes as long as the regenerated file is committedDecision Record impact
none. No ADR underlearn/agentos/decisions/governs this artifact's serialization. The change is aligned-with#16600's rationale for tracking the file: it makes the tracked artifact mergeable without altering what makes it identity-bearing.Acceptance Criteria
buildScripts/docs/generateDocsJson.mjswritesdocs/output/class-hierarchy.jsonwith one entry per line; sorted key order preserved.docs/output/class-hierarchy.jsonis committed in the same change, soclass-hierarchy-freshnesspasses on the PR.node -eparse of the committed file yields the same key/value map as before the change — entry count and everyclassName -> superClassNamepair identical. Format-only diff, proven rather than asserted.npm run generate-docs-jsonon the merged result produces no diff (freshness, not merely conflict-freedom).Out of Scope
apps/portal/resources/data/**. Several are single-line and far larger (tickets/idMap.jsonat 469KB), but they are data-sync pipeline output — written by the pipeline, whichAGENTS.md §critical_gates 3names as the explicit direct-commit exception, not co-edited by two feature PRs. The collision profile is different and they are not covered here.neomjs/neo-agent-brain(config-leaf-parity.json,retry-bound-registry.jsonhave both produced this conflict historically). Different repo, different owners; if it is worth a systematic pass, that belongs there rather than bundled into a neo build-script change.all.json, or to the freshness workflow's triggers.Avoided Traps
#16600calls the file an identity input. It is an identity input by its parsed content. Reading the incident framing without checkingDatabaseService.mjs:162would have blocked this fix on a risk that does not exist.indent: 4. Solves the merge property identically while inflating a tracked file for no benefit.Related
#16600— why this file is tracked at all; the chunk-identity rationale this change is verified against.#18253,#18258— the pair whose conflict surfaced this. Neither is blocked by this ticket; their conflict resolves by regeneration today.#17562/#17557(2026-08-22) — the prior independent occurrence, same file, same cause.Handoff Retrieval Hints
query_raw_memories:"class-hierarchy.json generated artifact merge conflict single line serialization"— surfaces both occurrences and the take-dev-then-regenerate resolution discipline.buildScripts/docs/generateDocsJson.mjs:447-451. Consumer anchor:ai/services/knowledge-base/helpers/classHierarchyContract.mjs:40-46inneomjs/neo-agent-brain.git merge-tree --write-treethe second against a synthesized merge of the first.Ownership
unowned-rationale:Found by the nightshift heartbeat while computing a merge order, not while working this surface. The heartbeat's finish-or-release rule forbids claiming a lane it cannot complete in the same run, and this needs a code change plus a regenerated artifact plus a merge-property test — more than a heartbeat should start and drop. Parked deliberately, fully specified, free for any seat to take.Live latest-open sweep: checked the latest 20 open issues at 2026-09-04T04:49Z; no equivalent found. A2A claim sweep over the last 30 messages (window 04:14Z-04:48Z): no
[lane-claim]/[lane-intent]on this scope. Memory Core rationale sweep: 8 results, surfacing the 2026-08-22 occurrence as prior art rather than a prior decision against fixing it. Own-assignment sweep: 20 open issues assigned to me, none on this surface.