v0.6.405: file versions keep/name/delete and minimum keep period (#1110, #924), restore to an earlier time and browser-only Delete forever (#1104) #1154

Merged
Cordy merged 79 commits from b5v07 into main 2026-11-10 03:09:58 +00:00
Owner

Batch 5 of v0.7 (b5v07).

  • #1110/#924/#1046: keep a version with an optional name (max 20 per file), delete one version (owners/managers, browser only, into Deleted files), minimum keep period (default 7 days on new and upgraded instances) with a per-file ceiling (1,000), one removal predicate everywhere, prune markers, nightly sweep under a lease, File versions admin tab, lowered-limit alerts.
  • #1104: restore a folder, a space or Personal files to an earlier time (preview, person/device filter, conflicts kept, added files to Deleted files, device pause, resumable job under a lease, undo), move record per home/space, result page for affected people, Earlier-time restores admin tab.
  • G4: Delete forever needs a browser sign-in (device and app passwords refused, always audited, red bell + security mail).
  • Fix: compile-cache marker without go:linkname (wazero keys its cache by module content; #1151 tracks the long-term PDFium build).

Reviews: W1-W3 wave reviews, fix rounds fx1-fx4s, whole-branch final review per feature with adversarial probes, final fix round fx5. Strings approved by Nikola 2026-11-09/10. Local verification at fd503ccc: build, vet, gofmt clean; internal/api, cmd/cairnd and internal/storage/versions full; touched packages; deploy, config, webcheck, audit; web suite 2393/2393; all 69 a11y files ok.

Batch 5 of v0.7 (b5v07). - #1110/#924/#1046: keep a version with an optional name (max 20 per file), delete one version (owners/managers, browser only, into Deleted files), minimum keep period (default 7 days on new and upgraded instances) with a per-file ceiling (1,000), one removal predicate everywhere, prune markers, nightly sweep under a lease, File versions admin tab, lowered-limit alerts. - #1104: restore a folder, a space or Personal files to an earlier time (preview, person/device filter, conflicts kept, added files to Deleted files, device pause, resumable job under a lease, undo), move record per home/space, result page for affected people, Earlier-time restores admin tab. - G4: Delete forever needs a browser sign-in (device and app passwords refused, always audited, red bell + security mail). - Fix: compile-cache marker without go:linkname (wazero keys its cache by module content; #1151 tracks the long-term PDFium build). Reviews: W1-W3 wave reviews, fix rounds fx1-fx4s, whole-branch final review per feature with adversarial probes, final fix round fx5. Strings approved by Nikola 2026-11-09/10. Local verification at fd503ccc: build, vet, gofmt clean; internal/api, cmd/cairnd and internal/storage/versions full; touched packages; deploy, config, webcheck, audit; web suite 2393/2393; all 69 a11y files ok.
wazero v1.12.0 already keys every compile-cache entry by content:
fileCacheKey = sha256(Module.ID, "WAZEVO", CPU features) with Module.ID
the sha256 of the WASM bytes and flags, and each entry's header carries
the wazero version (another version is stale and deleted). A different
pdfium.wasm or wazero can never load an old native entry, so hashing
go-pdfium's embedded module through a linkname into its internal package
bought nothing.

Marker "cairn pdfium compile cache 3": go-pdfium and wazero "path version
sum" lines from the build info ("<path> unknown" when absent),
GOOS/GOARCH and runtime.Version(); it only empties the folder when the
build changes. cacheMarker cannot fail any more (the "wasm" refusal
reason is gone). Tests: the embedded-module test is replaced by
TestCompileCacheMarkerBuildChangeCcm6405 (a new go-pdfium version empties
the folder; missing build info keeps the cache on). Docs: CHANGELOG
v0.6.405 Fixes, configuration-reference, security-standards,
ARCHITECTURE.
PurgeGuard.RequireSession (internal/api/purgeguard1104.go) refuses every permanent delete that is not a browser session with the caller's own cookie: 403 needs-session, purge-refused audit (trash, admin tier), WARN once a minute per device or account+client, red bell device-purge-refused via notify.AddOrCount (added once a day per device, per account for account passwords; counted after) and so the security mail KDevicePurgeRefused. DELETE /api/v1/trash/{id} asks it first; TrashAPI.purge takes a PurgeOK; the AST sweep test holds every purge primitive caller to the token. trash.OriginOf names the entry for the audit event. Existing test rigs that purge through the route now send their session's own cookie and wire a guard.
Kept versions are their key with .kv; names are encrypted <stem>.name
files beside them; prune markers pruned_<seconds>.pm (creation marker
from mkdirs, a newer one before every removal by prune). One Removal
predicate for prune (count, age, ceiling), List, coalesce and Unmint;
Keep, Unkeep, Listing, RemovalOf, KeptCount, Protected. Default minimum
keep period 7 days, ceiling 1000, kept 20 per file; CoalesceMinutes 0
now means no merging.

posix and s3 RecordOf only answer version keys (.v, .kv): a name file
or a marker holding the file's bytes was answered as its record in s3
put/none mode and posix copy mode with equal mtimes.

Existing tests: count-cap tests set MinKeepDays 0 (the cap under test);
raw chain listings leave prune markers out; the #1102 bypass list gains
the new raw writes in version folders (W8).
B1: mkdirs writes no marker. write.record writes pruned_0000000000.pm only
when the file did not exist before the write; snapshot, a write over an
existing empty file and move.record for content without a chain write a
marker at the first record's time. mergeChain and copyChain write, before
the first key arrives, the newer of what source and destination say of
their history (newest marker, else oldest key), and a marker at now for a
key left behind. move943_test no longer hides the creation marker.
N1: the TrashVersion rename row is W8 W12. N4: Return answers ErrNotFound
for a key that is no version key, so the entry restores as a copy.
N5: PersonalEntry serves Kind, VersionAt, VersionAuthor, VersionName, Kept
and KeptVersions as ListTrash does. N6: Removal's doc says to build it only
through RemovalOf (the minimum period is an unexported field).
S1: tpuRow uses trashVersionRow (title, Version badge), trashVersionRestoredLine
after a restore and trashPurgeRows1110's rows in the inline Purge confirm
(focus on Cancel when kept versions go with the file); the Purge all list
names a version entry as a version.
N1 focus back on the row's ⋯ after Undo; N2 pin/versions icons; N3 the
ceiling bell quotes the path; N4 the rules line uses the effective age;
N5 verAdmCheck1110 range-checks only changed fields (as the server); N6
hold note also with no versions; N7 tests read the mockup via MOCKUP_1110
only; N8 no literal U+2014 in the test; N9 an unknown delete refusal is
framed by deleteFailed.
Merge branch 'b5v07-fx5r' into b5v07
All checks were successful
ci / test-and-build (pull_request) Successful in 5m17s
fd503ccc2e
Cordy merged commit 5e1a4df1b4 into main 2026-11-10 03:09:58 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#1154
No description provided.