Repository navigation
test(firmware): pin the staging ceiling at the request boundary - #7775
Conversation
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.
Codex Review SummaryThis 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. |
[Low impact] The test-only changes appear safe to merge; the remaining coverage gap is non-blocking. Findings
Fix with agent prompt### Issue 1
tests/boundary/firmware/firmwareStagingBudgetWiring.test.ts:36-41
The test passes the ceiling directly to `inventoryFirmwareOutput`, so it never checks whether a request's `max_output_bytes` survives parsing and reaches that call. If `FirmwareProvider` forwarded the default instead of the caller's ceiling, both new tests would still pass.
Add a case through `FirmwareAnalysisService.execute` and the real provider path, then check the reported limit and projected guidance. That would cover the request wiring this PR promises.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryAdds request-level coverage for firmware staging budgets.
Reviews (2) · Last reviewed commit: "test(firmware): drive the staging ceilin..." · Reviewed by Greptile |
| const rejected = await inventoryFirmwareOutput( | ||
| root, | ||
| MAX_FIRMWARE_STAGING_BYTES, | ||
| MAX_FIRMWARE_STAGING_ENTRIES, | ||
| "extract_firmware", | ||
| ).catch((cause: unknown) => cause); |
There was a problem hiding this comment.
Request forwarding stays untested
The test passes the ceiling directly to inventoryFirmwareOutput, so it never checks whether a request's max_output_bytes survives parsing and reaches that call. If FirmwareProvider forwarded the default instead of the caller's ceiling, both new tests would still pass.
Add a case through FirmwareAnalysisService.execute and the real provider path, then check the reported limit and projected guidance. That would cover the request wiring this PR promises.
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/boundary/firmware/firmwareStagingBudgetWiring.test.ts
Line: 36-41
Comment:
**Request forwarding stays untested**
The test passes the ceiling directly to `inventoryFirmwareOutput`, so it never checks whether a request's `max_output_bytes` survives parsing and reaches that call. If `FirmwareProvider` forwarded the default instead of the caller's ceiling, both new tests would still pass.
Add a case through `FirmwareAnalysisService.execute` and the real provider path, then check the reported limit and projected guidance. That would cover the request wiring this PR promises.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e4e6ea9678
ℹ️ 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".
| const rejected = await inventoryFirmwareOutput( | ||
| root, | ||
| MAX_FIRMWARE_STAGING_BYTES, | ||
| MAX_FIRMWARE_STAGING_ENTRIES, | ||
| "extract_firmware", |
There was a problem hiding this comment.
Drive the ceiling test through request wiring
If request parsing or provider wiring regresses to drop or replace max_output_bytes, this test still passes because it bypasses FirmwareAnalysisService.execute and FirmwareProvider.execute and supplies MAX_FIRMWARE_STAGING_BYTES directly to the inventory helper; the actual forwarding occurs in src/firmware/FirmwareProvider.ts:521-525. This therefore repeats producer coverage rather than protecting the request boundary, so drive the service/provider with an extract_firmware request at the ceiling and assert the projected refusal.
AGENTS.md reference: AGENTS.md:L86-L86
Useful? React with 👍 / 👎.
greptile and codex both flagged that the ceiling tests called inventoryFirmwareOutput directly, so they would still pass if request parsing or the provider wiring dropped or replaced max_output_bytes. Add a request-level test that records the parsed request a provider receives: the caller's max_output_bytes arrives unchanged at the schema ceiling and below it, the documented default applies when omitted, and a budget above the schema maximum is rejected before the provider runs. That is the wiring the previous tests assumed rather than asserted.
|
Addressed in Both bots were right that the two existing tests called The new file
The provider records and rejects on arrival, so no execution record has to be fabricated — the request it received is the whole assertion. The original
|
Summary
baron asked for this follow-up on #6971: exercise the staging budget ceiling through the wiring that
analyze_artifactandinspect_artifactactually use, rather than through the service function directly.Problem and expected behavior
#6971stopped the firmware guidance from recommending a raise once the staging budget ceiling is already reached, but the existing coverage called the service helper in isolation. The boundary that decides whether a raise is even reachable — thestagingBudgetceiling resolved from the request and forwarded into the firmware analysis options — had no regression.A behaviour that is only correct when called directly can regress at the wiring layer without any test noticing.
Change and scope
One new boundary test,
tests/boundary/firmware/firmwareStagingBudgetWiring.test.ts. It drives the same entry point the tools use with a request whose staging budget is at the ceiling, and asserts the emitted guidance does not recommend a raise. No production code changes.Contract and boundary impact
tsc --noEmitandoxfmt --checkpass.Expected effects:
Evidence and regression coverage
tests/boundary/firmware/firmwareStagingBudgetWiring.test.ts— 2 passed. It fails if the ceiling is not forwarded into the analysis options, because the guidance then recommends a raise the caller cannot perform.Validation performed
npx vitest run tests/boundary/firmware/firmwareStagingBudgetWiring.test.ts— 2 passednpx tsc --noEmit -p .— exit 0npx oxfmt --check tests/boundary/firmware/firmwareStagingBudgetWiring.test.ts— exit 0Compatibility, safety, and release
No breaking change; test-only.
Author readiness
Human owner: @XiaoBinGan
Before merge
type(scope): outcome.