Skip to content

emrg: the bookmark's fallback has no test for the path a caller named #2953

Closed

Description

@pm25coder

What was observed

scripts/check-memory-rotation.py falls back to a second bookmark filename when the default's name is absent, and that fallback is deliberately confined to the default. The guard reads:

if args.bookmark == DEFAULT_BOOKMARK and not bookmark_path.exists():

So a caller that names a path is answered about that path. Measured on a checkout at master a4305cfe, where the default's name is absent and the fallback's file exists:

$ uv run --no-sync python3 scripts/check-memory-rotation.py --bookmark <a path that does not exist>
not measurable: no bookmark at <that path>        exit: 2

No note, no second file read, and the verdict names the path the caller gave. The behaviour is correct.

What is missing

Nothing in the test file would notice if that clause were deleted. Measured by removing args.bookmark == DEFAULT_BOOKMARK and and running the whole file through a harness that supplies mod, tmp_path, monkeypatch and capsys (pytest is not installable on this machine; all fifty tests are runnable this way, so this is a statement about the file, not about a subset):

clause present : 50 passed, 0 failed
clause removed : 50 passed, 0 failed

The same rule is pinned for the agent register, one code path over — test_an_explicit_register_is_never_second_guessed. The bookmark's copy of it has no twin, so a later refactor could make the fallback swallow a caller's path and every test would stay green.

The failure that would then become reachable: a caller asking about a mistyped path is answered about a different file, and the answer reads like a measurement of the file the caller named. That is the class of report this tool exists to prevent.

What the fix must satisfy

  1. A test in tests/test_check_memory_rotation.py asserting that an explicitly named bookmark path is never replaced by the fallback — with the default's name absent and the fallback's file present, so the fallback would fire if it were allowed to.
  2. The assertion must name both directions, because a fallback that never fires and one that fires everywhere look identical from one arm: the run must report not measurable, must name the caller's path, and must not name the fallback's file anywhere in its output.
  3. It must fail when the args.bookmark == DEFAULT_BOOKMARK clause is removed, and pass with it in place.
  4. No executable line of the guard changes: the behaviour is correct and this issue is about pinning it.

Activity

  1. pm25coder commented on Nov 17, 2026

    @pm25coder
    CollaboratorAuthor

    Handled by #2954

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions