Repository navigation
Description
Summary
FileOps mints archive tags in a reserved-looking namespace — <name>.archive.<unix-ts> (claim_archive_name, pkgs/id/src/fileops.rs:166) — but nothing reserves that namespace against user-created files. validate_name (fileops.rs:221-242) rejects empty, rooted, drive-prefixed, and ./.. names, but accepts archive-shaped names, and every consumer of the namespace then treats a user file with that shape as an archive:
- Misclassified in the web file list.
classify_tag(pkgs/id/src/web/routes.rs:153-184) returns(FileKind::Archive, Some(ts))for any name ending in.archive.<digits>— a user file namedreport.archive.1700000000renders as an archive ofreport, sorted/grouped with archives, instead of as the primary file its owner created. - Hard-deleted by deleting a different file.
FileOps::delete(fileops.rs:496+) collects the base name's archives by a prefix scan ({name}.archive.+ all-digit suffix,fileops.rs:523-545) and viaarchive.*metadata references filtered byis_archive_tag_name(fileops.rs:155-160), then deletes those tags and their metadata. Deletingreporttherefore hard-deletes the independent user filereport.archive.1700000000and its metadata with it. - Archives can be silently overwritten.
put(fileops.rs:307-318) validates the name, then unconditionallytags().set(name, hash). A put (directly, or as a rename/copy target —validate_targetuses the samevalidate_name) to the exact name of an existing archive replaces the archived version's hash, destroying the one copy the archive mechanism exists to preserve, with no archive-of-the-archive and no error.
The non-numeric lookalike case is already defended and pinned by a test (delete_only_removes_numeric_archive_suffixes, protocol.rs: a.archive.notes survives delete("a") because the suffix is not digits). The numeric-suffix case — the only shape that actually collides — has no equivalent guard, because the guard lives in the readers (classification/delete) while the writer (validate_name) never got the reservation.
Evidence (verified this run, origin/main b882c9d5e)
Laptop probe ~/git/fleet/probe-2026-11-02-laneB-archivename/ — verbatim extracts of validate_name and is_archive_tag_name from fileops.rs (blob md5 721b667fe3bb56a6198e49328ea7b3b7), classify_tag/parse_iso_timestamp from web/routes.rs, and delete()'s prefix-scan collection logic over an in-memory tag list. Results:
PROBE1 validate_name("report.archive.1700000000") == Ok (put accepts it): PASS(controls:"../x"and" "are rejected)PROBE2 classify_tag("report.archive.1700000000") == (Archive, Some(1700000000)): PASS(control:"a.archive.notes"classifies Primary)PROBE3 delete("report") collects user file report.archive.1700000000 for deletion: PASS(controls:report.archive.notesandreport2.archive.5are spared)PROBE4 is_archive_tag_name("report.archive.1700000000") == true: PASS
Why it matters
Archives are the only recovery copy when a file is replaced or renamed over (archive_existing, #1612/#2462 hardened their claiming precisely so a replaced version is never lost). A namespace collision breaks that guarantee in both directions: user data that merely looks like an archive is destroyed by an unrelated delete, and a genuine archive can be clobbered by an ordinary put — silently in both cases, since each operation reports success. Any surface that can create files (meta protocol Put/Rename/Copy, web routes, REPL — all funnel through FileOps) can trigger it, accidentally (a user naming an export data.archive.2024… the shape only needs trailing digits, e.g. notes.archive.1) or deliberately.
Acceptance criteria
- Creating a file whose name matches the archive shape (
<something>.archive.<all-digits>) is refused with a clear error at the FileOps layer (validate_name/validate_target), so put, rename, and copy all inherit it; the error is distinguishable like the existingInvalidName/EmptyNamevariants. - Regression test mirroring
delete_only_removes_numeric_archive_suffixesfrom the writer side: put/rename/copy to an archive-shaped name fails, and a pre-existing archive tag's hash is unchanged after such an attempt. - The chosen spelling rule matches the readers exactly (unsigned decimal digits only — no
+sign, per id(web): classify_tag timestamp parsers accept non-canonical spellings — non-padded, '+'-signed and over-wide components classify as Auto/Archive with the canonical instant #4329's note inclassify_tag); non-numeric lookalikes such asa.archive.notesremain valid user files and still survivedelete("a"). - If reserving the namespace is judged too breaking, the alternative is implemented instead and this issue updated: archives move to a namespace users cannot mint (or delete/classify stop inferring archives from names alone and use the
archive.*metadata references as the sole source) — with the same writer/reader agreement tests.
Related
- id(fileops): repeated-replacement archive removal test fails — delete reports 1 archive instead of 2 #4574 (archive references orphaned by rename — different defect: metadata references travelling, not user files colliding with the archive namespace; this issue's
deletearchive-reference path is theis_archive_tag_namehalf of PROBE4) - id(fileops): archive tags collide within one second — a second replace of the same name silently overwrites the first replace's archive #1612 / id(fileops): PR #1706's free_archive_name is check-then-act — concurrent same-second replaces can still lose a replaced version's archive #2462 (archive-name collision hardening for producer-minted names)
- id(web): classify_tag treats any '.archive.' filename as an archive — notes.archive.txt renders with an 'archive: ?' badge, sorts out of the primary list, and links by hash instead of by name #2793 / id(web): classify_tag timestamp parsers accept non-canonical spellings — non-padded, '+'-signed and over-wide components classify as Auto/Archive with the canonical instant #4329 (classification-side spelling rules for archive suffixes)
Activity
dezren39 commentedon Nov 3, 2026
🤖 Agent note · filed
<name>.archive.<digits>) is not reserved:validate_nameaccepts archive-shaped user names,classify_tagrenders such a file as an archive,deleteof the base name hard-deletes it, andputto an existing archive's exact name overwrites the archived version. Verbatim-extract probe (fileops.rs blob md5 721b667f @ origin/main b882c9d) passed all 4 probes + 3 controls.validate_name/validate_target, or move archives out of the user-mintable namespace).~/git/fleet/probe-2026-11-02-laneB-archivename/(laptop); triage packet enqueued to repo-health-code-pilot this run.dezren39 commentedon Nov 3, 2026
🤖 Agent note · picked up
29 remaining items
dezren39 commentedon Nov 4, 2026
🤖 Agent note · parked
dezren39 commentedon Nov 4, 2026
agent-note:v1
state: claimed
queue: repo-health-code-pilot
task: 8443 (small_fix, worker repo-worker-code, lane code-f, direct execution lane)
by: repo-queue-worker-shift-f
at: 2026-11-04T05:05Z
Picked up task 8443 and revalidated fresh: PR #4741 (branch queue/6711-4720-archive-name-reservation, task 6711) is the canonical fix for issue #4720 and is still OPEN, mergeable_state clean, Codex review completed with no findings. Task 6711 is no longer in an active queue state, so instead of parking again I reviewed PR #4741 against the acceptance criteria (validate_name reservation via is_archive_tag_name, distinct ReservedArchiveName error, put/rename/copy regression test with archive hash unchanged, non-numeric lookalikes still valid) — all met, with test evidence on the PR. Merging PR #4741 now; task 8443 will complete as fixed_merged via the canonical PR.
dezren39 commentedon Nov 4, 2026
agent-note:v1
state: done
queue: repo-health-code-pilot
task: 8443 (small_fix, worker repo-worker-code, lane code-f, direct execution lane)
by: repo-queue-worker-shift-f
at: 2026-11-04T05:03Z
Done: PR #4741 merged (merge commit ac14972) and issue #4720 closed by the merge. The canonical PR from task 6711 implements the validate_name archive-namespace reservation exactly per the acceptance criteria; Codex review had no findings and the PR carried passing targeted test evidence (three pkgs/id test filters + cargo check -p id --features web --lib). Task 8443 completes as fixed_merged via PR #4741 — no competing PR was built.