Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/ts-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@ jobs:
fi
base="${{ github.event.pull_request.base.sha }}"
head="${{ github.event.pull_request.head.sha }}"
if git diff --name-only "$base" "$head" | grep -qE '^(package\.json|ts/)'; then
# Must include package-lock.json and THIS WORKFLOW, not just package.json and ts/**:
# - a dependency bump can land entirely in the lockfile, and that is exactly the
# change most likely to break the suite;
# - a PR editing only ts-ci.yml previously skipped every step, so the workflow that
# defines this gate was the one change the gate never ran on. This PR is that
# shape: before this line was widened, the commit adding the Test step below had
# it reported as `skipped`.
if git diff --name-only "$base" "$head" \
| grep -qE '^(package(-lock)?\.json|ts/|\.github/workflows/ts-ci\.yml)'; then
Comment on lines +49 to +57

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Rejecting — there is nothing to centralize, and the indirection would make the gate harder to audit.

The comment's premise is duplication ("easy to desync from other workflows if similar filters exist"). Checked it:

$ grep -rl "git diff --name-only" .github/workflows/
.github/workflows/ts-ci.yml
(count: 1)

One workflow, one filter, one call site. ci.yml and docker-publish.yml have no changed-files logic at all. There is no second copy to drift from, so extracting it would create the coupling it is meant to prevent rather than remove one.

Two further reasons to keep it inline:

  • Auditability. This filter decides whether the required check actually runs. Today that decision is visible in the same file as the steps it gates — which is what let this PR's own defect be spotted (the head commit reported Test -> skipped). Behind a script indirection, reviewing the workflow no longer shows you what the workflow does.
  • It is 2 lines, not a subsystem. A checked-in script would need its own tests and its own review discipline to be trustworthy, and would still have to stay in step with the on: push: paths: list directly above it — which a script cannot own, because that list is workflow syntax.

If a second workflow ever needs the same filter, that is the point to extract it, and the second use case will show what the right interface is. Extracting on a sample of one usually guesses wrong.

I did widen the regex in this PR (package(-lock)?\.json|ts/|\.github/workflows/ts-ci\.yml) and verified by truth table that Rust-only, README-only and ci.yml-only PRs still resolve to ts=false, so the required context keeps reporting instead of hanging "expected".

echo "ts=true" >> "$GITHUB_OUTPUT"
else
echo "ts=false" >> "$GITHUB_OUTPUT"
Expand All @@ -65,6 +73,16 @@ jobs:
if: steps.changed.outputs.ts == 'true'
run: npm run typecheck

# The TypeScript suite was never executed by ANY workflow: ci.yml runs
# `cargo test --workspace` (Rust only) and this job ran typecheck + build + a dist
# staleness check. 401 tests existed and nothing invoked them, so a TS regression
# could merge with every required check green — typecheck proves it COMPILES, not
# that it WORKS. Runs before the dist rebuild so a logic failure is reported as a
# test failure rather than surfacing later as a confusing dist diff.
- name: Test
if: steps.changed.outputs.ts == 'true'
run: npm test

- name: Rebuild dist
if: steps.changed.outputs.ts == 'true'
run: npm run build
Expand All @@ -81,7 +99,7 @@ jobs:

- name: No TS/dist changes — required check trivially satisfied
if: steps.changed.outputs.ts != 'true'
run: echo "This PR touches no package.json or ts/** files; build-and-verify-dist has nothing to verify."
run: echo "This PR touches no package.json, package-lock.json, ts/** or ts-ci.yml files; build-and-verify-dist has nothing to verify."

# ── Vendored-ontology provenance (W12) ─────────────────────────────────────────────
# ontology/kko/PROVENANCE.md recorded a sha256 that NOTHING verified. Consumers across the
Expand Down
7 changes: 5 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading