Read only config#82
Merged
Merged
Conversation
Config tab now shows brew config output only — no editing. Removed everything related to reading or writing brew.env: BrewEnvFile model, BrewEnvFileParser, BrewEnvFileLocator, BrewEnvFileRepository, EnvFileRepository protocol, and all editor UI (ConfigEnvironmentEditorCard, EnvKeyDescriptor, EnvRowItem, CaskOpts, ConfigPagePayload). ConfigViewModel and ConfigView simplified to a single repository dependency. All associated tests deleted; ConfigViewModelTests updated. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR simplifies the Config feature by removing all brew.env read/write/editing infrastructure, leaving the Configuration page as a read-only view backed solely by the brew config snapshot.
Changes:
- Removed the
brew.envdomain model, parser/writer/locator, repository interface + implementation, and all related tests. - Simplified
ConfigViewModeland views to load/render onlyConfigRepositorystate (read-only; copy/refresh only). - Added
BrewConfigSnapshot: Placeholdableto supportAsyncContentView’s redacted placeholder rendering after the VM simplification.
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/BrewRepositoriesTests/BrewEnvFileRepositoryTests.swift | Deleted env-file repository tests (env editing removed). |
| Tests/BrewFeatureConfigTests/ConfigViewModelTests.swift | Updated tests for the simplified ConfigViewModel init and behavior. |
| Tests/BrewFeatureConfigTests/ConfigViewModelEditingTests.swift | Deleted editor-flow tests (editing removed). |
| Tests/BrewFeatureConfigTests/ConfigViewModelAdvancedTests.swift | Deleted advanced editor behavior tests (editing removed). |
| Tests/BrewFeatureConfigTests/CaskOptsTests.swift | Deleted HOMEBREW_CASK_OPTS advisory tests (editor removed). |
| Tests/BrewCLITests/BrewEnvFileWriterTests.swift | Deleted env-file writer tests (writer removed). |
| Tests/BrewCLITests/BrewEnvFileParserTests.swift | Deleted env-file parser tests (parser removed). |
| Tests/BrewCLITests/BrewEnvFileLocatorTests.swift | Deleted env-file locator tests (locator removed). |
| Tests/BrewCLITests/BrewEnvFileBrewSemanticsTests.swift | Deleted brew.env semantics tests (feature removed). |
| Sources/BrewRepositoryInterfaces/Protocols/EnvFileRepository.swift | Deleted EnvFileRepository protocol. |
| Sources/BrewRepositoryInterfaces/PreviewSupport/PreviewSupport.swift | Removed env-file preview repository wiring. |
| Sources/BrewRepositoryInterfaces/Fakes/Stubs.swift | Removed StubEnvFileRepository fake. |
| Sources/BrewRepositories/BrewEnvFileRepository.swift | Deleted live brew.env repository implementation. |
| Sources/BrewFeatureConfig/Views/ConfigView.swift | Removed save/discard/editor UI; now copy/refresh + read-only cards. |
| Sources/BrewFeatureConfig/Views/ConfigEnvironmentEditorCard.swift | Deleted the environment editor card UI. |
| Sources/BrewFeatureConfig/Views/ConfigColumnsRoot.swift | Removed env-file repository dependency injection into ConfigView. |
| Sources/BrewFeatureConfig/ViewModels/EnvRowItem.swift | Deleted editor row model types. |
| Sources/BrewFeatureConfig/ViewModels/EnvKeyDescriptor.swift | Deleted env key catalogue/descriptor/editor-only types. |
| Sources/BrewFeatureConfig/ViewModels/ConfigViewModel.swift | Reduced VM to config snapshot load/refresh + error mapping only. |
| Sources/BrewFeatureConfig/ViewModels/ConfigPagePayload.swift | Deleted combined snapshot+env payload model. |
| Sources/BrewFeatureConfig/ViewModels/CaskOpts.swift | Deleted cask opts advisory logic (editor removed). |
| Sources/BrewCore/Models/BrewEnvFile.swift | Deleted BrewEnvFile domain model. |
| Sources/BrewCore/Models/BrewConfigSnapshot+Placeholdable.swift | Added placeholder snapshot for AsyncContentView loading skeletons. |
| Sources/BrewCLI/Config/BrewEnvFileWriter.swift | Deleted brew.env writer. |
| Sources/BrewCLI/Config/BrewEnvFileParser.swift | Deleted brew.env parser. |
| Sources/BrewCLI/Config/BrewEnvFileLocator.swift | Deleted brew.env locator. |
| Sources/BrewAppEnvironment/UnimplementedRepositories.swift | Removed unimplemented env-file repository stub. |
| Sources/BrewAppEnvironment/RepositoryEnvironment.swift | Removed EnvironmentValues.envFileRepository entry. |
| Homebrew/Features/MainWindow/Views/MainWindowView.swift | Removed env-file repository preview injection. |
| Homebrew/BrewApp.swift | Removed env-file repository from app composition + scene-phase invalidation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MikeMcQuaid
approved these changes
Jul 5, 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.
PR: Make Config feature read-only; remove env file editing
Summary
Removes all
brew.envread/write infrastructure from the Config feature, making the Configuration page a read-only view ofbrew configoutput. The env-file editor added complexity and surface area that wasn't justified by the current UX; stripping it out brings the feature back to a simple, correct display of the config snapshot.Changes
BrewEnvFilemodel and all CLI-layer env file code —BrewEnvFileLocator,BrewEnvFileParser,BrewEnvFileWriterand theBrewEnvFiledomain model are gone.EnvFileRepositoryprotocol and implementation —BrewEnvFileRepositoryand theEnvFileRepositoryprotocol are deleted, along with their registration inRepositoryEnvironmentand the unimplemented stub.ConfigViewModelfrom ~400 lines to ~50 — draft state, dirty tracking, save/revert logic, dangerous-key confirmation flow, andpageStatecombining both repositories are all removed. The VM now exposes a singlepageState: LoadState<BrewConfigSnapshot, String>backed only byConfigRepository.CaskOpts,ConfigPagePayload,EnvKeyDescriptor,EnvRowItemare removed entirely.ConfigEnvironmentEditorCard— the 365-line editor view is gone;ConfigViewandConfigColumnsRootupdated accordingly.BrewConfigSnapshot+Placeholdable— small extension to support redacted placeholder rendering on the now-simplified config view.BrewEnvFileBrewSemanticsTests,BrewEnvFileLocatorTests,BrewEnvFileParserTests,BrewEnvFileWriterTests,BrewEnvFileRepositoryTests,CaskOptsTests,ConfigViewModelAdvancedTests, andConfigViewModelEditingTestsare removed.ConfigViewModelTestsis trimmed to match the reduced VM surface.Net: −3,333 lines, +49.
Why this split
The env-file writer was built speculatively. Keeping it required maintaining a parallel load/sync path alongside the config snapshot, handling merge conflicts between external file changes and in-progress edits, and classifying keys as dangerous or read-only — all for a feature that doesn't ship yet. Removing it now leaves a clean foundation; editing can be re-introduced as a deliberate, scoped piece of work if needed.
Testing
swift test --filter ConfigViewModelTests— all remaining config VM tests pass.brew configsnapshot correctly.PR checklist
Claude Code removed most of the code and drafted this description from
git diff main...HEAD. The diff, commit messages, and deleted files were reviewed manually to confirm accuracy before filing.