A site row whose opponent is a placeholder ("TBD", "TBA", "to be… #200

Merged
cmoriarty merged 3 commits from osf/204-duplicate-match-found-again into main 2026-11-20 14:53:28 -05:00
Owner

What was done

  • A site row whose opponent is a placeholder ("TBD", "TBA", "to be determined") now joins the feed's entry for the same game instead of becoming a second entry, fixing the duplicates where, for example, "Florida Gators vs. TBD" was listed beside "West Virginia vs. Florida".
  • The join works in both site merges the app runs — the sportsurge hub and thetvapp — and the row's real match page upgrades the entry's reference for that site, the same way a row matched by both team names already does, so the game keeps its proven page.
  • The join needs the row's known team, the same start time within five minutes, and a unique candidate: if the feed lists the known team more than once at that time (a doubleheader, a tournament day), or the times do not line up, the row keeps its own entry as before.
  • For a live row — the site drops the start time once the game is live — the join uses the start the app derives for the game, first live sighting minus the match minute, so the join holds for the whole game rather than falling off at kickoff and re-duplicating.
  • Rows the join must not take are unchanged: a row whose non-matching team is a real team stays its own entry (it may be a different game of the known team), and a soccer row with a placeholder opponent never joins, because the app's soccer label names no single feed to constrain the join to.
  • Unit tests for the join in both merges sit beside the existing merge tests in the backend suite, and the browser smoke test gains a leg that serves a "TBD" row beside a matching fake feed game and asserts the game is listed exactly once, at the API and on the page.
  • The unit lane — the frontend build plus the backend test suite — was run after the implementation and after each fix round and passed; no UI file changed, so no judge was due.
  • Not done: the live check after deploy (the two 2026-11-20 duplicates each listing once while their rows still read "TBD") is left to after deploy, and the new browser leg runs via make e2e, gated on headless Chromium, and was not part of the recorded unit lane.

How to review

  1. Get the branch: git fetch origin && git checkout osf/204-duplicate-match-found-again.
  2. Read the two files that carry the change: backend/app/games.py (the join in both merges) and backend/app/resolver/hub.py (the placeholder test, beside the other name-matching helpers).
  3. Run the unit lane: (npm --prefix frontend run build) && backend/.venv/bin/python -m pytest backend/tests -q -n auto --timeout=120 — expect a full pass; the new tests are the ones matching -k placeholder in backend/tests/test_games.py and backend/tests/test_thetvapp.py.
  4. Run the browser smoke test: make e2e — the new leg serves a "TBD" row beside a matching fake feed game and asserts the game is listed exactly once; it reports ok, or a clear skipped line if headless Chromium is absent.
  5. After deploy, check the live list: the two 2026-11-20 duplicates (NC State, Murray State) each list once while their rows still read "TBD".

Code review

Reviewed the placeholder-join change (games.py, hub.py, three test files) against the live-game-list delta spec. Found and fixed a spec violation: the taken set (which the placeholder join uses to skip entries that already hold a page from the site) was not tracking hub-only entries or entries joined by a placeholder/mascot row, so a second row for the same game could join an entry that already holds a page, violating 'holds no page from that source yet'. Fixed by adding those entries to taken in both merges (4 places). Also fixed two wrong-time comments in test_games.py (T0 is 8:30 PM ET, not 9:30/2:30 PM). All 178 tests pass.

Left for you

  • minor, backend/app/resolver/hub.py:407: is_placeholder(None) raises TypeError (norm_name calls .lower() on None). Never triggered in practice: both call sites (games.py:1158, 1302) pass parsed team-name strings. Not fixed.
  • minor, backend/app/resolver/hub.py:400: 'T.B.D.' (dotted acronym) normalizes to 't b d', not in the placeholder set. The spec's canonical forms ('TBD', 'TBA', 'to be determined') and their case/trailing-punctuation/spacing variants all match. Not fixed.
  • minor, backend/tests/test_thetvapp.py:451: monkeypatch.setattr(games, '_wall', lambda: NOW) is defensive but not exercised: every row is a pre-game row with a parsed start_ts, so the placeholder/mascot joins use row.start_ts, never _wall. Harmless and consistent with the #196 test. Not fixed.
  • minor, backend/tests/e2e_click_to_play.py:1753: The poll's httpx.get(...).json() has no try/except or status check; a transient error fails the leg instead of retrying (unlike wait_for_listed_games). Unlikely for a local subprocess (start_app waits until the app answers). Not fixed.
  • minor, backend/tests/e2e_click_to_play.py:399: strftime('%b') is locale-dependent; a non-English locale would break the parser's month lookup. Same pattern as existing test_thetvapp.py:441, so consistent with repo practice. Not fixed.
  • minor, backend/tests/e2e_click_to_play.py:1738: The feed mutation (append to FEED_SCOREBOARDS, removed in finally) is visible to the concurrently running channel leg's app (shared global feed server) during any overlap. No assertion depends on it (the channel leg's entry pick is always a live game, sorted first). Not fixed.

Fixed before the commit

  • major, backend/app/games.py:1008: The hub merge's placeholder join did not add the joined entry's index to taken, so a second placeholder row for the same game could also join it, replacing the first row's URL. Violates 'holds no page from that source yet'. Fixed by adding taken.add(place).
  • major, backend/app/games.py:1031: The hub merge's hub-only emission did not add the entry's index to taken, so a later placeholder row could join a hub-only entry (which holds a page from the site), violating 'holds no page from that source yet'. Order-dependent: both-names row first let the placeholder row join it (wrong URL); placeholder row first listed the game twice. Fixed by adding taken.add(len(merged)).
  • major, backend/app/games.py:1318: The thetvapp merge's placeholder join did not add the joined entry's index to taken, so a second placeholder row for the same game could also join it, adding a second thetvapp source. Violates 'holds no page from that source yet'. Fixed by adding taken.add(place).
  • major, backend/app/games.py:1326: The thetvapp merge's mascot join did not add the joined entry's index to taken, so a later placeholder row could add a second thetvapp source to an entry already joined by a mascot row (the placeholder join checks i not in taken, not the thetvapp source directly). Fixed by adding taken.add(place).
  • minor, backend/tests/test_games.py:664: Comment says '9:30 PM ET on Nov 4' but T0 = 2026-11-05 01:30 UTC is 8:30 PM ET (EST, DST ended 2026-11-01). Fixed the comment.
  • minor, backend/tests/test_games.py:762: Comment says 'live since T0 (2:30 PM)' but T0 is 8:30 PM ET. Fixed the comment.

Tests

All 10 scenarios of duplicate-match-found-again-i-have-tried-2yv88y have a tagged test.

The test lint recorded nothing in the run's tests.

Braid run

  • Workflow: Braid's OpenSpec flow, change duplicate-match-found-again-i-have-tried-2yv88y (26 steps)
  • Issue: cmoriarty/sports-breaker#199
  • Model: vLLM · qwen3.8-27b
  • Time: 1 h 35 m from start to this pull request, 2 h 4 m of it in the model
  • Tokens: 43.5M input, 97k output, 383k reasoning, over 471 model calls
  • Pre-flight estimate: too-big, p50 208k / p80 318k tokens against a 224k-token step allowance
  • CI: no CI ran on the checked code: no workflow runs on a push to osf/204-duplicate-match-found-again or on a pull request (.gitea/workflows: ci.yml, publish-image.yml); what only CI tests went unverified
  • Run: run_01M7X2V1PJ3DQA4QXG0P2YV88Y

Opened by Braid.

