Skip to content

feat(flutter): carry the value of each fixed Flutter allowance - #11641

Merged
morluto merged 4 commits into
mainfrom
feat/flutter-fixed-allowance-limits
Nov 16, 2026
Merged

morluto merged 4 commits into
mainfrom
feat/flutter-fixed-allowance-limits

Conversation

@morluto

@morluto morluto commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Refs #10508 (item 4, Flutter slice). The ten Flutter fixed-allowance calls named no value, so details.refusal had no limit or unit. Each now carries the constant that refused the input. Tracing the APK metadata read call to its source found a misattribution: any ZIP reader limit failure, including a Zstandard member whose decoder window exceeds the ZIP reader's fixed 128 MiB allowance, was reported as the Flutter APK metadata read allowance. With a value attached, that would state the wrong ceiling (8 MiB). The ZIP reader now names its own decoder-window ceiling, and Flutter and Playwright trace import keep it.

Builds on ArtifactReaderFailure.fixedAllowance from #11634 (merged).

Problem and expected behavior

Before: identify_flutter_build on an APK with 33 ABIs returned resource_constraint without details.refusal.limit. An APK whose lib/arm64-v8a/libapp.so is a Zstandard member with a 256 MiB window was refused as "The Flutter APK metadata read allowance". A Playwright trace with such a member told the caller to "Select a smaller complete recorder chunk".

After:

  • ABI count: details.refusal = { kind: "fixed_ceiling", allowance: "The Flutter ABI inventory allowance", allowance_kind: "parser", limit: 32, unit: "ABIs" }. A library path above 1024 bytes names "The Flutter library path allowance" (limit: 1024, unit: "bytes") instead of the ABI allowance.
  • APK snapshot (2 GiB), library read (256 MiB), cumulative extraction (768 MiB), APK metadata read (8 MiB), snapshot-hash candidates (64 candidates) carry their values.
  • Large decoder window (Flutter and Playwright trace): details.refusal = { allowance: "The ZIP Zstandard decoder window allowance", allowance_kind: "parser", limit: 134217728, unit: "bytes", narrowing: "Recompress the member with a window of at most 128 MiB, or decompress it with a tool that admits larger windows, then retry." }. The message keeps the outcome ("…above REA's fixed 128 MiB allowance; the archive is not necessarily corrupt."); the recovery now comes from the refusal.

Change and scope

  • src/flutter/FlutterBuildProvider.ts: one FLUTTER_ALLOWANCES table owns each ceiling with its constant; the ten call sites use it. The ABI inventory refusal selects the ceiling that was exceeded. A reader limit failure that names its own ceiling keeps it; only the unnamed ZIP metadata read refusal is attributed to Flutter's budget.
  • src/resources/ZipArtifactReader.ts: the decoder-window failure carries its FixedAllowance; the recovery sentence moved from the message into narrowing.
  • src/browser/history/playwrightTrace/TraceFailure.ts: a reader limit with a named ceiling keeps it instead of the recorder-chunk remediation.
  • Flutter's ZIP reader-limit mapping (readerLimitFailure): a reader-named ceiling is kept; a readerLimit (the size-derived artifact_limits.expanded_bytes budget, which Flutter does not expose) becomes "The Flutter APK expansion allowance (derived from the APK size)" with the reader's effective value; only the remaining unnamed ZIP limit is the 8 MiB metadata read allowance.
  • src/android/AndroidJniLibraries.ts: the JNI library failure message carries a reader-named ceiling's narrowing, because that report has no refusal field.
  • tests/fixtures/zipZstandard.ts: optional member name.

Not included: SAZ import (SazCapture.ts) also reports any ZIP reader limit as its expanded-input budget; fixing it needs a new capture limit name, so it is tracked separately. The other families of #10508 item 4 (pcap/tshark, native structural decoding, Go, Rust, IL2CPP, sigrok, Electron fuse, CDP, web network projection, assetutil) are later slices; the three W4 sites (src/adb ×2, src/process/ArtifactAnalysisResources.ts) belong to another workstream.

