Skip to content

Treat a missing MangaPlus expiry as unknown, not as expired in 1970 - #507

Merged
ArdaxHz merged 1 commit into
mainfrom
fix-mangaplus-missing-expiry
Sep 8, 2026
Merged

ArdaxHz merged 1 commit into
mainfrom
fix-mangaplus-missing-expiry

Conversation

@ArdaxHz

@ArdaxHz ArdaxHz commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator

What

chapterExpire fell back to DEFAULT_TIMESTAMP (epoch second 1) when endTimeStamp was absent. proto3 drops zero values, so a chapter that never rotates out of the free window arrives with the field missing — and stood in as 1, it reads as "expired in 1970".

Why it matters

Already wrong today: the filter in collect skips anything whose expiry has passed, so such a chapter is silently never uploaded.

Worse alongside #137, which removes a chapter the publisher still lists once its expiry is behind us — the chapters that are free forever are exactly the ones it would card.

A missing expiry is now null and stays null through toChapterInput; the chapter contract already allows it (records.ts: .nullable().default(null)). The decision moves into hasExpired so the rule is one testable line.

Not claimed

This does not make expiry a paywall oracle. availability.ts already documents the far-future sentinel (2145884400) MangaPlus puts on subscriber-only chapters, which no expiry check can catch. This only stops the absent case from lying.

Testing

src/expiry.test.ts covers past, future, exactly-now, and the absent case that motivated it. 62 tests pass; both typecheck configs clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K2GWZ284dc6s3znLsavYrS

`chapterExpire` fell back to DEFAULT_TIMESTAMP (epoch second 1) when
`endTimeStamp` was absent. proto3 drops zero values, so a chapter that never
rotates out of the free window arrives with the field missing -- and stood in
as 1, it reads as "expired in 1970".

That was already wrong: the filter in `collect` skips anything whose expiry has
passed, so such a chapter was silently never uploaded. It becomes dangerous
alongside the platform's new paywalled pass, which hard-deletes a chapter the
publisher still lists once its expiry is behind us: the chapters that are free
forever are exactly the ones it would delete.

A missing expiry is now null and stays null through `toChapterInput`, which the
chapter contract already allows. The decision moves into `hasExpired` so the
rule is one testable line rather than an inline comparison, and null reads as
"no expiry stated" everywhere it is asked.

Note this does not make expiry a paywall oracle -- `availability.ts` documents
the far-future sentinel MangaPlus puts on subscriber-only chapters, which no
expiry check can catch. It only stops the absent case from lying.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K2GWZ284dc6s3znLsavYrS
@ArdaxHz
ArdaxHz marked this pull request as ready for review September 8, 2026 13:59
@ArdaxHz
ArdaxHz merged commit d6185d3 into main Sep 8, 2026
5 checks passed
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