Skip to content

Reuse unchanged modules in DirRepository's cache - #701

Merged
lagergren merged 2 commits into
masterfrom
fix/dir-repository-cache
Oct 15, 2026
Merged

lagergren merged 2 commits into
masterfrom
fix/dir-repository-cache

Conversation

@lagergren

Copy link
Copy Markdown
Contributor

Summary

ecstasy.mgmt.DirRepository stores its cache entries by qualified module name, but isCacheValid() and ensureCache() look them up by file name. The lookups never match, so:

  • after the one-second scan interval, every access rescans the directory and reloads every module file in it;
  • a file that cannot be loaded is retried and reported again on every rescan;
  • once the directory is empty, isCacheValid() has no files to check and reports the cache as valid, so deleted modules stay listed.

(If a lookup had matched, the unchanged entry would have been skipped with continue and dropped from the new cache.)

This keeps each file's metadata and load result, including a failed load, in a cache keyed by file name, next to the module-name index. Unchanged files are reused on later scans whether or not they loaded, only files whose timestamp or size changed are reloaded, and a removed file invalidates the cache. Error messages are unchanged.

Testing

  • ./gradlew :xdk:installDist :xdk:test spotlessCheck

  • A small module creates a DirRepository over a directory holding one valid module and one unreadable .xtc file, looks the valid module up three times with a missing-module lookup after each one (forcing a rescan), then deletes both files:

    reports for the unchanged unreadable file moduleNames after deleting both files
    master 4 {Good.example.org}
    this branch 1 {}

