8000 feat: snapback v0.1 integration (stage-2) by adeelahmad · Pull Request #5 · adeelahmad/snapback · GitHub
[go: up one dir, main page]

Skip to content

feat: snapback v0.1 integration (stage-2) - #5

Merged
adeelahmad merged 538 commits into
masterfrom
stage-2
Sep 22, 2026
Merged

adeelahmad merged 538 commits into
masterfrom
stage-2

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Draft integration PR for Sprint 3 (v0.1, SPEC §22.1). Opened so CI (including the FUSE integration linux job) runs on the integration branch while stories land. Not ready to merge; promoted only after the final gate.

* commit 'd0c27d4':
  feat: cli config path (S3-09 T6b)
  feat: cmd dispatches core commands (S3-09 T6)
  test: cli config path (S3-09 T6b)
  chore: scaffold S3-09 T6 stubs
  test: cmd dispatches core commands (S3-09 T6)
  feat: cli seed and config commands (S3-09 T5)
  chore: scaffold S3-09 T5 stubs
  test: cli seed and config commands (S3-09 T5)
  feat: cli snap command (S3-09 T4)
  chore: scaffold S3-09 T4 stubs
  test: cli snap command (S3-09 T4)
  feat: cli open command (S3-09 T3)
  chore: scaffold S3-09 T3 stubs
  test: cli open command (S3-09 T3)
  feat: cli link and links commands (S3-09 T2)
  chore: scaffold S3-09 T2 stubs
  test: cli link and links commands (S3-09 T2)
  feat: cli core dispatch and envelope (S3-09 T1)
  chore: scaffold S3-09 T1 stubs
  test: cli core dispatch and envelope (S3-09 T1)
* chain3/s3-11:
  test: refresh integration waits for restic reload window (S3-11 T6fix)
  test: refresh gated real-mount refresh (S3-11 T6)
  feat: refresh loop interval triggers coalescing (S3-11 T5)
  chore: scaffold S3-11 T5 stubs
  test: refresh loop interval triggers coalescing (S3-11 T5)
  feat: refresh refresher build publish keep last good (S3-11 T4)
  chore: scaffold S3-11 T4 stubs
  test: refresh refresher build publish keep last good (S3-11 T4)
  feat: refresh reconcile listed snapshots with mount ids (S3-11 T3)
  chore: scaffold S3-11 T3 stubs
  test: refresh reconcile listed snapshots with mount ids (S3-11 T3)
  feat: refresh presence cache (S3-11 T2)
  chore: scaffold S3-11 T2 stubs
  test: refresh presence cache (S3-11 T2)
  feat: prewarm select and bounded run (S3-11 T1)
  chore: scaffold S3-11 T1 stubs
  test: prewarm select and bounded run (S3-11 T1)
* stage-2:
  test: refresh integration waits for restic reload window (S3-11 T6fix)
  fix: file node serves current generation after publish (S3-05 R1)
  test: file node serves current generation after publish (S3-05 R1)
  test: refresh gated real-mount refresh (S3-11 T6)
  feat: refresh loop interval triggers coalescing (S3-11 T5)
  chore: scaffold S3-11 T5 stubs
  test: refresh loop interval triggers coalescing (S3-11 T5)
  feat: refresh refresher build publish keep last good (S3-11 T4)
  chore: scaffold S3-11 T4 stubs
  test: history gated end-to-end mount tests (S3-05 T7)
  test: refresh refresher build publish keep last good (S3-11 T4)
  feat: refresh reconcile listed snapshots with mount ids (S3-11 T3)
  chore: scaffold S3-11 T3 stubs
  test: refresh reconcile listed snapshots with mount ids (S3-11 T3)
  feat: refresh presence cache (S3-11 T2)
  chore: scaffold S3-11 T2 stubs
  test: refresh presence cache (S3-11 T2)
  feat: prewarm select and bounded run (S3-11 T1)
  chore: scaffold S3-11 T1 stubs
  test: prewarm select and bounded run (S3-11 T1)
