Skip to content

fix(cli): identity warnings and remote plugin validation (D-1116, D-1151) - #990

Open
acamarata wants to merge 7 commits into
mainfrom
dw9-cli-3
Open

acamarata wants to merge 7 commits into
mainfrom
dw9-cli-3

Conversation

@acamarata

Copy link
Copy Markdown
Collaborator

Suppress false moved-to-itself warnings and preserve plugin validation when a remote flag value looks like --plugin.

Verified all six rows against fresh origin/main 68dc16a04d27250c2718be3674fb62c439c7ca83 before changes.

Row Result
D-0512 BLOCKED: core still accepts --token in runner_provision.go:51. Resolution explicitly requires coordinated plugin implementation/help/parity changes in the plugins repo, outside this cli-only task. No partial deprecation applied.
D-1116 FIXED: suppress identity rewrite notes after longest-prefix selection; ci/functions remain unchanged while ci eval still rewrites and warns. Regression covers bare commands, arguments and root flags.
D-0445 BLOCKED: still present in root.go:163-177 and config_explain_args.go:138-155. Debt address_when assigns it to the next P7-SURF config ticket; planning owns explain under P7-SURF-06 (plan/p7/epics/SURF/tickets.yaml:1473). P7 work is excluded by this task.
D-0804 BLOCKED: envApplier.Apply still writes all previous values via envLineWrite, including absent keys represented as empty strings. Debt related explicitly names P7-ADOPT-22, excluded by this task.
D-0435 BLOCKED: remote/detect migrate status, zero retries, JWT write ordering and lint envelope gaps remain. Debt assigns follow-up to SURF; planning/reviews identify P7-SURF-11 and P7-SURF-14. P7 work is excluded by this task.
D-1151 FIXED: validate before deduplication, skip required flag values using Cobra flag metadata, handle inline plugin flags and insert forwarding before positional delimiters. Regression proves invalid plugin names cause zero SSH calls even with migration-dir equal to --plugin.

Only cli was edited. No Docker, production access, releases, version changes, or hq edits.

Validation uses Go 1.26.10 from go.mod (the local instruction file still names 1.26.6; that version correctly refuses this module).

  • Before-fix check: go test -mod=vendor -overlay <baseline-overlay.json> ./cmd/commands -run 'TestCanonEngineArgvIdentityBreakouts|TestWithRemotePluginFlag|TestRemoteUp_PluginLikeDirectoryStillValidatesPlugin' -count=1: FAIL as expected against origin/main production files with the new tests. Both bugs reproduced, including local validation bypass.
  • go test -mod=vendor ./cmd/commands -run 'TestCanon|TestRemoteUp|TestRemoteStatus_Plugin|TestWithRemotePluginFlag' -count=1: PASS.
  • go vet -mod=vendor ./cmd/commands: PASS.
  • bash scripts/ci/gofmt-check.sh and git diff --check: PASS.
  • go test -mod=vendor -short -timeout=240s ./cmd/commands: PASS (216.022s).
  • go build -mod=vendor -o <scratch>/nself ./cmd/nself: PASS.
  • GOFLAGS=-mod=vendor golangci-lint run --timeout=5m ./cmd/commands/...: PASS, zero issues.

No hook exclusions were needed. Scratch artifacts are removed after the PR is created.

@acamarata

Copy link
Copy Markdown
Collaborator Author

Rebased onto origin/main and split cmd/commands/canon_engine_argv.go (302 → 188 + 126 lines) into canon_engine_argv_parse.go to satisfy the 300-line file-budget ratchet; TestFileSizeBudgetNotExceeded now passes. Pushed cbc025b to dw9-cli-3.

@acamarata

Copy link
Copy Markdown
Collaborator Author

Extracted boolValue into canon_bool_value.go to bring canon_engine_argv.go from 302 → 295 lines, satisfying the 300-line file-budget ratchet that was failing in nself-ci. Build and ratchet tests pass locally.

@acamarata

Copy link
Copy Markdown
Collaborator Author

Fixed gofmt alignment in cmd/commands/canon_bool_value.go (String/Type now aligned with Set). Verified: scripts/ci/gofmt-check.sh failed before the fix and passes after. Pushed as 9036f2b.

@acamarata

Copy link
Copy Markdown
Collaborator Author

Fixed package-size ratchet failure: moved NoopBoolValue to internal/cmdregistry and inlined plugin name validation at call sites, deleting canon_bool_value.go and plugin_flag.go from cmd/commands. Rebased onto origin/main; TestPackageSizeBudget now passes.

@acamarata

Copy link
Copy Markdown
Collaborator Author

Fixed the red CI: four files were not gofmt-clean (cmd/commands/canon_engine_argv.go, db_hasura.go, db_migrate.go, internal/plugin/name_validate.go). That one cause failed gofmt, golangci-lint, TestGofmtClean in every Vet/Build/Test matrix leg, and the dependent coverage and nself-ci gates. Reproduced before the fix with gofmt -l (4 files) and scripts/ci/gofmt-check.sh (exit 1). After the fix both are clean, and internal/repoqa, internal/plugin, internal/cmdregistry and the PR's cmd/commands tests (canon, remote, size budgets) pass. Rebased onto origin/main (no conflicts) and pushed 0856cce. Not run locally: Docker tests, the full golangci-lint run (the local binary is older than the Go toolchain); CI will confirm.

@acamarata

Copy link
Copy Markdown
Collaborator Author

Review fixes pushed (4a011c3): db_remote_plugin.go header now references plugin.ValidateName and name_validate.go; dropped the redundant name != "" guard (already returned early on empty). db_migrate.go and db_hasura.go have no such guard, so unchanged. gofmt, vet and cmd/commands Plugin/Remote tests pass. Comment and dead-branch cleanup only, so there is no behaviour change for a fail-before/pass-after test.

@acamarata

Copy link
Copy Markdown
Collaborator Author

Review items 1 and 2 are already fixed at PR head 4a011c3. The db_remote_plugin.go header no longer mentions validatePluginFlag or plugin_flag.go, and the redundant name != "" guard is gone. The same guard no longer appears in db_migrate.go or db_hasura.go. go build ./cmd/..., go vet ./cmd/commands and the plugin tests (338 passed) are green. No further change needed.

This branch has not been deployed

No deployments
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