The cache was indexed by qualified module name but looked up by file
name, so after the scan interval every access reloaded every module in
the directory, failed files were retried and reported on each rescan,
and an emptied directory kept its deleted modules. Cache each file's
metadata and load result, failed or not, by file name next to the
module-name index, reload only files whose timestamp or size changed,
and treat a removed file as a change.
Naming it module made the source rely on Tree-sitter accepting that
contextual keyword as a variable name, which the grammar does not do
yet, so the XDK parse check failed. Keep master's name for the module
template and name the file template fileTemplate.
lagergren added a commit that referenced this pull request Oct 15, 2026
The LSP reads bundled libraries and explicit dependencies into build
repositories and never opens a filesystem repository, so it needs none
of the repository cache, fallback or reporting changes. Restore
DirRepository, FileRepository, LinkedRepository, ModuleInfoRepository
and Ecstasy's DirRepository to master, remove the repository error
listener constructors and their tests, and keep ModuleRepository.of as
a plain factory for callers that choose a repository by path type. The
Ecstasy cache fix continues separately in #701.
lagergren added a commit that referenced this pull request Oct 15, 2026
The LSP reads bundled libraries and explicit dependencies into build
repositories and never opens a filesystem repository, so it needs none
of the repository cache, fallback or reporting changes. Restore
DirRepository, FileRepository, LinkedRepository, ModuleInfoRepository
and Ecstasy's DirRepository to master, remove the repository error
listener constructors and their tests, and keep ModuleRepository.of as
a plain factory for callers that choose a repository by path type. The
Ecstasy cache fix continues separately in #701.
@lagergren
lagergren merged commit 5a11063 into master Oct 15, 2026
5 checks passed
@lagergren
lagergren deleted the fix/dir-repository-cache branch October 15, 2026 13:46
lagergren added a commit that referenced this pull request Oct 15, 2026
The LSP reads bundled libraries and explicit dependencies into build
repositories and never opens a filesystem repository, so it needs none
of the repository cache, fallback or reporting changes. Restore
DirRepository, FileRepository, LinkedRepository, ModuleInfoRepository
and Ecstasy's DirRepository to master, remove the repository error
listener constructors and their tests, and keep ModuleRepository.of as
a plain factory for callers that choose a repository by path type. The
Ecstasy cache fix continues separately in #701.
lagergren added a commit that referenced this pull request Oct 15, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
#697's regressions to errs' own misc.x and errors.x, keeping the
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Oct 19, 2026
The LSP reads bundled libraries and explicit dependencies into build
repositories and never opens a filesystem repository, so it needs none
of the repository cache, fallback or reporting changes. Restore
DirRepository, FileRepository, LinkedRepository, ModuleInfoRepository
and Ecstasy's DirRepository to master, remove the repository error
listener constructors and their tests, and keep ModuleRepository.of as
a plain factory for callers that choose a repository by path type. The
Ecstasy cache fix continues separately in #701.
lagergren added a commit that referenced this pull request Oct 20, 2026
The LSP reads bundled libraries and explicit dependencies into build
repositories and never opens a filesystem repository, so it needs none
of the repository cache, fallback or reporting changes. Restore
DirRepository, FileRepository, LinkedRepository, ModuleInfoRepository
and Ecstasy's DirRepository to master, remove the repository error
listener constructors and their tests, and keep ModuleRepository.of as
a plain factory for callers that choose a repository by path type. The
Ecstasy cache fix continues separately in #701.
lagergren added a commit that referenced this pull request Oct 21, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
#697's regressions to errs' own misc.x and errors.x, keeping the
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Oct 21, 2026
The LSP reads bundled libraries and explicit dependencies into build
repositories and never opens a filesystem repository, so it needs none
of the repository cache, fallback or reporting changes. Restore
DirRepository, FileRepository, LinkedRepository, ModuleInfoRepository
and Ecstasy's DirRepository to master, remove the repository error
listener constructors and their tests, and keep ModuleRepository.of as
a plain factory for callers that choose a repository by path type. The
Ecstasy cache fix continues separately in #701.
lagergren added a commit that referenced this pull request Oct 26, 2026
The LSP reads bundled libraries and explicit dependencies into build
repositories and never opens a filesystem repository, so it needs none
of the repository cache, fallback or reporting changes. Restore
DirRepository, FileRepository, LinkedRepository, ModuleInfoRepository
and Ecstasy's DirRepository to master, remove the repository error
listener constructors and their tests, and keep ModuleRepository.of as
a plain factory for callers that choose a repository by path type. The
Ecstasy cache fix continues separately in #701.
lagergren added a commit that referenced this pull request Oct 26, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
#697's regressions to errs' own misc.x and errors.x, keeping the
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Oct 26, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Oct 26, 2026
The LSP reads bundled libraries and explicit dependencies into build
repositories and never opens a filesystem repository, so it needs none
of the repository cache, fallback or reporting changes. Restore
DirRepository, FileRepository, LinkedRepository, ModuleInfoRepository
and Ecstasy's DirRepository to master, remove the repository error
listener constructors and their tests, and keep ModuleRepository.of as
a plain factory for callers that choose a repository by path type. The
Ecstasy cache fix continues separately in #701.
lagergren added a commit that referenced this pull request Oct 27, 2026
The LSP reads bundled libraries and explicit dependencies into build
repositories and never opens a filesystem repository, so it needs none
of the repository cache, fallback or reporting changes. Restore
DirRepository, FileRepository, LinkedRepository, ModuleInfoRepository
and Ecstasy's DirRepository to master, remove the repository error
listener constructors and their tests, and keep ModuleRepository.of as
a plain factory for callers that choose a repository by path type. The
Ecstasy cache fix continues separately in #701.
lagergren added a commit that referenced this pull request Oct 27, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Oct 28, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Oct 28, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Oct 29, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Oct 29, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Oct 29, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Nov 2, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Nov 4, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Nov 5, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Nov 9, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Nov 11, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Nov 22, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Nov 25, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Nov 25, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Nov 25, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Nov 26, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Nov 26, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Nov 27, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
lagergren added a commit that referenced this pull request Nov 28, 2026
Take rebased #693's AstNode (with #697's ambiguous call detection),
Ecstasy's DirRepository (#701) and the LSP test fork default. Add
implicitly abstract class test beside the new ambiguity test.
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.

2 participants