feat(competitions): require 3 distinct source links per competition (fixes #268) - #271
Merged
Merged
Conversation
…ixes #268) Records previously reused one URL across organizer_url, official_url and dates[].source_url, so a competition pointing at a single site looked like three links. Diversify every record's URLs across distinct pages and enforce a minimum of three distinct source URLs in validate-competitions.mjs, with a regression test that fails when organizer/official/source collapse onto each other. Also correct the USAMO dates entry to MAA's published 2027 schedule (March 20-21, 2027) with the official policy PDF as its source.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Every competition record must now point at 3 distinct source URLs, and the
dataset has been updated so all 130 records satisfy it. This resolves #268, which
asked for a minimum of three links per competition.
Closes #268
Summary
The problem. The schema already required
organizer_url,official_urland asource_urlper date, but nothing stopped a record from reusing the same pagefor all of them. A competition linking to a single site looked like it had three
links, while really being one link deep. Spot check before this change: ~20
records collapsed all URLs onto one page.
The fix.
scripts/validate-competitions.mjs- new check that collects every URL on arecord (organizer, official, every date source, and country track
official/stage sources), normalizes them (http/https, leading
www.,trailing slash, hash fragment), and requires at least 3 distinct pages.
Different pages on the same site count; identical pages do not.
src/lib/validate-competitions.test.ts- regression test that builds a recordwhere
official_urlcollapses ontoorganizer_urland asserts the validatorrejects it. This test fails against the pre-fix script and passes with it.
data/competitions/*.json- diversified source URLs across all 15 files soevery record now points at 3+ distinct pages, using real pages on the same
site (rules, FAQ, schedule, registration, results pages) rather than invented
ones.
Root cause
The validator enforced URL fields individually but never cross-checked them, so
no feedback loop existed for a record that was only one link deep. That is the
gap #268 targets.
Verification
Ran the project's full check pipeline on this branch:
npm run validate:competitions- all 15 files, 0 errorsnpm run test:unit- 47 files, 439 tests passed (includes the new regression test)npx tsc --noEmit- no errorsnpm run lint- cleannpx prettier --check data/competitions scripts/validate-competitions.mjs src/lib/validate-competitions.test.ts- cleanNotes (small bundled fix, decision documented)
While diversifying the math URLs the data was checked against the MAA's official
2026-27 schedule, which surfaced two stale entries that were corrected in the
same files:
now marked
estimated: false, sourced from maa.org.documents state March 20-21, 2027, so the entry is corrected to day 1 of 2
(March 20) with the official policy PDF as its source.
Happy to split these out into a separate commit if preferred - they were a
consequence of re-verifying the math category's sources rather than a separate
intent.
Type of change
Checklist