@unified-product-graph/core 0.33.0 → 0.34.0

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.
package/dist/index.js CHANGED
@@ -2397,6 +2397,51 @@ var UPG_EDGE_CATALOG = {
2397
2397
  // evidence co-reside), so NOT cross_product_eligible.
2398
2398
  document_contains_quote: { forward_verb: "contains", reverse_verb: "contained_in", classification: "semantic", source_type: "document", target_type: "quote" },
2399
2399
  document_contains_observation: { forward_verb: "contains", reverse_verb: "contained_in", classification: "semantic", source_type: "document", target_type: "observation" },
2400
+ /**
2401
+ * A document EMBEDS this node's live value at a position in its prose.
2402
+ *
2403
+ * @remarks
2404
+ * NOT `describes`. `document_describes_persona` says the document is ABOUT the
2405
+ * persona. Transclusion says the document RENDERS that node where the prose
2406
+ * sits, so the value a reader sees is the node's current value rather than a
2407
+ * copy taken when the sentence was written. A PRD that transcludes a metric is
2408
+ * not "about" the metric, and collapsing the two would lose the only property
2409
+ * transclusion is bought for: current by construction. The nine-member
2410
+ * `document_describes_*` family is untouched and keeps its meaning.
2411
+ *
2412
+ * POLYMORPHIC because the target set is genuinely open. Anything renderable can
2413
+ * be embedded, and the nine enumerated describe-targets are none of `metric`,
2414
+ * `research_study`, `specification` or `architecture_decision`, which is what
2415
+ * 65% of measured documents carrying zero outbound edges were reaching for.
2416
+ *
2417
+ * THE ANCHOR BINDING (normative). `@unified-product-graph/markdown` already
2418
+ * parses an inline reference form and records the source line of every
2419
+ * occurrence: `[[type:id]]`, `[[type:id|label]]`, `[[type:id|k:v|...]]`,
2420
+ * `[[+type:id]]` for creation, and `[[type:id@product]]` across products. The
2421
+ * grammar is published as Appendix F of the specification paper. The rule that
2422
+ * was missing, and is stated here: an anchor appearing in the body of a
2423
+ * `document` IS a transclusion anchor, and a conformant parser WRITES this edge
2424
+ * beside it. Anchor and edge are one fact recorded twice, so they must be
2425
+ * written together or they drift.
2426
+ *
2427
+ * NO POSITION PROPERTY, deliberately. The obvious `anchor_line` is the most
2428
+ * volatile value a text document has: every insertion above moves every anchor
2429
+ * below, so a stored line number is wrong after the next paragraph and nothing
2430
+ * reports the drift. The anchor IS the position, and it lives in the prose
2431
+ * where ordinary editing moves it for free. What the law asks is that the edge
2432
+ * be written BESIDE the anchor, which is a write-time discipline rather than a
2433
+ * stored field.
2434
+ *
2435
+ * `deliberate_only`, and the 0.33.0 trap is why that is safe here. Flagging a
2436
+ * widened edge `deliberate_only` silently switched five adapters off in the
2437
+ * last release, two of them under a green suite. The rule that came out of it:
2438
+ * an adapter reading an explicit field the SOURCE stores carries an authored
2439
+ * fact rather than an inferred one and must emit deliberate-only edges
2440
+ * EXPLICITLY. A `[[type:id]]` anchor is as explicit as a source gets, because a
2441
+ * person typed it, so the markdown emitter keys on the ANCHOR and never on the
2442
+ * `node` wildcard. No generic pair-resolution path may ever produce one.
2443
+ */
2444
+ document_transcludes_node: { forward_verb: "transcludes", reverse_verb: "transcluded_in", classification: "semantic", source_type: "document", target_type: "node", deliberate_only: true },
2400
2445
  // 5.3 Customer Education & Training Domain
2401
2446
  product_educates_via_education_program: { forward_verb: "educates_via", reverse_verb: "educates", classification: "hierarchy", source_type: "product", target_type: "education_program" },
2402
2447
  education_program_teaches_via_tutorial: { forward_verb: "teaches_via", reverse_verb: "teaches", classification: "hierarchy", source_type: "education_program", target_type: "tutorial" },
@@ -2462,10 +2507,10 @@ var UPG_EDGE_CATALOG = {
2462
2507
  // and G2b is not engaged.
2463
2508
  // Membership is UNQUALIFIED: no role property on the edge. `role` is already an
2464
2509
  // entity type with team_staffed_with_role, so a role string here would be a
2465
- // second role model beside a node type. The consequence is stated rather than
2466
- // hidden: the graph can say a team has a slot and that a person is on the team,
2467
- // and not that the person fills the slot. `person_holds_role` is banked, with
2468
- // its condition the first field graph carrying both where the join is asked for.
2510
+ // second role model beside a node type. The consequence that used to follow is
2511
+ // now closed rather than accepted: the graph can say a team has a slot, that a
2512
+ // person is on the team, AND that the person fills the slot, the last through
2513
+ // `person_holds_role` (0.34.0) rather than through a qualifier here.
2469
2514
  //
2470
2515
  // Neither is cross_product_eligible: `person` is not portfolio_shared, so the
2471
2516
  // 0.18.0 both-endpoints gate rejects the flag regardless of any team-scoping
@@ -2486,6 +2531,41 @@ var UPG_EDGE_CATALOG = {
2486
2531
  // the person / team / department triangle is decided once rather than three
2487
2532
  // times.
2488
2533
  person_reports_to_person: { forward_verb: "reports_to", reverse_verb: "has_report", classification: "semantic", source_type: "person", target_type: "person" },
2534
+ // MINTED 0.34.0 on a grammar-versus-catalog inconsistency readable entirely
2535
+ // inside this package, NOT on the field condition the 0.33.0 bank named. That
2536
+ // condition is still unmet and saying so is the honest framing: both org edges
2537
+ // exist in exactly one graph and it is the saturation fixture, whose person set
2538
+ // contains teams mistyped as people. What replaced it is stronger on its own
2539
+ // terms because it is checkable and adoption-independent:
2540
+ //
2541
+ // `role`'s lifecycle terminates at `filled` and `vacant`, and `filled` is
2542
+ // described "Role is staffed." `team_staffed_with_role` runs team -> slot.
2543
+ // `person_member_of_team` runs person -> team. NOTHING connected a person to
2544
+ // a role. So a graph could legally mark a role `filled` and no edge in the
2545
+ // catalog could say by whom.
2546
+ //
2547
+ // A terminal lifecycle phase that no edge can substantiate is dead schema, and
2548
+ // it is worse than a phantom edge name: a phantom is inert, while `filled` is a
2549
+ // value graphs will actually carry. Same class as the anti-pattern entry that
2550
+ // instructed users toward an edge the catalog refused, which is what minted
2551
+ // `person_reports_to_person` one release ago.
2552
+ //
2553
+ // `semantic`, not `cross-domain`. `person`, `role` and `team` are one domain
2554
+ // (domains.ts, team_org), and T1.7 forbids new same-domain cross-domain edges.
2555
+ // This is the third member of that triangle and it is decided on exactly the
2556
+ // ground the other two were decided on mid-build at 0.33.0.
2557
+ //
2558
+ // Direction is person -> role, matching both 0.33.0 person edges, so the
2559
+ // containment reading stays UNAVAILABLE rather than merely unchosen and
2560
+ // UPG_VALID_CHILDREN is untouched. `role_filled_by_person` would source the
2561
+ // edge on the slot, which reads as the slot owning the person.
2562
+ //
2563
+ // Unqualified, for the reason the membership edge above gives: `role` is a type,
2564
+ // not a string, so a qualifier here would be a second role model.
2565
+ //
2566
+ // Not cross_product_eligible: `person` is not portfolio_shared, so the 0.18.0
2567
+ // both-endpoints gate rejects the flag regardless.
2568
+ person_holds_role: { forward_verb: "holds", reverse_verb: "held_by", classification: "semantic", source_type: "person", target_type: "role" },
2489
2569
  team_staffed_with_role: { forward_verb: "staffed_with", reverse_verb: "staffed_in", classification: "hierarchy", source_type: "team", target_type: "role" },
2490
2570
  team_targets_team_okr: { forward_verb: "targets", reverse_verb: "targeted_by", classification: "hierarchy", source_type: "team", target_type: "team_okr" },
2491
2571
  team_reflects_in_retrospective: { forward_verb: "reflects_in", reverse_verb: "reflects", classification: "hierarchy", source_type: "team", target_type: "retrospective" },
@@ -3856,8 +3936,51 @@ var UPG_POLYMORPHIC_EDGE_KEYS = [
3856
3936
  // Project membership (0.33.0, widened from project_delivers_epic):
3857
3937
  // endpoint-polymorphic over the work-item set {feature, epic, user_story, task,
3858
3938
  // bug}. Same construction and same reasoning as the cadence edge above.
3859
- "project_delivers_work_item"
3939
+ "project_delivers_work_item",
3940
+ // Document transclusion (0.34.0): a document embeds any renderable node's live
3941
+ // value at a position in its prose. Open by nature rather than by an
3942
+ // enumeration nobody wanted to write out.
3943
+ "document_transcludes_node"
3860
3944
  ];
3945
+ var UPG_POLYMORPHIC_EDGE_FAMILIES = {
3946
+ "universal semantic verbs": ["node_informs_node", "node_constrains_node", "node_inspires_node"],
3947
+ "decision-to-anything": ["decision_influences_node", "decision_constrained_by_node", "decision_produces_node"],
3948
+ "universal ownership": [
3949
+ "node_owned_by_team",
3950
+ "node_owned_by_role",
3951
+ "node_owned_by_stakeholder",
3952
+ "node_owned_by_department",
3953
+ "node_owned_by_person"
3954
+ ],
3955
+ "universal architecture references": ["node_belongs_to_bounded_context"],
3956
+ "framework exercises": ["framework_exercise_includes_node"],
3957
+ "universal classification": ["node_classified_as_classification_value"],
3958
+ "work-item issue links": [
3959
+ "work_item_blocks_work_item",
3960
+ "work_item_relates_to_work_item",
3961
+ "work_item_duplicates_work_item"
3962
+ ],
3963
+ "workspace provenance": ["workspace_produced_node"],
3964
+ "canvas arrangement and published-view focus": ["workspace_arranges_node", "composition_focuses_node"],
3965
+ "benchmark subject": ["eval_benchmark_measures_node"],
3966
+ // 0.32.0. Assignment is its OWN family and deliberately not a member of
3967
+ // 'universal ownership': keeping them apart in this partition is the same
3968
+ // ruling the edge itself makes, so a future author who merges them here is
3969
+ // making that decision visibly rather than by tidying a list.
3970
+ "universal assignment": ["node_assigned_to_person"],
3971
+ "capture subject": ["capture_renders_node"],
3972
+ "cadence scheduling": ["planning_cycle_schedules_work_item"],
3973
+ // 0.33.0. Project membership is its own family and deliberately not a member
3974
+ // of 'cadence scheduling', even though both range over the same work-item set:
3975
+ // a cycle SCHEDULES work in time and a project REFERENCES the work it delivers,
3976
+ // and merging them here would quietly assert those are one relation.
3977
+ "project membership": ["project_delivers_work_item"],
3978
+ // 0.34.0. Its own family and deliberately not merged with the nine-member
3979
+ // `document_describes_*` set, which is not polymorphic at all: those are
3980
+ // enumerated edges saying a document is ABOUT a thing. Transclusion says it
3981
+ // RENDERS the thing, and the difference is the whole reason the edge exists.
3982
+ "document transclusion": ["document_transcludes_node"]
3983
+ };
3861
3984
  var _POLY_KEY_SET = new Set(UPG_POLYMORPHIC_EDGE_KEYS);
3862
3985
  function isPolymorphicEdge(key) {
3863
3986
  const def = UPG_EDGE_CATALOG[key];
@@ -3875,1243 +3998,102 @@ function getEdgePropertySchema(type) {
3875
3998
  return def?.property_schema;
3876
3999
  }
3877
4000
 
3878
- // src/catalog/legacy-product-stages.ts
3879
- var LEGACY_PRODUCT_STAGES = Object.freeze({
3880
- idea: "concept"
3881
- });
3882
- function migrateProductStage(stage) {
3883
- if (stage === void 0 || stage === null) {
3884
- return void 0;
3885
- }
3886
- if (typeof stage !== "string") {
3887
- return stage;
3888
- }
3889
- const lower = stage.toLowerCase();
3890
- const mapped = LEGACY_PRODUCT_STAGES[lower];
3891
- return mapped ?? stage;
3892
- }
3893
- function isLegacyProductStage(stage) {
3894
- return typeof stage === "string" && stage.toLowerCase() in LEGACY_PRODUCT_STAGES;
3895
- }
3896
-
3897
- // src/shapes/base-node.ts
3898
- var BASE_NODE_FIELD_PRESENCE = {
3899
- id: true,
3900
- type: true,
3901
- title: true,
3902
- slug: true,
3903
- aliases: true,
3904
- key: true,
3905
- description: true,
3906
- tags: true,
3907
- status: true,
3908
- archived: true,
3909
- archived_at: true,
3910
- source_id: true,
3911
- source_type: true,
3912
- mapping_confidence: true,
3913
- external_tool: true,
3914
- external_ref: true,
3915
- external_id: true,
3916
- external_links: true,
3917
- created_at: true,
3918
- updated_at: true,
3919
- properties: true
3920
- };
3921
- var UPG_BASE_NODE_FIELDS = Object.freeze(
3922
- Object.keys(BASE_NODE_FIELD_PRESENCE)
3923
- );
3924
- var UPG_BASE_NODE_FIELD_SET = new Set(UPG_BASE_NODE_FIELDS);
3925
- var UPG_BASE_NODE_SPECIAL_MERGE_FIELDS = /* @__PURE__ */ new Set([
3926
- "id",
3927
- "type",
3928
- "slug",
3929
- "aliases",
3930
- "properties"
3931
- ]);
3932
-
3933
- // src/shapes/document.ts
3934
- var UPG_CROSS_ONLY_EDGE_TYPES = [
3935
- // Peer overlap: "these two products share / overlap on this thing." Symmetric,
3936
- // no canonical instance_of identity. shares_job / shares_need are the job/need
3937
- // siblings of the persona/competitor/metric peers (connective layer, 0.13.1).
3938
- "shares_persona",
3939
- "shares_competitor",
3940
- "shares_metric",
3941
- "shares_job",
3942
- "shares_need",
3943
- // Product-to-product relationships.
3944
- "depends_on_product",
3945
- // runtime dependency (built-on / dogfood), not containment
3946
- "cannibalises",
3947
- "succeeds",
3948
- "hosts",
3949
- // host runs the hosted product inside itself (container -> contained)
3950
- // OKR / measurement rollup primitives: the cascade ACROSS products (subordinate
3951
- // -> superior). `contributes_to` rolls a product strategy entity up to a higher-
3952
- // level one; `rolls_up_to` feeds a product metric into a higher-level north-star.
3953
- "contributes_to",
3954
- "rolls_up_to",
3955
- // Canonical instance + area-to-audience: the target lives in the portfolio
3956
- // `registry` section (`registry/{node_id}`). `instance_of` is same-type
3957
- // canonical-to-instance; the area edges are minted via `link_area_to_audience`.
3958
- "instance_of",
3959
- "area_serves_persona",
3960
- "area_targets_market_segment",
3961
- // Foundations (0.9.12): a product-graph entity links to a canonical specification
3962
- // or primitive in the registry (`registry/{node_id}` target, same shape as
3963
- // instance_of). Registry-internal spec-to-spec links are catalog edges, not these.
3964
- "product_implements_specification",
3965
- "product_exposes_specification",
3966
- "feature_conforms_to_specification",
3967
- "api_contract_speaks_specification",
3968
- "product_exposes_primitive",
3969
- "feature_manipulates_primitive",
3970
- "primitive_stored_as_data_type"
3971
- ];
3972
- var UPG_CROSS_EDGE_TYPES = [
3973
- ...UPG_CROSS_ONLY_EDGE_TYPES,
3974
- ...UPG_CROSS_ELIGIBLE_CATALOG_EDGE_TYPES
3975
- ];
3976
- var REGISTRY_PRODUCT_ID = "registry";
3977
- var UPG_PORTFOLIO_KINDS = ["owned", "watched", "strategic", "internal", "gtm"];
3978
-
3979
- // src/registry/entity-type-resolution.ts
3980
- var TYPES = getTypes();
3981
- var TYPES_SET = new Set(TYPES);
3982
- var UnknownEntityTypeError = class extends Error {
3983
- suggestions;
3984
- rawType;
3985
- constructor(rawType, suggestions) {
3986
- const suffix = suggestions.length > 0 ? ` Did you mean: ${suggestions.join(", ")}?` : "";
3987
- super(`Unknown entity type: "${rawType}".${suffix}`);
3988
- this.name = "UnknownEntityTypeError";
3989
- this.rawType = rawType;
3990
- this.suggestions = suggestions;
3991
- }
4001
+ // src/grammar/lifecycles.ts
4002
+ var PRODUCT_LIFECYCLE = {
4003
+ entity_type: "product",
4004
+ initial_phase: "concept",
4005
+ terminal_phases: ["sunset"],
4006
+ phases: [
4007
+ {
4008
+ id: "concept",
4009
+ status_category: "triage",
4010
+ label: "Concept",
4011
+ description: "Napkin idea. Problem shape and solution sketch, pre-validation.",
4012
+ transitions_to: ["validation", "build", "beta", "launch", "growth", "mature", "sunset"]
4013
+ },
4014
+ {
4015
+ id: "validation",
4016
+ status_category: "started",
4017
+ label: "Validation",
4018
+ description: "Testing demand. User conversations and experiments pressure-test assumptions before build commits.",
4019
+ transitions_to: ["build", "beta", "launch", "growth", "mature", "sunset"]
4020
+ },
4021
+ {
4022
+ id: "build",
4023
+ status_category: "started",
4024
+ label: "Build",
4025
+ description: "Actively developing v1. Core functionality is being authored, pre-user.",
4026
+ transitions_to: ["beta", "launch", "growth", "mature", "sunset"]
4027
+ },
4028
+ {
4029
+ id: "beta",
4030
+ status_category: "started",
4031
+ label: "Beta",
4032
+ description: "Early users, iterating. Feature-complete enough to learn from, still changing weekly.",
4033
+ transitions_to: ["launch", "growth", "mature", "maintenance", "sunset"]
4034
+ },
4035
+ {
4036
+ id: "launch",
4037
+ status_category: "started",
4038
+ label: "Launch",
4039
+ description: "Generally available. Announced to the target audience, open past beta access.",
4040
+ transitions_to: ["growth", "mature", "maintenance", "sunset"]
4041
+ },
4042
+ {
4043
+ id: "growth",
4044
+ status_category: "started",
4045
+ label: "Growth",
4046
+ description: "Scaling users and revenue. Product fit validated; focus is acquisition, retention, expansion.",
4047
+ transitions_to: ["mature", "maintenance", "sunset"]
4048
+ },
4049
+ {
4050
+ id: "mature",
4051
+ status_category: "started",
4052
+ label: "Mature",
4053
+ description: "Stable. Growth levelled; investment weights toward optimisation, efficiency, and durability.",
4054
+ transitions_to: ["maintenance", "sunset"]
4055
+ },
4056
+ {
4057
+ id: "maintenance",
4058
+ status_category: "started",
4059
+ label: "Maintenance",
4060
+ description: "Sustaining. Minimal investment keeps the product running for existing users. Can transition back to `mature` on a strategic revival.",
4061
+ transitions_to: ["mature", "sunset"]
4062
+ },
4063
+ {
4064
+ id: "sunset",
4065
+ status_category: "completed",
4066
+ label: "Sunset",
4067
+ description: "Winding down or retired. Existing users are being migrated or offboarded.",
4068
+ transitions_to: []
4069
+ }
4070
+ ]
3992
4071
  };
3993
- function withinEditDistance1(a, b) {
3994
- if (a === b) return true;
3995
- const al = a.length;
3996
- const bl = b.length;
3997
- if (Math.abs(al - bl) > 1) return false;
3998
- let i = 0;
3999
- let j = 0;
4000
- let edits = 0;
4001
- while (i < al && j < bl) {
4002
- if (a[i] !== b[j]) {
4003
- if (++edits > 1) return false;
4004
- if (al > bl) i++;
4005
- else if (bl > al) j++;
4006
- else {
4007
- i++;
4008
- j++;
4009
- }
4010
- } else {
4011
- i++;
4012
- j++;
4013
- }
4014
- }
4015
- if (i < al || j < bl) edits++;
4016
- return edits <= 1;
4017
- }
4018
- function resolveEntityType(rawType) {
4019
- if (typeof rawType !== "string" || rawType.length === 0) {
4020
- throw new UnknownEntityTypeError(String(rawType ?? ""), []);
4021
- }
4022
- if (TYPES_SET.has(rawType)) {
4023
- return { canonical: rawType };
4024
- }
4025
- const replacement = getReplacementType(rawType);
4026
- if (replacement && TYPES_SET.has(replacement)) {
4027
- return { canonical: replacement, alias: { from: rawType, to: replacement } };
4028
- }
4029
- const suggestions = [];
4030
- for (const t of TYPES) {
4031
- if (withinEditDistance1(t, rawType)) suggestions.push(t);
4032
- if (suggestions.length >= 5) break;
4033
- }
4034
- throw new UnknownEntityTypeError(rawType, suggestions);
4035
- }
4036
-
4037
- // src/grammar/hierarchy.ts
4038
- var UPG_VALID_CHILDREN = {
4039
- // ── Foundations (0.9.12): registry canonicals that self-nest. A
4040
- // specification extends a specification (a dialect of a parent spec); a
4041
- // primitive composes primitives (a block contains spans). These back the
4042
- // hierarchy-classified specification_extends_specification /
4043
- // primitive_composes_primitive catalog edges.
4044
- specification: ["specification"],
4045
- primitive: ["primitive"],
4046
- // An operating_lifecycle (e.g. the content-ops lifecycle) contains its ordered
4047
- // operating_stage children. Backs the operating_lifecycle_contains_operating_stage edge.
4048
- operating_lifecycle: ["operating_stage"],
4049
- // ── Product (root) ─────────────────────────────────────────────────────────
4050
- product: [
4051
- // Strategy
4052
- "vision",
4053
- "outcome",
4054
- "objective",
4055
- "metric",
4056
- "decision",
4057
- "constraint",
4058
- // User
4059
- "persona",
4060
- // Discovery (via outcome children)
4061
- // Validation (via hypothesis children)
4062
- // Market Intelligence
4063
- "competitor",
4064
- "market_trend",
4065
- "market_segment",
4066
- "competitive_analysis",
4067
- // User Research
4068
- "research_study",
4069
- // Experience Design
4070
- "user_journey",
4071
- "user_flow",
4072
- "wireframe",
4073
- "screen",
4074
- // Design System
4075
- "design_system",
4076
- "design_component",
4077
- // Brand Identity
4078
- "brand_identity",
4079
- // Product Specification
4080
- "feature",
4081
- "feature_area",
4082
- "release",
4083
- "roadmap",
4084
- "roadmap_theme",
4085
- "planning_cycle",
4086
- // Configuration (0.30.0): the levers whose values select which surface tree
4087
- // the product renders. Few per product, and top-level because an axis is a
4088
- // product-wide fact rather than a child of any one feature or surface.
4089
- "configuration_axis",
4090
- // Classification (0.32.0): the product's own taxonomies — the grouped-label
4091
- // case, one named group over a set of values. Same reasoning as the
4092
- // configuration axis above, and until now the only parent a
4093
- // classification_axis could have was a competitive_analysis.
4094
- "classification_axis",
4095
- // Engineering
4096
- "bounded_context",
4097
- "code_repository",
4098
- "integration_pattern",
4099
- "external_api",
4100
- "data_flow",
4101
- // Growth
4102
- "funnel",
4103
- "acquisition_channel",
4104
- "cohort",
4105
- "behavioral_segment",
4106
- "growth_loop",
4107
- "attribution_model",
4108
- // Business Model
4109
- "business_model",
4110
- // Go-To-Market
4111
- "gtm_strategy",
4112
- // Team & Organisation
4113
- // `person` is containment-free (see UPG_CONTAINMENT_FREE_TYPES below)
4114
- // (referenced via edges, not nested under product)
4115
- "team",
4116
- "stakeholder",
4117
- "department",
4118
- // Data & Analytics
4119
- "data_source",
4120
- "event_schema",
4121
- "dashboard",
4122
- "data_domain",
4123
- "glossary_term",
4124
- // Content & Knowledge
4125
- "content_piece",
4126
- "knowledge_base_article",
4127
- "brand_asset",
4128
- "document",
4129
- "documentation_template",
4130
- // Legal
4131
- "legal_entity",
4132
- "privacy_policy",
4133
- // Compliance
4134
- "compliance_requirement",
4135
- "risk",
4136
- "data_contract",
4137
- "audit_log_policy",
4138
- "compliance_framework",
4139
- // DevOps & Platform
4140
- "service_level_objective",
4141
- "incident",
4142
- "runbook",
4143
- "monitor",
4144
- "ci_pipeline",
4145
- "release_strategy",
4146
- "on_call_rotation",
4147
- "infrastructure_component",
4148
- // Security
4149
- "threat_model",
4150
- "security_control",
4151
- "security_policy",
4152
- "penetration_test",
4153
- "security_review",
4154
- "data_classification",
4155
- "access_policy",
4156
- // Accessibility
4157
- "a11y_standard",
4158
- "a11y_audit",
4159
- "a11y_annotation",
4160
- // Quality Assurance
4161
- "test_plan",
4162
- "test_suite",
4163
- "qa_session",
4164
- "test_coverage_report",
4165
- "test_environment",
4166
- // Customer Feedback
4167
- "feedback_program",
4168
- "user_advisory_board",
4169
- "beta_program",
4170
- // Pricing & Packaging
4171
- "pricing_strategy",
4172
- // AI & Machine Learning
4173
- "ai_model",
4174
- "model_comparison",
4175
- // Workflows & Agents
4176
- "workflow_template",
4177
- "agent_definition",
4178
- // Sales & Revenue
4179
- "pipeline_sales",
4180
- "account",
4181
- "lead",
4182
- "subscription",
4183
- "forecast",
4184
- // Program Management
4185
- // `milestone` is a SECOND, shallower parent here (Portfolio Phase 2,
4186
- // 2026-08-14), alongside its existing `project` parent: a product can own a
4187
- // milestone outright with no program/project above it. Required by the
4188
- // hierarchy-orphan guard now that `product_targets_milestone` exists.
4189
- "program",
4190
- "milestone",
4191
- // Marketing
4192
- "marketing_strategy",
4193
- "press_release",
4194
- "event",
4195
- "community_initiative",
4196
- // Customer Success
4197
- "support_ticket",
4198
- "customer_feedback",
4199
- "churn_reason",
4200
- "customer_health_score",
4201
- "playbook",
4202
- "service_level_agreement",
4203
- "success_milestone",
4204
- "service_blueprint",
4205
- "nps_campaign",
4206
- // Localisation
4207
- "locale",
4208
- "locale_config",
4209
- // Customer Education
4210
- "education_program",
4211
- // Partners & Ecosystem
4212
- "partner_program",
4213
- "api_ecosystem",
4214
- "developer_portal",
4215
- // Portfolio
4216
- // (UPG-677) product no longer lists product_area as a child: the
4217
- // product↔product_area containment is the single direction
4218
- // product_area_contains_product (product_area → product). The inverse
4219
- // product_categorised_in_product_area edge was collapsed.
4220
- // Workspace
4221
- "workspace"
4222
- ],
4223
- // ── Metric & Outcome hierarchy ──────────────────────────────────────────────
4224
- outcome: ["metric", "opportunity", "feature"],
4225
- // ── User & Jobs hierarchy ───────────────────────────────────────────────────
4226
- persona: ["job", "need", "switching_cost", "desired_outcome"],
4227
- job: ["need", "desired_outcome", "job_step"],
4228
- // ── Discovery hierarchy ─────────────────────────────────────────────────────
4229
- opportunity: ["solution", "design_concept", "feasibility_study", "design_sprint"],
4230
- // solutions now propose hypothesis (the templated
4231
- // belief), not the legacy hypothesis type.
4232
- solution: ["hypothesis", "prototype", "metric"],
4233
- // ── Validation hierarchy ────────────────────────────────────────────────────
4234
- // (UPG-664) The validation chain is a single-parent line:
4235
- // hypothesis ▷ experiment_plan ▷ experiment ▷ experiment_run.
4236
- // hypothesis is canonical (hypothesis_evidence collapsed into evidence;
4237
- // relationship expressed via hypothesis_has_evidence edge; evidence.direction
4238
- // carries supports/refutes/neutral semantics). `test_plan` re-homed to the
4239
- // QA/testing domain (UPG-678), so it is no longer a hypothesis child.
4240
- hypothesis: ["experiment_plan", "research_plan", "evidence"],
4241
- // experiment_plan is the canonical validation PLAN (graduated stable,
4242
- // UPG-664). It designs the experiment it produces; the plan owns the
4243
- // experiment in the containment line. It also retains experiment_run as a
4244
- // child for the v0.2.6 split-migration path
4245
- // (`experiment_plan_ran_as_experiment_run`), where a legacy experiment routes
4246
- // directly to a plan + run pair.
4247
- experiment_plan: ["experiment", "experiment_run"],
4248
- // experiment is the canonical structured test. It owns its run(s) and the
4249
- // learning/evidence it produces. The optional experiment_run child captures
4250
- // the multi-run / replication case.
4251
- experiment: ["experiment_run", "learning", "evidence"],
4252
- // experiment_run carries learning/evidence/metric children (run produces
4253
- // evidence) and self-nests for replications/multi-armed runs (V9: this is
4254
- // where self-nesting genuinely lives, not on `experiment`).
4255
- experiment_run: ["learning", "evidence", "metric", "experiment_run"],
4256
- // ── OKR hierarchy ──────────────────────────────────────────────────────────
4257
- // strategic_question (0.17.4): an open coordination question raised under an
4258
- // objective (objective_raises_strategic_question, hierarchy).
4259
- objective: ["key_result", "metric", "strategic_question"],
4260
- key_result: ["metric"],
4261
- // ── Strategic cascade: vision → mission → strategic_pillar → strategic_theme →
4262
- // { initiative, objective } ───────────────────────────────────────────────
4263
- //
4264
- // strategic_pillar vs strategic_theme (UPG-692 T3.3 — distinct cascade levels,
4265
- // NOT duplicates; sharpened rather than merged):
4266
- // - strategic_pillar = a DURABLE structural division of the strategy. A
4267
- // standing area the org organises around for years (e.g. "Structured
4268
- // content", "Developer experience"). Few, long-lived; time_horizon is
4269
- // multi-year / open-ended; carries its own `success_indicator`.
4270
- // - strategic_theme = a TIME-BOUND thrust WITHIN a pillar. The current bet
4271
- // for a period (e.g. "Go AI-native this year"). More numerous, rotates;
4272
- // time_horizon is bounded (Q / FY); has NO `success_indicator` because it
4273
- // is measured through its child objectives (strategic_theme_contains_objective).
4274
- // That success-measurement asymmetry is the load-bearing distinction.
4275
- vision: ["mission"],
4276
- mission: ["strategic_pillar"],
4277
- // 0.20.1: metric added as a strategic_pillar child, backing
4278
- // strategic_pillar_measured_by_metric (hierarchy) — the pillar's own
4279
- // north-star, mirrored from objective: ['key_result', 'metric', ...] one
4280
- // level down the cascade.
4281
- strategic_pillar: ["strategic_theme", "capability", "value_stream", "decision", "metric"],
4282
- // v0.5.4 (UPG-511): objectives are the specific quarterly bets *within* a
4283
- // strategic theme. The theme is the multi-quarter focus area; objectives are
4284
- // subordinate. Pairs with `strategic_theme_contains_objective` in the edge
4285
- // catalog (hierarchy, strategic_theme → objective, reverse_verb: rolls_up_to;
4286
- // renamed from objective_rolls_up_to_strategic_theme in UPG-676).
4287
- strategic_theme: ["initiative", "objective"],
4288
- initiative: ["assumption", "strategic_question"],
4289
- // v0.5.2 (UPG-528): capability decomposes into sub-capabilities (Wardley
4290
- // value-chain spine) and is realised by user-facing features. Pairs with
4291
- // `capability_depends_on_capability` and `capability_implemented_by_feature`
4292
- // in the edge catalogue. The self-loop guard (UPG-520) keeps A → A refused;
4293
- // A → B between distinct capabilities is the supported decomposition.
4294
- capability: ["capability", "feature"],
4295
- // ── Market hierarchy ────────────────────────────────────────────────────────
4296
- // competitive_analysis hosts classification axes (its dimensions);
4297
- // each axis hosts its values; values are reusable across the row and column
4298
- // dossiers of a 2-axis matrix.
4299
- competitive_analysis: ["competitor", "market_trend", "market_segment", "classification_axis"],
4300
- competitor: ["competitor_feature", "competitor_signal"],
4301
- classification_axis: ["classification_value"],
4302
- // ── UX Research hierarchy ───────────────────────────────────────────────────
4303
- research_study: [
4304
- "participant",
4305
- "observation",
4306
- "affinity_cluster",
4307
- "research_question",
4308
- "interview_guide",
4309
- "insight",
4310
- "survey_response"
4311
- ],
4312
- observation: ["quote"],
4313
- // F6 (UPG-672): affinity_cluster owns the observations it groups, in addition
4314
- // to the insights it synthesises. Pairs with `affinity_cluster_groups_observation`
4315
- // in the edge catalog (hierarchy). An observation can be both directly owned by
4316
- // its research_study and grouped under an affinity_cluster (multi-parent grammar).
4317
- affinity_cluster: ["insight", "observation"],
4318
- // insight refines into insight; a raw insight can be distilled
4319
- // into a more specific insight (refines_into chain).
4320
- // v0.5.8 (UPG-528 Part 2d): insights own their evidencing quotes;
4321
- // parallel to `observation: ['quote']`. Research-synthesis canon.
4322
- // Pairs with `insight_evidenced_by_quote` in the edge catalog.
4323
- // ── Design hierarchy ────────────────────────────────────────────────────────
4324
- // (UPG-663, v0.9.2) A user_journey owns its steps (the stable 0.1.0 spine)
4325
- // and carries phases as a non-owning band overlay. A journey_phase is NO
4326
- // LONGER a containment parent of journey_step: it SPANS steps via the
4327
- // `journey_phase_spans_journey_step` edge (mirroring the marketing
4328
- // `customer_journey_stage_spans_journey_step` precedent), so each step has
4329
- // exactly one containment parent and the journey has one canonical step list.
4330
- user_journey: ["journey_step", "journey_phase"],
4331
- journey_step: ["journey_action"],
4332
- // v0.5.8 (UPG-528 Part 2d): insights own their evidencing quotes;
4333
- // parallel to `observation: ['quote']`. Research-synthesis canon
4334
- // (insight ← quote evidencing) extends quote's hierarchy parents to
4335
- // both observation (raw-capture parent) and insight (synthesis parent).
4336
- // Pairs with `insight_evidenced_by_quote` in the edge catalog.
4337
- insight: ["design_question", "insight", "quote"],
4338
- // v0.5.2 (UPG-528): need anchors a Wardley value chain; capabilities
4339
- // fulfil the need at the chain top. Cross-domain hierarchy (need ∈ Design,
4340
- // capability ∈ Strategy) is intentional: Wardley analysis starts from a
4341
- // user need and decomposes into the capabilities required to fulfil it.
4342
- need: ["design_question", "capability"],
4343
- design_question: ["design_concept"],
4344
- design_concept: ["prototype", "wireframe"],
4345
- design_component: [
4346
- "design_token",
4347
- "design_pattern",
4348
- "design_guideline",
4349
- "interaction_spec",
4350
- "design_component"
4351
- ],
4352
- // self-nesting for atomic hierarchy (organism → molecule → atom)
4353
- prototype: ["annotation"],
4354
- // ── Brand hierarchy ─────────────────────────────────────────────────────────
4355
- brand_identity: [
4356
- "brand_colour",
4357
- "brand_typography",
4358
- "brand_asset",
4359
- "brand_voice",
4360
- "brand_logo",
4361
- "brand_imagery"
4362
- ],
4363
- // ── Product Specification hierarchy ─────────────────────────────────────────
4364
- // story_task collapsed into canonical task. feature now owns
4365
- // task directly; story-derived tasks implement user_story via
4366
- // task_implements_user_story edge.
4367
- feature: ["epic", "bug", "task"],
4368
- feature_area: ["feature", "feature_area"],
4369
- // epic owns user_story (the templated promise) and, mirroring feature, may
4370
- // also directly contain bug/task — heterogeneous imported tickets that belong
4371
- // to one epic rather than the feature as a whole (feedback df99026a).
4372
- epic: ["user_story", "bug", "task"],
4373
- user_story: ["acceptance_criterion"],
4374
- task: ["task"],
4375
- // planning_cycle (0.20.0): the cadence axis self-nests (a program-increment
4376
- // contains iterations; a cycle contains its cooldown) via
4377
- // planning_cycle_contains_planning_cycle. It does NOT contain user_story as a
4378
- // child: scheduling work into a cycle is the semantic, deliberate-only
4379
- // planning_cycle_schedules_work_item edge, so the item keeps its feature/epic
4380
- // containment parent and is merely referenced by the cycle.
4381
- planning_cycle: ["planning_cycle"],
4382
- // ── Engineering hierarchy ───────────────────────────────────────────────────
4383
- bounded_context: [
4384
- "service",
4385
- "domain_event",
4386
- "decision",
4387
- "data_model",
4388
- "aggregate",
4389
- "read_model",
4390
- "code_repository",
4391
- "integration_pattern",
4392
- "external_api",
4393
- "data_flow",
4394
- // v0.5.7 (UPG-528 Part 2c): BCs publish api_contracts as their "published
4395
- // language" (DDD canon). api_contract has two valid hierarchy parents now:
4396
- // service (per-service exposure) AND bounded_context (BC-level surface).
4397
- "api_contract"
4398
- ],
4399
- service: [
4400
- "api_contract",
4401
- "technical_debt_item",
4402
- "feature_flag",
4403
- "deployment",
4404
- "api_endpoint",
4405
- "database_schema",
4406
- "queue_topic",
4407
- "build_artifact",
4408
- "library_dependency"
4409
- ],
4410
- // v0.5.1 (UPG-517 C2): contracts contain their endpoints. Service still
4411
- // serves endpoints directly (legacy / non-contract endpoints); both
4412
- // parent-child paths coexist.
4413
- api_contract: ["api_endpoint"],
4414
- decision: ["technical_debt_item"],
4415
- aggregate: ["domain_entity", "value_object", "command"],
4416
- // ── Growth hierarchy ────────────────────────────────────────────────────────
4417
- funnel: ["funnel_step"],
4418
- acquisition_channel: ["growth_campaign"],
4419
- growth_campaign: ["experiment_plan", "variant"],
4420
- // ── Business Model hierarchy ─────────────────────────────────────────────────
4421
- business_model: [
4422
- "value_proposition",
4423
- "revenue_stream",
4424
- "cost_structure",
4425
- "unit_economics",
4426
- "partnership",
4427
- "key_resource",
4428
- "key_activity",
4429
- "customer_relationship",
4430
- "distribution_channel"
4431
- ],
4432
- revenue_stream: ["pricing_tier"],
4433
- // ── Go-To-Market hierarchy ───────────────────────────────────────────────────
4434
- gtm_strategy: [
4435
- "ideal_customer_profile",
4436
- "positioning",
4437
- "launch",
4438
- "content_strategy",
4439
- "sales_motion",
4440
- "competitive_battle_card",
4441
- "demand_gen_program",
4442
- "territory"
4443
- ],
4444
- positioning: ["messaging", "objection", "proof_point"],
4445
- value_proposition: ["objection", "proof_point"],
4446
- competitive_battle_card: ["objection"],
4447
- objection: ["rebuttal"],
4448
- rebuttal: ["proof_point"],
4449
- // ── Team & Organisation hierarchy ───────────────────────────────────────────
4450
- department: ["team", "stakeholder"],
4451
- team: [
4452
- "role",
4453
- "team_okr",
4454
- "retrospective",
4455
- "dependency",
4456
- "skill",
4457
- "ceremony",
4458
- "capacity_plan",
4459
- "decision",
4460
- // Self-nesting (0.17.2): a parent team contains its sub-teams / squads, one
4461
- // level below department_contains_team. Backs team_contains_team. Mirrors
4462
- // feature_area_contains_feature_area (same-type child listed last).
4463
- "team"
4464
- ],
4465
- // ── Data & Analytics hierarchy ───────────────────────────────────────────────
4466
- data_source: ["metric", "data_pipeline", "data_lineage", "event_schema"],
4467
- // UPG-685 T0.4 (0.13.0 Wave 1): `outcome` removed as a metric child. It closed a
4468
- // containment cycle (outcome ⊃ metric ⊃ outcome) and was backed only by the CAUSAL
4469
- // `metric_drives_outcome` edge, not a hierarchy edge — the "metric leads to outcome"
4470
- // meaning lives correctly on that causal edge. The real containment (outcome ⊃ metric)
4471
- // is kept. Sub-metric trees (metric ⊃ metric) stay.
4472
- metric: ["metric", "data_quality_rule", "metric_quality_assessment"],
4473
- data_domain: ["data_product", "data_source", "glossary_term", "data_model", "dashboard"],
4474
- dashboard: ["report", "experiment_run"],
4475
- // ── Content & Knowledge hierarchy ────────────────────────────────────────────
4476
- // release contains features and bugs (GitHub milestone→issue import).
4477
- release: ["changelog", "feature", "bug"],
4478
- content_strategy: ["content_calendar", "content_theme"],
4479
- content_calendar: [
4480
- "content_theme",
4481
- "content_piece",
4482
- "knowledge_base_article",
4483
- "brand_asset",
4484
- "document",
4485
- "documentation_template"
4486
- ],
4487
- // ── Operations & CS hierarchy ────────────────────────────────────────────────
4488
- service_blueprint: [
4489
- "user_flow",
4490
- "playbook",
4491
- "service_level_agreement",
4492
- "customer_health_score",
4493
- "support_ticket",
4494
- "customer_feedback"
4495
- ],
4496
- customer_health_score: ["nps_campaign", "success_milestone"],
4497
- customer_feedback: ["churn_reason"],
4498
- user_flow: ["screen", "customer_journey_stage"],
4499
- customer_journey_stage: ["touchpoint"],
4500
- // ── Legal, Compliance & Risk hierarchy ──────────────────────────────────────
4501
- legal_entity: ["ip_asset", "contract"],
4502
- contract: ["contract_clause"],
4503
- compliance_framework: [
4504
- "security_audit",
4505
- "compliance_requirement",
4506
- "privacy_policy",
4507
- "audit_log_policy",
4508
- "risk",
4509
- "data_contract",
4510
- "legal_entity"
4511
- ],
4512
- // ── DevOps & Platform hierarchy ──────────────────────────────────────────────
4513
- infrastructure_component: [
4514
- "service_level_objective",
4515
- "monitor",
4516
- "ci_pipeline",
4517
- "incident",
4518
- "runbook",
4519
- "release_strategy",
4520
- "on_call_rotation"
4521
- ],
4522
- service_level_objective: ["service_level_indicator", "error_budget"],
4523
- incident: ["postmortem"],
4524
- monitor: ["alert_rule"],
4525
- ci_pipeline: ["build_artifact"],
4526
- // ── Security hierarchy ───────────────────────────────────────────────────────
4527
- security_policy: [
4528
- "security_control",
4529
- "access_policy",
4530
- "data_classification",
4531
- "threat_model",
4532
- "security_review",
4533
- "incident"
4534
- ],
4535
- security_review: ["penetration_test"],
4536
- threat_model: ["threat", "vulnerability"],
4537
- // ── Sales & Revenue hierarchy ────────────────────────────────────────────────
4538
- pipeline_sales: ["pipeline_stage", "lead", "account", "forecast", "subscription"],
4539
- account: ["contact", "deal"],
4540
- deal: ["quote_document"],
4541
- subscription: ["invoice"],
4542
- // ── Program Management hierarchy ─────────────────────────────────────────────
4543
- program: ["project", "risk_register", "change_request", "resource_allocation", "status_report"],
4544
- project: ["milestone", "deliverable"],
4545
- risk_register: ["risk"],
4546
- // ── Accessibility hierarchy ──────────────────────────────────────────────────
4547
- a11y_standard: ["a11y_guideline", "a11y_audit", "a11y_annotation"],
4548
- a11y_audit: ["a11y_issue"],
4549
- // ── Product Specification expansion ─────────────────────────────────────────
4550
- roadmap: ["roadmap_item", "roadmap_theme", "release"],
4551
- roadmap_theme: ["feature"],
4552
- // ── Unified Context Layer hierarchy ─────────────────────────────────────────
4553
- design_system: [
4554
- "design_component",
4555
- "design_token",
4556
- "design_guideline",
4557
- "brand_identity",
4558
- "user_journey",
4559
- "user_flow",
4560
- "insight"
4561
- ],
4562
- screen: ["screen_state", "screen", "surface", "design_component", "wireframe"],
4563
- // self-nesting + surfaces + components + wireframes
4564
- // surface (0.27.0): the place inside a screen. Self-nests, so a shell holds
4565
- // panes, a pane holds regions, a region holds slots. A surface is reached
4566
- // through the screen that renders it (`screen: [... 'surface']`), never as a
4567
- // top-level product child: every UPG_VALID_CHILDREN pair must be backed by a
4568
- // hierarchy-classified edge (guardrail G2b), and the ratified ten do not
4569
- // include a product-to-surface verb. An app-shell surface therefore hangs off
4570
- // the screen that mounts it.
4571
- //
4572
- // NOTE: `surface_kind` narrows this further than UPG_VALID_CHILDREN can
4573
- // express. UPG_VALID_CHILDREN is keyed on entity TYPE, so it can only say
4574
- // "a surface may contain a surface"; the kind ordering (shell > tool > pane >
4575
- // region > slot / gutter / action_bar, with overlay and ambient parented by
4576
- // whatever raises them) is a property-level rule documented on `SurfaceKind`
4577
- // and enforced by validators, not by this table. Precedent: the same split
4578
- // applies to `planning_cycle`, whose `cadence_kind` narrows its self-nesting.
4579
- surface: ["surface", "design_component"],
4580
- // ── Marketing & Communications hierarchy ────────────────────────────────────
4581
- marketing_strategy: [
4582
- "marketing_channel",
4583
- "seo_keyword",
4584
- "press_release",
4585
- "event",
4586
- "community_initiative"
4587
- ],
4588
- marketing_channel: ["marketing_campaign_plan"],
4589
- marketing_campaign_plan: ["email_sequence", "social_post", "ad_creative"],
4590
- // ── Localisation & i18n hierarchy ───────────────────────────────────────────
4591
- locale: ["translation_bundle", "cultural_adaptation", "regional_pricing", "locale_config"],
4592
- translation_bundle: ["translation_key"],
4593
- // ── Customer Education & Training hierarchy ──────────────────────────────────
4594
- education_program: [
4595
- "tutorial",
4596
- "walkthrough",
4597
- "webinar",
4598
- "certification",
4599
- "help_video",
4600
- "learning_path"
4601
- ],
4602
- // a learning_path can include its terminal certification.
4603
- learning_path: ["tutorial", "certification"],
4604
- // ── Quality Assurance & Testing hierarchy ────────────────────────────────────
4605
- // (UPG-678) test_plan re-homed validation → QA. It is the QA planning layer:
4606
- // the verification approach (scope, environments, pass criteria) that the
4607
- // test suites execute. A test_plan groups the suites that carry it out.
4608
- test_plan: ["test_suite", "test_environment"],
4609
- test_suite: [
4610
- "test_case",
4611
- "regression_test",
4612
- "qa_session",
4613
- "test_coverage_report",
4614
- "test_environment",
4615
- "test_result"
4616
- ],
4617
- test_case: ["test_result"],
4618
- qa_session: ["bug"],
4619
- // ── Partner & Ecosystem Management hierarchy ─────────────────────────────────
4620
- partner_program: [
4621
- "partner_tier",
4622
- "integration_partner",
4623
- "partner_revenue_share",
4624
- "api_ecosystem",
4625
- "developer_portal"
4626
- ],
4627
- api_ecosystem: ["marketplace_listing"],
4628
- // ── Feedback & Voice of Customer hierarchy ───────────────────────────────────
4629
- feedback_program: [
4630
- "feature_request",
4631
- "nps_campaign",
4632
- "feedback_theme",
4633
- "user_advisory_board",
4634
- "beta_program"
4635
- ],
4636
- feature_request: ["feedback_vote"],
4637
- // v0.5.8 (UPG-528 Part 2d): CABs convene as quarterly ceremonies;
4638
- // CAB owns its meeting cadence (Stettler, Moore CAB playbook canon).
4639
- // Pairs with `user_advisory_board_convenes_as_ceremony` in the edge
4640
- // catalog. ceremony now has two valid hierarchy parents (team for sprint
4641
- // ceremonies, user_advisory_board for CAB meetings).
4642
- user_advisory_board: ["ceremony"],
4643
- // ── Pricing & Packaging hierarchy ────────────────────────────────────────────
4644
- pricing_strategy: [
4645
- "experiment_plan",
4646
- "pricing_tier",
4647
- "discount_strategy",
4648
- "trial_config",
4649
- "paywall"
4650
- ],
4651
- // ── AI/ML Operations hierarchy ───────────────────────────────────────────────
4652
- // (UPG-665) The prompt abstraction is corrected: ai_model → prompt_template →
4653
- // prompt_version (a model has templates; each template has versions). The
4654
- // model no longer owns prompt_version directly.
4655
- ai_model: [
4656
- "prompt_template",
4657
- "eval_benchmark",
4658
- "ai_cost_tracker",
4659
- "hallucination_report",
4660
- "ai_guardrail",
4661
- "model_comparison",
4662
- "ai_experiment",
4663
- "ai_dataset",
4664
- "ai_trace"
4665
- ],
4666
- // prompt_template owns its prompt_versions the way a file owns its commits.
4667
- prompt_template: ["prompt_version"],
4668
- // v0.5.7 (UPG-528 Part 2c): benchmarks define the metric set they measure
4669
- // (HELM, MLPerf, BIG-bench all spec a metric list). metric already has many
4670
- // hierarchy parents (outcome, objective, key_result, solution, data_source).
4671
- eval_benchmark: ["eval_run", "metric"],
4672
- // ai_trace spawns child traces for sub-calls (tool calls, chained
4673
- // prompts). Self-nesting enables call-tree representation.
4674
- ai_trace: ["ai_trace"],
4675
- // ── Agentic Workflows & Process hierarchy ────────────────────────────────────
4676
- workflow_template: ["workflow_run", "review_gate", "agent_task"],
4677
- workflow_run: ["workflow_artifact"],
4678
- agent_definition: ["agent_session", "agent_skill", "agent_hook", "workflow_template", "agent_task"],
4679
- // v0.5.8 (UPG-528 Part 2d): review gates also vet research insights
4680
- // (ResearchOps insight-review pattern). Pairs with `review_gate_vets_insight`
4681
- // in the edge catalog. The gate now owns two child types: approval records
4682
- // for workflow gates, insights for research-democratisation gates.
4683
- review_gate: ["approval_record", "insight"],
4684
- // ── Investigation hierarchy ──────────────────────────────────────────────────
4685
- investigation: ["symptom", "root_cause"],
4686
- root_cause: ["fix"],
4687
- // ── Portfolio layer hierarchy ────────────────────────────────────────────────
4688
- // organization → product_area is the org-axis anchor (who owns what);
4689
- // organization → portfolio is the strategic-axis anchor (where you invest).
4690
- // organization → workspace (WS3, 2026-07-05): org-altitude workspace anchor
4691
- // (organization_thinks_in_workspace) — a workspace scoped to org altitude
4692
- // lives in the same portfolio-level graph as its organization node.
4693
- organization: ["portfolio", "product_area", "workspace"],
4694
- // portfolios can nest (multi-level investment structures).
4695
- portfolio: ["product", "portfolio"],
4696
- // product_area is the organisational container for products and can
4697
- // nest (parent → sub-area). product_area also groups features; the
4698
- // "Studio area owns 6 features" mental model. product_area → workspace
4699
- // (WS3, 2026-07-05): plane-altitude workspace anchor
4700
- // (product_area_thinks_in_workspace) — "plane" is Entopo's app-level name
4701
- // for product_area, not a distinct spec entity.
4702
- product_area: ["product", "product_area", "feature", "workspace"]
4703
- };
4704
- function getValidChildren(entityType) {
4705
- return UPG_VALID_CHILDREN[entityType] ?? [];
4706
- }
4707
- function canBeChildOf(childType, parentType) {
4708
- return getValidChildren(parentType).includes(childType);
4709
- }
4710
- var UPG_CONTAINMENT_FREE_TYPES = /* @__PURE__ */ new Set([
4711
- "person",
4712
- // A framework_exercise has no structural parent: it anchors to the entities
4713
- // it scores via the `framework_exercise_includes_node` edge, not by
4714
- // containment. Modelling it as a product child would force a containment edge
4715
- // and read against the whole point of the exercise model (relational, not
4716
- // hierarchical). Same posture as `person`. See ADR 2026-06-02-framework-exercises.
4717
- "framework_exercise",
4718
- // A composition has no structural parent for the same reason a
4719
- // framework_exercise does not: it anchors to what it SHOWS, relationally, via
4720
- // `composition_focuses_node`. Modelling it as a product child would force a
4721
- // containment edge that reads against the point — a published view is not a
4722
- // part of the product, it is a lens onto one. This is also what keeps the
4723
- // type to two edges rather than three: no provenance edge is minted (that is
4724
- // `workspace_produced_node`, reused) and no parent edge is needed.
4725
- "composition",
4726
- // A capture has no structural parent for the same reason: it anchors to what
4727
- // it RENDERS, via `capture_renders_node`. Giving it a product parent would
4728
- // claim a capture is part of the product rather than a picture of one, and
4729
- // would mint a containment edge whose only job is to satisfy the hierarchy.
4730
- "capture"
4731
- ]);
4732
- function isContainmentFreeType(entityType) {
4733
- return UPG_CONTAINMENT_FREE_TYPES.has(entityType);
4734
- }
4735
-
4736
- // src/grammar/projection.ts
4737
- var VARIES_BY_EDGE = "surface_varies_by_configuration_axis";
4738
- var PRESENT_UNDER_PROPERTY = "present_under";
4739
- var ACTIVE_WHEN_PROPERTY = "active_when";
4740
- var QUALIFIABLE_EDGE_TYPES = [
4741
- "surface_contains_surface",
4742
- "feature_occupies_surface"
4743
- ];
4744
- function readStringArray(properties, key) {
4745
- const raw = properties?.[key];
4746
- if (!Array.isArray(raw)) return void 0;
4747
- return raw.filter((v) => typeof v === "string");
4748
- }
4749
- function readActiveWhen(edge) {
4750
- const raw = edge.properties?.[ACTIVE_WHEN_PROPERTY];
4751
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
4752
- const axis = raw.axis;
4753
- const values = readStringArray(raw, "values");
4754
- if (typeof axis !== "string" || axis.length === 0 || !values || values.length === 0) {
4755
- return void 0;
4756
- }
4757
- return { axis, values };
4758
- }
4759
- function projectGraph(nodes, edges, configuration) {
4760
- const axes = Object.keys(configuration);
4761
- if (axes.length === 0) {
4762
- return {
4763
- nodes: [...nodes],
4764
- edges: [...edges],
4765
- excluded_node_ids: [],
4766
- deactivated_edge_count: 0,
4767
- dangling_edge_count: 0
4768
- };
4769
- }
4770
- const excluded = /* @__PURE__ */ new Set();
4771
- for (const edge of edges) {
4772
- if (edge.type !== VARIES_BY_EDGE) continue;
4773
- const chosen = configuration[edge.target];
4774
- if (chosen === void 0) continue;
4775
- const presentUnder = readStringArray(edge.properties, PRESENT_UNDER_PROPERTY);
4776
- if (!presentUnder) continue;
4777
- if (!presentUnder.includes(chosen)) excluded.add(edge.source);
4778
- }
4779
- const survivingNodes = excluded.size === 0 ? [...nodes] : nodes.filter((n) => !excluded.has(n.id));
4780
- let deactivated = 0;
4781
- let dangling = 0;
4782
- const survivingEdges = [];
4783
- for (const edge of edges) {
4784
- const qualifier = readActiveWhen(edge);
4785
- if (qualifier) {
4786
- const chosen = configuration[qualifier.axis];
4787
- if (chosen !== void 0 && !qualifier.values.includes(chosen)) {
4788
- deactivated++;
4789
- continue;
4790
- }
4791
- }
4792
- if (excluded.has(edge.source) || excluded.has(edge.target)) {
4793
- dangling++;
4794
- continue;
4795
- }
4796
- survivingEdges.push(edge);
4797
- }
4798
- return {
4799
- nodes: survivingNodes,
4800
- edges: survivingEdges,
4801
- excluded_node_ids: [...excluded].sort(),
4802
- deactivated_edge_count: deactivated,
4803
- dangling_edge_count: dangling
4804
- };
4805
- }
4806
- function enumerateProjections(nodes) {
4807
- const out = [
4808
- { configuration: {} }
4809
- ];
4810
- for (const node of nodes) {
4811
- if (node.type !== "configuration_axis") continue;
4812
- const values = readStringArray(node.properties, "values");
4813
- if (!values) continue;
4814
- for (const value of values) {
4815
- out.push({ axis: node.id, value, configuration: { [node.id]: value } });
4816
- }
4817
- }
4818
- return out;
4819
- }
4820
-
4821
- // src/grammar/configuration-drift.ts
4822
- var ALTERNATES_EDGE = "surface_alternates_with_surface";
4823
- var PARENT_EDGE_TYPES = /* @__PURE__ */ new Set(["surface_contains_surface", "screen_renders_surface"]);
4824
- function edgeLabel(edge) {
4825
- return edge.id ?? `${edge.source} -> ${edge.target}`;
4826
- }
4827
- function checkConfigurationDrift(nodes, edges) {
4828
- const findings = [];
4829
- const axisValues = /* @__PURE__ */ new Map();
4830
- for (const node of nodes) {
4831
- if (node.type !== "configuration_axis") continue;
4832
- const values = readStringArray(node.properties, "values");
4833
- if (!values || values.length === 0) {
4834
- findings.push({
4835
- kind: "axis_values_empty",
4836
- severity: "error",
4837
- node_id: node.id,
4838
- axis_id: node.id,
4839
- message: "Configuration axis declares no values. An axis with no values selects nothing, so no projection can be taken along it."
4840
- });
4841
- axisValues.set(node.id, []);
4842
- continue;
4843
- }
4844
- axisValues.set(node.id, values);
4845
- const rawDefault = node.properties?.default_value;
4846
- if (typeof rawDefault === "string" && rawDefault.length > 0 && !values.includes(rawDefault)) {
4847
- findings.push({
4848
- kind: "axis_default_not_a_value",
4849
- severity: "error",
4850
- node_id: node.id,
4851
- axis_id: node.id,
4852
- message: `default_value "${rawDefault}" is not one of the axis values [${values.join(", ")}]. It names a value of this axis, so it has to be one the axis declares.`
4853
- });
4854
- }
4855
- }
4856
- for (const edge of edges) {
4857
- if (edge.type !== VARIES_BY_EDGE) continue;
4858
- const values = axisValues.get(edge.target);
4859
- const presentUnder = readStringArray(edge.properties, PRESENT_UNDER_PROPERTY);
4860
- if (!presentUnder || presentUnder.length === 0) {
4861
- findings.push({
4862
- kind: "present_under_empty",
4863
- severity: "error",
4864
- edge_id: edge.id,
4865
- node_id: edge.source,
4866
- axis_id: edge.target,
4867
- message: `${edgeLabel(edge)} declares variance without a non-empty present_under. A surface that exists under no configuration should be deleted rather than declared; a surface that exists under all of them should carry no varies_by edge at all.`
4868
- });
4869
- continue;
4870
- }
4871
- if (!values) continue;
4872
- for (const value of presentUnder) {
4873
- if (!values.includes(value)) {
4874
- findings.push({
4875
- kind: "present_under_unknown_value",
4876
- severity: "error",
4877
- edge_id: edge.id,
4878
- node_id: edge.source,
4879
- axis_id: edge.target,
4880
- message: `present_under names "${value}", which the axis does not declare. Its values are [${values.join(", ")}].`
4881
- });
4882
- }
4883
- }
4884
- }
4885
- for (const edge of edges) {
4886
- const hasQualifierKey = edge.properties !== void 0 && Object.prototype.hasOwnProperty.call(edge.properties, ACTIVE_WHEN_PROPERTY);
4887
- if (!hasQualifierKey) continue;
4888
- if (edge.type !== void 0 && !QUALIFIABLE_EDGE_TYPES.includes(edge.type)) {
4889
- findings.push({
4890
- kind: "qualifier_on_illegal_edge",
4891
- severity: "error",
4892
- edge_id: edge.id,
4893
- message: `active_when is not legal on ${edge.type}. The qualifier is scoped to [${QUALIFIABLE_EDGE_TYPES.join(", ")}] deliberately: conditional composition is the question this release answers, and a general modality system is not.`
4894
- });
4895
- continue;
4896
- }
4897
- const qualifier = readActiveWhen(edge);
4898
- if (!qualifier) {
4899
- const rawQualifier = edge.properties?.[ACTIVE_WHEN_PROPERTY];
4900
- const rawValues = rawQualifier && typeof rawQualifier === "object" && !Array.isArray(rawQualifier) ? rawQualifier.values : void 0;
4901
- if (Array.isArray(rawValues) && rawValues.length === 0) {
4902
- findings.push({
4903
- kind: "qualifier_values_empty",
4904
- severity: "error",
4905
- edge_id: edge.id,
4906
- message: `${edgeLabel(edge)} carries an active_when with an empty values list. Read literally that would remove the relationship from every configuration, which is a way to delete an edge by writing a property; it is treated as absent instead. To say a relationship never holds, delete the edge.`
4907
- });
4908
- continue;
4909
- }
4910
- findings.push({
4911
- kind: "qualifier_axis_unresolved",
4912
- severity: "error",
4913
- edge_id: edge.id,
4914
- message: `${edgeLabel(edge)} carries a malformed active_when. It must be an object with an axis id and a non-empty values array; anything else reads as absent, which silently makes the relationship invariant.`
4915
- });
4916
- continue;
4917
- }
4918
- const values = axisValues.get(qualifier.axis);
4919
- if (!values) {
4920
- findings.push({
4921
- kind: "qualifier_axis_unresolved",
4922
- severity: "error",
4923
- edge_id: edge.id,
4924
- axis_id: qualifier.axis,
4925
- message: `active_when names axis "${qualifier.axis}", which is not a configuration_axis node in this graph.`
4926
- });
4927
- continue;
4928
- }
4929
- for (const value of qualifier.values) {
4930
- if (!values.includes(value)) {
4931
- findings.push({
4932
- kind: "qualifier_unknown_value",
4933
- severity: "error",
4934
- edge_id: edge.id,
4935
- axis_id: qualifier.axis,
4936
- message: `active_when names value "${value}", which axis "${qualifier.axis}" does not declare. Its values are [${values.join(", ")}].`
4937
- });
4938
- }
4939
- }
4940
- }
4941
- const varianceBySource = /* @__PURE__ */ new Map();
4942
- for (const edge of edges) {
4943
- if (edge.type !== VARIES_BY_EDGE) continue;
4944
- const values = readStringArray(edge.properties, PRESENT_UNDER_PROPERTY) ?? [];
4945
- const list = varianceBySource.get(edge.source) ?? [];
4946
- list.push({ axis: edge.target, values });
4947
- varianceBySource.set(edge.source, list);
4948
- }
4949
- for (const edge of edges) {
4950
- if (edge.type !== ALTERNATES_EDGE) continue;
4951
- const left = varianceBySource.get(edge.source) ?? [];
4952
- const right = varianceBySource.get(edge.target) ?? [];
4953
- if (left.length === 0 || right.length === 0) {
4954
- findings.push({
4955
- kind: "alternation_axis_mismatch",
4956
- severity: "error",
4957
- edge_id: edge.id,
4958
- message: `${edgeLabel(edge)} declares an alternation, but at least one endpoint declares no variance at all. Two surfaces that are both always present are not alternatives; they co-exist.`
4959
- });
4960
- continue;
4961
- }
4962
- const sharedAxes = left.filter((l) => right.some((r) => r.axis === l.axis)).map((l) => l.axis);
4963
- if (sharedAxes.length === 0) {
4964
- findings.push({
4965
- kind: "alternation_axis_mismatch",
4966
- severity: "error",
4967
- edge_id: edge.id,
4968
- message: `${edgeLabel(edge)} declares an alternation between surfaces that vary on different axes. Alternatives are selected by ONE lever; surfaces on different levers can both be present at once.`
4969
- });
4970
- continue;
4971
- }
4972
- for (const axis of sharedAxes) {
4973
- const leftValues = left.find((l) => l.axis === axis)?.values ?? [];
4974
- const rightValues = right.find((r) => r.axis === axis)?.values ?? [];
4975
- const overlap = leftValues.filter((v) => rightValues.includes(v));
4976
- if (overlap.length > 0) {
4977
- findings.push({
4978
- kind: "alternation_overlap",
4979
- severity: "error",
4980
- edge_id: edge.id,
4981
- axis_id: axis,
4982
- message: `${edgeLabel(edge)} declares an alternation, but both surfaces are present under [${overlap.join(", ")}] on axis "${axis}". They co-exist there, so the graph is asserting "one of these" and "both, together" about the same pair.`
4983
- });
4984
- }
4985
- }
4986
- }
4987
- const parentsByChild = /* @__PURE__ */ new Map();
4988
- for (const edge of edges) {
4989
- if (edge.type && PARENT_EDGE_TYPES.has(edge.type)) {
4990
- parentsByChild.set(edge.target, (parentsByChild.get(edge.target) ?? 0) + 1);
4991
- }
4992
- }
4993
- for (const [axisId, values] of axisValues) {
4994
- for (const value of values) {
4995
- const projected = projectGraph(nodes, edges, { [axisId]: value });
4996
- const survivingParents = /* @__PURE__ */ new Map();
4997
- for (const edge of projected.edges) {
4998
- if (edge.type && PARENT_EDGE_TYPES.has(edge.type)) {
4999
- survivingParents.set(edge.target, (survivingParents.get(edge.target) ?? 0) + 1);
5000
- }
5001
- }
5002
- for (const node of projected.nodes) {
5003
- if (node.type !== "surface") continue;
5004
- if ((parentsByChild.get(node.id) ?? 0) === 0) continue;
5005
- if ((survivingParents.get(node.id) ?? 0) > 0) continue;
5006
- findings.push({
5007
- kind: "orphaned_under_projection",
5008
- severity: "warning",
5009
- node_id: node.id,
5010
- axis_id: axisId,
5011
- message: `Surface is present under ${axisId} = "${value}" but every containment parent it has is absent there. Either it needs a parent in that configuration, or it should declare that it is absent from it too.`
5012
- });
5013
- }
5014
- }
5015
- }
5016
- return findings;
5017
- }
5018
-
5019
- // src/grammar/lifecycles.ts
5020
- var PRODUCT_LIFECYCLE = {
5021
- entity_type: "product",
5022
- initial_phase: "concept",
5023
- terminal_phases: ["sunset"],
5024
- phases: [
5025
- {
5026
- id: "concept",
5027
- status_category: "triage",
5028
- label: "Concept",
5029
- description: "Napkin idea. Problem shape and solution sketch, pre-validation.",
5030
- transitions_to: ["validation", "build", "beta", "launch", "growth", "mature", "sunset"]
5031
- },
5032
- {
5033
- id: "validation",
5034
- status_category: "started",
5035
- label: "Validation",
5036
- description: "Testing demand. User conversations and experiments pressure-test assumptions before build commits.",
5037
- transitions_to: ["build", "beta", "launch", "growth", "mature", "sunset"]
5038
- },
5039
- {
5040
- id: "build",
5041
- status_category: "started",
5042
- label: "Build",
5043
- description: "Actively developing v1. Core functionality is being authored, pre-user.",
5044
- transitions_to: ["beta", "launch", "growth", "mature", "sunset"]
5045
- },
5046
- {
5047
- id: "beta",
5048
- status_category: "started",
5049
- label: "Beta",
5050
- description: "Early users, iterating. Feature-complete enough to learn from, still changing weekly.",
5051
- transitions_to: ["launch", "growth", "mature", "maintenance", "sunset"]
5052
- },
5053
- {
5054
- id: "launch",
5055
- status_category: "started",
5056
- label: "Launch",
5057
- description: "Generally available. Announced to the target audience, open past beta access.",
5058
- transitions_to: ["growth", "mature", "maintenance", "sunset"]
5059
- },
5060
- {
5061
- id: "growth",
5062
- status_category: "started",
5063
- label: "Growth",
5064
- description: "Scaling users and revenue. Product fit validated; focus is acquisition, retention, expansion.",
5065
- transitions_to: ["mature", "maintenance", "sunset"]
5066
- },
5067
- {
5068
- id: "mature",
5069
- status_category: "started",
5070
- label: "Mature",
5071
- description: "Stable. Growth levelled; investment weights toward optimisation, efficiency, and durability.",
5072
- transitions_to: ["maintenance", "sunset"]
5073
- },
5074
- {
5075
- id: "maintenance",
5076
- status_category: "started",
5077
- label: "Maintenance",
5078
- description: "Sustaining. Minimal investment keeps the product running for existing users. Can transition back to `mature` on a strategic revival.",
5079
- transitions_to: ["mature", "sunset"]
5080
- },
5081
- {
5082
- id: "sunset",
5083
- status_category: "completed",
5084
- label: "Sunset",
5085
- description: "Winding down or retired. Existing users are being migrated or offboarded.",
5086
- transitions_to: []
5087
- }
5088
- ]
5089
- };
5090
- var NEED_LIFECYCLE = {
5091
- entity_type: "need",
5092
- initial_phase: "raw",
5093
- terminal_phases: ["prioritized"],
5094
- phases: [
5095
- {
5096
- id: "raw",
5097
- status_category: "triage",
5098
- label: "Raw",
5099
- description: "Captured from an interview, observation, or support ticket. Articulation may be rough; may duplicate an existing need.",
5100
- transitions_to: ["validated"]
5101
- },
5102
- {
5103
- id: "validated",
5104
- status_category: "started",
5105
- label: "Validated",
5106
- description: "Corroborated by multiple data points or targeted research. The team agrees it is a real, recurring need.",
5107
- transitions_to: ["prioritized"]
5108
- },
5109
- {
5110
- id: "prioritized",
5111
- status_category: "completed",
5112
- label: "Prioritized",
5113
- description: "Ranked against other needs. Ready to inform opportunity definition and solution exploration.",
5114
- transitions_to: []
4072
+ var NEED_LIFECYCLE = {
4073
+ entity_type: "need",
4074
+ initial_phase: "raw",
4075
+ terminal_phases: ["prioritized"],
4076
+ phases: [
4077
+ {
4078
+ id: "raw",
4079
+ status_category: "triage",
4080
+ label: "Raw",
4081
+ description: "Captured from an interview, observation, or support ticket. Articulation may be rough; may duplicate an existing need.",
4082
+ transitions_to: ["validated"]
4083
+ },
4084
+ {
4085
+ id: "validated",
4086
+ status_category: "started",
4087
+ label: "Validated",
4088
+ description: "Corroborated by multiple data points or targeted research. The team agrees it is a real, recurring need.",
4089
+ transitions_to: ["prioritized"]
4090
+ },
4091
+ {
4092
+ id: "prioritized",
4093
+ status_category: "completed",
4094
+ label: "Prioritized",
4095
+ description: "Ranked against other needs. Ready to inform opportunity definition and solution exploration.",
4096
+ transitions_to: []
5115
4097
  }
5116
4098
  ]
5117
4099
  };
@@ -7181,367 +6163,1528 @@ var SPECIFICATION_LIFECYCLE = {
7181
6163
  description: "Replaced by a newer specification. Retained for historical reference.",
7182
6164
  transitions_to: []
7183
6165
  }
7184
- ]
7185
- };
7186
- var PLANNING_CYCLE_LIFECYCLE = {
7187
- entity_type: "planning_cycle",
7188
- initial_phase: "planned",
7189
- terminal_phases: ["closed"],
7190
- phases: [
7191
- { id: "planned", status_category: "unstarted", label: "Planned", description: "The cycle is being shaped: dates set, goal written, work scheduled into it. It has not started yet.", transitions_to: ["active"] },
7192
- { id: "active", status_category: "started", label: "Active", description: "The team is inside the interval; work is flowing through it.", transitions_to: ["closed"] },
7193
- { id: "closed", status_category: "completed", label: "Closed", description: "The interval has ended. Scheduled work has shipped, carried over, or been dropped. May reopen if the team extends or reruns it.", transitions_to: ["active"] }
7194
- ]
6166
+ ]
6167
+ };
6168
+ var PLANNING_CYCLE_LIFECYCLE = {
6169
+ entity_type: "planning_cycle",
6170
+ initial_phase: "planned",
6171
+ terminal_phases: ["closed"],
6172
+ phases: [
6173
+ { id: "planned", status_category: "unstarted", label: "Planned", description: "The cycle is being shaped: dates set, goal written, work scheduled into it. It has not started yet.", transitions_to: ["active"] },
6174
+ { id: "active", status_category: "started", label: "Active", description: "The team is inside the interval; work is flowing through it.", transitions_to: ["closed"] },
6175
+ { id: "closed", status_category: "completed", label: "Closed", description: "The interval has ended. Scheduled work has shipped, carried over, or been dropped. May reopen if the team extends or reruns it.", transitions_to: ["active"] }
6176
+ ]
6177
+ };
6178
+ var UPG_LIFECYCLES = [
6179
+ // Product (root)
6180
+ PRODUCT_LIFECYCLE,
6181
+ // Foundations (0.9.12)
6182
+ SPECIFICATION_LIFECYCLE,
6183
+ // Discovery & Validation
6184
+ NEED_LIFECYCLE,
6185
+ OPPORTUNITY_LIFECYCLE,
6186
+ SOLUTION_LIFECYCLE,
6187
+ EXPERIMENT_PLAN_LIFECYCLE,
6188
+ RESEARCH_PLAN_LIFECYCLE,
6189
+ FEEDBACK_PROGRAM_LIFECYCLE,
6190
+ FEATURE_REQUEST_LIFECYCLE,
6191
+ BETA_PROGRAM_LIFECYCLE,
6192
+ USER_ADVISORY_BOARD_LIFECYCLE,
6193
+ // Strategy & Product Specification
6194
+ OUTCOME_LIFECYCLE,
6195
+ VISION_LIFECYCLE,
6196
+ MISSION_LIFECYCLE,
6197
+ CAPABILITY_LIFECYCLE,
6198
+ OBJECTIVE_LIFECYCLE,
6199
+ KEY_RESULT_LIFECYCLE,
6200
+ STRATEGIC_THEME_LIFECYCLE,
6201
+ INITIATIVE_LIFECYCLE,
6202
+ STRATEGIC_PILLAR_LIFECYCLE,
6203
+ STRATEGIC_QUESTION_LIFECYCLE,
6204
+ FEATURE_AREA_LIFECYCLE,
6205
+ FEATURE_LIFECYCLE,
6206
+ // user_story is lifecycle-free (declared in UPG_LIFECYCLE_FREE_TYPES below).
6207
+ // story_task lifecycle removed v0.4.0; collapsed into task. task + epic are
6208
+ // now WORK_ITEM-template-derived (UPG-690, 0.21.0) — see TEMPLATE_LIFECYCLES.
6209
+ RELEASE_LIFECYCLE,
6210
+ ROADMAP_ITEM_LIFECYCLE,
6211
+ PLANNING_CYCLE_LIFECYCLE,
6212
+ IP_ASSET_LIFECYCLE,
6213
+ CONTRACT_LIFECYCLE,
6214
+ DESIGN_CONCEPT_LIFECYCLE,
6215
+ BRAND_IDENTITY_LIFECYCLE,
6216
+ SCREEN_LIFECYCLE,
6217
+ SURFACE_LIFECYCLE,
6218
+ // Engineering & Operations
6219
+ SERVICE_LIFECYCLE,
6220
+ DEPLOYMENT_LIFECYCLE,
6221
+ FEATURE_FLAG_LIFECYCLE,
6222
+ INVESTIGATION_LIFECYCLE,
6223
+ EXTERNAL_API_LIFECYCLE,
6224
+ DATABASE_SCHEMA_LIFECYCLE,
6225
+ INCIDENT_LIFECYCLE,
6226
+ SECURITY_CONTROL_LIFECYCLE,
6227
+ DATA_PIPELINE_LIFECYCLE,
6228
+ AI_MODEL_LIFECYCLE,
6229
+ WORKFLOW_RUN_LIFECYCLE,
6230
+ AGENT_DEFINITION_LIFECYCLE,
6231
+ AGENT_SESSION_LIFECYCLE,
6232
+ REVIEW_GATE_LIFECYCLE,
6233
+ TEST_SUITE_LIFECYCLE,
6234
+ TEST_CASE_LIFECYCLE,
6235
+ // ── Phase B hand-authored ─────────────────────────────────────────
6236
+ // Research + Validation
6237
+ INSIGHT_LIFECYCLE,
6238
+ RESEARCH_QUESTION_LIFECYCLE,
6239
+ INTERVIEW_GUIDE_LIFECYCLE,
6240
+ TEST_PLAN_LIFECYCLE,
6241
+ // AI workflow
6242
+ AI_DATASET_LIFECYCLE,
6243
+ AI_GUARDRAIL_LIFECYCLE,
6244
+ MODEL_COMPARISON_LIFECYCLE,
6245
+ PROMPT_VERSION_LIFECYCLE,
6246
+ EVAL_BENCHMARK_LIFECYCLE,
6247
+ // Business Model
6248
+ BUSINESS_MODEL_LIFECYCLE,
6249
+ REVENUE_STREAM_LIFECYCLE,
6250
+ // Customer Success
6251
+ CUSTOMER_HEALTH_SCORE_LIFECYCLE,
6252
+ PLAYBOOK_LIFECYCLE,
6253
+ // Team & Organisation
6254
+ TEAM_OKR_LIFECYCLE,
6255
+ RETROSPECTIVE_LIFECYCLE,
6256
+ DEPENDENCY_LIFECYCLE,
6257
+ ROLE_LIFECYCLE,
6258
+ CAPACITY_PLAN_LIFECYCLE,
6259
+ // Product & Growth
6260
+ VARIANT_LIFECYCLE,
6261
+ GROWTH_CAMPAIGN_LIFECYCLE,
6262
+ // Workspace
6263
+ FRAMEWORK_EXERCISE_LIFECYCLE,
6264
+ COMPOSITION_LIFECYCLE,
6265
+ // ── Template-generated lifecycles ─────────────────────────────────
6266
+ ...TEMPLATE_LIFECYCLES
6267
+ ];
6268
+ function getLifecycleForType(entityType) {
6269
+ return UPG_LIFECYCLES.find((l) => l.entity_type === entityType);
6270
+ }
6271
+ var UPG_LIFECYCLE_FREE_TYPES = /* @__PURE__ */ new Set([
6272
+ // ── Foundations (3 of 4): a primitive either exists or is deprecated; no
6273
+ // phase ladder (like metric). `operating_lifecycle`/`operating_stage` are
6274
+ // static ordered reference data (the loop is a `cyclic` flag, not a state
6275
+ // machine). `specification` carries a lifecycle. ──
6276
+ "primitive",
6277
+ "operating_lifecycle",
6278
+ "operating_stage",
6279
+ // ── User (5): personas and JTBD atoms are reference data ──────────────────
6280
+ "persona",
6281
+ "job",
6282
+ "job_step",
6283
+ "desired_outcome",
6284
+ "switching_cost",
6285
+ // ── Market Intelligence (7 of 8): competitor landscape is reference data;
6286
+ // competitor_signal is an append-only dated event (no phase ladder);
6287
+ // competitive_analysis shipped PUBLISHING lifecycle in Phase C;
6288
+ // classification_axis and classification_value are reference taxonomy
6289
+ // atoms with no state machine. ─
6290
+ "competitor",
6291
+ "competitor_feature",
6292
+ "competitor_signal",
6293
+ "market_trend",
6294
+ "market_segment",
6295
+ "classification_axis",
6296
+ "classification_value",
6297
+ // ── Product Specification (1): a configuration_axis is a structural
6298
+ // DECLARATION (a lever and its closed value set), not a thing that
6299
+ // progresses through states. Same reading as classification_axis above.
6300
+ "configuration_axis",
6301
+ // ── User Research (5 of 8): participants, quotes, observations,
6302
+ // clusters, survey responses are immutable data points ────────────────
6303
+ "participant",
6304
+ "observation",
6305
+ "quote",
6306
+ "affinity_cluster",
6307
+ "survey_response",
6308
+ // ── UX Design (3 of 8): journey structural atoms ──────────────────────────
6309
+ "journey_step",
6310
+ "journey_phase",
6311
+ "journey_action",
6312
+ "screen_state",
6313
+ // ── Design System (3 of 7): tokens and annotations are atomic values ────
6314
+ "design_token",
6315
+ "annotation",
6316
+ // ── Brand (4 of 6): colour/typography/imagery/voice are reference atoms ──
6317
+ "brand_colour",
6318
+ "brand_typography",
6319
+ "brand_imagery",
6320
+ // ── Product Specification (4 of 5): criteria, grouping, historical, +
6321
+ // user_story (the templated promise is a stable design artefact; the paired
6322
+ // task carries the lifecycle). Re-canon story_statement → user_story at
6323
+ // v0.7.0/UPG-571. ─
6324
+ "acceptance_criterion",
6325
+ "changelog",
6326
+ "roadmap_theme",
6327
+ "user_story",
6328
+ // ── Strategy: metric is a measurement definition; metric_quality_assessment
6329
+ // is a point-in-time snapshot; value_stream is a mapped flow;
6330
+ // constraint carries its own `constraint_status` enum (binding/advisory/
6331
+ // lifted) as a property; base-node `status` not used.
6332
+ // vision/mission/capability/outcome get lifecycles in Phase B or C ─────
6333
+ "metric",
6334
+ "metric_quality_assessment",
6335
+ "value_stream",
6336
+ "constraint",
6337
+ // ── Engineering (15 of 17): DDD modelling primitives + infra references.
6338
+ // root_cause / symptom / fix are investigation findings, not workflows
6339
+ // (investigation itself has a lifecycle) ────────────────────────────────
6340
+ "aggregate",
6341
+ "domain_entity",
6342
+ "value_object",
6343
+ "command",
6344
+ "read_model",
6345
+ "domain_event",
6346
+ "bounded_context",
6347
+ "api_endpoint",
6348
+ "queue_topic",
6349
+ "build_artifact",
6350
+ "code_repository",
6351
+ "library_dependency",
6352
+ "integration_pattern",
6353
+ "data_flow",
6354
+ "root_cause",
6355
+ "symptom",
6356
+ "fix",
6357
+ // ── Business Model (6 of 9): BMC cells are structural frames ────────────
6358
+ "cost_structure",
6359
+ "unit_economics",
6360
+ "key_resource",
6361
+ "key_activity",
6362
+ "customer_relationship",
6363
+ "distribution_channel",
6364
+ // ── Go-To-Market (8 of 13): positioning/ICP/territory/sales_motion are
6365
+ // configuration; objection/rebuttal/proof_point are catalog entries ───
6366
+ "ideal_customer_profile",
6367
+ "positioning",
6368
+ "sales_motion",
6369
+ "territory",
6370
+ "objection",
6371
+ "rebuttal",
6372
+ "proof_point",
6373
+ // ── Team & Organisation (7 of 11): org structural atoms ───────────────────
6374
+ "team",
6375
+ "stakeholder",
6376
+ "person",
6377
+ "department",
6378
+ "skill",
6379
+ "ceremony",
6380
+ // ── Data & Analytics (4 of 10): lineage and domain containers, plus
6381
+ // atomic definitions ────────────────────────────────────────────────────
6382
+ "data_lineage",
6383
+ "data_domain",
6384
+ "data_quality_rule",
6385
+ // ── AI (3 of 10): traces and cost trackers are append-only; model
6386
+ // comparison snapshots are immutable ───────────────────────────────────
6387
+ "ai_cost_tracker",
6388
+ "ai_trace",
6389
+ // ── Automation (2 of 6): approvals and artifacts are ledger entries ──────
6390
+ "approval_record",
6391
+ "workflow_artifact",
6392
+ // ── Growth (7 of 9): funnels and attribution are structural definitions;
6393
+ // cohorts/segments are computed snapshots ────────────────────────────
6394
+ "funnel",
6395
+ "funnel_step",
6396
+ "acquisition_channel",
6397
+ "cohort",
6398
+ "behavioral_segment",
6399
+ "growth_loop",
6400
+ "attribution_model",
6401
+ // ── Sales (5 of 6): pipeline structure + accounts/contacts + forecast
6402
+ // snapshots. Only `deal` has a lifecycle (Phase B SALES_DEAL template) ─
6403
+ "account",
6404
+ "contact",
6405
+ "pipeline_sales",
6406
+ "pipeline_stage",
6407
+ "forecast",
6408
+ // ── Customer Success (5 of 9): journey structure + derived values ────────
6409
+ "customer_journey_stage",
6410
+ "touchpoint",
6411
+ "churn_reason",
6412
+ "service_level_agreement",
6413
+ // ── DevOps (5 of 10): indicators and budgets are measurement references;
6414
+ // strategies and pipelines are configuration ──────────────────────────
6415
+ "service_level_indicator",
6416
+ "service_level_objective",
6417
+ "error_budget",
6418
+ "ci_pipeline",
6419
+ "release_strategy",
6420
+ // ── Security (1 of 5): data classification is a reference label ──────────
6421
+ "data_classification",
6422
+ // ── Accessibility (2 of 4): standards and annotations ─────────────────────
6423
+ "a11y_standard",
6424
+ "a11y_annotation",
6425
+ // ── Testing (3 of 5): regression tests are reference definitions; test
6426
+ // results and coverage reports are immutable records ───────────────────
6427
+ "regression_test",
6428
+ "test_coverage_report",
6429
+ "test_result",
6430
+ // ── Customer Feedback (2 of 3): themes and votes are atomic data points ──
6431
+ "feedback_theme",
6432
+ "feedback_vote",
6433
+ // ── Pricing (2 of 4): trial and paywall are configuration ─────────────────
6434
+ "trial_config",
6435
+ "paywall",
6436
+ // ── Content (2 of 5): calendars and themes are planning configuration ────
6437
+ "content_calendar",
6438
+ "content_theme",
6439
+ // ── Legal (2 of 3): legal_entity is an org; contract_clause is an atom
6440
+ // of a contract (which has its own lifecycle) ───────────────────────────
6441
+ "legal_entity",
6442
+ "contract_clause",
6443
+ // ── Portfolio (3 of 3): structural containers ─────────────────────────────
6444
+ "organization",
6445
+ "portfolio",
6446
+ "product_area",
6447
+ // ── Program Management (2 of 3): allocations and registers are tracking
6448
+ // containers ────────────────────────────────────────────────────────────
6449
+ "resource_allocation",
6450
+ "risk_register",
6451
+ // ── Localisation (4 of 5): translation keys, configs, and regional
6452
+ // adaptations are reference data ────────────────────────────────────────
6453
+ "translation_key",
6454
+ "locale_config",
6455
+ "cultural_adaptation",
6456
+ "regional_pricing",
6457
+ // ── Marketing (1 of 4): SEO keywords are tracked reference terms ─────────
6458
+ "seo_keyword",
6459
+ // ── Ecosystem (2 of 2): partner tiers and rev-share terms are config ─────
6460
+ "partner_tier",
6461
+ "partner_revenue_share",
6462
+ // ── Validation (2 of 4): evidence + learning are data points captured
6463
+ // from experiment_runs (which have lifecycles); hypothesis_evidence was
6464
+ // lifecycle-free here but is deprecated at v0.4.0 ──────────────────────────────────────
6465
+ "evidence",
6466
+ "learning",
6467
+ // ── Workspace (1 of 4): a capture is a fact about a moment, not a workflow.
6468
+ // It is taken, and from then on it either still matches its subject or it
6469
+ // does not — which is what `content_hash` answers, not a phase. ─────────
6470
+ "capture"
6471
+ ]);
6472
+ function isLifecycleFreeType(entityType) {
6473
+ return UPG_LIFECYCLE_FREE_TYPES.has(entityType);
6474
+ }
6475
+ var UPG_LIFECYCLE_PLANNED_TYPES = /* @__PURE__ */ new Set([
6476
+ // Phase B cleared this set entirely. Every type that was triaged
6477
+ // into Phase B/C/D under now either has a lifecycle in
6478
+ // `UPG_LIFECYCLES` or is documented as lifecycle-free in
6479
+ // `UPG_LIFECYCLE_FREE_TYPES`.
6480
+ //
6481
+ // Reintroduce entries here when a new entity type is added to the spec
6482
+ // and decided to be lifecycle-bearing but its phases have not yet been
6483
+ // designed. The `10-lifecycle-coverage` audit will surface uncovered
6484
+ // active types until they're either implemented or moved to the
6485
+ // free-types set.
6486
+ ]);
6487
+ function isLifecyclePlannedType(entityType) {
6488
+ return UPG_LIFECYCLE_PLANNED_TYPES.has(entityType);
6489
+ }
6490
+ function getLifecycleRenderShape(entityType) {
6491
+ const lifecycle = getLifecycleForType(entityType);
6492
+ if (!lifecycle) return null;
6493
+ const terminalSet = new Set(lifecycle.terminal_phases);
6494
+ const phaseIndex = new Map(lifecycle.phases.map((p, i) => [p.id, i]));
6495
+ const states = lifecycle.phases.map((phase) => ({
6496
+ id: phase.id,
6497
+ label: phase.label,
6498
+ description: phase.description,
6499
+ terminal: terminalSet.has(phase.id)
6500
+ }));
6501
+ const transitions = [];
6502
+ for (const phase of lifecycle.phases) {
6503
+ const fromTerminal = terminalSet.has(phase.id);
6504
+ for (const to of phase.transitions_to) {
6505
+ const toTerminal = terminalSet.has(to);
6506
+ let kind;
6507
+ if (fromTerminal && !toTerminal) {
6508
+ kind = "reopen";
6509
+ } else if (toTerminal && !fromTerminal) {
6510
+ kind = "terminal";
6511
+ } else {
6512
+ const fromIdx = phaseIndex.get(phase.id) ?? 0;
6513
+ const toIdx = phaseIndex.get(to) ?? 0;
6514
+ kind = toIdx < fromIdx ? "backward" : "forward";
6515
+ }
6516
+ transitions.push({ from: phase.id, to, kind });
6517
+ }
6518
+ }
6519
+ return {
6520
+ entity_type: lifecycle.entity_type,
6521
+ ...lifecycle.template_id !== void 0 && { template_id: lifecycle.template_id },
6522
+ states,
6523
+ transitions,
6524
+ initial_state: lifecycle.initial_phase
6525
+ };
6526
+ }
6527
+
6528
+ // src/catalog/legacy-product-stages.ts
6529
+ var LEGACY_PRODUCT_STAGES = Object.freeze({
6530
+ idea: "concept"
6531
+ });
6532
+ function migrateProductStage(stage) {
6533
+ if (stage === void 0 || stage === null) {
6534
+ return void 0;
6535
+ }
6536
+ if (typeof stage !== "string") {
6537
+ return stage;
6538
+ }
6539
+ const lower = stage.toLowerCase();
6540
+ const mapped = LEGACY_PRODUCT_STAGES[lower];
6541
+ return mapped ?? stage;
6542
+ }
6543
+ function isLegacyProductStage(stage) {
6544
+ return typeof stage === "string" && stage.toLowerCase() in LEGACY_PRODUCT_STAGES;
6545
+ }
6546
+
6547
+ // src/shapes/base-node.ts
6548
+ var BASE_NODE_FIELD_PRESENCE = {
6549
+ id: true,
6550
+ type: true,
6551
+ title: true,
6552
+ slug: true,
6553
+ aliases: true,
6554
+ key: true,
6555
+ description: true,
6556
+ tags: true,
6557
+ status: true,
6558
+ archived: true,
6559
+ archived_at: true,
6560
+ source_id: true,
6561
+ source_type: true,
6562
+ mapping_confidence: true,
6563
+ external_tool: true,
6564
+ external_ref: true,
6565
+ external_id: true,
6566
+ external_links: true,
6567
+ created_at: true,
6568
+ updated_at: true,
6569
+ properties: true
7195
6570
  };
7196
- var UPG_LIFECYCLES = [
7197
- // Product (root)
7198
- PRODUCT_LIFECYCLE,
7199
- // Foundations (0.9.12)
7200
- SPECIFICATION_LIFECYCLE,
7201
- // Discovery & Validation
7202
- NEED_LIFECYCLE,
7203
- OPPORTUNITY_LIFECYCLE,
7204
- SOLUTION_LIFECYCLE,
7205
- EXPERIMENT_PLAN_LIFECYCLE,
7206
- RESEARCH_PLAN_LIFECYCLE,
7207
- FEEDBACK_PROGRAM_LIFECYCLE,
7208
- FEATURE_REQUEST_LIFECYCLE,
7209
- BETA_PROGRAM_LIFECYCLE,
7210
- USER_ADVISORY_BOARD_LIFECYCLE,
7211
- // Strategy & Product Specification
7212
- OUTCOME_LIFECYCLE,
7213
- VISION_LIFECYCLE,
7214
- MISSION_LIFECYCLE,
7215
- CAPABILITY_LIFECYCLE,
7216
- OBJECTIVE_LIFECYCLE,
7217
- KEY_RESULT_LIFECYCLE,
7218
- STRATEGIC_THEME_LIFECYCLE,
7219
- INITIATIVE_LIFECYCLE,
7220
- STRATEGIC_PILLAR_LIFECYCLE,
7221
- STRATEGIC_QUESTION_LIFECYCLE,
7222
- FEATURE_AREA_LIFECYCLE,
7223
- FEATURE_LIFECYCLE,
7224
- // user_story is lifecycle-free (declared in UPG_LIFECYCLE_FREE_TYPES below).
7225
- // story_task lifecycle removed v0.4.0; collapsed into task. task + epic are
7226
- // now WORK_ITEM-template-derived (UPG-690, 0.21.0) — see TEMPLATE_LIFECYCLES.
7227
- RELEASE_LIFECYCLE,
7228
- ROADMAP_ITEM_LIFECYCLE,
7229
- PLANNING_CYCLE_LIFECYCLE,
7230
- IP_ASSET_LIFECYCLE,
7231
- CONTRACT_LIFECYCLE,
7232
- DESIGN_CONCEPT_LIFECYCLE,
7233
- BRAND_IDENTITY_LIFECYCLE,
7234
- SCREEN_LIFECYCLE,
7235
- SURFACE_LIFECYCLE,
7236
- // Engineering & Operations
7237
- SERVICE_LIFECYCLE,
7238
- DEPLOYMENT_LIFECYCLE,
7239
- FEATURE_FLAG_LIFECYCLE,
7240
- INVESTIGATION_LIFECYCLE,
7241
- EXTERNAL_API_LIFECYCLE,
7242
- DATABASE_SCHEMA_LIFECYCLE,
7243
- INCIDENT_LIFECYCLE,
7244
- SECURITY_CONTROL_LIFECYCLE,
7245
- DATA_PIPELINE_LIFECYCLE,
7246
- AI_MODEL_LIFECYCLE,
7247
- WORKFLOW_RUN_LIFECYCLE,
7248
- AGENT_DEFINITION_LIFECYCLE,
7249
- AGENT_SESSION_LIFECYCLE,
7250
- REVIEW_GATE_LIFECYCLE,
7251
- TEST_SUITE_LIFECYCLE,
7252
- TEST_CASE_LIFECYCLE,
7253
- // ── Phase B hand-authored ─────────────────────────────────────────
7254
- // Research + Validation
7255
- INSIGHT_LIFECYCLE,
7256
- RESEARCH_QUESTION_LIFECYCLE,
7257
- INTERVIEW_GUIDE_LIFECYCLE,
7258
- TEST_PLAN_LIFECYCLE,
7259
- // AI workflow
7260
- AI_DATASET_LIFECYCLE,
7261
- AI_GUARDRAIL_LIFECYCLE,
7262
- MODEL_COMPARISON_LIFECYCLE,
7263
- PROMPT_VERSION_LIFECYCLE,
7264
- EVAL_BENCHMARK_LIFECYCLE,
7265
- // Business Model
7266
- BUSINESS_MODEL_LIFECYCLE,
7267
- REVENUE_STREAM_LIFECYCLE,
7268
- // Customer Success
7269
- CUSTOMER_HEALTH_SCORE_LIFECYCLE,
7270
- PLAYBOOK_LIFECYCLE,
7271
- // Team & Organisation
7272
- TEAM_OKR_LIFECYCLE,
7273
- RETROSPECTIVE_LIFECYCLE,
7274
- DEPENDENCY_LIFECYCLE,
7275
- ROLE_LIFECYCLE,
7276
- CAPACITY_PLAN_LIFECYCLE,
7277
- // Product & Growth
7278
- VARIANT_LIFECYCLE,
7279
- GROWTH_CAMPAIGN_LIFECYCLE,
7280
- // Workspace
7281
- FRAMEWORK_EXERCISE_LIFECYCLE,
7282
- COMPOSITION_LIFECYCLE,
7283
- // ── Template-generated lifecycles ─────────────────────────────────
7284
- ...TEMPLATE_LIFECYCLES
6571
+ var UPG_BASE_NODE_FIELDS = Object.freeze(
6572
+ Object.keys(BASE_NODE_FIELD_PRESENCE)
6573
+ );
6574
+ var UPG_BASE_NODE_FIELD_SET = new Set(UPG_BASE_NODE_FIELDS);
6575
+ var UPG_BASE_NODE_SPECIAL_MERGE_FIELDS = /* @__PURE__ */ new Set([
6576
+ "id",
6577
+ "type",
6578
+ "slug",
6579
+ "aliases",
6580
+ "properties"
6581
+ ]);
6582
+
6583
+ // src/shapes/document.ts
6584
+ var UPG_CROSS_ONLY_EDGE_TYPES = [
6585
+ // Peer overlap: "these two products share / overlap on this thing." Symmetric,
6586
+ // no canonical instance_of identity. shares_job / shares_need are the job/need
6587
+ // siblings of the persona/competitor/metric peers (connective layer, 0.13.1).
6588
+ "shares_persona",
6589
+ "shares_competitor",
6590
+ "shares_metric",
6591
+ "shares_job",
6592
+ "shares_need",
6593
+ // Product-to-product relationships.
6594
+ "depends_on_product",
6595
+ // runtime dependency (built-on / dogfood), not containment
6596
+ "cannibalises",
6597
+ "succeeds",
6598
+ "hosts",
6599
+ // host runs the hosted product inside itself (container -> contained)
6600
+ // OKR / measurement rollup primitives: the cascade ACROSS products (subordinate
6601
+ // -> superior). `contributes_to` rolls a product strategy entity up to a higher-
6602
+ // level one; `rolls_up_to` feeds a product metric into a higher-level north-star.
6603
+ "contributes_to",
6604
+ "rolls_up_to",
6605
+ // Canonical instance + area-to-audience: the target lives in the portfolio
6606
+ // `registry` section (`registry/{node_id}`). `instance_of` is same-type
6607
+ // canonical-to-instance; the area edges are minted via `link_area_to_audience`.
6608
+ "instance_of",
6609
+ "area_serves_persona",
6610
+ "area_targets_market_segment",
6611
+ // Foundations (0.9.12): a product-graph entity links to a canonical specification
6612
+ // or primitive. Registry-internal spec-to-spec links are catalog edges, not these.
6613
+ //
6614
+ // CORRECTED 0.34.0 — the target contract. This comment said `registry/{node_id}`,
6615
+ // "same shape as instance_of". Every live instance disagrees: all three in the
6616
+ // field target `{product_id}/{node_id}`, and the portfolio's `registry` section
6617
+ // is EMPTY. A reader following the old sentence would look for a registry entry
6618
+ // that has never existed. Both target forms are legitimate — a specification held
6619
+ // as a canonical in the registry, or one held inside the product graph that owns
6620
+ // it — and the field has so far only produced the second.
6621
+ //
6622
+ // THE GAP THIS TIER LEAVES, restated 0.34.0 because the 0.33.0 wording named a
6623
+ // case no graph instantiates. It is NOT "a specification in a graph with no
6624
+ // portfolio around it". It is the HOLDER PRODUCT, and it is live today: the
6625
+ // product graph that HOLDS a specification node has three sibling products
6626
+ // reaching it through this tier and no way to state its own relation to it,
6627
+ // because the cross tier requires two distinct products and there is no
6628
+ // within-graph conformance edge. Not closed in 0.34.0. The verb the live case
6629
+ // wants is `defines` rather than `conforms_to` — a product does not conform to
6630
+ // the specification it authors — and one instance of evidence is not enough to
6631
+ // mint a catalog edge in the area that cost 0.33.0 its shape mid-build. The
6632
+ // condition is the second holder-product instance, or any single-product graph
6633
+ // modelling a specification it conforms to.
6634
+ "product_implements_specification",
6635
+ "product_exposes_specification",
6636
+ "feature_conforms_to_specification",
6637
+ "api_contract_speaks_specification",
6638
+ "product_exposes_primitive",
6639
+ "feature_manipulates_primitive",
6640
+ "primitive_stored_as_data_type"
7285
6641
  ];
7286
- function getLifecycleForType(entityType) {
7287
- return UPG_LIFECYCLES.find((l) => l.entity_type === entityType);
6642
+ var UPG_CROSS_EDGE_TYPES = [
6643
+ ...UPG_CROSS_ONLY_EDGE_TYPES,
6644
+ ...UPG_CROSS_ELIGIBLE_CATALOG_EDGE_TYPES
6645
+ ];
6646
+ var REGISTRY_PRODUCT_ID = "registry";
6647
+ var UPG_PORTFOLIO_KINDS = ["owned", "watched", "strategic", "internal", "gtm"];
6648
+
6649
+ // src/registry/entity-type-resolution.ts
6650
+ var TYPES = getTypes();
6651
+ var TYPES_SET = new Set(TYPES);
6652
+ var UnknownEntityTypeError = class extends Error {
6653
+ suggestions;
6654
+ rawType;
6655
+ constructor(rawType, suggestions) {
6656
+ const suffix = suggestions.length > 0 ? ` Did you mean: ${suggestions.join(", ")}?` : "";
6657
+ super(`Unknown entity type: "${rawType}".${suffix}`);
6658
+ this.name = "UnknownEntityTypeError";
6659
+ this.rawType = rawType;
6660
+ this.suggestions = suggestions;
6661
+ }
6662
+ };
6663
+ function withinEditDistance1(a, b) {
6664
+ if (a === b) return true;
6665
+ const al = a.length;
6666
+ const bl = b.length;
6667
+ if (Math.abs(al - bl) > 1) return false;
6668
+ let i = 0;
6669
+ let j = 0;
6670
+ let edits = 0;
6671
+ while (i < al && j < bl) {
6672
+ if (a[i] !== b[j]) {
6673
+ if (++edits > 1) return false;
6674
+ if (al > bl) i++;
6675
+ else if (bl > al) j++;
6676
+ else {
6677
+ i++;
6678
+ j++;
6679
+ }
6680
+ } else {
6681
+ i++;
6682
+ j++;
6683
+ }
6684
+ }
6685
+ if (i < al || j < bl) edits++;
6686
+ return edits <= 1;
7288
6687
  }
7289
- var UPG_LIFECYCLE_FREE_TYPES = /* @__PURE__ */ new Set([
7290
- // ── Foundations (3 of 4): a primitive either exists or is deprecated; no
7291
- // phase ladder (like metric). `operating_lifecycle`/`operating_stage` are
7292
- // static ordered reference data (the loop is a `cyclic` flag, not a state
7293
- // machine). `specification` carries a lifecycle. ──
7294
- "primitive",
7295
- "operating_lifecycle",
7296
- "operating_stage",
7297
- // ── User (5): personas and JTBD atoms are reference data ──────────────────
7298
- "persona",
7299
- "job",
7300
- "job_step",
7301
- "desired_outcome",
7302
- "switching_cost",
7303
- // ── Market Intelligence (7 of 8): competitor landscape is reference data;
7304
- // competitor_signal is an append-only dated event (no phase ladder);
7305
- // competitive_analysis shipped PUBLISHING lifecycle in Phase C;
7306
- // classification_axis and classification_value are reference taxonomy
7307
- // atoms with no state machine. ─
7308
- "competitor",
7309
- "competitor_feature",
7310
- "competitor_signal",
7311
- "market_trend",
7312
- "market_segment",
7313
- "classification_axis",
7314
- "classification_value",
7315
- // ── Product Specification (1): a configuration_axis is a structural
7316
- // DECLARATION (a lever and its closed value set), not a thing that
7317
- // progresses through states. Same reading as classification_axis above.
7318
- "configuration_axis",
7319
- // ── User Research (5 of 8): participants, quotes, observations,
7320
- // clusters, survey responses are immutable data points ────────────────
7321
- "participant",
7322
- "observation",
7323
- "quote",
7324
- "affinity_cluster",
7325
- "survey_response",
7326
- // ── UX Design (3 of 8): journey structural atoms ──────────────────────────
7327
- "journey_step",
7328
- "journey_phase",
7329
- "journey_action",
7330
- "screen_state",
7331
- // ── Design System (3 of 7): tokens and annotations are atomic values ────
7332
- "design_token",
7333
- "annotation",
7334
- // ── Brand (4 of 6): colour/typography/imagery/voice are reference atoms ──
7335
- "brand_colour",
7336
- "brand_typography",
7337
- "brand_imagery",
7338
- // ── Product Specification (4 of 5): criteria, grouping, historical, +
7339
- // user_story (the templated promise is a stable design artefact; the paired
7340
- // task carries the lifecycle). Re-canon story_statement → user_story at
7341
- // v0.7.0/UPG-571. ─
7342
- "acceptance_criterion",
7343
- "changelog",
7344
- "roadmap_theme",
7345
- "user_story",
7346
- // ── Strategy: metric is a measurement definition; metric_quality_assessment
7347
- // is a point-in-time snapshot; value_stream is a mapped flow;
7348
- // constraint carries its own `constraint_status` enum (binding/advisory/
7349
- // lifted) as a property; base-node `status` not used.
7350
- // vision/mission/capability/outcome get lifecycles in Phase B or C ─────
7351
- "metric",
7352
- "metric_quality_assessment",
7353
- "value_stream",
7354
- "constraint",
7355
- // ── Engineering (15 of 17): DDD modelling primitives + infra references.
7356
- // root_cause / symptom / fix are investigation findings, not workflows
7357
- // (investigation itself has a lifecycle) ────────────────────────────────
7358
- "aggregate",
7359
- "domain_entity",
7360
- "value_object",
7361
- "command",
7362
- "read_model",
7363
- "domain_event",
7364
- "bounded_context",
7365
- "api_endpoint",
7366
- "queue_topic",
7367
- "build_artifact",
7368
- "code_repository",
7369
- "library_dependency",
7370
- "integration_pattern",
7371
- "data_flow",
7372
- "root_cause",
7373
- "symptom",
7374
- "fix",
7375
- // ── Business Model (6 of 9): BMC cells are structural frames ────────────
7376
- "cost_structure",
7377
- "unit_economics",
7378
- "key_resource",
7379
- "key_activity",
7380
- "customer_relationship",
7381
- "distribution_channel",
7382
- // ── Go-To-Market (8 of 13): positioning/ICP/territory/sales_motion are
7383
- // configuration; objection/rebuttal/proof_point are catalog entries ───
7384
- "ideal_customer_profile",
7385
- "positioning",
7386
- "sales_motion",
7387
- "territory",
7388
- "objection",
7389
- "rebuttal",
7390
- "proof_point",
7391
- // ── Team & Organisation (7 of 11): org structural atoms ───────────────────
7392
- "team",
7393
- "stakeholder",
6688
+ function resolveEntityType(rawType) {
6689
+ if (typeof rawType !== "string" || rawType.length === 0) {
6690
+ throw new UnknownEntityTypeError(String(rawType ?? ""), []);
6691
+ }
6692
+ if (TYPES_SET.has(rawType)) {
6693
+ return { canonical: rawType };
6694
+ }
6695
+ const replacement = getReplacementType(rawType);
6696
+ if (replacement && TYPES_SET.has(replacement)) {
6697
+ return { canonical: replacement, alias: { from: rawType, to: replacement } };
6698
+ }
6699
+ const suggestions = [];
6700
+ for (const t of TYPES) {
6701
+ if (withinEditDistance1(t, rawType)) suggestions.push(t);
6702
+ if (suggestions.length >= 5) break;
6703
+ }
6704
+ throw new UnknownEntityTypeError(rawType, suggestions);
6705
+ }
6706
+
6707
+ // src/grammar/hierarchy.ts
6708
+ var UPG_VALID_CHILDREN = {
6709
+ // ── Foundations (0.9.12): registry canonicals that self-nest. A
6710
+ // specification extends a specification (a dialect of a parent spec); a
6711
+ // primitive composes primitives (a block contains spans). These back the
6712
+ // hierarchy-classified specification_extends_specification /
6713
+ // primitive_composes_primitive catalog edges.
6714
+ specification: ["specification"],
6715
+ primitive: ["primitive"],
6716
+ // An operating_lifecycle (e.g. the content-ops lifecycle) contains its ordered
6717
+ // operating_stage children. Backs the operating_lifecycle_contains_operating_stage edge.
6718
+ operating_lifecycle: ["operating_stage"],
6719
+ // ── Product (root) ─────────────────────────────────────────────────────────
6720
+ product: [
6721
+ // Strategy
6722
+ "vision",
6723
+ "outcome",
6724
+ "objective",
6725
+ "metric",
6726
+ "decision",
6727
+ "constraint",
6728
+ // User
6729
+ "persona",
6730
+ // Discovery (via outcome children)
6731
+ // Validation (via hypothesis children)
6732
+ // Market Intelligence
6733
+ "competitor",
6734
+ "market_trend",
6735
+ "market_segment",
6736
+ "competitive_analysis",
6737
+ // User Research
6738
+ "research_study",
6739
+ // Experience Design
6740
+ "user_journey",
6741
+ "user_flow",
6742
+ "wireframe",
6743
+ "screen",
6744
+ // Design System
6745
+ "design_system",
6746
+ "design_component",
6747
+ // Brand Identity
6748
+ "brand_identity",
6749
+ // Product Specification
6750
+ "feature",
6751
+ "feature_area",
6752
+ "release",
6753
+ "roadmap",
6754
+ "roadmap_theme",
6755
+ "planning_cycle",
6756
+ // Configuration (0.30.0): the levers whose values select which surface tree
6757
+ // the product renders. Few per product, and top-level because an axis is a
6758
+ // product-wide fact rather than a child of any one feature or surface.
6759
+ "configuration_axis",
6760
+ // Classification (0.32.0): the product's own taxonomies — the grouped-label
6761
+ // case, one named group over a set of values. Same reasoning as the
6762
+ // configuration axis above, and until now the only parent a
6763
+ // classification_axis could have was a competitive_analysis.
6764
+ "classification_axis",
6765
+ // Engineering
6766
+ "bounded_context",
6767
+ "code_repository",
6768
+ "integration_pattern",
6769
+ "external_api",
6770
+ "data_flow",
6771
+ // Growth
6772
+ "funnel",
6773
+ "acquisition_channel",
6774
+ "cohort",
6775
+ "behavioral_segment",
6776
+ "growth_loop",
6777
+ "attribution_model",
6778
+ // Business Model
6779
+ "business_model",
6780
+ // Go-To-Market
6781
+ "gtm_strategy",
6782
+ // Team & Organisation
6783
+ // `person` is containment-free (see UPG_CONTAINMENT_FREE_TYPES below)
6784
+ // (referenced via edges, not nested under product)
6785
+ "team",
6786
+ "stakeholder",
6787
+ "department",
6788
+ // Data & Analytics
6789
+ "data_source",
6790
+ "event_schema",
6791
+ "dashboard",
6792
+ "data_domain",
6793
+ "glossary_term",
6794
+ // Content & Knowledge
6795
+ "content_piece",
6796
+ "knowledge_base_article",
6797
+ "brand_asset",
6798
+ "document",
6799
+ "documentation_template",
6800
+ // Legal
6801
+ "legal_entity",
6802
+ "privacy_policy",
6803
+ // Compliance
6804
+ "compliance_requirement",
6805
+ "risk",
6806
+ "data_contract",
6807
+ "audit_log_policy",
6808
+ "compliance_framework",
6809
+ // DevOps & Platform
6810
+ "service_level_objective",
6811
+ "incident",
6812
+ "runbook",
6813
+ "monitor",
6814
+ "ci_pipeline",
6815
+ "release_strategy",
6816
+ "on_call_rotation",
6817
+ "infrastructure_component",
6818
+ // Security
6819
+ "threat_model",
6820
+ "security_control",
6821
+ "security_policy",
6822
+ "penetration_test",
6823
+ "security_review",
6824
+ "data_classification",
6825
+ "access_policy",
6826
+ // Accessibility
6827
+ "a11y_standard",
6828
+ "a11y_audit",
6829
+ "a11y_annotation",
6830
+ // Quality Assurance
6831
+ "test_plan",
6832
+ "test_suite",
6833
+ "qa_session",
6834
+ "test_coverage_report",
6835
+ "test_environment",
6836
+ // Customer Feedback
6837
+ "feedback_program",
6838
+ "user_advisory_board",
6839
+ "beta_program",
6840
+ // Pricing & Packaging
6841
+ "pricing_strategy",
6842
+ // AI & Machine Learning
6843
+ "ai_model",
6844
+ "model_comparison",
6845
+ // Workflows & Agents
6846
+ "workflow_template",
6847
+ "agent_definition",
6848
+ // Sales & Revenue
6849
+ "pipeline_sales",
6850
+ "account",
6851
+ "lead",
6852
+ "subscription",
6853
+ "forecast",
6854
+ // Program Management
6855
+ // `milestone` is a SECOND, shallower parent here (Portfolio Phase 2,
6856
+ // 2026-08-14), alongside its existing `project` parent: a product can own a
6857
+ // milestone outright with no program/project above it. Required by the
6858
+ // hierarchy-orphan guard now that `product_targets_milestone` exists.
6859
+ "program",
6860
+ "milestone",
6861
+ // Marketing
6862
+ "marketing_strategy",
6863
+ "press_release",
6864
+ "event",
6865
+ "community_initiative",
6866
+ // Customer Success
6867
+ "support_ticket",
6868
+ "customer_feedback",
6869
+ "churn_reason",
6870
+ "customer_health_score",
6871
+ "playbook",
6872
+ "service_level_agreement",
6873
+ "success_milestone",
6874
+ "service_blueprint",
6875
+ "nps_campaign",
6876
+ // Localisation
6877
+ "locale",
6878
+ "locale_config",
6879
+ // Customer Education
6880
+ "education_program",
6881
+ // Partners & Ecosystem
6882
+ "partner_program",
6883
+ "api_ecosystem",
6884
+ "developer_portal",
6885
+ // Portfolio
6886
+ // (UPG-677) product no longer lists product_area as a child: the
6887
+ // product↔product_area containment is the single direction
6888
+ // product_area_contains_product (product_area → product). The inverse
6889
+ // product_categorised_in_product_area edge was collapsed.
6890
+ // Workspace
6891
+ "workspace"
6892
+ ],
6893
+ // ── Metric & Outcome hierarchy ──────────────────────────────────────────────
6894
+ outcome: ["metric", "opportunity", "feature"],
6895
+ // ── User & Jobs hierarchy ───────────────────────────────────────────────────
6896
+ persona: ["job", "need", "switching_cost", "desired_outcome"],
6897
+ job: ["need", "desired_outcome", "job_step"],
6898
+ // ── Discovery hierarchy ─────────────────────────────────────────────────────
6899
+ opportunity: ["solution", "design_concept", "feasibility_study", "design_sprint"],
6900
+ // solutions now propose hypothesis (the templated
6901
+ // belief), not the legacy hypothesis type.
6902
+ solution: ["hypothesis", "prototype", "metric"],
6903
+ // ── Validation hierarchy ────────────────────────────────────────────────────
6904
+ // (UPG-664) The validation chain is a single-parent line:
6905
+ // hypothesis ▷ experiment_plan ▷ experiment ▷ experiment_run.
6906
+ // hypothesis is canonical (hypothesis_evidence collapsed into evidence;
6907
+ // relationship expressed via hypothesis_has_evidence edge; evidence.direction
6908
+ // carries supports/refutes/neutral semantics). `test_plan` re-homed to the
6909
+ // QA/testing domain (UPG-678), so it is no longer a hypothesis child.
6910
+ hypothesis: ["experiment_plan", "research_plan", "evidence"],
6911
+ // experiment_plan is the canonical validation PLAN (graduated stable,
6912
+ // UPG-664). It designs the experiment it produces; the plan owns the
6913
+ // experiment in the containment line. It also retains experiment_run as a
6914
+ // child for the v0.2.6 split-migration path
6915
+ // (`experiment_plan_ran_as_experiment_run`), where a legacy experiment routes
6916
+ // directly to a plan + run pair.
6917
+ experiment_plan: ["experiment", "experiment_run"],
6918
+ // experiment is the canonical structured test. It owns its run(s) and the
6919
+ // learning/evidence it produces. The optional experiment_run child captures
6920
+ // the multi-run / replication case.
6921
+ experiment: ["experiment_run", "learning", "evidence"],
6922
+ // experiment_run carries learning/evidence/metric children (run produces
6923
+ // evidence) and self-nests for replications/multi-armed runs (V9: this is
6924
+ // where self-nesting genuinely lives, not on `experiment`).
6925
+ experiment_run: ["learning", "evidence", "metric", "experiment_run"],
6926
+ // ── OKR hierarchy ──────────────────────────────────────────────────────────
6927
+ // strategic_question (0.17.4): an open coordination question raised under an
6928
+ // objective (objective_raises_strategic_question, hierarchy).
6929
+ objective: ["key_result", "metric", "strategic_question"],
6930
+ key_result: ["metric"],
6931
+ // ── Strategic cascade: vision → mission → strategic_pillar → strategic_theme →
6932
+ // { initiative, objective } ───────────────────────────────────────────────
6933
+ //
6934
+ // strategic_pillar vs strategic_theme (UPG-692 T3.3 — distinct cascade levels,
6935
+ // NOT duplicates; sharpened rather than merged):
6936
+ // - strategic_pillar = a DURABLE structural division of the strategy. A
6937
+ // standing area the org organises around for years (e.g. "Structured
6938
+ // content", "Developer experience"). Few, long-lived; time_horizon is
6939
+ // multi-year / open-ended; carries its own `success_indicator`.
6940
+ // - strategic_theme = a TIME-BOUND thrust WITHIN a pillar. The current bet
6941
+ // for a period (e.g. "Go AI-native this year"). More numerous, rotates;
6942
+ // time_horizon is bounded (Q / FY); has NO `success_indicator` because it
6943
+ // is measured through its child objectives (strategic_theme_contains_objective).
6944
+ // That success-measurement asymmetry is the load-bearing distinction.
6945
+ vision: ["mission"],
6946
+ mission: ["strategic_pillar"],
6947
+ // 0.20.1: metric added as a strategic_pillar child, backing
6948
+ // strategic_pillar_measured_by_metric (hierarchy) — the pillar's own
6949
+ // north-star, mirrored from objective: ['key_result', 'metric', ...] one
6950
+ // level down the cascade.
6951
+ strategic_pillar: ["strategic_theme", "capability", "value_stream", "decision", "metric"],
6952
+ // v0.5.4 (UPG-511): objectives are the specific quarterly bets *within* a
6953
+ // strategic theme. The theme is the multi-quarter focus area; objectives are
6954
+ // subordinate. Pairs with `strategic_theme_contains_objective` in the edge
6955
+ // catalog (hierarchy, strategic_theme → objective, reverse_verb: rolls_up_to;
6956
+ // renamed from objective_rolls_up_to_strategic_theme in UPG-676).
6957
+ strategic_theme: ["initiative", "objective"],
6958
+ initiative: ["assumption", "strategic_question"],
6959
+ // v0.5.2 (UPG-528): capability decomposes into sub-capabilities (Wardley
6960
+ // value-chain spine) and is realised by user-facing features. Pairs with
6961
+ // `capability_depends_on_capability` and `capability_implemented_by_feature`
6962
+ // in the edge catalogue. The self-loop guard (UPG-520) keeps A → A refused;
6963
+ // A → B between distinct capabilities is the supported decomposition.
6964
+ capability: ["capability", "feature"],
6965
+ // ── Market hierarchy ────────────────────────────────────────────────────────
6966
+ // competitive_analysis hosts classification axes (its dimensions);
6967
+ // each axis hosts its values; values are reusable across the row and column
6968
+ // dossiers of a 2-axis matrix.
6969
+ competitive_analysis: ["competitor", "market_trend", "market_segment", "classification_axis"],
6970
+ competitor: ["competitor_feature", "competitor_signal"],
6971
+ classification_axis: ["classification_value"],
6972
+ // ── UX Research hierarchy ───────────────────────────────────────────────────
6973
+ research_study: [
6974
+ "participant",
6975
+ "observation",
6976
+ "affinity_cluster",
6977
+ "research_question",
6978
+ "interview_guide",
6979
+ "insight",
6980
+ "survey_response"
6981
+ ],
6982
+ observation: ["quote"],
6983
+ // F6 (UPG-672): affinity_cluster owns the observations it groups, in addition
6984
+ // to the insights it synthesises. Pairs with `affinity_cluster_groups_observation`
6985
+ // in the edge catalog (hierarchy). An observation can be both directly owned by
6986
+ // its research_study and grouped under an affinity_cluster (multi-parent grammar).
6987
+ affinity_cluster: ["insight", "observation"],
6988
+ // insight refines into insight; a raw insight can be distilled
6989
+ // into a more specific insight (refines_into chain).
6990
+ // v0.5.8 (UPG-528 Part 2d): insights own their evidencing quotes;
6991
+ // parallel to `observation: ['quote']`. Research-synthesis canon.
6992
+ // Pairs with `insight_evidenced_by_quote` in the edge catalog.
6993
+ // ── Design hierarchy ────────────────────────────────────────────────────────
6994
+ // (UPG-663, v0.9.2) A user_journey owns its steps (the stable 0.1.0 spine)
6995
+ // and carries phases as a non-owning band overlay. A journey_phase is NO
6996
+ // LONGER a containment parent of journey_step: it SPANS steps via the
6997
+ // `journey_phase_spans_journey_step` edge (mirroring the marketing
6998
+ // `customer_journey_stage_spans_journey_step` precedent), so each step has
6999
+ // exactly one containment parent and the journey has one canonical step list.
7000
+ user_journey: ["journey_step", "journey_phase"],
7001
+ journey_step: ["journey_action"],
7002
+ // v0.5.8 (UPG-528 Part 2d): insights own their evidencing quotes;
7003
+ // parallel to `observation: ['quote']`. Research-synthesis canon
7004
+ // (insight ← quote evidencing) extends quote's hierarchy parents to
7005
+ // both observation (raw-capture parent) and insight (synthesis parent).
7006
+ // Pairs with `insight_evidenced_by_quote` in the edge catalog.
7007
+ insight: ["design_question", "insight", "quote"],
7008
+ // v0.5.2 (UPG-528): need anchors a Wardley value chain; capabilities
7009
+ // fulfil the need at the chain top. Cross-domain hierarchy (need ∈ Design,
7010
+ // capability ∈ Strategy) is intentional: Wardley analysis starts from a
7011
+ // user need and decomposes into the capabilities required to fulfil it.
7012
+ need: ["design_question", "capability"],
7013
+ design_question: ["design_concept"],
7014
+ design_concept: ["prototype", "wireframe"],
7015
+ design_component: [
7016
+ "design_token",
7017
+ "design_pattern",
7018
+ "design_guideline",
7019
+ "interaction_spec",
7020
+ "design_component"
7021
+ ],
7022
+ // self-nesting for atomic hierarchy (organism → molecule → atom)
7023
+ prototype: ["annotation"],
7024
+ // ── Brand hierarchy ─────────────────────────────────────────────────────────
7025
+ brand_identity: [
7026
+ "brand_colour",
7027
+ "brand_typography",
7028
+ "brand_asset",
7029
+ "brand_voice",
7030
+ "brand_logo",
7031
+ "brand_imagery"
7032
+ ],
7033
+ // ── Product Specification hierarchy ─────────────────────────────────────────
7034
+ // story_task collapsed into canonical task. feature now owns
7035
+ // task directly; story-derived tasks implement user_story via
7036
+ // task_implements_user_story edge.
7037
+ feature: ["epic", "bug", "task"],
7038
+ feature_area: ["feature", "feature_area"],
7039
+ // epic owns user_story (the templated promise) and, mirroring feature, may
7040
+ // also directly contain bug/task — heterogeneous imported tickets that belong
7041
+ // to one epic rather than the feature as a whole (feedback df99026a).
7042
+ epic: ["user_story", "bug", "task"],
7043
+ user_story: ["acceptance_criterion"],
7044
+ task: ["task"],
7045
+ // planning_cycle (0.20.0): the cadence axis self-nests (a program-increment
7046
+ // contains iterations; a cycle contains its cooldown) via
7047
+ // planning_cycle_contains_planning_cycle. It does NOT contain user_story as a
7048
+ // child: scheduling work into a cycle is the semantic, deliberate-only
7049
+ // planning_cycle_schedules_work_item edge, so the item keeps its feature/epic
7050
+ // containment parent and is merely referenced by the cycle.
7051
+ planning_cycle: ["planning_cycle"],
7052
+ // ── Engineering hierarchy ───────────────────────────────────────────────────
7053
+ bounded_context: [
7054
+ "service",
7055
+ "domain_event",
7056
+ "decision",
7057
+ "data_model",
7058
+ "aggregate",
7059
+ "read_model",
7060
+ "code_repository",
7061
+ "integration_pattern",
7062
+ "external_api",
7063
+ "data_flow",
7064
+ // v0.5.7 (UPG-528 Part 2c): BCs publish api_contracts as their "published
7065
+ // language" (DDD canon). api_contract has two valid hierarchy parents now:
7066
+ // service (per-service exposure) AND bounded_context (BC-level surface).
7067
+ "api_contract"
7068
+ ],
7069
+ service: [
7070
+ "api_contract",
7071
+ "technical_debt_item",
7072
+ "feature_flag",
7073
+ "deployment",
7074
+ "api_endpoint",
7075
+ "database_schema",
7076
+ "queue_topic",
7077
+ "build_artifact",
7078
+ "library_dependency"
7079
+ ],
7080
+ // v0.5.1 (UPG-517 C2): contracts contain their endpoints. Service still
7081
+ // serves endpoints directly (legacy / non-contract endpoints); both
7082
+ // parent-child paths coexist.
7083
+ api_contract: ["api_endpoint"],
7084
+ decision: ["technical_debt_item"],
7085
+ aggregate: ["domain_entity", "value_object", "command"],
7086
+ // ── Growth hierarchy ────────────────────────────────────────────────────────
7087
+ funnel: ["funnel_step"],
7088
+ acquisition_channel: ["growth_campaign"],
7089
+ growth_campaign: ["experiment_plan", "variant"],
7090
+ // ── Business Model hierarchy ─────────────────────────────────────────────────
7091
+ business_model: [
7092
+ "value_proposition",
7093
+ "revenue_stream",
7094
+ "cost_structure",
7095
+ "unit_economics",
7096
+ "partnership",
7097
+ "key_resource",
7098
+ "key_activity",
7099
+ "customer_relationship",
7100
+ "distribution_channel"
7101
+ ],
7102
+ revenue_stream: ["pricing_tier"],
7103
+ // ── Go-To-Market hierarchy ───────────────────────────────────────────────────
7104
+ gtm_strategy: [
7105
+ "ideal_customer_profile",
7106
+ "positioning",
7107
+ "launch",
7108
+ "content_strategy",
7109
+ "sales_motion",
7110
+ "competitive_battle_card",
7111
+ "demand_gen_program",
7112
+ "territory"
7113
+ ],
7114
+ positioning: ["messaging", "objection", "proof_point"],
7115
+ value_proposition: ["objection", "proof_point"],
7116
+ competitive_battle_card: ["objection"],
7117
+ objection: ["rebuttal"],
7118
+ rebuttal: ["proof_point"],
7119
+ // ── Team & Organisation hierarchy ───────────────────────────────────────────
7120
+ department: ["team", "stakeholder"],
7121
+ team: [
7122
+ "role",
7123
+ "team_okr",
7124
+ "retrospective",
7125
+ "dependency",
7126
+ "skill",
7127
+ "ceremony",
7128
+ "capacity_plan",
7129
+ "decision",
7130
+ // Self-nesting (0.17.2): a parent team contains its sub-teams / squads, one
7131
+ // level below department_contains_team. Backs team_contains_team. Mirrors
7132
+ // feature_area_contains_feature_area (same-type child listed last).
7133
+ "team"
7134
+ ],
7135
+ // ── Data & Analytics hierarchy ───────────────────────────────────────────────
7136
+ data_source: ["metric", "data_pipeline", "data_lineage", "event_schema"],
7137
+ // UPG-685 T0.4 (0.13.0 Wave 1): `outcome` removed as a metric child. It closed a
7138
+ // containment cycle (outcome ⊃ metric ⊃ outcome) and was backed only by the CAUSAL
7139
+ // `metric_drives_outcome` edge, not a hierarchy edge — the "metric leads to outcome"
7140
+ // meaning lives correctly on that causal edge. The real containment (outcome ⊃ metric)
7141
+ // is kept. Sub-metric trees (metric ⊃ metric) stay.
7142
+ metric: ["metric", "data_quality_rule", "metric_quality_assessment"],
7143
+ data_domain: ["data_product", "data_source", "glossary_term", "data_model", "dashboard"],
7144
+ dashboard: ["report", "experiment_run"],
7145
+ // ── Content & Knowledge hierarchy ────────────────────────────────────────────
7146
+ // release contains features and bugs (GitHub milestone→issue import).
7147
+ release: ["changelog", "feature", "bug"],
7148
+ content_strategy: ["content_calendar", "content_theme"],
7149
+ content_calendar: [
7150
+ "content_theme",
7151
+ "content_piece",
7152
+ "knowledge_base_article",
7153
+ "brand_asset",
7154
+ "document",
7155
+ "documentation_template"
7156
+ ],
7157
+ // ── Operations & CS hierarchy ────────────────────────────────────────────────
7158
+ service_blueprint: [
7159
+ "user_flow",
7160
+ "playbook",
7161
+ "service_level_agreement",
7162
+ "customer_health_score",
7163
+ "support_ticket",
7164
+ "customer_feedback"
7165
+ ],
7166
+ customer_health_score: ["nps_campaign", "success_milestone"],
7167
+ customer_feedback: ["churn_reason"],
7168
+ user_flow: ["screen", "customer_journey_stage"],
7169
+ customer_journey_stage: ["touchpoint"],
7170
+ // ── Legal, Compliance & Risk hierarchy ──────────────────────────────────────
7171
+ legal_entity: ["ip_asset", "contract"],
7172
+ contract: ["contract_clause"],
7173
+ compliance_framework: [
7174
+ "security_audit",
7175
+ "compliance_requirement",
7176
+ "privacy_policy",
7177
+ "audit_log_policy",
7178
+ "risk",
7179
+ "data_contract",
7180
+ "legal_entity"
7181
+ ],
7182
+ // ── DevOps & Platform hierarchy ──────────────────────────────────────────────
7183
+ infrastructure_component: [
7184
+ "service_level_objective",
7185
+ "monitor",
7186
+ "ci_pipeline",
7187
+ "incident",
7188
+ "runbook",
7189
+ "release_strategy",
7190
+ "on_call_rotation"
7191
+ ],
7192
+ service_level_objective: ["service_level_indicator", "error_budget"],
7193
+ incident: ["postmortem"],
7194
+ monitor: ["alert_rule"],
7195
+ ci_pipeline: ["build_artifact"],
7196
+ // ── Security hierarchy ───────────────────────────────────────────────────────
7197
+ security_policy: [
7198
+ "security_control",
7199
+ "access_policy",
7200
+ "data_classification",
7201
+ "threat_model",
7202
+ "security_review",
7203
+ "incident"
7204
+ ],
7205
+ security_review: ["penetration_test"],
7206
+ threat_model: ["threat", "vulnerability"],
7207
+ // ── Sales & Revenue hierarchy ────────────────────────────────────────────────
7208
+ pipeline_sales: ["pipeline_stage", "lead", "account", "forecast", "subscription"],
7209
+ account: ["contact", "deal"],
7210
+ deal: ["quote_document"],
7211
+ subscription: ["invoice"],
7212
+ // ── Program Management hierarchy ─────────────────────────────────────────────
7213
+ program: ["project", "risk_register", "change_request", "resource_allocation", "status_report"],
7214
+ project: ["milestone", "deliverable"],
7215
+ risk_register: ["risk"],
7216
+ // ── Accessibility hierarchy ──────────────────────────────────────────────────
7217
+ a11y_standard: ["a11y_guideline", "a11y_audit", "a11y_annotation"],
7218
+ a11y_audit: ["a11y_issue"],
7219
+ // ── Product Specification expansion ─────────────────────────────────────────
7220
+ roadmap: ["roadmap_item", "roadmap_theme", "release"],
7221
+ roadmap_theme: ["feature"],
7222
+ // ── Unified Context Layer hierarchy ─────────────────────────────────────────
7223
+ design_system: [
7224
+ "design_component",
7225
+ "design_token",
7226
+ "design_guideline",
7227
+ "brand_identity",
7228
+ "user_journey",
7229
+ "user_flow",
7230
+ "insight"
7231
+ ],
7232
+ screen: ["screen_state", "screen", "surface", "design_component", "wireframe"],
7233
+ // self-nesting + surfaces + components + wireframes
7234
+ // surface (0.27.0): the place inside a screen. Self-nests, so a shell holds
7235
+ // panes, a pane holds regions, a region holds slots. A surface is reached
7236
+ // through the screen that renders it (`screen: [... 'surface']`), never as a
7237
+ // top-level product child: every UPG_VALID_CHILDREN pair must be backed by a
7238
+ // hierarchy-classified edge (guardrail G2b), and the ratified ten do not
7239
+ // include a product-to-surface verb. An app-shell surface therefore hangs off
7240
+ // the screen that mounts it.
7241
+ //
7242
+ // NOTE: `surface_kind` narrows this further than UPG_VALID_CHILDREN can
7243
+ // express. UPG_VALID_CHILDREN is keyed on entity TYPE, so it can only say
7244
+ // "a surface may contain a surface"; the kind ordering (shell > tool > pane >
7245
+ // region > slot / gutter / action_bar, with overlay and ambient parented by
7246
+ // whatever raises them) is a property-level rule documented on `SurfaceKind`
7247
+ // and enforced by validators, not by this table. Precedent: the same split
7248
+ // applies to `planning_cycle`, whose `cadence_kind` narrows its self-nesting.
7249
+ surface: ["surface", "design_component"],
7250
+ // ── Marketing & Communications hierarchy ────────────────────────────────────
7251
+ marketing_strategy: [
7252
+ "marketing_channel",
7253
+ "seo_keyword",
7254
+ "press_release",
7255
+ "event",
7256
+ "community_initiative"
7257
+ ],
7258
+ marketing_channel: ["marketing_campaign_plan"],
7259
+ marketing_campaign_plan: ["email_sequence", "social_post", "ad_creative"],
7260
+ // ── Localisation & i18n hierarchy ───────────────────────────────────────────
7261
+ locale: ["translation_bundle", "cultural_adaptation", "regional_pricing", "locale_config"],
7262
+ translation_bundle: ["translation_key"],
7263
+ // ── Customer Education & Training hierarchy ──────────────────────────────────
7264
+ education_program: [
7265
+ "tutorial",
7266
+ "walkthrough",
7267
+ "webinar",
7268
+ "certification",
7269
+ "help_video",
7270
+ "learning_path"
7271
+ ],
7272
+ // a learning_path can include its terminal certification.
7273
+ learning_path: ["tutorial", "certification"],
7274
+ // ── Quality Assurance & Testing hierarchy ────────────────────────────────────
7275
+ // (UPG-678) test_plan re-homed validation → QA. It is the QA planning layer:
7276
+ // the verification approach (scope, environments, pass criteria) that the
7277
+ // test suites execute. A test_plan groups the suites that carry it out.
7278
+ test_plan: ["test_suite", "test_environment"],
7279
+ test_suite: [
7280
+ "test_case",
7281
+ "regression_test",
7282
+ "qa_session",
7283
+ "test_coverage_report",
7284
+ "test_environment",
7285
+ "test_result"
7286
+ ],
7287
+ test_case: ["test_result"],
7288
+ qa_session: ["bug"],
7289
+ // ── Partner & Ecosystem Management hierarchy ─────────────────────────────────
7290
+ partner_program: [
7291
+ "partner_tier",
7292
+ "integration_partner",
7293
+ "partner_revenue_share",
7294
+ "api_ecosystem",
7295
+ "developer_portal"
7296
+ ],
7297
+ api_ecosystem: ["marketplace_listing"],
7298
+ // ── Feedback & Voice of Customer hierarchy ───────────────────────────────────
7299
+ feedback_program: [
7300
+ "feature_request",
7301
+ "nps_campaign",
7302
+ "feedback_theme",
7303
+ "user_advisory_board",
7304
+ "beta_program"
7305
+ ],
7306
+ feature_request: ["feedback_vote"],
7307
+ // v0.5.8 (UPG-528 Part 2d): CABs convene as quarterly ceremonies;
7308
+ // CAB owns its meeting cadence (Stettler, Moore CAB playbook canon).
7309
+ // Pairs with `user_advisory_board_convenes_as_ceremony` in the edge
7310
+ // catalog. ceremony now has two valid hierarchy parents (team for sprint
7311
+ // ceremonies, user_advisory_board for CAB meetings).
7312
+ user_advisory_board: ["ceremony"],
7313
+ // ── Pricing & Packaging hierarchy ────────────────────────────────────────────
7314
+ pricing_strategy: [
7315
+ "experiment_plan",
7316
+ "pricing_tier",
7317
+ "discount_strategy",
7318
+ "trial_config",
7319
+ "paywall"
7320
+ ],
7321
+ // ── AI/ML Operations hierarchy ───────────────────────────────────────────────
7322
+ // (UPG-665) The prompt abstraction is corrected: ai_model → prompt_template →
7323
+ // prompt_version (a model has templates; each template has versions). The
7324
+ // model no longer owns prompt_version directly.
7325
+ ai_model: [
7326
+ "prompt_template",
7327
+ "eval_benchmark",
7328
+ "ai_cost_tracker",
7329
+ "hallucination_report",
7330
+ "ai_guardrail",
7331
+ "model_comparison",
7332
+ "ai_experiment",
7333
+ "ai_dataset",
7334
+ "ai_trace"
7335
+ ],
7336
+ // prompt_template owns its prompt_versions the way a file owns its commits.
7337
+ prompt_template: ["prompt_version"],
7338
+ // v0.5.7 (UPG-528 Part 2c): benchmarks define the metric set they measure
7339
+ // (HELM, MLPerf, BIG-bench all spec a metric list). metric already has many
7340
+ // hierarchy parents (outcome, objective, key_result, solution, data_source).
7341
+ eval_benchmark: ["eval_run", "metric"],
7342
+ // ai_trace spawns child traces for sub-calls (tool calls, chained
7343
+ // prompts). Self-nesting enables call-tree representation.
7344
+ ai_trace: ["ai_trace"],
7345
+ // ── Agentic Workflows & Process hierarchy ────────────────────────────────────
7346
+ workflow_template: ["workflow_run", "review_gate", "agent_task"],
7347
+ workflow_run: ["workflow_artifact"],
7348
+ agent_definition: ["agent_session", "agent_skill", "agent_hook", "workflow_template", "agent_task"],
7349
+ // v0.5.8 (UPG-528 Part 2d): review gates also vet research insights
7350
+ // (ResearchOps insight-review pattern). Pairs with `review_gate_vets_insight`
7351
+ // in the edge catalog. The gate now owns two child types: approval records
7352
+ // for workflow gates, insights for research-democratisation gates.
7353
+ review_gate: ["approval_record", "insight"],
7354
+ // ── Investigation hierarchy ──────────────────────────────────────────────────
7355
+ investigation: ["symptom", "root_cause"],
7356
+ root_cause: ["fix"],
7357
+ // ── Portfolio layer hierarchy ────────────────────────────────────────────────
7358
+ // organization → product_area is the org-axis anchor (who owns what);
7359
+ // organization → portfolio is the strategic-axis anchor (where you invest).
7360
+ // organization → workspace (WS3, 2026-07-05): org-altitude workspace anchor
7361
+ // (organization_thinks_in_workspace) — a workspace scoped to org altitude
7362
+ // lives in the same portfolio-level graph as its organization node.
7363
+ organization: ["portfolio", "product_area", "workspace"],
7364
+ // portfolios can nest (multi-level investment structures).
7365
+ portfolio: ["product", "portfolio"],
7366
+ // product_area is the organisational container for products and can
7367
+ // nest (parent → sub-area). product_area also groups features; the
7368
+ // "Studio area owns 6 features" mental model. product_area → workspace
7369
+ // (WS3, 2026-07-05): plane-altitude workspace anchor
7370
+ // (product_area_thinks_in_workspace) — "plane" is Entopo's app-level name
7371
+ // for product_area, not a distinct spec entity.
7372
+ product_area: ["product", "product_area", "feature", "workspace"]
7373
+ };
7374
+ function getValidChildren(entityType) {
7375
+ return UPG_VALID_CHILDREN[entityType] ?? [];
7376
+ }
7377
+ function canBeChildOf(childType, parentType) {
7378
+ return getValidChildren(parentType).includes(childType);
7379
+ }
7380
+ var UPG_CONTAINMENT_FREE_TYPES = /* @__PURE__ */ new Set([
7394
7381
  "person",
7395
- "department",
7396
- "skill",
7397
- "ceremony",
7398
- // ── Data & Analytics (4 of 10): lineage and domain containers, plus
7399
- // atomic definitions ────────────────────────────────────────────────────
7400
- "data_lineage",
7401
- "data_domain",
7402
- "data_quality_rule",
7403
- // ── AI (3 of 10): traces and cost trackers are append-only; model
7404
- // comparison snapshots are immutable ───────────────────────────────────
7405
- "ai_cost_tracker",
7406
- "ai_trace",
7407
- // ── Automation (2 of 6): approvals and artifacts are ledger entries ──────
7408
- "approval_record",
7409
- "workflow_artifact",
7410
- // ── Growth (7 of 9): funnels and attribution are structural definitions;
7411
- // cohorts/segments are computed snapshots ────────────────────────────
7412
- "funnel",
7413
- "funnel_step",
7414
- "acquisition_channel",
7415
- "cohort",
7416
- "behavioral_segment",
7417
- "growth_loop",
7418
- "attribution_model",
7419
- // ── Sales (5 of 6): pipeline structure + accounts/contacts + forecast
7420
- // snapshots. Only `deal` has a lifecycle (Phase B SALES_DEAL template) ─
7421
- "account",
7422
- "contact",
7423
- "pipeline_sales",
7424
- "pipeline_stage",
7425
- "forecast",
7426
- // ── Customer Success (5 of 9): journey structure + derived values ────────
7427
- "customer_journey_stage",
7428
- "touchpoint",
7429
- "churn_reason",
7430
- "service_level_agreement",
7431
- // ── DevOps (5 of 10): indicators and budgets are measurement references;
7432
- // strategies and pipelines are configuration ──────────────────────────
7433
- "service_level_indicator",
7434
- "service_level_objective",
7435
- "error_budget",
7436
- "ci_pipeline",
7437
- "release_strategy",
7438
- // ── Security (1 of 5): data classification is a reference label ──────────
7439
- "data_classification",
7440
- // ── Accessibility (2 of 4): standards and annotations ─────────────────────
7441
- "a11y_standard",
7442
- "a11y_annotation",
7443
- // ── Testing (3 of 5): regression tests are reference definitions; test
7444
- // results and coverage reports are immutable records ───────────────────
7445
- "regression_test",
7446
- "test_coverage_report",
7447
- "test_result",
7448
- // ── Customer Feedback (2 of 3): themes and votes are atomic data points ──
7449
- "feedback_theme",
7450
- "feedback_vote",
7451
- // ── Pricing (2 of 4): trial and paywall are configuration ─────────────────
7452
- "trial_config",
7453
- "paywall",
7454
- // ── Content (2 of 5): calendars and themes are planning configuration ────
7455
- "content_calendar",
7456
- "content_theme",
7457
- // ── Legal (2 of 3): legal_entity is an org; contract_clause is an atom
7458
- // of a contract (which has its own lifecycle) ───────────────────────────
7459
- "legal_entity",
7460
- "contract_clause",
7461
- // ── Portfolio (3 of 3): structural containers ─────────────────────────────
7462
- "organization",
7463
- "portfolio",
7464
- "product_area",
7465
- // ── Program Management (2 of 3): allocations and registers are tracking
7466
- // containers ────────────────────────────────────────────────────────────
7467
- "resource_allocation",
7468
- "risk_register",
7469
- // ── Localisation (4 of 5): translation keys, configs, and regional
7470
- // adaptations are reference data ────────────────────────────────────────
7471
- "translation_key",
7472
- "locale_config",
7473
- "cultural_adaptation",
7474
- "regional_pricing",
7475
- // ── Marketing (1 of 4): SEO keywords are tracked reference terms ─────────
7476
- "seo_keyword",
7477
- // ── Ecosystem (2 of 2): partner tiers and rev-share terms are config ─────
7478
- "partner_tier",
7479
- "partner_revenue_share",
7480
- // ── Validation (2 of 4): evidence + learning are data points captured
7481
- // from experiment_runs (which have lifecycles); hypothesis_evidence was
7482
- // lifecycle-free here but is deprecated at v0.4.0 ──────────────────────────────────────
7483
- "evidence",
7484
- "learning",
7485
- // ── Workspace (1 of 4): a capture is a fact about a moment, not a workflow.
7486
- // It is taken, and from then on it either still matches its subject or it
7487
- // does not — which is what `content_hash` answers, not a phase. ─────────
7382
+ // A framework_exercise has no structural parent: it anchors to the entities
7383
+ // it scores via the `framework_exercise_includes_node` edge, not by
7384
+ // containment. Modelling it as a product child would force a containment edge
7385
+ // and read against the whole point of the exercise model (relational, not
7386
+ // hierarchical). Same posture as `person`. See ADR 2026-06-02-framework-exercises.
7387
+ "framework_exercise",
7388
+ // A composition has no structural parent for the same reason a
7389
+ // framework_exercise does not: it anchors to what it SHOWS, relationally, via
7390
+ // `composition_focuses_node`. Modelling it as a product child would force a
7391
+ // containment edge that reads against the point — a published view is not a
7392
+ // part of the product, it is a lens onto one. This is also what keeps the
7393
+ // type to two edges rather than three: no provenance edge is minted (that is
7394
+ // `workspace_produced_node`, reused) and no parent edge is needed.
7395
+ "composition",
7396
+ // A capture has no structural parent for the same reason: it anchors to what
7397
+ // it RENDERS, via `capture_renders_node`. Giving it a product parent would
7398
+ // claim a capture is part of the product rather than a picture of one, and
7399
+ // would mint a containment edge whose only job is to satisfy the hierarchy.
7488
7400
  "capture"
7489
7401
  ]);
7490
- function isLifecycleFreeType(entityType) {
7491
- return UPG_LIFECYCLE_FREE_TYPES.has(entityType);
7402
+ function isContainmentFreeType(entityType) {
7403
+ return UPG_CONTAINMENT_FREE_TYPES.has(entityType);
7492
7404
  }
7493
- var UPG_LIFECYCLE_PLANNED_TYPES = /* @__PURE__ */ new Set([
7494
- // Phase B cleared this set entirely. Every type that was triaged
7495
- // into Phase B/C/D under now either has a lifecycle in
7496
- // `UPG_LIFECYCLES` or is documented as lifecycle-free in
7497
- // `UPG_LIFECYCLE_FREE_TYPES`.
7498
- //
7499
- // Reintroduce entries here when a new entity type is added to the spec
7500
- // and decided to be lifecycle-bearing but its phases have not yet been
7501
- // designed. The `10-lifecycle-coverage` audit will surface uncovered
7502
- // active types until they're either implemented or moved to the
7503
- // free-types set.
7504
- ]);
7505
- function isLifecyclePlannedType(entityType) {
7506
- return UPG_LIFECYCLE_PLANNED_TYPES.has(entityType);
7405
+
7406
+ // src/grammar/projection.ts
7407
+ var VARIES_BY_EDGE = "surface_varies_by_configuration_axis";
7408
+ var PRESENT_UNDER_PROPERTY = "present_under";
7409
+ var ACTIVE_WHEN_PROPERTY = "active_when";
7410
+ var QUALIFIABLE_EDGE_TYPES = [
7411
+ "surface_contains_surface",
7412
+ "feature_occupies_surface"
7413
+ ];
7414
+ function readStringArray(properties, key) {
7415
+ const raw = properties?.[key];
7416
+ if (!Array.isArray(raw)) return void 0;
7417
+ return raw.filter((v) => typeof v === "string");
7507
7418
  }
7508
- function getLifecycleRenderShape(entityType) {
7509
- const lifecycle = getLifecycleForType(entityType);
7510
- if (!lifecycle) return null;
7511
- const terminalSet = new Set(lifecycle.terminal_phases);
7512
- const phaseIndex = new Map(lifecycle.phases.map((p, i) => [p.id, i]));
7513
- const states = lifecycle.phases.map((phase) => ({
7514
- id: phase.id,
7515
- label: phase.label,
7516
- description: phase.description,
7517
- terminal: terminalSet.has(phase.id)
7518
- }));
7519
- const transitions = [];
7520
- for (const phase of lifecycle.phases) {
7521
- const fromTerminal = terminalSet.has(phase.id);
7522
- for (const to of phase.transitions_to) {
7523
- const toTerminal = terminalSet.has(to);
7524
- let kind;
7525
- if (fromTerminal && !toTerminal) {
7526
- kind = "reopen";
7527
- } else if (toTerminal && !fromTerminal) {
7528
- kind = "terminal";
7529
- } else {
7530
- const fromIdx = phaseIndex.get(phase.id) ?? 0;
7531
- const toIdx = phaseIndex.get(to) ?? 0;
7532
- kind = toIdx < fromIdx ? "backward" : "forward";
7419
+ function readActiveWhen(edge) {
7420
+ const raw = edge.properties?.[ACTIVE_WHEN_PROPERTY];
7421
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
7422
+ const axis = raw.axis;
7423
+ const values = readStringArray(raw, "values");
7424
+ if (typeof axis !== "string" || axis.length === 0 || !values || values.length === 0) {
7425
+ return void 0;
7426
+ }
7427
+ return { axis, values };
7428
+ }
7429
+ function projectGraph(nodes, edges, configuration) {
7430
+ const axes = Object.keys(configuration);
7431
+ if (axes.length === 0) {
7432
+ return {
7433
+ nodes: [...nodes],
7434
+ edges: [...edges],
7435
+ excluded_node_ids: [],
7436
+ deactivated_edge_count: 0,
7437
+ dangling_edge_count: 0
7438
+ };
7439
+ }
7440
+ const excluded = /* @__PURE__ */ new Set();
7441
+ for (const edge of edges) {
7442
+ if (edge.type !== VARIES_BY_EDGE) continue;
7443
+ const chosen = configuration[edge.target];
7444
+ if (chosen === void 0) continue;
7445
+ const presentUnder = readStringArray(edge.properties, PRESENT_UNDER_PROPERTY);
7446
+ if (!presentUnder) continue;
7447
+ if (!presentUnder.includes(chosen)) excluded.add(edge.source);
7448
+ }
7449
+ const survivingNodes = excluded.size === 0 ? [...nodes] : nodes.filter((n) => !excluded.has(n.id));
7450
+ let deactivated = 0;
7451
+ let dangling = 0;
7452
+ const survivingEdges = [];
7453
+ for (const edge of edges) {
7454
+ const qualifier = readActiveWhen(edge);
7455
+ if (qualifier) {
7456
+ const chosen = configuration[qualifier.axis];
7457
+ if (chosen !== void 0 && !qualifier.values.includes(chosen)) {
7458
+ deactivated++;
7459
+ continue;
7533
7460
  }
7534
- transitions.push({ from: phase.id, to, kind });
7535
7461
  }
7462
+ if (excluded.has(edge.source) || excluded.has(edge.target)) {
7463
+ dangling++;
7464
+ continue;
7465
+ }
7466
+ survivingEdges.push(edge);
7536
7467
  }
7537
7468
  return {
7538
- entity_type: lifecycle.entity_type,
7539
- ...lifecycle.template_id !== void 0 && { template_id: lifecycle.template_id },
7540
- states,
7541
- transitions,
7542
- initial_state: lifecycle.initial_phase
7469
+ nodes: survivingNodes,
7470
+ edges: survivingEdges,
7471
+ excluded_node_ids: [...excluded].sort(),
7472
+ deactivated_edge_count: deactivated,
7473
+ dangling_edge_count: dangling
7543
7474
  };
7544
7475
  }
7476
+ function enumerateProjections(nodes) {
7477
+ const out = [
7478
+ { configuration: {} }
7479
+ ];
7480
+ for (const node of nodes) {
7481
+ if (node.type !== "configuration_axis") continue;
7482
+ const values = readStringArray(node.properties, "values");
7483
+ if (!values) continue;
7484
+ for (const value of values) {
7485
+ out.push({ axis: node.id, value, configuration: { [node.id]: value } });
7486
+ }
7487
+ }
7488
+ return out;
7489
+ }
7490
+
7491
+ // src/grammar/configuration-drift.ts
7492
+ var ALTERNATES_EDGE = "surface_alternates_with_surface";
7493
+ var PARENT_EDGE_TYPES = /* @__PURE__ */ new Set(["surface_contains_surface", "screen_renders_surface"]);
7494
+ function edgeLabel(edge) {
7495
+ return edge.id ?? `${edge.source} -> ${edge.target}`;
7496
+ }
7497
+ function checkConfigurationDrift(nodes, edges) {
7498
+ const findings = [];
7499
+ const axisValues = /* @__PURE__ */ new Map();
7500
+ for (const node of nodes) {
7501
+ if (node.type !== "configuration_axis") continue;
7502
+ const values = readStringArray(node.properties, "values");
7503
+ if (!values || values.length === 0) {
7504
+ findings.push({
7505
+ kind: "axis_values_empty",
7506
+ severity: "error",
7507
+ node_id: node.id,
7508
+ axis_id: node.id,
7509
+ message: "Configuration axis declares no values. An axis with no values selects nothing, so no projection can be taken along it."
7510
+ });
7511
+ axisValues.set(node.id, []);
7512
+ continue;
7513
+ }
7514
+ axisValues.set(node.id, values);
7515
+ const rawDefault = node.properties?.default_value;
7516
+ if (typeof rawDefault === "string" && rawDefault.length > 0 && !values.includes(rawDefault)) {
7517
+ findings.push({
7518
+ kind: "axis_default_not_a_value",
7519
+ severity: "error",
7520
+ node_id: node.id,
7521
+ axis_id: node.id,
7522
+ message: `default_value "${rawDefault}" is not one of the axis values [${values.join(", ")}]. It names a value of this axis, so it has to be one the axis declares.`
7523
+ });
7524
+ }
7525
+ }
7526
+ for (const edge of edges) {
7527
+ if (edge.type !== VARIES_BY_EDGE) continue;
7528
+ const values = axisValues.get(edge.target);
7529
+ const presentUnder = readStringArray(edge.properties, PRESENT_UNDER_PROPERTY);
7530
+ if (!presentUnder || presentUnder.length === 0) {
7531
+ findings.push({
7532
+ kind: "present_under_empty",
7533
+ severity: "error",
7534
+ edge_id: edge.id,
7535
+ node_id: edge.source,
7536
+ axis_id: edge.target,
7537
+ message: `${edgeLabel(edge)} declares variance without a non-empty present_under. A surface that exists under no configuration should be deleted rather than declared; a surface that exists under all of them should carry no varies_by edge at all.`
7538
+ });
7539
+ continue;
7540
+ }
7541
+ if (!values) continue;
7542
+ for (const value of presentUnder) {
7543
+ if (!values.includes(value)) {
7544
+ findings.push({
7545
+ kind: "present_under_unknown_value",
7546
+ severity: "error",
7547
+ edge_id: edge.id,
7548
+ node_id: edge.source,
7549
+ axis_id: edge.target,
7550
+ message: `present_under names "${value}", which the axis does not declare. Its values are [${values.join(", ")}].`
7551
+ });
7552
+ }
7553
+ }
7554
+ }
7555
+ for (const edge of edges) {
7556
+ const hasQualifierKey = edge.properties !== void 0 && Object.prototype.hasOwnProperty.call(edge.properties, ACTIVE_WHEN_PROPERTY);
7557
+ if (!hasQualifierKey) continue;
7558
+ if (edge.type !== void 0 && !QUALIFIABLE_EDGE_TYPES.includes(edge.type)) {
7559
+ findings.push({
7560
+ kind: "qualifier_on_illegal_edge",
7561
+ severity: "error",
7562
+ edge_id: edge.id,
7563
+ message: `active_when is not legal on ${edge.type}. The qualifier is scoped to [${QUALIFIABLE_EDGE_TYPES.join(", ")}] deliberately: conditional composition is the question this release answers, and a general modality system is not.`
7564
+ });
7565
+ continue;
7566
+ }
7567
+ const qualifier = readActiveWhen(edge);
7568
+ if (!qualifier) {
7569
+ const rawQualifier = edge.properties?.[ACTIVE_WHEN_PROPERTY];
7570
+ const rawValues = rawQualifier && typeof rawQualifier === "object" && !Array.isArray(rawQualifier) ? rawQualifier.values : void 0;
7571
+ if (Array.isArray(rawValues) && rawValues.length === 0) {
7572
+ findings.push({
7573
+ kind: "qualifier_values_empty",
7574
+ severity: "error",
7575
+ edge_id: edge.id,
7576
+ message: `${edgeLabel(edge)} carries an active_when with an empty values list. Read literally that would remove the relationship from every configuration, which is a way to delete an edge by writing a property; it is treated as absent instead. To say a relationship never holds, delete the edge.`
7577
+ });
7578
+ continue;
7579
+ }
7580
+ findings.push({
7581
+ kind: "qualifier_axis_unresolved",
7582
+ severity: "error",
7583
+ edge_id: edge.id,
7584
+ message: `${edgeLabel(edge)} carries a malformed active_when. It must be an object with an axis id and a non-empty values array; anything else reads as absent, which silently makes the relationship invariant.`
7585
+ });
7586
+ continue;
7587
+ }
7588
+ const values = axisValues.get(qualifier.axis);
7589
+ if (!values) {
7590
+ findings.push({
7591
+ kind: "qualifier_axis_unresolved",
7592
+ severity: "error",
7593
+ edge_id: edge.id,
7594
+ axis_id: qualifier.axis,
7595
+ message: `active_when names axis "${qualifier.axis}", which is not a configuration_axis node in this graph.`
7596
+ });
7597
+ continue;
7598
+ }
7599
+ for (const value of qualifier.values) {
7600
+ if (!values.includes(value)) {
7601
+ findings.push({
7602
+ kind: "qualifier_unknown_value",
7603
+ severity: "error",
7604
+ edge_id: edge.id,
7605
+ axis_id: qualifier.axis,
7606
+ message: `active_when names value "${value}", which axis "${qualifier.axis}" does not declare. Its values are [${values.join(", ")}].`
7607
+ });
7608
+ }
7609
+ }
7610
+ }
7611
+ const varianceBySource = /* @__PURE__ */ new Map();
7612
+ for (const edge of edges) {
7613
+ if (edge.type !== VARIES_BY_EDGE) continue;
7614
+ const values = readStringArray(edge.properties, PRESENT_UNDER_PROPERTY) ?? [];
7615
+ const list = varianceBySource.get(edge.source) ?? [];
7616
+ list.push({ axis: edge.target, values });
7617
+ varianceBySource.set(edge.source, list);
7618
+ }
7619
+ for (const edge of edges) {
7620
+ if (edge.type !== ALTERNATES_EDGE) continue;
7621
+ const left = varianceBySource.get(edge.source) ?? [];
7622
+ const right = varianceBySource.get(edge.target) ?? [];
7623
+ if (left.length === 0 || right.length === 0) {
7624
+ findings.push({
7625
+ kind: "alternation_axis_mismatch",
7626
+ severity: "error",
7627
+ edge_id: edge.id,
7628
+ message: `${edgeLabel(edge)} declares an alternation, but at least one endpoint declares no variance at all. Two surfaces that are both always present are not alternatives; they co-exist.`
7629
+ });
7630
+ continue;
7631
+ }
7632
+ const sharedAxes = left.filter((l) => right.some((r) => r.axis === l.axis)).map((l) => l.axis);
7633
+ if (sharedAxes.length === 0) {
7634
+ findings.push({
7635
+ kind: "alternation_axis_mismatch",
7636
+ severity: "error",
7637
+ edge_id: edge.id,
7638
+ message: `${edgeLabel(edge)} declares an alternation between surfaces that vary on different axes. Alternatives are selected by ONE lever; surfaces on different levers can both be present at once.`
7639
+ });
7640
+ continue;
7641
+ }
7642
+ for (const axis of sharedAxes) {
7643
+ const leftValues = left.find((l) => l.axis === axis)?.values ?? [];
7644
+ const rightValues = right.find((r) => r.axis === axis)?.values ?? [];
7645
+ const overlap = leftValues.filter((v) => rightValues.includes(v));
7646
+ if (overlap.length > 0) {
7647
+ findings.push({
7648
+ kind: "alternation_overlap",
7649
+ severity: "error",
7650
+ edge_id: edge.id,
7651
+ axis_id: axis,
7652
+ message: `${edgeLabel(edge)} declares an alternation, but both surfaces are present under [${overlap.join(", ")}] on axis "${axis}". They co-exist there, so the graph is asserting "one of these" and "both, together" about the same pair.`
7653
+ });
7654
+ }
7655
+ }
7656
+ }
7657
+ const parentsByChild = /* @__PURE__ */ new Map();
7658
+ for (const edge of edges) {
7659
+ if (edge.type && PARENT_EDGE_TYPES.has(edge.type)) {
7660
+ parentsByChild.set(edge.target, (parentsByChild.get(edge.target) ?? 0) + 1);
7661
+ }
7662
+ }
7663
+ for (const [axisId, values] of axisValues) {
7664
+ for (const value of values) {
7665
+ const projected = projectGraph(nodes, edges, { [axisId]: value });
7666
+ const survivingParents = /* @__PURE__ */ new Map();
7667
+ for (const edge of projected.edges) {
7668
+ if (edge.type && PARENT_EDGE_TYPES.has(edge.type)) {
7669
+ survivingParents.set(edge.target, (survivingParents.get(edge.target) ?? 0) + 1);
7670
+ }
7671
+ }
7672
+ for (const node of projected.nodes) {
7673
+ if (node.type !== "surface") continue;
7674
+ if ((parentsByChild.get(node.id) ?? 0) === 0) continue;
7675
+ if ((survivingParents.get(node.id) ?? 0) > 0) continue;
7676
+ findings.push({
7677
+ kind: "orphaned_under_projection",
7678
+ severity: "warning",
7679
+ node_id: node.id,
7680
+ axis_id: axisId,
7681
+ message: `Surface is present under ${axisId} = "${value}" but every containment parent it has is absent there. Either it needs a parent in that configuration, or it should declare that it is absent from it too.`
7682
+ });
7683
+ }
7684
+ }
7685
+ }
7686
+ return findings;
7687
+ }
7545
7688
 
7546
7689
  // src/grammar/scales.ts
7547
7690
  var UPG_SCALES = {
@@ -11966,8 +12109,8 @@ var UPG_PROPERTY_SCHEMA = {
11966
12109
  },
11967
12110
  // CompositionProperties
11968
12111
  composition: {
11969
- member_query: { type: "object", description: "When present, membership is DERIVED: members are produced by running this query rather than authored by placement.", notes: "This is the portable statement of what the layer shows. On a composition, `CompositionMember.href` remains the publishing tool's own resolved route and stays opaque to everyone else; a member may carry both, and then the href is a fast path while the query is the meaning. A consumer that cannot parse the href can still render the layer, which is the whole reason the declaration is here rather than in a tool-namespaced bag key. A layer with no `member_query` is authored, which is what every composition written before 0.32.0 is. DECLARED ON BOTH HALVES OF THE PAIR since 0.33.0. A layer is query-driven while it is being worked on, not only once it is published, so declaring the query only on the durable composition would make it a fact invented at publish time rather than one recorded." },
11970
- presentation: { type: "object", description: "Advisory rendering intent for the layer as a whole. A consumer may ignore it entirely and still be conformant." },
12112
+ member_query: { type: "object", description: "When present, membership is DERIVED: members are produced by running this query rather than authored by placement. The clause list is authoritative and the named fields are a positive-only projection of it; since 0.34.0 a clause is a discriminated union on `dimension`, so the `type` axis carries entity types rather than free strings.", notes: "This is the portable statement of what the layer shows. On a composition, `CompositionMember.href` remains the publishing tool's own resolved route and stays opaque to everyone else; a member may carry both, and then the href is a fast path while the query is the meaning. A consumer that cannot parse the href can still render the layer, which is the whole reason the declaration is here rather than in a tool-namespaced bag key. A layer with no `member_query` is authored, which is what every composition written before 0.32.0 is. DECLARED ON BOTH HALVES OF THE PAIR since 0.33.0. A layer is query-driven while it is being worked on, not only once it is published, so declaring the query only on the durable composition would make it a fact invented at publish time rather than one recorded." },
12113
+ presentation: { type: "object", description: "Advisory rendering intent for the layer as a whole: `group_by`, `sort`, `layout`, `nest_by`, and `orphan_disposition` (0.34.0, absent means `'root'`). A consumer may ignore it entirely and still be conformant, because every default it then applies is the safe one.", notes: "THE DESCRIPTION LISTS THE FIELDS ON PURPOSE. This property is `object` in the runtime property registry, so an agent reading `get_entity_schema` gets an opaque blob and this sentence. For an object-typed property the description IS the declared shape, which is why `check:editorial` hashes it (E.4, 0.34.0) and why a field added to `UPGViewPresentation` without a word here would be invisible to every gate and every agent at once." },
11971
12114
  members: { type: "object[]", description: "The frozen member arrangement, captured at publish. Layout and pointers only, never resolved content." },
11972
12115
  rev: { type: "number", description: "Monotonic revision, bumped on each republish of the same slug.", notes: "A published revision is a fact about the composition, user-visible as a new print from the same plate, so it is serialised. Worth distinguishing from a store's concurrency token, which shares the name in some backends but is a fact about the table rather than about the thing, and is not spec data." },
11973
12116
  published_at: { type: "string", description: "ISO timestamp of the most recent publish or republish." },
@@ -14218,7 +14361,7 @@ var UPG_PROPERTY_SCHEMA = {
14218
14361
  team_type: { type: "string", enum: ["product", "engineering", "design", "growth", "customer_success"], description: "Functional area of the team" },
14219
14362
  size: { type: "number", description: "Number of people on the team" },
14220
14363
  mission: { type: "string", description: "Team's mission statement" },
14221
- key_prefix: { type: "string", description: 'Prefix this team mints node keys with (e.g. `"ENTP"`, giving `ENTP-1`, `ENTP-2`, ...). @example "ENTP"', notes: "SUPERSEDES `product.key_prefix` FOR THIS PRODUCT. The moment any team declares a prefix, the product-level prefix stops being consulted and the declared team prefixes become the candidate set a create surface offers. A product-level prefix that still resolved would win on order alone, and a multi-team product would then silently mint everything under it, which is the defect this field exists to end. A DECLARED PREFIX IS A CANDIDATE BEFORE IT IS OBSERVED. Candidates derived only from keys that already exist cannot see a team's first create, which is the one that most needs asking about. UNIQUENESS IS PRODUCT-SCOPED, AND A TEAM PREFIX DOES NOT WIDEN IT. The key sequence runs per product across entity types, so two teams in one product share one number line and never collide with each other. A team prefix names a team WITHIN that scope; it does not create a sequence that spans products. MINTING IS PRODUCT-SCOPED (normative, 0.33.0). `team` is `portfolio_shared`, so one team node can be referenced from two products. Minting is not portfolio-scoped with it. The rule, and it is a requirement rather than a recommendation: 1. A portfolio-shared team's prefix is NOT a minting candidate in a second product. The first product a team mints under is the only product that prefix mints in. 2. Refusal is NO-KEY. The node is created without a key. Refusal MUST NOT be an exception: a keyless create is a legal outcome everywhere else in the ladder, and throwing here would break creates that succeed today on every surface. Throwing stays reserved for a broken invariant, not for policy. 3. The rule applies on the MINT path, not the picker path, and it covers the INFERRED case. A prefix that was never requested by anyone, and was derived from keys that already exist in the second product, is refused on the same terms as one a caller named. A guard that only inspects an explicitly requested prefix misses the quiet path, and the quiet path is the one a fixture reproduces. WHY THE SCOPE STOPS AT THE PRODUCT. Key uniqueness is enforced by a `(product_id, key)` index, which permits the same key under two product ids by construction. A prefix that minted in two products would therefore run two independent sequences under one name and hand two different nodes the same citation, with nothing objecting. Portfolio-shared team minting is DEFERRED until a supra-product uniqueness design exists, rather than approximated. This rule states the CONTRACT. The behaviour belongs to whatever mints keys, which is not this package: see `UPGBaseNode.key`." }
14364
+ key_prefix: { type: "string", description: 'Prefix this team mints node keys with (e.g. `"ENTP"`, giving `ENTP-1`, `ENTP-2`, ...). @example "ENTP"', notes: "SUPERSEDES `product.key_prefix` FOR THIS PRODUCT, AND NOTHING ELSE (normative, narrowed in 0.34.0). The moment any team declares a prefix, the PRODUCT-LEVEL prefix stops being consulted. A product-level prefix that still resolved would win on order alone, and a multi-team product would then silently mint everything under it, which is the defect this field exists to end. THE CANDIDATE SET IS THE UNION OF DECLARED AND OBSERVED PREFIXES. A declaration adds a candidate; it does not remove one. A prefix stops being offered only when something claims it or when nothing has ever minted under it, and while more than one candidate stands the create surface keeps asking. WHY THIS WAS NARROWED, stated because 0.33.0 shipped the wider reading and an implementer built against it. The paragraph above made ANY declaration replace the candidate set outright, and its own stated rationale is entirely about `product.key_prefix`: a SINGLE STRING, declared once, that cannot represent two teams. An OBSERVED prefix is not that. It is evidence of a namespace already in active use. Suppressing it reproduces the precise defect this field exists to end, inside one product, and does so silently. Measured on the only keyed graph in the estate: it carries two observed prefixes, 370 keys under one and 662 under the other, and declares neither. Under the wider reading, one team declaring the smaller prefix collapses the candidate set to it, the picker disappears, and every later create mints under it, including the 662 keys' worth of work belonging to the other namespace. The sentence over-reached beyond its own reason, and this narrows it back to that reason. Shipped as a CHANGE in 0.34.0 rather than as a patch correction. Read as a correction it is defensible, but implementers had already built to the wider text, and moving a contract under them in a patch is how a patch becomes a surprise. A DECLARED PREFIX IS A CANDIDATE BEFORE IT IS OBSERVED. Candidates derived only from keys that already exist cannot see a team's first create, which is the one that most needs asking about. That is why declaration ADDS to the candidate set; it is not a reason for it to subtract. UNIQUENESS IS PRODUCT-SCOPED, AND A TEAM PREFIX DOES NOT WIDEN IT. The key sequence runs per product across entity types, so two teams in one product share one number line and never collide with each other. A team prefix names a team WITHIN that scope; it does not create a sequence that spans products. MINTING IS PRODUCT-SCOPED (normative, 0.33.0). `team` is `portfolio_shared`, so one team node can be referenced from two products. Minting is not portfolio-scoped with it. The rule, and it is a requirement rather than a recommendation: 1. A portfolio-shared team's prefix is NOT a minting candidate in a second product. The first product a team mints under is the only product that prefix mints in. 2. Refusal is NO-KEY. The node is created without a key. Refusal MUST NOT be an exception: a keyless create is a legal outcome everywhere else in the ladder, and throwing here would break creates that succeed today on every surface. Throwing stays reserved for a broken invariant, not for policy. 3. The rule applies on the MINT path, not the picker path, and it covers the INFERRED case. A prefix that was never requested by anyone, and was derived from keys that already exist in the second product, is refused on the same terms as one a caller named. A guard that only inspects an explicitly requested prefix misses the quiet path, and the quiet path is the one a fixture reproduces. WHY THE SCOPE STOPS AT THE PRODUCT. Key uniqueness is enforced by a `(product_id, key)` index, which permits the same key under two product ids by construction. A prefix that minted in two products would therefore run two independent sequences under one name and hand two different nodes the same citation, with nothing objecting. Portfolio-shared team minting is DEFERRED until a supra-product uniqueness design exists, rather than approximated. HOW RULE 1 IS DECIDED: THE EVIDENCE RULE (normative, 0.34.0). Rule 1 names a first product without saying how a minter knows which one it is. It is decided by EVIDENCE, not by a stored marker: at mint, if any other IN-SCOPE product already holds a key under the prefix, refuse. Evidence is derivable from the graphs themselves, needs no migration, cannot go stale, and cannot disagree with the keys. A durable home marker could do all three, and would mint state for a fact the graph already carries. The cost is stated rather than hidden: evidence is SCOPE-DEPENDENT, which is why the scope is ruled below in the same breath rather than left open. THE UNDECIDABLE CASE: NEITHER MINTS (normative, 0.34.0). When two products already hold keys under one prefix and nothing establishes which was first, NEITHER mints. No tiebreak is invented. Creation order is not recorded, and `max(existing)` measures import volume rather than precedence, so any tiebreak would be a guess wearing a rule, and a silent one, since it would attribute a namespace to a product with nothing to say it was wrong. Refusing both is the NO-KEY outcome rule 2 already sanctions, and it is recoverable: once either product declares the prefix, the other is unambiguous and a backfill can run. WHAT \"IN SCOPE\" MEANS: ENGINE-DEFINED, WITH A FLOOR AND A CEILING (normative, 0.34.0). The scope over which the evidence rule looks is defined by the engine, bounded on both sides. FLOOR. It MUST include every product the engine can enumerate for this caller. An engine that looks at fewer products than it can see is choosing not to notice a collision it could have seen. CEILING. It MUST NEVER include a product the caller could not otherwise read. A wider read is a cross-tenant information channel: refusing a mint because of a key in a graph the caller cannot see leaks that the graph exists and what is in it. This half is a security constraint and is not negotiable. PORTFOLIO ALTITUDE IS THE WRONG NORMATIVE ALTITUDE, and it was measured rather than argued: deleting the portfolio document changes nothing about minting, because no minter consults the portfolio seam. Stating the invariant there states it where nobody looks. In practice the local engine's scope is every graph in the workspace folder and the cloud engine's is the caller's own product list. THE HONEST CONSEQUENCE, which belongs in the text rather than in a later surprise: the invariant is SCOPE-RELATIVE. Two engines can legitimately disagree about whether one mint is safe, because they can legitimately see different sets of products. That is a real limitation of the evidence rule and the price of the ceiling. IMMUTABLE ONCE ANYTHING HAS MINTED UNDER IT, PER PRODUCT (normative, 0.34.0). Once any key exists under this prefix IN A GIVEN PRODUCT, the declaration cannot be edited for that product. Refusal-shaped and NO-KEY, matching rule 2: never an exception, because a keyless create is legal everywhere else in the ladder. SCOPED PER PRODUCT, NOT PER TEAM, and the reason is that `team` is `portfolio_shared`: a team that has never minted in product B must still be free to declare there. A per-team global lock would strand it. WHAT IT PREVENTS. Without it, a team edits its prefix after four hundred mints and one product silently carries two number lines under two names, with nothing recording that they were ever one sequence. RENAMING STAYS POSSIBLE BY THE HONEST ROUTE: a migration that rewrites the existing keys. That is a deliberate act with a visible cost, which is the difference between renaming a namespace and forking it by accident. THE PICKER MAY OFFER WHAT THE MINT REFUSES, AND THE SURFACE OWNS THE DIVERGENCE (0.34.0). Rule 3 applies on the MINT path and not the picker path, which is deliberate: the picker cannot cheaply know the answer, since knowing it requires reading other products. The consequence is that a surface can present a choice that then fails. The owner is named here rather than left implicit: A CREATE SURFACE THAT OFFERS A PREFIX THE MINT MAY REFUSE MUST BE ABLE TO REPORT THE REFUSAL, AND MUST BE ABLE TO PRESENT NO-KEY AS AN OUTCOME RATHER THAN AS AN ERROR. This is a design obligation on the surface, not a spec mechanic: the spec cannot fix a UX gap and should not pretend to. The union ruling above shrinks the divergence considerably, because the picker now keeps asking in exactly the case that would otherwise resolve wrongly. This rule states the CONTRACT. The behaviour belongs to whatever mints keys, which is not this package: see `UPGBaseNode.key`." }
14222
14365
  },
14223
14366
  // TeamOkrProperties: TeamOkr entity.
14224
14367
  team_okr: {
@@ -14544,8 +14687,8 @@ var UPG_PROPERTY_SCHEMA = {
14544
14687
  },
14545
14688
  // WorkspaceProperties: Workspace: a spatial thinking space for arranging entities.
14546
14689
  workspace: {
14547
- member_query: { type: "object", description: "When present, membership is DERIVED: members are produced by running this query rather than authored by placement.", notes: "This is the portable statement of what the layer shows. On a composition, `CompositionMember.href` remains the publishing tool's own resolved route and stays opaque to everyone else; a member may carry both, and then the href is a fast path while the query is the meaning. A consumer that cannot parse the href can still render the layer, which is the whole reason the declaration is here rather than in a tool-namespaced bag key. A layer with no `member_query` is authored, which is what every composition written before 0.32.0 is. DECLARED ON BOTH HALVES OF THE PAIR since 0.33.0. A layer is query-driven while it is being worked on, not only once it is published, so declaring the query only on the durable composition would make it a fact invented at publish time rather than one recorded." },
14548
- presentation: { type: "object", description: "Advisory rendering intent for the layer as a whole. A consumer may ignore it entirely and still be conformant." },
14690
+ member_query: { type: "object", description: "When present, membership is DERIVED: members are produced by running this query rather than authored by placement. The clause list is authoritative and the named fields are a positive-only projection of it; since 0.34.0 a clause is a discriminated union on `dimension`, so the `type` axis carries entity types rather than free strings.", notes: "This is the portable statement of what the layer shows. On a composition, `CompositionMember.href` remains the publishing tool's own resolved route and stays opaque to everyone else; a member may carry both, and then the href is a fast path while the query is the meaning. A consumer that cannot parse the href can still render the layer, which is the whole reason the declaration is here rather than in a tool-namespaced bag key. A layer with no `member_query` is authored, which is what every composition written before 0.32.0 is. DECLARED ON BOTH HALVES OF THE PAIR since 0.33.0. A layer is query-driven while it is being worked on, not only once it is published, so declaring the query only on the durable composition would make it a fact invented at publish time rather than one recorded." },
14691
+ presentation: { type: "object", description: "Advisory rendering intent for the layer as a whole: `group_by`, `sort`, `layout`, `nest_by`, and `orphan_disposition` (0.34.0, absent means `'root'`). A consumer may ignore it entirely and still be conformant, because every default it then applies is the safe one.", notes: "THE DESCRIPTION LISTS THE FIELDS ON PURPOSE. This property is `object` in the runtime property registry, so an agent reading `get_entity_schema` gets an opaque blob and this sentence. For an object-typed property the description IS the declared shape, which is why `check:editorial` hashes it (E.4, 0.34.0) and why a field added to `UPGViewPresentation` without a word here would be invisible to every gate and every agent at once." },
14549
14692
  visibility: { type: "string", enum: ["private", "shared", "public"], description: "Who can see this workspace" },
14550
14693
  purpose: { type: "string", description: "Free-text description. Pairs with the closed-enum `workspace_purpose`." },
14551
14694
  workspace_purpose: { type: "string", enum: ["discovery", "planning", "retrospective", "design", "research", "strategy", "general"], description: "What the workspace is for. Drives template suggestions and surfaces in workspace browsers.", notes: "`discovery` is persona, job and opportunity exploration. `planning` covers roadmap and decision sessions. `retrospective` is reflection on shipped work. `design` is experience or UI exploration. `research` organises study data and synthesis. `strategy` is high-level direction setting. `general` is the catch-all." },
@@ -29013,6 +29156,48 @@ var UPG_ANTI_PATTERNS = [
29013
29156
  severity: "medium",
29014
29157
  source: { kind: "fundamental" }
29015
29158
  },
29159
+ // ── Citable-key collision (0.34.0): portfolio-scoped, and the FIRST detector
29160
+ // to ship with a labeled corpus behind it (packages/upg-evals/corpora/
29161
+ // intelligence/duplicate-key-across-products/).
29162
+ //
29163
+ // WHY IT CANNOT BE A SINGLE-GRAPH CHECK. Key uniqueness is enforced by a
29164
+ // `(product_id, key)` index, so each product reports its own key as valid. The
29165
+ // collision is only visible from above, which is why this is `scope: 'portfolio'`
29166
+ // and carries no structured_condition: the detector reads across products, and
29167
+ // IntelligenceCondition composes aggregate counts within one graph.
29168
+ //
29169
+ // MECHANICALLY DECIDABLE, which is unusual in this file and is why it can ship
29170
+ // enforced: one `(prefix, number)` pair appearing in two products of one
29171
+ // portfolio, with no judgement about intent. Every other portfolio entry here
29172
+ // approximates a per-node rule; this one is exact.
29173
+ //
29174
+ // ENFORCED FROM DAY ONE. What was staged is the CORPUS, not the enforcement.
29175
+ // The tempting shape was a check that ships "defined" and becomes "enforced"
29176
+ // later, and there is no such mechanic: a registered detector that declines to
29177
+ // fire is worse than either real option, and nothing in the spec could hang it.
29178
+ // The detector has little to fire on until a second keyed product exists, and
29179
+ // that is a property of the estate rather than of the check.
29180
+ //
29181
+ // THE NEAR-MISSES ARE CONSTRUCTED, and the corpus says so in its own README
29182
+ // rather than in a plan nobody opens. Three classes: two products sharing a
29183
+ // prefix over DISJOINT number ranges (latent, not yet colliding); a
29184
+ // DELIBERATELY shared prefix across a product family wanting one citation
29185
+ // namespace; and a product holding IMPORTED keys minted elsewhere. Until a real
29186
+ // collision is sampled, the recall figure is a claim about the author's
29187
+ // imagination. The corpus carries a dated obligation to re-grade precision and
29188
+ // recall on the first sampled collision.
29189
+ {
29190
+ id: "duplicate-key-across-products",
29191
+ since: "0.34.0",
29192
+ scope: "portfolio",
29193
+ name: "One citable key, two products",
29194
+ description: "The same (prefix, number) pair identifies a node in two or more products of one portfolio. Keys are minted per product and uniqueness is enforced by a (product_id, key) index, so two products minting under one prefix run two independent sequences under one name. Each product reports its own key as valid and only the portfolio can see that the citation is ambiguous.",
29195
+ why_it_matters: "A key exists to be cited. When one citation resolves to two different things, every reference made with it becomes ambiguous after the fact, including references already written down outside the graph where nothing can be corrected. The damage is retroactive and grows with adoption: the longer both sequences run, the more citations a reconciliation has to rewrite.",
29196
+ remediation: "Decide which product owns the prefix and declare it there with team.key_prefix, so ownership is explicit rather than inferred. Migrate the other product by rewriting its existing keys, which is deliberate and visibly costly, never by editing a declaration under a live sequence. If both products want one namespace, record that decision so it does not read as drift.",
29197
+ stages: ["build", "beta", "launch", "growth", "mature"],
29198
+ severity: "high",
29199
+ source: { kind: "fundamental" }
29200
+ },
29016
29201
  // ── surface (0.27.0): the place, its guest list, and its arbitration rule ──
29017
29202
  // Three patterns, calibrated so the contention one leads and the two coverage
29018
29203
  // companions sit a tier below it. Like every entry in this file, each detector
@@ -32757,8 +32942,8 @@ var NODE_KEY_ORDER = [
32757
32942
  "sort_order",
32758
32943
  "properties"
32759
32944
  ];
32760
- var EDGE_KEY_ORDER = ["id", "source", "target", "type", "mapping_confidence", "properties"];
32761
- var CROSS_EDGE_KEY_ORDER = ["id", "source", "target", "type", "source_product_id", "target_product_id", "mapping_confidence", "alias", "relevance", "audience_role"];
32945
+ var EDGE_KEY_ORDER = ["id", "source", "target", "type", "mapping_confidence", "provenance", "properties"];
32946
+ var CROSS_EDGE_KEY_ORDER = ["id", "source", "target", "type", "source_product_id", "target_product_id", "mapping_confidence", "properties", "alias", "relevance", "audience_role"];
32762
32947
  var PRODUCT_KEY_ORDER = ["id", "title", "description", "stage", "properties"];
32763
32948
  function canonicalNode(node) {
32764
32949
  const repaired = repairNodeDrift(node);
@@ -32775,7 +32960,14 @@ function canonicalEdge(edge) {
32775
32960
  }
32776
32961
  function canonicalCrossEdge(edge) {
32777
32962
  return orderedObject(edge, CROSS_EDGE_KEY_ORDER, {
32778
- forceKeys: ["id", "source", "target", "type"]
32963
+ forceKeys: ["id", "source", "target", "type"],
32964
+ // `properties` is an OPEN bag and must be canonicalised like every other one
32965
+ // (node, edge, product all pass it). Without this, two writers emitting the
32966
+ // same parity assessment with their keys in a different order produce
32967
+ // different bytes, which breaks contract 3 of this format: input key order
32968
+ // does not change the output. Free to fix today and measured as such: zero
32969
+ // of the 61 cross-edges in the estate carry properties.
32970
+ openKeys: ["properties"]
32779
32971
  });
32780
32972
  }
32781
32973
  function canonicalProduct(product) {
@@ -33036,7 +33228,7 @@ function checkHeaderSealText(text) {
33036
33228
  }
33037
33229
 
33038
33230
  // src/index.ts
33039
- var UPG_VERSION = "0.33.0";
33231
+ var UPG_VERSION = "0.34.0";
33040
33232
  var UPG_FORMAT_VERSION = "0.4.0";
33041
33233
  var MARKDOWN_FORMAT_VERSION = "0.1";
33042
33234
  var UPG_TYPES = getTypes();
@@ -33099,6 +33291,14 @@ var UPG_ENTITY_COUNT = UPG_TYPES.length;
33099
33291
  var UPG_DOMAIN_COUNT = UPG_DOMAINS.length;
33100
33292
  var UPG_EDGE_COUNT = UPG_EDGE_TYPES.length;
33101
33293
  var UPG_META_COUNT = UPG_ENTITY_META.length;
33294
+ var UPG_PHASE_COUNT = (() => {
33295
+ const pairs = /* @__PURE__ */ new Set();
33296
+ for (const lifecycle of UPG_LIFECYCLES) {
33297
+ const owner = lifecycle.template_id ? `T:${lifecycle.template_id}` : `E:${lifecycle.entity_type}`;
33298
+ for (const phase of lifecycle.phases) pairs.add(`${owner}::${phase.id}`);
33299
+ }
33300
+ return pairs.size;
33301
+ })();
33102
33302
  export {
33103
33303
  ACTIVE_WHEN_PROPERTY,
33104
33304
  ANALYTICS_DATA_PLAYBOOK,
@@ -33110,10 +33310,12 @@ export {
33110
33310
  CONFIGURATION_VARIANCE_EDGE_PROPERTY_SCHEMA,
33111
33311
  CONTENT_DEPTH_WARNING_RULES,
33112
33312
  COVERAGE_ANTI_PATTERNS,
33313
+ CROSS_EDGE_KEY_ORDER,
33113
33314
  DEFAULT_ENTITY_EMOJI,
33114
33315
  DEFERRED_PROPOSED_BY_CONTRACT,
33115
33316
  DEFER_EDGE_PROPERTY_SCHEMA,
33116
33317
  DISCOVERY_RESEARCH_VALIDATION_PLAYBOOK,
33318
+ EDGE_KEY_ORDER,
33117
33319
  ENGINEERING_PLATFORM_PLAYBOOK,
33118
33320
  ENTITY_EMOJI,
33119
33321
  EXPERIENCE_DESIGN_BRAND_PLAYBOOK,
@@ -33181,7 +33383,9 @@ export {
33181
33383
  UPG_LIFECYCLE_PLANNED_TYPES,
33182
33384
  UPG_META_COUNT,
33183
33385
  UPG_MIGRATIONS,
33386
+ UPG_PHASE_COUNT,
33184
33387
  UPG_PLAYBOOKS,
33388
+ UPG_POLYMORPHIC_EDGE_FAMILIES,
33185
33389
  UPG_POLYMORPHIC_EDGE_KEYS,
33186
33390
  UPG_PORTFOLIO_KINDS,
33187
33391
  UPG_PORTFOLIO_SHARED_TYPES,