Skip to content

fix(portuguese/tsundoku): parse DD/MM/YYYY chapter dates - #2676

Open
RibatTRW wants to merge 3 commits into
lnreader:masterfrom
RibatTRW:fm/lnreader-tsundoku-parse
Open

RibatTRW wants to merge 3 commits into
lnreader:masterfrom
RibatTRW:fm/lnreader-tsundoku-parse

Conversation

@RibatTRW

@RibatTRW RibatTRW commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Fix the broken tsundoku source so a reader can open its novels again, and include screenshots of the working fix in the PR.

plugins/portuguese/tsundoku.ts fails at its own live check at parseNovel with Invalid time value, while the site's list page answers 200 with about 100 KB. So the site is up and serving listings - a date field the plugin parses with dayjs has changed shape and now throws. This is one of the plugins this fleet's plugin health sweep confirmed as genuinely broken today (not a site-side block).

Make sure the fix's pull request shows a photo of the plugin working correctly inside the plugin playground, and run that screenshot process headless if possible.

What Changed

  • parseDate in plugins/portuguese/tsundoku.ts now accepts only DD/MM/YYYY chapter dates and rejects impossible calendar dates (for example 31/02/2026). Anything else returns null instead of throwing, so a chapter with an unrecognised date loads without a release time rather than failing parseNovel with Invalid time value.
  • The legacy Portuguese month-name parsing (janeiro, fevereiro, ...) is removed, since the site no longer emits those dates.
  • Plugin version bumped from 1.0.1 to 1.0.2.

Risk Assessment

✅ Low: The change is confined to one date-parsing method in a single standalone plugin, the review-2 calendar-rollover guard holds for the cases I traced (31/02, 29/02 in a non-leap year, day 00, month 00), and no unrequested behavior remains.

Testing

Baseline: check:plugin passes on the target commit and reproduces the reported Invalid time value failure on the base commit. Driven live: the playground Parse Novel flow for Tsundoku (novel parses, 115 chapters with release dates, headless screenshot captured), plus in-page and Node probes of parseDate for the calendar and malformed-date guards, which return null without throwing or rolling over. Overall the fix restores parsing and the guards hold. Parse Chapter is covered by the live check against the real site rather than a separate playground drive.

  • Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Reader opens tsundoku novel 86: Oitenta e Seis (parseNovel) without 'Invalid time value' on the target commit ✅ pass live check:plugin parseNovel PASS (115 chapters); playground screenshot tsundoku-parse-novel-fixed.png
Same live check on base commit reproduces the failure ✅ pass live check:plugin on base-commit copy: parseNovel FAIL 'Invalid time value'
Chapter table shows real release dates from the DD/MM/YYYY field ✅ pass live playground snapshot and screenshot: Release Time column, First Chapter Jun 23, 2024, Last Updated Jul 17, 2024
Adversarial: calendar-impossible 31/02/2024 returns null instead of rolling over to 2024-03-02 ✅ pass live in-page probe of served plugin module: parseDate('31/02/2024') -> null
Adversarial: malformed or legacy date ('janeiro 5, 2024', '', '00/01/2024') returns null without throwing ✅ pass live in-page probe: 'janeiro 5, 2024' -> null, '' -> null; Node probe '00/01/2024' -> null
Valid leap day 29/02/2024 parses; 29/02/2023 rejected ✅ pass live in-page '29/02/2024' -> 2024-02-28T16:00Z; Node '29/02/2023' -> null
Reader opens a chapter (parseChapter) from a fixed novel ✅ pass live check:plugin parseChapter PASS (881 chars) against the real site
  • Evidence: Playground: Tsundoku novel parsed after fix (headless Chromium) (local file: ~/.no-mistakes/evidence/01M4ZNQPN49S5E9EZ2E2X5978T/tsundoku-parse-novel-fixed.png)

Screenshots

These screenshots come from this repository's plugin playground (npm run dev:start), not from the LNReader app. The Android toolchain is not installed on the machine that made this change, so this fix has not been tested in the app.

Captured headless (Chromium driven through chrome-devtools-axi), with the Tsundoku source selected:

Playground Popular list for Tsundoku, with live results

Playground Search for "86: Oitenta e Seis"

Playground Parse Novel: 115 chapters, first chapter Jun 23 2024, last updated Jul 17 2024

Playground chapter list with release times

Playground Parse Chapter: chapter text, 63,447 characters

This PR was written by an AI agent (Claude), and the change and its tests were AI-driven. No human has reviewed it yet.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed (2) ✅
  • ⚠️ plugins/portuguese/tsundoku.ts:42 - Simplification: the legacy month-name date branch (janeiro 5, 2024) and its monthMapping table (lines 16-29, 42-49) are a second date layout the intent does not require. The intent asks only that the current chapter date field, which has changed shape, parse so the novels open again. No source in the diff proves the site still emits the month-name layout. Remove the legacy branch and monthMapping as the smallest remedy; parse only the DD/MM/YYYY form and return null for anything else. If the owner has evidence the old layout is still served, keep it and say so in the PR.

