Repository navigation
test(watch-triage): restore lost marker-key injectivity and cross-bash regression tests - #73
Merged
Merged
Conversation
…ssions PR #18 (commits 4621615a, 26d1b380) added test_window_marker_keys_are_injective_and_ignore_legacy_state and test_window_marker_key_is_stable_across_bash_generations to prove fm_window_marker_key (bin/fm-marker-lib.sh) is injective and produces identical keys across bash generations for a non-ASCII endpoint. The production code from those commits (fm_window_marker_key, window_key wrapping it, the shared owner used by fm-supervise-daemon.sh and bin/backends/herdr.sh) is already on main. The two regression tests themselves were silently dropped when the PR18 branch was first merged into main at 44c296b (an unrelated docs commit whose merge diff reverted several fixtures back to the old colliding tr encoder and never carried the two new test functions forward), even though bin/fm-marker-lib.sh's header comment still names them as pinning tests. Restore both tests verbatim from 88cce04 (the PR18 merge), verified passing in isolation against current main's fm_window_marker_key (including its byte-masking refinement) and against tests/wake-helpers.sh's independent od-based watch_marker_key oracle. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014crY8agKaxBLcWeGkh2NZY
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Intent
Recover and finish the preserved watcher marker-key work from task fm-window-key-injective-2878: restore the two lost watch-triage marker-key regression tests - that watcher marker keys are injective and filename-safe, and that a non-ASCII endpoint yields an identical key across bash generations - since the marker-key production code is already on fork main and a prior merge silently dropped only those two tests. Fork main is now fixed, so this work is rebased onto current fork main and CI re-runs for a genuine green. Do not skip the CI gate; do not expand scope onto the inherited Herdr regression (owned by fm-main-ci-failures); do not merge. [recorded 2026-09-13, key=herdr-ci-preexisting-red]
What Changed
test_window_marker_keys_are_injective_and_ignore_legacy_statetotests/fm-watch-triage.test.sh, verifying that distinct window endpoints differing only by punctuation (.,_,/,:) derive distinct, filename-safev2-<hex>marker keys, that the watcher persists a.hash-<key>file per derived key, and that pre-existing ambiguous legacy marker state (.hash-s_a_b/.count-s_a_b) is left untouched rather than trusted or rewritten.test_window_marker_key_is_stable_across_bash_generationsplus itsmarker_key_under_bashhelper, confirming a non-ASCII window endpoint (s:café) produces an identical marker key when derived under the currentbash,/bin/bash, and/usr/bin/bash, matching the byte-oracle expectation fromwatch_marker_key.test_procevent_marker_keys_are_injectiveentry.Risk Assessment
✅ Low: The change is a minimal, verbatim restoration of two previously-dropped test functions into the existing test registry, touching no production code; both tests exercise real observable behavior (spawning the watcher process, invoking fm_window_marker_key across multiple real bash binaries, checking persisted state files) rather than asserting on source text, and the commit's provenance claims (source commits, dropped-in-merge commit) were verified to exist and match.
Testing
Confirmed via
git diff --statthat this change only adds the two named tests to tests/fm-watch-triage.test.sh (no production code changed, matching the stated intent that the marker-key implementation was already fixed on fork main). Both restored tests were driven live: they pass against the current bin/fm-marker-lib.sh, and an adversarial mutation of the marker-key function proved the injectivity test genuinely detects a broken implementation rather than passing vacuously. No scope was expanded onto the Herdr regression, and no CI/push/merge phases were invoked — this report covers only the assigned test phase.test_window_marker_keys_are_injective_and_ignore_legacy_staterun standalone: 'ok - colliding endpoint spellings receive distinct filename-safe markers and ignore ambiguous legacy state'test_window_marker_key_is_stable_across_bash_generationsrun standalone: 'ok - a non-ASCII endpoint keeps one persistent marker key across bash generations'Evidence: Restored tests passing live
Evidence: Adversarial mutation caught by the injectivity test
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
test_window_marker_keys_are_injective_and_ignore_legacy_staterun standalone: 'ok - colliding endpoint spellings receive distinct filename-safe markers and ignore ambiguous legacy state'test_window_marker_key_is_stable_across_bash_generationsrun standalone: 'ok - a non-ASCII endpoint keeps one persistent marker key across bash generations'Extracted and rantest_window_marker_keys_are_injective_and_ignore_legacy_stateandtest_window_marker_key_is_stable_across_bash_generationsfrom tests/fm-watch-triage.test.sh as a standalone scenario script (bash tests/fm-watch-triage-scenario.test.sh, deleted after each run) — both pass against unmodified bin/fm-marker-lib.sh.Adversarial mutation of bin/fm-marker-lib.sh's fm_window_marker_key (stripped hex-encoding, causing s:a.b/s:a_b collision) then re-ran the same scenario script — the injective/filename-safe test failed as expected ('watcher did not persist the derived marker key'), confirming the test is not vacuous. Reverted the mutation immediately after.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.