fix(memory): known line rematches on live entries after the status read
This commit is contained in:
1 parent
78eff1cf34
commit
8778c9d920
2 files changed
+21
-5
No files matched your search
@@ -2671,6 +2671,19 @@ test('TE7: the status reader runs only for a candidate', async (
|
||||
expect(w.runs.length - known).toBe(1)
|
||||
})
|
||||
|
||||
test('TE7b: a live successor sharing the span of a dead entry wins', async (
|
||||
$, on,
|
||||
) => {
|
||||
const older = entryText('BLK-001', 'old remote access', 'Solution',
|
||||
'Old fix.') + `seen: \`${KN_SPAN}\`\n`
|
||||
const w = await bootKnown($, on, { files: { [BLK]: older + KN_ENTRY } })
|
||||
w.proc = { stdout: [
|
||||
'| BLK-001 | 2026-01-01 | old remote access | superseded |',
|
||||
'| BLK-002 | 2026-02-01 | remote access | open |'].join('\n') }
|
||||
const out = await failing($, w, EXIT1 + KN_SPAN)
|
||||
expect(out).toEqual({ ...(w.answer as object), context: [KN_LINE] })
|
||||
})
|
||||
|
||||
test('TE4b: two concurrent failing calls inject one line', async (
|
||||
$, on,
|
||||
) => {
|
||||
|
||||
@@ -1185,7 +1185,7 @@ export function onContextStart(st: State, session: string): void {
|
||||
/**
|
||||
* Takes the IDs not yet seen in the context whose line costs (`chars`,
|
||||
* parallel to `ids`) still fit RECALL_CAP, and records them. Synchronous:
|
||||
* called after the last await, so two racing callers never both claim.
|
||||
* called after the reads, so two racing callers never both claim.
|
||||
*/
|
||||
export function claim(
|
||||
st: State,
|
||||
@@ -1401,8 +1401,8 @@ async function captureMilestones(
|
||||
}
|
||||
|
||||
/**
|
||||
* The live BLK or LRN entry `key` matches. The match runs on every entry
|
||||
* first: the status reader is spawned only for a candidate ID.
|
||||
* The live BLK or LRN entry `key` matches. A match on every entry gates
|
||||
* the status reader; the live entry is then rematched on the statuses.
|
||||
*/
|
||||
async function liveCandidate(
|
||||
$: Api,
|
||||
@@ -1415,8 +1415,11 @@ async function liveCandidate(
|
||||
const id = matchOf(buildIndex(failing, undefined), key)
|
||||
if (id === undefined) return undefined
|
||||
const status = await statusMap($, root)
|
||||
if (status === undefined || !isLive(status, id)) return undefined
|
||||
return assembleEntries(texts, status).find(e => e.id === id)
|
||||
if (status === undefined) return undefined
|
||||
const entries = assembleEntries(texts, status)
|
||||
const kept = entries.filter(e => FAILURE_KINDS.has(e.kind))
|
||||
const liveId = matchOf(buildIndex(kept, status), key)
|
||||
return entries.find(e => e.id === liveId)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user