Skip to content

feat(choudoufu): attribute drift from the plan, opt-in on refresh — a second mark on a bound card, the attributes in the diff pane (#404) - #406

Merged
lex00 merged 1 commit into
mainfrom
feat/choudoufu-drift-404
Sep 10, 2026
Merged

feat(choudoufu): attribute drift from the plan, opt-in on refresh — a second mark on a bound card, the attributes in the diff pane (#404)#406
lex00 merged 1 commit into
mainfrom
feat/choudoufu-drift-404

Conversation

@lex00

@lex00 lex00 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Closes #404. Stacked on #405 (the behaviour overlay), which is stacked on #395 and #392.

A bound choudoufu card stayed green while choudoufu plan showed an attribute change, because the overlay is composed from live-ls and live-plan, which answer ownership and never read a value. This adds the attribute half, opt-in.

What changed

  • Source. choudoufu plan -json on 0.16.0 is choudoufu's own ownership document, not OpenTofu's change stream, and carries no attribute values — measured, not assumed. So the read is plan -input=false -out=<tmp> then show -json <tmp> (format 1.2, resource_changes[].change.{actions,before,after}), the plan file under a mkdtemp in the OS temp dir and removed in a finally, never inside the served member. Argv pinned in src/choudoufu-plan.ts.
  • Opt-in. ?plan=1 on /api/overlay and /api/diff, sent by a second palette row, "Re-check live with plan (attribute drift)". Not the existing refresh: plan is one provider read per resource (301 on terralith-4), and POST /api/refresh is a primary-only re-observe that never composes the estate, so it is both the cheap button and the wrong request. Cached under the member's source stamp, so a reload after a refresh does not re-plan. Never on the initial read.
  • Paint. Ownership stays the card's colour. A bound resource with a non-empty change set gets a dashed mark and a ~ 2 attributes glyph; the names are in the tooltip and the inspect pane, where diff.changes renders before → after through the existing pairCell path with one new label word, planned. Sensitive values read (sensitive), unknowns (known after apply). The legend and statusbar say n drifted only when the plan was read; meta.drift is { read: false } or { read: true, drifted: n } so the SPA can tell "not looked" from "none". A planned create on an unowned resource is not drift.
  • Fixture. Three plan documents recorded against the iam-ecr cohort on floci: clean, drift (a tags change on the role with both markers identical on each side, which is exactly why the ownership half never noticed, and image_tag_mutability IMMUTABLE → MUTABLE on the repository), and a create.
  • Docs. AGENTS.md, the README's choudoufu paragraph and the demo's description now say a green card is ownership, not "nothing changed", and where the attribute read is.

Verified live

On the iam-ecr cohort against floci: green with no drift clause; one out-of-band change; ?plan=1 marks the card while it stays bound and green, /api/diff names the attributes with before → after, the legend reads 2 drifted; a reload without the flag serves the cache; the attribute restored, the drift is gone. Both gates green; no scratch container left.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DoXg2GDWwXJRPQo76t9Nrq

@lex00
lex00 force-pushed the feat/behaviour-397 branch from 38cf2d7 to 437ab7b Compare September 10, 2026 21:41
@lex00
lex00 changed the base branch from feat/behaviour-397 to main September 10, 2026 21:43
… second mark on a bound card, the attributes in the diff pane (#404)

One commit on main. The plan read is `plan -out` then `show -json` (choudoufu 0.16's `plan -json` is its ownership document and carries no values), opt-in through a second palette row and cached under the member's source stamp; ownership stays the card's colour, a drifted bound card gets a dashed mark and a count glyph, the inspect pane shows before → after with sensitive values redacted, the legend counts drifted only when the plan was read. Three plan documents recorded against the iam-ecr cohort. The docs say a green card is ownership, not "nothing changed". PR #406 has the account.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DoXg2GDWwXJRPQo76t9Nrq
@lex00
lex00 force-pushed the feat/choudoufu-drift-404 branch from 6d1b150 to 5f2776a Compare September 10, 2026 21:43
@lex00
lex00 merged commit 0bd7436 into main Sep 10, 2026
1 check passed
@lex00 lex00 mentioned this pull request Sep 10, 2026
@lex00
lex00 deleted the feat/choudoufu-drift-404 branch September 10, 2026 21:49
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.

choudoufu member: attribute drift a plan would revert is invisible in the overlay, the card stays green

1 participant