CI red on two guards:
- test/cli-exit-verdict-pin.test.ts: raw process.exitCode writes in
src/commands/reference.ts -> replaced with setCliExitVerdict.
- check:test-isolation R1: direct process.env.GBRAIN_SOURCE mutation in
test/reference-flag.test.ts -> wrapped the two runReference calls in
withEnv({ GBRAIN_SOURCE: undefined }).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Takeover of #1900 (rebased onto master + source-scoping repair).
Canon/reference figures imported from books/articles are real person/company
pages but have no dated history in the user's own life, so they sat
permanently red in timeline_coverage / entity_link_coverage with no
actionable fix.
- src/core/reference-flag.ts: single source of truth for the exclusion
predicate (frontmatter->>'reference') IS DISTINCT FROM 'true'.
- Predicate ANDed into numerator AND denominator at every entity-coverage
site: getHealth() entity_pages CTE (BOTH engines; postgres inlines the
literal since tagged-template interpolation binds), onboard/checks.ts,
onboard/init-nudge.ts. most_connected intentionally unfiltered.
- New CLI-only 'gbrain reference <slug> [--unset] [--source <id>]' writes
the flag to markdown frontmatter (durable) AND engine JSONB (immediate).
- Repair over #1900: the JSONB UPDATEs are now scoped to (source_id, slug)
— slug is only unique per source — with the source resolved from the
brain dir via the standard resolveSourceId chain (--source overrides).
- Skills/conventions docs + KEY_FILES entry; llms bundles regenerated.
- Tests: predicate/frontmatter units + PGLite e2e pinning the getHealth
exemption and the cross-source-twin scoping.
Fixes#1899
Co-authored-by: ElliotDrel <ElliotDrel@users.noreply.github.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>