fix(cli): align platform naming with hosted platform convention#76
fix(cli): align platform naming with hosted platform convention#76HomelessDinosaur merged 1 commit intomainfrom
Conversation
WalkthroughThis change tightens validation for platform identifiers across CLI and schema layers: regexes now require both team and platform to start with a lowercase letter and contain only lowercase letters, digits, or hyphens. Error messages were updated to reference Pre-merge checks❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
engines/terraform/platform.go (2)
72-76: Bug: passing value instead of key to GetLibrary
GetLibraryexpects the library key; this passes the value and will fail lookups.Apply this diff:
- for name, library := range p.Libraries { - libraries[name], _ = p.GetLibrary(library) + for name := range p.Libraries { + libraries[name], _ = p.GetLibrary(name) }
151-153: Read error is swallowedOn read failure, this returns an empty spec and nil error. Propagate the error.
Apply this diff:
- if err != nil { - return &PlatformSpec{}, nil - } + if err != nil { + return nil, fmt.Errorf("failed to read platform spec: %w", err) + }
🧹 Nitpick comments (4)
engines/terraform/platform.go (1)
57-59: Align library id pattern with stricter namingTo match the new convention, constrain team/platform segments while keeping version flexible.
Apply this diff:
- pattern := `^(?P<team>[^/]+)/(?P<library>[^@]+)@(?P<version>.+)$` + pattern := `^(?P<team>[a-z][a-z0-9-]*)/(?P<library>[a-z][a-z0-9-]*)@(?P<version>.+)$`cli/pkg/schema/schema.go (1)
16-16: Pattern update consistent with conventionMatches hyphenated segments and
file:alternative. Consider centralizing this pattern to avoid drift with errors.go and repository.go.cli/pkg/schema/errors.go (1)
138-138: Pretty-print mapping updated appropriatelyMessage matches the tightened pattern. Recommend sourcing the regex from a shared constant to prevent future mismatches.
cli/pkg/schema/schema_test.go (1)
110-134: Invalid hyphenated targets test is solidAsserts count and friendly error text; consider also checking the “Invalid target at index …” prefix for one case to lock formatting.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
cli/internal/platforms/repository.go(1 hunks)cli/pkg/schema/errors.go(1 hunks)cli/pkg/schema/schema.go(1 hunks)cli/pkg/schema/schema_test.go(1 hunks)engines/terraform/platform.go(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
cli/internal/platforms/repository.go (1)
cli/internal/version/version.go (1)
CommandName(13-13)
cli/pkg/schema/schema_test.go (2)
cli/pkg/schema/schema.go (1)
ApplicationFromYaml(98-112)cli/pkg/schema/errors.go (2)
GetSchemaValidationErrors(190-216)FormatValidationErrors(227-248)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build (windows-latest, amd64)
🔇 Additional comments (2)
cli/internal/platforms/repository.go (1)
22-22: Regex tightening LGTMPattern matches the new
<team>/<platform>@<revision>convention with hyphen/digit support.cli/pkg/schema/schema_test.go (1)
85-108: Valid hyphenated targets test looks goodCovers common hyphen/digit cases; assertions are clear.
Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
19cf7b0 to
e5cda4f
Compare
|
🎉 This PR is included in version 0.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
No description provided.