Skip to content

ci: typecheck, tests, and bundle-drift check for built userscripts - #5

Merged
curtyo18 merged 2 commits into
masterfrom
ci/typecheck-tests-bundle-drift
Jul 20, 2026
Merged

ci: typecheck, tests, and bundle-drift check for built userscripts#5
curtyo18 merged 2 commits into
masterfrom
ci/typecheck-tests-bundle-drift

Conversation

@curtyo18

Copy link
Copy Markdown
Owner

Closes #3.

No .github/workflows existed, so typecheck and test only ever ran locally and a broken commit could reach master unnoticed.

Adds .github/workflows/ci.yml on push (master) and pull_request, matrixed over the three projects that build a userscript from src/*.ts. Each job: npm citypechecktest → rebuild and require the committed *.user.js to be byte-identical to the build output.

Verified locally before pushing

Project typecheck tests bundle drift
auto-login pass 137 pass in sync
jira/jira-ticket-extractor pass 35 pass in sync
gitlab/gitlab-code-search pass 46 pass in sync

The issue flagged that jira's suite hadn't been run recently and might need fixing first — it passes as-is. All three bundles already match source, so this lands green rather than red.

Two deviations from the issue

Added gitlab/gitlab-code-search to the matrix. The issue lists only two projects, but this one has the identical shape — same scripts, same committed .user.js served by @downloadURL. It carries exactly the drift exposure the issue is about, so omitting it would leave the stated risk half-covered.

Confirmed the drift check can actually fail. First attempt at testing it was wrong: appending junk to the committed bundle proves nothing, since npm run build just overwrites it. The real scenario is source changed, bundle not rebuilt — forced by bumping the version without rebuilding. The check caught it and exited nonzero.

Determinism holds: neither build embeds a timestamp, and npm ci pins esbuild through the lockfile, so the byte-comparison won't flake.

Not included

The secret / proprietary-reference scan from the issue. It needs either a third-party action or hand-rolled regexes plus a false-positive baseline for an existing public repo — a noisy red CI you learn to ignore is worse than no scan. Better as its own issue.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WSt6ZYkUkUyDc28cHgwhDj

curtyo18 and others added 2 commits July 20, 2026 22:39
No workflows existed, so typecheck and test only ever ran locally and a
broken commit could reach master unnoticed.

Adds .github/workflows/ci.yml, matrixed over the three projects that build
a userscript from src/*.ts. Each job runs npm ci, typecheck, test, then
rebuilds and requires the committed *.user.js to be byte-identical to the
build output.

That last check is the one with user impact: @downloadurl serves the
committed bundle straight off master, so a stale bundle ships broken code
to anyone who auto-updates.

Includes gitlab/gitlab-code-search alongside auto-login and
jira/jira-ticket-extractor. It has the same shape and the same committed
bundle exposure, so omitting it would leave the drift risk half-covered.

All three projects pass typecheck, tests, and the drift check as of this
commit, so CI lands green.

Closes #3

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WSt6ZYkUkUyDc28cHgwhDj
Review of the initial workflow surfaced a false negative in the check that
is the whole point of this change.

git diff only compares tracked files, so a build output that was renamed
in build.mjs or never committed is invisible to it: the old bundle is
untouched, the new one is untracked, and CI goes green while @downloadurl
keeps serving the stale file. Verified by dropping an untracked
*.user.js into a project — the old check exited 0.

Gate on git status --porcelain instead, which reports untracked and
modified alike, and does so without staging anything. Verified it catches
both drift modes, stays clean at baseline, and stays scoped to its own
project rather than tripping on a sibling.

Also from review:
- cancel-in-progress no longer applies to master, where cancelling would
  leave a merged commit with no CI result.
- timeout-minutes: 10, so a hung vitest run cannot hold a runner for the
  6-hour default.
- Error message says 'npm ci && npm run build' — a contributor whose local
  esbuild floated off the lockfile has already run the build, so the old
  wording sent them hunting.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WSt6ZYkUkUyDc28cHgwhDj
@curtyo18
curtyo18 merged commit f7c165f into master Jul 20, 2026
3 checks passed
@curtyo18
curtyo18 deleted the ci/typecheck-tests-bundle-drift branch July 20, 2026 21:48
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.

Add CI: typecheck + tests for auto-login and jira-ticket-extractor

1 participant