v0.42.31.0 feat(links): open link_source provenance + link-add/link-rm/link-sources (#1941)#1957
Merged
Conversation
…tion v114 Open link_source from a closed allowlist to a kebab-case format gate (^[a-z][a-z0-9]*(-[a-z0-9]+)*$, char_length<=64) so external derivers stamp their own provenance (e.g. citation-graph) without a per-deriver migration. Migration v114: Postgres NOT VALID + VALIDATE (lock-friendly, transaction:false); PGLite plain DROP+ADD. Updates the schema.sql + engine provenance contract comments. (#1941)
…nk-sources
add_link/remove_link now accept --link-source/--link-type; add_link guards
the reconciliation-managed built-ins (markdown/frontmatter/mentions/
wikilink-resolved) and defaults omitted provenance to 'manual' (was the
misleading engine default 'markdown'). New cliHints.aliases mechanism with a
startup collision guard registers link-add/link-rm; printOpHelp shows the
invoked alias name. New list_link_sources read op + listLinkSources engine
method (both engines, {sourceId?,sourceIds?}, deterministic order) powers
`gbrain link-sources`, added to the minion read allowlist. (#1941)
Covers the v114 regex/length boundaries, upgrade-path constraint swap on existing data, the managed-built-in op guard + manual default, remove_link type/source filters, list_link_sources scoping (scalar + federated) and PG/PGLite parity, and alias resolution/collision/help. Fixes the prior 'inferred'-rejection assertion (now valid kebab) in the mentions test. (#1941)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
KEY_FILES.md current-state updates for #1941: link_source now an open kebab-case provenance (migration v114), the add_link/remove_link guard + defaults, list_link_sources + listLinkSources, and cliHints.aliases. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…llow-up #1849) Two correctness bugs in the v0.42.29.0 supervisor-singleton work, caught by adversarial review: - supervisorLockId mixed a config-derived DB identity into the key, but the lock row already lives inside the target database. Two supervisors on the same physical DB via different-but-equivalent URLs (pooler vs direct port, host alias, trailing params) computed different ids and BOTH acquired the "singleton" lock. Key on the queue alone; the database half of the mutex is physical. Removes the now-dead currentDbIdentity() from worker-registry. - The pidfile-cleanup process.on('exit') listener was installed AFTER the DB-lock acquire, so the LOCK_HELD early-exit stranded the pidfile this process had just created. Install the listener first. Regression test pins the listener-before-lock ordering; updates the lockId test to the queue-only invariant; KEY_FILES updated to current state. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mgunnin
added a commit
to mgunnin/gbrain
that referenced
this pull request
Jun 8, 2026
* upstream/master: v0.42.32.0 fix(sync): coerce non-string frontmatter titles + bounded auto-skip failure ledger (garrytan#1939) (garrytan#1956) v0.42.31.0 feat(links): open link_source provenance + link-add/link-rm/link-sources (garrytan#1941) (garrytan#1957) feat(skills): add idea-lineage (garrytan#1830) # Conflicts: # src/core/content-sanity.ts # src/core/markdown.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Closes the two ergonomics gaps from #1941 that forced a typed-citation-graph edge-writer to live downstream of gbrain instead of as a
gbraincommand. Filed by a downstream agent building a citation-graph ingester.Gap 1 — provenance + CLI.
engine.addLink/removeLinkalready acceptedlinkType/linkSource, but the ops didn't expose them, and there was nolink-add/link-rmcommand. Nowgbrain link/unlinktake--link-source/--link-type, withlink-add/link-rmaliases, plus a newgbrain link-sourcesto discover provenances.Gap 2 — closed allowlist.
link_sourcewas a closedIN(...)CHECK; a new provenance likecitation-graphwas rejected, so derivers stampedmanualand lost the distinction from hand-entered edges. Now it's an open kebab-case format gate (^[a-z][a-z0-9]*(-[a-z0-9]+)*$, ≤64 chars) — no migration per deriver.Changes
link_sourceCHECK (3 inline schemas + migration). Postgres usesNOT VALID+VALIDATE(transaction:false); PGLite plain DROP+ADD. Existing built-ins all satisfy the regex, so the constraint swap never fails on existing data.add_link/remove_linkexpose--link-source/--link-type. Op-layer guard rejects the reconciliation-managed built-ins (markdown/frontmatter/mentions/wikilink-resolved) and defaults omitted provenance tomanual(was the misleading engine defaultmarkdown).cliHints.aliasesmechanism (collision-guarded at startup; alias-aware--help) registerslink-add/link-rm; fixes a pre-existing--type→--link-typehelp typo.list_link_sourcesread op +listLinkSources({sourceId?,sourceIds?})on both engines (deterministic order, federated-scope aware), added to the minion read allowlist.Test plan
test/link-source-namespaced-regex.test.ts: regex/length boundaries, upgrade-path constraint swap on existing data, op guard + manual default,remove_linkfilters,list_link_sourcesscalar+federated scoping, alias resolution/collision/help.inferredassertion).Reviews
/plan-eng-review(clean) + codex outside-voice on the plan: 13 findings, all absorbed (strict-kebab regex, 64-cap, managed-built-in guard, lock-friendly migration, federated scoping, deterministic order, doc/help fixes).Also fixed: supervisor queue-singleton (follow-up to #1849)
The adversarial pass flagged two correctness bugs in the v0.42.29.0 supervisor-singleton work (
src/core/minions/supervisor.ts). Fixed in this PR:supervisorLockIdkeyed on a config-derived DB identity (:305), but the lock row already lives inside the target database. Two supervisors on the same physical DB via different-but-equivalent URLs (pooler vs direct port, host alias, trailing params) computed different ids and both acquired the "singleton" lock. Now keyed on the queue alone; the database half of the mutex is physical. Removed the now-deadcurrentDbIdentity().:501): theprocess.on('exit')cleanup listener was installed after the DB-lock acquire, so theLOCK_HELDearly-exit left this process's pidfile behind to block the next start. The listener is now installed first.Regression test pins the listener-before-lock ordering and the queue-only lock-id invariant;
KEY_FILES.mdand the v0.42.31.0 CHANGELOG updated.