Skip to content

Surface GTM handoff trace#3

Merged
gorajing merged 4 commits into
mainfrom
codex/system-legibility-traceability
May 28, 2026
Merged

Surface GTM handoff trace#3
gorajing merged 4 commits into
mainfrom
codex/system-legibility-traceability

Conversation

@gorajing
Copy link
Copy Markdown
Owner

Summary

  • render GTM handoff trace cards with a clear research-seed-not-evidence warning
  • validate required trace metadata and http/https operator links at import time
  • emit importer result JSON for cross-repo demo validation
  • refresh README and screenshot for the new trace surface

Verification

  • pnpm typecheck
  • pnpm test
  • SALES_REPO=../Sales npm run demo:cross-repo from gtm-ops-router
  • browser smoke of imported account trace links
  • Claude review loop until no substantive findings

gorajing and others added 4 commits May 28, 2026 00:58
Polish for the GTM-handoff trace surfacing before merge:
- Extract isSafeHttpUrl + parseOperatorLinks to lib/gtm-handoff/trace.ts —
  one owner of "what is a safe operator link", used by both the importer's
  Zod refine (write boundary) and the account page (render sink). The page
  re-checks because an <a href> is an XSS sink and payloadJson is opaque
  stored text; we dedupe the rule, not the two enforcement points.
- Drop the account page's local GtmTracePayload type, which declared
  trace.sourceSystem/evidenceBoundary fields the renderer never read. The
  "not verified evidence" warning is unconditional, which is correct: the
  importer enforces the evidenceBoundary literal, so every stored handoff
  is a research seed by contract.
- Add tests/unit/gtm-handoff-trace.test.ts covering protocol rejection,
  malformed JSON, and the per-link degrade path.

Verified: pnpm typecheck clean; vitest 88/88; codex review -> none.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The claim-audit span filter matched validation issues to spans via
`issue.detail.includes(span.evidence_id)` against a free-text detail
string. Two spine-level bugs: (a) substring cross-match (ev_1 matched a
detail mentioning ev_12); (b) one not-in-snippet span for an id dropped
EVERY span citing that id, including valid ones — silently discarding
verifiable claims on a tool whose whole value is "every claim traces to
verified evidence."

ValidationIssue now carries structured evidenceId/span (detail unchanged);
a pure selectValidSpans() matches by exact (evidenceId, span) identity;
claim-audit delegates to it. Two new tests cover the cross-match and
span-identity cases (both fail under the old filter).

Verified: pnpm typecheck clean; vitest 91/91; codex review -> none.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The importer required a `trace` block in v1 payloads, which breaks older
or minimal v1 exports generated before the trace block existed (e.g. the
original committed sample). Make `trace` optional — still enforcing the
exact sourceSystem/evidenceBoundary literals when present. Absence is safe:
the research-seed boundary is enforced structurally by the evidence layer
(only `verified` rows are citable; the importer never writes evidence) and
the account page shows the "not verified evidence" notice regardless — not
by this metadata label. Adds a test that a trace-less v1 payload imports.

Verified: pnpm typecheck clean; vitest 92/92; codex review -> none.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gorajing gorajing merged commit 46e3cb3 into main May 28, 2026
@gorajing gorajing deleted the codex/system-legibility-traceability branch May 28, 2026 20:51
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