Replace the desktop .env banner instead of stacking another one - #416
Open
kevin9327 wants to merge 1 commit into
Open
Replace the desktop .env banner instead of stacking another one#416kevin9327 wants to merge 1 commit into
kevin9327 wants to merge 1 commit into
Conversation
kevin9327
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso and
tylerslaton
as code owners
September 7, 2026 11:13
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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 this changes
The desktop shell's
.envgrows by two lines on every start, forever.writekeeps the lines it did not write — which is the right rule, and its own header commentmatches it:
So the old banner is preserved and a new one is appended beside it.
Measured
Five starts, same settings:
and the file itself:
Nothing breaks — Compose reads the settings fine. It is the file a person opens when they want to
add
HTTPS_PROXYor check which port the server is on, and after a few weeks of use the thing theycame to read is under a wall of repeated banners. The existing test
rewriting_replaces_its_own_settings_rather_than_appending_them_twicecovers the settings, which iswhy this was not caught: it is the banner that repeats, not the settings.
Fix
The banner is a constant, and the preserve pass recognises it as the shell's own rather than as a
line somebody else wrote. The blank lines the removed banners leave behind go with them, so the
separator stays one blank line rather than one per start.
Comments somebody else put in the file are untouched — that is the point of the rule and it is what
the second test pins.
Where it runs
machine.
computer. The
.envit writes is what the replicas later read, and it now says the same thingon the fiftieth start as on the first.
std::fs::writeas before.Boundary and audit
exists.
Changelog
CHANGELOG.mdunderUnreleased.Tests
Two in
desktop/src-tauri/src/env.rs:Against
mainthe first fails withleft: 5, right: 1.How I tested
Windows 11.
cargo test --libindesktop/src-tauriis 72 passed, 0 failed, up from 70 by the twonew tests.
cargo fmt --all -- --checkandcargo clippy --libare clean. The crate has norust-toolchain.toml, so I built it with the 1.98.0 toolchain installed here.