Skip to content

fix: confirm_scars must not green-light a failed retrieval (GIT-93 step 2) - #27

Merged
nTEG-dev merged 1 commit into
mainfrom
bugfix/GIT-93-step2-retrieval-failure-signal
Aug 9, 2026
Merged

fix: confirm_scars must not green-light a failed retrieval (GIT-93 step 2)#27
nTEG-dev merged 1 commit into
mainfrom
bugfix/GIT-93-step2-retrieval-failure-signal

Conversation

@nTEG-dev

@nTEG-dev nTEG-dev commented Aug 9, 2026

Copy link
Copy Markdown
Member

GIT-93 step 2. Step 1 (#26) fixed the RPC names; this fixes the reason nobody noticed they were wrong.

The problem

An empty scar set had two causes and one answer:

  1. recall() reached the store and matched nothing — proceeding is correct
  2. recall() never reached the store — nothing was checked

Both produced:

ok  No recall-surfaced scars to confirm. Proceed freely.

The *_scar_search RPC 404'd on every call since it was written, and the protocol reported success for that failure. Nothing ever accumulated into a signal. Fixing the name without fixing the signal leaves the next such break just as well hidden — that's the defect actually worth removing.

The change

recall records a failure marker on the session when the store can't be reached, and clears it when a search succeeds. Cleared on success, not on attempt, and independent of result count: a search that ran and matched nothing is a real answer; a failed one is not an answer at all.

confirm_scars reads that marker before answering an empty set:

REJECTED Cannot confirm — institutional memory was not reached.

recall() failed at 2026-08-09T03:08:06.643Z: Supabase RPC error: 404 - {"code":"PGRST202", ...}

This is NOT the same as no relevant scars. Nothing was checked, so any
warning that applies to this work is still unseen. Treat it as memory
being unavailable, not as a clean bill of health.

The marker persists to session.json and is restored on recovery, following recall_called. A restart is exactly the event this state exists to survive — it must not be what launders a broken store into a clean slate.

Verification

End to end, with a prefix whose match_<table> function does not exist:

before after
retrieval 404 PGRST202 404 PGRST202
confirm_scars Proceed freely REJECTED, quoting PGRST202

+6 tests (1185 → 1191), including the restart case. Confirmed to fail against the pre-fix behaviour (2 of 6 fail when the check is removed).

provenance-citation.test.ts mocks session-state and needed the two new exports added to its mock — no behavioural change to that suite.

Still open on GIT-93

Step 3: reconcile the prefix rule with GIT-84 — one documented statement of which object classes GITMEM_TABLE_PREFIX applies to.

🤖 Generated with Claude Code

…ep 2)

An empty scar set had two causes and one answer. recall() ran, reached the
store and matched nothing — proceeding is correct. Or recall() never reached the
store — nothing was checked and any warning that applies is still unseen. Both
produced:

  ok  No recall-surfaced scars to confirm. Proceed freely.

This is why step 1 could hide for as long as it did. The *_scar_search RPC 404'd
on every call from the day it was written, and the protocol reported success for
that failure, so nothing accumulated into a signal anyone could notice. Fixing
the RPC name without fixing the signal would leave the next such break equally
well hidden — which is the actual defect worth removing.

recall now records a failure marker on the session when the store cannot be
reached, and clears it when a search succeeds. Cleared on success rather than on
attempt, and independent of how many scars came back: a search that ran and
matched nothing is a real answer; a failed one is not an answer at all.

confirm_scars reads that marker before answering an empty set. On a failure it
returns valid: false, names the underlying error, and says plainly that this is
not the same as no relevant scars.

The marker persists to session.json and is restored on recovery, following
recall_called. A restart is exactly the event this state exists to survive, so
it must not be the thing that launders a broken store into a clean slate.

Verified end to end: with a prefix whose match_<table> function does not exist,
recall 404s and confirm_scars returns REJECTED quoting PGRST202, where it
previously returned "Proceed freely".

+6 tests (1185 -> 1191), including the restart case, and confirmed to fail
against the pre-fix behaviour (2 of 6). provenance-citation.test.ts mocks
session-state and needed the two new exports added to its mock.

Co-Authored-By: Claude Opus 5 <[email protected]>
@nTEG-dev
nTEG-dev merged commit cb9f0f7 into main Aug 9, 2026
4 checks passed
@nTEG-dev
nTEG-dev deleted the bugfix/GIT-93-step2-retrieval-failure-signal branch August 9, 2026 03:09
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