Repository navigation
Conversation
[Medium impact] Changes how the live-check test script reports Cloudflare blocks. Fix response-to-step tracking before merging so a timed-out search cannot hide a real plugin failure. FindingsSummaryThe checker now observes Cloudflare responses during plugin requests and changes affected failed steps to
Reviews (1) · Last reviewed commit: "no-mistakes(document): Document Cloudfla..." · Reviewed by Greptile |
| const res = await originalFetch(...args); | ||
| const step = currentStep; |
There was a problem hiding this comment.
installChallengeDetector reads currentStep after the request finishes. If searchNovels times out, its request keeps running while the checker starts parseNovel. A late Cloudflare response from that search then marks parseNovel as blocked, hiding a real failure there as INCONCLUSIVE.
Capture the step before awaiting the request, and add a test for a late response crossing steps.
| const res = await originalFetch(...args); | |
| const step = currentStep; | |
| const step = currentStep; | |
| const res = await originalFetch(...args); |
There was a problem hiding this comment.
Fixed in 74e8d1a: currentStep is captured before the await, and scripts/live-check-plugin.test.mjs now has a test of a late challenge response crossing steps (fails against the old order, passes with the fix). (AI-assisted: Claude Code.)
| @@ -0,0 +1,97 @@ | |||
| // Run with: node --test scripts/live-check-plugin.test.mjs | |||
There was a problem hiding this comment.
No package script or workflow runs scripts/live-check-plugin.test.mjs. The live-check workflow also skips execution when only checker files change, so these six tests cannot catch regressions automatically.
Add a CI step that runs these local-server tests when the checker or its tests change.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Addressed in 74e8d1a: new workflow .github/workflows/live-check-tests.yml runs node --test scripts/live-check-plugin.test.mjs on pull requests that change the checker, its tests or the workflow itself. The existing live-check workflow is unchanged. I did not add an npm script. (AI-assisted: Claude Code.)
| const originalFetch = globalThis.fetch; | ||
| globalThis.fetch = async (...args) => { | ||
| const res = await originalFetch(...args); | ||
| const step = currentStep; |
There was a problem hiding this comment.
Please capture currentStep before awaiting originalFetch; otherwise a late response can be attributed to the wrong live-check step.
There was a problem hiding this comment.
Done in 74e8d1a: installChallengeDetector now reads currentStep into step before await originalFetch(...), so a late response is attributed to the step that sent it. Added a regression test where a first step's request outlives that step and returns a Cloudflare challenge while the next step runs; the later step's real failure stays FAIL (red against the old order, green with the fix). (AI-assisted: Claude Code.)
There was a problem hiding this comment.
@rajarsheechatterjee this is ready for another look: currentStep is now captured before the await in 74e8d1a9, with a regression test for a late response crossing steps.
…e request Capture currentStep before awaiting the original fetch so a late Cloudflare challenge cannot mark a later step INCONCLUSIVE. Add a regression test for a response crossing steps and run the checker tests in CI when the checker or its tests change.
1483e28 to
74e8d1a
Compare
Summary
On GitHub's runners Cloudflare can block every HTML page of a source, while the checker's root reachability probe (HEAD of the site root) still succeeds.
fetchApireturns theResponsefor any status and never throws, so a Cloudflare challenge page parses to zero novels and the live check reports FAIL ("Returned no novels") instead of "could not test". This makes the shared Plugin Live Check report those steps as INCONCLUSIVE. Failing run that motivated it: https://github.com/lnreader/lnreader-plugins/actions/runs/38055684264.What Changed
scripts/live-check-plugin.jsnow wraps the globalfetchduring each step to spot Cloudflare challenge responses (cf-mitigated: challenge, or a 403/503 carryingcf-*headers) on the plugin's own page loads. A step that would otherwiseFAILafter such a response is reclassified asINCONCLUSIVEwith a "Blocked by Cloudflare" detail. Passing steps and failures with no observed challenge are unchanged.describeCloudflareChallenge,installChallengeDetectorandcheckPlugin, and only runsmain()when executed directly, so it can be imported by tests.scripts/live-check-plugin.test.mjs, which covers the new detection and reclassification logic. Updated theINCONCLUSIVEdescription indocs/testing.mdto mention challenge pages served for a plugin's page loads.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The change is confined to the live-check script and only downgrades FAIL to INCONCLUSIVE when a Cloudflare challenge response was seen during that step; its tests run the real checker against a local server.
Testing
The tests in
scripts/live-check-plugin.test.mjspass. They run the realcheckPluginagainst local HTTP servers that serve a challenge as 403 or 200, a 403 with Cloudflare headers, an empty result, a plain 403 and a passing page. I also ran the checker as a CLI against a local server that returns a Cloudflare challenge on its list page while the root probe succeeds. The report showed INCONCLUSIVE ("Blocked by Cloudflare…"), "no hard failures" and exit code 0. I did not test against the real royalroad.com. The worktree stayed clean.Evidence: CLI report for a challenged plugin
Review follow-up: late responses and test wiring
installChallengeDetectornow readscurrentStepbefore awaitingoriginalFetch, so a response is attributed to the step that sent the request (review comment from @rajarsheechatterjee and the matching Greptile P1).scripts/live-check-plugin.test.mjs: a first step's request is still in flight when the step ends, the next step starts, then the first request returns a Cloudflare challenge. The later step's real failure must stay FAIL. It uses a local server gate, no timers. Against the old order it fails (6 of 7 pass); with the fix all 7 pass..github/workflows/live-check-tests.ymlrunsnode --test scripts/live-check-plugin.test.mjson pull requests that touch the checker, its tests or the workflow (Greptile P2: the tests were not run anywhere). The existing live-check workflow is unchanged.Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
package.json- No package script or workflow runs scripts/live-check-plugin.test.mjs (the Greptile P2 on the PR). Tests only run vianode --test scripts/live-check-plugin.test.mjs. Adding atest:live-checkscript and a CI step needs a maintainer decision.currentStepafter the await), the late-response test fails, so the test detects the bugnode --test scripts/live-check-plugin.test.mjspassnpm ci --ignore-scriptsnode --test scripts/live-check-plugin.test.mjsTemporarily reverted the fix (capturecurrentStepafter the await), reran the tests, then restored the file✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.