Fix field mode derivation and metadata refresh handling - #9
Merged
Merged
Conversation
…and stale refresh - Editing a field (and restoring a draft) kept the previous mode, so a typed $RG rendered as '$RG' and a var field edited to "my group" was emitted unquoted. The mode is now derived from the value. - Fields holding only their metadata default were skipped by the draft, bindings, env and Azure-defaults stages, inverting spec §8.5. - Stale cache entries (and the embedded baseline) were never refreshed: Result.Refresh had no caller. It now runs in the background. - undefined-var and escape-error no longer block Done for disabled fields. - Ctrl+G insert spliced by byte offset using a rune cursor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dza8X5c3XGHUjejpqGLR8q
…itch names az wraps help at hyphens, so 'comma-separated' became 'comma- separated' and 'Values from: az account list-locations' became an unrunnable 'list- locations'. aks create --enable-addons was misread as a switch. --identity, --assign-identity and --service-principal take values on most commands (acr/aks/appgw/postgres/...); login's switch forms are already recognised from their help text. Goldens and baseline regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dza8X5c3XGHUjejpqGLR8q
Unquoted they trigger comments, tilde/brace expansion or zsh globbing and '=cmd' expansion, so az would not receive the value as typed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dza8X5c3XGHUjejpqGLR8q
The check ran on the separator-folded name, so USERNAME, HOSTNAME and LOGNAME all bound to --name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dza8X5c3XGHUjejpqGLR8q
With the widget's usual end-of-line cursor, 'az a && az b' opened the form for the first command instead of the one being typed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dza8X5c3XGHUjejpqGLR8q
…dirs --purge was documented but only PURGE_STATE=1 worked, and the purge path ignored XDG_STATE_HOME and macOS locations used by the binary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dza8X5c3XGHUjejpqGLR8q
…mmand Flags the metadata does not know (outdated cache, extensions) were silently dropped on Done; they are now re-emitted exactly as typed. A value-taking flag typed with no value (vm create --assign-identity) is emitted bare while its field stays empty instead of disappearing. escape-error is now a warning: literal values are always single-quoted, so an unbalanced quote reaches az intact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dza8X5c3XGHUjejpqGLR8q
- Enter on a field with fetched values opens a picker (first row: type a value manually); before, they were only counted as "(N options)". - Only the first command of a multi-command hint is run, punctuation and placeholders are handled, and commands that need context (vm list-sizes, aks get-versions/get-upgrades) get the form's --location / --resource-group / --name; edits to those drop stale choices. - Output parsing is deterministic and understands version keys and plain string arrays; error text is truncated on rune boundaries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dza8X5c3XGHUjejpqGLR8q
deb/rpm ship az as a launcher in /usr/bin, so the install root resolved to /usr, whose mtime never changes on upgrade; pip venv roots behave the same. Follow the launcher to the Python it runs and use the newest site-packages mtime, which changes when azure_cli-*.dist-info is renamed. Also recognise /usr/lib64/az. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dza8X5c3XGHUjejpqGLR8q
zsh CURSOR and bash 5 READLINE_POINT count characters while the tokenizer uses bytes, so non-ASCII text before the cursor picked the wrong command. The widgets now pass the text left of the cursor (--cursor-prefix). An unclosed $(az … or `az … no longer gains a closing delimiter when the line is rebuilt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dza8X5c3XGHUjejpqGLR8q
- update: SemVer precedence, so 1.0.0-rc1 users are told about 1.0.0. - debug: Close no longer races with background Event calls. - lock: fall back to a private per-user dir instead of shared /tmp, refuse symlinks, and re-check the locked inode to close the flock/unlink race; fix the outdated package comment. - diagnostics: stop rewriting parse-health.log on every append once it holds 200 entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dza8X5c3XGHUjejpqGLR8q
The e2e tests ran azform against the shared default state dir. The bash test cancels 'az group create', saving a draft that carries env matches from the runner (--name $RUNNER_NAME); the zsh round-trip test then restored it and appended its input to it. With drafts now restored in var mode, '$RUNNER_NAMEwesteurope' is an undefined var and Done is blocked, so azform never exited. Each test now uses a private state dir. The zsh tests also called cmd.Wait twice, which the race detector flagged on the failure path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dza8X5c3XGHUjejpqGLR8q
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.
Summary
This PR fixes two related issues in the form UI: field mode is now correctly derived from typed values rather than persisting previous modes, and stale metadata entries now trigger background refresh to keep the cache current.
Key Changes
Field Mode Derivation (typed_value_test.go)
$RGinto a literal field correctly switches it to var mode$(cat name.txt)are recognized as var modeMetadata Refresh Handling (refresh_test.go, model.go)
refreshcallback toMetadataLoadedMsgfor stale cache entriesrefreshMetadata()metadataRefreshedMsgtype reports completion of background refreshPre-fill Logic (prefill.go)
Source == FieldSourceNoneto newfillable()functionValidation and Rendering
needsQuoting()to handle shell metacharacters:#,~,{,},^$RGno longer unnecessarily quoted)Metadata Parsing Improvements
takes_valueflags for several parameters (e.g.,--enable-local-user,--accept-system-assigned-identities)Environment Variable Matching (vars/match.go)
USERNAMEno longer matches--name)Installation Script (install.sh)
state_dir()andcache_dir()functions respecting XDG standards and macOS conventions--purgeremoves both state and cache directoriesNotable Implementation Details
fillable()helper function encapsulates the logic for determining which fields can be pre-filledhttps://claude.ai/code/session_01Dza8X5c3XGHUjejpqGLR8q