Skip to content
This repository was archived by the owner on Mar 17, 2026. It is now read-only.

fix(cli): align platform naming with hosted platform convention#76

Merged
HomelessDinosaur merged 1 commit intomainfrom
platform-names
Sep 23, 2025
Merged

fix(cli): align platform naming with hosted platform convention#76
HomelessDinosaur merged 1 commit intomainfrom
platform-names

Conversation

@HomelessDinosaur
Copy link
Copy Markdown
Member

No description provided.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Sep 22, 2025

Walkthrough

This 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 <team>/<platform>@<version> and preserve the file:<path> alternative. The JSON Schema for Application targets was aligned with the new pattern. Two unit tests were added to validate hyphenated targets. No public API signatures or control flow logic were changed; only validation patterns and error text were modified.

Pre-merge checks

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning No pull request description was provided in the PR metadata, so there is no author-provided summary to relate to the changeset. That absence means the description check fails because it is empty rather than simply terse or generic. While the diffs themselves make the intent discoverable, the PR metadata lacks a description to guide reviewers. Please add a brief PR description summarizing what changed (regex/schema/error-message updates), why the change is needed (aligning with hosted platform naming), which components are affected, and any migration or compatibility notes; include related issue links if any to help reviewers assess risk quickly.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title concisely describes the primary change—aligning CLI platform naming with the hosted-platform convention—and scopes the change to the CLI. It accurately reflects the diff which tightens naming validation, updates related error messages, and adds tests for hyphenated targets. The phrasing is specific and clear for reviewers scanning history.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

GetLibrary expects 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 swallowed

On 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 naming

To 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 convention

Matches 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 appropriately

Message 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 solid

Asserts 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

📥 Commits

Reviewing files that changed from the base of the PR and between 37d1b7a and a7b3441.

📒 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 LGTM

Pattern 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 good

Covers common hyphen/digit cases; assertions are clear.

Comment thread cli/internal/platforms/repository.go Outdated
Comment thread engines/terraform/platform.go Outdated
@HomelessDinosaur HomelessDinosaur changed the title feat: align platform naming with hosted platform convention feat(cli): align platform naming with hosted platform convention Sep 22, 2025
Apply suggestions from code review

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@jyecusch jyecusch changed the title feat(cli): align platform naming with hosted platform convention fix(cli): align platform naming with hosted platform convention Sep 22, 2025
@HomelessDinosaur HomelessDinosaur merged commit 741ee45 into main Sep 23, 2025
12 checks passed
@HomelessDinosaur HomelessDinosaur deleted the platform-names branch September 23, 2025 01:46
@nitric-bot
Copy link
Copy Markdown

🎉 This PR is included in version 0.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants