Separate managed config drafts from workspace cache - #370
Open
rohita5l wants to merge 1 commit into
Open
Conversation
This was referenced Aug 24, 2026
Collaborator
Author
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.
Why
~/.ucode/managed-state.jsoncurrently serves two different owners:ucode setupwrites an admins unpublished draft, while every normal launch overwrites the same file with the workspace-published config. That means testing or even launching can destroy unpublished edits. A single fallback file also cannot safely represent multiple workspaces.This PR fixes the storage model only. It does not add new CLI workflow.
New invariants
~/.ucode/managed-state.jsonis only the editable draft written by setup.~/.ucode/managed-cache/<workspace-hash>.jsonis only the last config fetched from that workspace.Implementation
source,fetched_at, canonical config digest)fsync, mode0600, andos.replaceucode --dry-runread the published cache instead of the draftReview guide
managed_config.py:_save_managed_payload,save/load_managed_cache, thenrefresh_managed_config.TestPersistenceandTestRefreshManagedConfigfor the invariants and failure cases.Testing
pytest tests/test_managed_config.py tests/test_cli.py -q: 275 passedStack