Repository navigation
fix(pipeline): report a link only once it has answered the same way twice - #5
Merged
Merged
Conversation
clay-good
force-pushed
the
fix/link-check-noise
branch
from
November 14, 2026 18:02
b2ac0e7 to
1de8b42
Compare
…wice The weekly link check opened an issue listing 47 links: 24 blocked, 18 moved, 5 broken. Checked by hand on 2026-11-14, four of them needed anything. Not one of the five "broken" links was dead: Mississippi and Montana answered 200 again, and puco.ohio.gov answers 404 to our user-agent and 200 to a browser. Of the eighteen "moved", four had really moved. This matters beyond the issue. The limits page publishes every link in state "broken" as a dead citation, so a moment's network trouble named a live source dead in public. Four things made the noise, and each is now judged on what it means: - A first bad answer is held back. A result still records honestly what the check saw, but it is reported, and published as a dead citation, only once the previous check saw the same thing, with `since` saying how long it has held. This also settles dockets that mint a fresh session URL every visit (Wyoming's, Montana's, two of the eighteen), which "moved" weekly to an address that expires before anyone could use it. - A redirect onto an interstitial is the refusal of an automated check, not a move: eCFR and the Federal Register send one to unblock.federalregister.gov and Minnesota's PUC to a ShieldSquare challenge. Nine of the eighteen were this. They now read "blocked", which already means "a person checks this by hand". - A DOI that resolves is working, which covers two more. Resolving is its whole job, and storing where it pointed today would trade a permanent citation for a perishable one. - The fragment is ours, not the server's, and `fetch` drops it, so #licensing alone made the PUDL README look moved every week. The 24 blocked links are unaffected: they are real refusals, and the project means a person to check them by hand. The first run after this ships confirms nothing, as there is no previous answer to agree with; the run after it reports as usual. Towards #1; the four links that really moved are updated separately. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
clay-good
force-pushed
the
fix/link-check-noise
branch
from
November 14, 2026 18:16
1de8b42 to
bfe9c28
Compare
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.
Status: LGTM — ready to merge. Towards #1 (the four links that really moved are updated in a separate PR).
What was wrong
The weekly link check opened #1 listing 47 links: 24 blocked, 18 moved, 5 broken. I checked every one by hand on 2026-11-14. Four needed anything.
Not one of the five "broken" links was dead:
psc.ms.govctsportal.psc.ms.gov/portal/document-searchpsc.mt.govpsc.mt.gov/Documents-Proceedings/Public-Participationpuco.ohio.govOf the eighteen "moved", four had really moved. The other fourteen were artifacts:
unblock.federalregister.gov, and Minnesota's PUC to a ShieldSquare challenge atvalidate.perfdrive.com. Following those would have stored a URL that cites nothing.dms.wyo.gov, Montana'sreddi.mt.gov) mint a fresh session id per visit, so they "moved" every single week to an address that expires before anyone could use it.fetchdrops the#licensingfragment fromres.url, so the comparison on the old line 73 never matched.A report where 4 of 47 lines are actionable does not get read, which is the real cost. But this reaches further than the issue:
core/lib/ledger.mjspublishes every link in statebrokenas a dead citation on the limits page. So Mississippi's and Montana's momentary network trouble, and Ohio's bot wall, were being published to the public as cited sources that no longer resolve. That is a correctness bug on a public page, not just inbox noise.How it was fixed
Each cause is now judged on what it actually means.
1. A first bad answer is held back. A result still records honestly what this check saw — the health record does not lie. But a link is reported, and published as a dead citation, only once the previous check saw the same thing. A new
sincefield says how long the answer has held, and the issue body now readsunchanged since <date>.This one rule also settles the session-URL dockets: a redirect counts as "the same answer" only if it points to the same target as last time, so an address that changes every visit never confirms.
2. A redirect onto an interstitial is a refusal, not a move.
unblock.federalregister.govandvalidate.perfdrive.comnow classify asblocked— a state the project already defines as "a person checks this by hand." That is 9 of the 18.3. A DOI that resolves is working. Resolving is a DOI's entire job. Storing where it pointed today would trade a permanent citation for a perishable one, so
doi.organddx.doi.orgareokwhen they resolve — and stillbrokenwhen they don't.4. The fragment is ours, not the server's. Comparison now ignores it, alongside the trailing slash it already ignored.
Classification moved into an exported
classify()so it can be tested directly instead of through a live fetch.The 24 blocked links are deliberately unaffected. They are real 403s, and the project means a person to check them by hand. That was a design decision, not a bug.
Proof it works
verify/tests/pipeline/automation.test.mjs— 16 tests, all passing. Six are new or rewritten, each pinning one of the false positives above against the real URL that produced it:buildLedger(...).deadLinksis empty on the first failure. This is the Mississippi/Montana bug.dms.wyo.govURL from the data.The existing moved-handoff test was extended rather than replaced: it now asserts nothing is reported on the first sighting and everything is on the second.
verify/tests/{core,site,mcp}ledger, limits, and protocol suites: 32/32 passing — the published contract is unchanged (consumers project onlyurl/status/lastOk/usedBy/archive, so the newsince/confirmedfields stay internal). Full unit suite passes.Notes / nits
puco.ohio.govreturns a persistent 404 to our user-agent, so it will confirm and be reported as broken — and published as a dead citation, which it is not. It is genuinely indistinguishable from a dead page without trying a second user-agent, which I did not want to do quietly. Worth a follow-up decision: either retry a confirmed-broken link once with a browser user-agent, or record the state sites known to wall us off.INTERSTITIALSis a two-entry list, not a pattern. It will need an entry when another publisher adopts a different wall. I judged a named list more honest than guessing at a heuristic.🤖 Generated with Claude Code