Skip to content

feat(competitions): require 3 distinct source links per competition (fixes #268) - #271

Merged
shauryagangrade merged 1 commit into
mainfrom
feat/268-min-three-links
Sep 19, 2026
Merged

shauryagangrade merged 1 commit into
mainfrom
feat/268-min-three-links

Conversation

@shauryagangrade

Copy link
Copy Markdown
Member

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_url and a
source_url per date, but nothing stopped a record from reusing the same page
for 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.

  1. scripts/validate-competitions.mjs - new check that collects every URL on a
    record (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.
  2. src/lib/validate-competitions.test.ts - regression test that builds a record
    where official_url collapses onto organizer_url and asserts the validator
    rejects it. This test fails against the pre-fix script and passes with it.
  3. data/competitions/*.json - diversified source URLs across all 15 files so
    every 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 errors
  • npm run test:unit - 47 files, 439 tests passed (includes the new regression test)
  • npx tsc --noEmit - no errors
  • npm run lint - clean
  • npx prettier --check data/competitions scripts/validate-competitions.mjs src/lib/validate-competitions.test.ts - clean

Notes (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:

  • AMC 10/12 A and B moved to the published dates (Nov 5 / Nov 13, 2026) and are
    now marked estimated: false, sourced from maa.org.
  • The USAMO entry previously claimed 2027-03-24; MAA's published 2027 policy
    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

  • Code or fix
  • New public place(s)
  • New or updated benefit guide
  • New or updated resource link
  • Docs

Checklist

  • The changes host no copyrighted files (links only; no image or media files added)
  • No em dashes in any copy
  • The affected tests pass and the full unit suite is green

…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.
@vercel

vercel Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
study-map Ready Ready Preview Sep 19, 2026 7:14am UTC

@shauryagangrade
shauryagangrade merged commit 341a72a into main Sep 19, 2026
6 checks passed
@shauryagangrade
shauryagangrade deleted the feat/268-min-three-links branch September 19, 2026 09:44
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.

[feature] Add minimum three links per competition

1 participant