Repository navigation
One tree per alias expansion, opaque in the state, reuse key from the modes (refactor 3.2, S5, S7) - #241
Merged
Conversation
sf624
added this pull request to stack #243
October 23, 2026 09:17
Contributor
|
Web preview: https://sf624.github.io/bash-explainer/pr/241/ (commit 50e2801) |
sf624
force-pushed
the
refactor/3.2-trees
branch
from
October 23, 2026 11:40
fcb6f54 to
be2fb5f
Compare
… the walk's modes (refactor 3.2, S5, S7) - The trust scan reads the trees of the aliases the walk expands (an alias's text with the rest of the command, Scripts.expansion), at each command named like an alias the script defines: the text as foreign text, the rest where the command is. treeFacts, Trust.reads and the global cache of alias texts are gone; an alias no command names is read alone, as before. So `m[k]=1` in an alias after `declare -A m` keeps the decisions. - Whether a path ran what the walk does not read (a sourced file, a string not read, startup files) is ShellState.opaque, merged at joins, and a change other code may see (widen); the arithmetic memos depend on it instead of being emptied. - The walk's modes are one record (dead, quiet); a function walk is reused by a key derived from it, and a reused walk makes its changes again for what collects them (a trap's action calling a function now widens what it sets, as bash may change it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ript, not over the whole script A script with many plain uses of aliases (1,200 uses of `ll`) trusted nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…f 3.2 trees) 500 commands of a chain of aliases that doubles 9 times asked for 255,500 trees, and V8 ran out of memory. A model now makes at most 20,000; past them the trust scan trusts nothing and the walk takes the alias as what it does not read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o, in trees shared by text (review of 3.2 trees) Taking the alias as unread text kept every variable and option as it was: after a capped chain whose last alias runs `set -f`, `*.txt` was said to expand. The trust scan still trusts nothing then. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sf624
force-pushed
the
refactor/3.2-trees
branch
from
October 23, 2026 14:20
ec65607 to
50e2801
Compare
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.
Step 3.2 of docs/design/refactor.md, layer 2 of 3 (stack: #240 → #241 → #242).
Addresses: S7 (alias part), S5 (reuse key,
opaque)Scripts.expansion), used by the walk where it expands the alias and read by the trust scan at each command named like an alias the script defines (the text as foreign text, the rest of the command where the command is; not an alias inside itself; at most 1,000 trees, then nothing is trusted).treeFacts,Trust.readsand the global cache of alias texts are gone; an alias no command names is read alone, as before. Effect:m[k]=1in an alias afterdeclare -A mkeeps the decisions (before, nothing was trusted). test/trust.test.ts "reads the aliases the walk expands from the walk's own trees…" (with bash), plus analias 'g,h=f'row.opaque: nowShellState.opaque, merged at joins, and a change thatwidenpasses on (bodies no call reached, traps, recursive calls); the arithmetic memos depend on it instead of being emptied. test/state.test.ts "says so on the paths that ran what the walk does not read, and after they join" (with bash).Walker.mode: dead, quiet) and the key is derived from it (reuseKey). A reused walk now makes its changes again for what collects them, which fixes a contradiction:f() { x=2; }; x=1; f; x=1; trap f USR1saidxis 1 after thetrap, where bash has 2 once the signal comes (test/state.test.ts "a walk reused makes its changes again…", with bash; CHANGELOG Fixed).Probe tests and test/decisions.test.ts unchanged; fixture dumps unchanged. Node 24 coverage 100%, snippets regenerated.
🤖 Generated with Claude Code