Live sync removes files outside packaging/files.json (dry run first) #27
Loading…
Reference in a new issue
No description provided.
Delete branch "oss-oo/z-live-sync-prune"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Owner request (Claudiu, 2026-10-28): remove
icons/chat-bubble.svgfrom the live folder and teach the live sync to delete files thatpackaging/files.jsondoes not name.The copy install never deletes (its contract for every user: only two known, byte-identical retired icons go), so leftovers stay. On the station:
icons/chat-bubble.svg(the upstream ChatGPT artwork z dropped in 1.0.0, still byte-identical to upstreamef77e98) and a stale__pycache__..zcode/skills/cinnamon-z-usage-live-sync/scripts/prune_unmanaged.py: dry run by default (lists every entry the manifest does not name,__pycache__included),--applyremoves exactly that list. Only inside a realapplets/<uuid>folder; never follows a symlink (a symlink is removed as a link); refuses a symlinked or foreign folder and a symlinked managed path.audit_deployment.py: reportsEXTRA(fails the audit) andCACHE(__pycache__, tolerated since the settings dialog rewrites it) entries; right after a sync:EXPECTED=24 VALID=24 SYMLINKS=0 MISMATCHES=0 EXTRA=0 CACHE=0.sleep 1, install, prune, targeted ReloadXlet, audit. Release skill: the new summary line.tests/test_live_sync_tools.py: dry run, apply, symlinks in and out, refusals, audit counts.No payload change:
install.shandscripts/package.pyare untouched,install.zipstays byte-identical, so no release is needed.Live dry run (read-only, before this PR):
WOULD REMOVE3__pycache__/*.pyc,icons/chat-bubble.svg,__pycache__/.🤖 Generated with Claude Code
- Manifest paths must be canonical ("./a", "a//b", "a/", "." rejected): otherwise the prune deleted the file the installer had just written. - The audit fails a symlinked, below-a-symlink or missing folder and never prints EXTRA=0 without a completed scan (EXTRA=? CACHE=?); unreadable directories fail loudly; empty leftover directories count as EXTRA; CACHE is only __pycache__ and the .pyc files directly in it. - prune_unmanaged.py requires --project, --installed and --plan (no stale defaults, no --manifest). The dry run writes the plan; --apply removes only planned entries that are still unmanaged and keeps and reports anything new (exit 1). It refuses a git checkout or a folder overlapping the project, removes through directory handles with O_NOFOLLOW (a swap between scan and unlink cannot lead outside), has nothing to prune on a first install and handles names that are not UTF-8. - Skill: the dry run on its own first, install stops on failure, the reload follows a failed prune; the station helper is two-step (dry run, then --apply after the warning line). - Tests: every finding above, whole-tree checks around the dry run and the symlink-safe removal itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>