[PR #1474] [MERGED] perf(javascript)!: stop repeating the semantic identifier strategy per fact #2913

Closed
opened 2026-10-17 21:11:45 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1474
Author: @kaoru0822-kitauji
Created: 10/10/2026
Status: ✅ Merged
Merged: 10/10/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: perf/javascript-semantic-identifier-strategy


📝 Commits (1)

  • ccaee0a perf(javascript)!: stop repeating the semantic identifier strategy per fact

📊 Changes

2 files changed (+6 additions, -18 deletions)

View changed files

📝 src/domain/javascript/javascriptSemanticGraph.ts (+0 -8)
📝 src/domain/javascript/javascriptSemanticGraphSchemas.ts (+6 -10)

📄 Description

Summary

Every JavaScript Semantic Relation Graph node carried
"identifier_strategy":{"strategy":"semantic-content-sha256","stability":"artifact-version"}, and every relation carried the same object with "relationship-exact". The schema allows exactly one value for each record type, so the object tells the caller nothing per record. It is repeated across the whole graph and on every fact a semantic trace returns.

This change:

  • removes identifier_strategy from semantic nodes and relations;
  • moves the information into the advertised schema: the node_id and relation_id descriptions now say how each identifier is derived;
  • stops hashing the constant into relation IDs. The validator re-derives IDs from the record, so it stays consistent.

The application graph's identifier_strategy (about 380 records in the run below) is not touched.

Measured effect

rea analyze-javascript-application /Applications/Obsidian.app/Contents/Resources/app.asar --integrity-policy record-and-continue --format json (5,945 semantic nodes, 5,625 relations):

bytes
main 12,037,684
this branch 10,961,994 (−8.9%)

Breaking change

  • Semantic graph nodes and relations no longer include identifier_strategy.
  • Relation IDs change because the constant is no longer hashed into them. Node IDs do not change: they only ever hashed kind and identity.
  • Retained Evidence from earlier versions no longer validates against the strict semantic graph schema. This is the same kind of break as e3bbb9ac.

Verification

  • npx vitest run src/domain/javascript src/application/javascript src/contracts passes (1,022 tests).
  • The JavaScript, application and semantic MCP boundary tests pass: 10 files under tests/boundary/mcp, run with npm run test:focused.
  • npm run check:fast and npm run docs:check pass.
  • I ran the CLI by hand against a real Electron ASAR to get the numbers above.
  • No real Hopper or Ghidra verification was needed: JavaScript static analysis only.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/1474 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/10/2026 **Status:** ✅ Merged **Merged:** 10/10/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `perf/javascript-semantic-identifier-strategy` --- ### 📝 Commits (1) - [`ccaee0a`](https://github.com/morluto/rea/commit/ccaee0a4203cbb50d2c66dc6ef9b037f9ad4d390) perf(javascript)!: stop repeating the semantic identifier strategy per fact ### 📊 Changes **2 files changed** (+6 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/javascript/javascriptSemanticGraph.ts` (+0 -8) 📝 `src/domain/javascript/javascriptSemanticGraphSchemas.ts` (+6 -10) </details> ### 📄 Description ## Summary Every JavaScript Semantic Relation Graph node carried `"identifier_strategy":{"strategy":"semantic-content-sha256","stability":"artifact-version"}`, and every relation carried the same object with `"relationship-exact"`. The schema allows exactly one value for each record type, so the object tells the caller nothing per record. It is repeated across the whole graph and on every fact a semantic trace returns. This change: - removes `identifier_strategy` from semantic nodes and relations; - moves the information into the advertised schema: the `node_id` and `relation_id` descriptions now say how each identifier is derived; - stops hashing the constant into relation IDs. The validator re-derives IDs from the record, so it stays consistent. The application graph's `identifier_strategy` (about 380 records in the run below) is not touched. ## Measured effect `rea analyze-javascript-application /Applications/Obsidian.app/Contents/Resources/app.asar --integrity-policy record-and-continue --format json` (5,945 semantic nodes, 5,625 relations): | | bytes | |---|---| | main | 12,037,684 | | this branch | 10,961,994 (−8.9%) | ## Breaking change - Semantic graph nodes and relations no longer include `identifier_strategy`. - Relation IDs change because the constant is no longer hashed into them. Node IDs do not change: they only ever hashed `kind` and `identity`. - Retained Evidence from earlier versions no longer validates against the strict semantic graph schema. This is the same kind of break as e3bbb9ac. ## Verification - `npx vitest run src/domain/javascript src/application/javascript src/contracts` passes (1,022 tests). - The JavaScript, application and semantic MCP boundary tests pass: 10 files under `tests/boundary/mcp`, run with `npm run test:focused`. - `npm run check:fast` and `npm run docs:check` pass. - I ran the CLI by hand against a real Electron ASAR to get the numbers above. - No real Hopper or Ghidra verification was needed: JavaScript static analysis only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:11:45 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2913
No description provided.