mirror of
https://github.com/morluto/rea.git
synced 2026-10-27 09:55:46 +00:00
refactor(javascript)!: share semantic evidence at fact construction
Intern shared provenance in a graph-scoped context registry while retaining exact locations on every fact. Semantic traces carry their referenced context subset, and portable graph validation rejects stale or dangling commitments. BREAKING CHANGE: Semantic graph facts now store evidence context IDs and locations. Graph and semantic trace results require an inline evidence_contexts table.
This commit is contained in:
1 parent
9c4a68bc19
commit
e3bbb9ac45
25 files changed
+1109
-464
No files matched your search
@@ -96,20 +96,23 @@ const projectValue = (input: ValueProjectionInput): void => {
|
||||
if (container.coverage.status === "partial")
|
||||
addSemanticGraphUnknown(
|
||||
context.state,
|
||||
createJavaScriptSemanticGraphUnknown({
|
||||
node_id: target.node_id,
|
||||
family: "object-flow",
|
||||
relation_kinds: ["writes-property"],
|
||||
reason: "ambiguous-target",
|
||||
detail: `Initializer container has unknown ${
|
||||
value.status === "object" ? "properties" : "items"
|
||||
}${container.coverage.omitted === null ? " with an unknown omitted count" : `; ${container.coverage.omitted} omitted`}.`,
|
||||
candidate_node_ids: [target.node_id],
|
||||
evidence: unknownSemanticEvidence(
|
||||
context.file,
|
||||
binding.definitions[0]?.location ?? null,
|
||||
),
|
||||
}),
|
||||
createJavaScriptSemanticGraphUnknown(
|
||||
{
|
||||
node_id: target.node_id,
|
||||
family: "object-flow",
|
||||
relation_kinds: ["writes-property"],
|
||||
reason: "ambiguous-target",
|
||||
detail: `Initializer container has unknown ${
|
||||
value.status === "object" ? "properties" : "items"
|
||||
}${container.coverage.omitted === null ? " with an unknown omitted count" : `; ${container.coverage.omitted} omitted`}.`,
|
||||
candidate_node_ids: [target.node_id],
|
||||
evidence: unknownSemanticEvidence(
|
||||
context.file,
|
||||
binding.definitions[0]?.location ?? null,
|
||||
),
|
||||
},
|
||||
context.state.evidenceContexts,
|
||||
),
|
||||
);
|
||||
} else if (
|
||||
value.status === "unknown" ||
|
||||
@@ -120,24 +123,27 @@ const projectValue = (input: ValueProjectionInput): void => {
|
||||
const evidence = observedSemanticEvidence(context.file, location);
|
||||
addSemanticGraphUnknown(
|
||||
context.state,
|
||||
createJavaScriptSemanticGraphUnknown({
|
||||
node_id: target.node_id,
|
||||
family: "data-flow",
|
||||
relation_kinds: ["defines"],
|
||||
reason:
|
||||
value.resourceLimit === undefined
|
||||
? "unknown-value"
|
||||
: "resource-limit",
|
||||
detail: `${value.reason} Unknown value at ${role}.`,
|
||||
candidate_node_ids: [target.node_id],
|
||||
evidence: {
|
||||
...evidence,
|
||||
authority: "unknown",
|
||||
state: "unknown",
|
||||
confidence: "unknown",
|
||||
limitations: [value.reason],
|
||||
createJavaScriptSemanticGraphUnknown(
|
||||
{
|
||||
node_id: target.node_id,
|
||||
family: "data-flow",
|
||||
relation_kinds: ["defines"],
|
||||
reason:
|
||||
value.resourceLimit === undefined
|
||||
? "unknown-value"
|
||||
: "resource-limit",
|
||||
detail: `${value.reason} Unknown value at ${role}.`,
|
||||
candidate_node_ids: [target.node_id],
|
||||
evidence: {
|
||||
...evidence,
|
||||
authority: "unknown",
|
||||
state: "unknown",
|
||||
confidence: "unknown",
|
||||
limitations: [value.reason],
|
||||
},
|
||||
},
|
||||
}),
|
||||
context.state.evidenceContexts,
|
||||
),
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user