* stage-2: (43 commits)
  refactor: shared path-under helper (R-PATH T1)
  test: allow pathutil in resolver deps and drop private within test (R-PATH T1fix)
  chore: scaffold R-PATH T1 stubs
  test: shared path-under helper (R-PATH T1)
  test: refresh integration waits for restic reload window (S3-11 T6fix)
  fix: file node serves current generation after publish (S3-05 R1)
  test: file node serves current generation after publish (S3-05 R1)
  test: refresh gated real-mount refresh (S3-11 T6)
  feat: refresh loop interval triggers coalescing (S3-11 T5)
  chore: scaffold S3-11 T5 stubs
  test: refresh loop interval triggers coalescing (S3-11 T5)
  feat: refresh refresher build publish keep last good (S3-11 T4)
  chore: scaffold S3-11 T4 stubs
  test: history gated end-to-end mount tests (S3-05 T7)
  test: refresh refresher build publish keep last good (S3-11 T4)
  feat: history supervisor one mount per repository (S3-05 T6)
  feat: history build registered dirs to projection spec (S3-05 T5)
  chore: scaffold S3-05 T5+T6 stubs
  test: history build registered dirs to projection spec (S3-05 T5)
  test: history supervisor one mount per repository (S3-05 T6)
  ...
* chain3/s3-10: (29 commits)
  feat: status from refresh result (S3-10 T2b)
  chore: scaffold S3-10 T2b stubs
  test: status from refresh result (S3-10 T2b)
  feat: daemon run status refresh commands (S3-10 T7)
  chore: scaffold S3-10 T7 stubs
  test: daemon run status refresh commands (S3-10 T7)
  fix: failed startup still unmounts started mounts (S3-10 T6b)
  test: failed startup still unmounts started mounts (S3-10 T6b)
  feat: daemon shutdown order (S3-10 T6)
  feat: daemon op handlers (S3-10 T5)
  chore: scaffold S3-10 T5 stubs
  test: daemon shutdown order (S3-10 T6)
  test: daemon op handlers (S3-10 T5)
  feat: daemon lock and startup (S3-10 T4)
  chore: scaffold S3-10 T4 stubs
  test: daemon lock and startup (S3-10 T4)
  test: recovery repairs pending links (S3-10 T3b)
  feat: daemon status snapshot (S3-10 T2a)
  chore: scaffold S3-10 T2a stubs
  test: daemon status snapshot (S3-10 T2a)
  ...
…on test

Seeding is explicit per SPEC.md, so the fixture root needs an explicit
snapback link before its .snapshot entry exists. Poll for the published
history entry instead of listing once, which raced the debounced refresh.
startDaemon now hands the child process its own log file, so the daemon's
stdout and stderr stream to disk and survive a kill. On a failed test the
capture's last 200 lines go to t.Log and, when SNAPBACK_EVIDENCE_DIR is set,
the whole capture is appended to <dir>/<acc>-daemon.log, named after the acc
recordEvidence used. The evidence JSON files are unchanged.
pollEligible decoded EligibleCount at the top level, but status --json prints an
{"ok":...,"data":{...}} envelope, so the map was always empty and Acc 12 timed out
on Linux CI. Decode the data envelope instead; poll semantics and error text stay.
Watch roots must come from each root's seed_paths, carrying max_depth and
the root's exclusions; a root naming no seed path is not watched. Adds a
MaxDepth compile shim on WatchRoot with no behaviour.
watchRoots now emits one seed.WatchRoot per configured seed path, carrying its
max_depth; a root without seed_paths is not watched. NewWatcher keeps MaxDepth
through its cleaning loop and covered() rejects dirs deeper than MaxDepth below
their root, using the seed planner's convention (root is depth 0, 0 = no limit).
Deps gains a Log *slog.Logger as a declaration-only compile shim; the daemon
does not use it yet, so the new tests fail by assertion.
New substitutes a discarding logger for a nil Deps.Log. Each refresh logs one
Info line with the generation, per-repository state, eligible/linked counts and
failed repositories; an outcome equal to the last logged one is dropped because
the periodic loop refreshes as soon as it starts. A failed Supervisor.Start logs
one Error line naming the repositories and the error. daemonBuilder wires the
logger to a text handler on os.Stderr.
Tag Snapshot, Repo, RecoverySummary and ThrottleEvent with snake_case JSON keys, and make the
acceptance status envelope decode those keys exactly.
usage.md gains a status --json example whose data keys are the snake_case wire keys,
plus a Daemon logs section for the change-gated refresh Info line and the mount-failure
Error line. configuration.md states that the Linux inotify watcher covers only the
seed_paths entries, within max_depth, and that macOS has no watcher. test/docs guards
the example's data keys against a populated status.Snapshot.
Go cancels t.Context before t.Cleanup runs, so Acc 17's cleanup never
executed `snapback service uninstall` and failed with "context canceled".
Add runSnapbackCtx/systemctlUserCtx variants and a cleanupContext helper
(30s, context.Background) and use them in Acc 17's cleanup, keeping the
diagnostics-then-uninstall order.
Restic keeps tree blobs in data/ packs too, so the daemon's own refresh and
pre-warm open the very packs the crawler window watches. Wait for status
--json to report prewarm.pending == 0 with warm >= 1, then hold the counter
at zero for a settle window before running the crawlers.

