@metaobjectsdev/metadata 0.24.1 → 0.24.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/attr-contradictions.d.ts +52 -0
  2. package/dist/attr-contradictions.d.ts.map +1 -0
  3. package/dist/attr-contradictions.js +100 -0
  4. package/dist/attr-contradictions.js.map +1 -0
  5. package/dist/core/requirement/meta-requirement.d.ts +9 -1
  6. package/dist/core/requirement/meta-requirement.d.ts.map +1 -1
  7. package/dist/core/requirement/meta-requirement.js +15 -2
  8. package/dist/core/requirement/meta-requirement.js.map +1 -1
  9. package/dist/core/requirement/requirement-constants.d.ts +30 -2
  10. package/dist/core/requirement/requirement-constants.d.ts.map +1 -1
  11. package/dist/core/requirement/requirement-constants.js +32 -1
  12. package/dist/core/requirement/requirement-constants.js.map +1 -1
  13. package/dist/core/requirement/requirement-definition.embedded.d.ts.map +1 -1
  14. package/dist/core/requirement/requirement-definition.embedded.js +22 -4
  15. package/dist/core/requirement/requirement-definition.embedded.js.map +1 -1
  16. package/dist/core/vocabulary-rewrite-yaml.d.ts.map +1 -1
  17. package/dist/core/vocabulary-rewrite-yaml.js +103 -0
  18. package/dist/core/vocabulary-rewrite-yaml.js.map +1 -1
  19. package/dist/errors.d.ts +1 -1
  20. package/dist/errors.d.ts.map +1 -1
  21. package/dist/errors.js +10 -0
  22. package/dist/errors.js.map +1 -1
  23. package/dist/index.d.ts +2 -0
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +3 -0
  26. package/dist/index.js.map +1 -1
  27. package/dist/loader/meta-data-loader.d.ts.map +1 -1
  28. package/dist/loader/meta-data-loader.js +5 -1
  29. package/dist/loader/meta-data-loader.js.map +1 -1
  30. package/dist/loader/validation-passes.d.ts +1 -0
  31. package/dist/loader/validation-passes.d.ts.map +1 -1
  32. package/dist/loader/validation-passes.js +73 -6
  33. package/dist/loader/validation-passes.js.map +1 -1
  34. package/dist/registry-manifest.d.ts +1 -1
  35. package/dist/registry-manifest.js +1 -1
  36. package/dist/retired-vocabulary.d.ts.map +1 -1
  37. package/dist/retired-vocabulary.js +54 -11
  38. package/dist/retired-vocabulary.js.map +1 -1
  39. package/dist/vocabulary-rewrite.d.ts.map +1 -1
  40. package/dist/vocabulary-rewrite.js +115 -7
  41. package/dist/vocabulary-rewrite.js.map +1 -1
  42. package/package.json +1 -1
  43. package/src/attr-contradictions.ts +141 -0
  44. package/src/core/requirement/meta-requirement.ts +18 -1
  45. package/src/core/requirement/requirement-constants.ts +34 -1
  46. package/src/core/requirement/requirement-definition.embedded.ts +22 -4
  47. package/src/core/vocabulary-rewrite-yaml.ts +108 -0
  48. package/src/errors.ts +10 -0
  49. package/src/index.ts +9 -0
  50. package/src/loader/meta-data-loader.ts +6 -1
  51. package/src/loader/validation-passes.ts +95 -5
  52. package/src/registry-manifest.ts +1 -1
  53. package/src/retired-vocabulary.ts +54 -11
  54. package/src/vocabulary-rewrite.ts +125 -7
@@ -40,11 +40,18 @@
40
40
  // (flow mappings, `{ name: x, readOnly: true }`) was not matched at all. YAML's value extent
41
41
  // is not derivable by scanning; JSON's is.
42
42
  //
43
+ // IT ALSO RESOLVES ATTRIBUTE CONTRADICTIONS — two LIVE attributes that may not sit on one
44
+ // node (`attr-contradictions.ts`). Same machinery, different match: a retirement finds one
45
+ // key, a contradiction finds a PAIR inside one node body, which is exactly what `scopeRanges`
46
+ // already answers. Doing it by proximity instead ("a `fields` with an `expr` near it") was
47
+ // tried and took a `fields` whose neighbouring `expr` belonged to a SIBLING node.
48
+ //
43
49
  // IT REFUSES WHAT IT CANNOT KNOW. A retirement with no `rewrite` (`@status: abandoned`) is
44
50
  // reported, never guessed at. Deleting the node, retyping it, and fixing the residue it
