v0.35.8.0 feat(cycle): phantom-page redirect inside extract_facts#1138
Merged
Conversation
Drains the existing pile of unprefixed entity pages (alice.md, acme.md) that pre-PR-#1010 routing left behind. Folds the cleanup into the existing extract_facts cycle phase via two new lossless engine primitives so the v0.32.2 reconciliation contract owns drift handling instead of a parallel implementation duplicating it. Layers: - engine: refreshPageBody + migrateFactsToCanonical on Postgres + PGLite - resolver: resolvePhantomCanonical + findPrefixCandidates (codex #1/#11) - orchestrator: src/core/cycle/phantom-redirect.ts + phantom-audit JSONL - cycle: sourceId/brainDir threaded; 3 new totals counters - tests: 38 unit + 6 parity + 4 E2E (48 total) pinning all 12 codex findings
…v0.35.5.1) Resolved version trio to v0.35.8.0 (next free slot above master's v0.35.7.0). Resolved CHANGELOG by keeping v0.35.8.0 entry above master's v0.35.7.0, v0.35.6.0, and v0.35.5.1 entries (per CLAUDE.md merge-recovery procedure). Resolved extract-facts.ts imports by taking BOTH: master's gateway import (embed + isAvailable) and the phantom-redirect imports — they're complementary, the gateway import is for the consolidate phase, the phantom-redirect imports are for the v0.35.8.0 pre-pass. Regenerated llms-full.txt against the merged CLAUDE.md.
CI test (1) failed: `sync_freshness check > exact 72h boundary → warn`. The test set `last_sync_at = Date.now() - 72h`, then checkSyncFreshness called Date.now() again to compute ageMs. Between the two reads the clock advanced (0.43ms in this CI run, microseconds locally) which pushed ageMs above the strict 72h fail threshold and flipped the status from warn to fail. Same shape latent in the 24h boundary test — fixed both. Fix: - checkSyncFreshness gains an optional `opts.nowMs` test-only seam. Production callers omit it and get live wall-clock semantics. - Both boundary tests now capture nowMs once and thread it through both `last_sync_at` and the check, eliminating drift between reads. Verified deterministic: 10 consecutive runs of the 72h boundary test pass on this machine (was occasionally failing before).
garrytan
added a commit
that referenced
this pull request
May 18, 2026
Master shipped v0.35.8.0 (autopilot phantom-page redirect inside extract_facts, #1138) ahead of this branch. VERSION trio kept at 0.36.1.0 since this branch's slot is already higher than master's new tag. CHANGELOG carries both v0.36.1.0 (top) and v0.35.8.0 entries; llms-full.txt regenerated. src/core/cycle.ts and src/commands/doctor.ts auto-merged cleanly (both branches added separate sections). Test gate green: 195/195 on cycle.serial + migrate + doctor. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Drains the existing pile of unprefixed entity pages (
alice.md,acme.md) that pre-PR-#1010 routing left behind. Folds the cleanup into the existingextract_factscycle phase via two new lossless engine primitives so the v0.32.2 reconciliation contract owns drift handling instead of a parallel implementation duplicating it.The previous attempt (
gbrain merge-phantoms) was scrapped after 30 codex review rounds because it built a parallel reconcile path. This release picks up that scrapped work via Option Beta: piggyback on the existing reconcile loop, add two narrow primitives the existing path can't do losslessly, and letextract_factsown drift.Layers:
refreshPageBody+migrateFactsToCanonicalon Postgres + PGLite (parity tests)resolvePhantomCanonical(codex feat: GBrain v0.1.0 — Postgres-native personal knowledge brain #1: bypasses exact-self-match) +findPrefixCandidates(codex Feature request: Org-mode (.org) ingestion and sync support #11: surfaces ambiguity)src/core/cycle/phantom-redirect.ts+src/core/facts/phantom-audit.ts(JSONL audit, ISO-week rotation)runPhaseExtractFacts; pre-pass runs after legacy-row guard, before main reconcile; 3 new totals countersGBRAIN_PHANTOM_REDIRECT_LIMIT); writer-lock acquired once per pass with 30s bounded retryTest Coverage
48 new tests pinning all 12 codex findings + 8 cascade-table regression rounds:
Pre-Landing Review
Self-reviewed via /plan-eng-review with codex outside-voice. All 12 codex findings incorporated pre-implementation (see plan file at
~/.claude/plans/system-instruction-you-are-working-snoopy-lantern.mdfor the full decision trail).Plan Completion
Every plan item from the Section 1-4 + codex round decision table is implemented:
Known limitations
[[alice]]references in other pages' markdown bodies still point at the phantom slug. Follow-up PR; preventive resolver in PR fix(entities): prefix-expansion resolver + stub-guard + dropped-fact audit #1010 ensures new writes go to canonical.gbrain-syncserializes redirect vsperformSyncbut doesn't cover MCPput_page/ facts queue / directwriteFactsToFence. Best-effort; follow-up design pass to widen scope.Test plan
🤖 Generated with Claude Code