fix: remove deleted app assets from frontend exports

Merged
FA
23d ago
+627-44

Deleting or renaming a file in an app's assets/ directory now removes its tracked copy from .web/public on the next compile, so subsequent production exports stop including the old file. Cleanup also handles removal of the entire assets directory. Files replaced by a plugin or another writer are preserved, including replacements generated only once.

Closes #7231.

  • Track each app copy's modification time and size in an atomic manifest outside the served public directory. Delete only copies that still match their saved fingerprint. The fingerprint uses stat only, so large media is never read again after the copy.
  • Refresh fingerprints after actual copies and reuse them on unchanged compiles. Adopt existing copies using the source file, without claiming skipped plugin output.
  • Preserve untracked public files, replacement files, and replaced symlink paths. Abort cleanup if the source directory cannot be fully scanned, and retain dry-run behavior.
  • Document the one-time cleanup needed for files already stale before ownership tracking exists.

Validation

  • Confirmed the original deletion regressions and replacement-file regressions fail before their fixes.
  • uv run pytest tests/units --cov --no-cov-on-fail --cov-report= — 9,752 passed, 19 skipped; 79.07% coverage.
  • Compiler and path-operation checks — 162 passed, covering replacements with the same modification time or the same content, intervening compiles, existing copies, renames, directory removal, file/directory changes, symlink boundaries, custom frontend directories, and invalid manifests.
  • uv run ruff check ., uv run ruff format --check ., and uv run pyright reflex tests passed.
  • Commit hooks passed, including stub generation, codespell, pyright, and ty.
  • Three real production exports verified .web/public and frontend.zip after initial copying, deletion/renaming, and removal of the entire assets directory. A plugin that replaces an app asset only once retained its output across later exports, alongside unrelated generated files.