45
51
  // describes are all defensible, and a wrong guess emits metadata that LOADS and means
46
52
  // something different — strictly worse than leaving it alone, because the adopter would
47
53
  // believe the migration finished.
54
+ import { ATTR_CONTRADICTIONS, contradictionScopeMatches } from "./attr-contradictions.js";
48
55
  import { RETIRED_VOCABULARY, note, scopeMatches, } from "./retired-vocabulary.js";
49
56
  /** `0.24.0` → `[0,24,0]`, for an ordered comparison rather than a string one. */
50
57
  function parts(v) {
@@ -117,8 +124,8 @@ function scopeRanges(source) {
117
124
  }
118
125
  return ranges;
119
126
  }
120
- /** The type key governing `offset` — the innermost body containing it. */
121
- function scopeAt(ranges, offset) {
127
+ /** The innermost node body containing `offset`. */
128
+ function scopeRangeAt(ranges, offset) {
122
129
  let best;
123
130
  for (const r of ranges) {
124
131
  if (offset <= r.bodyStart || offset >= r.bodyEnd)
@@ -127,7 +134,53 @@ function scopeAt(ranges, offset) {
127
134
  if (best === undefined || r.bodyStart > best.bodyStart)
128
135
  best = r;
129
136
  }
130
- return best?.typeKey;
137
+ return best;
138
+ }
139
+ /** The type key governing `offset`. Derived from the range so the two cannot disagree —
140
+ * a retirement asks WHICH type, a contradiction asks WHICH NODE, and answering them from
141
+ * two separate walks is how the pair-matching would drift from the scoping. */
142
+ function scopeAt(ranges, offset) {
143
+ return scopeRangeAt(ranges, offset)?.typeKey;
144
+ }
145
+ /** Every place `attr` appears as a key inside `range`'s OWN body — a nested node's key of
146
+ * the same name belongs to that node, not to this one. Containment alone is not enough:
147
+ * a node body contains its children's bodies, so the innermost enclosing range must BE
148
+ * this range. That identity test is what proximity matching cannot express. */
149
+ function ownKeys(source, ranges, range, attr) {
150
+ const out = [];
151
+ const re = keyPattern(attr);
152
+ let m;
153
+ while ((m = re.exec(source)) !== null) {
154
+ if (m.index <= range.bodyStart || m.index >= range.bodyEnd)
155
+ continue;
156
+ if (scopeRangeAt(ranges, m.index)?.bodyStart !== range.bodyStart)
157
+ continue;
158
+ out.push({ keyStart: m.index, afterKey: m.index + m[0].length });
159
+ }
160
+ return out;
161
+ }
162
+ /** True when `keep` holds one of the entry's `keepValues` (or the entry names none,
163
+ * in which case mere presence is the contradiction). */
164
+ function keepValueMatches(source, site, c) {
165
+ if (c.keepValues === undefined)
166
+ return true;
167
+ const raw = valueSpan(source, site.afterKey)?.raw;
168
+ if (raw === undefined)
169
+ return false;
170
+ return c.keepValues.some((v) => rawEquals(raw, v));
171
+ }
172
+ /** Does this key carry a string that actually says something? */
173
+ function suppliesText(source, site) {
174
+ const raw = valueSpan(source, site.afterKey)?.raw;
175
+ if (raw === undefined)
176
+ return false;
177
+ try {
178
+ const v = JSON.parse(raw);
179
+ return typeof v === "string" && v.trim().length > 0;
180
+ }
181
+ catch {
182
+ return false;
183
+ }
131
184
  }
132
185
  /**
133
186
  * Matches `"@name"` at a key position, plus the separator that follows, capturing the key
@@ -244,6 +297,49 @@ export function rewriteDocument(source, opts = {}) {
244
297
  refusals.push({ ...note(entry), subject: r.typeKey, line: lineAt(source, r.keyIndex) });
245
298
  }
246
299
  }
300
+ // ── Attribute contradictions: two LIVE attrs that may not sit on one node ──
301
+ //
302
+ // Matched per NODE, not per occurrence, because the illegal thing is the pair. `ownKeys`
303
+ // supplies the node-identity test the proximity approach could not: a `@fields` and an
304
+ // `@expr` that merely appear near each other may belong to different siblings.
305
+ //
306
+ // THE TWO SIDES ARE ASKED DIFFERENT QUESTIONS, mirroring the loader's Rule 1a exactly
307
+ // (`validation-passes.ts`, `hasFieldsAttr` vs `hasExpr`). The DROP side counts on
308
+ // PRESENCE — `@fields: []` beside `@expr` is still a declaration of both, and is the case
309
+ // where the discard is total. The KEEP side counts only when it actually supplies a key,
310
+ // so `@expr: ""` beside `@fields` is a plain column index the loader accepts and this
311
+ // must not touch. If those two predicates ever diverge, this deletes an attribute from a
312
+ // document that was loading.
313
+ //
314
+ // IT SEES ONLY THIS NODE'S OWN TEXT. A node declaring `@expr` while INHERITING `@fields`
315
+ // through `extends` contradicts itself in the loaded model and not on the page, and no
316
+ // raw-text rewriter can resolve a super-reference. That case stays a refusal from the
317
+ // loader — correctly, since the fix is on the parent and is the adopter's call.
318
+ for (const range of ranges) {
319
+ for (const c of ATTR_CONTRADICTIONS) {
320
+ if (opts.maxVersion !== undefined && !atOrBefore(c.since, opts.maxVersion))
321
+ continue;
322
+ if (!contradictionScopeMatches(c, range.typeKey))
323
+ continue;
324
+ // `keep` must be present AND, when the entry names values, hold one of them —
325
+ // otherwise @status and @implementedBy would contradict on every status.
326
+ if (!ownKeys(source, ranges, range, c.keep).some((k) => suppliesText(source, k) && keepValueMatches(source, k, c)))
327
+ continue;
328
+ for (const site of ownKeys(source, ranges, range, c.drop)) {
329
+ const span = valueSpan(source, site.afterKey);
330
+ if (span === undefined)
331
+ continue;
332
+ const { start, end } = dropSpan(source, site.keyStart, span.end);
333
+ edits.push({ start, end, text: "" });
334
+ changes.push({
335
+ attr: c.drop,
336
+ from: c.drop,
337
+ to: `(removed — @${c.keep} keys this node)`,
338
+ line: lineAt(source, site.keyStart),
339
+ });
340
+ }
341
+ }
342
+ }
247
343
  for (const entry of RETIRED_VOCABULARY.filter((e) => e.attr !== undefined && inWindow(e))) {
248
344
  const attr = entry.attr;
249
345
  const re = keyPattern(attr);
@@ -253,8 +349,9 @@ export function rewriteDocument(source, opts = {}) {
253
349
  const keyEnd = keyStart + (m[1]?.length ?? 0);
254
350
  const afterKey = m.index + m[0].length;
255
351
  // Scope is decided HERE, per occurrence, from the enclosing node.
256
- const scope = scopeAt(ranges, keyStart);
257
- if (scope === undefined || !scopeMatches(entry, scope))
352
+ const scopeRange = scopeRangeAt(ranges, keyStart);
353
+ const scope = scopeRange?.typeKey;
354
+ if (scope === undefined || scopeRange === undefined || !scopeMatches(entry, scope))
258
355
  continue;
259
356
  const line = lineAt(source, keyStart);
260
357
  const span = valueSpan(source, afterKey);
@@ -284,8 +381,19 @@ export function rewriteDocument(source, opts = {}) {
284
381
  if (rw === undefined)
285
382
  refuse();
286
383
  else if (rw.kind === "renameAttr") {
287
- edits.push({ start: keyStart, end: keyEnd, text: `"@${rw.to}"` });
288
- changes.push({ attr, from: attr, to: rw.to, line });
384
+ // A rename onto a key the node ALREADY declares would emit a duplicate — two
385
+ // `"@counterexample"` members in one object, where JSON parsers silently take
386
+ // the last and the author's surviving text is the one that loses. Refuse
387
+ // instead: which of the two sentences is the real one is exactly the judgement
388
+ // `meta upgrade` does not make.
389
+ const target = ownKeys(source, ranges, scopeRange, rw.to)
390
+ .filter((k) => k.keyStart !== keyStart);
391
+ if (target.length > 0)
392
+ refuse();
393
+ else {
394
+ edits.push({ start: keyStart, end: keyEnd, text: `"@${rw.to}"` });
395
+ changes.push({ attr, from: attr, to: rw.to, line });
396
+ }
289
397
  }
290
398
  else if (rw.kind === "dropAttr")
291
399
  drop();
@@ -1 +1 @@
1
- {"version":3,"file":"vocabulary-rewrite.js","sourceRoot":"","sources":["../src/vocabulary-rewrite.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,EAAE;AACF,mDAAmD;AACnD,EAAE;AACF,qFAAqF;AACrF,yFAAyF;AACzF,0FAA0F;AAC1F,sFAAsF;AACtF,EAAE;AACF,6FAA6F;AAC7F,wFAAwF;AACxF,2CAA2C;AAC3C,EAAE;AACF,0FAA0F;AAC1F,mFAAmF;AACnF,yFAAyF;AACzF,wFAAwF;AACxF,iDAAiD;AACjD,EAAE;AACF,yFAAyF;AACzF,2FAA2F;AAC3F,uFAAuF;AACvF,0FAA0F;AAC1F,mFAAmF;AACnF,4FAA4F;AAC5F,6FAA6F;AAC7F,0FAA0F;AAC1F,qDAAqD;AACrD,EAAE;AACF,wFAAwF;AACxF,qFAAqF;AACrF,kFAAkF;AAClF,6FAA6F;AAC7F,yFAAyF;AACzF,oBAAoB;AACpB,EAAE;AACF,yFAAyF;AACzF,6FAA6F;AAC7F,2FAA2F;AAC3F,6FAA6F;AAC7F,2CAA2C;AAC3C,EAAE;AACF,2FAA2F;AAC3F,wFAAwF;AACxF,sFAAsF;AACtF,wFAAwF;AACxF,kCAAkC;AAElC,OAAO,EACL,kBAAkB,EAClB,IAAI,EACJ,YAAY,GAGb,MAAM,yBAAyB,CAAC;AA8BjC,iFAAiF;AACjF,SAAS,KAAK,CAAC,CAAS;IACtB,OAAO,CAAC,CAA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AAE,GAAG,IAAI,KAAK,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,KAAK,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;YAC7F,CAAC;YACD,sFAAsF;YACtF,iDAAiD;iBAC5C,IAAI,EAAE,CAAC,SAAS,KAAK,MAAM;gBAAE,IAAI,EAAE,CAAC;;gBACpC,MAAM,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,IAAI,GAAG,MAAM,CAAC;IAClB,KAAK,MAAM,CAAC,IAAI,KAAK;QAAE,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAElF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AACrC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metaobjectsdev/metadata",
3
- "version": "0.24.1",
3
+ "version": "0.24.2",
4
4
  "description": "Metamodel loader, types, and constants for the MetaObjects standard.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -0,0 +1,141 @@
1
+ // server/typescript/packages/metadata/src/attr-contradictions.ts
2
+ //
3
+ // Pairs of LIVE attributes that may not both be declared on one node — and, where the
4
+ // resolution is mechanical, which one `meta upgrade` drops.
5
+ //
6
+ // THE SIBLING OF `retired-vocabulary.ts`, DELIBERATELY NOT PART OF IT. That table answers
7
+ // "this name is gone"; this one answers "both these names are fine, and together they are
8
+ // not". The match shape differs (one attribute versus a pair on the same node), the fix
9
+ // shape differs (rewrite a value versus delete one of two), and folding them together
10
+ // would give every retirement entry fields it can never use. They share the thing that
11
+ // matters instead: both are consulted by the LOADER for its diagnostic and by the
12
+ // `meta upgrade` rewriter for its fix, so the message an adopter reads and the edit the
13
+ // tool makes come from one place and cannot drift apart.
14
+ //
15
+ // WHY A MECHANICAL FIX IS AVAILABLE HERE AT ALL, when `@status: abandoned` is refused.
16
+ // A refusal is right when the correct edit depends on intent nobody recorded. It is wrong
17
+ // when the metadata's own history says what the declaration MEANT. `@fields` + `@expr`
18
+ // loaded before 0.24.1 and `@fields` was silently DISCARDED — `migrate-ts` has always run
19
+ // `columns: expr ? [] : cols`, so the index in the adopter's database is the expression
20
+ // one. Dropping `@fields` therefore reproduces the object that already exists; keeping
21
+ // `@fields` and dropping `@expr` would invent a different index and emit a migration
22
+ // against live data. There is one answer, and the deployed schema is the evidence for it.
23
+ //
24
+ // CROSS-PORT: like the retirement map this is a DIAGNOSTIC plus a TS-only fixer. It
25
+ // changes no load OUTCOME — every port already refuses the contradiction with the same
26
+ // code — and the shared corpus compares error code and source, never message text. So it
27
+ // carries no registry-conformance obligation; mirroring it is per-port ergonomics.
28
+
29
+ /**
30
+ * One pair of attributes that may not co-occur on a node.
31
+ *
32
+ * `drop` and `keep` are named for the REWRITE, not for importance: an entry exists only
33
+ * where one side is provably redundant. An entry with no mechanical answer does not belong
34
+ * here — it belongs in the loader alone, refusing.
35
+ */
36
+ export interface AttrContradiction {
37
+ readonly type: string;
38
+ /** `*` for every subtype of `type`, else the exact subtype. */
39
+ readonly subType: string;
40
+ /** Declared alongside `keep`, this one goes. Matched on PRESENCE — see below. */
41
+ readonly drop: string;
42
+ /** The attribute whose presence makes `drop` illegal, and which survives the rewrite. */
43
+ readonly keep: string;
44
+ /**
45
+ * When set, `keep` makes `drop` illegal only at THESE values — the pair is a
46
+ * contradiction of meaning rather than of mere co-occurrence.
47
+ *
48
+ * It lists every spelling that has ever carried the meaning, across the version
49
+ * boundary, and that is load-bearing rather than defensive: the rewriter runs the
50
+ * contradiction pass BEFORE the retirement pass, so a legacy document still says
51
+ * `abandoned` at the moment this is evaluated. Listing only the modern value would
52
+ * make `meta upgrade --apply` rewrite the status, leave the contradicting sibling
53
+ * behind, and exit 0 on a file that still does not load — the exact failure #342
54
+ * was filed for.
55
+ */
56
+ readonly keepValues?: readonly string[];
57
+ /** The release that started refusing the pair. */
58
+ readonly since: string;
59
+ /** One line stating the RULE, in the present tense — the loader has already said WHICH
60
+ * node broke it, so this says what the rule is. */
61
+ readonly why: string;
62
+ /** What the rewrite costs, completing "so <effect>" — the sentence that tells an adopter
63
+ * it is safe to run, and why the answer is not a guess. */
64
+ readonly effect: string;
65
+ }
66
+
67
+ export const ATTR_CONTRADICTIONS: readonly AttrContradiction[] = [
68
+ // ── FR-039: a retired requirement has no implementation (0.24.2) ──
69
+ //
70
+ // The pair is @status: retired + @implementedBy. It is a contradiction of MEANING,
71
+ // not of co-occurrence — @status and @implementedBy sit together happily on every
72
+ // other status — which is why this is the first entry needing `keepValues`.
73
+ //
74
+ // Mechanical, and the reason it is: a retired capability has no implementation BY
75
+ // DEFINITION, so the reference list describes nodes that are gone. That is not a
76
+ // judgement call about what the author meant; it is what retiring something IS. The
77
+ // record of what used to implement it belongs in `notes` (the shape one adopting
78
+ // estate reached by hand before any ruling, on the grounds that "what used to
79
+ // implement a retired capability is real information in the wrong field") and what
80
+ // REPLACED it belongs in @supersededBy, which resolves.
81
+ {
82
+ type: "requirement", subType: "*",
83
+ drop: "implementedBy", keep: "status",
84
+ keepValues: ["retired", "abandoned", "superseded"],
85
+ since: "0.24.2",
86
+ why: "a retired requirement has no implementation — that is what retiring it means",
87
+ effect: "the references named nodes that are gone, so dropping them removes a list " +
88
+ "nothing could resolve; what REPLACED the capability goes in @supersededBy " +
89
+ "and why it went goes in `notes`",
90
+ },
91
+ // ── #342: an index key is @fields XOR @expr (0.24.1) ──
92
+ //
93
+ // Both subtypes, because ADR-0040 puts uniqueness in the TYPE: `identity.secondary` IS a
94
+ // unique index, keys itself identically, and carries `@expr` from the same db provider.
95
+ // `identity.primary` and `identity.reference` are absent on purpose — a primary key or an
96
+ // FK is always plain columns and has no `@expr` to contradict.
97
+ {
98
+ type: "index", subType: "lookup",
99
+ drop: "fields", keep: "expr",
100
+ since: "0.24.1",
101
+ why: "an index keys off plain columns (@fields) or a key expression (@expr), never both",
102
+ effect: "the index in your database is the expression one and dropping @fields " +
103
+ "changes no emitted DDL",
104
+ },
105
+ {
106
+ type: "identity", subType: "secondary",
107
+ drop: "fields", keep: "expr",
108
+ since: "0.24.1",
109
+ why: "a unique key keys off plain columns (@fields) or a key expression (@expr), never both",
110
+ effect: "the constraint in your database is the expression one and dropping @fields " +
111
+ "changes no emitted DDL",
112
+ },
113
+ ];
114
+
115
+ /** True when `c` governs `typeKey` (`"<type>.<subType>"`). Mirrors `scopeMatches`. */
116
+ export function contradictionScopeMatches(c: AttrContradiction, typeKey: string): boolean {
117
+ const dot = typeKey.indexOf(".");
118
+ if (dot < 0) return false;
119
+ if (c.type !== typeKey.slice(0, dot)) return false;
120
+ return c.subType === "*" || c.subType === typeKey.slice(dot + 1);
121
+ }
122
+
123
+ /** Every contradiction governing this type key. */
124
+ export function contradictionsFor(typeKey: string): readonly AttrContradiction[] {
125
+ return ATTR_CONTRADICTIONS.filter((c) => contradictionScopeMatches(c, typeKey));
126
+ }
127
+
128
+ /**
129
+ * The sentence appended to the load error that refuses the pair.
130
+ *
131
+ * Kept beside the table for the reason #337 recorded: an adopter who is told only that
132
+ * their metadata is invalid concludes the tool is broken, because nothing in the message
133
+ * says a fixer exists. Naming the command is the difference between a dead end and a
134
+ * one-line migration.
135
+ */
136
+ export function contradictionHint(c: AttrContradiction): string {
137
+ return (
138
+ `${c.why} — drop one. Declaring both previously loaded but silently discarded ` +
139
+ `@${c.drop}, so ${c.effect}. \`meta upgrade --apply\` drops it for you.`
140
+ );
141
+ }
@@ -19,6 +19,8 @@ import {
19
19
  REQUIREMENT_STATUSES_WITH_OUTSTANDING_WORK,
20
20
  type RequirementDisposition,
21
21
  type RequirementStatus,
22
+ REQUIREMENT_STATUS_RETIRED,
23
+ REQUIREMENT_ATTR_SUPERSEDED_BY,
22
24
  } from "./requirement-constants.js";
23
25
 
24
26
  export class MetaRequirement extends MetaData {
@@ -72,6 +74,20 @@ export class MetaRequirement extends MetaData {
72
74
  return s !== undefined && REQUIREMENT_STATUSES_WITH_OUTSTANDING_WORK.includes(s);
73
75
  }
74
76
 
77
+ /** Built, then deliberately removed. Carries no `@implementedBy` (the loader
78
+ * refuses it), never counts toward object coverage, and is exempt from the
79
+ * architectural universality check — a withdrawn policy governs nothing. */
80
+ isRetired(): boolean {
81
+ return this.status() === REQUIREMENT_STATUS_RETIRED;
82
+ }
83
+
84
+ /** The requirement that REPLACED this one (FR-039). Legal on `retired` only;
85
+ * `verify` resolves it, so a supersession chain stays walkable. */
86
+ supersededBy(): string | undefined {
87
+ const v = this.attr(REQUIREMENT_ATTR_SUPERSEDED_BY);
88
+ return typeof v === "string" && v.trim() !== "" ? v : undefined;
89
+ }
90
+
75
91
  implementedBy(): string[] {
76
92
  const v = this.attr(REQUIREMENT_ATTR_IMPLEMENTED_BY);
77
93
  return Array.isArray(v) ? (v as string[]) : [];
@@ -92,7 +108,8 @@ export class MetaRequirement extends MetaData {
92
108
  }
93
109
 
94
110
  /** True when a dangling `@implementedBy` is an ERROR rather than expected.
95
- * `planned` is the only exemption — there the nodes do not exist YET. */
111
+ * `planned` is exempt (the nodes do not exist YET) and `retired` cannot reach
112
+ * this at all, because the loader refuses `@implementedBy` there. */
96
113
  requiresLiveNodes(): boolean {
97
114
  const s = this.status();
98
115
  return s !== undefined && REQUIREMENT_STATUSES_REQUIRING_LIVE_NODES.includes(s);
@@ -37,6 +37,13 @@ export const REQUIREMENT_ATTR_STATEMENT = "statement";
37
37
  export const REQUIREMENT_ATTR_COUNTEREXAMPLE = "counterexample";
38
38
  export const REQUIREMENT_ATTR_IMPLEMENTED_BY = "implementedBy";
39
39
 
40
+ /** FR-039 — the requirement that REPLACED a retired one. A resolving reference,
41
+ * so a supersession chain stays walkable: A -> B, and when B is retired too it
42
+ * carries its own. Legal ONLY on `retired`; the original 2026-08-10 ruling
43
+ * asked for a resolving `supersededBy` (point 4) and 0.24.0 deregistered the
44
+ * unresolved string version without ever building it. */
45
+ export const REQUIREMENT_ATTR_SUPERSEDED_BY = "supersededBy";
46
+
40
47
  // ---------------------------------------------------------------------------
41
48
  // Status — a closed enum, enforced by the registry via `allowedValues`. This is
42
49
  // the one payload with controlled evidence behind it: model-only agents flagged
@@ -47,17 +54,30 @@ export const REQUIREMENT_ATTR_IMPLEMENTED_BY = "implementedBy";
47
54
  export const REQUIREMENT_STATUS_PLANNED = "planned";
48
55
  export const REQUIREMENT_STATUS_LIVE = "live";
49
56
  export const REQUIREMENT_STATUS_PARTIAL = "partial";
57
+ /** FR-039 — built, then deliberately removed; it must NOT be rebuilt.
58
+ *
59
+ * PRESCRIPTIVE, which is what makes it admissible under FR-038's rule that a
60
+ * requirement never journals what happened: the entry states a prohibition in
61
+ * force, falsifiable by exactly one observable — the capability reappearing.
62
+ * The retired `abandoned` described the past; this describes the standing rule.
63
+ *
64
+ * This is the status the ledger's only surviving controlled result is about:
65
+ * model-only agents flagged a deliberately-retired capability 0 times out of
66
+ * 24, ledger arms 19 of 40. */
67
+ export const REQUIREMENT_STATUS_RETIRED = "retired";
50
68
 
51
69
  export const REQUIREMENT_STATUSES = [
52
70
  REQUIREMENT_STATUS_PLANNED,
53
71
  REQUIREMENT_STATUS_LIVE,
54
72
  REQUIREMENT_STATUS_PARTIAL,
73
+ REQUIREMENT_STATUS_RETIRED,
55
74
  ] as const;
56
75
  export type RequirementStatus = (typeof REQUIREMENT_STATUSES)[number];
57
76
 
58
77
  /** Statuses whose implementing nodes are supposed to still exist. A dangling
59
78
  * `@implementedBy` on one of these means the model moved and the requirement is
60
- * stale. `planned` is the only exemption — there the nodes do not exist YET. */
79
+ * stale. `planned` is exempt — there the nodes do not exist YET — and `retired`
80
+ * cannot appear here at all, because it may not carry `@implementedBy`. */
61
81
  export const REQUIREMENT_STATUSES_REQUIRING_LIVE_NODES: readonly RequirementStatus[] = [
62
82
  REQUIREMENT_STATUS_LIVE,
63
83
  REQUIREMENT_STATUS_PARTIAL,
@@ -71,6 +91,19 @@ export const REQUIREMENT_STATUSES_WITH_OUTSTANDING_WORK: readonly RequirementSta
71
91
  REQUIREMENT_STATUS_PARTIAL,
72
92
  ];
73
93
 
94
+ /** Statuses on which `@implementedBy` is REFUSED AT LOAD (FR-039).
95
+ *
96
+ * This is the structural half of FR-039 and the reason it is a list rather
97
+ * than an inline test. FR-038 removed `abandoned` because `verify` was SILENT
98
+ * on dangling refs for it, hiding 29 unresolvable references across 14 entries
99
+ * in one estate. That silence was a deliberate EXEMPTION — dangling was
100
+ * specified as correct there. Forbidding the attribute outright makes the bug
101
+ * class UNREACHABLE instead: a retired capability has no implementation by
102
+ * definition, so the references cannot dangle because they cannot exist. */
103
+ export const REQUIREMENT_STATUSES_FORBIDDING_IMPLEMENTORS: readonly RequirementStatus[] = [
104
+ REQUIREMENT_STATUS_RETIRED,
105
+ ];
106
+
74
107
  // ---------------------------------------------------------------------------
75
108
  // Disposition — what was DECIDED about the outstanding work. Orthogonal to
76
109
  // status, which says whether the work is done. Absent means UNDECIDED, and that
@@ -32,9 +32,10 @@ export const REQUIREMENT_DEFINITION: ProviderDefinition = {
32
32
  "allowedValues": [
33
33
  "planned",
34
34
  "live",
35
- "partial"
35
+ "partial",
36
+ "retired"
36
37
  ],
37
- "description": "planned intended but not built yet; live implemented and in use; partial implemented with known gaps. A requirement is PRESCRIPTIVE it states what SHOULD happen and is never a journal of what happened so a capability that no longer applies is DELETED, not annotated as retired; the record of it having existed belongs to version control and to notes on the entries that survive. A dangling @implementedBy is an ERROR on live/partial (the model moved, the requirement is stale) and ALLOWED on planned, where the nodes do not exist YET. A planned requirement also never contributes to object coverage: planning a capability must not silence the warning that nothing implements it."
38
+ "description": "planned intended but not built yet; live implemented and in use; partial implemented with known gaps; retired BUILT THEN DELIBERATELY REMOVED — it must not be rebuilt. A requirement is PRESCRIPTIVE: it states what SHOULD be true and never journals what happened, and retired satisfies that because it states a prohibition in force, falsifiable by the capability reappearing. On retired, @implementedBy is REFUSED at load (ERR_REQUIREMENT_RETIRED_HAS_IMPLEMENTORS) — a retired capability has no implementation by definition, so its references cannot dangle because they cannot exist; @supersededBy names the requirement that replaced it. A dangling @implementedBy is an ERROR on live/partial (the model moved, the requirement is stale) and ALLOWED on planned, where the nodes do not exist YET. Neither planned nor retired contributes to object coverage: planning a capability must not silence the warning that nothing implements it, and neither must retiring one."
38
39
  },
39
40
  {
40
41
  "type": "attr",
@@ -73,6 +74,14 @@ export const REQUIREMENT_DEFINITION: ProviderDefinition = {
73
74
  "max": 1,
74
75
  "description": "What breaking it looks like, in one sentence — a STATIC falsifiability test, authored once, never a state. A requirement MUST be violable: 'every entity has a uuid primary key' is (point at one with a composite string key); 'things are persisted' is not, and is a description rather than a requirement. Renamed from @violation in 0.24.0, which read as a status."
75
76
  },
77
+ {
78
+ "type": "attr",
79
+ "subType": "string",
80
+ "name": "supersededBy",
81
+ "min": 0,
82
+ "max": 1,
83
+ "description": "The requirement that REPLACED this one. Legal on @status: retired only (ERR_REQUIREMENT_SUPERSEDED_BY_NOT_RETIRED otherwise), and RESOLVED like any other reference, so a dangling one is ERR_REQUIREMENT_DANGLING_REF and a supersession chain stays walkable: A names B, and when B is retired in turn it names C. That resolution is the whole point — 0.24.0 deregistered an unresolved string, and the 2026-08-10 ruling had asked for the resolving form (point 4) which was never built. A prose note in @notes points one hop and goes stale; this does not."
84
+ },
76
85
  {
77
86
  "type": "attr",
78
87
  "subType": "string",
@@ -115,9 +124,10 @@ export const REQUIREMENT_DEFINITION: ProviderDefinition = {
115
124
  "allowedValues": [
116
125
  "planned",
117
126
  "live",
118
- "partial"
127
+ "partial",
128
+ "retired"
119
129
  ],
120
- "description": "As on requirement.functional. A live or partial architectural requirement claimed by NOTHING is an error: a policy declared and applied to nothing. A planned one is exempt from that check — it is not applied yet by definition."
130
+ "description": "As on requirement.functional. A live or partial architectural requirement claimed by NOTHING is an error: a policy declared and applied to nothing. planned is exempt from that check — it is not applied yet by definition — and retired is exempt because a withdrawn policy governs nothing."
121
131
  },
122
132
  {
123
133
  "type": "attr",
@@ -156,6 +166,14 @@ export const REQUIREMENT_DEFINITION: ProviderDefinition = {
156
166
  "max": 1,
157
167
  "description": "What breaking it looks like — the node that would contradict it. A STATIC falsifiability test, not a state. This is what makes universality checkable. Renamed from @violation in 0.24.0, which read as a status."
158
168
  },
169
+ {
170
+ "type": "attr",
171
+ "subType": "string",
172
+ "name": "supersededBy",
173
+ "min": 0,
174
+ "max": 1,
175
+ "description": "The requirement that REPLACED this one. Legal on @status: retired only (ERR_REQUIREMENT_SUPERSEDED_BY_NOT_RETIRED otherwise), and RESOLVED like any other reference, so a dangling one is ERR_REQUIREMENT_DANGLING_REF and a supersession chain stays walkable: A names B, and when B is retired in turn it names C. That resolution is the whole point — 0.24.0 deregistered an unresolved string, and the 2026-08-10 ruling had asked for the resolving form (point 4) which was never built. A prose note in @notes points one hop and goes stale; this does not."
176
+ },
159
177
  {
160
178
  "type": "attr",
161
179
  "subType": "string",