Live canary: the lnw comment-thread marker still holds #88

Closed
opened 2026-08-11 11:28:09 +07:00 by sulthan · 1 comment
Owner

Parent

#80 (spec) — implements part of #77.

What to build

The Poll's lightnovelworld scan now depends on one marker string surviving in the Site's markup. When that marker vanishes the Series are skipped and logged — correct, but silent until a Reader notices their Latest Chapter has stopped moving. Give a maintainer a way to check on demand, without waiting for that report.

An env-gated live test that fetches a real Series page and asserts the marker still occurs exactly once and still follows the last chapter anchor. It skips when its environment variable is unset, so it never runs as part of the ordinary suite — same convention as the existing live browser smoke tests, which skip on an unset variable at the top of the function before touching the network.

Remember the page size when writing the fetch: a truncated read reports the marker as absent when it is present.

Acceptance criteria

  • With the environment variable unset, the test skips and cd backend && go test ./... is unaffected
  • With it set, the test fetches a live Series page and fails if the marker is missing, occurs more than once, or precedes the last chapter anchor
  • The command to run it is discoverable from the test's own doc comment, as the existing smoke tests do it

Blocked by

## Parent #80 (spec) — implements part of #77. ## What to build The Poll's lightnovelworld scan now depends on one marker string surviving in the Site's markup. When that marker vanishes the Series are skipped and logged — correct, but silent until a Reader notices their Latest Chapter has stopped moving. Give a maintainer a way to check on demand, without waiting for that report. An env-gated live test that fetches a real Series page and asserts the marker still occurs exactly once and still follows the last chapter anchor. It skips when its environment variable is unset, so it never runs as part of the ordinary suite — same convention as the existing live browser smoke tests, which skip on an unset variable at the top of the function before touching the network. Remember the page size when writing the fetch: a truncated read reports the marker as absent when it is present. ## Acceptance criteria - [ ] With the environment variable unset, the test skips and `cd backend && go test ./...` is unaffected - [ ] With it set, the test fetches a live Series page and fails if the marker is missing, occurs more than once, or precedes the last chapter anchor - [ ] The command to run it is discoverable from the test's own doc comment, as the existing smoke tests do it ## Blocked by - #87
sulthan added the ready-for-agent label 2026-08-11 11:28:09 +07:00
sulthan self-assigned this 2026-08-11 13:04:15 +07:00
Author
Owner

Landed on main (merge of ticket/88-lnw-marker-canary; commits 78ce251, 3396c50).

backend/internal/latest/smoke_lnw_test.go adds TestSmokeLnwCommentBoundary, gated on SMOKE_LNW_SERIES_URL — the URL of the live Series page to check, read as the first statement of the function, t.Skip when empty. It asserts against the production symbols themselves, lnwCommentMarker and lnwChapterRe, not copies: a canary carrying its own copy of what it guards can pass while the scan is broken. The fetch goes through the package's own TLSFetcher, so it exercises the same path the Poll does (and never needs the browser sidecar), with fetchableSeriesURL gating the supplied URL and a 60s timeout.

Three assertions: the marker occurs exactly once, the last chapter anchor precedes it, and anchors exist before it at all — a marker at byte 200 with nothing before it satisfies the first two and is still catastrophic. Failures carry the observed offsets and body length; that is the whole value of the test.

A challenge, a non-200 or a short body is reported as 'not a marker failure' rather than as a missing marker. Page size is handled explicitly: a 100 KB floor rejects a truncated or challenged read before any marker judgement, since the marker sits at ~94% of these documents.

Verified both ways on the merged base:

  • unset: skips, go test ./... unaffected (all packages ok)
  • set: live PASS against /novel/immortality-simulator/ — marker once at byte 612182 of a 651,795-byte body, no Cloudflare challenge from this IP today
  • red runs demonstrated against mangled bodies and against the homepage ('occurs 0 times') and a 404

Process note: the spec-axis reviewer hung with no activity and was cancelled rather than re-dispatched; I ran the spec review myself against git diff 71a2c8e...HEAD and found it clean — all three acceptance criteria met, no scope creep. The one judgement call is that the default Series URL lives in the doc comment rather than in code, because a code default would make the test run unattended and break the first acceptance criterion.

Landed on main (merge of ticket/88-lnw-marker-canary; commits 78ce251, 3396c50). backend/internal/latest/smoke_lnw_test.go adds TestSmokeLnwCommentBoundary, gated on SMOKE_LNW_SERIES_URL — the URL of the live Series page to check, read as the first statement of the function, t.Skip when empty. It asserts against the production symbols themselves, lnwCommentMarker and lnwChapterRe, not copies: a canary carrying its own copy of what it guards can pass while the scan is broken. The fetch goes through the package's own TLSFetcher, so it exercises the same path the Poll does (and never needs the browser sidecar), with fetchableSeriesURL gating the supplied URL and a 60s timeout. Three assertions: the marker occurs exactly once, the last chapter anchor precedes it, and anchors exist before it at all — a marker at byte 200 with nothing before it satisfies the first two and is still catastrophic. Failures carry the observed offsets and body length; that is the whole value of the test. A challenge, a non-200 or a short body is reported as 'not a marker failure' rather than as a missing marker. Page size is handled explicitly: a 100 KB floor rejects a truncated or challenged read before any marker judgement, since the marker sits at ~94% of these documents. Verified both ways on the merged base: - unset: skips, go test ./... unaffected (all packages ok) - set: live PASS against /novel/immortality-simulator/ — marker once at byte 612182 of a 651,795-byte body, no Cloudflare challenge from this IP today - red runs demonstrated against mangled bodies and against the homepage ('occurs 0 times') and a 404 Process note: the spec-axis reviewer hung with no activity and was cancelled rather than re-dispatched; I ran the spec review myself against git diff 71a2c8e...HEAD and found it clean — all three acceptance criteria met, no scope creep. The one judgement call is that the default Series URL lives in the doc comment rather than in code, because a code default would make the test run unattended and break the first acceptance criterion.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sulthan/mangaBookmark#88