Skip to content

fix(workspace): render codeql push paths per detected language - #1147

Merged
c-vigo merged 3 commits into
devfrom
bugfix/1142-codeql-push-paths
Jul 16, 2026
Merged

c-vigo merged 3 commits into
devfrom
bugfix/1142-codeql-push-paths

Conversation

@c-vigo

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

Copy link
Copy Markdown
Contributor

Description

render_codeql_matrix() (assets/init-workspace.sh) rewrites the CodeQL
language: matrix per detected language (#1025) but left the push-to-main
trigger's paths: filter hardcoded to **.py. On a Node consumer, a push
touching only TS/JS therefore never fired the post-merge CodeQL scan — only the
unfiltered PR trigger caught it. And because codeql.yml is a managed file,
consumer hand-fixes (e.g. commit-action's **.ts patch, vig-os/commit-action#67)
were silently reverted on every devkit upgrade.

Type of Change

  • fix -- Bug fix

Changes Made

  • Extend render_codeql_matrix() to build the push paths: list from the same
    language detection it already uses for the matrix:
    • python → '**.py'
    • node → '**.ts', '**.js', '**.mjs', '**.cjs'
    • rust → no source globs (CodeQL ships no Rust analyzer)
    • the '.github/workflows/**' catch-all is always kept
    • marker-less repos get a workflows-only filter
  • Rewrite the paths: block with awk (the item count varies per language, so
    a single sed line-replace can't do it); the language matrix render is
    unchanged.
  • Regression bats tests for node / python / rust / marker-less consumers.

Changelog Entry

Fixed

  • Render CodeQL push paths: filter per detected language (#1142)
    • full entry in CHANGELOG.md under ## Unreleased.

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Manual Testing Details

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective
  • New and existing unit tests pass locally with my changes

Additional Notes

Found during the sync-issues-action deploy recon — affects every JS-action
consumer (commit-action today, sync-issues-action next). With this merged,
deploys no longer need to re-patch codeql.yml by hand after each scaffold sync.

Closes #1142

Refs: #1142

@c-vigo
c-vigo merged commit 0bb3afb into dev Jul 16, 2026
13 checks passed
@c-vigo
c-vigo deleted the bugfix/1142-codeql-push-paths branch July 16, 2026 11:10
c-vigo added a commit that referenced this pull request Jul 16, 2026
## Description

The scaffolded `release.yml` calls the consumer-owned
`release-extension.yml`
seam, but its `extension` caller job declared **no** `permissions:`
block, so
the called reusable workflow ran under the caller's workflow-level
default
(`contents: read, packages: read`). A called reusable workflow can only
*downgrade* the caller's `GITHUB_TOKEN` — never elevate it — so any
write-scoped
extension step was silently denied:

- `actions/attest-build-provenance` (needs `id-token: write` +
`attestations: write`) — the flow that surfaced this during the
sync-issues-action adoption (vig-os/sync-issues-action#106).
- Even the **GHCR-publish example the docs already ship** (needs
`packages: write`) — blocked by the same read-only ceiling.

## Type of Change

- [x] `feat` -- New feature

## Changes Made

Option A from the issue — raise the ceiling and document it:

- **`assets/workspace/.github/workflows/release.yml`** — the `extension`
caller
  job now declares a documented token **ceiling**: `contents: read`,
  `packages: write`, `id-token: write`, `attestations: write`.
- **`assets/workspace/.github/workflows/release-extension.yml`**
(seeded/consumer-owned) —
header note explaining the ceiling and the per-job opt-in; the default
no-op
  stays `contents: read`.
- **`docs/DOWNSTREAM_RELEASE.md`** — new "Permission ceiling" subsection
(scope
table + deny-by-default explanation + when to use a consumer-owned
tag-push
  workflow instead).

**Ceiling, not grant.** It's the *maximum* the seam can reach; the
shipped
default no-op is read-only and deny-by-default is preserved — a consumer
opts a
job in by declaring the scopes it needs (up to the ceiling), e.g. a
`actions/attest-build-provenance` job sets
`permissions: { id-token: write, attestations: write }`. Scopes beyond
the
ceiling (e.g. `contents: write` to push a branch) still belong in a
consumer-owned tag-push workflow — documented.

Scope note: this is scaffold-only. Devkit's own `release.yml` is a
bespoke
upstream pipeline and does not use the `release-extension.yml` seam, so
there's
no dogfooding copy to change.

## Changelog Entry

### Changed
- **Release extension seam gains a documented token ceiling**
([#1144](#1144))
  - full entry in `CHANGELOG.md` under `## Unreleased`.

## Testing

- [x] Tests pass locally (`just test`)
- [x] Manual testing performed (describe below)

### Manual Testing Details

- New `tests/test_workflow_release_extension.py` (TDD, RED→GREEN):
asserts the
  caller ceiling grants the four scopes **and** the default no-op stays
  read-only (ceiling ≠ grant).
- `uv run pytest -k "workflow or scaffold or release or downstream or
extension"`
→ **109 passed**; `actionlint` clean on the edited workflow (only the
expected
cross-tree reusable-path notes); full `prek run --all-files` **green**.
- Manifest sync propagated the doc into `assets/workspace/docs/` (mirror
test green).

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have updated the documentation accordingly
- [x] I have updated `CHANGELOG.md` in the `[Unreleased]` section (and
pasted the entry above)
- [x] My changes generate no new warnings or errors
- [x] I have added tests that prove my fix is effective
- [x] New and existing unit tests pass locally with my changes

## Additional Notes

Companion to #1147 (#1142); both surfaced during the sync-issues-action
deploy
recon. The workaround shipping there today (`attest-release.yml` on
`push: tags: v*.*.*`) remains valid — this makes the in-seam path work
too, so
future consumers can keep provenance attestation inside
`release-extension.yml`.

Closes #1144

Refs: #1144
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