Skip to content

ci: gate unit tests and add data freshness checks - #185

Merged
yakew7 merged 1 commit into
StudentSuite:mainfrom
AyobamiH:ci/gate-unit-tests-and-freshness
Aug 22, 2026
Merged

ci: gate unit tests and add data freshness checks#185
yakew7 merged 1 commit into
StudentSuite:mainfrom
AyobamiH:ci/gate-unit-tests-and-freshness

Conversation

@AyobamiH

Copy link
Copy Markdown
Contributor

Closes #168.

What changed

  • Adds npm run test:unit as a dedicated PR CI job so unit regressions can block changes.
  • Adds a deterministic check:freshness command for place records with valid_till.
  • Supports an injected --today value so freshness behaviour can be tested without depending on the wall clock.
  • Adds integration coverage for:
    • records valid through today
    • expired records
    • impossible ISO dates
    • malformed data rows
    • invalid injected current dates
  • Adds a weekly scheduled workflow that runs place validation and freshness checks.
  • Opens or updates a single issue when the scheduled check fails.
  • Uses paginated issue lookup so the failure reporting does not assume the repository will always have fewer than 100 open issues.
  • Keeps workflow permissions scoped to contents: read and issues: write.

Existing baseline finding

While validating the freshness gate, it surfaced 13 existing SAT records whose valid_till value is the placeholder YYYY-MM-DD.

Those records are not changed in this PR. The scheduled check will surface them for follow-up rather than making unrelated PRs fail on pre-existing data debt.

Verification

Final commit:

25f3caa341875287b78a0c3fba5b649ed29417bf

Validated against the current upstream base:

  • 12 test files passed
  • 97 tests passed
  • npm run validate passed
  • npm run lint passed
  • npx tsc --noEmit passed
  • npm run build passed
  • CI passed
  • Lint & Typecheck passed

Final validation PR:
AyobamiH#2

Signed-off-by: Ayobami Haastrup <47716486+AyobamiH@users.noreply.github.com>
@vercel

vercel Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

@AyobamiH is attempting to deploy a commit to the studentsuite Team on Vercel.

A member of the Team first needs to authorize it.

@yakew7

yakew7 commented Aug 22, 2026

Copy link
Copy Markdown
Member

Hey @AyobamiH! Will check your pr and merge it if it is good meanwhile could you pls star the repo since it helps the project grow and also helps others find this project

@yakew7
yakew7 merged commit 991af83 into StudentSuite:main Aug 22, 2026
4 of 5 checks passed

@shauryagangrade shauryagangrade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review: CI unit-test gate + data freshness (#168)

LGTM overall — the design decisions are sound and well-argued in the description:

  • Deterministic freshness: the --today injection makes the CLI testable without clock mocking, and isRealIsoDate's round-trip through toISOString() correctly rejects 2026-02-30 (leap/impossible dates) rather than trusting the regex. ISO string comparison for expiry is valid.
  • Integration tests via spawnSync against the real script with temp dirs — no logic duplication, proper exit-code assertions, clean temp cleanup. Nice.
  • Workflow hygiene: scoped permissions (contents: read, issues: write only where needed), paginated issue lookup with PR filtering, single upserted tracking issue, off-minute cron.

One thing to land alongside this (not blocking, but time-sensitive):

The first scheduled run will be red

Confirmed locally: data/places/sat_centre.json currently contains 13 records with "valid_till": "YYYY-MM-DD" placeholders. So Monday's cron fails out of the gate and opens the tracking issue. That's the documented intent ("surface pre-existing debt"), but please open a follow-up issue now referencing those 13 ids so the red scheduled check has an owner from day one — otherwise it reads as a broken pipeline rather than a deliberate alarm.

Nits, non-blocking:

  1. Parity: build job still lacks timeout-minutes (and npm cache) that the other jobs now have.
  2. The tracking-issue update overwrites the body each week, losing failure history — consider appending a comment per failure instead of rewriting the body.

Good infra addition.

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.

ci: the 91-test vitest suite never runs in CI; add scheduled data-freshness checks

3 participants