Skip to content

fix(hook): reship SessionStart vault false-positive fix (BUG-022, BUG-023)#171

Merged
mlorentedev merged 1 commit into
mainfrom
fix/bug-022-023-hook-false-positives
May 30, 2026
Merged

fix(hook): reship SessionStart vault false-positive fix (BUG-022, BUG-023)#171
mlorentedev merged 1 commit into
mainfrom
fix/bug-022-023-hook-false-positives

Conversation

@mlorentedev
Copy link
Copy Markdown
Owner

Why

PR #165 (same title) merged an empty commitgit show on the squash shows zero files changed, and origin/main's claude-session-start.sh still carries the un-anchored grep and AGENTS.md in critical_files. So both false-positives are still live on main. This reships the real fix that was never committed, plus the regression guard that was missing.

What

  • BUG-022check_knowledge_health anchored ^## Last Crystallized:, but the marker is indented when MEMORY.md is embedded in a YAML content: | block (how the knowledge vault stores it). The date was never parsed → false "crystallization never run". The anchor now tolerates leading whitespace.
  • BUG-023check_vault_baseline listed AGENTS.md as a vault critical file, but per ADR-010 AGENTS.md is single-SSOT in dotfiles (deployed, not duplicated to the vault) → false "Vault baseline FAIL". Removed from critical_files.

Guard (incident→guard)

tests/session-start-false-positives.bats — 4 hermetic tests:

  • BUG-022 recent indented date → not flagged
  • BUG-022 old indented date → IS parsed (CRYSTALLIZE NEEDED, not "never run")
  • BUG-023 absent AGENTS.md → no baseline failure
  • BUG-023 control: a genuinely missing canonical file STILL fails (proves the check was narrowed, not disabled)

Hermetic by copying the script into a temp dir so the Obsidian-launching vault-health.sh sibling is skipped — runs headless without the hang that affects session-start-config.bats.

Verification

  • bats tests/session-start-false-positives.bats → 4/4 pass
  • shellcheck clean on changed lines; bash -n OK
  • spec-gate: 8 production LOC < 50 (tests excluded), no spec required

…-023)

PR #165 merged an empty commit, so both false-positives are still live on
main. This reships the real fix plus a regression guard.

- BUG-022: check_knowledge_health anchored '^## Last Crystallized:' but the
  marker is indented when MEMORY.md is embedded in a YAML `content: |` block
  (the knowledge vault stores it that way), so the date was never parsed and
  the hook falsely reported "crystallization never run". The anchor now
  tolerates leading whitespace.
- BUG-023: check_vault_baseline required AGENTS.md as a vault critical file,
  but per ADR-010 AGENTS.md is single-SSOT in dotfiles (deployed, not
  duplicated to the vault). Removed from critical_files.

Guard: tests/session-start-false-positives.bats (4 tests, hermetic — copies
the script into a temp dir so the Obsidian-launching vault-health.sh sibling
is skipped and the suite runs headless). Incident->guard: the empty merge of
#165 meant no test ever proved the fix; there is one now.
@mlorentedev mlorentedev merged commit 9ad6357 into main May 30, 2026
6 checks passed
@mlorentedev mlorentedev deleted the fix/bug-022-023-hook-false-positives branch May 30, 2026 00:45
mlorentedev added a commit that referenced this pull request May 30, 2026
…167) (#175)

Defect 1 (the hang): the byte-equivalence test runs the full hook across CWDs
incl. $HOME/Projects/knowledge. With the vault present, the hook ->
vault-health.sh probes via the `obsidian` CLI (PATH), launching the real GUI
that never returns headless (40+ min hang, orphaned process tree). Fix (issue
option a): setup() shadows `obsidian` with a stub reporting GUI-down, so
vault-health exits 2 (already handled by the hook) instead of launching. Now
deterministic + hermetic for every test that runs the hook.

Defect 2 (stale-baseline false DIFF): compare against origin/main when available
(truer baseline than a possibly-stale local main), fallback to main.

Verified: bats tests/session-start-config.bats -> 14/14 in ~2s with the vault
present (previously hung). Hermetic regression tests for BUG-022/023 already
landed in PR #171 (the issue's follow-up).

Closes #167.
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