You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
lua: move seven list endpoints onto shared list helpers - #92
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.
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.
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
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.
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: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
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
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
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.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #91.
Problem
Seven list endpoints still carried their own copies of cursor decoding,
IN (...)loops,created_atsort SQL, cursor encoding and limit/sortDirection parsing.Fix
activityList,attachmentList,collectionList,entityFollowPagination,evaluationList,feedReactionandfundingReceiptListontodecode_cursor,add_in,created_at_sort,cursor_encode,parse_sort_directionandparse_list_limit.collectionItemsuses the shared limit parser; its cursor decoder is unchanged.entity_follow_sort_key(an exact copy ofcreated_at_sort()) and the collection-localinvalid/keys_only/scalarcopies in favour ofquery.lua. A small wrapper keeps the booleanhasOrganizationRecordbehaviour.searchBadgeDefinitionsreuses the URI check frombadgeDefinitionValidation.lua.EXISTSand compound filters keep their own bind helpers.Summary by CodeRabbit