Skip to content

Replace ucode setup with a ucode configure-centered workflow - #433

Open
david-siqi-liu wants to merge 1 commit into
david/personal-mcp-skillsfrom
david/configure-managed-flow
Open

Replace ucode setup with a ucode configure-centered workflow#433
david-siqi-liu wants to merge 1 commit into
david/personal-mcp-skillsfrom
david/configure-managed-flow

Conversation

@david-siqi-liu

@david-siqi-liu david-siqi-liu commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

🥞 Stack (AIGTWY-4342 ucode configure)

Superseded: #437 (folded into #433, so the draft slot arrives together with its first writer).


What did you change, and why?

Authoring a managed config (ucode setup) and applying one (bare ucode) were separate entry points
with overlapping behavior, and neither told the user which side of that line they were on. ucode configure becomes the single entry point: it works out whether you are a workspace admin, then
either offers to author a draft or applies the workspace's published config. Authoring has to be
locally testable on the admin's own machine before it reaches anyone else, so the same change splits
~/.ucode/managed-state.json into a draft slot and a published slot.

  • ucode setup and its sub-app are gone. ucode configure carries authoring, and ucode publish
    promotes the draft to published.
  • The state file becomes a versioned map of workspace URL to {published, draft}. Authoring and
    ucode export read and write draft only; a launch refreshes published and never touches
    draft. Before this, both wrote the one slot, so refresh_managed_config on the next launch
    clobbered whatever the admin had just authored, and the admin had no way to run their own draft
    without publishing it first.
  • A map rather than a single slot because one developer can be configured against more than one
    workspace. A v1 file migrates into published (a v1 config's provenance is unrecoverable, and
    published is the safe reading), the legacy file is copied to managed-state.json.pre-v2.bak once
    before the first v2 write, and every write goes through a temp file plus rename.
  • README is rewritten around the new flow, including the on-disk state table.
  • Reviewer focus: admin detection and its fallback in src/ucode/cli.py (an inconclusive check must
    not strand a non-admin in the authoring path), the phase ordering in src/ucode/managed_wizard.py,
    and the slot read precedence, which is draft-then-published on every authoring surface and
    published alone on the apply path.

How do you know it works?

tests/test_cli.py and tests/test_managed_wizard.py were rebuilt around configure, covering the
admin and non-admin branches, the dry run, authoring from a file, and publish;
tests/test_managed_config.py covers the v1 to v2 migration and the slot boundary. #440 then drives
the whole flow end to end against a fake workspace. Full unit suite green locally at this layer
(2165 passed, 38 skipped).

@david-siqi-liu
david-siqi-liu force-pushed the david/configure-managed-flow branch from 7628c68 to 4bd0eeb Compare September 1, 2026 18:02
@david-siqi-liu
david-siqi-liu changed the base branch from main to david/personal-mcp-skills September 1, 2026 18:03
@david-siqi-liu
david-siqi-liu force-pushed the david/configure-managed-flow branch 2 times, most recently from c28f508 to 3f60924 Compare September 1, 2026 19:50
@david-siqi-liu
david-siqi-liu force-pushed the david/personal-mcp-skills branch from ba90328 to 82c09bb Compare September 1, 2026 23:28
@david-siqi-liu
david-siqi-liu force-pushed the david/configure-managed-flow branch from f95af9c to f6d295b Compare September 1, 2026 23:28
@david-siqi-liu
david-siqi-liu force-pushed the david/personal-mcp-skills branch from 82c09bb to 223b263 Compare September 2, 2026 00:39
@david-siqi-liu
david-siqi-liu force-pushed the david/configure-managed-flow branch from f6d295b to 3709e5b Compare September 2, 2026 00:39
@david-siqi-liu
david-siqi-liu force-pushed the david/personal-mcp-skills branch from 223b263 to 591ad29 Compare September 2, 2026 23:32
@david-siqi-liu
david-siqi-liu force-pushed the david/configure-managed-flow branch 2 times, most recently from 3f70031 to e27f8d9 Compare September 3, 2026 01:05
@david-siqi-liu
david-siqi-liu force-pushed the david/personal-mcp-skills branch from b2e5ea5 to 3ceeae9 Compare September 3, 2026 02:32
Managed config had its own command tree: `ucode setup` to author, `ucode setup
show`, `ucode setup help`, `ucode setup spend-tiers`, `ucode setup --from-file`.
An admin had to know that `ucode configure` set up their own machine while
`ucode setup` authored everyone else's, and a developer running `ucode configure`
against a workspace that publishes a config was walked through prompts whose
answers the managed config was about to override.

`ucode configure` is now the single entry point. It fetches the workspace's
published config once, applies it to this machine when there is one (showing the
drift inline rather than asking per setting), and only then offers authoring, to
admins. `ucode setup` and its subcommands are gone; `spend-tiers` and
`--from-file` move onto `configure`.

Authoring has to be locally testable before it reaches anyone else, so it writes
a draft that the admin's own machine runs from and nothing else reads.
`~/.ucode/managed-state.json` could not express that: it held one config per
workspace, written both by `refresh_managed_config` (the copy fetched on every
launch) and by the authoring wizard. The two clobbered each other, so a launch
wiped an in-progress draft, and a launch could apply an unpublished draft as if
it were published policy.

It now holds a versioned per-workspace map with separate `draft` and `published`
slots. Authoring and `ucode export` read and write the draft only, so nothing
reaches the workspace until `ucode publish`; a launch refreshes `published` and
never touches the draft. Keeping a map rather than one slot means refreshing one
workspace cannot clobber another workspace's draft. A v1 file migrates on read
into `published`, with its original bytes kept once at
`managed-state.json.pre-v2.bak`, because a legacy value's provenance cannot be
recovered. The map is written through a sibling temp file and renamed into place:
it now holds the draft, which nothing can refetch, so a torn write would lose it
outright.

A workspace whose managed-config backend is unavailable still configures the
machine and simply does not offer to publish.

Co-authored-by: Isaac <no-reply@databricks.com>
@david-siqi-liu
david-siqi-liu force-pushed the david/configure-managed-flow branch from e27f8d9 to ae085ca Compare September 3, 2026 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant