Skip to content

[Measurement run – do not merge] STORY-142: Save for later + private Reading list (frontend, Fusion) - #84

Closed
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/story-142-fusion
Closed

devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/story-142-fusion

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

[Measurement run – do not merge] STORY-142 Fusion measurement rerun. Implemented fresh from main; does not reuse, rebase or reference code from the earlier-run PRs.

Story: STORY-142 (coordinated from parent session https://devin-gtm.devinenterprise.com/sessions/1ab6e443eb49449d9482f7c1a6d9e583). Backend PR for this run: COG-GTM/spring-boot-realworld-example-app#1203 (also a separate measurement rerun, draft). E2E evidence and screenshots will also be added by the coordinator.

Summary

Adds a private Save for later toggle and an own-profile Reading list tab. Built against the shared contract:

POST   /articles/:slug/bookmark      -> { article }   // article.bookmarked: viewer-specific boolean
DELETE /articles/:slug/bookmark      -> { article }
GET    /articles/bookmarked?limit&offset -> { articles, articlesCount }   // current user only, newest saved first

(All require auth. There is no public count.)

  • Article.bookmarked: boolean (required). New ArticlesService.bookmark / unbookmark / queryBookmarked(limit, offset).
  • BookmarkButtonComponent (app-bookmark-button) shows an amber outlined "🔖 Save" or a filled "🔖 Saved". It sits next to Favorite in both the banner and the bottom action rows on the article page, for readers and anonymous users. Unlike FavoriteButtonComponent, which reads isAuthenticated (false while auth is loading), it waits for authState !== 'loading' and takes one value. Then:
    • unauthenticated navigates to /login, as does a 401 from the API.
    • unavailable and other errors show an inline role="alert" message and keep the previous state.
    • While a request is in flight, the button is disabled and aria-busy is set.
  • Route profile/:username/reading-list uses readingListGuard, which waits for auth init so a persisted session isn't bounced on reload. Anonymous users go to /login; any other username goes to /profile/:username. It also sets runGuardsAndResolvers: 'always', so the guard runs again when Angular reuses the route for a different username.
  • ProfileReadingListComponent keeps the API order and pages 10 at a time.
    • Unsave removes the card immediately and decrements articlesCount, which updates the pager. If items remain beyond the current page, it refetches in the background to fill the gap. If the page becomes empty, it goes back one page.
    • Empty state text is exactly: Nothing saved yet. Use 🔖 Save on any article.
    • A failed load shows an error with a Retry button.
    • Guards only run on navigation, so the component also watches authState/currentUser. If the viewer logs out (or a 401 purges the session) or the current account changes while the list is open, it clears the results and goes to /login or the new user's profile.
  • ProfileComponent now reads route.paramMap (it used to read snapshot). The articles and favorites tabs do the same. Without this, going from /profile/ana to /profile/eric on a reused route kept the old profile and its isUser flag, which could leave the Reading list tab visible on someone else's profile.
  • Design parity: the tabs now read My Articles / Favorited Articles / Reading list, the active Reading list tab has amber text over the theme's green underline, and the article banner is dark (#333). The theme's banner is white.
  • Baseline fix: every existing spec imports zone.js, but package.json did not list it, so all 6 spec files failed to resolve it on main. This PR adds zone.js ~0.16.0 as a devDependency. The bun.lock change is limited to that one line; the lockfile's stale @angular/core entry is left alone.
  • api.interceptor.ts is not modified.

Validation (shell)

  • bun run test -- --run: 10 files, 210 passed. main had 180 tests, all blocked by the zone.js import. The 30 new tests cover:
    • HTTP contract: 4
    • Button: 9 (success, error, 401, anonymous redirect, waiting for auth loading, in-flight)
    • Guard: 5 (owner, other user, anonymous, waiting for loading, unavailable)
    • List: 9 (order, empty text, unsave, unsave error, pagination, backfill, retry, logout while open, account switch while open)
    • Profile tabs: 3 (own, other user via reused route, anonymous)
  • bun run build: succeeds with no warnings.
  • npx tsc -p tsconfig.app.json --noEmit: clean.
  • bun run format:check: clean.

Not covered here: running the app against the real backend. The coordinator handles that.

Devin-Org: engineering

Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/bb2f2df700d749dc9ba3497b2efb0838
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/bb2f2df700d749dc9ba3497b2efb0838?variant=devin


Devin Review

Status Commit
⚪ Not started —

Run Devin Review

Enable auto-review to review your pull requests automatically.

Devin Review (Staging)

- Article.bookmarked + ArticlesService bookmark/unbookmark/queryBookmarked
- Amber Save/Saved toggle next to Favorite on the article page (anonymous -> /login)
- Own-profile Reading list tab guarded against other usernames, with unsave/pagination/empty state
- Profile tabs react to username param changes; dark article banner per design
- Add zone.js devDependency so existing specs resolve it

Co-Authored-By: Pedro Tabio <paltat@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration

Copy link
Copy Markdown
Author

Real-backend STORY-142 verification passed with signed-in users and SQLite persistence; independent API checks: 24 passed. Supplementary UI pagination/backfill checks also passed. Default external avatars were unavailable.

Saved article
Own private Reading list
Annotated real-backend flow

CI remains red on six existing profile-settings failures; identical failures reproduced on clean main (details and run link in the description).

Not exercised in UI: network-failure/concurrent-mutation scenarios or other browsers.

@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review October 28, 2026 20:27
devin-ai-integration[bot]

This comment was marked as resolved.

…t or switches account

Co-Authored-By: Pedro Tabio <paltat@gmail.com>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

<span class="counter">({{ a.favoritesCount }})</span>
</app-favorite-button>

<app-bookmark-button [article]="a" (toggle)="onToggleBookmark($event)" />

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🟡 Authors cannot save their own articles

For an article's author, canModify() hides both Save buttons behind the reader-only branch. Authors cannot add their own articles to their reading list.

Learn more

Both article action rows render the Save button only when canModify() is false. That signal is true when the signed-in user's username matches the article author's username in ngOnInit. The author branch renders only edit and delete controls, so an author viewing their own article cannot invoke the new bookmark endpoint.

Example: Ana opens an article she published. She sees Edit and Delete in the banner and lower action row, but no Save button; she cannot add the article to her reading list.

Recommended fix: Render app-bookmark-button outside the canModify() alternatives in both action rows, preserving the author-only edit/delete controls and the reader-only follow/favorite controls.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Confirmed: the button sits in the reader branch next to Favorite, so authors don't see it on their own articles. This follows the story brief ("Show Save for anonymous… and readers") and matches how Favorite works. I've asked the coordinator whether authors should get it too. If so, the fix is to move <app-bookmark-button> out of the canModify() branch in both action rows.

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.

0 participants