Skip to content

test(phase2): rigorous coverage for importDetails + 2-hop + watcher queue#53

Merged
PatrickSys merged 7 commits intomasterfrom
test/phase2-rigor
Feb 28, 2026
Merged

test(phase2): rigorous coverage for importDetails + 2-hop + watcher queue#53
PatrickSys merged 7 commits intomasterfrom
test/phase2-rigor

Conversation

@PatrickSys
Copy link
Owner

Completes Phase 2 (2a–2d) rigor work (2e excluded):

  • Adds deterministic unit tests for auto-refresh queueing when indexing is busy.
  • Adds a minimal 2-hop impact test (hop1+hop2) for decision-card impact.details.
  • Extends relationship sidecar test to assert graph.importDetails persists line + importedSymbols.
  • Adds InternalFileGraph round-trip serialization test to ensure importedSymbols behavior survives persistence.
  • Expands watcher ignore patterns to include common tooling dirs (.nx, .planning, coverage, .turbo, .next, .cache).

Notes:

  • Local vitest is blocked in this environment by esbuild spawn EPERM; rely on CI for test execution.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7a9af7a472

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const controller = createAutoRefreshController();
expect(controller.onFileChange(true)).toBe(false);
expect(controller.consumeQueuedRefresh('indexing')).toBe(false);
expect(controller.consumeQueuedRefresh('ready')).toBe(true);

Choose a reason for hiding this comment

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

P1 Badge Remove unreachable ready expectation after queue consumption

This new test case is internally inconsistent and will fail every run: createAutoRefreshController.consumeQueuedRefresh clears the queued flag on every call (see src/core/auto-refresh.ts), so after calling it with 'indexing' on the previous line, the follow-up expectation that 'ready' returns true cannot be satisfied. In CI environments where tests execute, this blocks the commit despite no product-code path changing this behavior.

Useful? React with 👍 / 👎.

@greptile-apps
Copy link

greptile-apps bot commented Feb 28, 2026

Greptile Summary

Completes Phase 2 test coverage with rigorous unit and integration tests for auto-refresh queueing, 2-hop impact tracking, and importDetails persistence. The refactoring extracts auto-refresh logic into a dedicated controller module, improving separation of concerns.

  • Auto-refresh controller properly queues changes during indexing and dequeues after completion
  • 2-hop impact test verifies transitive dependency tracking (c.ts → b.ts → a.ts)
  • Serialization test ensures importDetails survives round-trip persistence
  • Relationship sidecar test extended to verify line numbers and imported symbols
  • File watcher ignore patterns expanded to cover common tooling directories

Issue: tests/auto-refresh-controller.test.ts:13 contains a logic error that will cause test failure

Confidence Score: 4/5

  • Safe to merge after fixing the test logic bug
  • Core refactoring is clean and equivalent to original logic. Test coverage is comprehensive. One test has a logic bug (line 13) that will cause it to fail, but the fix is straightforward.
  • tests/auto-refresh-controller.test.ts requires fix at line 13 before tests will pass

Important Files Changed

Filename Overview
src/core/auto-refresh.ts New controller module for managing auto-refresh queueing logic
src/index.ts Refactored auto-refresh logic to use new AutoRefreshController
tests/auto-refresh-controller.test.ts Unit tests for AutoRefreshController - contains logic bug in "queues when indexing" test

Last reviewed commit: 7a9af7a

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

7 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

it('queues when indexing and runs after ready', () => {
const controller = createAutoRefreshController();
expect(controller.onFileChange(true)).toBe(false);
expect(controller.consumeQueuedRefresh('indexing')).toBe(false);
Copy link

Choose a reason for hiding this comment

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

calling consumeQueuedRefresh clears the queue regardless of status, so line 14 will return false (not true as expected). Remove this line - you should only call consumeQueuedRefresh once after indexing completes.

Suggested change
expect(controller.consumeQueuedRefresh('indexing')).toBe(false);
expect(controller.consumeQueuedRefresh('ready')).toBe(true);

@PatrickSys
Copy link
Owner Author

Fixed the failing test by making consumeQueuedRefresh('indexing') not clear the queue (defensive behavior). This preserves the queued refresh until an indexing run completes with status
eady/error, and matches how src/index.ts uses it.

Pushed in commit 2f0b319.

@PatrickSys PatrickSys merged commit 86a1728 into master Feb 28, 2026
3 checks passed
@PatrickSys PatrickSys deleted the test/phase2-rigor branch February 28, 2026 21:45
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