Repository navigation
fix(arrays): release mapfile budgets and surface refusals - #2733
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | d166e9d | Commit Preview URL Branch Preview URL |
Oct 15 2026, 03:15 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Repeated
mapfilereads now release the replaced array's retained entry and byte charges.mapfile -Oupdates existing entries through the interpreter's checked writer, preserving other entries and refunding overwritten values. Array entry-limit refusals now fail execution through the existing memory-error path instead of silently dropping writes.Why
The independent brush-web evaluation found that repeated large reads eventually emptied arrays, including unrelated arrays in later executions. Direct removal of
mapfiledestinations left phantom charges in the session-wideMemoryBudget; indexed merges also removed their destination before admission. The shared 100,000-entry ceiling was eventually exhausted, and ignored insertion refusals reported success. Both entry and retained-byte charges now follow storage ownership; resource ceilings are unchanged.Before / After
Exact upstream reproduction, default limits:
Baseline (
origin/mainat8a817bf0):Fixed CLI and GNU Bash 5.3.20, byte-for-byte:
The six original native regression tests failed on the baseline. Coverage includes tiny entry budgets, empty input,
-Ooverwrite/merge, repeated 48 KB replacements, genuine entry/byte exhaustion, and recovery in subsequent host calls. Browser-WASM tests exercise repeated 50,000-line reads and a rejected 100,001-entry read followed by recovery. Existing security tests now require visible errors while checking retained counts.mapfilealso matches Bash's status-1 refusal for interpreter-owned debug-stack arrays (FUNCNAME,BASH_SOURCE,BASH_LINENO), whose uncharged metadata must not refund user capacity. A focused regression covers this ceiling-preservation edge case.Validation
just pre-pr: 7,121 Rust tests/doctests plus 165 latest-main script tests; formatting, lint, docs/knowledge/capability/release checks, and dependency vetting pass.http_client,ssh,sqlitesuites: 6,993 tests pass; expanded-feature doctests pass.cargo deny checkpasses; regenerated builtin inventory has no diff.parallel_executionCriterion benchmark completes.just bench: 96 cases, zero errors and 100% output match for both engines (local smoke run, not a before/after performance baseline).Risk
FUNCNAMEremains reserved after unset (L-MAPFILE-002); modeling removal of its special status is outside the interpreter-owned metadata lifecycle.Checklist