Skip to content

feat(episodes): add a setting to control the Latest Episodes list length (#114)#200

Merged
chhoumann merged 5 commits into
masterfrom
chhoumann/114-episode-list-length
Jun 16, 2026
Merged

feat(episodes): add a setting to control the Latest Episodes list length (#114)#200
chhoumann merged 5 commits into
masterfrom
chhoumann/114-episode-list-length

Conversation

@chhoumann

Copy link
Copy Markdown
Owner

Summary

Adds an episodeListLimit setting that controls how many of each saved feed's
most recent episodes appear in the aggregated Latest Episodes list (and how
far back the search box reaches when no individual podcast is selected).

Closes #114.

Why

In #114 a user reported that searching the episode list returned far fewer
results than other podcast apps. PodNotes only surfaces the latest 10
episodes per feed in the aggregated Latest Episodes view, and the search box (when
no podcast is selected) searches exactly that set — so older episodes were never
found. There was no way to widen that window.

What changed

  • New episodeListLimit setting (default 10, range 1-75), surfaced in the
    settings tab as "Latest episodes per podcast".
  • The latestEpisodes store now keeps the newest episodeListLimit episodes per
    feed instead of a hard-coded 10, and reacts live to the setting (no reload
    needed).
  • Selecting an individual podcast still shows that feed's full episode list,
    unbounded by this setting — so any one show's complete back catalogue stays
    searchable from its own view.

Default behaviour is unchanged: a fresh or upgraded vault keeps the historical
10-per-feed window.

Review-driven hardening

Two adversarial reviewers (opposite-model) plus an ultracode review pass surfaced
several real issues, all addressed here:

  • Cache-cap coherence: the persisted feed cache only retains 75 episodes per
    feed, so a larger limit could never be served on a warm start. The max is
    aligned to that cap (75), with a cross-reference comment so the two can't drift.
  • "Most recent" correctness: the per-feed slice now ranks the whole feed by
    date before truncating, so it keeps the newest episodes even when a feed (or
    cache) isn't already newest-first.
  • Settings import: importing settings now rehydrates the live episodeListLimit
    store (previously the value was persisted but the open view kept the old limit).
  • Load sanitisation: a malformed persisted value (e.g. 0 from an old
    data.json) is repaired in the settings object on load, not just clamped at
    runtime, so it can't be re-persisted.
  • Input UX: the number input no longer overwrites the saved limit while the
    field is empty/mid-edit, and skips redundant saves.
  • Rebuild path: changing the limit rebuilds the merged list with a single
    sort+slice instead of repeated array copies.

Testing

  • npm run lint, format:check, typecheck, check:a11y, build, test — all
    green (463 tests; new store + sanitize coverage, including an oldest-first feed
    regression test).
  • Real Obsidian (isolated worktree vault), seeded 100-episode feed:
    • default limit 10 → Latest Episodes shows 10; selecting the podcast shows 100.
    • limit 75 → 75; limit 200 → clamped to 75 (and loadSettings repaired
      the persisted value to 75).
    • live settings-tab change 15 → 4 updated the open list immediately, no reload.

Release / migration impact

Additive top-level settings key. loadSettings merges over DEFAULT_SETTINGS, so
existing vaults get episodeListLimit: 10 automatically; the e2e provision seed
(DEFAULT_PODNOTES_DATA) was updated to keep the seed-sync test green.

Note: this branch only adds a new key to DEFAULT_SETTINGS; it does not touch
the feedNote default that #160 is editing, so the two should not conflict.

…der, import, load sanitize)

- Align MAX_EPISODE_LIST_LIMIT with the feed cache's per-feed retention (75) so a
  chosen limit is always serveable from a warm cache; selecting a podcast still
  shows its full archive.
- Sort each feed by date before truncating so the per-feed limit keeps the NEWEST
  episodes even when the feed/cache is not newest-first.
- Rehydrate the episodeListLimit store on settings import (was only persisted).
- Sanitize episodeListLimit in loadSettings so a malformed persisted value is
  repaired in the settings object, not just clamped at runtime.
- Settings input: don't clobber the saved limit on empty/mid-edit input and skip
  redundant saves.
- Rebuild the latest list with a single sort+slice on limit change.

Refs #114
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 16, 2026

Copy link
Copy Markdown

Deploying podnotes with  Cloudflare Pages  Cloudflare Pages

Latest commit: cbcc503
Status: ✅  Deploy successful!
Preview URL: https://e399f8b1.podnotes.pages.dev
Branch Preview URL: https://chhoumann-114-episode-list-l.podnotes.pages.dev

View logs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 609950c3e9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/constants.ts
…114)

Codex review (P2): setCachedEpisodes persisted the first 75 episodes in feed
order, so an oldest-first feed cached its OLDEST episodes. After a warm restart
within the cache TTL, the Latest Episodes list rebuilt from that stale set and
search missed the actual newest episodes. Select the newest 75 by date while
preserving original order (feeds <= the cap are untouched), so the per-feed list
limit is correct for any feed ordering.
@chhoumann

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3808548358

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/services/FeedCacheService.ts
…114)

Codex review (P2): the previous commit changed which episodes the feed cache
retains (newest-by-date instead of first-in-feed-order), but an unexpired v2
entry written by the old code still holds the first 75 feed items. For an
oldest-first feed those are the oldest episodes, so a warm start after upgrade
would keep Latest Episodes/search stuck on stale items until the TTL expired.
Bump the storage key v2 -> v3 (and drop v2 as a legacy key) so the new retention
applies immediately on upgrade, matching the existing v1 -> v2 precedent.
@chhoumann

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: cbcc50336c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chhoumann chhoumann merged commit 7b3e3c6 into master Jun 16, 2026
2 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.

Setting for length of episode-list

1 participant