Contribution scope: within existing boundaries.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the Flutter provider's allowance table; the ZIP reader for the decoder window.
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: additive details.refusal.limit/unit (and narrowing for the decoder window). The decoder-window remediation.action wording changes; code, retryable and reported_limits are unchanged except that a Flutter decoder-window refusal no longer reports max_metadata_read_bytes, which did not apply to it.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • 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/boundary/filesystem/flutterBuildProvider.test.ts: the oversized-APK, ZIP metadata budget, ABI expansion (now also a long library path case) and hash-candidate tests assert details.refusal. A new case builds a real APK whose libapp.so is a large-window Zstandard member and asserts the decoder-window ceiling for both operations. With the Flutter provider at main, the 8 refusal assertions fail; with only the Flutter table applied, the 2 decoder-window cases fail with allowance: "The Flutter APK metadata read allowance", limit: 8388608.
  • src/browser/history/playwrightTrace/PlaywrightTraceDecoder.test.ts: a new large-window trace.trace case fails with main's TraceFailure.ts and passes with the change.
  • tests/boundary/cli/artifactZstandardWindow.test.ts: CLI and stdio MCP assert the decoder-window refusal facts instead of the old remediation sentence.
  • After review: a Flutter case with a small APK declaring a 300 MiB member asserts the 256 MiB expansion ceiling (both operations), and a JNI case asserts the recompression advice in the library failure message. All 3 fail at the previous head (8 MiB metadata ceiling; message without advice).
  • Remaining proof gaps: the library read and cumulative extraction ceilings have no test that reaches them (they need 256 MiB and 768 MiB members); their values are the constants each refusal already reports in reported_limits.

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

  • npm run test:focused -- Flutter provider, ZipArtifactReader.test.ts, CLI decoder window, ZIP integrity, Playwright trace decoder and lifecycle: 228 passed.
  • The same Flutter file with main's provider: 8 failed (the new refusal assertions); the Playwright file with main's TraceFailure.ts: 1 failed.
  • npm run check:fast (typecheck, lint, architecture guards): passed. npx oxfmt --check on the changed files: passed.
  • After the review fixes (rebased on main after feat(artifacts): project fixed reader ceilings as typed refusals #11634 merged): Flutter provider + androidJniLibraries.test.ts 145 passed; the 3 new cases fail with the previous head's sources; npm run check:fast passed.
  • After the second Greptile round (766d30e): decoder-window advice is compared with analysisRefusalRemediation over the exported ZIP_ZSTANDARD_WINDOW_CEILING in the Flutter, Playwright, CLI/MCP and JNI tests; those 4 files 167 passed; npm run check:fast passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; the refusal fields are additive. A caller that matched the decoder-window remediation sentence sees new wording.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS only; no real Flutter build or Playwright recorder output beyond the fixtures.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Author readiness

Human owner:

  • 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

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-16T01:25:22.582490Z
We couldn’t complete this review. Comment @codex review to try again.
2448869 PR opened
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto changed the base branch from feat/deno-fixed-allowance-refusals to main November 16, 2026 01:29
@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The PR appears safe to merge; no new actionable issue remains in the reviewed changes.

Summary

Flutter refusals now carry the value and unit of the allowance that stopped the read.

  • Flutter inspections report the value of the limit that stopped an APK.
  • Zstandard window refusals carry the ZIP reader’s limit and recovery advice.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[ZIP reader refuses input] --> B{Reader facts}
  B -->|Named ceiling| C[Keep reader ceiling and advice]
  B -->|Expansion budget| D[Flutter reports effective expansion value]
  B -->|Unnamed limit| E[Flutter reports metadata read allowance]
  C --> F[Structured refusal and recovery]
  D --> F
  E --> F
  C --> G[JNI includes advice in failure message]
Loading

Reviews (4) · Last reviewed commit: "test(artifacts): compare decoder-window ..." · Reviewed by Greptile

Comment thread src/resources/ZipArtifactReader.ts Resolved
Comment thread src/flutter/FlutterBuildProvider.ts Resolved
Each Flutter fixed allowance now passes limit and unit, so details.refusal states the ceiling. The ABI inventory refusal names the ceiling that was exceeded: the ABI count or the library path bytes.
…ace refusals

A Zstandard member whose window exceeds the ZIP reader's fixed 128 MiB allowance now carries that ceiling as a typed fixed allowance (limit, unit, and the recompression narrowing). Flutter reported any ZIP reader limit as its APK metadata read allowance, and Playwright trace import as a recorder-chunk limit; both now keep the reader's ceiling.
…sion advice

A ZIP reader limit with a reader-owned parameter (the size-derived expansion budget) is no longer reported as the Flutter metadata read allowance; Flutter exposes no control for it, so it is a fixed ceiling with the reader's effective value. The JNI library failure message carries the reader-named ceiling's narrowing, since that report has no refusal field.
@morluto
morluto force-pushed the feat/flutter-fixed-allowance-limits branch from 2448869 to 139ebe8 Compare November 16, 2026 01:37
@morluto
morluto merged commit 2a31e06 into main Nov 16, 2026
7 of 9 checks passed
@morluto
morluto deleted the feat/flutter-fixed-allowance-limits branch November 16, 2026 01:54
morluto added a commit that referenced this pull request Nov 16, 2026
…main (#11666)

#11518 merged its counted baseline beside #11641, which added two
fixed-allowance refusals to FlutterBuildProvider, and #11659, which
removed one from AdbCommand; AppleAssetCatalogAnalysis no longer builds
one. The architecture guards fail on main until the baseline records
those counts.
@morluto morluto added enhancement New feature or request provider: flutter Analysis provider / engine: flutter labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request provider: flutter Analysis provider / engine: flutter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant