Repository navigation
infra(delta): say what is dirty and who deployed when refusing a dirty checkout - #172
Open
dadamsncsa wants to merge 1 commit into
Open
dadamsncsa wants to merge 1 commit into
dadamsncsa wants to merge 1 commit into
Conversation
…y checkout deploy --apply refused a dirty deployment tree with a one-line error, so whoever it blocked had to ask around to learn what was in the tree and whether it was safe to discard. Now the refusal lists the dirty paths (the first 20, then a count), shows the last DEPLOYED record, and prints the commands to discard them. The original error line is kept. The dry run, which the README runs first, shows the same listing and warns that --apply will refuse. DEPLOYED's by= now names the person sudo reports behind impersonate. Under /sw/admin/scripts/impersonate (sudo -u), `id -un` is always svcdeltallmhub, so by= could never say who deployed. It now reads "<SUDO_USER> via <account>" when SUDO_USER is set, and the account alone otherwise. It is a pointer, not an audit record. Refs whose own kit predates this change still record the account alone, since the deployed ref's kit writes DEPLOYED. README: try a branch with --ref, never by editing the checkout, plus what by= does and does not tell you. Tested by driving the real `deploy [--apply] --profile staging` in a sandbox (all roots redirected; --apply runs stopped at the first runtime step), in six cases: a dirty tree, 25 dirty paths, a clean tree via sudo, a clean tree without sudo, a dirty-tree dry run, and a clean-tree dry run. 25/25 checks pass. The same checks against the previous kit pass 12/25, failing only on the new behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HnSD7hPrebDeNgc4wTqoPd
This branch has not been deployed
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
deploy --applyrefuses a deployment checkout with uncommitted changes, and it should. But it said onlydeployment tree is dirty, so whoever it blocked had to ask around to learn what was in the tree and whether it was safe to discard. That happened on the shared staging stack: three files from an open PR branch had been copied into its checkout by hand two days earlier, and it took a Slack thread to establish that they matched the pushed branch.DEPLOYEDcouldn't help, because under/sw/admin/scripts/impersonateitsby=is alwayssvcdeltallmhub.What changes
DEPLOYEDrecord, and prints the commands to discard them. The original error line is unchanged.deploywithout--applyfirst, so the dry run now shows the same listing and says--applywill refuse it. It still changes nothing.DEPLOYEDpoints at the person.by=reads<SUDO_USER> via <account>when the kit runs under sudo (impersonate usessudo -u), and the account alone otherwise. It is a pointer, not an audit record, becauseSUDO_USERis inherited. Refs whose own kit predates this change still record the account alone, since the deployed ref's kit writesDEPLOYED.--ref, never by editing the checkout; to runmainand a PR together, push a branch that merges both. Plus whatby=does and does not tell you.The refusal now looks like this (sandbox paths shortened):
Testing
The real
./llmhub deploy [--apply] --profile stagingwas driven in a sandbox on a DeltaAI login node:LLMHUB_VM_HOSTset to the login node;origin;LLMHUB_UV_DIRunder/proc, so an--applyrun fails at the first runtime step, before anything is installed or downloaded.Six cases and 25 checks: a dirty tree, 25 dirty paths, a clean tree via sudo, a clean tree without sudo, a dirty-tree dry run, and a clean-tree dry run (which must not warn).
mainNot yet exercised on a VM: whether
SUDO_USERsurvives impersonate's login shell (bash -l). The first deploy'sby=will show it; if it doesn't,by=stays as it is today.Follow-ups (not in this PR)
statusstill says onlytree is DIRTYwith no paths, and it reportstree cleanwhen git cannot read the checkout (2>/dev/null | head -1). It could useshow_dirtytoo.svcdeltallmhub/paths, but for any other account the code uses/projects/bfmz/<user>/llmhub-stagingand/data/llmhub/staging-<user>.🤖 Generated with Claude Code
https://claude.ai/code/session_01HnSD7hPrebDeNgc4wTqoPd