Repository navigation
test(native): bound section lookups by table reads instead of elapsed time - #11648
Conversation
… time PE TLS callback and ELF initializer section lookups now assert section-table reads through a counting proxy on the parsed image, and the huge DT_INIT_ARRAYSZ case asserts mapping lookups. The kernel-module shared-name bound is deleted: removing the section-name cache already fails that test on the 16 MiB name budget.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
[Low impact] The PR appears safe to merge; the replacement assertions retain the intended regression checks. SummaryThis test-only PR replaces four elapsed-time checks with counted work or existing assertions.
No actionable issues were found. Source review only; tests and mutation checks were not rerun. Supersession could not be checked because GitHub authentication was unavailable. Acknowledged coverage limit: morluto explicitly notes that the proxies do not detect repeated walks over other structures. Reviews (1) · Last reviewed commit: "test(native): bound section lookups by t..." · Reviewed by Greptile |
Summary
Refs #10513 (native parser family). Four wall-clock bounds in three native parser test files are replaced by deterministic work counts or deleted where an existing assertion already detects the regression. Each change is checked against a mutant that reintroduces the regression.
Problem and expected behavior
The bounds (
expect(performance.now() - started).toBeLessThan(1_000 | 5_000 | 10_000)) can fail on a loaded CI shard without a regression, and two of them did not detect the regression they were written for.Change and scope
PeLoadConfigParser.test.ts(1 bound): the test wrapsreadPeImage'ssectionsandmappingsin a counting proxy and asserts at most4 x 65535element reads for 4096 callbacks over 65,535 sections (measured 131,071). The proxy throws past the budget, so a regression fails at once instead of running for seconds.NativeInitializersParsers.test.ts(2 bounds):readElfDirectoryFromBuffersections, budget12 x 65535(measured 393,222, about one walk per consumer).DT_INIT_ARRAYSZ: the existingcreateFileMappingIndexspy now countsoffsetlookups; the test asserts fewer thanMAX_NATIVE_INITIALIZER_ENTRIES + 1024(measured 66,194). The old bound and theexamined_entriesassertion both missed a 4x slot budget, because unbacked slots are not counted as examined.KernelModuleParser.test.ts(1 bound): deleted. With the section-name cache removed, the module exceeds the 16 MiB section-name budget and the test already fails.No production code changes. Not included: the other #10513 families (lifecycle and cancellation bounds, JavaScript/web, Go strings, Solidity, managed artifacts, source maps);
WabtOutput,ElfNoteParserandjavascriptRouteScanguard regex backtracking (#10783).Contribution scope: within existing boundaries.
Contract and boundary impact
docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions in.agents/skills/reverse-engineer-anything/and never commit build outputs): none.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
Mutants (each applied alone to the production file, then restored):
sectionsinside the section-name lookup fails the PE test (budget exceeded).sectionsinnameAtfails the near-maximal test.DT_INIT_ARRAYSZtest; before this change it passed.decodedNamescache innativeSectionDirectory.tsfails the shared-name test without its bound.For evidence-bearing changes:
Validation performed
npm run test:focused -- src/native/elf/KernelModuleParser.test.ts src/native/initializers/NativeInitializersParsers.test.ts src/native/pe/PeLoadConfigParser.test.ts: 207 passed (1.6 s).npm run test:focusedon the affected file: each fails the intended test only.npm run check:fast: passed.npx oxfmton the changed files.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.