refactor(core): decode SCIP into flat records - #562
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f1e2f140fe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for (auto &[name, node] : merged_nodes) { | ||
| flat_nodes.emplace_back(std::move(node.data)); | ||
| if (name != ROOT_NODE) | ||
| records.vertices.emplace_back(std::move(node.data)); |
There was a problem hiding this comment.
Sort vertices before assigning indexed IDs
When the same index is decoded with different standard-library implementations or builds, iteration over merged_nodes is not stable because it is an unordered_map, so both the returned vertex order and every indexed edge endpoint can change. This contradicts the new decode_records() contract in docs/core_cpp.md that promises deterministic vertex ordering and can make downstream serialized fact batches or cache keys non-reproducible; sort the nodes or preserve deterministic insertion order before constructing vertex_ids.
Useful? React with 👍 / 👎.
| records.vertices.reserve(merged_nodes.size() + 1); | ||
| CodeGraph::VertexData root; | ||
| root.name = ROOT_NODE; | ||
| root.type = "root"; |
There was a problem hiding this comment.
Replace the hard-coded root node type
The new record path introduces another literal graph node type, so a future vocabulary or schema change can update CodeGraph::add_root_node without updating decoded records, producing different root attributes depending on the entry point. Add the root type to the centralized node-type vocabulary and use a named constant here instead of "root".
AGENTS.md reference: AGENTS.md:L122-L123
Useful? React with 👍 / 👎.
Summary
Separate provider-neutral decoded SCIP records from graph materialization so later transports and indexes can consume one stable decode boundary.
Closes #559.
Changes
Type of Change
Testing
pre-commit run --files <11 changed files>make core-test— 7 passed, 4 skippedpython -m mkdocs build --strictChecklist