Conversation
.zi-at-eval was defined in both lib/zsh/autoload.zsh and lib/zsh/install.zsh. The two agreed on behaviour and differed in wording, so nothing was broken, but both libraries are sourced conditionally and in different orders depending on the command, so which definition won varied by code path. That is a heisenbug waiting for the first divergence. The only call sites are install.zsh:2410 and install.zsh:2430, inside the file that defines it. It is absent from contracts/public-contract-v1.json and has no consumer anywhere in the organization, so removing the autoload.zsh copy leaves one deterministic definition next to its callers. Two `# FUNCTION:' headers named a different function than they preceded: lib/zsh/autoload.zsh .zi-update-in-parallel -> .zi-update-all-parallel zi.zsh +zi-parse-opts -> .zi-parse-opts The second was not in the issue; a systematic sweep of every header against the following definition found it. Neither defect can be caught behaviourally. Duplicate definitions that agree behave correctly until they drift, and a wrong header misleads only the next reader. tests/source-hygiene.zsh asserts both structurally over zi.zsh and lib/zsh/*.zsh, currently 175 functions, and was observed failing with each defect reintroduced separately. Issue item 2 is not reproducible: the header above @zsh-plugin-run-on-unload names that function correctly. Item 4, the .zi-load-ices snippet-directory TODO, is untouched; the issue itself says it needs an ID-collision test before it can be classified as a defect. Closes #449
This was referenced Sep 3, 2026
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.
Wave 1 item 2 from the preserved architecture audit, plus the structural tests that stop both defects recurring.
The duplicate
.zi-at-evalwas defined in bothlib/zsh/autoload.zsh:303andlib/zsh/install.zsh:2047. I diffed them: same behaviour, different wording. So nothing was broken.What makes it worth fixing is that both libraries are sourced conditionally and in different orders depending on the command:
So which definition wins varies by code path. Two copies that must stay in lockstep, selected non-deterministically, become a heisenbug the first time they drift.
Removing the
autoload.zshcopy is safe: the only call sites areinstall.zsh:2410andinstall.zsh:2430, inside the file that defines it; it is absent fromcontracts/public-contract-v1.json; and it has no consumer anywhere in the organization.The drifted headers
The second is not in the issue. A systematic sweep of every
# FUNCTION:header against the definition that follows it turned it up, which is why the test does that sweep rather than checking one known case.Why a structural test
Neither defect is reachable behaviourally. Duplicate definitions that agree behave correctly right up until they drift, and a wrong header misleads only the next reader.
tests/source-hygiene.zshasserts both directly overzi.zshandlib/zsh/*.zsh, currently 175 functions.Each defect was reintroduced separately and the test observed failing on it:
Registered in
zsh-n.yml, both path filters and a job.Two issue items not addressed, deliberately
Item 2 is not reproducible. The header above
@zsh-plugin-run-on-unloadatzi.zsh:1309names that function correctly. Either it was fixed after the audit or the audit was slightly off. Nothing to change, and the new test would catch it if it regressed.Item 4 is out of scope. The
.zi-load-icessnippet-directory TODO is untouched; the issue itself says it needs an ID-collision test before it can be classified as a defect. That deserves its own investigation rather than being bundled here.Full suite 20/20,
zsh -nclean onzi.zshand both libraries.Closes #449