Skip to content

Make @/lib/reviews the single entry point for reviews - #23

Merged
haroldadmin merged 5 commits into
mainfrom
claude/awesome-johnson-3ygn2u
Oct 28, 2026
Merged

haroldadmin merged 5 commits into
mainfrom
claude/awesome-johnson-3ygn2u

Conversation

@haroldadmin

Copy link
Copy Markdown
Owner

First domain in the data layer cleanup: reviews are now read, validated, and written only through @/lib/reviews (and @/lib/reviews/shared for client components).

  • load* reads take a labelled filter. A separate loadLabelledUris lookup drives moderation notices.
  • Reviews take a generic subject, not a route.
  • Input is validated with a Zod schema.
  • saveReview and deleteReview handle the account writes and return typed failure reasons.
  • Database functions accept an AbortSignal. Key lookups default to a short timeout.
  • Tests run against Postgres via Testcontainers, so CI's test step now needs Docker.
  • AGENTS.md documents data access and test conventions.

Generated by Claude Code

Reviews are now read, validated, and written only through `@/lib/reviews`
(server) and `@/lib/reviews/shared` (client-safe), enforced by a lint rule.

- Reads are `load*` functions that take a `labelled` filter, so callers
  decide whether they want labelled reviews. `Review` no longer carries a
  `labelled` flag; `loadLabelledUris` in `@/lib/moderation` answers which
  records are labelled when a page needs to show a notice.
- Reviews take a subject (strong ref) instead of knowing about routes. The
  self-review rule uses the DID in the subject's URI rather than a join.
- Input is validated with a Zod schema that requires text.
- `saveReview` and `deleteReview` own the repository writes and return
  typed failure reasons; the server actions map those to messages.
- Adds `assertSession`, `Viewer`, and `parseRecordUri`.
- Adds tests that run against a Postgres container with the real migrations
  applied (Testcontainers), and a fake account for writes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M9KZ6SDuRW4inA7dgB2nYh
- Generate TIDs with @atproto/common-web and CIDs with @atproto/lex
  instead of hand-rolled or hardcoded values.
- Rename the `route` test helper to `routeSubject`.
- Apply migrations through Kysely's Migrator.
- Drop an unneeded comment in the review actions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M9KZ6SDuRW4inA7dgB2nYh
- Database functions take an optional AbortSignal and cancel the query in
  Postgres when it aborts. Key lookups default to a 1s timeout.
- Parse AT URIs with AtUri from @atproto/syntax.
- Show the viewer's own review first on a route page instead of merging it
  into the list by date.
- Replace the import lint rule with data access guidance in AGENTS.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M9KZ6SDuRW4inA7dgB2nYh
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M9KZ6SDuRW4inA7dgB2nYh
ssh2 and cpu-features only speed up SSH connections to remote Docker
hosts, so their build scripts are skipped like the other entries. CI's
install failed with ERR_PNPM_IGNORED_BUILDS without them listed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M9KZ6SDuRW4inA7dgB2nYh
@haroldadmin
haroldadmin added this pull request to stack #26 October 28, 2026 17:38
@haroldadmin
haroldadmin merged commit c12a15c into main Oct 28, 2026
4 checks passed
@haroldadmin
haroldadmin deleted the claude/awesome-johnson-3ygn2u branch October 28, 2026 19:20
haroldadmin added a commit that referenced this pull request Oct 28, 2026
Stacked on #23. Applies the same data access cleanup to profiles:
everything goes through `@/lib/profiles` (and `@/lib/profiles/shared`
for client components).

- `fetchProfile`, `fetchProfiles` and `fetchUserProfile` combine indexed
profiles with Bluesky handles, and accept an `AbortSignal`.
- `fetchAvatar` owns the avatar lookup and format policy, and returns
typed failure reasons.
- `fetchProfileRecord`, `saveProfile` and `ensureProfileRecord` own
profile record writes. This replaces `auth/declaration.ts`.
- Profile input is validated with a Zod schema.
- `profile-name.ts` and `actor-search.ts` are folded into the module.
- Focused tests, with the fake account moved into a shared test helper.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01M9KZ6SDuRW4inA7dgB2nYh)_

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants