Repository navigation
Expand file tree
/
Copy pathregen-artifacts.mjs
More file actions
1084 lines (1069 loc) · 65 KB
/
Copy pathregen-artifacts.mjs
File metadata and controls
1084 lines (1069 loc) · 65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
/**
* The one table of **generator-owned artifacts** — the files whose merge
* semantics are "recompute from the merged sources", not "three-way text merge"
* (#4675).
*
* Three consumers read this and nothing else: `.gitattributes` (which paths get
* `merge=os-regen`), the merge driver (`git-merge-regen.mjs`), and the
* `pre-commit` hook that makes the deferred regeneration mandatory. They must
* agree exactly, so `git-merge-regen.mjs --self-test` reconciles `.gitattributes`
* against this array in BOTH directions rather than trusting them to stay in
* step — the same reason `check:generated` reconciles its own ledger against
* `package.json` on every run.
*/
/**
* The manifest that owns a row's `gen:`/`check:` names when the row does not say.
*
* Every row declared this implicitly until #13585, and the reconciliation read it
* and nothing else — see `REGEN_ARTIFACTS` for what that cost.
*/
export const DEFAULT_OWNER = '@objectstack/spec';
/**
* The ROOT manifest, by the name it gives itself.
*
* Spelled as a name rather than as a path so it reads the same way as any other
* owner, and pinned against the real root `package.json` by
* `git-merge-regen.mjs --self-test` so the two cannot drift apart silently. The
* root is the one owner that is not a workspace member, which is why `ownerDir`
* answers it directly instead of looking for it.
*/
export const ROOT_OWNER = '@objectstack/spec-monorepo';
/**
* Artifacts the driver takes over. `check` proves currency, `gen` restores it.
*
* `owner` names the manifest that defines those two script names, and defaults to
* `DEFAULT_OWNER`. `--self-test` verifies each name against THAT manifest, so a
* renamed script fails loudly here instead of silently disarming a path.
*
* ## `mixed` — the row is NOT generated whole, and here is when deferring is safe (#14064)
*
* Every other row is generated WHOLE: its generator renders the file's entire
* content in memory and writes it, so nothing on disk survives into the output and
* a merge that keeps one side whole loses nothing a regeneration cannot restore.
* That property is what makes "defer and regenerate" a merge SEMANTICS rather than
* a coin flip, and it is why `NOT_DRIVER_MANAGED` turns MIXED files away
* (`skills/README.md`, `content/docs/ai/skills-reference.mdx` — each in its own
* words: "a deferral would launder the prose"; the migration registry was the third
* until #22554 made it git-ignored build output).
*
* `mixed` is the third answer those two lists could not express. A file can be
* mixed AND still belong here, when the generated half is unreachable by any text
* merge (`content/docs/permissions/system-context.mdx` was the measured case, routed
* from #13646 until #22927 retired its census totals; the site register #26442 has
* since generated on it is left to text-merge, for the reasons its
* `NOT_DRIVER_MANAGED` entry records; no row carries `mixed` today) — but
* then "defer" is only correct for the merges where the discarded side changed
* nothing but the generated half. The value NAMES that equivalence, and
* `git-merge-regen.mjs` holds the mapping from the name to the comparator; an
* unrecognised name makes the driver CONFLICT and the self-test RED, so this fails
* closed in both directions.
*
* ⛔ It is not a licence to route mixed files in general. Reach for
* `NOT_DRIVER_MANAGED` first; `mixed` is for the case where a hand merge provably
* cannot produce the right answer, and it buys back exactly the deferrals that are
* lossless — never the rest.
*
* ## Why the owner is declared and not searched for (#13585)
*
* Until #13585 the verification read `packages/spec/package.json` alone, so an
* artifact owned by ROOT tooling could not be registered at all: its `gen:`/
* `check:` live in the root manifest, and the reconciliation reported them as
* scripts that "no longer exist". That refusal was correct about the tree and
* wrong about the world, and an author following it literally moves root tooling
* into a package it does not belong to, purely to satisfy a lookup path.
*
* Widening the lookup to "resolve the name in any manifest" would have fixed the
* refusal and left a worse seam behind, because the name is not what the other two
* consumers need. The driver prints a regeneration command and the `pre-commit`
* gate SPAWNS one, and both were bound to `packages/spec`; a row that resolved
* somewhere else would be registered and unreconcilable — self-test green, while
* the hook ran the gate in a directory that does not define it and refused the
* commit forever. Measured before this field existed: `pnpm -s check:sdui-lockstep`
* exits 254 (`Command not found`) in the gate's spawn directory and 0 at the repo
* root. So the owner is a declaration all three consumers read, which is what keeps
* the reconciliation two-way rather than merely permissive.
*/
export const REGEN_ARTIFACTS = Object.freeze([
// Sharded by category (#5837): one file per namespace, so two PRs touching
// different categories never share a file. The reason it had to be sharded and
// not merely driver-managed is that the driver is LOCAL — the GitHub merge
// queue rebuilds server-side and runs no custom merge driver, so a textual
// conflict there evicted the second PR and the spec lane could land one at a
// time. The driver still owns the residue: two PRs in the SAME category.
{ path: 'packages/spec/authorable-surface/**', gen: 'gen:schema', check: 'check:authorable-surface' },
// The deletion gate's in-tree anchor (#5235). Same sorted-array shape, same
// conflict — two branches that each re-anchored it differ on the `baseRev`
// header and on whatever main added in between, and a text merge of that is
// never right, so it stays driver-managed.
//
// But it is the one path here with NOTHING TO REGENERATE after a merge. A stale
// copy is not an error (on `main` the merge base is HEAD, so the file
// necessarily trails its own surface by one PR): `check:authorable-surface`
// proves it AUTHENTIC — `baseRev` on origin/main, keys matching that commit —
// never current. Either side of the conflict is an authentic upstream snapshot,
// so the driver keeping OURS is already the resolution, and the pre-commit gate
// passes on it as-is.
//
// `gen` therefore still names `gen:schema` — correct for this file's two
// neighbours, which a merge defers alongside it, and a harmless no-op for this
// one since #5358 took the anchor out of every build. It deliberately does NOT
// name the re-anchoring command (`gen:authorable-surface-base`): that mid-merge
// is exactly #5370, where `merge-base(HEAD, origin/main)` still resolves to the
// branch's OLD fork point and the anchor moves BACKWARDS — authentically, so no
// gate objects. Re-anchor after the merge is committed, or not at all.
// Stays a SINGLE file while its subject is sharded (#5837): nothing but an
// explicit `--update-base` writes it, so it was never on the churn path that
// made the other three the queue's serialization point — and its `baseRev` is
// one commit for the whole surface, which a per-shard copy would let drift.
//
// `alsoWrittenBy` records the generator the paragraph above deliberately refuses
// to name as `gen`, so the #13731 accounting can see that
// `gen:authorable-surface-base` HAS a recorded disposition rather than reporting
// it as a generator nobody has judged. It is a declaration for that reconciliation
// only — no consumer runs it, which is the whole point of it not being `gen`.
{
path: 'packages/spec/authorable-surface.base.json',
gen: 'gen:schema',
check: 'check:authorable-surface',
alsoWrittenBy: ['gen:authorable-surface-base'],
},
{ path: 'packages/spec/json-schema.manifest/**', gen: 'gen:schema', check: 'check:authorable-surface' },
// The #4666 default-value ratchet — what an author gets when they OMIT a key.
// Same producer, same gate and the same sorted-array-per-category shape as its
// authorable-surface sibling, so it merges the same way. A CHANGED default is
// never resolved by regenerating: `check:authorable-surface` adjudicates it
// against the merge base before this file is written at all, so the regen here
// can only ever pick up a NEW key's default.
{ path: 'packages/spec/authorable-defaults/**', gen: 'gen:schema', check: 'check:authorable-surface' },
// `gen:api-surface` reads the BUILT `dist/*.d.ts`, never the source. On a
// stale dist it does not fail — it emits a *plausible* surface missing every
// export added since the last build, and `gen:docs` will ratchet a baseline
// exemption in to cover the hole it leaves. That happened on #4687 and was
// caught only by diffing the generated files against `main`. Hence
// `readsDist`: every path that would regenerate these refuses unless the
// build is newer than the sources it claims to describe.
{ path: 'packages/spec/api-surface/**', gen: 'gen:api-surface', check: 'check:api-surface', readsDist: true },
// Deliberately NOT sharded (#5837): 1.3KB, one line per `defineX` factory —
// never the conflict surface its neighbour was.
{
path: 'packages/spec/api-surface-signatures.json',
gen: 'gen:api-surface',
check: 'check:api-surface',
readsDist: true,
},
// The #4796 declaration-origin baseline: which source declaration each entry
// point's exports resolve to. Sharded per entry point for the same
// merge-queue reason `api-surface/` is, and rewritten by every retirement PR
// — the exact churn profile the driver exists for. NO `readsDist`: it reads
// `src/`, so a merge that moved sources is all it needs to be re-run against.
{ path: 'packages/spec/export-origins/**', gen: 'gen:export-origins', check: 'check:export-origins' },
// The #13712 TS-declaration-name → registry-name map. Composed from
// json-schema.manifest/ + export-origins/ (both rows above, so a regen pass
// that runs in list order refreshes its inputs first) plus a syntactic pass
// over src/ for module-private base declarations. NO `readsDist`: like its
// export-origins sibling it reads `src/` and committed artifacts only.
{ path: 'packages/spec/declaration-map/**', gen: 'gen:declaration-map', check: 'check:declaration-map' },
// `readsSchemaTree` is the `readsDist` above, one artifact over (#4723). Both
// `gen:docs` and `check:docs` render from `packages/spec/json-schema/`, which is
// GITIGNORED — a merge therefore never delivers it, and a leftover tree from
// before the merge describes the sources as they were on one side of it. Until
// #4723 `check:docs` began with `gen:schema`, so the tree was always rebuilt (at
// the cost of a "check" that wrote two tracked files whenever they were behind).
// With that step gone, the freshness is asserted instead: every path that would
// run either script refuses unless the tree is newer than the sources.
{ path: 'content/docs/references/**', gen: 'gen:docs', check: 'check:docs', readsSchemaTree: true },
// [#10096] The schema-free `/meta` URL-spelling data module — the checked-in
// materialization of PLURAL_TO_SINGULAR ∪ registry-derived REST plurals. A
// pure projection of its two sources (no hand-written half), so a conflict is
// always resolved by regenerating; low-churn (moves only when a metadata type
// is declared or the manifest map changes). No `readsDist`: the generator
// tsx-loads `src/`, so a merge that moved sources is all it needs.
{
path: 'packages/spec/src/meta-spelling/meta-url-data.generated.ts',
gen: 'gen:meta-url-spelling',
check: 'check:meta-url-spelling',
},
// #5107. Unlike its neighbours this one is derived from the AST *plus* a
// hand-written column (the ledger's `Class` verdicts feed the per-class
// subtotals), which is exactly why it belongs here rather than in the ledger:
// the arithmetic composes on a merge, the judgement does not, so they had to
// stop living in one file. The ledger itself stays hand-written and is NOT
// driver-managed — regenerating prose would delete somebody's evidence.
//
// #20361 SHARDED it — one `<dir>.md` per source directory, the cross-directory
// totals summed by the gate instead of committed — because the single file's
// global section and posture total were rewritten by every schema PR, and in
// the driver-less server-side merge two PRs in different directories conflicted
// on them. A same-directory pair is the residue this row still routes.
{
path: 'docs/audits/2026-07-unknown-key-strictness-ledger.counts/**',
gen: 'gen:strictness-ledger',
check: 'check:strictness-ledger',
},
// #7377. The liveness ledger's "Current state" table, split the way its
// strictness neighbour above was: the NUMBERS here, the Notes prose left in
// `packages/spec/liveness/README.md`, which is emphatically NOT driver-managed —
// a Note is hand-written measurement, and regenerating one would manufacture a
// verdict. The drift that forced the split was 9 of 30 rows disagreeing with the
// gate, several beside Notes cells that enumerate their dead sets by hand.
//
// Two things distinguish it from the entry above. Its input is not the AST but
// the LIVENESS GATE's own report (`check-liveness.mts --json`, the counting
// method fixed in #4488), spawned by the generator rather than re-implemented —
// a second walker would be a second definition of "classified", and the one that
// wins would be whichever the artifact happened to be rendered from. And its
// `check` is that same gate, so freshness is proven by the instrument that
// produces the numbers rather than by a parser reading them back. No
// `readsDist`: the gate walks `src/` Zod schemas through tsx, so a merge that
// moved sources is all it needs to be re-run against.
//
// #20361 SHARDED it — one `<type>.md` per governed type, no committed total —
// for the reason the three directory rows above were sharded (#5837): this
// driver runs only in a local merge, and the single file's shared total row
// made any two in-flight liveness PRs conflict in GitHub's server-side one.
// Different types now touch disjoint files; a same-type pair still meets on
// that type's one row, and that residue is what this row still routes.
{
path: 'packages/spec/liveness/state-counts/**',
gen: 'gen:liveness-counts',
check: 'check:liveness',
},
// #13646 → #22927. `content/docs/permissions/system-context.mdx`, the elevation
// census page, was the row here: the first one owned by ROOT tooling and the one
// row with `mixed: 'line-anchors'` (#14064 measured a whole-side deferral dropping
// its prose). Its generated half was its `file:line` anchors until #15921 made
// them `path#symbol`, then its census totals until #22927's ruling took those off
// the page with `gen:system-context-census`. #26442 then generated its site
// register (`check-system-context-census.mjs --write`), so it is MIXED again and
// still has no row: its `NOT_DRIVER_MANAGED` entry (`content/docs/permissions/**`)
// records why, and `check:system-context-census` holds the register to the tree
// on every PR. The measurements this row carried are in
// `git log -p scripts/regen-artifacts.mjs`.
// #13335 / #13731. The per-skill reference index — one row per `packages/spec`
// source module, rendered whole by `gen:skill-refs`. Nine tracked files today,
// matched as a SEGMENT glob so a tenth skill arrives routed instead of arriving
// unrouted and silent (`entryForPath` learned the form for this row).
//
// The measured case is #13335's, and it is the textbook shape: PR #13262 and the
// #13263 branch each regenerated `skills/objectstack-ui/references/_index.md`,
// and `git merge origin/main` conflicted on adjacent rows —
//
// - node_modules/@objectstack/spec/src/ui/report.zod.ts — Exports: ReportType, ...
// =======
// - node_modules/@objectstack/spec/src/ui/report.zod.ts — Report Type Enum
//
// Both sides are correct-for-themselves projections of their own tree, and the
// merged tree's index equals NEITHER — the same "no text merge can reach the
// answer" property that once put the elevation census page in this table. The correct
// resolution #13335 records by hand (take either side, commit the merge,
// regenerate, let `check:skill-refs` prove it) is exactly what this row plus
// `os-regen-merge.sh` step 4 do mechanically.
//
// ⚠️ Routing is the CHEAP half and never the protection — the driver is LOCAL, so
// it does nothing for a merge-queue rebuild (the header's standing warning). The
// load-bearing half is server-side and already wired: `check:skill-refs` runs in
// `lint.yml` (`typecheck-source-gates`) on `pull_request` AND `merge_group` with
// no `paths:` filter, and it RE-DERIVES the index from the spec sources rather
// than reading the file back — so it catches the silent case too, which is the
// one that matters here (two branches whose rows do not overlap merge to exit 0
// and a file describing neither side).
//
// No `readsDist`/`readsSchemaTree`: the generator walks `src/` directly.
{ path: 'skills/*/references/_index.md', gen: 'gen:skill-refs', check: 'check:skill-refs' },
// #13731. The ADR-0081 react-tier contract — ONE artifact since #14296 item 3
// retired its machine-readable JSON twin (the same table rendered twice, with
// zero consumers). Generated WHOLE — the markdown's frontmatter and its "do not
// edit by hand" banner are emitted by the generator too, so there is no
// hand-written region for a deferral to launder, which is the question this
// table exists to ask. A projection of the `REACT_BLOCKS` definition in
// `@objectstack/spec/ui`, one section per block: two PRs adding different blocks
// are a set union that git reports as a conflict.
//
// Same cheap-half caveat as its neighbour above, same answer: `check:react-blocks`
// runs in `lint.yml` on `pull_request` and `merge_group`, re-deriving from the
// definition, so the driver removes hand-merge rounds and is never the only signal.
{
path: 'skills/objectstack-ui/references/react-blocks.md',
gen: 'gen:react-blocks',
check: 'check:react-blocks',
},
// #14957. The platform-object tenancy census — which platform-namespace objects
// the tenancy machinery can reach, and the declaration on each excluded object's
// own schema that puts it outside. Generated WHOLE: `renderArtefact` renders the
// entire file in memory, its `$comment` preamble included, so nothing on disk
// survives into the output and there is no hand-written region for a deferral to
// launder — which is the question this table exists to ask. ⇒ `REGEN_ARTIFACTS`
// rather than `NOT_DRIVER_MANAGED`, and no `mixed`.
//
// Two PRs that each add an object land disjoint row sets; the merged tree's
// census equals NEITHER side, and its `totals` / `reasonTotals` equal neither
// either — the same "no text merge can reach the answer" property as its
// neighbours above, sharpened by the aggregates, which a union of rows would
// leave arithmetically wrong while looking merged.
//
// Same cheap-half caveat as its neighbours, same answer: the driver is LOCAL and
// is never the protection. `check:platform-object-tenancy-census` runs in
// `lint.yml` on `pull_request` and `merge_group` with no `paths:` filter, and it
// RE-DERIVES the census from the tree rather than reading the file back, so it
// catches the silent case too — two branches whose rows do not overlap merging to
// exit 0 over a file describing neither side.
//
// No `readsDist`/`readsSchemaTree`: the generator loads its predicate and every
// object declaration from SOURCE (no build), so a merged tree is the whole
// prerequisite.
{
path: 'scripts/platform-object-tenancy-census.json',
gen: 'gen:platform-object-tenancy-census',
check: 'check:platform-object-tenancy-census',
owner: ROOT_OWNER,
},
// The component reference: every file under the directory is rendered whole
// from the repo-root `sdui.manifest.json` by scripts/gen-sdui-reference.mjs, and
// a write removes anything else there, so no hand-written region exists for a
// deferral to launder. Two branches that each change the manifest produce pages
// describing neither side once merged; only regenerating from the merged
// manifest reaches the answer. The manifest itself is not routed — it is built
// from the registry under `ui/` — so a merge resolves it first and this row's
// regeneration reads the result.
//
// Same LOCAL-facility caveat as its neighbours: `check:sdui-reference` runs in
// `lint.yml` on `pull_request` and `merge_group` with no `paths:` filter and
// re-renders from the manifest rather than reading the pages back. No
// `readsDist`: the generator reads the tracked manifest and nothing built.
{
path: 'content/docs/ui/components/**',
gen: 'gen:sdui-reference',
check: 'check:sdui-reference',
owner: ROOT_OWNER,
},
]);
/**
* Files that LOOK generator-owned and deliberately are not. Recorded rather than
* omitted: the dangerous mistake here is adding a path to `.gitattributes` because
* a generator writes it, without asking whether recomputing it can *lose* a
* decision a human made.
*
* Two optional fields, both added by #13731 and both read only by
* `reconcileGenerators` in `git-merge-regen.mjs`:
*
* `gen` / `owner` — the generator whose output this path is. Present where the
* accounting needs it, i.e. where the generator appears in no `REGEN_ARTIFACTS`
* row's `gen` and this entry is therefore the only record of its disposition.
* `owner` defaults to `DEFAULT_OWNER` exactly as a row's does, and it is part
* of the key: `gen:test-typecheck-debt` exists in THREE manifests writing three
* different ledgers, and declaring one of them must not silently account for
* the other two — that was 2 of the 11 unaccounted generators #13731 found.
*
* `untracked` — this path is not in git at all (gitignored build output). The
* disposition is still recorded, because "git never merges it" is an answer to
* the question and its absence is not. Asserted rather than asserted-once: the
* self-test refuses if such a path becomes tracked, which is the moment the
* reason expires and a real disposition is owed.
*/
export const NOT_DRIVER_MANAGED = Object.freeze([
{
path: 'skills/*/SKILL.md',
gen: 'version',
owner: ROOT_OWNER,
why:
'hand-written skill prose carrying two DERIVED lines — the `compatibility:` majors and '
+ '`metadata.version`, which `scripts/check-skill-compatibility-version.mjs --fix` writes from '
+ 'the workspace manifests and the root `version` script re-stamps after every `changeset '
+ 'version`. That `--fix` is what makes the `version` script a generator here, and the answer '
+ 'to "discard both sides and re-run" is NO: a regeneration would restore the two lines and '
+ 'lose every prose edit around them. A text conflict in a SKILL.md stays a human\'s; the two '
+ 'derived lines re-stamp themselves on the next `--fix`, and `check:skill-compatibility` reds '
+ 'until they do.',
},
{
path: 'packages/spec/docs-import-surface.baseline.json',
why:
'a SHRINK-ONLY ratchet. `gen:docs` writes it, but regenerating it can WIDEN it — '
+ 'a fresh gap gets a fresh exemption line, which is precisely how "a ratchet quietly stops '
+ 'ratcheting" (its own words). Recomputing that during a merge would launder a new '
+ 'exemption in as merge noise. A text conflict here deserves a human.',
},
{
path: 'packages/spec/dual-source-exports.baseline.json',
why:
'hand-ratcheted under review by design — check:generated already records that a `gen:` '
+ 'which rewrites it would admit a new dual-source via "run the fix command" instead of via '
+ 'a maintainer decision (#4446).',
},
{
path: 'packages/spec/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
why:
'a SHRINK-ONLY ratchet, same trade as docs-import-surface.baseline.json above (#5286). '
+ '`gen:test-typecheck-debt` writes it, and on a merge it is exactly the file two branches '
+ 'both re-record — but recomputing it mid-merge would record whatever the half-merged tree '
+ 'happens to compile to, and any file that GAINED errors would enter the ledger as merge '
+ 'noise instead of as red. check:generated refuses to auto-regenerate it for the same reason.',
},
{
path: 'packages/spec/variant-docs.json',
why: 'hand-maintained map of the schema variants; `check:variant-docs` audits it against the code, no generator.',
},
{
path: 'packages/spec/src/migrations/registry.ts',
gen: 'gen:migration-registry',
untracked: true,
why:
'GITIGNORED since #22554 (ruling B on that card, completing #22449 B′): generated WHOLE by '
+ '`gen:migration-registry` on `pnpm install` and as the first step of `build`, from two committed '
+ 'sources — `src/migrations/registry.ts.template`, the hand-written skeleton outside the '
+ '`<os-generated …>` markers, and `src/migrations/entries/`, one file per entry. Git never merges '
+ 'it. It was a MIXED committed file from #7297 until then, kept out of the driver because a '
+ "regeneration would launder a sibling's prose edit; that prose now lives in the template, which "
+ 'is plain hand-written source and text-merges like any other, its conflicts a human\'s. A branch '
+ 'that still carries the committed registry meets a modify/delete conflict on its merge of main, '
+ 'which takes no driver: the deletion is the answer. Same expiry clause as the untracked entries '
+ 'above: committing it again turns this entry red.',
},
{
path: 'packages/spec/src/conversions/registry.ts',
why:
'hand-written source. Conflicts here are two conversions appended at the same spot — keeping '
+ 'both is usually right, but "usually" is a human judgement, not a merge rule. Not split per-entry '
+ 'alongside the migrations registry by #7297 (the #6957 ruling names two append registries and the '
+ 'other one is `scripts/adr-anchors.json`, #7301); #29987 split it by a codemod '
+ '(`scripts/codemod-split-conversions-registry.mjs`): each conversion is now a module of its own '
+ 'under `conversions/entries/`, a new file that never conflicts, and what a retirement still edits '
+ 'here is its import line and its list entry — hand-written text a human merges, never regenerated.',
},
{
path: 'content/docs/permissions/**',
why:
'the DIRECTORY is not what #13646 routed, and recording that is the point of this ledger. '
+ 'Its pages are hand-written permissions prose, and two of them are MIXED: hand-written prose '
+ 'around one generated region between BEGIN/END GENERATED markers. `system-context.mdx` was '
+ 'routed as a MIXED file from #13646 until #22927 retired its census totals, and has carried a '
+ 'generated site register since #26442 (`node scripts/check-system-context-census.mjs '
+ '--write`); `tenant-audit-census.mdx` carries the census region `node '
+ 'scripts/tenant-audit-census.mjs --write` rebuilds. NEITHER is routed, re-weighed at #26535: '
+ 'a whole-side deferral would drop the other side\'s prose; the `mixed` escape would buy nothing, '
+ 'since its one comparator, `line-anchors`, blanks `file:line` digits and is the identity on '
+ 'both pages (measured), so every real edit would still take the driver\'s text-merge limb; a '
+ 'row needs a `gen:` script its owner manifest declares, and neither page has one; and the '
+ 'driver runs only in a local merge, never in GitHub\'s server-side one or the queue\'s. What '
+ 'keeps them right is their gates, which hold each region equal to its `--write` output on '
+ 'every PR and queue build in the required `Lint & Repo Gates` job, so a text merge that '
+ 'leaves a region wrong is red, never silent; and the register carries one line per symbol and '
+ 'no total, so two read-adding branches text-merge apart. Routing the tree the way its sibling '
+ '`content/docs/references/**` is routed reads as symmetry and is not: that sibling is '
+ 'generated whole, this one would defer every prose page to OURS and lose the other side\'s '
+ 'edits silently. Should a page generated WHOLE arrive here, route that FILE and leave its '
+ 'neighbours to text-merge, which is correct for prose and always was.',
},
// ── #13731: the remaining generators, one recorded disposition each ──────────
{
path: 'packages/client/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/client',
why:
'a SHRINK-ONLY ratchet — the same file, the same generator and the same trade as '
+ '`packages/spec/test-typecheck-debt.json` above, one package over. It is listed '
+ 'SEPARATELY rather than covered by its sibling on purpose: three manifests define '
+ '`gen:test-typecheck-debt` and each writes its own ledger, so one entry standing for '
+ 'all three would be a disposition nobody actually made for this file. Recomputing it '
+ 'mid-merge records whatever the half-merged tree compiles to, and a file that GAINED '
+ 'errors enters the ledger as merge noise instead of as red.',
},
{
path: 'packages/rest/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/rest',
why:
'a SHRINK-ONLY ratchet — see `packages/client/test-typecheck-debt.json` directly above; '
+ 'same generator, same per-package ledger, same reason a merge must never recompute it.',
},
{
path: 'packages/objectql/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/objectql',
why:
'a SHRINK-ONLY ratchet — see `packages/client/test-typecheck-debt.json` above; same '
+ 'generator, same per-package ledger, same reason a merge must never recompute it: the '
+ 'half-merged tree is not the tree whose type errors this file records, so a file that '
+ 'GAINED errors would enter the ledger as merge noise instead of as red. It is the FOURTH '
+ 'manifest to define `gen:test-typecheck-debt` — the "three manifests" in the client entry '
+ "above and in `reconcileGenerators`'s header is #13731's count of the ledgers that existed "
+ 'then, never a bound, and the per-(owner, script) key is exactly what lets a fourth one '
+ 'arrive needing nothing but this row.',
},
// ── #14062: the `packages/plugins/**` family's starting ledgers ──────────────
//
// The director ruling of 2026-09-01 (maintainer verbatim: 「同意」) onboarded all
// fourteen plugin packages into the `check:test-typecheck` instrument family. Four
// of them measured non-zero and therefore carry a ledger and a
// `gen:test-typecheck-debt` script; the other ten measured ZERO and deliberately
// have NEITHER, because at zero residue a ledger holds nothing while a MISSING one
// is read by the gate as `{ entries: {} }` — under which any error is red
// immediately, with no entry to be added to. That is why this block adds four rows
// and not fourteen: `reconcileGenerators`'s population is the manifest SCRIPTS, so
// a package that defines no generator needs no disposition, and inventing one would
// record a decision about a file that does not exist.
{
path: 'packages/plugins/plugin-approvals/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/plugin-approvals',
why:
'a SHRINK-ONLY ratchet — see `packages/client/test-typecheck-debt.json` above; same '
+ 'generator, same per-package ledger, same reason a merge must never recompute it: the '
+ 'half-merged tree is not the tree whose type errors this file records, so a file that '
+ 'GAINED errors would enter the ledger as merge noise instead of as red. This is also the '
+ 'largest of them (324 errors over 8 files), which makes the merge-noise route the most '
+ 'attractive and the most expensive one to take.',
},
{
path: 'packages/plugins/plugin-auth/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/plugin-auth',
why:
'a SHRINK-ONLY ratchet — see `packages/plugins/plugin-approvals/test-typecheck-debt.json` '
+ 'directly above; same generator, same per-package ledger, same reason a merge must never '
+ 'recompute it.',
},
{
path: 'packages/plugins/plugin-sharing/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/plugin-sharing',
why:
'a SHRINK-ONLY ratchet — see `packages/plugins/plugin-approvals/test-typecheck-debt.json` '
+ 'above; same generator, same per-package ledger, same reason a merge must never recompute '
+ 'it. Its residue is only 3 errors, and that makes it MORE exposed to the failure this row '
+ 'prevents rather than less: a recomputation on a half-merged tree can double a 3 without '
+ 'anyone noticing the number moved.',
},
{
path: 'packages/plugins/knowledge-ragflow/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/knowledge-ragflow',
why:
'a SHRINK-ONLY ratchet — see `packages/plugins/plugin-approvals/test-typecheck-debt.json` '
+ 'above; same generator, same per-package ledger, same reason a merge must never recompute '
+ 'it.',
},
// ── #14173: `packages/lint`'s starting ledger, wired to the same instrument ──
//
// Onboarded by wiring per the triage ruling on #14173 (comment 5502888897,
// 2026-09-02: "onboard by wiring to whichever of the two in-repo routes #14062
// lands on"), which landed on `check:test-typecheck`. This is the fifth row
// this manifest adds for the mechanism — `reconcileGenerators`'s population is
// the manifest SCRIPTS, so a package that defines a generator needs a row and
// one that measures zero needs none, same as the plugin family above.
{
path: 'packages/lint/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/lint',
why:
'a SHRINK-ONLY ratchet — see `packages/plugins/plugin-approvals/test-typecheck-debt.json` '
+ 'above; same generator, same per-package ledger, same reason a merge must never recompute '
+ 'it: the half-merged tree is not the tree whose type errors this file records, so a file '
+ 'that GAINED errors would enter the ledger as merge noise instead of as red. Its residue is '
+ 'only 6 errors over 2 files, which makes it MORE exposed to the failure this row prevents '
+ 'rather than less.',
},
// ── #14504: `packages/runtime`'s starting ledger, same instrument ───────────
//
// The sixth row this manifest adds for the mechanism, and the largest ledger
// in the family: 191 errors over 27 of the package's 214 test files. Size is
// the reason to read this row rather than skim it — a recomputation on a
// half-merged tree writes a number nobody measured, and at 191 nobody would
// spot the difference by eye. The package's `TEST_DEBT` entry in
// `scripts/check-type-check-coverage.mjs` graduated in the same change, so
// this file is now the ONLY record of that population anywhere in the tree.
{
path: 'packages/runtime/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/runtime',
why:
'a SHRINK-ONLY ratchet — see `packages/plugins/plugin-approvals/test-typecheck-debt.json` '
+ 'above; same generator, same per-package ledger, same reason a merge must never recompute '
+ 'it: the half-merged tree is not the tree whose type errors this file records, so a file '
+ 'that GAINED errors would enter the ledger as merge noise instead of as red. This is the '
+ 'BIGGEST ledger in the family (191 errors over 27 files), which makes the failure this row '
+ 'prevents both more likely and harder to see: at that size a recomputed number reads as '
+ 'plausible, and the per-signature keys underneath it would be silently rewritten with it.',
},
// ── #14613: `packages/core`'s starting ledger, same instrument ─────────────
//
// The package declared NO `typecheck` script at all until this PR, so this row
// both opens the ledger and is the reason `pnpm --filter @objectstack/core
// typecheck` now exists.
{
path: 'packages/core/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/core',
why:
'a SHRINK-ONLY ratchet — see `packages/plugins/plugin-approvals/test-typecheck-debt.json` '
+ 'above; same generator, same per-package ledger, same reason a merge must never recompute '
+ 'it: the half-merged tree is not the tree whose type errors this file records, so a file '
+ 'that GAINED errors would enter the ledger as merge noise instead of as red. This file also '
+ 'carries the family\'s clearest instance of the second thing at stake, in its hand-authored '
+ '`_note` (never written by `gen:test-typecheck-debt` — `--update` only ever preserves an '
+ 'EXISTING `_note` verbatim, it never invents or edits one): a human triaged all 4 entries '
+ 'and decided to fix NONE of them in the PR that opened this gate — 2 are one defect twice '
+ 'over (a mock `PluginContext` literal missing three methods) deliberately left for a '
+ "shared-fixture repair already in flight on `@objectstack/metadata`'s own ledger, 1 is a "
+ "genuine open question about whether a test's assertion or a parameter's type is wrong, and "
+ 'the 4th — though mechanical — was left beside them on purpose so the diff that opens this '
+ 'gate stays readable. It also records WHY the ledger opens at 4 and not the 98 the retired '
+ '`check:type-check-coverage` DEBT entry once measured: 94 of those 98 were `tsconfig.json`\'s '
+ 'NodeNext judging vitest-executed ESM, a config-tier artifact this PR\'s `tsconfig.test.json` '
+ 'fixes, not a test repair. None of that triage is reconstructable from source — a mid-merge '
+ 'regeneration can only recompute COUNTS from whatever the half-merged tree compiles to, '
+ 'never re-derive which of those counts a human already chose to defer, or why.',
},
// ── #14710: `packages/cli`'s starting ledger, same instrument ──────────────
//
// The seventh row this manifest adds for the mechanism, and the SMALLEST
// ledger in the family — 28 errors over 3 of the package's 115 test files.
// Size is the reason to read this row rather than skim it, and the reason is
// the opposite of the runtime row's above: at 28 errors over 3 files, a
// recomputation on a half-merged tree does not read as plausible noise, it
// reads as a CLEAN result. Three quarters of this package's test files that
// carry errors would have to vanish for the ledger to look wrong, and a
// recompute that silently drops an entry looks exactly like a repair somebody
// landed. The package's `TEST_DEBT` entry in
// `scripts/check-type-check-coverage.mjs` graduated in the same change, so
// this file is now the ONLY record of that population anywhere in the tree.
{
path: 'packages/cli/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/cli',
why:
'a SHRINK-ONLY ratchet — see `packages/plugins/plugin-approvals/test-typecheck-debt.json` '
+ 'above; same generator, same per-package ledger, same reason a merge must never recompute '
+ 'it: the half-merged tree is not the tree whose type errors this file records, so a file '
+ 'that GAINED errors would enter the ledger as merge noise instead of as red. This ledger '
+ 'is the SMALLEST in the family (28 errors over 3 files) and that cuts the other way from '
+ 'the runtime row above: a recomputed value here reads as a clean, plausible REPAIR rather '
+ 'than as noise, and a dropped entry is indistinguishable from a file somebody fixed.',
},
// ── #12511: the seven ledgered packages that graduated together ───────────
//
// Seven rows and not one, for the reason the `packages/client` row above
// states: `reconcileGenerators` keys on (owner, script), three manifests
// defined `gen:test-typecheck-debt` when that row was written and eleven do
// now, so one entry standing for the family would be a disposition nobody
// actually made for any of these files. Each package's `TEST_DEBT` entry in
// `scripts/check-type-check-coverage.mjs` graduated in the same change, so
// each file below is now the ONLY record of its population anywhere in the
// tree. EIGHT rows since 2026-09-17: `@objectstack/http-conformance` was
// deliberately absent while it had no sibling config and no generator, and
// the director ruling that gave it both (maintainer verbatim: 「同意」) is what
// closed the card at 8 of 8. Its row is the last of this block.
{
path: 'packages/mcp/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/mcp',
why:
'a SHRINK-ONLY ratchet — see `packages/plugins/plugin-approvals/test-typecheck-debt.json` '
+ 'above; same generator, same per-package ledger, same reason a merge must never recompute '
+ 'it: the half-merged tree is not the tree whose type errors this file records, so a file '
+ 'that GAINED errors would enter the ledger as merge noise instead of as red. '
+ 'This is the biggest of the seven (53 errors over 6 files) and 51 of them are ONE idiom — `await '
+ 'res.json()` bound without a narrowing — repeated across four suites. That uniformity is exactly '
+ 'what makes a mid-merge recompute unreadable here: a number that moved from 53 to 49 because the '
+ 'half-merged tree resolved one import differently looks like four repairs somebody landed, and '
+ 'the per-signature keys underneath would be silently rewritten with it.',
},
{
path: 'packages/formula/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/formula',
why:
'a SHRINK-ONLY ratchet — see `packages/plugins/plugin-approvals/test-typecheck-debt.json` '
+ 'above; same generator, same per-package ledger, same reason a merge must never recompute '
+ 'it: the half-merged tree is not the tree whose type errors this file records, so a file '
+ 'that GAINED errors would enter the ledger as merge noise instead of as red. '
+ 'The only one of the seven whose ledger is NOT its recorded per-package number (15, from a '
+ 'recorded 17): the TS1470 x2 dissolved under the sibling config\'s `module: esnext` while '
+ 'everything else survived. A recomputation mid-merge cannot tell a dissolution from a repair, '
+ 'and this file is the only record that the -2 was the former.',
},
{
path: 'packages/platform-objects/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/platform-objects',
why:
'a SHRINK-ONLY ratchet — see `packages/plugins/plugin-approvals/test-typecheck-debt.json` '
+ 'above; same generator, same per-package ledger, same reason a merge must never recompute '
+ 'it: the half-merged tree is not the tree whose type errors this file records, so a file '
+ 'that GAINED errors would enter the ledger as merge noise instead of as red. '
+ 'Three errors over one file, all in `src/feature-gate-guard.test.ts`. At that size a recomputed '
+ 'value reads as a clean REPAIR rather than as noise, and a dropped entry is indistinguishable '
+ 'from a file somebody fixed — the `packages/cli` row above states that direction of the trade at '
+ 'length.',
},
{
path: 'packages/connectors/connector-mcp/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/connector-mcp',
why:
'a SHRINK-ONLY ratchet — see `packages/plugins/plugin-approvals/test-typecheck-debt.json` '
+ 'above; same generator, same per-package ledger, same reason a merge must never recompute '
+ 'it: the half-merged tree is not the tree whose type errors this file records, so a file '
+ 'that GAINED errors would enter the ledger as merge noise instead of as red. '
+ 'Five errors carrying ONE signature in one file, which is the shape this row protects least '
+ 'visibly: a recompute that keeps the count and swaps the signature is exactly the substitution '
+ 'the per-signature ledger exists to catch, and doing it as merge noise defeats it silently.',
},
{
path: 'packages/connectors/connector-openapi/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/connector-openapi',
why:
'a SHRINK-ONLY ratchet — see `packages/plugins/plugin-approvals/test-typecheck-debt.json` '
+ 'above; same generator, same per-package ledger, same reason a merge must never recompute '
+ 'it: the half-merged tree is not the tree whose type errors this file records, so a file '
+ 'that GAINED errors would enter the ledger as merge noise instead of as red. '
+ 'Five errors carrying one signature in one file — see the `connector-mcp` row directly above; '
+ 'the two packages measure the identical population against the same connector contract.',
},
{
path: 'packages/connectors/connector-rest/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/connector-rest',
why:
'a SHRINK-ONLY ratchet — see `packages/plugins/plugin-approvals/test-typecheck-debt.json` '
+ 'above; same generator, same per-package ledger, same reason a merge must never recompute '
+ 'it: the half-merged tree is not the tree whose type errors this file records, so a file '
+ 'that GAINED errors would enter the ledger as merge noise instead of as red. '
+ 'The smallest ledger in the repo at ONE error, and smallness is the hazard rather than the '
+ 'reassurance: a mid-merge recompute that writes zero here deletes the whole record, and an empty '
+ 'ledger reads as a package that graduated.',
},
{
path: 'packages/services/service-sms/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/service-sms',
why:
'a SHRINK-ONLY ratchet — see `packages/plugins/plugin-approvals/test-typecheck-debt.json` '
+ 'above; same generator, same per-package ledger, same reason a merge must never recompute '
+ 'it: the half-merged tree is not the tree whose type errors this file records, so a file '
+ 'that GAINED errors would enter the ledger as merge noise instead of as red. '
+ 'One error, in `src/transports/transports.test.ts` — see the `connector-rest` row directly above '
+ 'for why a one-entry ledger is the most exposed to a mid-merge recompute, not the least.',
},
{
path: 'packages/qa/http-conformance/test-typecheck-debt.json',
gen: 'gen:test-typecheck-debt',
owner: '@objectstack/http-conformance',
why:
'a SHRINK-ONLY ratchet — see `packages/plugins/plugin-approvals/test-typecheck-debt.json` '
+ 'above; same generator, same per-package ledger, same reason a merge must never recompute '
+ 'it: the half-merged tree is not the tree whose type errors this file records, so a file '
+ 'that GAINED errors would enter the ledger as merge noise instead of as red. '
+ 'The eighth and last of the card, and the one whose population is the MOST sensitive to the '
+ 'tree it is measured on: 25 of its 27 errors exist only because the build config now inherits '
+ "the root config's declared `lib`, which drops the DOM reading of `Response.json()` in favour "
+ "of @types/node's undici one. A mid-merge recompute against a half-merged tsconfig would "
+ 'report those 25 as repaired — a config-tier flip that looks exactly like somebody typing 25 '
+ 'narrowings — and would rewrite the per-signature keys underneath with it.',
},
{
path: 'skills/README.md',
gen: 'gen:skill-docs',
why:
'MIXED, and the mix is the whole reason — the same trade `packages/spec/src/migrations/'
+ 'registry.ts` is kept out of the table for. `gen:skill-docs` rewrites ONLY the region '
+ 'between `BEGIN/END GENERATED: skills`: 17 of the file\'s 114 lines. The other 97 are '
+ 'hand-written prose about the bundle layout, and the driver defers the WHOLE file to OURS '
+ "— so routing it would let a regeneration launder away a sibling's prose edit, trading a "
+ 'merge conflict for a silent loss. `check:skill-docs` guards the generated region instead, '
+ 'and a prose conflict here is a human\'s, as it always was.',
},
{
path: 'content/docs/ai/skills-reference.mdx',
gen: 'gen:skill-docs',
why:
'MIXED, exactly as `skills/README.md` above — one spliced `BEGIN/END GENERATED: skills` '
+ 'block inside 267 lines of hand-written guide prose. Same generator, same deferral hazard, '
+ 'same answer: guard the block with `check:skill-docs`, leave the prose to text-merge.',
},
{
path: 'packages/create-objectstack/src/templates/*/package.json',
gen: 'gen:scaffold-emission-policy',
owner: ROOT_OWNER,
why:
'MIXED, and the generated part is TWO VALUES of it. `gen:scaffold-emission-policy` rewrites '
+ "only `engines.pnpm` and `devDependencies.typescript` from the CLI's shared `SCAFFOLD_*` "
+ 'constants; everything else in the file — the scripts block, the dependency LIST, and the '
+ '`@objectstack/*` ranges a different pass (`scripts/sync-template-versions.mjs`) stamps at '
+ 'version time — is authored or owned elsewhere. So "discard both sides and re-run the '
+ 'generator" is not even defined here: the generator REFUSES a template that does not '
+ 'already declare the keys it stamps, and it would reproduce none of the rest. Guarding the '
+ 'two values with `check:scaffold-emission-policy` is the whole mechanism; a conflict in '
+ 'this file is a human\'s, exactly as it was before those two values were generated.',
},
{
path: 'packages/spec/json-schema/**',
gen: 'gen:openapi',
untracked: true,
why:
'GITIGNORED build output (`.gitignore:61`) — git never merges it, so it has no merge '
+ 'semantics to decide. Recorded rather than omitted because the tree LOOKS like the routed '
+ '`json-schema.manifest/**` next to it and invites the symmetry. It is also the tree '
+ '`readsSchemaTree` already warns about: a merge never delivers it, and whatever sits on '
+ 'disk describes one side. If it is ever committed, this entry expires and a real '
+ 'disposition is owed — the self-test refuses at that moment rather than after the merge '
+ 'that needed it.',
},
{
path: 'sbom.json',
gen: 'gen:sbom',
untracked: true,
why:
'GITIGNORED build output (`.gitignore:73`), produced at release time from the manifests. '
+ 'Nothing merges it and no `check:` proves it current, so it has no place in either '
+ 'ledger — recorded so that "no disposition" is not confused with "not yet decided". Same '
+ 'expiry clause as the entry above: committing it turns this entry red.',
},
{
// ⚠️ NOT a directory of this repository, and by ruling never one. The
// generator's `--out <dir>` is a runner tempdir whose contents are pushed
// to the repository WIKI — a separate git repo that this driver, this
// ledger and the merge queue all sit outside of.
path: 'wiki/**',
gen: 'gen:checklist-status',
// The ROOT manifest defines this script, not `packages/spec` — and the
// accounting is keyed per (owner, script), so leaving this to the default
// owner records the disposition against a manifest that has no such script
// and leaves the real one unaccounted. Both halves red at once, which is
// the two-way reconciliation working.
owner: ROOT_OWNER,
untracked: true,
why:
'writes NOTHING into this repository. `gen:checklist-status` prints the per-area '
+ 'active/planned census to stdout and, with `--out <dir>`, renders the wiki page set into '
+ 'that directory; `.github/workflows/checklist-status.yml` publishes it to the repository '
+ 'wiki on a schedule. So "discard both sides and re-run the generator" is not a question '
+ 'that arises — git never merges these pages, and the wiki is regenerated wholesale every '
+ 'run. Recorded rather than omitted because the ALTERNATIVE was considered and REFUSED on '
+ 'the card: a `STATUS.md` committed to `docs/qa/platform-checklist/` paired with a '
+ '`check:checklist-status` gate, which is exactly the routed-artifact shape this ledger is '
+ 'full of, and which a reader may well assume happened here. Same expiry clause as the two '
+ 'entries above: the day any of these pages is committed to this tree, this entry turns red '
+ 'and a real disposition is owed.',
},
{
path: 'content/docs/protocol-upgrade/**',
gen: 'gen:upgrade-guide',
untracked: true,
why:
'GITIGNORED build output (`.gitignore:108`): the protocol upgrade guide\'s docs pages, one '
+ 'per major plus an index, which `gen:upgrade-guide` writes and the `@objectstack/docs` build '
+ 'runs before `next build`. Git never merges them. Recorded because this generator used to own '
+ 'a ROUTED row, `docs/protocol-upgrade-guide.md`, and #22483 took that row out on purpose: the '
+ 'file is now a hand-written pointer stub that nothing generates, so "discard both sides and '
+ 're-run the generator" would discard the stub with no generator to bring it back, and '
+ '`check:upgrade-guide`, which compares no committed copy, would pass the loss. A merge that '
+ 'meets the stub on both sides is a human\'s. Same expiry clause as the three untracked '
+ 'entries above: committing these pages turns this entry red.',
},
{
path: 'packages/spec/spec-changes.json',
gen: 'gen:spec-changes',
untracked: true,
why:
'GITIGNORED since #22485: the ADR-0087 D4 manifest `@objectstack/spec` ships. The publish lane '
+ '(`scripts/release-spec-changes.sh --prepare` / `--generate`) writes it into the package right '
+ 'before the tarball is packed, `gen:spec-changes` writes the same file locally, and the pull '
+ 'request generates it in memory (`check:spec-changes`) — so git never merges it. It was a '
+ 'ROUTED row until #22485 deleted the committed copy under the #22449 B′ ruling. A branch that '
+ 'still carries one meets a modify/delete conflict on its merge of main, which takes no driver: '
+ 'the deletion is the answer. Same expiry clause as the untracked entries above: committing it '
+ 'again turns this entry red.',
},
{
path: 'docs/audits/**',
why:
'hand-written audit ledgers — Class verdicts, evidence, findings logs. Two files here are '
+ 'generated whole instead. The strictness ledger\'s `.counts/` shards are the ROUTED one, '
+ 'declared above: #5107 split the ledger\'s numbers out precisely so the prose could keep '
+ 'text-merging (it always merged cleanly) while the numbers stopped (they merged clean and '
+ 'WRONG). `2026-08-tenant-audit-write-call-sites.counts.md` (`node '
+ 'scripts/tenant-audit-census.mjs --write`) is NOT routed: a row needs a `gen:`/`check:` pair '
+ 'in the manifest it names as owner, and no manifest declares one for that census, which runs '
+ 'straight from the lint workflow; the driver runs only in a local merge anyway, and '
+ '`check-tenant-audit-census.mjs` holds the file to its `--write` output on every PR, so a '
+ 'clean-and-wrong text merge is red, never silent (the file\'s own header says the same). '
+ 'Regenerating a ledger would discard evidence, which is the opposite trade — so this '
+ 'exclusion covers the prose and must stay.',
},
// ── the objectui tree under ui/ (objectstack#25677) ──────────────────────────
{
path: 'ui/packages/components/src/ui/*.tsx',
gen: 'shadcn:update',
owner: 'object-ui-monorepo',
why:
'VENDORED components with hand-kept local patches. `shadcn:update` (`ui/scripts/shadcn-sync.js '
+ '--update`) fetches a component from the network Shadcn registry, re-applies the patch list in '
+ '`ui/scripts/shadcn-local-patches.mjs` and refuses to overwrite local edits without `--force`. '
+ '"Discard both sides and re-run" would swap a reviewed vendored copy for whatever the registry '
+ 'serves that day and drop every edit the patch list does not carry, and it needs the network, '
+ 'which a merge must not. A conflict in a vendored component stays a human\'s; never routed.',
},
// objectstack#30511 (ruling F of #29349): the Console's Traditional Chinese pack.
{
path: 'ui/packages/i18n/src/locales/zh-Hant.ts',
gen: 'gen:zh-hant',
owner: '@object-ui/i18n',
why:
'generated WHOLE from `zh-Hans.ts` by `gen:zh-hant`, so "discard both sides and re-run" '
+ 'loses no human decision. Still not routed: a `REGEN_ARTIFACTS` row needs a `check:` script '
+ 'as its currency proof, and ruling F of #29349 adds no gate to this phase. The currency proof '
+ 'is the package test `src/__tests__/zh-hant-generated.test.ts`, which reds a pack that is not '
+ 'byte-for-byte the generator\'s output wherever the ui unit tests run, and the driver is local '
+ 'anyway (never the queue\'s merge). The pack is line-aligned with `zh-Hans.ts`, one line per '
+ 'line, so two branches editing different keys text-merge apart; a conflict is resolved by '
+ 'taking either side and running `pnpm --filter @object-ui/i18n gen:zh-hant`.',
},
// objectstack#30511: the marketplace namespace's Traditional Chinese catalogue, same command.
{
path: 'ui/packages/i18n/src/namespaces/marketplace/zh-Hant.ts',
gen: 'gen:zh-hant',
owner: '@object-ui/i18n',
why:
'generated WHOLE from the namespace\'s `zh-Hans.ts` by the same `gen:zh-hant` run that writes '
+ 'the pack above, and not routed for the same reason: no `check:` script proves its currency. '
+ 'The proof is the same package test, which walks every generated target. Line-aligned with '
+ 'its source, so a conflict is resolved by taking either side and running '
+ '`pnpm --filter @object-ui/i18n gen:zh-hant`.',
},
// objectstack#32225: the developer namespace's Traditional Chinese catalogue, same command.
{
path: 'ui/packages/i18n/src/namespaces/developer/zh-Hant.ts',
gen: 'gen:zh-hant',
owner: '@object-ui/i18n',
why:
'generated WHOLE from the namespace\'s `zh-Hans.ts` by the same `gen:zh-hant` run that writes '
+ 'the pack, and not routed for the same reason as the marketplace catalogue above: no `check:` '
+ 'script proves its currency. The proof is the same package test, which walks every generated '
+ 'target. Line-aligned with its source, so a conflict is resolved by taking either side and '
+ 'running `pnpm --filter @object-ui/i18n gen:zh-hant`.',
},
]);
/** Marker file (inside the git dir, never the worktree) listing paths the driver deferred. */
export const PENDING_MARKER = 'os-regen-pending';
/** The git config key pair that registers the driver in a clone. */
export const DRIVER_NAME = 'os-regen';
/**
* The script git runs as the merge driver, as a shell word (#4868).
*
* Resolved at MERGE time against the worktree being merged, never at install time
* against the worktree that happened to run `pnpm install`. Linked worktrees share
* one `.git/config`, so an absolute path here is a container-wide setting written
* by whoever installed last — and it dangles the moment that worktree is removed,
* which AGENTS.md requires on task cleanup. See `setup-git-hooks.mjs` for the two
* constraints this spelling satisfies and the two traps it avoids.
*/
export const DRIVER_SCRIPT_EXPR = '"$(git rev-parse --show-toplevel)/scripts/git-merge-regen.mjs"';
/**
* Every git config setting that `pnpm install` registers, declared once.
*
* `setup-git-hooks.mjs` writes these; `git-merge-regen.mjs --self-test` asserts the
* live config still matches them and that the driver script actually resolves. One
* declaration, so the registrar and the gate cannot drift apart.
*/
export const GIT_SETTINGS = Object.freeze([
{ key: `merge.${DRIVER_NAME}.name`, value: 'regenerate generator-owned artifacts instead of text-merging' },
// %O %A %B %P — ancestor, ours (the output file), theirs, pathname. Unquoted on
// purpose: git generates %O %A %B as temp names and shell-quotes %P itself.
{ key: `merge.${DRIVER_NAME}.driver`, value: `node ${DRIVER_SCRIPT_EXPR} %O %A %B %P` },
{ key: 'core.hooksPath', value: '.githooks' },
]);
/**
* The manifest name that owns an entry's `gen:`/`check:` scripts.
*
* Pure, and the single place the default is applied — a consumer that spelled
* `entry.owner ?? '@objectstack/spec'` inline would be a second definition of the
* default, and the one that wins would be whichever consumer the reader opened.
*
* @param {{ owner?: string }} entry
* @returns {string}
*/
export function ownerOf(entry) {