[PR #4550] [MERGED] feat(noodle): new-since-last-visit divider and counter (Slice 8f-5, plus Noodle), and blurred locked teasers #6418

Closed
opened 2026-10-23 04:10:14 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4550
Author: @Gunterlie
Created: 8/4/2026
Status: ✅ Merged
Merged: 8/4/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/noodler-locked-blurred-teaser


📝 Commits (10+)

  • 56a9f1a fix(noodler): restore blurred teasers for locked posts
  • 5bb36d9 feat(noodler): add the new-since-last-visit divider and entry-point counter
  • 3ac7fcb feat(noodle): carry the divider and counter to the public timeline
  • ce40e0d fix(noodle): put the divider on the timeline, not in search results
  • 13d6fd1 fix(noodle): show the timeline counter from NoodleR, and share one count
  • 2868940 Merge branch 'staging' into fix/noodler-locked-blurred-teaser
  • c7793e6 fix(noodle): address review on the unseen divider, teaser fallback, and its tests
  • 306f4c5 Merge remote-tracking branch 'origin/fix/noodler-locked-blurred-teaser' into fix/noodler-locked-blurred-teaser
  • 62b89ab fix(noodle): keep feed-seen timestamps monotonic and type the sharp loader
  • 53b8b89 Merge branch 'staging' into fix/noodler-locked-blurred-teaser

📊 Changes

19 files changed (+759 additions, -107 deletions)

View changed files

📝 .github/plans/noodl-split/noodler-pr-split-living-plan.md (+44 -17)
📝 package.json (+1 -1)
📝 packages/client/src/components/noodle/NoodleHome.tsx (+83 -32)
📝 packages/client/src/components/noodle/NoodleShell.tsx (+45 -0)
📝 packages/client/src/components/noodle/NoodlerHome.tsx (+77 -2)
📝 packages/client/src/components/noodle/NoodlerPostCard.tsx (+12 -5)
📝 packages/client/src/hooks/use-noodle.ts (+22 -1)
📝 packages/client/src/localization/locales/en.json (+2 -0)
📝 packages/server/src/routes/game-assets.routes.ts (+3 -33)
📝 packages/server/src/routes/noodle.routes.ts (+24 -12)
📝 packages/server/src/services/noodle/noodle-noodler-media.ts (+37 -2)
📝 packages/server/src/services/storage/noodle.storage.ts (+15 -1)
➕ packages/server/src/utils/sharp.ts (+36 -0)
📝 packages/shared/src/index.ts (+1 -0)
📝 packages/shared/src/schemas/noodle.schema.ts (+7 -1)
📝 packages/shared/src/types/noodle.ts (+10 -0)
➕ packages/shared/src/utils/noodle-unseen.ts (+81 -0)
➕ scripts/regressions/noodle-feed-seen.regression.ts (+165 -0)
➕ scripts/regressions/noodle-locked-teaser.regression.ts (+94 -0)

📄 Description

Why

Slice 8f-5 — the watching surface. NoodleR gave a returning user no reason to come back and no way to see where they stopped. The plan calls this "the cheapest real win in the document" and split it out specifically so a scope cut could not eat it:

The "new since your last visit" divider plus the entry-point counter costs one stored timestamp per viewer persona and no provider budget, and it is what gives a user a reason to come back at all.

Also carries a side fix found while working in the same files: locked posts had stopped showing a blurred image at all.

8f-5: divider and counter

One timestamp, per viewer persona. noodlerFeedSeenAt joins NoodleAccountSocialSettings next to the existing notificationsReadAt, and rides the account-settings patch route that already exists — no new endpoint. Per persona rather than per user is the plan's explicit requirement, and it matters: NoodleR follows and locked-post access are already persona-scoped, so an account-wide timestamp would let visiting as one persona silently clear another persona's counter despite them having entirely different Following feeds.

It advances only once the feed is actually shown, not on app entry and not while discovery search has replaced the feed — again per the plan. The subtlety that costs a line of thought: advancing the stored timestamp the moment the feed renders would erase the divider out from under the reader, so the value the divider reads is frozen per persona at that moment while the stored one moves on.

The divider sits at the boundary after the run of new posts (the feed is newest-first, so everything new is one contiguous run at the top). It is shown only when there is something on both sides of it — with no older posts it would sit at the bottom labelling nothing, and with no new ones it says nothing.

The counter is a badge on the NoodleR mode toggle, so it is visible from the Noodle side — which is where the user is when they are not already watching NoodleR. It excludes the viewer's own stage profile's posts, which are never "new" to the person who just wrote them, and stays silent for a persona that has never been shown the feed rather than announcing the entire backlog on first run.

countNoodlerPostsSince() lives in packages/shared/src/utils/noodle-unseen.ts — pure, shared, and directly testable rather than buried in a hook.

Carried to public Noodle

Not in the plan — 8f-5 scopes to NoodleR — so flagging it as an explicit addition rather than something folded in silently. The same blind spot exists on Noodle: characters post while you are elsewhere, and nothing tells you how many landed. The existing bell counts things addressed to you (mentions, replies, follows), not new posts in your timeline.

noodleFeedSeenAt is a separate field from noodlerFeedSeenAt, not one shared value — otherwise opening either surface clears the other's counter, which is the same cross-contamination the per-persona scoping exists to prevent.

The one thing that needed real care: Noodle's timeline sorts by latest activity, not creation time. Counting by createdAt would put the divider somewhere other than the boundary the reader sees. So both the count and the divider measure the same value the sort does — a post bumped by a new reply is unseen again. That expression was inline and evaluated twice per comparison; it is now one timelineActivityAt() shared by the sort and both consumers.

The badge and the divider are shared components in NoodleShell rather than a second copy of each.

Side fix: blurred teasers for locked posts

A locked post with an image rendered an empty grey frame. The onboarding wizard, meanwhile, teaches the locked card using a pre-blurred demo image (NoodlerBulkCreatePanel.tsx:77), described there as "what the user is being taught to recognise" — so the tutorial promised something the feed did not deliver.

Slice 8f-2 caused this deliberately, and its reasoning was right as far as it went: "a browser-side blur would still disclose the original image bytes." True — the bytes are in the page. But the remedy was to withhold the image entirely, which removed the teaser as a side effect.

Fixed by blurring server-side instead: readNoodlerLockedTeaser() downscales to 24px before blurring, which makes the derivative destructive rather than merely obscured, and caches it beside the original. resolveReadableNoodlerPost now reports locked rather than refusing, so the access-checked media route can answer a locked viewer with the teaser; resolveGatedNoodlerPost checks the flag, leaving interaction gating unchanged. The viewer projection keeps imageUrl for locked posts only when it points inside the NoodleR media namespace — media stored elsewhere has no derivative and is still withheld. The card's CSS blur drops blur-xl → blur-sm, since it is presentation over an already-blurred image now, not the protection.

Fail-closed throughout: no sharp (Android/Termux has no prebuild), undecodable source, or missing file all serve nothing and leave the empty frame — today's behaviour, never the original.

Also extracted the lazy sharp loader out of game-assets.routes.ts into packages/server/src/utils/sharp.ts rather than copying it. No behaviour change for game assets.

Plan updated

noodler-pr-split-living-plan.md still described 8f-1/2/3/4/8g as unmerged on big-chungus-1; #4515 shipped them on 2026-08-03. The status table and implementation-status section now reflect that, record 8f-5 as done here, and note the locked-media defect so it is not rediscovered. 8f-6 (creator-page operator area, source-changed/source-missing notices) is now the only remaining 8f unit.

Validation already run

pnpm check and pnpm regression:noodle pass on this head. Two new regressions, both wired into regression:noodle:

  • noodle-feed-seen.regression.ts — the timestamps survive a storage round-trip, one persona's visit does not clear another's, a Noodle visit does not disturb the NoodleR timestamp, and the counting rules hold (own posts excluded, no-timestamp means zero, unparseable timestamp means zero, a post exactly at the boundary counts as seen).
  • noodle-locked-teaser.regression.ts — the teaser is not the original bytes, is ≤24px wide and under a quarter the size, is reused from cache without rebuilding, and returns null on an unreadable source. Where sharp cannot load it pins the fail-closed branch instead.

The boxes below are for the human contributor and are intentionally left unchecked.

Test plan

  • pnpm check
  • pnpm regression:noodle
  • Manually verify the divider appears at the right boundary after publishing new posts and returning to the feed, and does not vanish while you are looking at it
  • Manually verify the divider copy and its placement read correctly — it sits below the new run, marking where you stopped; confirm that is the intended reading rather than a label for the posts beneath it
  • Manually verify the counter appears on the NoodleR toggle from the Noodle side and clears after the feed is shown
  • Manually verify persona scoping: visit as persona A, switch to persona B, and confirm B's counter and divider are untouched
  • Manually verify a persona opening NoodleR for the very first time sees no counter and no divider
  • Manually verify entering NoodleR but landing on a creator profile (not the feed) does not clear the counter
  • Manually verify the same divider and counter on the public Noodle timeline
  • Manually verify the two counters are independent: visiting Noodle must not clear the NoodleR count, or vice versa
  • Manually verify a post bumped by a new reply (rather than newly created) is counted and sorted as unseen on Noodle
  • Manually verify opening Noodle on the notifications or profile view does not clear the timeline counter
  • Manually verify a locked NoodleR post with a generated image shows a blurred teaser and reads as "paywalled" rather than broken
  • Manually compare the real blurred teaser against the wizard's pre-blurred Mari teaser — different means of production, so blur radius or teaser width may need tuning to match
  • Manually verify unlocking or subscribing swaps the teaser for the sharp original
  • Manually confirm devtools/network on a locked post exposes only the ~24px derivative, never the original
  • Manually verify deleting a post removes both the media file and its .teaser.jpg
  • Manually verify light and dark themes on the divider, the badge, and the locked card
  • Verify game-asset image metadata still works after the sharp loader extraction

Summary by CodeRabbit

New Features

  • Added unseen-post counts to Noodle and NoodleR mode controls, capped at 99+.
  • Added “since last visit” dividers for newly arrived feed posts.
  • Feed visits are tracked independently for Noodle and NoodleR.
  • Locked NoodleR media now displays blurred teasers while protected originals remain inaccessible.

Bug Fixes

  • Improved feed ordering to account for reply activity.
  • Standardized blurred presentation for unrevealed locked images.

Tests

  • Added regression coverage for feed-seen tracking and locked-media teasers.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/4550 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 8/4/2026 **Status:** ✅ Merged **Merged:** 8/4/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/noodler-locked-blurred-teaser` --- ### 📝 Commits (10+) - [`56a9f1a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/56a9f1ae45dbb32d876451d373589bf9f8086fd2) fix(noodler): restore blurred teasers for locked posts - [`5bb36d9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5bb36d918a603defbc61d83ddc3559aac65bea6a) feat(noodler): add the new-since-last-visit divider and entry-point counter - [`3ac7fcb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3ac7fcbb6c4003b7223683241fd45b87db4f9d40) feat(noodle): carry the divider and counter to the public timeline - [`ce40e0d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ce40e0d5da90a3f8de993b226296585b37f53b10) fix(noodle): put the divider on the timeline, not in search results - [`13d6fd1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/13d6fd165397d8587dfce05e87b0ac5bcb544228) fix(noodle): show the timeline counter from NoodleR, and share one count - [`2868940`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2868940dfcd52ff7801b0a7e08ade583b53b5254) Merge branch 'staging' into fix/noodler-locked-blurred-teaser - [`c7793e6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c7793e6ffc9515151187f71e07272f78b77acb76) fix(noodle): address review on the unseen divider, teaser fallback, and its tests - [`306f4c5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/306f4c5fb92f2bab38ad610b03139aad4e90fdcc) Merge remote-tracking branch 'origin/fix/noodler-locked-blurred-teaser' into fix/noodler-locked-blurred-teaser - [`62b89ab`](https://github.com/Pasta-Devs/Marinara-Engine/commit/62b89abfd8748bf447764cd2214c90c4b9df7c29) fix(noodle): keep feed-seen timestamps monotonic and type the sharp loader - [`53b8b89`](https://github.com/Pasta-Devs/Marinara-Engine/commit/53b8b89f2227cb62b622a4201eb7a75abbbd2480) Merge branch 'staging' into fix/noodler-locked-blurred-teaser ### 📊 Changes **19 files changed** (+759 additions, -107 deletions) <details> <summary>View changed files</summary> 📝 `.github/plans/noodl-split/noodler-pr-split-living-plan.md` (+44 -17) 📝 `package.json` (+1 -1) 📝 `packages/client/src/components/noodle/NoodleHome.tsx` (+83 -32) 📝 `packages/client/src/components/noodle/NoodleShell.tsx` (+45 -0) 📝 `packages/client/src/components/noodle/NoodlerHome.tsx` (+77 -2) 📝 `packages/client/src/components/noodle/NoodlerPostCard.tsx` (+12 -5) 📝 `packages/client/src/hooks/use-noodle.ts` (+22 -1) 📝 `packages/client/src/localization/locales/en.json` (+2 -0) 📝 `packages/server/src/routes/game-assets.routes.ts` (+3 -33) 📝 `packages/server/src/routes/noodle.routes.ts` (+24 -12) 📝 `packages/server/src/services/noodle/noodle-noodler-media.ts` (+37 -2) 📝 `packages/server/src/services/storage/noodle.storage.ts` (+15 -1) ➕ `packages/server/src/utils/sharp.ts` (+36 -0) 📝 `packages/shared/src/index.ts` (+1 -0) 📝 `packages/shared/src/schemas/noodle.schema.ts` (+7 -1) 📝 `packages/shared/src/types/noodle.ts` (+10 -0) ➕ `packages/shared/src/utils/noodle-unseen.ts` (+81 -0) ➕ `scripts/regressions/noodle-feed-seen.regression.ts` (+165 -0) ➕ `scripts/regressions/noodle-locked-teaser.regression.ts` (+94 -0) </details> ### 📄 Description ## Why **Slice 8f-5 — the watching surface.** NoodleR gave a returning user no reason to come back and no way to see where they stopped. The plan calls this "the cheapest real win in the document" and split it out specifically so a scope cut could not eat it: > The "new since your last visit" divider plus the entry-point counter costs one stored timestamp per viewer persona and no provider budget, and it is what gives a user a reason to come back at all. Also carries a side fix found while working in the same files: locked posts had stopped showing a blurred image at all. ## 8f-5: divider and counter **One timestamp, per viewer persona.** `noodlerFeedSeenAt` joins `NoodleAccountSocialSettings` next to the existing `notificationsReadAt`, and rides the account-settings patch route that already exists — no new endpoint. Per *persona* rather than per user is the plan's explicit requirement, and it matters: NoodleR follows and locked-post access are already persona-scoped, so an account-wide timestamp would let visiting as one persona silently clear another persona's counter despite them having entirely different Following feeds. **It advances only once the feed is actually shown**, not on app entry and not while discovery search has replaced the feed — again per the plan. The subtlety that costs a line of thought: advancing the stored timestamp the moment the feed renders would erase the divider out from under the reader, so the value the divider reads is frozen per persona at that moment while the stored one moves on. **The divider** sits at the boundary after the run of new posts (the feed is newest-first, so everything new is one contiguous run at the top). It is shown only when there is something on both sides of it — with no older posts it would sit at the bottom labelling nothing, and with no new ones it says nothing. **The counter** is a badge on the NoodleR mode toggle, so it is visible from the *Noodle* side — which is where the user is when they are not already watching NoodleR. It excludes the viewer's own stage profile's posts, which are never "new" to the person who just wrote them, and stays silent for a persona that has never been shown the feed rather than announcing the entire backlog on first run. `countNoodlerPostsSince()` lives in `packages/shared/src/utils/noodle-unseen.ts` — pure, shared, and directly testable rather than buried in a hook. ## Carried to public Noodle Not in the plan — 8f-5 scopes to NoodleR — so flagging it as an explicit addition rather than something folded in silently. The same blind spot exists on Noodle: characters post while you are elsewhere, and nothing tells you how many landed. The existing bell counts things *addressed to you* (mentions, replies, follows), not new posts in your timeline. `noodleFeedSeenAt` is a **separate field** from `noodlerFeedSeenAt`, not one shared value — otherwise opening either surface clears the other's counter, which is the same cross-contamination the per-persona scoping exists to prevent. The one thing that needed real care: Noodle's timeline sorts by **latest activity**, not creation time. Counting by `createdAt` would put the divider somewhere other than the boundary the reader sees. So both the count and the divider measure the same value the sort does — a post bumped by a new reply is unseen again. That expression was inline and evaluated twice per comparison; it is now one `timelineActivityAt()` shared by the sort and both consumers. The badge and the divider are shared components in `NoodleShell` rather than a second copy of each. ## Side fix: blurred teasers for locked posts A locked post with an image rendered an empty grey frame. The onboarding wizard, meanwhile, teaches the locked card using a **pre-blurred** demo image (`NoodlerBulkCreatePanel.tsx:77`), described there as "what the user is being taught to recognise" — so the tutorial promised something the feed did not deliver. Slice 8f-2 caused this deliberately, and its reasoning was right as far as it went: *"a browser-side blur would still disclose the original image bytes."* True — the bytes are in the page. But the remedy was to withhold the image entirely, which removed the teaser as a side effect. Fixed by blurring **server-side** instead: `readNoodlerLockedTeaser()` downscales to 24px *before* blurring, which makes the derivative destructive rather than merely obscured, and caches it beside the original. `resolveReadableNoodlerPost` now reports `locked` rather than refusing, so the access-checked media route can answer a locked viewer with the teaser; `resolveGatedNoodlerPost` checks the flag, leaving interaction gating unchanged. The viewer projection keeps `imageUrl` for locked posts **only** when it points inside the NoodleR media namespace — media stored elsewhere has no derivative and is still withheld. The card's CSS blur drops `blur-xl` → `blur-sm`, since it is presentation over an already-blurred image now, not the protection. Fail-closed throughout: no `sharp` (Android/Termux has no prebuild), undecodable source, or missing file all serve nothing and leave the empty frame — today's behaviour, never the original. Also extracted the lazy `sharp` loader out of `game-assets.routes.ts` into `packages/server/src/utils/sharp.ts` rather than copying it. No behaviour change for game assets. ## Plan updated `noodler-pr-split-living-plan.md` still described 8f-1/2/3/4/8g as unmerged on `big-chungus-1`; #4515 shipped them on 2026-08-03. The status table and implementation-status section now reflect that, record 8f-5 as done here, and note the locked-media defect so it is not rediscovered. **8f-6** (creator-page operator area, source-changed/source-missing notices) is now the only remaining 8f unit. ## Validation already run `pnpm check` and `pnpm regression:noodle` pass on this head. Two new regressions, both wired into `regression:noodle`: - `noodle-feed-seen.regression.ts` — the timestamps survive a storage round-trip, one persona's visit does not clear another's, a Noodle visit does not disturb the NoodleR timestamp, and the counting rules hold (own posts excluded, no-timestamp means zero, unparseable timestamp means zero, a post exactly at the boundary counts as seen). - `noodle-locked-teaser.regression.ts` — the teaser is not the original bytes, is ≤24px wide and under a quarter the size, is reused from cache without rebuilding, and returns null on an unreadable source. Where `sharp` cannot load it pins the fail-closed branch instead. The boxes below are for the human contributor and are intentionally left unchecked. ## Test plan - [x] `pnpm check` - [x] `pnpm regression:noodle` - [x] Manually verify the divider appears at the right boundary after publishing new posts and returning to the feed, and does **not** vanish while you are looking at it - [x] Manually verify the divider copy and its placement read correctly — it sits *below* the new run, marking where you stopped; confirm that is the intended reading rather than a label for the posts beneath it - [x] Manually verify the counter appears on the NoodleR toggle from the Noodle side and clears after the feed is shown - [x] Manually verify persona scoping: visit as persona A, switch to persona B, and confirm B's counter and divider are untouched - [x] Manually verify a persona opening NoodleR for the very first time sees no counter and no divider - [x] Manually verify entering NoodleR but landing on a creator profile (not the feed) does not clear the counter - [x] Manually verify the same divider and counter on the **public Noodle** timeline - [x] Manually verify the two counters are independent: visiting Noodle must not clear the NoodleR count, or vice versa - [x] Manually verify a post bumped by a new reply (rather than newly created) is counted and sorted as unseen on Noodle - [x] Manually verify opening Noodle on the notifications or profile view does not clear the timeline counter - [x] Manually verify a locked NoodleR post with a generated image shows a blurred teaser and reads as "paywalled" rather than broken - [x] Manually compare the real blurred teaser against the wizard's pre-blurred Mari teaser — different means of production, so blur radius or teaser width may need tuning to match - [x] Manually verify unlocking or subscribing swaps the teaser for the sharp original - [ ] Manually confirm devtools/network on a locked post exposes only the ~24px derivative, never the original - [ ] Manually verify deleting a post removes both the media file and its `.teaser.jpg` - [x] Manually verify light and dark themes on the divider, the badge, and the locked card - [ ] Verify game-asset image metadata still works after the `sharp` loader extraction <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## New Features - Added unseen-post counts to Noodle and NoodleR mode controls, capped at 99+. - Added “since last visit” dividers for newly arrived feed posts. - Feed visits are tracked independently for Noodle and NoodleR. - Locked NoodleR media now displays blurred teasers while protected originals remain inaccessible. ## Bug Fixes - Improved feed ordering to account for reply activity. - Standardized blurred presentation for unrevealed locked images. ## Tests - Added regression coverage for feed-seen tracking and locked-media teasers. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:10:14 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6418
No description provided.