Repository navigation
fix(repo): let the Lore-id index rebuild after a failed build - #77
Merged
Merged
Conversation
getLoreIdIndex memoized its build promise with ??=: a fulfilled build caches forever (correct), but a REJECTED build also cached forever, so one transient git failure (lock contention, I/O hiccup) poisoned every later getLoreIdIndex call on that AtomRepository instance - the same rejection replayed with no retry. Practical impact in the shipped CLI is low (one repository instance per process, no caller retries today), but the class is exported for programmatic use where instances can be long-lived, and the trap hardens into API contract if left. The fix keeps the ??= memoization and adds a rejection handler that clears the cache slot, so the next call rebuilds; the rejection itself still propagates to every current awaiter, and the derived promise from the handler is intentionally discarded. The diff deliberately touches only the function's closing lines (byte-identical on the in-flight delta-pass branch), so the two PRs merge cleanly in any order. Test: the first build's authoritative --all pass throws, the rejection reaches the caller, and the second call rebuilds (four git passes total) instead of returning the memoized rejection. Lore-id: a942e3e8 Constraint: A fulfilled build stays memoized for the instance lifetime (one build per instance remains the steady-state contract). Constraint: The rejection must propagate to every current awaiter; only the cache slot resets. Constraint: The diff must not touch the IIFE body, keeping it merge-compatible with the in-flight delta-pass change to the same function. Tested: npm run typecheck: clean Tested: Full suite on Windows: 507 tests in 34 files, all passing Tested: Unit: first build rejects on the --all pass, second call rebuilds (log called 4 times) and returns the atom Related: d181468e Confidence: high Scope-risk: narrow Reversibility: clean
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.
getLoreIdIndexmemoized its build promise with??=: a fulfilled build caches forever (correct), but a rejected build also cached forever, so one transient git failure (lock contention, I/O hiccup) poisoned every latergetLoreIdIndexcall on thatAtomRepositoryinstance - the same rejection replayed, no retry.Practical impact in the shipped CLI is low (one repository instance per process, and no caller retries today), but the class is exported for programmatic use where instances can be long-lived, and the trap hardens into API contract if left.
Fix: keep the
??=memoization and clear the cache slot on rejection, so the next call rebuilds. The rejection still propagates to every current awaiter; a fulfilled build stays memoized for the instance lifetime.Merge-compatibility: the diff is a pure insertion between
})();andreturn this.loreIndex;- the IIFE body is untouched - so this merges cleanly with #75 (which rewrites that body) in any order; both orders verified locally (clean auto-merge, combined suite green).Test: first build's authoritative
--allpass throws; the rejection reaches the caller; the second call rebuilds (four git passes total) instead of returning the memoized rejection. Fails under the old code. Typecheck clean, full suite 507/507 on Windows.