Skip to content

refactor(core): decode SCIP into flat records - #562

Merged
fishmingyu merged 1 commit into
mainfrom
refactor/decoded-records
Aug 11, 2026
Merged

refactor(core): decode SCIP into flat records#562
fishmingyu merged 1 commit into
mainfrom
refactor/decoded-records

Conversation

@fishmingyu

Copy link
Copy Markdown
Member

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

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Performance improvement
  • Tests

Testing

  • Tests pass locally
  • Added new tests for the changes
  • pre-commit run --files <11 changed files>
  • make core-test — 7 passed, 4 skipped
  • python -m mkdocs build --strict

Checklist

  • My code follows the project style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

@github-actions github-actions Bot added the type/docs Documentation label Aug 11, 2026
@fishmingyu fishmingyu added the full-ci Run the hosted unit gate while a pull request is draft label Aug 11, 2026
@fishmingyu
fishmingyu marked this pull request as ready for review August 11, 2026 01:51

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread core/scip_decode_base.cpp
Comment on lines 375 to +377
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));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread core/scip_decode_base.cpp
records.vertices.reserve(merged_nodes.size() + 1);
CodeGraph::VertexData root;
root.name = ROOT_NODE;
root.type = "root";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@fishmingyu
fishmingyu merged commit 7ef0a35 into main Aug 11, 2026
6 of 7 checks passed
@fishmingyu
fishmingyu deleted the refactor/decoded-records branch August 11, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-ci Run the hosted unit gate while a pull request is draft type/docs Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(core): decode SCIP into provider-neutral flat records

1 participant