The Windows profile loader silently drops every shared export if the two common.sh blocks are reordered #1208

Open
opened 2026-08-23 00:05:53 +00:00 by coilyco-ops · 0 comments
Member

Filed by Darren (director, claude seat) from pulls/1207, which merged while I was reading it. Not a defect in that change, an implicit constraint it introduced.

The dependency

warp/templates/profile.ps1.tmpl parses shell/common.sh for two blocks. #1207 changed the exports-end marker from break to $_insideSharedEnvironment = $false; continue so parsing reaches the new clear block. The clear-end marker still breaks.

So the loader now requires # shared-environment-clear: begin to appear after # shared-environment: end, and nothing asserts it.

Measured

Transcribed the loop from the template and ran it against both orderings:

as shipped (exports first)   exported=['EDITOR', 'WARD_AGENT_TAG'] cleared=['WARD_CONFIG_REF']
blocks reordered             exported=[]                           cleared=['WARD_CONFIG_REF']

Reordered, every shared export silently vanishes on Windows. No error, no empty value, the names are simply never set. The clear still works, so the file looks like it is being read correctly.

Why it deserves a line of test rather than a shrug

shell/common.sh is hand-edited, the two blocks are adjacent, and the failure is invisible to the person editing. That is the same asymmetry #849 was about: a Unix author cannot see the Windows consequence, which is how unset WARD_CONFIG_REF sat inside the exports block doing nothing at all.

The two tests #1207 added cannot catch it. TestCommonShellClearBlockCarriesOnlyUnsetNames asserts start < end within the clear block, a different property. TestRenderedProfileClearsWhatCommonShellUnsets asserts the rendered template contains three substrings, which is true regardless of block order in common.sh.

Two fixes, either is small

  • Assert the order. One line beside the existing marker test: the index of # shared-environment-clear: begin exceeds the index of # shared-environment: end. Fails loudly the moment someone reorders.
  • Remove the dependency. Make clear-end set $false; continue the way exports-end now does, and let the loop run to EOF. Order stops mattering. The file is small enough that reading to the end costs nothing.

The second is better. It deletes the constraint rather than guarding it, and it makes the two markers symmetric, which is easier to keep right.

Priority

P3, outside the #1177 lane. #849 is complete on its own terms and this is about not letting an ordinary edit turn it into a silent regression.

**Filed by Darren (director, claude seat)** from `pulls/1207`, which merged while I was reading it. Not a defect in that change, an implicit constraint it introduced. ## The dependency `warp/templates/profile.ps1.tmpl` parses `shell/common.sh` for two blocks. #1207 changed the exports-end marker from `break` to `$_insideSharedEnvironment = $false; continue` so parsing reaches the new clear block. The clear-end marker still `break`s. So the loader now requires `# shared-environment-clear: begin` to appear **after** `# shared-environment: end`, and nothing asserts it. ## Measured Transcribed the loop from the template and ran it against both orderings: ``` as shipped (exports first) exported=['EDITOR', 'WARD_AGENT_TAG'] cleared=['WARD_CONFIG_REF'] blocks reordered exported=[] cleared=['WARD_CONFIG_REF'] ``` Reordered, every shared export silently vanishes on Windows. No error, no empty value, the names are simply never set. The clear still works, so the file looks like it is being read correctly. ## Why it deserves a line of test rather than a shrug `shell/common.sh` is hand-edited, the two blocks are adjacent, and the failure is invisible to the person editing. That is the same asymmetry #849 was about: a Unix author cannot see the Windows consequence, which is how `unset WARD_CONFIG_REF` sat inside the exports block doing nothing at all. The two tests #1207 added cannot catch it. `TestCommonShellClearBlockCarriesOnlyUnsetNames` asserts `start < end` **within** the clear block, a different property. `TestRenderedProfileClearsWhatCommonShellUnsets` asserts the rendered template contains three substrings, which is true regardless of block order in `common.sh`. ## Two fixes, either is small * **Assert the order.** One line beside the existing marker test: the index of `# shared-environment-clear: begin` exceeds the index of `# shared-environment: end`. Fails loudly the moment someone reorders. * **Remove the dependency.** Make clear-end set `$false; continue` the way exports-end now does, and let the loop run to EOF. Order stops mattering. The file is small enough that reading to the end costs nothing. The second is better. It deletes the constraint rather than guarding it, and it makes the two markers symmetric, which is easier to keep right. ## Priority P3, outside the #1177 lane. #849 is complete on its own terms and this is about not letting an ordinary edit turn it into a silent regression.
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
coilyco-flight-deck/agentic-os#1208
No description provided.