ci: gate unit tests and add data freshness checks - #185
Conversation
Signed-off-by: Ayobami Haastrup <47716486+AyobamiH@users.noreply.github.com>
|
@AyobamiH is attempting to deploy a commit to the studentsuite Team on Vercel. A member of the Team first needs to authorize it. |
|
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 |
shauryagangrade
left a comment
There was a problem hiding this comment.
Review: CI unit-test gate + data freshness (#168)
LGTM overall — the design decisions are sound and well-argued in the description:
- Deterministic freshness: the
--todayinjection makes the CLI testable without clock mocking, andisRealIsoDate's round-trip throughtoISOString()correctly rejects2026-02-30(leap/impossible dates) rather than trusting the regex. ISO string comparison for expiry is valid. - Integration tests via
spawnSyncagainst the real script with temp dirs — no logic duplication, proper exit-code assertions, clean temp cleanup. Nice. - Workflow hygiene: scoped permissions (
contents: read,issues: writeonly 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:
- Parity:
buildjob still lackstimeout-minutes(and npm cache) that the other jobs now have. - 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.
Closes #168.
What changed
npm run test:unitas a dedicated PR CI job so unit regressions can block changes.check:freshnesscommand for place records withvalid_till.--todayvalue so freshness behaviour can be tested without depending on the wall clock.contents: readandissues: write.Existing baseline finding
While validating the freshness gate, it surfaced 13 existing SAT records whose
valid_tillvalue is the placeholderYYYY-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:
25f3caa341875287b78a0c3fba5b649ed29417bfValidated against the current upstream base:
npm run validatepassednpm run lintpassednpx tsc --noEmitpassednpm run buildpassedFinal validation PR:
AyobamiH#2