perf(javascript)!: stop repeating the semantic identifier strategy per fact (#1474)

Every semantic graph node and relation carried an identifier_strategy
object whose schema admits exactly one value per record type. The
constant made up about 9% of analyze_javascript_application output
(Obsidian app.asar: 12.04 MB to 10.96 MB), and semantic traces repeated
it on every returned fact.

The node_id and relation_id schema descriptions now state how each
identifier is derived.

BREAKING CHANGE: Semantic graph nodes and relations no longer include
identifier_strategy, and relation IDs no longer hash that constant.
Evidence recorded by earlier versions does not validate against the new
semantic graph schema.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822 2026-10-10 00:13:34 -07:00 committed by GitHub
parent 3c7b176a3d
commit 7296f2b5bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 18 deletions

View File

@ -127,10 +127,6 @@ export const createJavaScriptSemanticGraphNode = (
...parsed,
application_node_ids: uniqueSorted(parsed.application_node_ids),
evidence: evidenceContexts.intern(parsed.evidence),
identifier_strategy: {
strategy: "semantic-content-sha256" as const,
stability: "artifact-version" as const,
},
};
return javaScriptSemanticNodeSchema.parse({
...semantic,
@ -147,10 +143,6 @@ export const createJavaScriptSemanticGraphRelation = (
const semantic = {
...parsed,
evidence: evidenceContexts.intern(parsed.evidence),
identifier_strategy: {
strategy: "semantic-content-sha256" as const,
stability: "relationship-exact" as const,
},
};
return javaScriptSemanticRelationSchema.parse({
...semantic,

View File

@ -233,11 +233,9 @@ export const javaScriptSemanticNodeInputSchema = z.strictObject({
export const javaScriptSemanticNodeSchema =
javaScriptSemanticNodeInputSchema.extend({
evidence: javaScriptSemanticEvidenceReferenceSchema,
node_id: semanticNodeIdSchema,
identifier_strategy: z.strictObject({
strategy: z.literal("semantic-content-sha256"),
stability: z.literal("artifact-version"),
}),
node_id: semanticNodeIdSchema.describe(
"SHA-256 of the node kind and identity; stable for one artifact version.",
),
});
/** One directed semantic relationship before its ID is derived. */
@ -254,11 +252,9 @@ export const javaScriptSemanticRelationInputSchema = z.strictObject({
export const javaScriptSemanticRelationSchema =
javaScriptSemanticRelationInputSchema.extend({
evidence: javaScriptSemanticEvidenceReferenceSchema,
relation_id: semanticRelationIdSchema,
identifier_strategy: z.strictObject({
strategy: z.literal("semantic-content-sha256"),
stability: z.literal("relationship-exact"),
}),
relation_id: semanticRelationIdSchema.describe(
"SHA-256 of the exact relation content, including its evidence reference.",
),
});
/** Reasons semantic analysis can leave an explicit frontier. */