Skip to content

test: altimate tools — impact analysis DAG traversal and training import parsing#384

Merged
anandgupta42 merged 2 commits intomainfrom
claude/test-impact-training-20260322-session_01H7d93hQP5qAwYhLgRdkqhV
Mar 22, 2026
Merged

test: altimate tools — impact analysis DAG traversal and training import parsing#384
anandgupta42 merged 2 commits intomainfrom
claude/test-impact-training-20260322-session_01H7d93hQP5qAwYhLgRdkqhV

Conversation

@anandgupta42
Copy link
Contributor

What does this PR do?

Adds 20 new tests for two recently added tools (impact_analysis, training_import) from PR #350 that shipped with zero test coverage. Both tools are user-facing and handle complex input parsing where bugs could cause wrong decisions or silent data loss.

1. ImpactAnalysisToolsrc/altimate/tools/impact-analysis.ts (10 new tests)

This tool analyzes downstream impact of dbt model/column changes across the DAG. Zero tests existed despite containing a recursive DAG traversal algorithm (findDownstream) and severity classification logic. New coverage includes:

  • Empty/missing manifest handling (NO MANIFEST, MODEL NOT FOUND responses)
  • Linear chain traversal — correctly identifies direct vs transitive dependents
  • Diamond dependency deduplication — each model counted only once via visited set
  • Dotted depends_on references (e.g. project.stg_ordersstg_orders)
  • Severity classification boundaries (SAFE/LOW/MEDIUM/HIGH thresholds)
  • Blast radius percentage calculation in formatted output
  • Error handling when Dispatcher is unavailable
  • Change type warnings (BREAKING for remove, CAUTION for retype, rename update guidance)

2. TrainingImportToolsrc/altimate/tools/training-import.ts (10 new tests)

This tool imports training entries from markdown documents (style guides, glossaries). Zero tests existed despite a markdown parser (parseMarkdownSections) and capacity enforcement logic. New coverage includes:

  • H2 section extraction as separate training entries
  • H1 context prefix injection into section content
  • No-sections-found error when markdown lacks H2 headings
  • Empty section skipping (H2 with only whitespace)
  • max_entries limit enforcement
  • Capacity enforcement — warns and marks SKIP when near TRAINING_MAX_PATTERNS_PER_KIND
  • Actual import path — verifies TrainingStore.save called for each entry
  • Save failure handling — skipped count and FAIL markers in output
  • Slugify edge cases — special characters, em-dashes, parentheses
  • File-not-found error propagation (ENOENT)

Type of change

  • New feature (non-breaking change which adds functionality)

Issue for this PR

N/A — proactive test coverage for tools added in #350

How did you verify your code works?

bun test test/altimate/impact-analysis.test.ts    # 10 pass, 32 expect() calls
bun test test/altimate/training-import.test.ts    # 10 pass, 30 expect() calls

Both test files use spyOn to mock Dispatcher.call, TrainingStore, TrainingPrompt, and fs.readFile — no external dependencies, no flakiness risk.

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

https://claude.ai/code/session_01H7d93hQP5qAwYhLgRdkqhV

…ort markdown parsing

New tests for two recently added tools (impact_analysis, training_import) that had
zero test coverage. These tools are user-facing and incorrect behavior leads to
wrong blast radius assessments or silent data loss when importing team standards.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

https://claude.ai/code/session_01H7d93hQP5qAwYhLgRdkqhV
Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review.

…stant import

- Add severity boundary tests at exact thresholds (3→LOW, 4→MEDIUM, 10→MEDIUM, 11→HIGH)
- Fix blast radius test to verify model_count drives denominator, not models.length
- Import TRAINING_MAX_PATTERNS_PER_KIND instead of hardcoding 48
- Document that parseMarkdownSections includes empty sections (potential future fix)
- Tighten empty-section assertion from toBeGreaterThanOrEqual to exact toBe

https://claude.ai/code/session_01H7d93hQP5qAwYhLgRdkqhV
@coderabbitai
Copy link

coderabbitai bot commented Mar 22, 2026

Warning

Rate limit exceeded

@anandgupta42 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 11 minutes and 13 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c13e99dd-2533-45fc-8e55-2eede65b1606

📥 Commits

Reviewing files that changed from the base of the PR and between 11a27fe and 4d8e6ec.

📒 Files selected for processing (2)
  • packages/opencode/test/altimate/impact-analysis.test.ts
  • packages/opencode/test/altimate/training-import.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/test-impact-training-20260322-session_01H7d93hQP5qAwYhLgRdkqhV

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@anandgupta42 anandgupta42 merged commit d1e8419 into main Mar 22, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant