Skip to content

Repository improvement plan + phases 1–3: validator correctness, tests/CI, architecture cleanup#12

Merged
martinl5 merged 2 commits into
mainfrom
claude/repository-improvement-plan-l0a4p1
Jun 10, 2026
Merged

Repository improvement plan + phases 1–3: validator correctness, tests/CI, architecture cleanup#12
martinl5 merged 2 commits into
mainfrom
claude/repository-improvement-plan-l0a4p1

Conversation

@martinl5

@martinl5 martinl5 commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary

Adds IMPROVEMENT_PLAN.md (full audit + phased roadmap) and implements phases 1–3 of it.

Validation accuracy (Phase 1)

  • Read-only query guard (src/lib/sqlRunner.ts): user SQL can no longer DROP/UPDATE/INSERT and silently corrupt the in-memory database for the rest of the session; one statement at a time, executed via prepare/step. A pristine seed snapshot enables instant resetDatabase().
  • Order-aware comparison: rows compare as a multiset unless the solution has a top-level ORDER BY (window OVER (ORDER BY …) and subqueries are ignored); per-level orderMatters override available. Correct queries without an unrequested ORDER BY no longer fail.
  • Tighter value comparison: exact string matching (SQLite = is case-sensitive — the old .toLowerCase().trim() taught wrong semantics), relative float tolerance instead of absolute 0.0001, case-insensitive column-name matching.
  • Specific failure messages per mismatch class (column count/names, row count, value diff, ordering) instead of one generic "check your WHERE conditions".
  • Expected results cached per level; epoch tags on levels 51–54 fixed to match the displayed progression.

Tests + CI (Phase 2)

  • 270 Vitest tests: every level's solution executes against the real seed in Node, returns rows, and validates against itself; seed scaffolds must not already be passing answers; validator comparison unit tests.
  • GitHub Actions: lint → typecheck → test → build on every PR and push to main.

Architecture (Phase 3)

  • sql.js self-hosted from the npm package (synced to public/vendor by a predev/prebuild script) instead of loading v1.8.0 from a third-party CDN while v1.14 sat unused in package.json; custom type shim replaced by @types/sql.js.
  • src/lib/progression.ts as the single source of epochs, XP, ranks, ship species, and MAX_LEVEL — deletes four duplicated copies, the hardcoded / 63, and the hardcoded epoch-divider set.
  • Seed extracted to src/lib/seed.ts (pure, reused by the Node test suite).
  • Dead code removed: unused NextAuth wiring + next-auth/@auth/core beta deps, unused p5/@types/p5 (~1 MB), bird-era types, no-op onSuccess callback, sqlawk package-name typo; new react-hooks lint errors fixed.

Still open (tracked in the plan): level 49 simplification, store tests, levels.ts split, Pillar 4 UX/a11y, LICENSE choice.

Verification

  • npm run lint — clean (0 errors, 0 warnings)
  • npm run typecheck — clean
  • npm test — 270/270 passing
  • npm run build — succeeds

https://claude.ai/code/session_01RQVRtRAigoNCzJc37A5Ses

Audit of validation accuracy, testing gaps, architecture, and UX,
organized into 5 pillars with a phased roadmap and quick wins.

https://claude.ai/code/session_01RQVRtRAigoNCzJc37A5Ses
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
sqlwak Ready Ready Preview, Comment Jun 10, 2026 7:51am

Phase 1-3 of the improvement plan:

Validation accuracy
- Reject non-SELECT/WITH and multi-statement queries so user SQL can
  no longer mutate the shared in-memory database (src/lib/sqlRunner.ts)
- Compare rows as a multiset unless the solution has a top-level
  ORDER BY (per-level orderMatters override available)
- Exact string comparison, relative float tolerance, case-insensitive
  column names, and specific failure messages per mismatch class
- Cache expected results; snapshot seed for instant resetDatabase()
- Fix epoch tags on levels 51-54 to match the displayed progression

Tests + CI
- Vitest suite: every level's solution executes, returns rows, and
  validates against itself; seed scaffolds must not already pass;
  validator comparison unit tests (270 tests)
- GitHub Actions: lint, typecheck, test, build

Architecture
- Self-host sql.js from the npm package (script in scripts/) instead
  of loading 1.8.0 from a third-party CDN; drop the custom type shim
  for @types/sql.js
- New src/lib/progression.ts as the single source of epochs, XP,
  ranks, and MAX_LEVEL - removes four duplicated copies and the
  hardcoded '/ 63' and epoch-divider sets
- Extract seedDatabase to src/lib/seed.ts (pure, Node-testable)
- Delete unused NextAuth wiring and next-auth/@auth/core/p5 deps;
  fix package name typo (sqlawk -> sqlwak); fix new react-hooks
  lint errors

https://claude.ai/code/session_01RQVRtRAigoNCzJc37A5Ses
@martinl5 martinl5 changed the title docs: comprehensive repository improvement plan Repository improvement plan + phases 1–3: validator correctness, tests/CI, architecture cleanup Jun 10, 2026
@martinl5 martinl5 marked this pull request as ready for review June 10, 2026 07:55
@martinl5 martinl5 merged commit 6d7d6f9 into main Jun 10, 2026
3 checks passed
@martinl5 martinl5 deleted the claude/repository-improvement-plan-l0a4p1 branch June 10, 2026 07:55
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