Skip to content

feat(impact): hazard-aware blast radius + docs refresh - #121

Merged
CodeWithJuber merged 3 commits into
masterfrom
claude/repo-review-agentic-generics-tteyld
Aug 7, 2026
Merged

feat(impact): hazard-aware blast radius + docs refresh#121
CodeWithJuber merged 3 commits into
masterfrom
claude/repo-review-agentic-generics-tteyld

Conversation

@CodeWithJuber

Copy link
Copy Markdown
Owner

What & why

Two commits delivering a docs refresh and a data-driven upgrade to forge impact:

Commit A — docs/diagrams refresh (fix):

  • ARCHITECTURE.md repo layout and component descriptions updated for rank.js, collide.js, docs_render.js
  • mintlify Labs card now lists rank and collide
  • Mermaid theme normalization extended to .mdx files (6 mintlify diagrams were rendering in default blue/grey instead of the branded palette)
  • trackedMarkdown() and markdownFiles() widened from *.md to *.md *.mdx
  • normalizeMermaid() now injects branded %%{init into bare mermaid blocks (previously only replaced existing init lines)

Commit B — hazard-aware impact analysis (feat):
Replace hardcoded impact constants with data-driven enhancements that fuse the code graph with team memory:

  • SCC-aware propagation: when a file in a circular-dependency cluster is impacted, all co-members are impacted at the same confidence (via Tarjan SCC from rank.cycles()). A change to any file in a cycle effectively changes them all.
  • Hazard-adjusted threshold: effectiveThreshold = base / (1 + hazard), where hazard is derived from PageRank centrality × ledger incident history. No new constants — purely data-driven from existing infrastructure.
  • buildSccIndex() helper, loadRankData() assembler, wired through CLI (--basic flag), cortex_mcp, and imagine. consensus/gate left on basic impact (hot path).
  • 4 new tests: SCC propagation, hazard threshold, combined, fail-open backwards compatibility.

Checklist

  • npm test passes (1115 pass, 2 skipped, 0 fail)
  • npm run check passes (only pre-existing warnings in dash.html/init.js/gateway_model_map.js)
  • New public functions have a test (buildSccIndex, enhanced impact() with 4 new tests)
  • Conventional commit message (fix: + feat:)
  • CHANGELOG.md updated under ## [Unreleased]
  • No new runtime dependency
  • Substrate/docs updated — ARCHITECTURE.md, GUIDE.md, README.md (auto-rendered), mintlify/cli/substrate.mdx, commands.js

Risk & rollback

  • Risk level: low — fail-open design; sccIndex/hazards default to undefined and impact() behaves identically to pre-enhancement. --basic flag reverts to fixed-threshold mode.
  • Rollback plan: revert commit B; commit A is a pure docs fix with no risk.

Extra checks (tick if applicable)

  • npm run typecheck passes
  • Input validated at boundaries; errors handled (loadRankData catches all errors and returns undefined)
  • If AI-assisted: I understand it, verified the package APIs, and it has tests

Generated by Claude Code

claude added 2 commits August 7, 2026 15:16
- ARCHITECTURE.md: add rank.js, collide.js, docs_render.js to repo
  layout tree and component descriptions
- mintlify/cli/overview.mdx: add rank and collide to Labs card
- docs_render.js: widen trackedMarkdown glob to *.md + *.mdx so
  normalizeMermaid auto-applies the branded theme to mintlify diagrams;
  inject init line into bare mermaid blocks (was skip-only)
- docs_check.js: widen markdownFiles to *.md + *.mdx so diagram checks
  cover mintlify files
- 6 mintlify mermaid diagrams now carry the branded %%{init theme
- Updated normalizeMermaid test for the new inject behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LXmzxfRVDRVPU6LG8W39Rz
…a-driven threshold

Replace hardcoded impact constants with data-driven enhancements that fuse
the code graph with team memory:

- SCC-aware propagation: when a file in a circular-dependency cluster is
  impacted, all co-members are impacted at the same confidence (via Tarjan
  SCC from rank.cycles()). A change to any file in a cycle effectively
  changes them all — ignoring this was the biggest source of false negatives.

- Hazard-adjusted threshold: files that are both structurally critical AND
  have historically broken get a lower inclusion threshold:
  effectiveThreshold = base / (1 + hazard), where hazard is derived from
  PageRank centrality and ledger incident history. No new constants — every
  enhancement is computed from existing infrastructure.

- buildSccIndex() helper in atlas.js, loadRankData() assembler in
  substrate.js, wired through cli.js (--basic flag), cortex_mcp.js, and
  imagine.js. consensus.js and gate.js left on basic impact (hot path).

- 4 new tests: SCC propagation, hazard threshold, combined, fail-open
  backwards compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LXmzxfRVDRVPU6LG8W39Rz
Sort imports alphabetically (rank.js before reuse.js, loadRankData
before predictFailingTests) and restore 100-column formatting that
the environment hook had collapsed to 80 columns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LXmzxfRVDRVPU6LG8W39Rz
@CodeWithJuber
CodeWithJuber marked this pull request as ready for review August 7, 2026 15:51
@CodeWithJuber
CodeWithJuber merged commit e09eb38 into master Aug 7, 2026
13 checks 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.

2 participants