Skip to content

test: extend file watcher indexing tests#54

Merged
PatrickSys merged 2 commits intomasterfrom
fix/phase2d-e2e-auto-refresh
Mar 1, 2026
Merged

test: extend file watcher indexing tests#54
PatrickSys merged 2 commits intomasterfrom
fix/phase2d-e2e-auto-refresh

Conversation

@PatrickSys
Copy link
Owner

Summary

  • add tracked-extension filtering in the chokidar watcher so only indexed file types trigger auto-refresh
  • add watcher test coverage for non-tracked extension ignores
  • add end-to-end auto-refresh test proving file edits update keyword index without manual refresh_index

Validation

  • pnpm vitest run tests/file-watcher.test.ts tests/auto-refresh-e2e.test.ts

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: 00c23206f9

ℹ️ 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".


function isTrackedSourcePath(filePath: string): boolean {
const extension = path.extname(filePath).toLowerCase();
return extension.length > 0 && TRACKED_EXTENSIONS.has(extension);

Choose a reason for hiding this comment

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

P2 Badge Reindex on extensionless metadata changes

The new extension filter returns early for any path without an extension, which means edits to files like .gitignore never trigger auto-refresh. CodebaseIndexer.scanFiles applies .gitignore when building the indexed file set, so changing ignore rules can add/remove indexed files, but with this gate the index remains stale until an unrelated tracked source edit (or manual refresh) occurs.

Useful? React with 👍 / 👎.

Comment on lines +121 to +122
const content = await readIndexedContent(tempDir);
return content.includes('UPDATED_TOKEN');

Choose a reason for hiding this comment

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

P2 Badge Retry transient index reads during E2E polling

The polling callback reads and parses the keyword index on each iteration, but it does not handle transient read/parse failures while incremental indexing rewrites that file. In those moments readIndexedContent can throw (e.g., temporary ENOENT or partial JSON), and waitFor exits immediately instead of retrying, making this test flaky under slower I/O timing.

Useful? React with 👍 / 👎.

@greptile-apps
Copy link

greptile-apps bot commented Feb 28, 2026

Greptile Summary

This PR completes phase 2d validation by adding extension filtering to the file watcher and comprehensive E2E test coverage for auto-refresh functionality.

Key Changes:

  • Enhanced file watcher to only trigger on tracked source file extensions, preventing unnecessary index refreshes for non-source files like .txt, .log, etc.
  • Added end-to-end test proving file edits automatically update the keyword index without manual intervention
  • Added unit test coverage for non-tracked extension filtering behavior

Testing:
All changes are well-tested with both unit tests and E2E validation. The E2E test creates a temporary codebase, performs initial indexing, starts the watcher, edits a source file, and verifies the index is automatically updated within the debounce window.

Confidence Score: 5/5

  • This PR is safe to merge with no issues found
  • All changes are test-focused with comprehensive coverage, the implementation is clean and follows best practices, no any types used (adheres to AGENTS.md guidelines), and the extension filtering logic is sound with proper defensive checks
  • No files require special attention

Important Files Changed

Filename Overview
src/core/file-watcher.ts Added extension filtering to only track changes to supported source file types
tests/auto-refresh-e2e.test.ts New E2E test validating automatic index updates when source files are edited
tests/file-watcher.test.ts Added test case verifying non-tracked file extensions are properly ignored by watcher

Last reviewed commit: 00c2320

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.

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@PatrickSys PatrickSys changed the title test: complete phase 2d auto-refresh e2e validation test: extend file watcher indexing tests Mar 1, 2026
@PatrickSys PatrickSys merged commit dd0cca8 into master Mar 1, 2026
3 checks passed
@PatrickSys PatrickSys deleted the fix/phase2d-e2e-auto-refresh branch March 2, 2026 13:09
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