Skip to content

test(frontend): add CI coverage for tests and migrations - #605

Merged
junhoyeo merged 1 commit into
junhoyeo:mainfrom
IvGolovach:codex/frontend-ci-db-migration-replay
May 27, 2026
Merged

junhoyeo merged 1 commit into
junhoyeo:mainfrom
IvGolovach:codex/frontend-ci-db-migration-replay

Conversation

@IvGolovach

@IvGolovach IvGolovach commented May 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR adds a focused frontend CI workflow for the existing Vitest suite and a real Postgres migration replay check for the frontend database schema.

Why

The frontend already has meaningful tests for API routes, leaderboard behavior, submit validation, embeds, tokens, groups, and username lookup, but those tests were not exposed as a dedicated CI signal. The migration SQL also carried production-sensitive changes, while most existing checks mocked database behavior or inspected migration text instead of replaying the migration history against Postgres.

Diff Scope

  • Adds packages/frontend test scripts for Vitest and migration replay.
  • Adds .github/workflows/frontend_ci.yml with separate jobs for frontend Vitest and postgres:16 migration replay.
  • Adds packages/frontend/scripts/check-migrations.ts to verify migration journal application, required tables/columns/indexes/extensions, removed-column cleanup, and representative insert compatibility after migrations.

Branch Integrity

  • Base: junhoyeo/tokscale:main
  • Validated base SHA: 8e73312f05f603d5184d36059e4ce2604322d492
  • Head: IvGolovach:codex/frontend-ci-db-migration-replay
  • Head SHA: 0d3fbaa6a9910f837ef38e467823e7cb89f48ccd
  • Ahead/behind: 0 behind / 1 ahead

Commit Integrity

  • 0d3fbaa6a9910f837ef38e467823e7cb89f48ccd test(frontend): add CI coverage for tests and migrations
  • Final diff is limited to frontend test scripts, the new frontend CI workflow, and the migration replay verifier.

Diff Hygiene

  • git diff --check origin/main...HEAD: PASS, no output
  • Forbidden/local artifact files: not present
  • DB migrations: not applicable; no migration files changed
  • Ledger: not applicable; not required for this change family
  • Version: not applicable; not required for this change family

Validation

Validation mode: Mode 4 — CI/test tooling.

  • bun install --frozen-lockfile: PASS
  • bun run --cwd packages/frontend test: PASS, 29 files / 251 tests
  • DATABASE_URL=postgres://postgres:postgres@localhost:<docker-port>/tokscale_ci NODE_ENV=test bun run --cwd packages/frontend test:migrations: PASS against temporary postgres:16
  • ruby -e 'require "yaml"; YAML.load_file(".github/workflows/frontend_ci.yml"); puts "yaml ok"': PASS
  • git diff --check origin/main...HEAD: PASS

Not used as proof: actionlint was unavailable locally. Full frontend lint currently reports unrelated existing app lint errors outside this diff, so this workflow intentionally starts with tests and migration replay rather than adding a new lint gate.

CI Context

Pending — required remote checks and the new frontend workflow will run after the PR is opened.

Runtime Safety

Not applicable — no application runtime path changed. This PR adds CI/test coverage and migration verification only.

Migration Safety

No new migration is introduced. The new replay job applies the existing migration journal to a fresh postgres:16 database and verifies critical schema facts after replay.

Rollback Plan

Rollback: revert this PR.

DB downgrade: not applicable.

Data repair: not applicable.

Operational caveats: reverting would remove the frontend Vitest and migration replay CI signals.

Known Residual Risks

The new workflow needs GitHub Actions validation on the opened PR. The migration replay check is intentionally schema-smoke focused rather than an exhaustive application integration test.

Validation

* Validation tier: Tier 4 - CI/test tooling, because this adds a focused frontend CI workflow plus migration replay verification without changing runtime behavior.

* bun install --frozen-lockfile: PASS

* bun run --cwd packages/frontend test: PASS, 29 files and 251 tests passed.

* DATABASE_URL=postgres://postgres:postgres@localhost:<docker-port>/tokscale_ci NODE_ENV=test bun run --cwd packages/frontend test:migrations: PASS against postgres:16, migrations applied and schema smoke checks passed.

* ruby -e 'require "yaml"; YAML.load_file(".github/workflows/frontend_ci.yml"); puts "yaml ok"': PASS

* perl -ne 'print if /[\x{0400}-\x{04FF}]/' .github/workflows/frontend_ci.yml packages/frontend/package.json packages/frontend/scripts/check-migrations.ts: PASS, no output.

* git diff --check: PASS

* git diff --cached --check: PASS

* Ledger: not applicable - not required for selected validation tier/change family.

* Version: not applicable - not required for selected validation tier/change family.

* Non-gating observation: bun run --cwd packages/frontend lint currently fails on pre-existing unrelated app lint errors outside this diff; the new workflow does not introduce lint as a frontend gate.

* Not run: actionlint - not installed locally.

Rollback

* git revert HEAD
@vercel

vercel Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tokscale Ready Ready Preview, Comment May 25, 2026 9:30pm

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 3 files

Re-trigger cubic

@junhoyeo
junhoyeo merged commit 20fec5c into junhoyeo:main May 27, 2026
7 checks passed
@junhoyeo

Copy link
Copy Markdown
Owner

@IvGolovach this has been merged to v3.0.0: https://github.com/junhoyeo/tokscale/releases/tag/v3.0.0 thanks for the contribution!

leecoder pushed a commit to leecoder/tokscale that referenced this pull request May 29, 2026
Validation

* Validation tier: Tier 4 - CI/test tooling, because this adds a focused frontend CI workflow plus migration replay verification without changing runtime behavior.

* bun install --frozen-lockfile: PASS

* bun run --cwd packages/frontend test: PASS, 29 files and 251 tests passed.

* DATABASE_URL=postgres://postgres:postgres@localhost:<docker-port>/tokscale_ci NODE_ENV=test bun run --cwd packages/frontend test:migrations: PASS against postgres:16, migrations applied and schema smoke checks passed.

* ruby -e 'require "yaml"; YAML.load_file(".github/workflows/frontend_ci.yml"); puts "yaml ok"': PASS

* perl -ne 'print if /[\x{0400}-\x{04FF}]/' .github/workflows/frontend_ci.yml packages/frontend/package.json packages/frontend/scripts/check-migrations.ts: PASS, no output.

* git diff --check: PASS

* git diff --cached --check: PASS

* Ledger: not applicable - not required for selected validation tier/change family.

* Version: not applicable - not required for selected validation tier/change family.

* Non-gating observation: bun run --cwd packages/frontend lint currently fails on pre-existing unrelated app lint errors outside this diff; the new workflow does not introduce lint as a frontend gate.

* Not run: actionlint - not installed locally.

Rollback

* git revert HEAD
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.

2 participants