Skip to content

test(firmware): exercise the staging ceiling through the emitted refusal - #7033

Closed
XiaoBinGan wants to merge 2 commits into
morluto:mainfrom
XiaoBinGan:fix/firmware-staging-ceiling-wiring
Closed

XiaoBinGan wants to merge 2 commits into
morluto:mainfrom
XiaoBinGan:fix/firmware-staging-ceiling-wiring

Conversation

@XiaoBinGan

@XiaoBinGan XiaoBinGan commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

#6971 established the staging-budget ceiling recovery but covered it through the wording helper
only. Review noted the follow-up: exercise the error inventoryFirmwareOutput actually emits, so the
production wiring is protected rather than just the string function.

This adds that boundary coverage. It is the follow-up requested in the #6971 review.

Problem and expected behavior

A wiring change that passed the schema ceiling where the selected value belongs, or that emitted an
ad-hoc action instead of the owner's, keeps a helper-only test green while the refusal handed to
callers is wrong. The gap is regression protection, not a behaviour defect: the current wiring is
correct.

Expected: the recovery emitted by inventoryFirmwareOutput equals
firmwareStagingBudgetRemediation(<field>, <selected value>) at the schema ceiling and below it.

Change and scope

Adds tests/boundary/firmware/firmwareStagingBudgetWiring.test.ts:

  • The byte ceiling is reached with a sparse file whose declared size is
    MAX_FIRMWARE_STAGING_BYTES + 1. The file reports the size without storing the bytes, so the test
    exercises the real schema ceiling instead of a toy budget. The projected refusal must carry
    reported_limits.max_output_bytes and must equal the owner's output exactly.
  • A one-byte staged tree with a selected budget of 1 reaches the same refusal below the ceiling, and
    the same exact-equality assertion covers the raise advice.
  • Exact equality rather than phrase matching, so an ad-hoc or truncated action that keeps the
    familiar sentences still fails.

Not included: no production change. The entry ceiling cannot be reached without staging more entries
than the schema permits, so its at-ceiling wording stays covered by
src/firmware/FirmwareStagingBudget.test.ts and its below-ceiling entry wiring by
firmwareReportFiles.test.ts. That limit is stated in the test file.

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.

Not applicable — test-only coverage for an existing, already-integrated boundary.

Contract and boundary impact

  • Semantic owner and earliest changed stage: firmware staging-budget enforcement; no production stage
    changes.
  • Contribution scope fit and linked maintainer decision: not applicable; no behaviour change.
  • CLI and MCP/tool-catalog contract: unchanged; the assertions read the existing projection.
  • Provider, bridge, target-format, or platform compatibility: none. The sparse fixture uses
    FileHandle.truncate, which reports the declared length without storing it on the supported hosts;
    a host that allocated it would make the test slower, not wrong.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): none.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; 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.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: tests/boundary/firmware/firmwareStagingBudgetWiring.test.ts (2 cases).
  • Base reproduction or other evidence: verified red in two directions, neither of which the helper
    test catches. Passing the schema ceiling as the selected value makes the below-ceiling case fail.
    Replacing the emitted action with a divergent sentence that keeps the ceiling phrases fails both
    cases under exact equality, where phrase matching passed. Both checks were run and reverted.
  • User-visible CLI/MCP output (if applicable): not applicable; this pins existing output.
  • Remaining proof gaps: the entry ceiling is not reachable in-process without staging more entries
    than the schema permits, so only the byte ceiling is exercised end to end. The test asserts the
    projected refusal, not a full extract_firmware MCP round trip, and no real Unblob extraction ran.

For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.

No boundary regression class applies: this changes no production code path, no reader or process
lifetime, and no public contract. It pins an existing refusal's recovery against its owner.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • node node_modules/vitest/vitest.mjs run tests/boundary/firmware/firmwareStagingBudgetWiring.test.ts --maxWorkers=1 — 2 passed.
  • node node_modules/vitest/vitest.mjs run src/firmware tests/boundary/firmware --maxWorkers=1 — 112
    passed, 52 skipped (13 files; the skips are host-gated firmware integration and workspace recovery).
  • npx tsc --noEmit -p . — no errors.
  • npx oxfmt <changed file> — formatted.
  • npm run verify:module-boundaries — 3012 source files checked, no violations.
  • Red → green, three directions: schema-ceiling wiring → 1 failed; single-form remediation → 2
    failed; divergent action keeping the phrases → 2 failed; restored → 2 passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; test-only.
  • Real Hopper/Ghidra, browser, or OS coverage: no analysis engine involved.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no target execution and no new data exposure.

Author readiness

Human owner: @XiaoBinGan

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-27T09:48:21.899652Z
We couldn’t complete this review. Comment @codex review to try again.
8fd1cf4 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The test-only change appears safe to merge.

Summary

Adds two tests that check the recovery advice emitted by inventoryFirmwareOutput.

  • Firmware staging tests check the exact recovery sent with byte-budget refusals.

Tests were not run during this review. Supersession could not be checked because GitHub access required authentication.

Reviews (8) · Last reviewed commit: "test(firmware): compare the emitted reco..." · Reviewed by Greptile

@XiaoBinGan

Copy link
Copy Markdown
Contributor Author

Pushed 60262d9da to merge current main into this branch. The previous head was based on 08b8e629, 102 commits behind, and CI on that head failed in tests/boundary/cli/managedMemberSummaryCli.test.ts, which is unrelated to this change: main added input_path to the recorded parameters in 9b3a63329 and updated that test's expectation in the same line of work. The stale base had the old expectation, so the full-suite lane failed on it.

The diff against main is now exactly the one new test file (83 lines), and nothing else. Re-running is the only way to clear it — the failing job cannot be re-run from an account without write access, so this push also serves as the retrigger.

Worth noting for the record: the flake had nothing to do with this PR's content, but a stale base still turns into a red PR that a reviewer has to spend time on. That is the same delivery-channel problem as #3442.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 60262d9dae

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +53 to +55
expect(projected.remediation.action).toContain("not supported");
expect(projected.remediation.action).not.toContain("Increase");
expect(projected.remediation.action).toContain("smaller firmware byte range");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Compare the emitted action with the remediation owner

If firmwareStagingLimit is later replaced with an ad-hoc or truncated action that preserves these three snippets, this test still passes even though the emitted recovery has diverged from firmwareStagingBudgetRemediation, so it does not fully protect the wiring it was added for and duplicates brittle prose checks. Assert exact equality with firmwareStagingBudgetRemediation("max_output_bytes", MAX_FIRMWARE_STAGING_BYTES) here (and with 1 in the lower-budget case), while leaving recovery semantics to the formatter's module tests; this is the consumer/owner comparison required by the repository's test guidance.

AGENTS.md reference: AGENTS.md:L83-L83

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adopted in 28a3ce4d1. Both cases now assert exact equality with
firmwareStagingBudgetRemediation(<field>, <selected value>) rather than matching
phrases, so a divergent emitted action fails even when it repeats the ceiling
sentences. Recovery semantics stay in the formatter's module test as you suggested.

Verified red: replacing firmwareStagingLimit's action with a sentence that keeps
"not supported" and "smaller firmware byte range" but diverges from the owner now
fails both cases, where the previous phrase matching passed.

Thanks — the point about not fully protecting the wiring while duplicating brittle
prose checks was exactly right.

@XiaoBinGan

Copy link
Copy Markdown
Contributor Author

The failing checks here are not caused by this diff, which only adds one firmware test file.

Three separate main-level breaks are being attributed to every PR right now:

  1. Static checks — 662ec2e45 left scripts/verify-apk-signature.mjs unformatted, so oxfmt --check . exits 1 on a clean main. fix(scripts): format the APK signature verifier import #7262 fixes it with a one-line change.
  2. Test shard 6/8 (and 5/8, 7/8, 8/8) — tests/acceptance/applications/adbListingNumbers.test.ts fails with an assertion mismatch on main. Unrelated to firmware; feat(il2cpp): link version 24 generic method instances #7261 (a different author) fails the same test in shard 1/8.
  3. Validate author declaration — pr-readiness.mjs:21 openHeadsMatching throws RequestError [HttpError]: <!DOCTYPE html>: the GraphQL query that pages all 547 open PR heads is returning an HTML error page. feat(environment): serve the writes callers make without recorded form fields #7260 hit the identical error.

