Conversation
…write semantics (closes #778) Phase A (Skills) was the oldest of the three context-gateway phase tests and only asserted the 409 response label. ADR-0001 §5 c4 pins **conflict semantics** — a regression that returned 409 + status == "aborted" and *then* wrote body.content would have gone undetected. Tighten ``TestUpdateSkill.test_mtime_conflict`` in place with two additional assertions, mirroring the strict shape of the Agents test at ``test_web_routes_context.py:801-802``: 1. ``data["mtime_ns"]`` echoes the manifest's on-disk ``st_mtime_ns`` — pins the retry-hint contract from ``context_skills.py:199-208``. 2. The manifest content on disk is unchanged after the 409 — pins the no-write semantics §5 c4 actually targets. Verified: mutation-tested by moving ``atomic_write_text`` above the guard in ``context_skills.py:198-209``; the new content assertion failed on ``'# Changed' == '# Test skill'`` while the 409 / status / mtime_ns echo assertions all still passed, confirming the test catches exactly the class of regression §5 c4 is designed to prevent. The mutation was reverted before the commit. The 409 path itself in production code is unchanged — this is purely test-coverage hardening. Refs: #778, #777 (Phase B sibling), #761 (parent RFC), #769 (ADR §5) Co-Authored-By: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TestUpdateSkill.test_mtime_conflictto pin ADR-0001 §5 c4 no-write semantics on the canonical PUT route.test_web_routes_context.py:801-802(which already asserts bothmtime_nsecho + content-unchanged).packages/memtomem/src/memtomem/web/routes/context_skills.py:199-208) is unchanged — this is purely test-coverage hardening.What §5 c4 actually requires
§5 c4 pins conflict semantics, not just the response label. The
existing
TestUpdateSkill.test_mtime_conflict(status_code == 409 +status == "aborted") would still pass a regression that wrote
body.contentand then returned the abort envelope.This PR adds two assertions on top of the existing pair:
data["mtime_ns"] == str(manifest_path.stat().st_mtime_ns)— pins the retry-hint contract fromcontext_skills.py:199-208.manifest_path.read_text(...) == "# Test skill\n"— pins the no-write semantics §5 c4 actually targets.Mutation validation
Before commit, I verified the hardened test is regression-tight by
mutating
context_skills.py:198-209to performatomic_write_textbefore the mtime-guard. The 409 /
status == "aborted"/mtime_nsecho assertions all still passed (the response shape is unchanged),
but the new content assertion failed on
'# Changed' == '# Test skill'— confirming the test catches exactly the class of regression §5 c4 is
designed to prevent. The mutation was reverted before the commit
(
git diff packages/memtomem/src/memtomem/web/routes/context_skills.pyreturns empty in the final commit).
Phase strictness map (post-merge)
status: "aborted"mtime_nsechoThe Phase B
mtime_nsecho gap is intentionally out of scope here —§5 c4's "conflict semantics" requirement is satisfied by the no-write
assertion alone, which #777 already pins. File a separate hygiene
issue if the team wants strict three-phase echo parity.
Test plan
uv run pytest -m "not ollama" packages/memtomem/tests/test_web_routes_context.py— 57/57 greenuv run ruff check packages/memtomem/tests/test_web_routes_context.pyuv run ruff format --check packages/memtomem/tests/test_web_routes_context.pyRefs: #778, #777 (Phase B sibling), #761 (parent RFC), #769 (ADR §5)
🤖 Generated with Claude Code