refactor(windows): trim dead fields from New-DreamEnv return hash#1012
Open
yasinBursali wants to merge 2 commits intoLight-Heart-Labs:mainfrom
Open
refactor(windows): trim dead fields from New-DreamEnv return hash#1012yasinBursali wants to merge 2 commits intoLight-Heart-Labs:mainfrom
yasinBursali wants to merge 2 commits intoLight-Heart-Labs:mainfrom
Conversation
Collaborator
$envResult returned a 4-field hashtable (EnvPath, SearxngSecret, OpenclawToken, DashboardKey) but phase 06 only reads SearxngSecret and OpenclawToken. EnvPath and DashboardKey have zero runtime readers; the dry-run stub and three header comments advertised fields that were never consumed. Drops EnvPath and DashboardKey from the return and from the dry-run stub. DASHBOARD_API_KEY continues to be generated and written to .env by the function body - only the return-hash surface was trimmed. Pure code hygiene; no runtime behavior change on Windows. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Phase 07's header comment listed $envResult under Reads, but a body-wide search shows 07-devtools.ps1 never actually reads $envResult.OpenclawToken (or any field). This stale claim was inherited from upstream/main and predates the return-hash trim — the trim brought it from "(OpenclawToken, DreamAgentKey)" down to "(OpenclawToken)", but the field has zero readers in this phase regardless. The Reads section now lists only the variables 07-devtools actually consumes ($dryRun, $cloudMode, $installDir, $tierConfig, $script:OPENCODE_*). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2c5e451 to
414c41e
Compare
Contributor
Author
|
Pushed the rebased state. Per the audit ask and this PR's own merge-order coordination clause, dropped Follow-up commit PSScriptAnalyzer can't run locally on macOS — |
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.
✅ Rebased on current
main2026-04-28 (post-#996)Original PR trimmed the dead
EnvPath+DashboardKeyfields fromNew-DreamEnv's return hash. After #996 merged (which renamedDashboardKey→DreamAgentKeywhile adding aDREAM_AGENT_KEY=...line to the.envheredoc),$envResult.DreamAgentKeyis also dead surface (zero readers anywhere in the tree — host agent readsDREAM_AGENT_KEYfrom.envdirectly via Docker env-file injection, not from the PowerShell return value).Per the audit ask and this PR's own merge-order coordination clause, I dropped
DreamAgentKeyalong withEnvPathon rebase. The return hash now contains exactly the 2 fields with live readers:SearxngSecret+OpenclawToken.What
Reduces the
$envResulthashtable returned byNew-DreamEnvfrom four fields (EnvPath,SearxngSecret,OpenclawToken,DreamAgentKey— wasDashboardKeypre-#996) to the two that are actually consumed (SearxngSecret,OpenclawToken). Updates header comments and the dry-run stub to match.Files touched:
dream-server/installers/windows/lib/env-generator.ps1— return blockdream-server/installers/windows/install-windows.ps1— header commentdream-server/installers/windows/phases/06-directories.ps1— header comment + dry-run stubdream-server/installers/windows/phases/07-devtools.ps1— header comment (additional commit414c41ecdrops the misleading$envResultreference entirely; phase 07 doesn't actually read from the hash)Why
Pure code hygiene. A full grep of
installers/windows/confirms$envResult.EnvPath,$envResult.DashboardKey(pre-#996), and$envResult.DreamAgentKey(post-#996) are never accessed. These fields were stale API surface that drifted past what any caller needs; the headers pointed consumers at properties that would silently return$nullif accessed.DASHBOARD_API_KEYandDREAM_AGENT_KEYthemselves are unaffected —$dashboardApiKeyand$dreamAgentKeyare still generated viaGet-EnvOrNew "<KEY>"and written to.envthrough the heredoc (lines 287 + 289 ofenv-generator.ps1). Only their unused return-hash surface was dropped.How
EnvPathandDreamAgentKeylines (the latter introduced by fix(windows): generate DREAM_AGENT_KEY in installer env-generator.ps1 #996); keepSearxngSecretandOpenclawTokenwith existing alignment.install-windows.ps1,phases/06-directories.ps1, andphases/07-devtools.ps1: updated to advertise only the fields the function actually emits. Phase 07'sReads:block additionally drops the entire$envResultline — phase 07 reads only$dryRun,$cloudMode,$installDir,$tierConfig,$script:OPENCODE_*.Testing
git grep '$envResult\.' dream-server/installers/windows/→ exactly.SearxngSecretand.OpenclawToken. Zero references to.EnvPath,.DashboardKey, or.DreamAgentKeyanywhere.Invoke-ScriptAnalyzer -Path dream-server/installers/windows/ -Recurseon Windows before merge. CI gatelint-powershell.ymlcovers this on push.Manual Windows test checklist (WSL2 + Docker Desktop + PowerShell 7+)
pwsh -NoProfile -ExecutionPolicy Bypass -File install-windows.ps1 -DryRun— phase 06 prints dry-run messages; noMissingPropertyerrors;$envResultpopulated with 2 fields.pwsh -NoProfile -ExecutionPolicy Bypass -File install-windows.ps1—.envcontains non-empty values forDASHBOARD_API_KEY,DREAM_AGENT_KEY,SEARXNG_SECRET,OPENCLAW_TOKEN;config/searxng/settings.ymlandconfig/openclaw/openclaw.jsonhave the generated secrets..env—DASHBOARD_API_KEYandDREAM_AGENT_KEYpreserved byte-for-byte (Get-EnvOrNew path).Invoke-ScriptAnalyzer -Path dream-server/installers/windows/ -Recurse— no new warnings against the four modified files.Platform Impact
$envResult.SearxngSecret/.OpenclawTokenstill work. Zero references to the removed.EnvPath/.DashboardKey/.DreamAgentKeyexist anywhere in the tree.installers/linux/or Linux-reachable paths touched.installers/macos/or macOS-reachable paths touched.