Skip to content

test(mem0): lock the D-7 interlock's absent-capture fail-safe - #552

Merged
Kyzcreig merged 1 commit into
mainfrom
fix/d7-interlock-capture-default
Aug 10, 2026
Merged

Kyzcreig merged 1 commit into
mainfrom
fix/d7-interlock-capture-default

Conversation

@Kyzcreig

Copy link
Copy Markdown
Collaborator

What

Adds two regression tests pinning resolve_capture()'s final
return "auto", "default" — the fleet-wide fail-safe that keeps the D-7
interlock engaged on any profile whose mem0.json omits a capture key
(that is every non-root profile in this fleet).

Test-only. plugins/memory/mem0/__init__.py is byte-identical to the base commit.

Why (measured)

Filed from kanban card t_760693df, which asserted the D-7 interlock was
disarmed on 9 worker profiles because the profile mem0.json lacks a
capture key. That mechanism is falsified — absent config resolves to
("auto", "default"), i.e. capture ON, so the interlock engages. The card
had the polarity backwards; the card's prescribed fix (resolve the ROOT
mem0.json instead) measured inert: 0 of 10 profiles change their
capture_is_on decision.

But the audit did find one real, unguarded invariant. The whole fail-safe is a
single literal, and nothing tested it:

mutate  return "auto", "default"  ->  return "off", "default"
result  28/28 existing tests still pass
effect  D-7 interlock silently disarmed on every profile lacking a capture key

Verification

run result
clean tree 17 passed (was 15)
mutant M1 (auto->off in the default return) 2 failed, 15 passed — exactly the 2 new tests
mutant M2 ("auto" dropped from _CAPTURE_ON) 4 failed, 13 passed (2 new + 2 pre-existing)
scripts/run_tests.sh tests/plugins/memory/ 22 files, 449 passed, 0 failed

Reviewer note

The 2 new tests are the entire behavioural claim. M1 is the mutation they were
written to catch; it passed 28/28 before this commit.

resolve_capture()'s final `return "auto", "default"` is the fleet-wide
fail-safe that keeps the D-7 interlock ENGAGED on any profile whose
mem0.json omits a `capture` key -- which is every non-root profile here.
Nothing asserted it.

Measured: mutating that literal to `return "off", "default"` disarms the
interlock on every such profile and the existing mem0 suite stayed green
(28/28 pass against the mutant: 15 in tests/plugins/memory/
test_mem0_remember.py + 13 in plugins/memory/mem0/test_capture_pipeline.py).

Adds two tests:
  - test_resolve_capture_defaults_on_when_absent — pins value + source, and
    that empty/whitespace inputs fall through to the same default.
  - test_interlock_engages_when_profile_config_omits_capture — drives the
    real provider against a profile-shaped HERMES_HOME whose mem0.json has
    no `capture` key; asserts the write is suppressed and no POST /memories
    is ever issued.

Verified:
  clean tree          -> 17 passed (was 15)
  mutant M1 (auto->off in the default return)
                      -> 2 failed, 15 passed; exactly the 2 new tests
  mutant M2 ("auto" dropped from _CAPTURE_ON)
                      -> 4 failed, 13 passed (2 new + 2 pre-existing)
  scripts/run_tests.sh tests/plugins/memory/
                      -> 22 files, 449 tests passed, 0 failed

Test-only change; plugins/memory/mem0/__init__.py is byte-identical to the
base commit.

Refs: kanban t_760693df
@Kyzcreig
Kyzcreig added this pull request to the merge queue Aug 10, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 10, 2026
@Kyzcreig
Kyzcreig added this pull request to the merge queue Aug 10, 2026
Merged via the queue into main with commit cdeae84 Aug 10, 2026
32 checks passed
@Kyzcreig
Kyzcreig deleted the fix/d7-interlock-capture-default branch August 10, 2026 20:35
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