Skip to content

feat: accept plain yaml/yml/json profiles in cloned repos and gists#74

Merged
8bitAlex merged 3 commits into
mainfrom
feat/profile-fallback-plain-yaml
May 10, 2026
Merged

feat: accept plain yaml/yml/json profiles in cloned repos and gists#74
8bitAlex merged 3 commits into
mainfrom
feat/profile-fallback-plain-yaml

Conversation

@8bitAlex
Copy link
Copy Markdown
Owner

Summary

Extends raid profile add <url> so single-file gists (and scratch repos) whose profile file isn't named with the *.raid.yaml convention work without renaming.

Before: cloning a gist containing profile.yaml (or myprofile.yml, config.json) succeeded, but findProfileFilesInDir matched nothing and the user got No profile files found in repository.

After: when none of the primary patterns (profile.raid.yaml, *.raid.yaml/*.raid.yml, profile.json) match, raid falls back to any plain .yaml / .yml / .json at the repo root. processProfileFiles runs the same schema validation on each candidate, so non-profile YAML is still rejected with Skipping … invalid profile rather than producing incorrect behavior.

Files

  • src/cmd/profile/fetch.go — fallback branch in findProfileFilesInDir.
  • src/cmd/profile/fetch_test.go — tests covering: single plain .yaml falls through, plain .yaml is NOT picked up when a *.raid.yaml is present (priority preserved), multiple plain files all selected, plain .json fallback. Existing noRaidYAML_noJSON test renamed/repurposed to assert the new behavior.
  • site/docs/usage/profile.mdx — example using a gist URL.
  • site/docs/whats-new.mdx0.10.1 entry.
  • src/resources/app.properties — version 0.10.0-beta → 0.10.1-beta (patch bump per CLAUDE.md, small enhancement).

Test plan

  • go test ./... — all packages green.
  • cmd/profile coverage holds at 89.0%.
  • cd site && npm run build — no broken links.

🤖 Generated with Claude Code

`raid profile add <git-url>` previously only picked up profile files
matching the *.raid.yaml convention (or profile.json). Single-file
gists and scratch repos that just contain `profile.yaml` or
`myprofile.yml` would clone successfully but then fail with
"No profile files found in repository".

When the primary patterns (profile.raid.yaml, *.raid.yaml/*.raid.yml,
profile.json) match nothing, fall back to any plain .yaml/.yml/.json
at the repo root. processProfileFiles validates each candidate against
the profile schema, so non-profile YAML in a repo root is still
rejected with a clear "Skipping … invalid profile" message rather
than misbehaving.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 10, 2026 18:46
@codecov
Copy link
Copy Markdown

codecov Bot commented May 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.88%. Comparing base (5f37965) to head (e354627).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #74      +/-   ##
==========================================
+ Coverage   90.71%   90.88%   +0.17%     
==========================================
  Files          33       33              
  Lines        2788     2798      +10     
==========================================
+ Hits         2529     2543      +14     
+ Misses        169      167       -2     
+ Partials       90       88       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends raid profile add <url> to support cloned repositories and single-file gists whose profile files don’t follow the *.raid.yaml / profile.json naming conventions, by adding a fallback that considers plain .yaml / .yml / .json files at the repo root when no primary matches are found.

Changes:

  • Add a fallback in findProfileFilesInDir to consider any root .yaml / .yml / .json when no *.raid.yaml / profile.json files are found.
  • Add tests covering the new fallback behavior and priority preservation when *.raid.yaml exists.
  • Update docs/release notes and bump the beta patch version.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/resources/app.properties Bumps app version to 0.10.1-beta.
src/cmd/profile/fetch.go Adds fallback profile-file discovery for plain YAML/YML/JSON in cloned repos/gists.
src/cmd/profile/fetch_test.go Adds coverage for the fallback discovery and precedence rules.
site/docs/usage/profile.mdx Documents gist/scratch-repo behavior and adds examples.
site/docs/whats-new.mdx Adds a 0.10.1 release note entry for the fallback behavior.

Comment thread src/cmd/profile/fetch.go
Comment on lines +185 to +193
for _, e := range entries {
if e.IsDir() {
continue
}
ext := strings.ToLower(filepath.Ext(e.Name()))
if ext == ".yaml" || ext == ".yml" || ext == ".json" {
add(e.Name())
}
}
Comment on lines +146 to +155
func TestFindProfileFilesInDir_plainYAMLFallback(t *testing.T) {
dir := t.TempDir()
// A plain .yaml file should not be picked up.
// Single-file gist scenario: a plain .yaml at the root, no *.raid.yaml.
// Should be picked up as a fallback.
writeRaidYAML(t, dir, "plain.yaml", "p")
got := findProfileFilesInDir(dir)
if len(got) != 0 {
t.Errorf("findProfileFilesInDir plain yaml: got %v, want none", got)
if len(got) != 1 || !strings.HasSuffix(got[0], "plain.yaml") {
t.Errorf("findProfileFilesInDir plain yaml fallback: got %v", got)
}
}
8bitAlex and others added 2 commits May 10, 2026 12:15
Copilot review feedback on #74: the new plain-yaml fallback in
findProfileFilesInDir can now match arbitrary root yamls (e.g.
docker-compose.yaml from a gist or scratch repo). Those candidates fail
schema validation in processProfileFiles and the function previously
returned exit 0 with "No new profiles found" — the same code path used
when "all profiles already exist", which masks a real failure and means
`raid profile add <url>` would falsely report success.

Differentiate the two cases:
- queued empty AND existingNames non-empty → "all already exist", exit 0
  (unchanged for the ergonomic re-run case).
- queued empty AND existingNames empty → "No valid profiles found",
  exit 1.

Also adds a regression test exercising exactly the gist-style scenario
flagged in the review: a cloned repo containing only docker-compose.yaml,
which now correctly exits 1.

Existing tests that assumed schema-invalid input was a soft success
(httpURL_invalidProfile, httpURL_unmarshalError, invalidProfileName)
updated to assert the new — and more correct — exit-1 behavior.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The plain-yaml fallback in findProfileFilesInDir skips subdirectories
(only files are profile candidates), but no existing test exercised
that branch — the codecov/patch check was flagging it as uncovered.
Real-world example: a scratch repo with docs/ and assets/ alongside a
profile.yaml at the root.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@8bitAlex 8bitAlex enabled auto-merge (squash) May 10, 2026 19:19
@8bitAlex 8bitAlex merged commit 84e1eaa into main May 10, 2026
13 checks passed
@8bitAlex 8bitAlex deleted the feat/profile-fallback-plain-yaml branch May 10, 2026 19:19
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.

2 participants