Repository navigation
fix(native): name the exhausted native export allowance by its units - #7754
ayobamiseun wants to merge 2 commits into
Conversation
The native export parser throws one BinaryResourceFailure for both its 262144-entry inventory ceiling and its 16 MiB retained-text byte budget, and NativeExportsProvider mapped every such refusal to the fixed-count recovery. A PE whose export names exhaust the byte budget therefore reported reported_limits.maximum 16777216 next to "is a fixed count". Tag each parser allowance at the producing boundary (NativeExportLimitFailure with limit "rows" or "retained_text") and let the provider select count, byte, or structural-decoding recovery from that tag instead of from message text. The refusal code, non-retryable flag, message, and reported maximum are unchanged.
[Low impact] The change affects recovery details for native export refusals. The existing test-rule violation must be fixed before merging; no new blocking defect was found. Findings
Fix with agent prompt### Issue 1
tests/boundary/filesystem/nativeExports.test.ts:95-96
These assertions require specific recovery wording and forbid the old phrase. This violates the repository directive to check structured facts and compare delivered guidance with its owning formatter instead of freezing explanatory text.
Keep the independent checks for `fixedAllowance.kind`, the maximum, and retryability, then compare the action with `fixedAllowanceRemediation`. Apply the same cleanup to the count control and the new message assertions in `NativeExportParser.test.ts`. This repository requirement must be satisfied before merging.
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.SummaryThe PR gives native export limit failures a structured tag and uses it to choose recovery guidance with the correct units.
Reviews (2) · Last reviewed commit: "test(native): verify export allowance re..." · Reviewed by Greptile |
| expect(action).toContain("fixed byte allowance"); | ||
| expect(action).not.toContain("fixed count"); |
There was a problem hiding this comment.
These assertions require specific recovery wording and forbid the old phrase. This violates the repository directive to check structured facts and compare delivered guidance with its owning formatter instead of freezing explanatory text.
Keep the independent checks for fixedAllowance.kind, the maximum, and retryability, then compare the action with fixedAllowanceRemediation. Apply the same cleanup to the count control and the new message assertions in NativeExportParser.test.ts. This repository requirement must be satisfied before merging.
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/boundary/filesystem/nativeExports.test.ts
Line: 95-96
Comment:
**Harmless wording breaks tests**
These assertions require specific recovery wording and forbid the old phrase. This violates the repository directive to check structured facts and compare delivered guidance with its owning formatter instead of freezing explanatory text.
Keep the independent checks for `fixedAllowance.kind`, the maximum, and retryability, then compare the action with `fixedAllowanceRemediation`. Apply the same cleanup to the count control and the new message assertions in `NativeExportParser.test.ts`. This repository requirement must be satisfied before merging.
**Context Used:** AGENTS.md ([source](https://github.com/morluto/rea/blob/main/AGENTS.md))
---
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!
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. |
|
Hey @ayobamiseun, thanks for this! The fix looks good. What's left: there is 1 unresolved review thread from Greptile, about "Harmless wording breaks tests". Greptile is at 4/5 on the current head, mainly over "Harmless wording breaks tests", so addressing that thread should bump it. Once that's done I'm happy to merge it. |
The native export parser throws one BinaryResourceFailure for both its 262144-entry inventory ceiling and its 16 MiB retained-text byte budget, and NativeExportsProvider mapped every such refusal to the fixed-count recovery. A PE whose export names exhaust the byte budget therefore reported reported_limits.maximum 16777216 next to "is a fixed count". Tag each parser allowance at the producing boundary (NativeExportLimitFailure with limit "rows" or "retained_text") and let the provider select count, byte, or structural-decoding recovery from that tag instead of from message text. The refusal code, non-retryable flag, message, and reported maximum are unchanged. Fixes #7628 Supersedes #7754 Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
The native export parser throws one BinaryResourceFailure for both its 262144-entry inventory ceiling and its 16 MiB retained-text byte budget, and NativeExportsProvider mapped every such refusal to the fixed-count recovery. A PE whose export names exhaust the byte budget therefore reported reported_limits.maximum 16777216 next to "is a fixed count". Tag each parser allowance at the producing boundary (NativeExportLimitFailure with limit "rows" or "retained_text") and let the provider select count, byte, or structural-decoding recovery from that tag instead of from message text. The refusal code, non-retryable flag, message, and reported maximum are unchanged. Fixes #7628 Supersedes #7754 Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
The native export parser throws one BinaryResourceFailure for both its 262144-entry inventory ceiling and its 16 MiB retained-text byte budget, and NativeExportsProvider mapped every such refusal to the fixed-count recovery. A PE whose export names exhaust the byte budget therefore reported reported_limits.maximum 16777216 next to "is a fixed count". Tag each parser allowance at the producing boundary (NativeExportLimitFailure with limit "rows" or "retained_text") and let the provider select count, byte, or structural-decoding recovery from that tag instead of from message text. The refusal code, non-retryable flag, message, and reported maximum are unchanged. Fixes #7628 Supersedes #7754 Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
|
Thank you for this fix. It landed in #10499 with your authorship kept on the commit (adapted where noted in the PR), so I'm closing this PR as superseded. |
Summary
Fixes #7628.
inspect-native-exportsrefused a PE whose export names exhaust the 16777216-byte retained-text allowance with the correctresource_constraintcode,retryable: false, andreported_limits: {boundary: "structure", maximum: 16777216}, butremediation.actionsaid the allowance "is a fixed count". The exhausted limit is a byte budget; the independent 262144-entry ceiling was not reached. Recovery now names the retained-text byte allowance for the byte refusal and keeps count wording for the entry-count refusal.Problem and expected behavior
Trigger: a PE export directory with 4100 name-table entries aliasing one 4096-byte string (16,793,600 retained bytes, 4100 entries). Violated invariant (
docs/design/limits-and-recovery.md, PR #5633): recovery for a fixed allowance names the exhausted limit with its units; byte budgets use fixed-byte wording and count limits use fixed-count wording.Expected: same refusal, same message and reported maximum, with recovery that identifies the retained-name byte allowance.
Change and scope
src/native/exports/NativeExportParser.ts(producing boundary): the two parser allowances now throwNativeExportLimitFailure, aBinaryResourceFailurecarryinglimit: "rows" | "retained_text", mirroringPeImportLimitFailure. Messages,boundary, andmaximum_bytesare unchanged.src/native/exports/NativeExportsProvider.ts(consumer): replaces the singlefixedAllowanceOptions(..., "count")branch withlimitRecovery(limit, maximum):rows→The 262144-entry native export inventory allowance(count),retained_text→The 16777216-byte native export retained-text allowance(bytes), and an untaggedBinaryResourceFailurefrom the sharedBinaryReaderstructural decoding budget →The native export structural decoding allowance(parser, asPeImportsProviderandPeLoadConfigProvideralready describe that reader budget). The provider does not re-interpret message text.Maintainer scope decision: not applicable (ordinary fix within an existing boundary).
Contract and boundary impact
NativeExportParserowns which allowance was exhausted (new structured tag);NativeExportsProvideris the only consumer and now derives recovery from the tag. The superseded blanket count mapping is removed.remediation.actiontext and thefixedAllowancename/kind differ for the byte refusal (andparserkind for the reader budget);code,retryable,message, anddetails.reported_limitsare unchanged.Expected effects:
Evidence and regression coverage
Tests added or updated:
src/native/exports/NativeExportParser.test.ts: the existing row-ceiling and retained-text refusals now assertNativeExportLimitFailurewithlimit: "rows"/"retained_text", the unchangedmaximum_bytes, and message.tests/boundary/filesystem/nativeExports.test.ts: the existingpeRepeatedExportNamesImagecase (4100 aliases of one 4096-byte name, as in the issue) now asserts through the servicereportedLimits.maximum 16777216,retryable: false,fixedAllowance.kind: "bytes", and thatanalysisErrorRemediationActioncontains "fixed byte allowance" and not "fixed count"; a new control withdeclaredFunctions: 0x40001assertsmaximum 262144,kind: "count", and the inverse wording. Boundary regression class: independent limits (byte budget vs entry count) and public error delivery.Base reproduction or other evidence: source-derived — on
mainthe provider branch returnedfixedAllowanceOptions("The native export inventory allowance", "count")for everyBinaryResourceFailure, so the newkind: "bytes"assertions fail there. Executed: the issue's Python reproduction against this branch's built CLI (output below).User-visible CLI/MCP output:
node scripts/rea.mjs inspect-native-exports names-4100.dll --format json(exit 1, empty stderr):{ "code": "resource_constraint", "retryable": false, "message": "Selected artifact <target>: Export names exceed the 16777216-byte retained-text allowance", "remediation": { "action": "The 16777216-byte native export retained-text allowance is a fixed byte allowance. Waiting for an active analysis to finish does not raise it. Repeating the unchanged request fails the same way." }, "details": { "resource": "capacity", "reported_limits": { "boundary": "structure", "maximum": 16777216 } } }The 4096-alias control still exits 0 with 4096 exports and complete coverage.
MCP delivery was exercised with real bounded PE fixtures for both retained-text bytes and entry count; the advertised tool returned the correct maximum, nonretryable status and unit-specific recovery. The
parserkind for the shared reader budget is covered by the provider's existing type switch and typecheck only, not by a dedicated fixture.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
npm run test:local -- src/native/exports/NativeExportParser.test.ts— 41 passed.npm run test:focused -- tests/boundary/filesystem/nativeExports.test.ts— 9 passed (includes the built runtime).npm run test:focused -- tests/boundary/mcp/binaryDiagnosticsMcp.test.ts— 8 passed, including the two unit-specific allowance refusals through MCP.npm run check:fast— typecheck and lint passed (also ran in the pre-push hook).Compatibility, safety, and release
fixedAllowancename/kind differ.Author readiness
Human owner: @ayobamiseun
Before merge
type(scope): outcome.🤖 Generated with Claude Code