Skip to content

fix(cli): an unknown --services value is warned about and skipped instead of rejected #2006

Description

@cristim

Summary

parseServices maps each --services name through a lookup table and, on a miss, logs one warning to stderr and drops the name. The run then proceeds with the remaining services. Only a run where every name is unrecognised reaches the "No valid services specified" fatal. External input is not parsed into the enum at the boundary with an error on unknown, which is the project's standing rule.

Location

  • cmd/main.go:219 at 3c0f8ac
  • cmd/multi_service.go:94-96 (the only guard, reached when the result is empty)

Failure scenario

cudly --services rds,elasticahe --purchase (typo). ElastiCache is dropped with one log line amid the wizard's decorated stdout, and the run purchases for RDS alone. The operator believes both services were covered.

Evidence

		if service, ok := serviceMap[key]; ok {
			add(service)
		} else {
			log.Printf("Warning: Unknown service '%s', skipping", name)
		}

Suggested fix

Return an error from parseServices naming the unrecognised value and the valid set, and call it from validateFlags so the run never starts.


Found by the 2026-09-02 codebase audit, finding A10-012, reported by one reviewer and independently confirmed by a second. Full report: docs/audits/codebase-audit-2026-09-02.md.

Activity

  1. cristim commented on Oct 7, 2026

    @cristim
    MemberAuthor

    claimed by cc-cli-w2

  2. cristim commented on Oct 8, 2026

    @cristim
    MemberAuthor

    Merged in PR #2146 as d46dfcc1905611fc773580240e6fc75ced396341 on 2026-10-08.

    Post-merge verification: the squash commit contains the independently reviewed patch byte for byte. A fresh Go 1.26.6 build of that exact commit passed. Actual macOS CLI runs with isolated AWS configuration rejected --services=rds,elasticahe, an all-unknown selection, --services=, and an empty CSV element before Processing services, with no audit files. The mixed typo also failed alongside --all-services and --input-csv. Omitted services and valid RDS,SP,elasticsearch controls reached the deliberate nonexistent-profile error and created only zero-byte audit files. No cloud calls or purchases were made.

    The merged-head pre-commit run passed; build/test CI remains in progress and is assigned to the existing coordinator. The original exact-head CI, full race suite, independent reviews and hooks passed before merge. The current owner override accepts independent review and realistic local startup evidence; the prior exact-model/account gates are superseded. CR is optional after that evidence and independent review, with no new CR trigger here.

    This verifies the fix described in the now-closed issue. All retained files, branches and worktrees were preserved. No additional issue was identified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions