Skip to content

fix(wc2026): reconcile match identity and multi-source facts#12

Open
huygdv wants to merge 13 commits into
mainfrom
fix/wc2026-match-identity
Open

fix(wc2026): reconcile match identity and multi-source facts#12
huygdv wants to merge 13 commits into
mainfrom
fix/wc2026-match-identity

Conversation

@huygdv

@huygdv huygdv commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Problem

The World Cup pack could publish two records for the same physical match and use the 90-minute score as the final knockout result:

  • placeholders such as W91 vs W92 used a team/date-derived event id;
  • when participants resolved, the ingest created a second id instead of updating the same match;
  • score.ft was always used even when score.et or score.p existed;
  • mechanical ingest replaced the event's source list rather than preserving provenance from other producers;
  • the structured pack and wc2026/history recap surface were not cross-checked.

This produced the observed W91/W92 ghost plus Norway 1–1 England, although match 99 finished 1–2 after extra time.

Changes

  • introduce stable matchNumber, matchKey, and sourceMatchId identity;
  • reconcile exact ids, resolved team pairs, and schedule placeholders by date/round/venue;
  • normalize regulation, extra-time, final and penalty scores separately;
  • remove resolved placeholder duplicates and remap causal links/insight references;
  • union and deduplicate citations instead of last-write-wins;
  • preserve editorial fields such as whyItMatters, watchpoints and Vietnamese text;
  • block independently sourced factual conflicts for manual review;
  • require explicit factCorrection.reason for reviewed manual overrides;
  • validate unique match numbers and structured results;
  • cross-check the pack against every wc2026/history/YYYY-MM-DD.json recap;
  • run helper tests, ingest, structural validation and consistency validation in GitHub Actions.

Multi-source policy

ChatGPT/scheduled-agent output remains an editorial and recap layer, not the sole authority for scores. Additional sources such as FIFA, open data, Reuters/AP or manual curation may enrich the same match. Their citations are retained. If independent sources disagree on participants, score or winner, publication fails instead of allowing the latest writer to silently overwrite the others.

Verification

Locally exercised:

  • regular-time, extra-time and penalty normalization;
  • W91/W92 placeholder reconciliation;
  • link remapping to canonical events;
  • source union/deduplication;
  • duplicate match-number rejection;
  • pack/history consistency pass and intentional conflict failure;
  • manual-agent input merge by match number and explicit conflict blocking.

After merge, the push workflow runs reconciliation against the live source and commits the corrected generated pack only if all gates pass.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 967f165019

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +84 to +85
const key = `${date}|${normalizeTeamPair(home, away)}`;
const event = (n != null ? byMatchNumber.get(n) : null) || byDatePair.get(key);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Allow recap dates to differ from feed dates

When a recap result does not include matchNumber, this exact ${date}|teamPair lookup misses real pack events whose recap/publication day differs from the feed kickoff date. In the committed data, wc2026/history/2026-06-23.json has Argentina vs Austria, while packs/worldcup-2026/events.json contains the same match as wc2026-argentina-austria-0622 on 2026-06-22, so node scripts/validate-worldcup-consistency.mjs exits with no pack event found and the new workflow gate is blocked. Please match by a stable match number where possible, or normalize/tolerate the date difference before failing.

Useful? React with 👍 / 👎.

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.

1 participant