Skip to content

fix(install): capture installed_at at lockfile upsert (PR-D C2a, ADR-0008)#630

Merged
memtomem merged 1 commit intomainfrom
fix/pr-d-c2a-installed-at
May 1, 2026
Merged

fix(install): capture installed_at at lockfile upsert (PR-D C2a, ADR-0008)#630
memtomem merged 1 commit intomainfrom
fix/pr-d-c2a-installed-at

Conversation

@memtomem
Copy link
Copy Markdown
Owner

@memtomem memtomem commented May 1, 2026

Summary

  • PR-B fixup that ships independently of PR-D C2's mm context update work.
  • installed_at was captured before copy_tree_atomic, leaving freshly installed files with mtimes potentially later than the recorded installed_at. ADR-0008 PR-D's mtime > installed_at dirty check (Invariant 2) would then false-positive on the install's own writes under any non-trivial copytree latency.
  • Move capture to the lockfile-upsert boundary (after copy completes) so mtime <= installed_at holds for fresh installs by construction.

Why standalone

C2 (mm context update + dirty detection) consumes this invariant in its is_asset_dirty() classifier. Splitting the fixup into its own PR keeps that change reviewable as a real PR-B bug fix, independent of C2's much larger surface (update CLI, --all cross-project, .bak semantics).

No user-visible behavior change today; the lockfile semantic is tightened so the upcoming dirty check is sound.

Test plan

  • New regression test test_installed_at_after_all_writes: install a multi-file skill (4 files across 3 subdirs), walk dest, assert parsed installed_at >= max(dest mtimes) within 1ms slack.
  • Existing 19 install tests pass unchanged (packages/memtomem/tests/test_context_install.py).
  • Adjacent suites pass: test_context_install_widening.py, test_lockfile.py.
  • Full CI filter uv run pytest -m "not ollama" — 3476 passed, 46 deselected.
  • ruff check + ruff format --check — green.

Series

Part of ADR-0008 wiki layer:

🤖 Generated with Claude Code

…0008)

`installed_at` was captured before `copy_tree_atomic`, leaving freshly
installed files with mtimes potentially later than the recorded
`installed_at`. ADR-0008 PR-D's `mtime > installed_at` dirty check
(Invariant 2) would then false-positive on the install's own writes
under any non-trivial copytree latency.

Move the capture to the lockfile-upsert boundary (after copy completes)
so `mtime <= installed_at` holds for fresh installs by construction.

Add `test_installed_at_after_all_writes` to pin the invariant: install
a multi-file skill, walk the dest tree, and assert parsed
`installed_at` >= max(dest mtimes) within 1ms slack for fs precision.

Standalone PR-B fixup that ships independently of C2's `mm context
update` work; no user-visible behavior change today, but tightens the
lockfile semantic so the upcoming dirty check is sound.

Co-authored-by: Claude <[email protected]>
@memtomem memtomem merged commit 6495534 into main May 1, 2026
7 checks passed
@memtomem memtomem deleted the fix/pr-d-c2a-installed-at branch May 1, 2026 01:16
@github-actions github-actions Bot locked and limited conversation to collaborators May 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants