Skip to content

ci: web CI workflow, lint fixes, unit tests (#48)#63

Merged
Jose-Gael-Cruz-Lopez merged 3 commits into
mainfrom
ci/web-app-and-tests
Jul 7, 2026
Merged

ci: web CI workflow, lint fixes, unit tests (#48)#63
Jose-Gael-Cruz-Lopez merged 3 commits into
mainfrom
ci/web-app-and-tests

Conversation

@Jose-Gael-Cruz-Lopez

Copy link
Copy Markdown
Collaborator

Closes #48. Stacked on #62 (base reliability/error-handling-and-freshness). Merge #60#61#62 → this.

CI — .github/workflows/web-ci.yml

On PR + push to main, paths web/** / .github/scripts/**. SHA-pinned actions.

  • web job: npm cilinttest (vitest) → buildtsc --noEmit. tsc runs after build because next build generates next-env.d.ts + .next/types (both gitignored → absent on fresh checkout).
  • scripts job: Python unittest suite.

Lint — npm run lint now exits 0

  • The two set-state-in-effect errors (preloader reduced-motion, store localStorage hydration) → justified eslint-disable: both are intentional post-mount syncs where a lazy initializer would cause a hydration mismatch.
  • deck.tsx: ternary statement → if/else.
  • store.tsx: dropped the throwaway destructure (no-unused-vars).
  • error.tsx: <a><Link> (a lint error I'd introduced in reliability: error boundaries, guarded reads, live deadlines (#46, #47) #62).
  • Ignore components/vendor/** (minified third-party Framer code).

Tests

  • JS (vitest): parsePrizeValue, deriveState, splitTitle, themesFor, resolveAssetSrc, table parsing — happy path + malformed. (Exported those functions for direct import.)
  • Python (stdlib unittest): parse_deadline_date, sanitize_field, is_valid_email, escape_attr, parse_issue_body, parse_state, parse_deadline, SSRF guard.

Acceptance criteria

  • PRs run lint + typecheck + build for web/ and fail on errors
  • npm run lint exits 0
  • Core parsing functions (JS + Python) have unit tests (happy + malformed)

Verification

  • ✅ lint exit 0 · 15 JS + 13 Python tests pass · next build + tsc --noEmit succeed · workflow YAML valid · npm audit --omit=dev clean

🤖 Generated with Claude Code

Closes #48.

CI:
- Add .github/workflows/web-ci.yml: on PR + push(main) for web/**,
  .github/scripts/**. Job `web` runs npm ci, lint, vitest, next build, and
  tsc --noEmit (after build so generated next-env.d.ts / .next/types exist).
  Job `scripts` runs the Python unittest suite. Actions pinned to SHAs.

Lint (npm run lint now exits 0):
- Fix the two set-state-in-effect errors (preloader reduced-motion, store
  localStorage hydration) with justified eslint-disable — both are intentional
  post-mount syncs where a lazy initializer would cause a hydration mismatch.
- deck.tsx: ternary statement -> if/else (no-unused-expressions).
- store.tsx: drop the throwaway destructure binding (no-unused-vars).
- error.tsx: use <Link> instead of <a> (no-html-link-for-pages).
- Ignore components/vendor/** (minified third-party Framer code).

Tests:
- vitest (dev dep) + `test` script. lib/listings.test.ts and
  lib/parse-readme.test.ts cover parsePrizeValue, deriveState, splitTitle,
  themesFor, resolveAssetSrc, and table parsing (happy path + malformed).
- .github/scripts/test_scripts.py (stdlib unittest): parse_deadline_date,
  sanitize_field, is_valid_email, escape_attr, parse_issue_body, parse_state,
  parse_deadline, and the SSRF guard.
- Exported the tested lib functions for direct import.

Verified: lint exit 0; 15 JS tests + 13 Python tests pass; next build + tsc
--noEmit succeed; workflow YAML valid; production audit (--omit=dev) clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Jose-Gael-Cruz-Lopez and others added 2 commits July 7, 2026 10:50
The lock update had deleted the @emnapi/core and @emnapi/runtime package
nodes while five dependency edges (@rolldown/binding-wasm32-wasi,
@napi-rs/wasm-runtime peerDeps, etc.) still referenced them, leaving the
lockfile internally inconsistent. `npm ci` — the first step of the new Web
CI job — failed deterministically ("Missing: @emnapi/runtime / @emnapi/core
from lock file"), so lint/test/build/tsc never ran.

Regenerated with `npm install` (re-adds exactly the two missing nodes).
Verified the full CI pipeline locally on node 24: npm ci, npm run lint,
npm run test (15/15), npm run build, and npx tsc --noEmit all pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
My previous lockfile resync used local npm 11.6.2, which resolves the
@emnapi/core and @emnapi/runtime transitive deps to 1.11.2. The CI runner
(node 24.18.0 / npm 11.16.0) computes a tree that needs the 1.11.1 nodes, so
`npm ci` still failed there ("Missing: @emnapi/core@1.11.1 from lock file")
even though it passed locally under 11.6.2.

Reconciled the lockfile with npm@11.16.0 (the exact runner version).
Verified against that version: `npm ci` fails on the old lockfile and passes
on this one; lint, test (15/15), build, and tsc --noEmit all pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Jose-Gael-Cruz-Lopez added a commit that referenced this pull request Jul 7, 2026
Carry the lockfile fix from #63 onto this branch so its Web CI passes rather
than failing at `npm ci` on the inherited out-of-sync lockfile. Regenerated
with npm@11.16.0 (the CI runner version); verified `npm ci`, lint, test
(15/15), build, and tsc --noEmit all pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Jose-Gael-Cruz-Lopez Jose-Gael-Cruz-Lopez changed the base branch from reliability/error-handling-and-freshness to main July 7, 2026 15:29
@Jose-Gael-Cruz-Lopez Jose-Gael-Cruz-Lopez merged commit 98d031d into main Jul 7, 2026
2 checks passed
@Jose-Gael-Cruz-Lopez Jose-Gael-Cruz-Lopez deleted the ci/web-app-and-tests branch July 7, 2026 15:38
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.

[Medium] CI/CD: no CI for the web app; lint/typecheck unenforced (ESLint errors) and no tests

1 participant