Skip to content

Add a sandbox that exercises every ucode configure path end to end - #440

Open
david-siqi-liu wants to merge 1 commit into
david/configure-managed-flowfrom
david/configure-sandbox
Open

Add a sandbox that exercises every ucode configure path end to end#440
david-siqi-liu wants to merge 1 commit into
david/configure-managed-flowfrom
david/configure-sandbox

Conversation

@david-siqi-liu

@david-siqi-liu david-siqi-liu commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

🥞 Stack (AIGTWY-4342 ucode configure)


What did you change, and why?

The configure flow spans admin detection, authoring, publish, apply, and per-agent file writes, and
the unit tests mock most of that away. This adds a sandbox that runs the real CLI against a fake
Databricks workspace inside a throwaway HOME, so the file writes, the state transitions, and the
printed output under assertion are the real ones.

  • 27 scenarios across 6 groups (draft, published, empty, gate, multi, section). Each runs
    in its own subprocess with a fresh HOME, fresh module state, and fresh caches.
  • Only two seams are faked: the HTTP layer in ucode.databricks and the questionary prompts in
    ucode.ui. Everything above them (cli, managed_wizard, managed_config, managed_publish, agents,
    config_io, state) executes for real.
  • Any URL the fake workspace does not recognize is recorded as unrouted and returned as an error, so
    a flow that reaches an unmodelled endpoint fails loudly instead of degrading quietly.
  • Tests only. No change under src/.
  • Reviewer focus: the expectations table in tests/test_configure_sandbox.py. That is the actual
    specification of what each path should do; the rest is plumbing.

How do you know it works?

uv run pytest tests/test_configure_sandbox.py collects 28 tests: the 27 scenarios plus a guard
that fails if a scenario is added without expectations. Green locally, and it runs as part of the
default suite in CI. To drive one scenario by hand: python -m tests.sandbox_scenarios <name>.

The configure flow branches on three axes at once: whether the managed-config
opt-in and backend are live, whether the workspace publishes a config, and
whether the caller is an admin (including the case where the SCIM check cannot
say). The unit tests cover each branch with the collaborators stubbed, which is
where the branch logic belongs, but nothing exercised a whole run: the state file
it leaves behind, the settings it writes, the order the messages come out in, or
whether the server was touched at all.

Add a sandbox that runs the real CLI in a subprocess per scenario, inside a
throwaway HOME, against a fake workspace. Only three seams are faked: the HTTP
layer in `ucode.databricks`, the subprocesses that shell out to the databricks
CLI or an agent binary, and the questionary prompts, which are driven by a
scripted answer queue that fails loudly on an unexpected question. Everything
above them (cli, managed_wizard, managed_config, managed_publish, agents/*,
config_io, state) runs for real, and any endpoint the fake does not model is
reported instead of quietly degrading.

The 27 scenarios cover the gates, a published config for each persona, an empty
workspace, the draft lifecycle, the pre-v2 migration, and the admin-only
sections. `draft/survives-a-launch` is the load-bearing one: it fails if the
draft and published slots are ever collapsed back into one, since a launch has to
overwrite the fetched snapshot while leaving the admin's authored draft alone.

Expectations live in `tests/test_configure_sandbox.py`, which drives the table
concurrently and adds about two seconds to the suite. Verified by mutation:
dropping the apply of a freshly authored draft fails four scenarios, and making
a published write clobber the draft slot fails twelve.

Co-authored-by: Isaac <no-reply@databricks.com>
@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/configure-sandbox branch from 5a346ab to e4bd556 Compare September 2, 2026 00:39
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