Skip to content

lua: move seven list endpoints onto shared list helpers - #92

Merged
Kzoeps merged 3 commits into
mainfrom
lua/list-helpers-batch2
Nov 18, 2026
Merged

Kzoeps merged 3 commits into
mainfrom
lua/list-helpers-batch2

Conversation

@Kzoeps

@Kzoeps Kzoeps commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #91.

Problem

Seven list endpoints still carried their own copies of cursor decoding, IN (...) loops, created_at sort SQL, cursor encoding and limit/sortDirection parsing.

Fix

  • Move activityList, attachmentList, collectionList, entityFollowPagination, evaluationList, feedReaction and fundingReceiptList onto decode_cursor, add_in, created_at_sort, cursor_encode, parse_sort_direction and parse_list_limit. collectionItems uses the shared limit parser; its cursor decoder is unchanged.
  • Drop entity_follow_sort_key (an exact copy of created_at_sort()) and the collection-local invalid/keys_only/scalar copies in favour of query.lua. A small wrapper keeps the boolean hasOrganizationRecord behaviour.
  • searchBadgeDefinitions reuses the URI check from badgeDefinitionValidation.lua.
  • No behaviour change: the SQL golden from tests: add list endpoint SQL golden safety net #90 is unchanged. EXISTS and compound filters keep their own bind helpers.

Summary by CodeRabbit

  • Bug Fixes
    • Improved pagination cursor validation across activity, collection, attachment, evaluation, receipt, follow, and reaction lists. Invalid or malformed cursors are rejected more consistently.
    • Updated list ordering to use valid record timestamps, with a fallback when those timestamps are missing or invalid.
    • Standardized filtering and request validation across list and search endpoints, including handling of empty filters and invalid limits.

@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
api-endpoints Skipped Skipped Nov 18, 2026 3:41pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d2d4808

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

List endpoints now use shared helpers for request validation, cursor handling, SQL filters, and timestamp sorting. Collection limit parsing also uses a shared helper. Script manifests load the corresponding shared sources. Badge-definition URI validation uses a named collection constant.

Changes: List query helper consolidation

Layer / File(s) Summary
List cursors, filters, and ordering
happyview-modules/lua/endpoints/..., happyview-modules/lua/shared/..., happyview-modules/modules/{activity,context-attachments,context-evaluation,funding}/manifest.json
Activity, attachment, evaluation, and receipt queries use shared cursor, filter, and sort-direction helpers. Their endpoint-specific cursor checks remain. Their queries also use the shared created-at sort expression.
Collection request and pagination helpers
happyview-modules/lua/endpoints/{getCollection.lua,listCollectionItems.lua,listCollections.lua,searchCollections.lua}, happyview-modules/lua/shared/{collection.lua,collectionItems.lua,collectionList.lua}, happyview-modules/modules/collection/manifest.json
Collection endpoints use shared request validation, limit, cursor, and SQL filter helpers. Collection-item limit parsing uses the shared parser.
Feed-reaction and entity-follow ordering
happyview-modules/lua/endpoints/{getActorLikes.lua,getActorReposts.lua,getEntityFollow.lua,getEntityFollows.lua,getLikes.lua,getReposts.lua,listEntityFollowers.lua,listEntityFollowing.lua}, happyview-modules/lua/shared/{entityFollow.lua,entityFollowLookup.lua,entityFollowPagination.lua,feedReaction.lua}, happyview-modules/modules/{entity-follow,feed-reactions}/manifest.json
Feed-reaction and entity-follow queries use created-at sort helpers. Their cursor decoders delegate common checks to shared helpers and retain endpoint-specific validation.

Badge-definition validation wiring

Layer / File(s) Summary
Badge-definition validation source
happyview-modules/lua/endpoints/searchBadgeDefinitions.lua, happyview-modules/lua/src/searchBadgeDefinitions.lua, happyview-modules/modules/badge-queries/manifest.json
The badge-definition URI validator uses a named collection constant. The script manifest adds the shared validation source.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Refactor

Possibly related PRs

  • hypercerts-org/api#90: Adds a SQL golden test for cursor-taking query bundles. The PR description says this golden remains unchanged after the refactor.
Merge Risk: Minimal · up to d2d48

This change moves several list endpoints onto shared helpers for cursor handling, filters, sort direction, limits and timestamp ordering. Review found no behavior regressions: the manifests load the helpers in the right order and the previous sort and filter semantics are preserved. The change looks safe to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "lua: move seven list endpoints onto shared list helpers" matches the main change. The raw summary and PR objectives show the change moves list endpoints (activityList, attachmentList, colle…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "lua: move seven list endpoints onto shared list helpers" matches the main change. The raw summary and PR objectives show the change moves list endpoints (activityList, attachmentList, collectionList, entityFollowPagination, evaluationList, feedReaction, fundingReceiptList) onto shared cursor, IN-clause, created_at sort, and parsing helpers. The title is specific and concise. It does not name every shared helper, which is acceptable.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9fc9a316-e2aa-419f-b247-3564d2c1f6e4
Commits

Reviewing files that changed from the base of the PR and between 65f4bc8 and d2d4808.

Files selected for processing: 40

  • happyview-modules/lua/endpoints/getActorLikes.lua
  • happyview-modules/lua/endpoints/getActorReposts.lua
  • happyview-modules/lua/endpoints/getCollection.lua
  • happyview-modules/lua/endpoints/getEntityFollow.lua
  • happyview-modules/lua/endpoints/getEntityFollows.lua
  • happyview-modules/lua/endpoints/getLikes.lua
  • happyview-modules/lua/endpoints/getReposts.lua
  • happyview-modules/lua/endpoints/listActivities.lua
  • happyview-modules/lua/endpoints/listAttachments.lua
  • happyview-modules/lua/endpoints/listCollectionItems.lua
  • happyview-modules/lua/endpoints/listCollections.lua
  • happyview-modules/lua/endpoints/listEntityFollowers.lua
  • happyview-modules/lua/endpoints/listEntityFollowing.lua
  • happyview-modules/lua/endpoints/listEvaluations.lua
  • happyview-modules/lua/endpoints/listReceipts.lua
  • happyview-modules/lua/endpoints/searchActivities.lua
  • happyview-modules/lua/endpoints/searchBadgeDefinitions.lua
  • happyview-modules/lua/endpoints/searchCollections.lua
  • happyview-modules/lua/shared/activityList.lua
  • happyview-modules/lua/shared/attachmentList.lua
  • happyview-modules/lua/shared/collection.lua
  • happyview-modules/lua/shared/collectionItems.lua
  • happyview-modules/lua/shared/collectionList.lua
  • happyview-modules/lua/shared/entityFollow.lua
  • happyview-modules/lua/shared/entityFollowLookup.lua
  • happyview-modules/lua/shared/entityFollowPagination.lua
  • happyview-modules/lua/shared/evaluationList.lua
  • happyview-modules/lua/shared/feedReaction.lua
  • happyview-modules/lua/shared/fundingReceiptList.lua
  • happyview-modules/lua/src/getCollection.lua
  • happyview-modules/lua/src/getEntityFollows.lua
  • happyview-modules/lua/src/searchBadgeDefinitions.lua
  • happyview-modules/modules/activity/manifest.json
  • happyview-modules/modules/badge-queries/manifest.json
  • happyview-modules/modules/collection/manifest.json
  • happyview-modules/modules/context-attachments/manifest.json
  • happyview-modules/modules/context-evaluation/manifest.json
  • happyview-modules/modules/entity-follow/manifest.json
  • happyview-modules/modules/feed-reactions/manifest.json
  • happyview-modules/modules/funding/manifest.json
Files with no reviewable changes: 3

  • happyview-modules/lua/shared/collection.lua
  • happyview-modules/lua/shared/entityFollow.lua
  • happyview-modules/lua/src/searchBadgeDefinitions.lua

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@Kzoeps
Kzoeps force-pushed the lua/shared-list-helpers branch from 112ddac to 79d7002 Compare November 18, 2026 15:04
@Kzoeps
Kzoeps force-pushed the lua/list-helpers-batch2 branch from 9a07b18 to dbf7899 Compare November 18, 2026 15:05
Base automatically changed from lua/shared-list-helpers to main November 18, 2026 15:41
@sonarqubecloud

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@Kzoeps
Kzoeps merged commit 23c4fed into main Nov 18, 2026
7 of 8 checks passed
@Kzoeps
Kzoeps deleted the lua/list-helpers-batch2 branch November 18, 2026 15:54

This branch was previously deployed

1 inactive deployment
Preview — d2d4808d Deployed Nov 18, 2026 by vercel[bot]
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