fix(ledger): stop a source backfill dating decade-old facts as today - #4139
Merged
Conversation
Registering a source imports its whole archive at once, so a 2013 post and a 2026 post are both crawled this morning. Two dating paths read that crawl moment as if it meant something. `evidenceDerivedDate` falls back to `post.createdAt` when the post carries no `publishedAt`, and for a backfilled archive that is the import date. Measured on prod 2026-08-23: of 12,468 claims dated this way, 91.4% carry exactly the crawl date, and every claim on a pre-2025 article is wrong by the article's own age — 2022 articles drift four years. The direction is what makes it worse than imprecision: M1 denies a candidate whose `effectiveDate` is older than 24 months, so a decade-old fact stamped with today walks straight through the staleness bar built to catch it. It now stays undated, which is honest (playbook §10) and leaves the row visible to the review lane. `extractClaims` told bragi the post was published today whenever the payload carried no `published_at`, and bragi uses that value for exactly one job — resolving the relative expressions a post uses. A 2016 archive post saying "last month" resolved to this year. Measured as unfired so far (the affected population carries a *lower* recent-date share than the control, because these are release posts that state their own dates), so this is a forward guard. The upstream cause is yggdrasil's RSS publisher, which parses the feed's `<pubDate>` into `SourceEntry.PublishedAt` and then drops it when building `EntryData` — the article engine can only take whatever date the content cleaner scrapes off the page. That is why 19 of the 45 sources added on 2026-08-23 carry NULL `publishedAt` on every post while the other 26 do not, and it is filed separately.
|
🍹 The Update (preview) for dailydotdev/api/prod (at ceddc82) was successful. Resource Changes Name Type Operation
~ vpc-native-check-analytics-report-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-current-streak-cron kubernetes:batch/v1:CronJob update
~ vpc-native-hourly-notification-cron kubernetes:batch/v1:CronJob update
~ vpc-native-expire-super-agent-trial-cron kubernetes:batch/v1:CronJob update
+ vpc-native-api-db-migration-9bb42ef8 kubernetes:batch/v1:Job create
~ vpc-native-user-profile-analytics-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-ws-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-update-tags-str-cron kubernetes:batch/v1:CronJob update
~ vpc-native-private-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-daily-digest-cron kubernetes:batch/v1:CronJob update
~ vpc-native-generate-search-invites-cron kubernetes:batch/v1:CronJob update
~ vpc-native-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-materialize-monthly-best-post-archives-cron kubernetes:batch/v1:CronJob update
~ vpc-native-rotate-daily-quests-cron kubernetes:batch/v1:CronJob update
~ vpc-native-sync-subscription-with-cio-cron kubernetes:batch/v1:CronJob update
~ vpc-native-squad-posts-analytics-refresh-cron kubernetes:batch/v1:CronJob update
~ vpc-native-ledger-hygiene-cron kubernetes:batch/v1:CronJob update
~ vpc-native-user-posts-analytics-refresh-cron kubernetes:batch/v1:CronJob update
~ vpc-native-validate-active-users-cron kubernetes:batch/v1:CronJob update
~ vpc-native-bg-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-update-source-public-threshold-cron kubernetes:batch/v1:CronJob update
+ vpc-native-api-clickhouse-migration-9bb42ef8 kubernetes:batch/v1:Job create
~ vpc-native-update-tag-materialized-views-cron kubernetes:batch/v1:CronJob update
~ vpc-native-personalized-digest-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-materialize-yearly-best-post-archives-cron kubernetes:batch/v1:CronJob update
~ vpc-native-user-world-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-user-profile-updated-sync-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-images-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-achievement-rarity-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-gifted-plus-cron kubernetes:batch/v1:CronJob update
~ vpc-native-post-analytics-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-personalized-digest-cron kubernetes:batch/v1:CronJob update
~ vpc-native-post-analytics-achievements-cron kubernetes:batch/v1:CronJob update
~ vpc-native-interest-scheduled-run-cron kubernetes:batch/v1:CronJob update
- vpc-native-api-clickhouse-migration-2bef4ad0 kubernetes:batch/v1:Job delete
~ vpc-native-clean-channel-highlights-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-views-cron kubernetes:batch/v1:CronJob update
~ vpc-native-subscription-anniversary-achievements-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-old-notifications-cron kubernetes:batch/v1:CronJob update
~ vpc-native-ledger-corroboration-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-trending-cron kubernetes:batch/v1:CronJob update
... and 21 other changes |
This was referenced Aug 23, 2026
Closed
Merged
idoshamun
added a commit
that referenced
this pull request
Aug 24, 2026
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
Two dating paths read a source backfill's crawl moment as if it meant something. Registering a source imports its whole archive at once, so a 2013 post and a 2026 post are both crawled this morning.
1.
evidenceDerivedDateno longer dates a claim from an archive importThe fallback to
post.createdAtfires when the post carries nopublishedAt. Measured on prod today: of 12,468 claims datedevidence_crawled, 91.4% carry exactly the crawl date, and every claim on a pre-2025 article is wrong by that article's own age.The direction is the sharp edge. M1 denies a pending candidate whose
effectiveDateis older than 24 months.evidence_crawledsets it to today. So an undated candidate on an undated post is not merely misdated — it is misdated in the exact direction that defeats the guard meant to catch it, and enters the ledger reading as current. Confirmed live:17565f7a(alreadycorroborated) records a 2022 netsim-tools→netlab rename as2026-08-11; seven .NET MAUI claims from a 2024/09 article all sit at 2025-12-11.Note the 2026 row — on live-feed content the fallback is correct (drift −0.01 years). So this does not remove the fallback, it gates it: a post crawled within a day of its source being registered came in the opening archive sweep, and only that case goes undated. Undated is the honest outcome (playbook §10) and it leaves the row visible to the review lane rather than silently current.
2.
extractClaimsno longer tells bragi an archive post was published todaypublishedDatewas defaulting tonew Date()whenever the payload carried nopublished_at. Bragi uses that field for exactly one job — resolving the relative expressions a post uses ("last month", "since March", "starting today") — so a 2016 post's relative dates resolved to this year.Measured as unfired. Candidates on NULL-
publishedAtposts carry a lower recent-date share than the control (2.28% in 2026-08 vs 7.46%), and the sharp test — dated this month while the URL says the article is old — returns zero rows. These are release-announcement posts that state their own dates, sopublished_dateis rarely load-bearing. Fixing it as a forward guard, not a cleanup.Decision worth a look
ARCHIVE_IMPORT_WINDOW_MSis one day. The 2026-08-23 imports each drained inside ninety seconds, so the window is deliberately generous; the only thing it costs is leaving the first day of a new source's genuinely fresh posts undated. Happy to tighten it, or to replace the heuristic with a real import marker if you'd rather yggdrasil flag a backfill explicitly.Not in this PR
The upstream cause. yggdrasil's RSS publisher parses the feed's
<pubDate>intoSourceEntry.PublishedAtand then drops it when buildingEntryData(workflows/source_engines/rss/publisher/publisher.gomaps only URL/Title/Keywords/OriginID). The article engine can therefore only take whatever date the content cleaner scrapes off the page — which is why 19 of the 45 sources added on 2026-08-23 carry NULLpublishedAton every post while the other 26 do not. Carrying the feed date through would make both of the above moot for future imports.Running the repair.
bin/repairCrawlDatedClaims.tsis in this PR (second commit) but is deliberately not run yet. It invents nothing — the recovered date comes off the post row — so it reaches exactly as far as the posts have been repaired, and the posts are fixed upstream. Order is: merge fix(date): recover publication dates the URL and JSON-LD already state newspaper#12 → ship dailydotdev/yggdrasil-cleaner-newspaper#54 → re-clean the affected posts → then run it. Running it today would find almost nothing.It is narrow on purpose, because it overwrites a date rather than filling an empty one: only
evidence_crawled(anextracteddate was read off the change itself, possibly by a reviewer;evidence_publishedis already better), only where the post now carries apublishedAt, and only where that date is earlier than the claim's — a post published after we crawled it is bad in a way this repair cannot name, and a repair that overwrites may only act on the cases it can name.Recovery tiers, measured: 913 posts / 1,674 claims carry the date in the URL (cross-checked 15/15 exact against live pages, no network needed); ~2,800 posts recoverable by page fetch (40-post sample, CI [2,028–3,529] — an estimate, not a measurement); only 724 posts / 715 claims are structurally unrecoverable, all daily.dev-generated
collection/trendsposts with no external URL.