fix: prevent silent passing on missing topology data + visible cleanup failures

predicates.ts (missing-fact discipline):
  - getTopologyValueBySubject: return -1 sentinel instead of ?? 0
    when topology data is missing/unset. NaN and negative values
    also treated as missing. Previously returned 0 which was
    indistinguishable from root subject ID.
  - clippedByPredicate: return 'indeterminate' when clippingRoot < 0
  - inStackingContextPredicate: return 'indeterminate' when sc < 0
    or refSC < 0 (both subject and reference). Previously treated
    missing data as false — a silent wrong answer.
  - attachedToScrollContainerPredicate: return 'indeterminate' when
    scrollContainer < 0
  - escapeClippingChainOfPredicate: return 'indeterminate' when
    clippingRoot < 0

extraction.ts (cleanup visibility):
  - Promote fast-geometry and CDP cleanup failures from console.debug
    (invisible during test execution) to console.warn. Contaminated
    pages are now diagnosable without debug-log inspection.

658 tests pass.
This commit is contained in:
John Dvorak
2026-05-22 13:55:11 -07:00
parent 1a8f308f71
commit 45b5575e53
2 changed files with 13 additions and 3 deletions
@@ -747,7 +747,8 @@ export async function extractWorldFastGeometry(
el.removeAttribute('data-imhotep-runtime-id')
}
}).catch((err) => {
console.debug('[imhotep-playwright] fast-geometry cleanup evaluate failed:', err instanceof Error ? err.message : err)
// eslint-disable-next-line no-console
console.warn('[imhotep-playwright] fast-geometry cleanup failed:', err instanceof Error ? err.message : err)
})
}
}
@@ -933,7 +934,8 @@ export async function extractWorldCdp(
el.removeAttribute('data-imhotep-runtime-id')
}
}).catch((err) => {
console.debug('[imhotep-playwright] CDP cleanup evaluate failed:', err instanceof Error ? err.message : err)
// eslint-disable-next-line no-console
console.warn('[imhotep-playwright] CDP cleanup failed:', err instanceof Error ? err.message : err)
})
await sessionManager.detach()
}