writeLinkConfig now sets catalog.refresh_interval to 10m so no periodic
refresh can land inside that window.

ripgrep skips hidden directories and honours ignore files by default, so
plain `rg -L x proj` never descends into .snapshot and never trips the
reader policy. Add --hidden --no-ignore. rg is already in the default
catalog.reader_policy.deny_processes list, so the config needs no rule.
…n content reads

writeLinkConfig set no_cache: true, so restic mount re-read TREE packs from
data/ on every FUSE lookup, including the daemon's own idle probes. Acc 12
counts IN_OPEN under data/ as crawler content reads, so it saw 8 opens while
idle and failed on Linux. With cache_dir set, restic serves trees, index and
snapshots from the cache and only real data blobs touch data/, which is the
premise the test needs. Same shape writeHistConfig already uses; config
rejects cache_dir and no_cache together, so no_cache is dropped.
…e trip the policy

The control walked .snapshot and read the first regular file, which is the
synthetic info.json, so no restic data pack was opened. Read
.snapshot/latest/src/deep/a.txt instead and assert its bytes.

The throttle probe used rg, whose worker threads make the comm the policy
resolves per request unreliable; find is single-threaded and deny-listed, and
-L makes it enter the history mount.
…ROC-1)

FUSE reports the calling thread id, so a crawler's worker thread name hides the
process name the deny list matches on.
…C-1)

Read Tgid from /proc/<tid>/status and take the leader's comm, so a crawler's
worker thread no longer bypasses the deny list. Falls back to the thread's own
comm when status is unreadable or has no Tgid.
The goldens and the user-scope line assertion now require KillMode=mixed
right after Type=simple, so systemd signals only the daemon on stop.
…ts children (SVC-KILLMODE)

Default control-group kill sends SIGTERM to the daemon and its restic mount
at once, so restic dies before the daemon unmounts it and the mountpoint is
left dead. KillMode=mixed signals only the main process, then SIGKILLs the
rest after TimeoutStopSec.

The integration test's cleanup now lazily unmounts a stale repository mount
so TempDir removal cannot fail on a dead FUSE endpoint; its assertions are
unchanged.
The final find -L probe produced no reader-policy event on Linux CI and its
exit status and stderr were discarded, so the failure carried no evidence.
Run both probes with CombinedOutput, log exit and truncated output, log the
status throttle array, and accept find or rsync as the denied process.
Acc 12 on Linux showed the reader policy denying reads while status --json
reported "throttle": null. Deps.Throttle is wired but never called.
Status now calls Deps.Throttle when it is set and puts its events in the
snapshot, so snapback status --json reports the denials and bursts the
reader policy recorded instead of null.
CI run 35720597517 (job "FUSE integration (linux)") uploaded v0.1-evidence-linux:
fixtures, acc-01..acc-17 and the two perf checks, all status pass on kernel
6.17.0-1022-azure with fusermount3 3.14.0 and restic 0.19.0. The 20 files are
committed unedited under docs/reports/v0.1/linux/ and every Acc row in the v0.1
acceptance report now cites them. The evidence records commit 354ace1, so the
report cites that commit rather than the merge commit.
@adeelahmad
adeelahmad marked this pull request as ready for review September 22, 2026 11:37
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Resolved docs-site/index.md: stage-2 rewrite plus the Privacy section.
Resolved mkdocs.yml: stage-2 nav entries plus the analytics extra block.
A CLI probe holding the lock for a microsecond killed the daemon with a false
"another daemon is running". Pin a bounded retry window via a lockWith seam,
plus the fast path and Running's holder detection.
Lock now polls flock every 25ms for up to 2s before reporting another daemon,
so a CLI probe taken in the same microsecond no longer kills a starting daemon.
Running probes with LOCK_SH, which still detects an exclusive holder while
holding the file for a shorter, non-exclusive instant.
@adeelahmad
adeelahmad merged commit 5b5dd2f into master Sep 22, 2026
34 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0