Commit Graph
2 Commits
Author SHA1 Message Date
Garry TanandClaude Fable 5 8fa9bed815 review: empty-file skip must not enter the sync failure ledger; keep inline extract for non-brainDir sync targets
Two adversarial-review fixes on the #840/#1079 takeovers:

1. importCodeFile's empty-file skip returned skipped WITH an error string.
   performSync treats skipped-with-error as a parse failure (failedFiles →
   applySyncFailureGate), so any repo containing a legitimate empty code
   file (__init__.py, barrel stubs) would BLOCK last_commit for 3
   consecutive syncs and then live in the ledger as auto-skipped — the
   fix recreated #840's spurious-failure complaint one layer up, and the
   became-empty branch reported its own successful stale-page deletion as
   a failure. The skip now carries no error, matching the content-hash
   short-circuit (banked via markCompleted, never ledgered).

2. runPhaseSync passed noExtract: willRunExtractPhase to EVERY sync
   target, but the cycle's extract phase (runPhaseExtract →
   extractForSlugs) walks brainDir only — slugs synced from other
   sources' checkouts are invisible to it, so their link/timeline
   extraction was silently dropped forever. Inline extract is now
   deduped only for the brainDir target; other targets keep it, matching
   standalone 'gbrain sync --source X' behavior. Pinned by a new
   cycle.serial test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-22 11:07:49 -07:00
bccd97c75b fix(core): empty code files, multi-source cycle sync, root-level entity refs
Three community-PR takeovers rebased onto master:

- import-file (#840): importCodeFile skips empty (0-byte) code files instead
  of writing a page with empty compiled_truth that fails every reindex-code
  pass. When a previously-imported file BECOMES empty, the stale page is
  deleted (chunks cascade) instead of ghosting in search — mirrors the
  markdown importer's empty-content branch.

- cycle (#1079): runPhaseSync now enumerates every registered, non-archived,
  sync-enabled source with a local checkout instead of syncing only the
  single brainDir-matched source. Preserves the SyncLockBusyError per-source
  skip (#1794), keeps the legacy brainDir fallback when no source covers it,
  and respects explicit --source scoping (#1503) so a scoped cycle stays
  single-source. Single-target result shape is unchanged.

- link-extraction (#1101): ENTITY_REF_RE gains a root-level branch so
  [Name](action-tracker.md) resolves to slug 'action-tracker'. The bare
  branch requires the .md suffix and excludes '#', '/', ':' so anchors,
  non-markdown assets, and URLs don't emit bogus refs; the capture's .md is
  stripped in extractEntityRefs and dir is '' (not the filename).
  LINK_EXTRACTOR_VERSION_TS bumped so stamped pages re-extract.

Takeover of #840, #1079, #1101 (rebased; flaws named in review fixed).

Co-authored-by: nightlaro <nightlaro@users.noreply.github.com>
Co-authored-by: samvilian <samvilian@users.noreply.github.com>
Co-authored-by: essexcanning <essexcanning@users.noreply.github.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 14:46:59 -07:00