Skip to content

feat: viewer_anchor_facts edge read model for broken/external links (#114)#159

Merged
YusukeHirao merged 3 commits into
feature/impl-new-dbfrom
feature/114-viewer-anchor-facts
Jul 3, 2026
Merged

feat: viewer_anchor_facts edge read model for broken/external links (#114)#159
YusukeHirao merged 3 commits into
feature/impl-new-dbfrom
feature/114-viewer-anchor-facts

Conversation

@YusukeHirao

Copy link
Copy Markdown
Member

Summary

Benchmark (synthetic archive, no real customer data)

50k pages / 400k anchors: read-model build +5.9s, +152 MiB on disk. /api/links?type=broken fast path: warm p50 1.2ms, p95 1.2-1.8ms across all 5 sort/direction combinations (previously 13-16s via the legacy anchor scan).

Test plan

  • yarn build (+ direct tsc --noEmit on query/viewer)
  • yarn test — 303 files / 2431 passed, 5 skipped
  • yarn lint — clean
  • yarn workspace @nitpicker/viewer test:e2e — 46/46 passed (Broken Links view unchanged visually)
  • /code-review xhigh, /qa-engineer, /product-manager, /doc — findings applied
  • CI green

🤖 Generated with Claude Code

Records the read/write/storage-optimized design for broken/external link
listing, superseding the destination-summary-only approach from PR #157.
…#114)

Add viewer_anchor_facts, an edge-deduped (source_page_id, dest_page_id)
table backing a new cursor-paginated listViewerBrokenLinks fast path, and
derive viewer_external_links from the same single anchors scan instead of a
separate GROUP BY + COUNT(DISTINCT) query. Bumps
VIEWER_READ_MODEL_SCHEMA_VERSION to 6.
… path

/api/links?type=broken now dispatches to the cursor-paginated
listViewerBrokenLinks when the read model is current, falling back to the
legacy offset-based listLinks otherwise. useLinksInfinite switches its
virtual-scroll pageParam from offset to the server-issued nextCursor to
match.
@YusukeHirao YusukeHirao merged commit 76e1115 into feature/impl-new-db Jul 3, 2026
4 checks passed
@YusukeHirao YusukeHirao deleted the feature/114-viewer-anchor-facts branch July 3, 2026 14:22
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