Repository navigation
feat: migrate feature tests to devcontainer features test CLI + copilot-instructions #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
C. Spencer Beggs (spencerbeggs)
merged 19 commits into
main
from
copilot/declare-devcontainer-features
May 1, 2026
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
180c951
fix: containerUser/remoteUser support across all features
Copilot 9dc7218
docs: document executable-bit convention; revert accidental 100755 mo…
Copilot 12d6acd
docs: document _REMOTE_USER/_CONTAINER_USER spec in feature-anatomy a…
Copilot c50c2f7
feat: adopt devcontainer features test CLI pattern for all features
Copilot e592771
chore: add .github/copilot-instructions.md with commit conventions
Copilot 3be3543
fix: address review feedback — zig env var, homebrew user guard, scen…
Copilot 58c0ca8
fix(homebrew): send [INFO] fallback message to stdout not stderr
Copilot f116aa3
feat: extract test-result parsing to scripts, JSON-based failure dete…
Copilot bc764c4
fix: biome test
spencerbeggs 60a4bdf
fix: update src/biome/install.sh
spencerbeggs c0097a5
fix: update .github/workflows/publish.yml
spencerbeggs cd9a67b
fix: update .github/workflows/test.yml
spencerbeggs bbd702c
fix: update .github/workflows/test-feature.yml
spencerbeggs 5d35166
fix: set +e in test-feature.yml; treat missing TEST REPORT as failure
Copilot c1b8094
fix: merge remote fix into local; keep parse-test-results.js reportFo…
Copilot 9cf8e07
fix(claude-code): switch to native curl installer; fix homebrew autog…
Copilot 4343930
fix(claude-code): use $HOME instead of hardcoded /root in path fallback
Copilot d08f8d3
chore: refactor repo structure
spencerbeggs c05a5e7
fix(claude-code): run native installer as _REMOTE_USER via su
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # Copilot Instructions | ||
|
|
||
| ## Commit Conventions | ||
|
|
||
| All commits in this repository are validated by `@savvy-web/commitlint` (Silk preset). | ||
|
|
||
| ### Format | ||
|
|
||
| ```text | ||
| type(scope): subject | ||
|
|
||
| Optional body — plain prose only, max 300 chars per line. | ||
|
|
||
| Signed-off-by: Name <email@example.com> | ||
| ``` | ||
|
|
||
| ### Allowed Types | ||
|
|
||
| | Type | When to use | | ||
| | :--- | :---------- | | ||
| | `feat` | New feature or capability | | ||
| | `fix` | Bug fix | | ||
| | `docs` | Documentation-only change | | ||
| | `style` | Formatting, whitespace — no logic change | | ||
| | `refactor` | Code restructuring without behaviour change | | ||
| | `perf` | Performance improvement | | ||
| | `test` | Adding or updating tests | | ||
| | `build` | Build system or dependency changes | | ||
| | `ci` | CI/CD workflow changes | | ||
| | `chore` | Maintenance tasks (version bumps, configs) | | ||
| | `revert` | Reverts a previous commit | | ||
| | `release` | Release preparation commit | | ||
| | `ai` | AI-generated or AI-assisted change | | ||
|
|
||
| ### Rules | ||
|
|
||
| - **Subject line**: imperative mood, no trailing period, max ~72 chars | ||
| - **Body**: optional; plain prose only — no Markdown headers (`##`), no fenced | ||
| code blocks (` ``` `), no bare URLs, no numbered lists | ||
| - **Body line length**: max 300 characters per line | ||
| - **DCO sign-off**: required on every commit — a `Signed-off-by:` trailer must | ||
| be present because this repository has a `DCO` file and enforces the check in | ||
| CI via `dco.yml` | ||
|
|
||
| ### DCO Sign-Off | ||
|
|
||
| The Developer Certificate of Origin (DCO) certifies that you have the right to | ||
| submit your contribution. Add the trailer automatically with: | ||
|
|
||
| ```bash | ||
| git commit -s -m "feat(biome): bump default version to 2.5.0" | ||
| ``` | ||
|
|
||
| Or configure git to add it by default: | ||
|
|
||
| ```bash | ||
| git config --global trailer.sign.key "Signed-off-by" | ||
| git config --global trailer.sign.ifmissing add | ||
| git config --global trailer.sign.ifexists doNothing | ||
| git config --global trailer.sign.command 'echo "$(git config user.name) <$(git config user.email)>"' | ||
| ``` | ||
|
|
||
| ### Examples | ||
|
|
||
| ```text | ||
| feat(biome): bump default version to 2.5.0 | ||
|
|
||
| Signed-off-by: C. Spencer Beggs <spencer@savvyweb.systems> | ||
| ``` | ||
|
|
||
| ```text | ||
| fix(package-manager): handle missing packageManager field in package.json | ||
|
|
||
| When no packageManager field is present and the option is set to 'auto', | ||
| the install script now exits cleanly instead of forwarding an empty spec | ||
| to corepack. | ||
|
|
||
| Signed-off-by: C. Spencer Beggs <spencer@savvyweb.systems> | ||
| ``` | ||
|
|
||
| ```text | ||
| ci: switch feature tests to devcontainer features test CLI | ||
|
|
||
| Signed-off-by: C. Spencer Beggs <spencer@savvyweb.systems> | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| #!/usr/bin/env node | ||
| // Outputs a JSON matrix of { id, skipAutogenerated } entries for every | ||
| // feature that has both a devcontainer-feature.json and a test/test.sh file. | ||
| // Used by the "Discover features" step in test.yml. | ||
| import { existsSync, readFileSync, readdirSync } from "node:fs"; | ||
| import { join, resolve } from "node:path"; | ||
|
|
||
| const srcRoot = resolve("src"); | ||
| const testRoot = resolve("test"); | ||
|
|
||
| if (!existsSync(srcRoot)) { | ||
| process.stdout.write("[]"); | ||
| process.exit(0); | ||
| } | ||
|
|
||
| const entries = readdirSync(srcRoot) | ||
| .filter((f) => { | ||
| const featureJson = join(srcRoot, f, "devcontainer-feature.json"); | ||
| const testSh = join(testRoot, f, "test.sh"); | ||
| return existsSync(featureJson) && existsSync(testSh); | ||
| }) | ||
| .map((id) => { | ||
| const featureJson = JSON.parse(readFileSync(join(srcRoot, id, "devcontainer-feature.json"), "utf8")); | ||
| const installsAfter = featureJson.installsAfter || []; | ||
| // Skip auto-generated test for features that depend on another local | ||
| // savvy-web feature (e.g. package-manager requires node). | ||
| const skipAutogenerated = installsAfter.some((dep) => dep.includes("ghcr.io/savvy-web/")); | ||
| return { id, skipAutogenerated }; | ||
| }); | ||
|
|
||
| process.stdout.write(JSON.stringify(entries)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #!/usr/bin/env node | ||
| // Parses the TEST REPORT section emitted by `devcontainer features test` and | ||
| // writes a structured JSON results file. | ||
| // | ||
| // Usage: | ||
| // node parse-test-results.js [logPath] [outPath] | ||
| // | ||
| // Defaults: | ||
| // logPath /tmp/test.log | ||
| // outPath /tmp/test-results.json | ||
| // | ||
| // Output shape: | ||
| // { passed: string[], failed: string[], total: number, allPassed: boolean } | ||
| import { readFileSync, writeFileSync } from "node:fs"; | ||
|
|
||
| const logPath = process.argv[2] ?? "/tmp/test.log"; | ||
| const outPath = process.argv[3] ?? "/tmp/test-results.json"; | ||
|
|
||
| let log = ""; | ||
| try { | ||
| log = readFileSync(logPath, "utf8"); | ||
| } catch { | ||
| // log file not yet written; treat as empty | ||
| } | ||
|
|
||
| const idx = log.indexOf("TEST REPORT"); | ||
| // If the CLI crashed or changed output format, treat as a parse failure | ||
| // rather than silently succeeding with an empty result set. | ||
| const reportFound = idx >= 0; | ||
| const section = reportFound ? log.slice(idx) : ""; | ||
| const passed = [...section.matchAll(/Passed:\s+'([^']+)'/g)].map((m) => m[1]); | ||
| const failed = [...section.matchAll(/Failed:\s+'([^']+)'/g)].map((m) => m[1]); | ||
|
|
||
| const result = { | ||
| passed, | ||
| failed, | ||
| total: passed.length + failed.length, | ||
| allPassed: reportFound && failed.length === 0, | ||
| }; | ||
|
|
||
| writeFileSync(outPath, JSON.stringify(result, null, 2)); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the log doesn't contain a "TEST REPORT" section (CLI crash or output format change),
passed/failedwill be empty and the computed result effectively becomes a silent success. Consider explicitly detecting the missing report and settingallPassed=false(and/or recording a parse error) so callers don't treat "no parsed results" as passing.