Skip to content

refactor: replace graph core with deterministic directed multigraph - #583

Merged
mohanagy merged 5 commits into
core-resetfrom
core-reset-directed-multigraph
Jul 21, 2026
Merged

mohanagy merged 5 commits into
core-resetfrom
core-reset-directed-multigraph

Conversation

@mohanagy

@mohanagy mohanagy commented Jul 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • replace the predecessor graph path with one always-directed multigraph domain under src/domain/graph/**
  • give every node and semantic edge fact deterministic IDs, preserve parallel/opposite-direction edges, and round-trip metadata, attributes, evidence, provenance, and confidence exactly
  • introduce one strict madar.graph artifact schema, reject old artifacts with madar generate . --update, and delete the legacy graph core plus HTML/SVG/GraphML/Cypher/Obsidian exporter surface

The application/filesystem boundary now builds and persists the canonical graph. Existing extractor, SPI, runtime, federation, and benchmark consumers were adapted mechanically; no second store, V1/V2 mode, converter, fallback loader, feature flag, runtime dependency, or repository-specific retrieval rule was added.

Testing

  • npm run test:run -- --maxWorkers=1 — 205/205 files; 2,820 passed, 2 skipped (current-head CI)
  • npx vitest run tests/unit/core-reset-baseline.test.ts tests/unit/directed-multigraph.test.ts tests/unit/core-reset-governance.test.ts --maxWorkers=1 — 35/35
  • npx vitest run tests/unit/retrieve.test.ts tests/unit/compare-native-agent.test.ts tests/unit/core-reset-governance.test.ts --maxWorkers=1 — 193/193
  • npm run test:coverage -- --maxWorkers=1 — 205/205 files; 85.23% statements, 76.82% branches, 91.56% functions, 85.70% lines
  • generated-demo CI eval — 100% recall, 1.000 MRR, 100% snippet coverage
  • npm run typecheck
  • npm run build
  • npm run release:verify
  • npm run registry:validate
  • npm run verify:pack-parity
  • node tools/eval/core-reset/verify-isolation.mjs
  • npm audit
  • npm run pack:dry-run
  • git diff --check

Core Reset contract

  • RFC requirement: [RFC]: Madar Core Reset — narrow TypeScript semantic-path engine #577 Directed multigraph phase
  • Parent issue: [Core Reset]: Replace the graph core with a deterministic directed multigraph #582
  • Removal-manifest IDs: directed-multigraph (rebuild), provenance (preserved contract)
  • Exit gate: parallel relationship kinds, opposite directions, deterministic IDs, and exact evidence/provenance serialization survive build, store, and load
  • Production inventory: 178 TypeScript files / 93,792 LOC
  • Production LOC added: 1,197
  • Production LOC removed: 4,171
  • Net production LOC: -2,974
  • New production files: 5 of 8 maximum
  • Dependencies added: 0
  • Superseded paths deleted:
    • src/contracts/graph.ts
    • src/pipeline/build.ts
    • src/pipeline/export.ts
    • src/core/schema/normalize.ts
    • src/runtime/direction.ts
    • src/pipeline/export/community-summary.ts
    • src/pipeline/export/overview-bridges.ts
    • src/pipeline/export/overview-navigation.ts

Reset scope checks

  • This PR is governed by accepted RFC [RFC]: Madar Core Reset — narrow TypeScript semantic-path engine #577
  • This replaces and deletes the owned predecessor path
  • No permanent fallback or parallel implementation was added
  • No evaluation-repository-specific production logic was added under src/
  • Production does not import development-only evaluation tooling
  • The removal manifest, scorecard, and roadmap were updated
  • The frozen v0.32.0 baseline receipt is unchanged

Checklist

  • I updated docs for user-visible artifact and command changes
  • I added focused graph invariant, serialization, migration-error, and consumer regression tests
  • This PR excludes private corpora, secrets, credentials, proprietary prompts, sensitive raw logs, and accidental generated artifacts
  • This PR is limited to the Directed multigraph replacement and mechanical consumer adaptations

Related issues

Closes #582

Summary by CodeRabbit

  • New Features
    • Introduced a stricter, canonical directed graph.json artifact format with deterministic IDs and stronger load/save validation.
  • Changes
    • generate/watch and related guidance now focus on graph.json + GRAPH_REPORT.md (and optional wiki), removing legacy HTML/export options; runtime no longer serves graph.html.
    • Retrieval/analysis behavior improves around multi-edge relationship handling, with edge-identity details surfaced in outputs.
    • Error responses now emphasize regenerating outdated/invalid artifacts.
  • Documentation
    • Updated tutorials, benchmarks, and proof guidance to match the new command/output expectations (including dropping --no-html references).
  • Chores
    • CI and benchmark runner commands adjusted to align with the updated generation flow.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR replaces the legacy graph core with a deterministic directed multigraph domain (src/domain/graph), adds canonical JSON serialization and artifact I/O, rewrites the extraction-to-graph build pipeline, deletes legacy export/HTML/Obsidian/Cypher/GraphML surfaces, removes CLI flags (--no-html, --directed/--undirected, export toggles), updates all runtime/infrastructure consumers to the new relation-based graph API, and updates governance docs and extensive tests.

Changes

Directed Multigraph Core Reset

Layer / File(s) Summary
Directed multigraph domain, canonical JSON, and artifact serialization
src/domain/graph/directed-multigraph.ts, src/domain/graph/canonical-json.ts, src/domain/graph/artifact.ts, src/adapters/filesystem/graph-artifact.ts, tests/unit/directed-multigraph.test.ts, tests/helpers/graph-artifact.ts, tests/fixtures/federation-flagship/*/graph.json
Adds a deterministic directed multigraph with hashed edge identity, canonical JSON serialization/deserialization, filesystem artifact adapters, and updated fixtures/tests.
Extraction-to-graph application layer and pipeline consumers
src/application/build-graph.ts, src/pipeline/{analyze,cluster,community-details,community-naming,docs,extract,federate,report,wiki}.ts, src/pipeline/extract/frameworks/redux.ts, src/pipeline/spi/*, tests/unit/{analyze,build,cluster,community-*,extract-*,federate,normalize,pipeline,report,schema-v2,spi-*,wiki}.test.ts
Adds the buildGraph/buildGraphFromExtraction application layer and updates all pipeline modules and tests to the new relation-based graph query API.
CLI options, generation policy, and infra graph-artifact wiring
src/cli/{main,parser}.ts, src/contracts/generation-policy.ts, src/infrastructure/{generate,generation-policy,watch,try-command,time-travel,doctor,background-auto-refresh,install-skill-templates,neo4j,compare,benchmark/*}.ts, src/shared/{discovery-safety,graph-source-root}.ts, src/runtime/freshness.ts, plus corresponding tests
Removes noHtml/directed/export CLI flags, drops the directed generation-policy setting, and switches infra modules to load/write canonical graph artifacts including graph-content-hash-based freshness caching.
Runtime retrieval, impact, serve, and stdio consumers
src/runtime/{retrieve*,impact,implementation-pack,pr-impact,graph-summary,risk-map,relevant-files,feature-map,serve,http-server,stdio-*,context-pack*,diff,time-travel}.ts, src/infrastructure/{context-pack-command,context-prompt-command,handoff-command}.ts, plus extensive corresponding tests
Migrates runtime consumers to relation-kind-based graph queries (relationKindsBetween, bestRelationBetween, edgesBetween, successors) and removes directed-graph guards.
Documentation, CI, and governance updates
docs/**, .github/**, tools/eval/core-reset/*, tests/unit/{core-reset-governance,getting-started-docs,why-madar-doc}.test.ts
Updates roadmap/scorecard/removal-manifest, CLI/MCP reference, tutorials, and CI to remove --no-html/directed-mode references and reflect the new graph.json artifact contract.

Estimated code review effort: 5 (Critical) | ~150 minutes

Possibly related issues

Possibly related PRs

  • mohanagy/madar#572: Both PRs touch generation policy at the contract level in src/contracts/generation-policy.ts—this PR removes the directed setting while #572 adds extraction_mode support.
  • mohanagy/madar#579: Both PRs update Core Reset governance docs (docs/roadmap.md, docs/core-reset/removal-manifest.yml, docs/core-reset/scorecard.md).
  • mohanagy/madar#460: Both PRs overlap on removing the madar add command/parseAddArgs wiring from the CLI.

Suggested labels: core-reset

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR also changes CLI/parser and installer/template surfaces, including removing madar add and other options, which are outside the graph-core scope. Remove the CLI/installer surface edits or split them into a separate PR, keeping this change focused on the directed multigraph and its consumer adaptations.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.81% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes align with #582: they add the directed multigraph, deterministic artifacts, delete the five predecessor paths, and update consumers/tests.
Title check ✅ Passed The title clearly summarizes the main change: replacing the graph core with a deterministic directed multigraph.
Description check ✅ Passed The description follows the required template and includes all major sections, filled testing evidence, core reset details, checklist, and related issue reference.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch core-reset-directed-multigraph

Comment @coderabbitai help to get the list of available commands.

@mohanagy

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mohanagy

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mohanagy

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/pipeline/community-details.ts (1)

88-121: 🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win

communityDetailsMid/communityDetailsMacro each do multiple full-graph edgeEntries() scans per community.

edge_count, externalInDegree, and exitPointMap in communityDetailsMid (Lines 88-99, 110-116) each iterate every edge in the whole graph and filter by community membership, and communityDetailsMacro (Lines 187-200) does the same again. This replaces the prior degree-bounded incidentNeighbors traversal with an O(E) full scan, repeated per function. Since docs.ts's generateDocs calls communityDetailsMid once per community (for every community with >1 node), total cost becomes O(communities × E), which for a large codebase with many communities can be significantly more expensive than the previous approach.

Consider bounding these to the community's own nodes using the existing graph.successors(nodeId)/graph.predecessors(nodeId) plus graph.edgesBetween(...), so the work scales with community size × average degree instead of total edge count.

Also applies to: 187-200

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pipeline/community-details.ts` around lines 88 - 121, Update
communityDetailsMid and communityDetailsMacro to avoid full-graph edgeEntries()
scans for edge_count, externalInDegree, and exitPointMap. Traverse only each
community’s node IDs using graph.successors(), graph.predecessors(), and
graph.edgesBetween(), while preserving the existing membership filters, counts,
labels, and five-item limits.
🧹 Nitpick comments (1)
src/runtime/http-server.ts (1)

232-236: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

/graph.json now double-parses the artifact per request.

loadGraph(graphPath) fully deserializes the artifact (validateGraphPath + statSync + readFileSync + JSON parse) purely to trigger the regeneration-error check, and its result is discarded; the raw bytes are then read again via a second readFileSync. On a frequently-hit endpoint this doubles I/O and CPU cost per request for no functional benefit beyond validation.

Consider reusing the already-loaded/cached graph() loader (used by /stats, /community, etc.) for validation instead of a fresh loadGraph call, or skip the eager validation and let a parse failure surface naturally when needed.

♻️ Possible approach
       if (url.pathname === '/graph.json') {
-        loadGraph(graphPath)
+        graph()
         sendText(response, 200, readFileSync(graphPath, 'utf8'), 'application/json; charset=utf-8', resourceFreshnessHeaders(resourceFreshnessMetadata(graphPath, graphPath)))
         return
       }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/runtime/http-server.ts` around lines 232 - 236, Remove the discarded
loadGraph(graphPath) call from the /graph.json handler to avoid parsing and
reading the artifact twice per request. Reuse the existing cached graph() loader
for validation if that check must remain; otherwise rely on the subsequent
response read and its natural parse/error behavior, while preserving the current
response payload and headers.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 36-37: Update the actions/checkout configuration associated with
fetch-depth to set persist-credentials to false, preventing the GITHUB_TOKEN
from being stored in the repository’s Git configuration. Preserve the existing
checkout behavior and fetch-depth setting; do not add authenticated Git
operations unless they are already required later in the job.

In `@src/domain/graph/directed-multigraph.ts`:
- Around line 222-229: Update the directed multigraph’s degree bookkeeping so
degree(id) reads an O(1) per-node counter instead of scanning edgeMap. Add and
maintain that counter in the graph state, increment it for both source and
target endpoints in addEdge (including twice for self-loops and once per
parallel edge), and preserve the existing degree result semantics.

In `@src/pipeline/analyze.ts`:
- Around line 955-964: Update graphDiff’s edge comparison around oldEdges,
newEdges, newEdgesList, and removedEdgesList to detect edges sharing the same
identity whose attributes, including confidence or confidence_score, changed.
Surface these attribute-only changes in the diff using the existing output
contract, such as paired old/new entries or a changed_edges collection, and add
regression coverage for a confidence-only change.

In `@src/pipeline/extract/frameworks/redux.ts`:
- Around line 1114-1118: The node construction in the Redux extraction flow must
apply the computed sourceLine even when baseNode exists. Update the addNode call
around baseNode and createNode so the copied node uses sourceLine for its
location and matching provenance while preserving baseNode’s extra attributes;
keep the existing fallback behavior for nodes without a baseNode.

---

Outside diff comments:
In `@src/pipeline/community-details.ts`:
- Around line 88-121: Update communityDetailsMid and communityDetailsMacro to
avoid full-graph edgeEntries() scans for edge_count, externalInDegree, and
exitPointMap. Traverse only each community’s node IDs using graph.successors(),
graph.predecessors(), and graph.edgesBetween(), while preserving the existing
membership filters, counts, labels, and five-item limits.

---

Nitpick comments:
In `@src/runtime/http-server.ts`:
- Around line 232-236: Remove the discarded loadGraph(graphPath) call from the
/graph.json handler to avoid parsing and reading the artifact twice per request.
Reuse the existing cached graph() loader for validation if that check must
remain; otherwise rely on the subsequent response read and its natural
parse/error behavior, while preserving the current response payload and headers.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9d18b3f1-0765-45a5-9486-30c427b81b4c

📥 Commits

Reviewing files that changed from the base of the PR and between 647c291 and bcff6a4.

📒 Files selected for processing (191)
  • .github/ISSUE_TEMPLATE/design_partner_report.yml
  • .github/workflows/ci.yml
  • docs/auto-refresh.md
  • docs/benchmarks/2026-05-02-govalidate-pr-review/README.md
  • docs/benchmarks/2026-05-11-spi-vs-legacy/README.md
  • docs/benchmarks/2026-05-11-spi-vs-legacy/run.sh
  • docs/claims-and-evidence.md
  • docs/core-reset/removal-manifest.yml
  • docs/core-reset/scorecard.md
  • docs/design-partners.md
  • docs/proof-workflows.md
  • docs/reference/cli-and-mcp.md
  • docs/roadmap.md
  • docs/share-safe-dashboard-decision.md
  • docs/tutorials/agent-quickstarts.md
  • docs/tutorials/getting-started.md
  • docs/tutorials/sample-workspace.md
  • examples/sample-workspace/README.md
  • src/adapters/filesystem/graph-artifact.ts
  • src/application/build-graph.ts
  • src/cli/main.ts
  • src/cli/parser.ts
  • src/contracts/generation-policy.ts
  • src/contracts/graph.ts
  • src/core/schema/normalize.ts
  • src/domain/graph/artifact.ts
  • src/domain/graph/canonical-json.ts
  • src/domain/graph/directed-multigraph.ts
  • src/infrastructure/background-auto-refresh.ts
  • src/infrastructure/benchmark.ts
  • src/infrastructure/benchmark/generate-performance.ts
  • src/infrastructure/benchmark/quality.ts
  • src/infrastructure/benchmark/questions.ts
  • src/infrastructure/benchmark/runner.ts
  • src/infrastructure/benchmark/suite.ts
  • src/infrastructure/compare.ts
  • src/infrastructure/context-pack-command.ts
  • src/infrastructure/context-prompt-command.ts
  • src/infrastructure/doctor.ts
  • src/infrastructure/generate.ts
  • src/infrastructure/generation-policy.ts
  • src/infrastructure/handoff-command.ts
  • src/infrastructure/install-skill-templates.ts
  • src/infrastructure/neo4j.ts
  • src/infrastructure/time-travel.ts
  • src/infrastructure/try-command.ts
  • src/infrastructure/watch.ts
  • src/pipeline/analyze.ts
  • src/pipeline/build.ts
  • src/pipeline/cluster.ts
  • src/pipeline/community-details.ts
  • src/pipeline/community-naming.ts
  • src/pipeline/docs.ts
  • src/pipeline/export.ts
  • src/pipeline/export/community-summary.ts
  • src/pipeline/export/overview-bridges.ts
  • src/pipeline/export/overview-navigation.ts
  • src/pipeline/extract.ts
  • src/pipeline/extract/frameworks/redux.ts
  • src/pipeline/federate.ts
  • src/pipeline/report.ts
  • src/pipeline/spi/index.ts
  • src/pipeline/spi/projector.ts
  • src/pipeline/wiki.ts
  • src/runtime/context-pack-recovery.ts
  • src/runtime/context-pack.ts
  • src/runtime/diff.ts
  • src/runtime/direction.ts
  • src/runtime/feature-map.ts
  • src/runtime/freshness.ts
  • src/runtime/graph-summary.ts
  • src/runtime/http-server.ts
  • src/runtime/impact.ts
  • src/runtime/implementation-checklist.ts
  • src/runtime/implementation-pack.ts
  • src/runtime/pr-impact.ts
  • src/runtime/relevant-files.ts
  • src/runtime/retrieve.ts
  • src/runtime/retrieve/conceptual-fallback.ts
  • src/runtime/retrieve/slicing.ts
  • src/runtime/risk-map.ts
  • src/runtime/serve.ts
  • src/runtime/stdio-server.ts
  • src/runtime/stdio/prompts.ts
  • src/runtime/stdio/resources.ts
  • src/runtime/stdio/tools.ts
  • src/runtime/time-travel.ts
  • src/shared/discovery-safety.ts
  • src/shared/graph-source-root.ts
  • tests/fixtures/cross-layer-monitor-flow.ts
  • tests/fixtures/federation-flagship/backend/graph.json
  • tests/fixtures/federation-flagship/frontend/graph.json
  • tests/fixtures/federation-flagship/shared/graph.json
  • tests/fixtures/madar-self-retrieval.ts
  • tests/helpers/graph-artifact.ts
  • tests/unit/analyze.test.ts
  • tests/unit/background-auto-refresh.test.ts
  • tests/unit/benchmark-quality.test.ts
  • tests/unit/benchmark-suite.test.ts
  • tests/unit/benchmark.test.ts
  • tests/unit/build.test.ts
  • tests/unit/cli.test.ts
  • tests/unit/cluster.test.ts
  • tests/unit/community-details.test.ts
  • tests/unit/community-naming.test.ts
  • tests/unit/compare-native-agent.test.ts
  • tests/unit/compare.test.ts
  • tests/unit/context-pack-adapter-gating.test.ts
  • tests/unit/context-pack-command.test.ts
  • tests/unit/context-pack-recovery.test.ts
  • tests/unit/context-prompt-command.test.ts
  • tests/unit/core-reset-governance.test.ts
  • tests/unit/directed-multigraph.test.ts
  • tests/unit/doctor.test.ts
  • tests/unit/export.test.ts
  • tests/unit/extract-duplicate-file-stems.test.ts
  • tests/unit/extract-frameworks.test.ts
  • tests/unit/extract-go.test.ts
  • tests/unit/extract-tsconfig-alias-cross-file.test.ts
  • tests/unit/feature-map.test.ts
  • tests/unit/federate.test.ts
  • tests/unit/freshness-surfaces.test.ts
  • tests/unit/generate-spi-flag.test.ts
  • tests/unit/generate.test.ts
  • tests/unit/generation-policy.test.ts
  • tests/unit/getting-started-docs.test.ts
  • tests/unit/graph-summary.test.ts
  • tests/unit/handoff-command.test.ts
  • tests/unit/helpers/pack-quality.ts
  • tests/unit/http-server.test.ts
  • tests/unit/impact.test.ts
  • tests/unit/implementation-checklist.test.ts
  • tests/unit/implementation-pack.test.ts
  • tests/unit/indexing-completeness.test.ts
  • tests/unit/indexing-generate.test.ts
  • tests/unit/mcp-response-evidence.test.ts
  • tests/unit/neo4j.test.ts
  • tests/unit/normalize.test.ts
  • tests/unit/pack-quality-helper.test.ts
  • tests/unit/pipeline-stage-characterization.test.ts
  • tests/unit/pipeline.test.ts
  • tests/unit/pr-impact.test.ts
  • tests/unit/proof-report.test.ts
  • tests/unit/relevant-files.test.ts
  • tests/unit/report.test.ts
  • tests/unit/retrieval-gate-entry-points.test.ts
  • tests/unit/retrieval-gate-override-surface.test.ts
  • tests/unit/retrieval-pipeline-stages.test.ts
  • tests/unit/retrieve-conceptual-fallback.test.ts
  • tests/unit/retrieve-cross-layer-flow.test.ts
  • tests/unit/retrieve-framework-boost-v0-19.test.ts
  • tests/unit/retrieve-go.test.ts
  • tests/unit/retrieve-metadata-boost-133.test.ts
  • tests/unit/retrieve-production-correctness.test.ts
  • tests/unit/retrieve-prompt-symbol-boost.test.ts
  • tests/unit/retrieve-retrieval-levels.test.ts
  • tests/unit/retrieve-self-hosted-concepts.test.ts
  • tests/unit/retrieve-semantic.test.ts
  • tests/unit/retrieve-slice-surface.test.ts
  • tests/unit/retrieve-slice-v1.test.ts
  • tests/unit/retrieve.test.ts
  • tests/unit/review-compare.test.ts
  • tests/unit/risk-map.test.ts
  • tests/unit/sample-workspace.test.ts
  • tests/unit/schema-v2.test.ts
  • tests/unit/serve-queries.test.ts
  • tests/unit/serve.test.ts
  • tests/unit/spi-nest-di-runtime-calls-realistic.test.ts
  • tests/unit/spi-nest-di-runtime-calls.test.ts
  • tests/unit/spi-projector.test.ts
  • tests/unit/spi-routing-controllers-runtime.test.ts
  • tests/unit/spi-scoped-root-tsconfig.test.ts
  • tests/unit/stdio-pr-impact.test.ts
  • tests/unit/stdio-prompts.test.ts
  • tests/unit/stdio-resources.test.ts
  • tests/unit/stdio-semantic-resilience.test.ts
  • tests/unit/stdio-semantic.test.ts
  • tests/unit/stdio-server.test.ts
  • tests/unit/stdio-slice-surface.test.ts
  • tests/unit/stdio-tool-profile.test.ts
  • tests/unit/time-travel-infrastructure.test.ts
  • tests/unit/time-travel.review-regressions.test.ts
  • tests/unit/time-travel.test.ts
  • tests/unit/try-command.test.ts
  • tests/unit/watch.test.ts
  • tests/unit/why-madar-doc.test.ts
  • tests/unit/wiki.test.ts
  • tests/unit/workspace.test.ts
  • tests/unit/worktree-cli-artifacts.test.ts
  • tools/eval/core-reset/README.md
  • tools/eval/core-reset/record-baseline.mjs
💤 Files with no reviewable changes (16)
  • src/core/schema/normalize.ts
  • src/pipeline/export/overview-bridges.ts
  • src/contracts/graph.ts
  • src/pipeline/build.ts
  • src/pipeline/export/overview-navigation.ts
  • src/runtime/direction.ts
  • src/infrastructure/benchmark/suite.ts
  • docs/auto-refresh.md
  • tests/unit/pack-quality-helper.test.ts
  • src/pipeline/export.ts
  • src/pipeline/export/community-summary.ts
  • tests/unit/helpers/pack-quality.ts
  • src/infrastructure/background-auto-refresh.ts
  • tests/unit/export.test.ts
  • src/cli/main.ts
  • tests/unit/benchmark-suite.test.ts

Comment thread .github/workflows/ci.yml Resolved
Comment thread src/domain/graph/directed-multigraph.ts Resolved
Comment thread src/pipeline/analyze.ts Resolved
@mohanagy

Copy link
Copy Markdown
Owner Author

Review follow-up for head 50778ca:

Addressed all six substantive CodeRabbit findings:

  • hardened checkout with persist-credentials: false
  • restored O(1) multigraph degree lookup while preserving parallel, reverse, duplicate, and self-loop semantics
  • made graphDiff report same-ID attribute/confidence changes with paired old/new evidence
  • corrected Redux exported-member locations and provenance when a base node exists
  • replaced repeated community-wide edge scans with indexed adjacency traversal
  • made /graph.json validate and serve the same size-bounded bytes, cache validation by a full content hash, and derive response version/ETag/byte metadata from those exact bytes

The two generic warnings were investigated and intentionally require no code change:

  • madar add was already removed in v0.27.6, absent from help and command dispatch, and tested as an unknown command on the protected base. The deleted parser type was unreachable residue, not a public-surface removal in this PR.
  • An 80% docstring target is not configured in .coderabbit.yaml, CI, or package scripts, and the protected base does not meet such a policy. Adding blanket comments would consume the phase's hard production-LOC budget without improving the graph contract.

Final local evidence: 205/205 test files and 2,819 tests passed (2 skipped); coverage gates passed; typecheck/build/release/registry/pack parity/isolation/audit/pack dry-run passed; generated-demo eval reached 100% recall, 1.000 MRR, and 100% snippet coverage. Production delta is +1,192 / -4,157 / net -2,965 with zero dependency additions.

@mohanagy

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/runtime/freshness.ts (1)

408-412: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Validate and hash the same bounded artifact bytes.

loadGraphArtifact() validates one read, then readFileSync() hashes another. A concurrent rewrite can therefore publish a version for unvalidated bytes; the mtime/size cache can also skip validation after a same-metadata replacement. Read once with readGraphArtifact(), validate that string, and hash that same string before any cache return.

Proposed fix
-  loadGraphArtifact(safeGraphPath)
-  const graphVersion = createHash('sha256').update(readFileSync(safeGraphPath)).digest('hex').slice(0, VERSION_HASH_LENGTH)
+  const artifact = readGraphArtifact(safeGraphPath)
+  deserializeGraphArtifact(artifact)
+  const graphVersion = createHash('sha256').update(artifact).digest('hex').slice(0, VERSION_HASH_LENGTH)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/runtime/freshness.ts` around lines 408 - 412, Update the freshness
artifact flow around loadGraphArtifact and the graphVersion calculation to call
readGraphArtifact once and retain its bounded string result. Validate that same
string, then hash those exact bytes before any cache return, eliminating the
separate readFileSync call and ensuring concurrent rewrites or same-metadata
replacements cannot produce an unvalidated version.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/unit/http-server.test.ts`:
- Line 197: Remove the duplicate const handle declarations in each affected test
block around startGraphServer, including the blocks at the referenced locations.
Retain a single handle declaration per test and preserve the existing server
setup and usage.

---

Outside diff comments:
In `@src/runtime/freshness.ts`:
- Around line 408-412: Update the freshness artifact flow around
loadGraphArtifact and the graphVersion calculation to call readGraphArtifact
once and retain its bounded string result. Validate that same string, then hash
those exact bytes before any cache return, eliminating the separate readFileSync
call and ensuring concurrent rewrites or same-metadata replacements cannot
produce an unvalidated version.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9f74ba58-bc4f-4323-9d07-d2d1f299df29

📥 Commits

Reviewing files that changed from the base of the PR and between bcff6a4 and 50778ca.

📒 Files selected for processing (18)
  • .github/workflows/ci.yml
  • docs/core-reset/removal-manifest.yml
  • docs/core-reset/scorecard.md
  • docs/roadmap.md
  • src/adapters/filesystem/graph-artifact.ts
  • src/application/build-graph.ts
  • src/domain/graph/artifact.ts
  • src/domain/graph/directed-multigraph.ts
  • src/pipeline/analyze.ts
  • src/pipeline/community-details.ts
  • src/pipeline/extract/frameworks/redux.ts
  • src/runtime/freshness.ts
  • src/runtime/http-server.ts
  • tests/unit/analyze.test.ts
  • tests/unit/community-details.test.ts
  • tests/unit/directed-multigraph.test.ts
  • tests/unit/extract-frameworks.test.ts
  • tests/unit/http-server.test.ts
🚧 Files skipped from review as they are similar to previous changes (13)
  • .github/workflows/ci.yml
  • src/adapters/filesystem/graph-artifact.ts
  • docs/core-reset/scorecard.md
  • tests/unit/community-details.test.ts
  • src/domain/graph/artifact.ts
  • docs/roadmap.md
  • tests/unit/directed-multigraph.test.ts
  • src/application/build-graph.ts
  • docs/core-reset/removal-manifest.yml
  • src/domain/graph/directed-multigraph.ts
  • src/pipeline/analyze.ts
  • tests/unit/extract-frameworks.test.ts
  • src/pipeline/extract/frameworks/redux.ts

Comment thread tests/unit/http-server.test.ts Resolved
@mohanagy

Copy link
Copy Markdown
Owner Author

Follow-up for CodeRabbit incremental review on head 7524162:

  • Fixed the valid freshness finding: graphVersionForPath now performs one bounded artifact read, hashes those exact bytes before any cache return, validates changed bytes with deserializeGraphArtifact, and caches only the full validated content hash. Same-size/same-mtime rewrite and unsupported-schema regressions were added.
  • Verified the duplicate-handle report as a false positive: the declarations at the referenced locations are in separate test(...) scopes and there is exactly one per scope. Typecheck, build, and focused HTTP/freshness tests pass; the thread contains that evidence and is resolved.

Focused verification: 69/69 tests, typecheck, build, packed-runtime parity, Core Reset isolation, audit, and diff checks are green. Updated production evidence: 178 TypeScript files / 93,792 LOC, +1,197 / -4,171 / net -2,974, zero dependencies.

@mohanagy

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

1 participant