Skip to content

[filesystem] Isolate Finder creation behind a factory (#90)#91

Merged
coisa merged 4 commits intomainfrom
codex/90-finder-factory
Apr 18, 2026
Merged

[filesystem] Isolate Finder creation behind a factory (#90)#91
coisa merged 4 commits intomainfrom
codex/90-finder-factory

Conversation

@coisa
Copy link
Copy Markdown
Contributor

@coisa coisa commented Apr 18, 2026

Summary

  • Add FinderFactoryInterface and FinderFactory so every mutable Symfony Finder scan starts from a fresh instance.
  • Replace injected shared Finder usage in resource copy, git hook sync, command loading, and skill synchronization.
  • Register the factory in the service provider and remove the direct Finder::class service mapping.
  • Move services that consumed Symfony\Component\Filesystem\Filesystem directly to the local FilesystemInterface abstraction.
  • Extend the local filesystem wrapper with remove, symlink, and readlink so skill synchronization and other services do not depend on Symfony Filesystem directly.
  • Update tests to mock local factories/interfaces and add coverage proving fresh Finder instances and local filesystem link operations.

Verification

  • git diff --check
  • rg -n -F "Symfony\\Component\\Filesystem\\Filesystem" src tests (only src/Filesystem/Filesystem.php remains as the adapter around Symfony)
  • rg -n "Finder \\$|Finder \\$finder|Finder::class|Finder::create|new Finder\\(" src tests
  • ./vendor/bin/phpunit --filter 'FilesystemTest|FinderFactoryTest|CopyResourceCommandTest|GitHooksCommandTest|DevToolsCommandLoaderTest|SkillsSynchronizerTest|GitIgnore\\WriterTest|GitAttributes\\WriterTest|ExistenceCheckerTest|GeneratorTest|DevToolsTest' (blocked: env: php: No such file or directory)
  • ./vendor/bin/composer dev-tools tests -- --filter='FinderFactoryTest|CopyResourceCommandTest|GitHooksCommandTest|DevToolsCommandLoaderTest|SkillsSynchronizerTest|DevToolsTest' (blocked: env: php: No such file or directory)

Notes

  • No production Finder::create() calls were present. The only remaining production new Finder() is inside the dedicated FinderFactory.
  • Direct Symfony Filesystem usage now remains only inside the local filesystem adapter.

Closes #90

@github-actions github-actions Bot added the bug Something isn't working label Apr 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 18, 2026

@coisa coisa merged commit 47a2b31 into main Apr 18, 2026
2 checks passed
@coisa coisa deleted the codex/90-finder-factory branch April 18, 2026 20:14
github-actions Bot added a commit that referenced this pull request Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Released

Development

Successfully merging this pull request may close these issues.

Avoid reusing mutable Symfony Finder instances from dependency injection

1 participant