Skip to content

🧹 chore: commit the graphify code graph - #110

Merged
nstarman merged 4 commits into
GalacticDynamics:mainfrom
nstarman:claude/graphify-code-graph-987da0
Dec 3, 2026
Merged

nstarman merged 4 commits into
GalacticDynamics:mainfrom
nstarman:claude/graphify-code-graph-987da0

Conversation

@nstarman

@nstarman nstarman commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Commits the graphify code graph (graphify-out/graph.json, 203 nodes, 190 KB) so every clone and every coding agent can query the repository instead of grepping it. Extraction is local tree-sitter parsing, with no model call and no network.

What this adds

  • Scope and tracking. .graphifyignore limits the index to the package source under src/; tests, benchmarks, docs, CI, config and Markdown are all out. .gitignore tracks graph.json and nothing else in graphify-out/, and .gitattributes marks it generated and keeps it out of diffs.
  • Rebuild on commit. A graphify-update hook in .pre-commit-config.yaml, pinned to graphifyy==0.9.119 with no extras. It runs graphify update . --force on every commit, including commits that only delete files. Like a formatter, it rebuilds and fails; stage graph.json and commit again. The hook is skipped for pre-commit.ci (ci.skip) and for the precommit nox session behind the required Format check, because the graph is not byte-reproducible across platforms. The existing no-commit-to-branch skip is kept.
  • Hook exclusions. graph.json is excluded from check-added-large-files, end-of-file-fixer, prettier and codespell.
  • Weekly drift job. .github/workflows/graphify.yml rebuilds on Mondays (and on demand) and opens one pull request if the graph moved. It never pushes to main, and it uses sign-commits: true to satisfy the signed-commits ruleset.
  • Docs. A new AGENTS.md carrying the agent rules for the graph, a "The code graph" section in .github/CONTRIBUTING.md, and a one-line pointer in the README. There is no docs site, so no docs page.

Needs a maintainer

  • A milestone on this PR. main requires the "Milestone Check", which is pending with "Please set the milestone!". I did not pick one (open: v0.9.x, v0.10.0). The drift job picks the newest open milestone for its own pull requests, for the same reason.
  • A code-owner approval, since .github/ is covered by CODEOWNERS.
  • Run benchmarks fails with CodSpeed's Unsupported system, before any benchmark runs. This PR touches neither the workflow nor benchmarks/, and the check is not required.

The drift job mints a GitHub App token from the secrets GRAPHIFY_APP_ID and GRAPHIFY_APP_PRIVATE_KEY, which do not exist yet. github.token is read-only here and Actions may not open pull requests, and the repository has no other bot-PR credential. Until the App is created, the weekly run fails at the token step. That is deliberate and commented in the workflow.

Each clone also needs a one-time merge-driver setup (git will not take a merge-driver command from a tracked file); it is in the CONTRIBUTING section.

Checked

  • Rebuilding in two independent fresh clones gives byte-identical graph.json (sha256 e1cca85b…); the committed file is that one.
  • A commit that deleted a file shrank the graph in the same commit (checked before the scope was narrowed to src/).
  • Merging two branches that each changed a different file merges graph.json cleanly with the driver registered and conflicts without it.
  • A fresh clone answers graphify query with no build step.
  • nox -s precommit (the Format job's command) leaves the graph untouched and check-useless-excludes passes.
  • The drift job's steps, run by hand in a fresh clone: no drift on a clean tree, drift detected after adding a function. The workflow itself cannot be dispatched until it is on main.

🤖 Generated with Claude Code

The hook and the drift job both build with Python 3.12: the graph's communities differ on 3.11, so the repository's 3.11 floor is the wrong pin. The graph covers src/ only, so it cannot say which tests cover a symbol; CONTRIBUTING and AGENTS.md say so.

@nstarman
nstarman requested a review from a team as a code owner November 25, 2026 04:42
@github-actions github-actions Bot added 🔧 Add / update configuration Add or update configuration files. 👷 Add / update CI build system Add or update CI build system. 🙈 Add / update .gitignore Add or update a .gitignore file. 📝 Add / update documentation Add or update documentation. labels Nov 25, 2026
@codecov

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a1f89b8) to head (99e34d8).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #110   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           12        12           
  Lines          290       290           
=========================================
  Hits           290       290           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Track graphify-out/graph.json, rebuild it with a pinned graphify-update
commit hook, and tell contributors and agents it exists.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@nstarman
nstarman force-pushed the claude/graphify-code-graph-987da0 branch from b85adce to 69fff90 Compare December 1, 2026 03:32
Copilot AI lite review requested due to automatic review settings December 1, 2026 03:32

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.

🟡 Changes recommended

The change still has an unresolved critical cross-platform pre-commit hook issue (entry: env ... will break on Windows despite CI running windows-latest), alongside a minor documentation typo in AGENTS.md.

2 open issues
What changed in this PR

Adds a committed Graphify code graph and supporting contributor/automation scaffolding so humans and coding agents can query repository structure without grepping.

Changes:

  • Commit graphify-out/graph.json and configure Git attributes/ignore rules to treat it as generated and mergeable.
  • Add a graphify-update pre-commit hook (plus nox/CI adjustments) and a scheduled GitHub Actions workflow to detect drift and open a PR.
  • Document usage and contributor setup in AGENTS.md, .github/CONTRIBUTING.md, and README.md.
File Description
README.md Adds a pointer for contributors/agents to the code-graph docs.
noxfile.py Skips graphify-update during the nox “precommit” session run.
graphify-out/​graph.json Adds the committed Graphify graph snapshot.
AGENTS.md New agent-facing instructions for using the committed graph.
.pre-commit-config.yaml Adds/updates hooks and introduces the local graphify-update hook.
.graphifyignore Limits Graphify indexing scope to src/.
.gitignore Ignores all graphify-out/* except the tracked graph.json.
.github/​workflows/​graphify.yml Adds a scheduled/manual drift-check workflow that opens a PR on change.
.github/​CONTRIBUTING.md Documents the graph, rebuild behavior, and merge-driver setup.
.gitattributes Marks the graph as generated, disables diffs, and assigns a merge driver.

Review effort: Lite
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.

Comment thread .pre-commit-config.yaml Resolved
Comment thread AGENTS.md Resolved
…S.md run-on

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the 🐛 Fix a bug Fix a bug. label Dec 1, 2026
nstarman and others added 2 commits December 2, 2026 21:05
… are not indexed

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The graph's communities differ on 3.11, so both must build with the same Python.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@nstarman nstarman added this to the v0.10.0 milestone Dec 3, 2026
@nstarman
nstarman merged commit 16dce75 into GalacticDynamics:main Dec 3, 2026
20 of 21 checks passed
@nstarman
nstarman deleted the claude/graphify-code-graph-987da0 branch December 3, 2026 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

👷 Add / update CI build system Add or update CI build system. 🔧 Add / update configuration Add or update configuration files. 📝 Add / update documentation Add or update documentation. 🙈 Add / update .gitignore Add or update a .gitignore file. 🐛 Fix a bug Fix a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants