Repository navigation
fix(setup): render language-aware scaffold .gitignore and codeql matrix - #1035
Merged
Merged
Conversation
Node consumers must get node_modules/, *.tsbuildinfo, coverage/, .nyc_output/ and never a blanket dist/ ignore (JS Actions commit dist/index.js); Python keeps its ignore set; a marker-less repo gets a language-neutral base only. Refs: #1024
The managed .gitignore shipped the stock Python github/gitignore template, which blanket-ignored dist/ (silently dropping a JS Action's committed dist/index.js) and carried no Node ignores, and — being overwritten on upgrade — no per-repo hand-fix survived. init-workspace.sh now detects the consumer language from marker files (pyproject.toml -> python, package.json -> node, Cargo.toml -> rust) and assembles the language-neutral base (assets/workspace/.gitignore) plus the matching fragment (assets/gitignore.d/<lang>.gitignore) on every (re)scaffold, so the correct ignore set is upgrade-persistent. Fragments live beside init-workspace.sh in the image, never under the template, so they never leak into the consumer tree. Refs: #1024
The scaffold codeql.yml matrix was hardcoded to ['python', 'actions'], which fails the python leg on a repo with no Python. Assert the matrix is rendered per detected language (python -> python, node -> javascript-typescript, rust -> omitted, always actions) and that the workflow documents the conflict with GitHub's default code-scanning setup. Refs: #1025
The managed .github/workflows/codeql.yml hardcoded the matrix to ['python', 'actions']; on a repo with no Python the python leg failed (no source code seen), and — being overwritten on upgrade — a per-repo fix did not survive. init-workspace.sh now rewrites the matrix from the same marker-file language detection as the .gitignore (#1024): python -> 'python', node -> 'javascript-typescript', rust omits its leg (no first-class CodeQL Rust analyzer); 'actions' is always analyzed. The scaffolded codeql.yml and an install-time note document that this advanced config conflicts with GitHub's default code-scanning setup, which must be disabled; the installer never flips the code-scanning API setting. Refs: #1025
3 tasks
This was referenced Jul 14, 2026
c-vigo
added a commit
that referenced
this pull request
Jul 14, 2026
…es (#1042) ## Summary Implements the node/typescript capability module per the design decision recorded on the issue (module = v1 shell contract; scaffold statics via #1024/#1025; release bundling via #1029). ### `node` capability module (v1 contract) - `modules = [ "node" ]` puts `nodejs` (bundles npm) in the dev shell — replaces the hand-wired `extraPackages = [ pkgs.nodejs ]` every TS-action consumer copied. - **Lands the per-module-options mechanism the ADR deferred** (this is "the first module that needs it"): a `modules` entry may be `{ name = "node"; version = 22; }` alongside plain strings — additive, no break for the string form. Modules are now uniformly `pkgs -> options -> contribution`; unknown option names, malformed entries, and unavailable Node majors all fail at eval time with clear messages. - **PATH nuance (flagged for review):** the toolchain SSoT (`nix/devtools.nix`) already ships `nodejs` for `@devcontainers/cli`, and the ADR orders devTools before module packages — so a pinned module node would be shadowed. When (and only when) an explicit `version` is given, the module prepends its node in `shellHook` (a v1-contract fragment, same pattern as `native`'s CC/CXX exports). Documented in the module and `docs/NIX.md`. - `nodejs_20` (the Actions runtime major the issue mentions) is EOL/insecure in the pinned nixpkgs — pinning it surfaces nixpkgs' own error unless the consumer opts into `permittedInsecurePackages`; the versioned test uses maintained LTS 22. - Zero-module invariant intact: `modules = [ ]` drvPath byte-identity and the parity suite pass untouched. `checks.<system>.module-node` is registry-generated. ### First-scaffold npm recipes Node-detected consumers (`package.json`, via #1024's `DETECTED_LANGUAGES`) get `justfile.project` seeded from `assets/justfile.d/node.justfile.project` at **first scaffold only** — `sync`=`npm ci`, `lint`/`format`/`test`/`test-cov`, `build` (tsc), `bundle` (ncc) — so the CI contract (`just sync`/`just test`) and the #1029 release bundle probe work out of the box. Guarded on `JUSTFILE_PROJECT_PREEXISTED`: an existing consumer-owned file is never touched. Full replacement, not append (appending would redeclare recipe names). ### Out of scope (per the recorded decision) eslint/prettier hooks (#883 seam), gitignore/codeql (landed via #1035), release bundle step (landed via #1033). TDD: two failing-test → implementation commit pairs + a docs commit. ## Test evidence - `uv run pytest tests/test_flake_modules.py` → 6 passed (node/npm resolve; `version = 22` pins 22.x; unknown option rejected) - `bats tests/bats/init-workspace.bats` → 174 ok / 0 failed (5 new seeding tests; re-run after merging dev) - Zero-module drvPath parity → passed; flake checks `module-node`, `deadnix`, `statix` build - `prek run --all-files` → green (re-verified independently before push) Closes #1027 Refs: #884, #1024, #1029
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Bundles the two "managed scaffold static is Python-hardcoded" bugs from the commit-action pilot — both are fixed by one shared language-detection mechanism, so they share a PR and a CI run.
Shared mechanism
init-workspace.shpopulates aDETECTED_LANGUAGESarray from consumer marker files (pyproject.toml→ python,package.json→ node,Cargo.toml→ rust) before the template copy, and renders the managed statics from it after the copy. Detection re-runs on every (re)scaffold, so the result is upgrade-persistent — the core failure both issues reported.#1024 — language-aware
.gitignoreassets/workspace/.gitignoreis now a language-neutral base; per-language fragments live inassets/gitignore.d/(image-level, beside the installer — never shipped into the consumer tree) and are appended at install time.node_modules/,*.tsbuildinfo,coverage/,.nyc_output/and no blanketdist/(JS Actions commitdist/index.js);dist/moves into the Python fragment..gitignore.projectcompanion because base+fragment re-assembly auto-tracks devkit ignore evolution across upgrades.#1025 — language-aware CodeQL matrix + default-setup conflict
language:matrix line per detected language (python →python, node →javascript-typescript, rust → omitted pending CodeQL support;actionsalways analyzed, so the matrix is never empty). The committed template stays['python', 'actions']— correct for the devkit itself and SSoT-synced from the root workflow.TDD: each fix lands as failing-test commit → implementation commit (7 new end-to-end bats tests).
Test evidence
bats tests/bats/init-workspace.bats→ 166 ok / 0 failed (3 new for [BUG] Scaffold .gitignore is Python-only: blanket dist/ breaks JS Action repos, Node ignores dropped, not upgrade-persistent #1024, 4 for [BUG] Scaffold codeql.yml: hardcoded python matrix + conflicts with GitHub default code-scanning setup #1025, no regressions)uv run pytest tests/test_transforms.py→ 6 passedprek run --all-files→ green (re-verified independently before push)Closes #1024
Closes #1025
Refs: #1027