🔧 Fix applied.
2 issues (1 warning, 1 info) still open:

  • ⚠️ plugins/portuguese/tsundoku.ts:42 - Simplification: the legacy month-name date branch (janeiro 5, 2024) and its monthMapping table (lines 16-29, 42-49) are a second date layout the intent does not require. The intent asks only that the current chapter date field, which has changed shape, parse so the novels open again. No source in the diff proves the site still emits the month-name layout. Remove the legacy branch and monthMapping as the smallest remedy; parse only the DD/MM/YYYY form and return null for anything else. If the owner has evidence the old layout is still served, keep it and say so in the PR.
  • ℹ️ plugins/portuguese/tsundoku.ts:22 - parseDate accepts calendar-impossible DD/MM/YYYY dates and silently rolls them over: 31/02/2024 becomes 2024-2-31, which dayjs turns into 2024-03-02 with isValid() true, so the chapter gets a wrong release time instead of null. Only isValid() guards the overflow-free path. Fix: after parsing, check parsed.date() === Number(day) && parsed.month() === Number(month) - 1 (or use a strict format parse) and return null on mismatch. Rare in practice since the site emits real dates.

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Reader opens tsundoku novel 86: Oitenta e Seis (parseNovel) without 'Invalid time value' on the target commit ✅ pass live check:plugin parseNovel PASS (115 chapters); playground screenshot tsundoku-parse-novel-fixed.png
Same live check on base commit reproduces the failure ✅ pass live check:plugin on base-commit copy: parseNovel FAIL 'Invalid time value'
Chapter table shows real release dates from the DD/MM/YYYY field ✅ pass live playground snapshot and screenshot: Release Time column, First Chapter Jun 23, 2024, Last Updated Jul 17, 2024
Adversarial: calendar-impossible 31/02/2024 returns null instead of rolling over to 2024-03-02 ✅ pass live in-page probe of served plugin module: parseDate('31/02/2024') -> null
Adversarial: malformed or legacy date ('janeiro 5, 2024', '', '00/01/2024') returns null without throwing ✅ pass live in-page probe: 'janeiro 5, 2024' -> null, '' -> null; Node probe '00/01/2024' -> null
Valid leap day 29/02/2024 parses; 29/02/2023 rejected ✅ pass live in-page '29/02/2024' -> 2024-02-28T16:00Z; Node '29/02/2023' -> null
Reader opens a chapter (parseChapter) from a fixed novel ✅ pass live check:plugin parseChapter PASS (881 chars) against the real site
  • npm run check:plugin -- plugins/portuguese/tsundoku.ts on the target commit: all four checks PASS (popularNovels 48, searchNovels 1, parseNovel 115 chapters, parseChapter 881 chars).
  • npm run check:plugin on a temporary copy of the base-commit file (49b4727, removed afterwards): parseNovel FAIL with Invalid time value, reproducing the reported failure.
  • npm run dev:start playground Vite bound to 127.0.0.1:3100; Chromium maps localhost:3000 to it via --host-resolver-rules because the playground proxy hard-codes localhost:3000.
  • Headless Chromium via chrome-devtools-axi: opened http://localhost:3000/?plugin=tsundoku, Parse Novel tab, entered /manga/86-oitenta-e-seis/, clicked Fetch. Novel header, 115 chapters, first chapter Jun 23, 2024, last updated Jul 17, 2024, release times in the table. Screenshot captured.
  • In-page probe of the served plugin module calling parseDate: '29/02/2024' valid, '31/02/2024' -> null, '' -> null, 'janeiro 5, 2024' -> null.
  • Node esbuild-bundle probe of parseDate: '00/01/2024' -> null, '29/02/2023' -> null, '31/04/2024' -> null, '1/7/2024' and ' 11/07/2024 ' valid.
  • Site emits DD/MM/YYYY chapter dates (curl of novel page: class chapterdate 17/07/2024).
  • Cleanup: stopped my own Vite and Chromium only (other sessions' processes on 3000, 9333 untouched); npm run clean:multisrc; git status clean.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

The site now shows chapter release dates as DD/MM/YYYY (e.g. "17/07/2024").
parseDate expected "month day, year" text, so the split produced undefined
parts and dayjs(...).toISOString() threw "Invalid time value", failing
parseNovel on every novel.

parseDate now reads DD/MM/YYYY, still accepts the older month-name layout,
and returns null for a missing or unrecognised date instead of throwing.
Version 1.0.1 -> 1.0.2.
@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issue was found.

Summary

Updates TsundokuPlugin.parseDate to read numeric chapter dates and return null for unknown or impossible dates instead of throwing.

  • Tsundoku chapter dates now use day/month/year format.

No actionable issues were found. This review checked the code; it did not repeat the live tests described in the PR.

Reviews (2) · Last reviewed commit: "no-mistakes(review): Reject impossible c..." · Reviewed by Greptile

@RibatTRW
RibatTRW marked this pull request as draft October 15, 2026 12:06
@RibatTRW
RibatTRW marked this pull request as ready for review October 15, 2026 13:22

This branch has not been deployed

No deployments
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