Repository navigation
fix: rebuild symbol index after composer changes and index root config - #650
Merged
Merged
Conversation
IndexCache::isStale() skipped vendor modules and never looked at Composer state, so the index stayed stale after composer require/update/remove. The project-root config/ directory was never scanned, so keys defined there were permanently reported as unknown by marko-lsp. - Persist a Composer state fingerprint (path, mtime and size of vendor/composer/installed.json, falling back to composer.lock) in the cache payload and compare it in isStale(). - Index <root>/config/*.php via ConfigScanner::scanDirectory() under the module name "project", and include <root>/config in the mtime walk and the tracked-path set. - Clear PHP's stat cache at the start of isStale() so long-lived servers see changes made by other processes. - Fix stale comments and docs that said vendor is excluded. Closes #649 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KaHtYgss6ELkNd1fkcNyX
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KaHtYgss6ELkNd1fkcNyX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two gaps in
marko/codeindexerthat mademarko-lsp/marko-mcpreport falsemarko.config.unknown_keydiagnostics.Composer changes now invalidate the index.
IndexCache::build()persists acomposerStatefingerprint (path, mtime and size ofvendor/composer/installed.json, falling back tocomposer.lock) in the cache payload.isStale()compares it to the current value, socomposer require,updateandremovemark the index stale and the next read rebuilds it. Vendor files are still not walked one by one, so the check costs a single stat. A payload without the new key, from an older version, counts as stale and rebuilds once.The project-root
config/is indexed. The newConfigScanner::scanDirectory()(whichscan()now delegates to) scans<root>/config/*.phpduringbuild(). Those keys are recorded under the module nameproject(IndexCache::ROOT_CONFIG_MODULE).<root>/configis part of both the mtime walk and the tracked-path set, so edits, additions and deletions there also mark the index stale.Also:
isStale()callsclearstatcache()first, so long-lived servers see changes other processes made to the files they stat.codeindexer.md,troubleshooting.md,verification-checklist.md).packages/devaiis unchanged. Its CLAUDE.md promise that the index rebuilds itself is now accurate.Tests
New
packages/codeindexer/tests/Unit/Cache/IndexCacheComposerStateTest.phpuses the real walker and scanners:installed.jsontouched: the index is stale, andgetConfigKeys()on the same instance containsnew.*.composer.lockwheninstalled.jsonis absent.<root>/config/app_only.phpis indexed. Editing it or adding a new root config file marks the index stale.Closes #649
🤖 Generated with Claude Code
https://claude.ai/code/session_017KaHtYgss6ELkNd1fkcNyX