You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
index: derived edges for indexed resources - referenceCatalog over indexed nodes #4522
epic:graph-queryEpic: mixed-substrate graph query and the index (INTENTIUS/behold#1024)wave:1Wave 1 of an epic's rollout: can start once earlier waves land
Edges for indexed resources. Run each lexicon's referenceCatalog, today used by chant graph --live to rebuild edges from live reads (#778), over indexed nodes, so a project-less index has edges. Tier 1 of INTENTIUS/behold#1025.
An indexed fixture with a known topology (instance, security group, subnet, route table, gateway on aws) produces the expected edges, each labelled derived.
A lexicon without a catalog is named in the notes.
Acceptance: verdict lines and recorded artifacts, never exit codes alone. Anything needing an emulator corpus, an estate run or a real cloud is run by the maintainer by hand. Red-first only for new guards.
Merged into integration/consolidation-graph as 2e07df6 (unit commit c0ea218, branch unit/cg-chant-4522). It sits on #4521's merge 8c1bde1 and follows behold#1023's ruling (INTENTIUS/behold#1023 (comment)) and behold#1025's schema.
What landed
packages/core/src/lifecycle/derive-edges.ts adds two pure functions over the documents typeListing writes: deriveEdges(doc, lexicons) and deriveEdgesAcross(docs, lexicons). Both run each lexicon's referenceCatalog through the new reconstructIndexedEdges in packages/core/src/graph-refs.ts.
Labels. Every edge has origin: "derived", a rule of the form <lexicon>:<from kind>:<path> (or …:tag:<key>), and grain: "property". viaAttr is the attribute a declared graph names (SecurityGroupIds, SubnetId), so capability mappings read derived edges the same way they read declared ones. Containment edges carry relation: "containment" and also fill groups.byContainer.
Q2, join key. A key is the scoped value: substrate and scope id, plus region for a regional type. A global type (location global or cluster) is keyed by account only. A reference on a regional node matches its own region and the account's global nodes. A reference on a global node matches global nodes only.
Q3, several matches. A value that matches several nodes draws no edge, and an ambiguous-reference note records it with every candidate. For indexed nodes this replaces the candidates[0] pick at graph-refs.ts:196. reconstructEdges still makes that pick for chant graph --live, whose values are logical and physical ids.
Dangling. A reference to nothing in the index goes in graph.dangling.
Q4. The 19 untargeted aws template-shape rules each get an indexedTargetKind (new on RefRule) and keep no targetKind, so enrichLiveAttrs works as before.
Missing aws rules from the feat(core): fold — composite factory interpretation (removes the last run) #1023 report, all targeted.VPCGatewayAttachmentVpcId and InternetGatewayId; NatGateway.AllocationId to EIP; TaskDefinitionExecutionRoleArn and TaskRoleArn to IAM::Role, plus ContainerDefinitions[].LogConfiguration.Options.awslogs-group to Logs::LogGroup; SecurityGroupIngress[].SourceSecurityGroupId; Route53::RecordSet.HostedZoneId.
New identities: DBSubnetGroup, IAM Role (ARN and name), EIP, LogGroup, HostedZone, EKS Cluster and CloudFormation Stack.
On an index, a node is matched by its id, physical id, native id and cloud ids as well as by catalog identity paths. That is how a role's ARN joins even though the aws deep hooks prune Arn.
Q5, tags. Tags make edges only through the new typed ReferenceCatalog.tagRefs. For aws these are aws:cloudformation:stack-id, aws:eks:cluster-name, eks:cluster-name and kubernetes.io/cluster/<name>. No rule matches equal tag values.
Q7, one read.deriveEdgesAcross runs over every document of one account from one read and stores each edge in its holder's document. It refuses two accounts or two observedAts. Running it twice gives the same result.
Lexicons with no catalog. Azure, gcp and k8s are named in a no-catalog note with their node counts. Their nodes get no derived edges.
IREdge gains the optional fields origin, rule and relation. GraphIR stays at version 1, and graph.schema.json was regenerated.
Tests (written, not run)
packages/core/src/lifecycle/derive-edges.test.ts covers labels, scoped joins (a default subnet group in two regions; a global role joined by ARN), ambiguity with every candidate named, containment and boxes, dangling, tag rules (a tag value never joins), the no-catalog note, idempotence, multiple documents and both refusals.
The node-order shuffle test is in the same file. Six seeded permutations of the typed nodes, plus a reversed lexicon order, must give the same edges, dangling list, boxes and notes.
lexicons/aws/src/derived-edges.test.ts runs over testdata/indexed/topology.listing.json, a fixture in Cloud Control's property shape: VPC, public and private subnets, internet gateway, attachment, route table, route, association, two security groups, two instances and an EKS cluster. It lists the 17 expected edges, each derived with its rule. It also checks that internet-reachable gives the same answer (i-0web) over the index as over the equivalent declared graph, that all 19 untargeted rules have an indexedTargetKind, and that every catalog kind exists in the lexicon.
Compile
tsc (TypeScript 7, tsconfig.typecheck.json) reports no errors in any touched file. The total error count is unchanged, and every remaining error needs chant generate.
Still open, waiting for epic-ready or a maintainer run
The two test files above, and graph-schema.test.ts.
Global holders. Under Q2's key, a reference from a global node to a regional one (CloudFront to an ALB, Route 53 to an ALB) does not join and is reported dangling. This follows the ruling; whether a global holder should also search regions is a question for the false-join measurement.
Q6, drawing by default, and Q8, the measurement. Both are the maintainer's emulator run, followed by offline classification. Nothing here draws or hides edges by rule.
Identity matching between attribute values and cloud ids is the separate pass from behold#1023 Q1. It was not built here.
The fixture is hand-written in Cloud Control's documented shape. floci returns a security group as identity and description only (behold#1023), so the ingress-rule edge needs a real Cloud Control payload or a richer floci response before a recorded fixture can show it.
Closed at epic-ready (consolidation-graph, 2026-10-27)
chant main is 47b8594 (the merge of integration/consolidation-graph, tree equal to the tested tip b6281ef). The unit merged at 2e07df6.
Done when, both met by tests that ran green in chant's epic-ready run at the tested tip b6281ef (npx vitest run --project unit, 30275 passed; typecheck with no regressions; release-floors as release-pack runs it, 33 floors and 23 texts agreeing on NEXT_RELEASE 0.124.53):
The aws topology fixture (VPC, subnets, gateway and attachment, route table, route, association, two security groups, two instances, an EKS cluster) gives the 17 expected edges, each origin: "derived" with its rule: lexicons/aws/src/derived-edges.test.ts.
Still open elsewhere, not on this issue's list: Q6 (draw by default) and Q8 (the false-join measurement) are behold#1023's measurement. Their inputs are run sheet entries A3 and F5 in engine-wt/goals/consolidation-graph-1-runs.md, and the result is recorded on behold#1023.
epic:graph-queryEpic: mixed-substrate graph query and the index (INTENTIUS/behold#1024)wave:1Wave 1 of an epic's rollout: can start once earlier waves land
Activity
Merge unit/cg-chant-4522: derived edges for indexed resources (#4522)
lex00 commentedon Oct 27, 2026
Merged into
integration/consolidation-graphas 2e07df6 (unit commit c0ea218, branchunit/cg-chant-4522). It sits on #4521's merge 8c1bde1 and follows behold#1023's ruling (INTENTIUS/behold#1023 (comment)) and behold#1025's schema.What landed
packages/core/src/lifecycle/derive-edges.tsadds two pure functions over the documentstypeListingwrites:deriveEdges(doc, lexicons)andderiveEdgesAcross(docs, lexicons). Both run each lexicon'sreferenceCatalogthrough the newreconstructIndexedEdgesinpackages/core/src/graph-refs.ts.origin: "derived", aruleof the form<lexicon>:<from kind>:<path>(or…:tag:<key>), andgrain: "property".viaAttris the attribute a declared graph names (SecurityGroupIds,SubnetId), so capability mappings read derived edges the same way they read declared ones. Containment edges carryrelation: "containment"and also fillgroups.byContainer.globalorcluster) is keyed by account only. A reference on a regional node matches its own region and the account's global nodes. A reference on a global node matches global nodes only.ambiguous-referencenote records it with every candidate. For indexed nodes this replaces thecandidates[0]pick at graph-refs.ts:196.reconstructEdgesstill makes that pick forchant graph --live, whose values are logical and physical ids.graph.dangling.indexedTargetKind(new onRefRule) and keep notargetKind, soenrichLiveAttrsworks as before.VPCGatewayAttachmentVpcIdandInternetGatewayId;NatGateway.AllocationIdtoEIP;TaskDefinitionExecutionRoleArnandTaskRoleArntoIAM::Role, plusContainerDefinitions[].LogConfiguration.Options.awslogs-grouptoLogs::LogGroup;SecurityGroupIngress[].SourceSecurityGroupId;Route53::RecordSet.HostedZoneId.Arn.ReferenceCatalog.tagRefs. For aws these areaws:cloudformation:stack-id,aws:eks:cluster-name,eks:cluster-nameandkubernetes.io/cluster/<name>. No rule matches equal tag values.deriveEdgesAcrossruns over every document of one account from one read and stores each edge in its holder's document. It refuses two accounts or twoobservedAts. Running it twice gives the same result.no-catalognote with their node counts. Their nodes get no derived edges.IREdgegains the optional fieldsorigin,ruleandrelation. GraphIR stays at version 1, andgraph.schema.jsonwas regenerated.Tests (written, not run)
packages/core/src/lifecycle/derive-edges.test.tscovers labels, scoped joins (adefaultsubnet group in two regions; a global role joined by ARN), ambiguity with every candidate named, containment and boxes, dangling, tag rules (a tag value never joins), the no-catalog note, idempotence, multiple documents and both refusals.lexicons/aws/src/derived-edges.test.tsruns overtestdata/indexed/topology.listing.json, a fixture in Cloud Control's property shape: VPC, public and private subnets, internet gateway, attachment, route table, route, association, two security groups, two instances and an EKS cluster. It lists the 17 expected edges, each derived with its rule. It also checks thatinternet-reachablegives the same answer (i-0web) over the index as over the equivalent declared graph, that all 19 untargeted rules have anindexedTargetKind, and that every catalog kind exists in the lexicon.Compile
tsc (TypeScript 7,
tsconfig.typecheck.json) reports no errors in any touched file. The total error count is unchanged, and every remaining error needschant generate.Still open, waiting for epic-ready or a maintainer run
graph-schema.test.ts.lex00 commentedon Oct 27, 2026
Closed at epic-ready (consolidation-graph, 2026-10-27)
chant main is 47b8594 (the merge of integration/consolidation-graph, tree equal to the tested tip b6281ef). The unit merged at 2e07df6.
Done when, both met by tests that ran green in chant's epic-ready run at the tested tip b6281ef (
npx vitest run --project unit, 30275 passed; typecheck with no regressions; release-floors as release-pack runs it, 33 floors and 23 texts agreeing on NEXT_RELEASE 0.124.53):origin: "derived"with its rule:lexicons/aws/src/derived-edges.test.ts.no-catalognote:packages/core/src/lifecycle/derive-edges.test.ts. (Since then Reference catalogs for azure, gcp, k8s and terraform, so behold can retire its own matcher #4535 gave azure, gcp and k8s catalogs.)Still open elsewhere, not on this issue's list: Q6 (draw by default) and Q8 (the false-join measurement) are behold#1023's measurement. Their inputs are run sheet entries A3 and F5 in engine-wt/goals/consolidation-graph-1-runs.md, and the result is recorded on behold#1023.