[GH-ISSUE #5221] [Docs] AOT buffer allocation is one byte larger than the guide states #3197

Closed
opened 2026-10-31 00:37:44 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @coygeek on GitHub (Oct 19, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/5221

Before submitting

  • I searched the existing issues for a related documentation report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Documentation location

Flutter analysis guide, Limits / Bounded reads.

Problem

The guide says “the AOT image buffer is allocated at exactly the declared size before reading”. The selected-library inspection instead allocates one additional byte. This affects readers relying on the precise allocation description; the verified inspections themselves succeeded.

To check the contradiction in a source checkout at the baseline below, read the cited guide passage, then follow inspect-dart-aot in src/cli/flutterCommands.ts through the shared Flutter application service into FlutterBuildProvider.inspectDartAot. After selecting a lib/<abi>/libapp.so member and checking its declared size against the library budget, the provider calls Buffer.alloc(declared + 1) before reading the owned image file. For any admitted declared size, that expression requests one more byte than the guide states.

Expected content

Describe the allocation accurately and consistently with the implementation. The documentation and observed allocation should agree while successful inspections retain their actual library byte counts and structural coverage. This report does not establish which allocation strategy should be used or why the extra byte exists.

Supporting evidence

The allocation and read loop provides conclusive source evidence for this documentation contradiction.

Retained verification at the source baseline used synthetic APK ZIPs with consistent declared/actual member lengths, aotFixtureImage() from src/flutter/FlutterBuild.fixture.ts, and the repository APK writer. An in-process CLI invocation with default ABI selection (arm64-v8a) requested and received 9745 buffer bytes for a 9744-byte library, while reporting 9744 library bytes, the fixture's expected snapshot hash, and complete structural/overall coverage. Two shared-application-service checks with explicit x86_64 selection observed (declared bytes, allocation bytes, reported bytes) of (9744, 9745, 9744) and (9745, 9746, 9745); both retained complete structural coverage. The second image added one trailing zero byte. The allocation observer forwarded all arguments to the original allocator.

These are prior executed source-checkout observations, read back during publication preparation; no runtime check was rerun during this preparation. The source comparison above is independently sufficient to observe the documentation mismatch. No malformed archive, incorrect analysis result, or consequential resource-boundary failure was demonstrated.

Additional context

Verified source baseline: 39275420ea18ad803eccfcc2702865b98ed36e44. In a pre-filing source comparison, the cited Flutter code and guide were byte-identical to the default branch despite an unrelated branch-head advance. Verification used Node 24.18.0, npm 11.16.0 and Vitest 5.0.3 on macOS arm64. Published release source compared: rea-agents-6.7.0 at 27dc42d10249f0410904a75c0997842eb03b931c; its guide and provider files are byte-identical to the baseline. Release applicability is a source comparison only. The packaged release runtime, standalone installed CLI and MCP transport were not exercised.

Triage assessment

  • Impact level: P3
  • Assessment status: supported
  • Impact basis: The allocation description differs by one byte; the retained valid-input inspections succeeded with correct byte counts and complete structural coverage, without a consequential behavior change.
  • Workaround status: unverified
  • Workaround basis: No documentation workaround was evaluated; obtaining successful inspection results did not require a runtime workaround.
Originally created by @coygeek on GitHub (Oct 19, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/5221 ### Before submitting - [x] I searched the existing issues for a related documentation report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ### Documentation location [Flutter analysis guide, Limits / Bounded reads](https://github.com/morluto/rea/blob/39275420ea18ad803eccfcc2702865b98ed36e44/docs/flutter-analysis.md#L132-L137). ### Problem The guide says “the AOT image buffer is allocated at exactly the declared size before reading”. The selected-library inspection instead allocates one additional byte. This affects readers relying on the precise allocation description; the verified inspections themselves succeeded. To check the contradiction in a source checkout at the baseline below, read the cited guide passage, then follow `inspect-dart-aot` in `src/cli/flutterCommands.ts` through the shared Flutter application service into `FlutterBuildProvider.inspectDartAot`. After selecting a `lib/<abi>/libapp.so` member and checking its declared size against the library budget, the provider calls `Buffer.alloc(declared + 1)` before reading the owned image file. For any admitted declared size, that expression requests one more byte than the guide states. ### Expected content Describe the allocation accurately and consistently with the implementation. The documentation and observed allocation should agree while successful inspections retain their actual library byte counts and structural coverage. This report does not establish which allocation strategy should be used or why the extra byte exists. ### Supporting evidence The [allocation and read loop](https://github.com/morluto/rea/blob/39275420ea18ad803eccfcc2702865b98ed36e44/src/flutter/FlutterBuildProvider.ts#L958-L1028) provides conclusive source evidence for this documentation contradiction. Retained verification at the source baseline used synthetic APK ZIPs with consistent declared/actual member lengths, `aotFixtureImage()` from `src/flutter/FlutterBuild.fixture.ts`, and the repository APK writer. An in-process CLI invocation with default ABI selection (`arm64-v8a`) requested and received 9745 buffer bytes for a 9744-byte library, while reporting 9744 library bytes, the fixture's expected snapshot hash, and complete structural/overall coverage. Two shared-application-service checks with explicit `x86_64` selection observed `(declared bytes, allocation bytes, reported bytes)` of `(9744, 9745, 9744)` and `(9745, 9746, 9745)`; both retained complete structural coverage. The second image added one trailing zero byte. The allocation observer forwarded all arguments to the original allocator. These are prior executed source-checkout observations, read back during publication preparation; no runtime check was rerun during this preparation. The source comparison above is independently sufficient to observe the documentation mismatch. No malformed archive, incorrect analysis result, or consequential resource-boundary failure was demonstrated. ### Additional context Verified source baseline: `39275420ea18ad803eccfcc2702865b98ed36e44`. In a pre-filing source comparison, the cited Flutter code and guide were byte-identical to the default branch despite an unrelated branch-head advance. Verification used Node 24.18.0, npm 11.16.0 and Vitest 5.0.3 on macOS arm64. Published release source compared: `rea-agents-6.7.0` at `27dc42d10249f0410904a75c0997842eb03b931c`; its guide and provider files are byte-identical to the baseline. Release applicability is a source comparison only. The packaged release runtime, standalone installed CLI and MCP transport were not exercised. ## Triage assessment - Impact level: P3 - Assessment status: supported - Impact basis: The allocation description differs by one byte; the retained valid-input inspections succeeded with correct byte counts and complete structural coverage, without a consequential behavior change. - Workaround status: unverified - Workaround basis: No documentation workaround was evaluated; obtaining successful inspection results did not require a runtime workaround.
Author
Owner

@morluto commented on GitHub (Oct 23, 2026):

Fixed on main in github.com/morluto/rea@80bc0f5ede. Guide now states admitted declared size plus one byte and distinguishes the reported bytes actually read, matching Buffer.alloc(declared + 1).

Verified against the full issue and current source. The published tree also retains passing docs:check and docs:build receipts. This closes the documentation/help/CI-configuration scope; no new provider runtime verification is claimed.

<!-- gh-comment-id:6376068279 --> @morluto commented on GitHub (Oct 23, 2026): Fixed on main in https://github.com/morluto/rea/commit/80bc0f5ede815a5d9e1a5e97ba20dea5ea7831e3. Guide now states admitted declared size plus one byte and distinguishes the reported bytes actually read, matching Buffer.alloc(declared + 1). Verified against the full issue and current source. The published tree also retains passing docs:check and docs:build receipts. This closes the documentation/help/CI-configuration scope; no new provider runtime verification is claimed.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#3197
No description provided.