Repository navigation
fix(test): bind the hermetic agent-tools memory case to its fake datastore - #10450
Conversation
…store The agent-tools case of TestSurfaceDefaultAccessMatrix reads through utils.retrieval.tool_services.memories.get_memories_text, which resolves the Firestore client this module captured at import time. The case never bound it, so it only passed when an earlier test's fixture happened to rebind that name; run on its own it reaches for real Firestore and fails with PermissionDenied against test-e2e-project — an order dependency and a hermeticity hole (BasedHardware#10423). Bind the module's client to the case's fake_firestore explicitly, so the case is order-independent and never leaves the hermetic stack. The reader clock is already injected end to end (get_memories_text(now=) → MemoryService.read → read_canonical_memories → filter_canonical_default_visible_items), verified by re-running the matrix with the fixture clock moved 18 months into the past: still 6 passed. So this case is now both date- and order-independent. Refs BasedHardware#10423. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Nice find and clean fix — thanks @aryanorastar. I verified the root cause statically: The Backend Hermetic Merge Gate and Hermetic Backend E2E are green on this head, so the order dependency is resolved. The remaining check entries appear as skipped/cancelled only because this is a test-only path with no source formatting/hygiene surface. Leaving formal approval to a human maintainer; from a correctness standpoint this looks good. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
What
Fixes the order dependency in
TestSurfaceDefaultAccessMatrix::test_surface_excludes_archive_and_respects_grants[agent_tools], the case failing the Backend Hermetic E2E job (and therefore the Backend Hermetic Merge Gate) across several open PRs.Fixes #10423.
Root cause
The agent-tools case reads through
utils.retrieval.tool_services.memories.get_memories_text, which resolves the Firestore client that module captured at import time (from database._client import db as firestore_db). The case never bound that name, so it only passed when an earlier test's fixture happened to rebind it.Run on its own it reaches for real Firestore:
That's both an order dependency and a hermeticity hole — a "hermetic" case escaping to a real service.
Fix
Bind the module's client to the case's
fake_firestoreexplicitly. Six added lines, test-only.On the clock half of #10423
The issue also suspected the reader evaluated short-term expiry against the wall clock. That part is already resolved on current
main— the clock is injected end to end:get_memories_text(now=)→MemoryService.read(now=)→read_canonical_memories(now=)→filter_canonical_default_visible_items(now=)I verified it rather than assuming: re-ran the matrix with the fixture clock moved 18 months into the past (
NOW = 2025-01-15) — 6 passed. If the wall clock still leaked, thefresh-shortfixture would have been filtered. So after this change the case is both date- and order-independent.Verification
NOW−18 months): 6 passedProduct invariants affected
none
Failure-Class: none