Skip to content

fix: prefer article titles in webfetch#5

Merged
code-yeongyu merged 1 commit into
mainfrom
code-yeongyu/webfetch-title-selector
Jun 26, 2026
Merged

fix: prefer article titles in webfetch#5
code-yeongyu merged 1 commit into
mainfrom
code-yeongyu/webfetch-title-selector

Conversation

@code-yeongyu

@code-yeongyu code-yeongyu commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes a Tistory title regression where a blog-level header <h1> could be chosen before the real article title. The reader-mode fallback now scans title selectors in preferred order, so .tit_post and common article title classes win over generic h1 chrome.

Changes

  • Replace DOM-order comma selector title lookup with an ordered TITLE_SELECTORS scan.
  • Apply the same preferred-title lookup to explicit article extraction and Readability fallback.
  • Add markdown and text regressions for a Tistory page where site chrome appears before the article title.

QA / Evidence

  • npm test: 4 files passed, 37 tests passed.
  • npm run check: tsgo --noEmit and biome check . passed.

Risks

  • Low. The fallback still uses the document/Readability title when no preferred selector has text, and the new tests cover the exact chrome-before-article failure mode.

Secret safety

  • No logs, credentials, cookies, or auth-bearing output included.

Summary by cubic

Prefer article titles in webfetch so site-level h1 (e.g., Tistory blog headers) no longer override the real article title. Markdown and text outputs now pick .tit_post and other common article title classes before generic h1 or the document title.

  • Bug Fixes
    • Replaced DOM-order title query with ordered TITLE_SELECTORS and selectPreferredTitle().
    • Applied the same title preference to explicit article extraction and Readability fallback.
    • Added markdown/text tests to cover Tistory pages and prevent chrome-over-article regressions.

Written for commit e2fab0c. Summary will update on new commits.

Review in cubic

Post-merge Audit Addendum

  • Failing-first title-priority proof was captured after merge by applying only the new title tests to the previous implementation commit.
    • External RED artifact: /Users/yeongyu/local-workspaces/senpi-webfetch-tistory-worktree/local-ignore/qa-evidence/20260626-webfetch-title-selector/pi-webfetch-title-red.txt
    • Failure proved the old external implementation selected # 블로그 이름 instead of # 티스토리 본문을 읽어야 합니다.
  • The matching GREEN proof remains the PR validation: npm test passed 37 tests and CI passed on Ubuntu/macOS Node 20/22.

@code-yeongyu code-yeongyu merged commit e449fdc into main Jun 26, 2026
6 checks passed
@code-yeongyu code-yeongyu deleted the code-yeongyu/webfetch-title-selector branch June 26, 2026 03:02
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