## What was done - A site row whose opponent is a placeholder ("TBD", "TBA", "to be determined") now joins the feed's entry for the same game instead of becoming a second entry, fixing the duplicates where, for example, "Florida Gators vs. TBD" was listed beside "West Virginia vs. Florida". - The join works in both site merges the app runs — the sportsurge hub and thetvapp — and the row's real match page upgrades the entry's reference for that site, the same way a row matched by both team names already does, so the game keeps its proven page. - The join needs the row's known team, the same start time within five minutes, and a unique candidate: if the feed lists the known team more than once at that time (a doubleheader, a tournament day), or the times do not line up, the row keeps its own entry as before. - For a live row — the site drops the start time once the game is live — the join uses the start the app derives for the game, first live sighting minus the match minute, so the join holds for the whole game rather than falling off at kickoff and re-duplicating. - Rows the join must not take are unchanged: a row whose non-matching team is a real team stays its own entry (it may be a different game of the known team), and a soccer row with a placeholder opponent never joins, because the app's soccer label names no single feed to constrain the join to. - Unit tests for the join in both merges sit beside the existing merge tests in the backend suite, and the browser smoke test gains a leg that serves a "TBD" row beside a matching fake feed game and asserts the game is listed exactly once, at the API and on the page. - The unit lane — the frontend build plus the backend test suite — was run after the implementation and after each fix round and passed; no UI file changed, so no judge was due. - **Not done:** the live check after deploy (the two 2026-11-20 duplicates each listing once while their rows still read "TBD") is left to after deploy, and the new browser leg runs via `make e2e`, gated on headless Chromium, and was not part of the recorded unit lane. ## How to review 1. Get the branch: `git fetch origin && git checkout osf/204-duplicate-match-found-again`. 2. Read the two files that carry the change: `backend/app/games.py` (the join in both merges) and `backend/app/resolver/hub.py` (the placeholder test, beside the other name-matching helpers). 3. Run the unit lane: `(npm --prefix frontend run build) && backend/.venv/bin/python -m pytest backend/tests -q -n auto --timeout=120` — expect a full pass; the new tests are the ones matching `-k placeholder` in `backend/tests/test_games.py` and `backend/tests/test_thetvapp.py`. 4. Run the browser smoke test: `make e2e` — the new leg serves a "TBD" row beside a matching fake feed game and asserts the game is listed exactly once; it reports ok, or a clear skipped line if headless Chromium is absent. 5. After deploy, check the live list: the two 2026-11-20 duplicates (NC State, Murray State) each list once while their rows still read "TBD". ## Code review Reviewed the placeholder-join change (games.py, hub.py, three test files) against the live-game-list delta spec. Found and fixed a spec violation: the `taken` set (which the placeholder join uses to skip entries that already hold a page from the site) was not tracking hub-only entries or entries joined by a placeholder/mascot row, so a second row for the same game could join an entry that already holds a page, violating 'holds no page from that source yet'. Fixed by adding those entries to `taken` in both merges (4 places). Also fixed two wrong-time comments in test_games.py (T0 is 8:30 PM ET, not 9:30/2:30 PM). All 178 tests pass. **Left for you** - minor, `backend/app/resolver/hub.py:407`: is_placeholder(None) raises TypeError (norm_name calls .lower() on None). Never triggered in practice: both call sites (games.py:1158, 1302) pass parsed team-name strings. Not fixed. - minor, `backend/app/resolver/hub.py:400`: 'T.B.D.' (dotted acronym) normalizes to 't b d', not in the placeholder set. The spec's canonical forms ('TBD', 'TBA', 'to be determined') and their case/trailing-punctuation/spacing variants all match. Not fixed. - minor, `backend/tests/test_thetvapp.py:451`: monkeypatch.setattr(games, '_wall', lambda: NOW) is defensive but not exercised: every row is a pre-game row with a parsed start_ts, so the placeholder/mascot joins use row.start_ts, never _wall. Harmless and consistent with the #196 test. Not fixed. - minor, `backend/tests/e2e_click_to_play.py:1753`: The poll's httpx.get(...).json() has no try/except or status check; a transient error fails the leg instead of retrying (unlike wait_for_listed_games). Unlikely for a local subprocess (start_app waits until the app answers). Not fixed. - minor, `backend/tests/e2e_click_to_play.py:399`: strftime('%b') is locale-dependent; a non-English locale would break the parser's month lookup. Same pattern as existing test_thetvapp.py:441, so consistent with repo practice. Not fixed. - minor, `backend/tests/e2e_click_to_play.py:1738`: The feed mutation (append to FEED_SCOREBOARDS, removed in finally) is visible to the concurrently running channel leg's app (shared global feed server) during any overlap. No assertion depends on it (the channel leg's entry pick is always a live game, sorted first). Not fixed. **Fixed before the commit** - major, `backend/app/games.py:1008`: The hub merge's placeholder join did not add the joined entry's index to `taken`, so a second placeholder row for the same game could also join it, replacing the first row's URL. Violates 'holds no page from that source yet'. Fixed by adding `taken.add(place)`. - major, `backend/app/games.py:1031`: The hub merge's hub-only emission did not add the entry's index to `taken`, so a later placeholder row could join a hub-only entry (which holds a page from the site), violating 'holds no page from that source yet'. Order-dependent: both-names row first let the placeholder row join it (wrong URL); placeholder row first listed the game twice. Fixed by adding `taken.add(len(merged))`. - major, `backend/app/games.py:1318`: The thetvapp merge's placeholder join did not add the joined entry's index to `taken`, so a second placeholder row for the same game could also join it, adding a second thetvapp source. Violates 'holds no page from that source yet'. Fixed by adding `taken.add(place)`. - major, `backend/app/games.py:1326`: The thetvapp merge's mascot join did not add the joined entry's index to `taken`, so a later placeholder row could add a second thetvapp source to an entry already joined by a mascot row (the placeholder join checks `i not in taken`, not the thetvapp source directly). Fixed by adding `taken.add(place)`. - minor, `backend/tests/test_games.py:664`: Comment says '9:30 PM ET on Nov 4' but T0 = 2026-11-05 01:30 UTC is 8:30 PM ET (EST, DST ended 2026-11-01). Fixed the comment. - minor, `backend/tests/test_games.py:762`: Comment says 'live since T0 (2:30 PM)' but T0 is 8:30 PM ET. Fixed the comment. ## Tests All 10 scenarios of `duplicate-match-found-again-i-have-tried-2yv88y` have a tagged test. The test lint recorded nothing in the run's tests. ## Braid run - **Workflow:** Braid's OpenSpec flow, change `duplicate-match-found-again-i-have-tried-2yv88y` (26 steps) - **Issue:** cmoriarty/sports-breaker#199 - **Model:** vLLM · qwen3.8-27b - **Time:** 1 h 35 m from start to this pull request, 2 h 4 m of it in the model - **Tokens:** 43.5M input, 97k output, 383k reasoning, over 471 model calls - **Pre-flight estimate:** too-big, p50 208k / p80 318k tokens against a 224k-token step allowance - **CI:** no CI ran on the checked code: no workflow runs on a push to `osf/204-duplicate-match-found-again` or on a pull request (`.gitea/workflows`: ci.yml, publish-image.yml); what only CI tests went unverified - **Run:** [run_01M7X2V1PJ3DQA4QXG0P2YV88Y](http://openspecflow.internal.underthere.xyz/run/run_01M7X2V1PJ3DQA4QXG0P2YV88Y) _Opened by Braid._
cmoriarty deleted branch osf/204-duplicate-match-found-again 2026-11-20 14:53:28 -05:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cmoriarty/sports-breaker!200
No description provided.