Skip to content

Add disk changes to end-to-end scripts - #685

Draft
Firehed wants to merge 24 commits into
e2e-definition-handlerfrom
e2e-disk-changes
Draft

Firehed wants to merge 24 commits into
e2e-definition-handlerfrom
e2e-disk-changes

Conversation

@Firehed

@Firehed Firehed commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

Stacked on #684.

Adds disk changes to end-to-end scripts and moves the external-change tests onto them.

Steps

All in Step/:

  • Close closes an open document.
  • Copy and Delete change the disk as another program would, without telling the server. Copy puts a prepared variant in place, so no PHP is written inline; the variants live in DiskChange/ in the fixture project, outside the autoload paths. Scripts already run against a throwaway copy of the project (Add script-driven end-to-end tests with recorded transcripts #680), so fixtures are never mutated.
  • ReportChanges sends one workspace/didChangeWatchedFiles listing typed file events (FileChange, FileChangeType).

Scripts

Each declares watched-file support and asks for definitions in src/DiskChange/Consumer.php, expecting NoAnswer() before a change and LandsOn after it (or the reverse for the deletion):

  • a reported edit to an unopened class file;
  • a checkout of two files, reported together;
  • a deletion, reported as Deleted;
  • a class created after a failed lookup, reported as Created;
  • an edit to an open file's disk copy, which is ignored while the file is open and seen once it is closed;
  • an edit to an autoload.files entry, reported and unreported.

What the scripts show about invalidation: class files are read again on every query, because what a file declares is cached under its path and text. An edit to a class file is therefore seen whether or not it is reported. The autoload.files index is rebuilt only on a report, so an unreported edit there is not seen. Both behaviors are stated as expectations; the unreported autoload.files case will change if a stand-in file watcher (#647) lands.

Originals

  • ExternalFileChangeInvalidationTest is removed. Its enumeration case is covered only by name lookup here, and only for the added symbol, not the removed one, since enumeration surfaces through expression-position completion, which waits on PHP built-ins are read from the server's own PHP, not the project's #401.
  • The watched-files case in ServerTest is removed, with the helpers only it used. It used Server::forProject and the container.
  • DefinitionIntegrationTest is removed. disk-close-rereads shows that an open buffer wins over the disk, which its remaining case covered.

Coverage: ExternalFileChangeInvalidationTest covered nothing, and the ServerTest case covered nothing other tests do not. Removing DefinitionIntegrationTest leaves Server::forProject's fallback to the working directory uncovered in-process; every end-to-end script runs it, which coverage cannot see.

🤖 Generated with Claude Code

Firehed and others added 15 commits October 3, 2026 16:59
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.67%. Comparing base (16b9e8f) to head (1f2a388).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@                     Coverage Diff                      @@
##             e2e-definition-handler     #685      +/-   ##
============================================================
- Coverage                     99.73%   99.67%   -0.07%     
  Complexity                     1900     1900              
============================================================
  Files                           135      135              
  Lines                          4873     4873              
============================================================
- Hits                           4860     4857       -3     
- Misses                           13       16       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Firehed and others added 9 commits October 3, 2026 20:53
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	tests/EndToEnd/README.md
#	tests/EndToEnd/ScriptTest.php
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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