Skip to content

fix: bounded write-path check with an UNVERIFIED verdict; self-describing close WARNs (GIT-102) - #41

Merged
2 commits merged into
mainfrom
bugfix/GIT-102-diagnostics
Sep 22, 2026
Merged

2 commits merged into
mainfrom
bugfix/GIT-102-diagnostics

Conversation

@nTEG-dev

Copy link
Copy Markdown
Member

What

The startup write-path check can no longer go quiet, health shows its verdict, and session_close's WARN says what failed and whether the session was saved (GIT-102).

  • Bounded check: checkWritePathWithTimeout() races the startup probe against 10 s. A store that never answers gives the verdict timed out after 10 s, durability UNVERIFIED and a loud stderr warning. If the probe answers later, its real verdict replaces that one, marked late. server.ts uses it on both startup paths (with and without a license key).
  • health exposes the last verdict: a write_path field, plus a first line such as Write path: Supabase — … writes are durable (ok, checked …, 327 ms) or Write path: timed out after 10 s, durability UNVERIFIED (NOT OK, …). Before any verdict exists it says not checked yet.
  • Self-describing WARN: WARN 1 write failure becomes one line per failing subsystem:
    WARN knowledge graph (triples): 1 of 1 write failed — 1/1 triples failed: Supabase upsert error: 400 - {"code":"22P02",…"invalid input syntax for type uuid: \"t-b4d09cb0\""} · session content stored OK
    
    Every line carries the mandatory clause session content stored OK or session content NOT stored, taken from whether the session row actually landed, not from overall close success.

Found along the way (fixed here, same class)

A probe that failed fast with a network or auth error was deliberately ignored ("out of scope"), so a store refusing every connection logged Write-path OK. The timeout only catches hangs. That case is now its own verdict: unreachable, store unreachable (<error>), durability UNVERIFIED. Counting skipped, there are now six modes: timed_out is the fifth outcome the ticket asked for, and unreachable is the extra one.

How to test

Venue (v1.8.0 setup.sql, vujndhcumgroztfkkdus; production not touched): flow now requires every close WARN to match <subsystem>: N of M writes failed — <cause> · session content (stored OK|NOT stored), and health to carry a Write path: line. The GIT-105 triple 400 provides a real write failure to describe.

origin/main 1.10.0 This branch
Close WARN WARN 1 write failure the line above, which names GIT-105's own cause
health no write-path verdict Write path: Supabase — learnings/decisions tables present, writes are durable (ok, …, 327 ms)
Exit 1 0

A store that hangs (local probe, not the venue: a TCP listener that accepts and never answers, used as SUPABASE_URL; health called at 11.5 s):

origin/main This branch
health line 1 No tracked effects this session. Write path: timed out after 10 s, durability UNVERIFIED (NOT OK, checked …, 10018 ms)
stderr nothing: the probe is still pending ⚠️ [gitmem] WRITE PATH: timed out after 10 s, durability UNVERIFIED.

Unit tests: 1288/1288 pass (+14):

  • timeout: 10 s default; a probe that never answers resolves at the deadline; a late answer replaces the verdict; health line formats;
  • checkWritePath verdicts: ok, missing tables, connection refused → unreachable, auth failure → unreachable. Both unreachable cases fail on main, where they report supabase, ok;
  • WARN lines: subsystem name, cause, stored OK / NOT stored on every line, unknown subsystem, no failures → no WARN.

No existing test encoded the old behaviour.

Checklist

  • npm run test:unit passes (1288)
  • New tests added
  • No schema change; verified on a v1.8.0 store
  • Docs: none describe health output

Breaking changes

None. health gains a first line and a write_path field; close WARN text changes.

🤖 Generated with Claude Code

Claude and others added 2 commits September 21, 2026 20:36
…elf-describing close WARNs (GIT-102)

- checkWritePathWithTimeout() races the startup probe against 10 s. A store
  that never answers gives "timed out after 10 s, durability UNVERIFIED"
  instead of silence; a late answer replaces it, marked late. server.ts uses
  it on both startup paths.
- The last verdict is exposed through health (write_path, and a first line
  "Write path: ..."). It was visible only on stderr, and not at all on a hang.
- A probe that errored with anything but a missing table was ignored, so a
  store refusing every connection logged "Write-path OK". It is now
  "unreachable", durability UNVERIFIED.
- session_close's "WARN N write failures" becomes one line per failing
  subsystem: name, failure count, cause (its latest error), and a mandatory
  "session content stored OK / NOT stored" clause, from whether the session
  row actually landed.

+14 tests; the unreachable and timeout cases fail on origin/main.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…h verdict in health (GIT-102)

Exits 1 on 1.10.0 ("WARN 1 write failure"; health without a verdict).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@nTEG-dev nTEG-dev closed this pull request by merging all changes into main in f93c3a3 Sep 22, 2026
neoneye pushed a commit to agent-memory-atlas-archive/gitmem-dev--gitmem that referenced this pull request Sep 22, 2026
Conflicts:
- session-close.ts: gitmem-dev#40 and gitmem-dev#41 add the same sessionRowStored flag; one
  declaration kept (one assignment after the upsert), comment covers both uses.
- blank-supabase.mjs: all result fields and all checks kept.
tsc clean; no new returns to type.
@nTEG-dev
nTEG-dev deleted the bugfix/GIT-102-diagnostics branch September 23, 2026 05:49
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