Repository navigation
test: bound folder collapse, echo search and ELF section admission by work, not elapsed time - #10783
Merged
Merged
Conversation
…sed time Two quadratic-regression tests in src/domain asserted elapsed time. Count the comparisons and text searches instead, failing at a linear bound so a pairwise or per-member search stops early instead of running on. Refs #10513
Codex Review Summary: ✅ CompletedThis 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. |
Contributor
[Low impact] The PR appears safe to merge; no blocking defects were found. SummaryReplaces elapsed-time checks with operation limits in three regression tests. Production code is unchanged.
Reviews (4) · Last reviewed commit: "test(native): bound hostile ELF section ..." · Reviewed by Greptile |
…time The 65,000-section case asserted it finished within 5 s, which a loaded runner can miss and a fast one can pass while quadratic. Count array elements walked through iteration and the element-visiting methods, and stop at 64 per section; the parser walks about 19. A per-candidate rescan of the admitted spans now fails at the bound.
This was referenced Nov 15, 2026
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.
Summary
Refs #10513 (Phase 6.3). Two complexity-regression tests in
src/domainasserted elapsed time (performance.now()deltas under 2 s and 5 s). They now count the operations a quadratic implementation would repeat and fail at a linear bound, so a regression is caught deterministically and stops early instead of running on.Problem and expected behavior
Wall-clock bounds flake on loaded CI shards and pass on a fast host even when the work has grown.
docs/development/testing.mdreserves elapsed assertions for cases where speed itself is the behavior under test; here the intent is "no pairwise or per-member search".Change and scope
src/domain/desktop/appExportUnowned.test.ts: countsSet.prototype.hasandString.prototype.startsWithcalls duringunownedChangedFoldersover 20,003 paths. Bound24 * files(observed about 11 per path); the spy throws at the bound.src/domain/analysisView/environmentStateWriteCopies.test.ts: countsString.prototype.includesandindexOfcalls duringexplainCreateover an 8,000-member body. Bound16 * n(observed 27,401, about 3.4n); the spy throws at the bound.src/native/hardening/BinaryHardeningParsers.test.ts: "admits a hostile section table without rescanning every span" (65,000 disjoint SHT_NOTE sections) replacedperformance.now()< 5 s with a count of array elements walked duringreadElfHardening, throughArray.prototype[Symbol.iterator]and the element-visiting methods (some,find,filter,map,sort,toSorted, ...). Bound64 * sections(observed 1,235,343, about 19 per section); counting throws at the bound. The methods are patched directly rather than withvi.spyOn, whose bookkeeping iterates arrays and would recurse. The test runs in about 70 ms, so itslong-runningtag is dropped.Same spy-and-throw pattern as the sibling 6.3 PRs (#10672, #10671, #10670, #10627, #10619), which cover other files. Production code is unchanged.
Not included:
javascriptRouteScan.test.ts,WabtOutput.test.tsandElfNoteParser.test.tsguard against regex backtracking inside a singleexec, which a call counter cannot observe, so their elapsed bounds stay.getter_aliasesand the process, deadline and cancellation tests are left to their owning workstreams.Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.
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): noneExpected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
unownedChangedFolderswith a pairwise[...folders].some((other) => folder.startsWith(${other}/))fails the test withfolders compared pairwisein under a second; replacingholdersOfwith a per-tokentext.indexOf(token)search fails withtexts searched per member. Adding a per-candidateadmitted.some(...)rescan toadmitDisjointTablesinElfHardening.tsfails the ELF test witharray elements walked past bound. (Replacing the binary search insideoverlapIndexwithfindLastdoes not trip the bound, because this fixture queries that index only a few times; the per-candidate rescan is the quadratic case it targets.)For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.
For evidence-bearing changes:
Validation performed
npm run test:local -- src/domain/desktop/appExportUnowned.test.ts src/domain/analysisView/environmentStateWriteCopies.test.ts— 2 files, 24 tests passednpm run check:fast— passednpx vitest run src/native/hardening/BinaryHardeningParsers.test.ts— 78 tests passed; pre-push typecheck and lint passedCompatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.