Repository navigation
fix(ubi): bound smaller-grid probe memoization - #15087
Closed
ShuaixinHuang wants to merge 2 commits into
Closed
ShuaixinHuang wants to merge 2 commits into
ShuaixinHuang wants to merge 2 commits into
Conversation
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
Contributor
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryBounds retained smaller-grid probe answers at 65,536 without stopping further checks.
Reviews (1) · Last reviewed commit: "chore: align UBI cache fix with main" · Reviewed by Greptile |
This was referenced Nov 29, 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.
Replaces #15069 at the same commit
c5da2e434cfab84be89e1042342cbf60c6e85df2. The prior PR records the review history and validation for this commit.Replaces #15008 at the same commit
c5da2e434cfab84be89e1042342cbf60c6e85df2. The prior PR records the review history and validation for this commit.Replaces #14989 at the same commit
c5da2e434cfab84be89e1042342cbf60c6e85df2. The prior PR records the review history and validation for this commit.Replaces #14963 at the same commit
c5da2e434cfab84be89e1042342cbf60c6e85df2. The prior PR records the review history and validation for this commit.Replaces #14818 at the same commit
c5da2e434cfab84be89e1042342cbf60c6e85df2. The prior PR records the review history and validation for this commit.Problem and fix
An accepted UBI image can grow
smallerGridPositionswith a boolean for every probed 512-byte offset. Moving the layout-volume blocks behind mostly erased dynamic-volume data makes smaller-grid discovery retain hundreds of thousands of entries; the existing EC-header cache cap does not cover this map. Both artifact inventory and extraction use this parser.The same valid virtual images remain extractable before and after the fix:
Cap this memoization at 65,536 results, matching the existing EC-cache scale. A miss still reads and classifies the position; reaching the cap neither skips probes nor changes input admission. A parser-level statistics callback, following the existing EC-cache observer, lets the regression measure retained state while checking successful geometry and volume facts. The guide documents the cache bound.
Addresses the unresolved grid-cache finding on merged #13333. No separate issue: the defect is directly reproduced in its existing parser, including an external Map-retention measurement against the unmodified source. Related UBI PR #14809 only shares fixture helpers.
The earlier baseline Knip prerequisite (removing the unused internal
PeOverlayRangealias) has now landed independently in #14852, commit412f92736e099899a6a4257ffd65ce926337ea0a. This branch merges that main revision; its effective diff now contains only the UBI parser, its cache regression, and the UBI guide. All three UBI file hashes, and the main parser used by the saved red reproduction, are unchanged.Validation
AI-assisted work on Linux x64, Node 24.22.1, npm 11.21.3. The checks below were rerun after aligning with main
412f92736on current commitc5da2e434cfab84be89e1042342cbf60c6e85df2. Its tree matches the validated tree; all 8457 typed-inventory source hashes remained unchanged through the merge-message commit hook. The resource regression serves bounded chunks for large logical images rather than allocating those images in memory.npm run test:focused -- src/domain/firmware/ubiImage.cache.test.ts src/domain/firmware/ubiImage.test.ts src/artifacts/UbiImageArtifactReader.test.ts src/artifacts/UbiImageArtifactReader.boundaries.test.ts tests/acceptance/ubiImageCli.test.ts tests/boundary/mcp/ubiImageMcp.test.ts— required artifact builds passed; 124 tests passed in six files, including compiled public CLI/MCP.checkcomponents passed:node scripts/run-exclusive.mjs artifacts node scripts/run-turbo.mjs run typecheck lint format:check knip metadata:check(six successful tasks),npm run verify:architecture-guards(3239 files), andnpm run knip:production(99 advisory candidates). The full 8457-file typed-lint inventory passed in eight disjoint serial batches throughnode scripts/ci/static-check-report.mjs typed-lint, with identical rules/tsconfigs: zero errors, 6128 non-failing warnings, exact coverage and unchanged hashes verified. A monolithicnpm run checkis not claimed to have completed: the earlier revision's monolithic typed stage was interrupted with SIGINT near this environment's 8 GiB limit, so this aligned revision used the bounded full-inventory qualification directly.npm run verify:test-discovery— all 4010 test/spec files discovered exactly once.npm run docs:check— facts passed; 8 README consistency tests passed.npm run deps:checkandgit diff --check— passed. The normal pre-commit hook ran for the merge-message amendment with no staged files; normal pre-pushnpm run check:fastpassed. All validated source hashes remained unchanged.Previously, four independent
ubinize 2.1.5controls passed against both original and fixed production-parser bundles; these were not rerun after this main alignment because both parser sources are byte-identical: dynamic/static volumes, non-default alignment, and NAND subpage geometry. Reassembly matched producer input bytes, including dynamic-volume padding. This is a parser/reassembly check, not an additional public CLI/MCP run.Single-process resource observation
The same completed parser probe (front/tail layout on a 128 MiB virtual image) ran in one fresh Node process per revision. Before/after: wall time 0.940/0.918 s, CPU user+system 0.837/0.819 s, peak process-family RSS 61,640/54,980 KiB. The process had no child processes. These are single cold-process observations on a shared host, without warm samples or a general speed/RSS guarantee. No LLM calls occur in this probe; token impact was not measured. The regression independently verifies the deterministic retained-entry bound. The tail-layout case read 4,195,200 additional header bytes after the cap, while preserving its result.
Scope and limits
Existing read-only UBI parsing and extraction; maintainer scope decision not applicable. No new input allowance, runtime setting, provider, network/target-execution authority, package dependency or advertised schema. Artifact identity, CRC rules, cancellation and cleanup paths stay with their existing owners.
Local verification did not exercise real NAND dumps with OOB data, bad blocks or bit flips, Windows/macOS host workflows, or Fastmap. Hosted platform verification is reported separately below.
Hosted CI and automated review
The current aligned commit is
c5da2e434cfab84be89e1042342cbf60c6e85df2. Its CI run 45939311205, attempt 1 completed successfully.The previous commit
bb8f01a5f63547390ff71604b07b2fffa68a2ae4completed CI run 45923144747 successfully, including Windows capability tests (1124 passed / 73 skipped), Windows package verification (59 tests), and Linux x64/arm64 and Darwin arm64 native package baselines. Those are historical selected-platform checks, not current-head platform runs or UBI regression coverage on every host.Greptile inspected the current
c5da2e4commit and reported no actionable issue. Automated review is source-inspection evidence, not a test run or human readiness declaration. The prior Codex review could not complete because the repository's code-review usage limit was reached; no completed current-head Codex review is claimed.Under CONTRIBUTING, readiness records the initial review and later pushes do not invalidate it. The existing human-owned declaration below is preserved unchanged. This CI update was prepared by the coding agent and does not attest to an additional human review.
Author readiness
Human owner: @ShuaixinHuang