Skip to content

fix(setup): render language-aware scaffold .gitignore and codeql matrix - #1035

Merged
c-vigo merged 5 commits into
devfrom
bugfix/1024-language-aware-scaffold-statics
Jul 14, 2026
Merged

c-vigo merged 5 commits into
devfrom
bugfix/1024-language-aware-scaffold-statics

Conversation

@c-vigo

@c-vigo c-vigo commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

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.sh populates a DETECTED_LANGUAGES array 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 .gitignore

  • assets/workspace/.gitignore is now a language-neutral base; per-language fragments live in assets/gitignore.d/ (image-level, beside the installer — never shipped into the consumer tree) and are appended at install time.
  • Node consumers get node_modules/, *.tsbuildinfo, coverage/, .nyc_output/ and no blanket dist/ (JS Actions commit dist/index.js); dist/ moves into the Python fragment.
  • Chosen over a preserved .gitignore.project companion because base+fragment re-assembly auto-tracks devkit ignore evolution across upgrades.

#1025 — language-aware CodeQL matrix + default-setup conflict

  • The installer rewrites the language: matrix line per detected language (python → python, node → javascript-typescript, rust → omitted pending CodeQL support; actions always 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.
  • The advanced-config vs GitHub default code-scanning setup conflict is documented in the workflow header (both copies) and printed as an install-time note. The installer never flips the repo's code-scanning API setting.

TDD: each fix lands as failing-test commit → implementation commit (7 new end-to-end bats tests).

Test evidence

Closes #1024
Closes #1025
Refs: #1027

c-vigo added 4 commits July 14, 2026 09:47
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
@c-vigo
c-vigo merged commit 50a5b9c into dev Jul 14, 2026
13 checks passed
@c-vigo
c-vigo deleted the bugfix/1024-language-aware-scaffold-statics branch July 14, 2026 08:14
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
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.

1 participant