Locally this PR's own test passes: firmwareStagingBudgetWiring.test.ts — 2 passed, and the branch is rebased onto current main (1b17d971d).

The commit status for PR readiness is success on this head.

@XiaoBinGan
XiaoBinGan force-pushed the fix/firmware-staging-ceiling-wiring branch from 1b17d97 to 2768469 Compare October 26, 2026 19:34
@XiaoBinGan

Copy link
Copy Markdown
Contributor Author

The Test shard / Portable tests / CI required failures here are pre-existing on main, not caused by this one-file test addition.

Verified on a clean checkout of upstream/main with no local changes: tests/boundary/browser/sazWebCapture.test.ts fails two tests —

AssertionError: expected { provider_id: 'saz', …(4) } to not have property "partial_observation"

and src/application/SetupRegistrationPrewarm.test.ts fails settles the prewarm deadline after a detached descendant inherits the exited runner's pipes with expected '' to contain 'descendant:'. Both reproduce on main itself, and the same shards fail on four unrelated open PRs (#7267, #7261, #7260, #7258). Recent main CI runs are 14 failure / 25 cancelled, 0 success.

For this PR specifically: it adds one test file under tests/boundary/firmware/, which does not import any of the failing modules. Locally, firmwareStagingBudgetWiring.test.ts passes (2 tests), and the branch is rebased onto current main with behind=0.

Static checks was also failing on main earlier (scripts/verify-apk-signature.mjs formatting, since repaired upstream by 741f2de75), which is why earlier runs of this PR showed it.

@XiaoBinGan
XiaoBinGan force-pushed the fix/firmware-staging-ceiling-wiring branch from 2768469 to 1cdcebc Compare October 27, 2026 05:22
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

The ceiling recovery added in morluto#6971 was covered through the wording helper only, so a wiring change that passed the schema ceiling where the selected value belongs, or that dropped the remediation, would have stayed green.

Adds boundary coverage that calls inventoryFirmwareOutput itself: a sparse file reaches the real byte ceiling without storing the bytes and asserts the projected refusal carries the ceiling recovery, and a one-byte tree below the ceiling asserts the raise advice. Verified red on both regressions — passing the schema ceiling for the selected value fails the below-ceiling case, and restoring the single-form remediation fails both.
The wiring test matched three phrases of the emitted remediation, so an ad-hoc or truncated action that kept those phrases would still pass while the emitted recovery had diverged from firmwareStagingBudgetRemediation.

Assert exact equality with the owner's output for the selected value in both cases instead. Verified red: replacing the emitted action with a divergent sentence that keeps the ceiling phrases now fails both cases, where the phrase matching passed.
@XiaoBinGan
XiaoBinGan force-pushed the fix/firmware-staging-ceiling-wiring branch from 1cdcebc to 8fd1cf4 Compare October 27, 2026 09:48
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@XiaoBinGan

Copy link
Copy Markdown
Contributor Author

Closing to free a review slot, not because the work is wrong: this is test-only, so its Source tests and Test shard checks cannot pass until main itself is green, and four unrelated main breakages are still outstanding.

The follow-up itself is unchanged and ready. Branch fix/firmware-staging-ceiling-wiring stays rebased on current main (currently d6f88becd), and its test passes: npx vitest run tests/boundary/firmware/firmwareStagingBudgetWiring.test.ts → 2 passed.

I will reopen it once main is green again so it can be reviewed on its own merits rather than on inherited CI failures. Apologies for the churn — flagging the reasoning rather than leaving it to guesswork.

@XiaoBinGan XiaoBinGan closed this Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant