Skip to content

Fix/update rpg graph stats#83

Merged
QingtaoLi1 merged 3 commits into
mainfrom
fix/update-rpg-graph-stats
Jun 29, 2026
Merged

Fix/update rpg graph stats#83
QingtaoLi1 merged 3 commits into
mainfrom
fix/update-rpg-graph-stats

Conversation

@QingtaoLi1

Copy link
Copy Markdown
Contributor

Summary

  • Fix run_update_rpg() statistics so edge_count / edges_delta are computed from the serialized RPG JSON that is actually written to disk, rather than from updated_rpg.edges.
  • Add dependency graph stats to update/check outputs:
    • dep_nodes
    • dep_edges
    • dep_nodes_delta
    • dep_edges_delta
    • dep_to_rpg_map_size
  • Update /cmind.update_rpg instructions to display feature graph and dependency graph counts separately.
  • Extend tests to cover serialized RPG edge counts and embedded dependency graph stats.

Why

RPG.to_dict() merges dep-graph-derived semantic edges into the serialized rpg.json. The previous update_rpg result used len(updated_rpg.edges), so it could report edges_delta: 0 even when the
persisted RPG edge set changed substantially.

This makes the command output match the graph data users actually inspect via rpg.json and check_encode.py.

Test plan

  • Targeted pytest:

    uv run --with . --with pytest --with pytest-timeout python -m pytest -q tests/test_encode_commands.py tests/test_step4_integration.py -k "check_encode or run_update_rpg or update_rpg_template" --timeout=60
    
    Result:
    

5 passed, 39 deselected

  • Verified local check_encode output includes dependency graph stats:

{
"node_count": 7425,
"edge_count": 37004,
"dep_nodes": 2661,
"dep_edges": 5394
}

  • RPG edit impact review passed.

Notes

The full default smoke test still fails on existing unrelated repository-wide issues:

  • import path failures for top-level common / rpg imports during full-repo smoke
  • 7 unrelated stub detections

Those failures are not introduced by this PR; the scoped scripts import smoke passes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the RPG encoder CLI’s reporting so run_update_rpg() and check_encode.py surface statistics that reflect the graph data users actually inspect in rpg.json, including newly exposed dependency-graph counts and deltas.

Changes:

  • Compute edge_count / edges_delta in run_update_rpg() from the serialized RPG JSON payload written to disk, and add dependency-graph stats (dep_nodes, dep_edges, deltas, and dep_to_rpg_map_size).
  • Extend check_encode.py stats to include embedded dependency-graph counts.
  • Update /cmind.update_rpg template output text and extend tests to cover the new stats.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
CoderMind/scripts/rpg_encoder/run_update_rpg.py Computes update stats from serialized output and adds dep-graph stat fields.
CoderMind/scripts/rpg_encoder/check_encode.py Adds embedded dep-graph node/edge counts to returned stats.
CoderMind/templates/commands/update_rpg.md Splits feature-graph vs dependency-graph counts in user-facing instructions/output.
CoderMind/tests/test_step4_integration.py Adds assertions to validate serialized edge counts and dep-graph stats in update output.
CoderMind/tests/test_encode_commands.py Adds dep-graph stats coverage for check_encode() and template text assertions.
CoderMind/pyproject.toml Bumps package version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CoderMind/scripts/rpg_encoder/run_update_rpg.py Outdated
@QingtaoLi1 QingtaoLi1 requested a review from Bonytu June 29, 2026 08:58
…lat-format RPG JSON, the edges list includes hierarchy edges like contains/composes that are not emitted by RPG.to_dict() (which run_update_rpg writes back to disk). This makes edges_delta compare two different edge definitions (pre includes hierarchy edges, post does not), producing misleading deltas on repos that still have flat-format rpg.json.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@QingtaoLi1 QingtaoLi1 merged commit 6b79d9d into main Jun 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants