Skip to content

lua: one cursor check and one repeated-parameter parser for list endpoints - #108

Open
Kzoeps wants to merge 7 commits into
lua/consolidate-shared-helpersfrom
lua/consolidate-shared-helpers-b
Open

Kzoeps wants to merge 7 commits into
lua/consolidate-shared-helpersfrom
lua/consolidate-shared-helpers-b

Conversation

@Kzoeps

@Kzoeps Kzoeps commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Problem

After the pure refactor in #107, the remaining copies differed in small ways: empty or over-long cursors, and keyed or sparse repeated parameters, were handled differently per endpoint.

Fix

  • One cursor check (decode_record_cursor) and one repeated-parameter parser (query_string_values / unique_query_values) on every list endpoint. Allowlist now 25, each with a specific reason.
  • Approved message changes, all still InvalidRequest:
    • Empty cursor now returns cursor is malformed (was ... or belongs to another sortDirection) on 12 list endpoints.
    • Cursors over 8192 characters are rejected on those endpoints; listFeatures was 32768. API-issued cursors are at most 5338 characters (test added).
    • Keyed or sparse repeated parameters are rejected with <name> must use repeated query values on the lenient filters; listFeatures message aligned. HappyView already rejects k[x], k[2], k.x before Lua (HTTP test added).
  • listFeatures Lexicon cursor maxLength 32768 → 8192, matching the other list Lexicons. Docs snapshots, OpenAPI, skill snapshot and client regenerated.
  • listRecentFollows and listVocabTags keep their own cursor decoders: their cursors embed unbounded caller values.

Stacked on #107.

@vercel

vercel Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
api-endpoints Ready Ready Preview Nov 26, 2026 1:41pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0dfe16a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@hypercerts-org/happyview-modules Patch
@hypercerts-org/api Patch

Not sure what this means? Click here to learn what changesets are.

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

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 28 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

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: 413b43ba-940f-4dd3-95af-a8f6523bc2b5
Commits

Reviewing files that changed from the base of the PR and between 5afb449 and 0dfe16a.

Files selected for processing: 90

  • .agents/skills/hypercerts-api/references/openapi.json
  • .changeset/list-features-cursor-limit.md
  • .changeset/shared-list-input-checks.md
  • AGENTS.md
  • docs/openapi.json
  • docs/sources/lexicons/org.hypercerts.entity.listFeatures.json
  • happyview-modules/lexicons/org.hypercerts.entity.listFeatures.json
  • happyview-modules/lua/endpoints/getActorReactions.lua
  • happyview-modules/lua/endpoints/getReactionCounts.lua
  • happyview-modules/lua/endpoints/listAcknowledgements.lua
  • happyview-modules/lua/endpoints/listActivities.lua
  • happyview-modules/lua/endpoints/listActorFollowers.lua
  • happyview-modules/lua/endpoints/listActorFollowing.lua
  • happyview-modules/lua/endpoints/listAttachments.lua
  • happyview-modules/lua/endpoints/listBadgeAwards.lua
  • happyview-modules/lua/endpoints/listBadgeDefinitions.lua
  • happyview-modules/lua/endpoints/listBadgeResponses.lua
  • happyview-modules/lua/endpoints/listCollections.lua
  • happyview-modules/lua/endpoints/listContributions.lua
  • happyview-modules/lua/endpoints/listContributorInformation.lua
  • happyview-modules/lua/endpoints/listEvaluations.lua
  • happyview-modules/lua/endpoints/listEvmLinks.lua
  • happyview-modules/lua/endpoints/listFeatures.lua
  • happyview-modules/lua/endpoints/listLocations.lua
  • happyview-modules/lua/endpoints/listMeasurements.lua
  • happyview-modules/lua/endpoints/listOrganizations.lua
  • happyview-modules/lua/endpoints/listProfiles.lua
  • happyview-modules/lua/endpoints/listReceipts.lua
  • happyview-modules/lua/endpoints/listRights.lua
  • happyview-modules/lua/endpoints/listVocabTags.lua
  • happyview-modules/lua/endpoints/listWorkscopeTags.lua
  • happyview-modules/lua/endpoints/searchActivities.lua
  • happyview-modules/lua/endpoints/searchBadgeDefinitions.lua
  • happyview-modules/lua/endpoints/searchCollections.lua
  • happyview-modules/lua/endpoints/searchOrganizations.lua
  • happyview-modules/lua/endpoints/searchProfiles.lua
  • happyview-modules/lua/shared/acknowledgementList.lua
  • happyview-modules/lua/shared/activityList.lua
  • happyview-modules/lua/shared/actorFollowList.lua
  • happyview-modules/lua/shared/attachmentList.lua
  • happyview-modules/lua/shared/collectionList.lua
  • happyview-modules/lua/shared/evaluationList.lua
  • happyview-modules/lua/shared/feedActorReactions.lua
  • happyview-modules/lua/shared/fundingReceiptList.lua
  • happyview-modules/lua/shared/listWhere.lua
  • happyview-modules/lua/shared/organizationList.lua
  • happyview-modules/lua/shared/profileList.lua
  • happyview-modules/lua/shared/queryArray.lua
  • happyview-modules/lua/shared/workscopeTagList.lua
  • happyview-modules/lua/src/getReactionCounts.lua
  • happyview-modules/lua/src/listBadgeAwards.lua
  • happyview-modules/lua/src/listBadgeDefinitions.lua
  • happyview-modules/lua/src/listBadgeResponses.lua
  • happyview-modules/lua/src/listContributions.lua
  • happyview-modules/lua/src/listContributorInformation.lua
  • happyview-modules/lua/src/listEvmLinks.lua
  • happyview-modules/lua/src/listFeatures.lua
  • happyview-modules/lua/src/listLocations.lua
  • happyview-modules/lua/src/listMeasurements.lua
  • happyview-modules/lua/src/listRights.lua
  • happyview-modules/lua/src/listVocabTags.lua
  • happyview-modules/lua/src/searchBadgeDefinitions.lua
  • happyview-modules/modules/acknowledgements/manifest.json
  • happyview-modules/modules/activity/manifest.json
  • happyview-modules/modules/badge-definitions/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/context-measurements/manifest.json
  • happyview-modules/modules/contribution/manifest.json
  • happyview-modules/modules/contributor-information/manifest.json
  • happyview-modules/modules/evm-links/manifest.json
  • happyview-modules/modules/features/manifest.json
  • happyview-modules/modules/funding/manifest.json
  • happyview-modules/modules/location/manifest.json
  • happyview-modules/modules/organization/manifest.json
  • happyview-modules/modules/profile/manifest.json
  • happyview-modules/modules/rights/manifest.json
  • happyview-modules/modules/workscope-tags/manifest.json
  • happyview-modules/tests/http/query-array-shapes.http.test.js
  • happyview-modules/tests/unit/endpoints/rights-edge-lua.test.js
  • happyview-modules/tests/unit/endpoints/rights-lua.test.js
  • happyview-modules/tests/unit/feature.test.js
  • happyview-modules/tests/unit/list-golden/cursor-size.test.js
  • happyview-modules/tests/unit/list-golden/fixtures.js
  • happyview-modules/tests/unit/list-golden/list-endpoints.golden.jsonl
  • happyview-modules/tests/unit/tooling/listContributorInformation.test.js
  • happyview-modules/tooling/shared-helpers.registry.json
  • packages/api/src/lexicons/org/hypercerts/entity/listFeatures.defs.ts
  • 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

listBadgeAwards uses the shared valid_badge_definition_uri. bind_values moves
into listWhere.lua (add_in builds on it) so activityList and listMeasurements
drop their copies. listLocations' add_in is a different helper (skips nil,
joins placeholders with ',') and becomes add_optional_in. No behavior change:
list golden is byte-identical.
actorFollowList, organizationList, profileList, listLocations, listEvmLinks,
listFeatures and the badge list/search handlers decode cursors with
decode_record_cursor. Empty cursors now answer 'cursor is malformed' and
cursors over 8192 characters are rejected (listFeatures: was 32768); error
name InvalidRequest is unchanged. A test builds each endpoint's largest
possible cursor (max DID and record key) and checks it is under the cap and
accepted on replay (largest: 5338 of 8192 characters).

listRecentFollows and listVocabTags keep their own decoders: their cursors
carry caller-supplied values (before, author filter) with no size bound.
query_string_values reads a repeated parameter (single value, list, <=100
strings, no keyed or sparse tables) and unique_query_values validates,
optionally normalizes and de-duplicates. The 17 per-endpoint parsers keep only
their own item rules and messages. profile, badge, EVM-link, location and
feature lists now also reject keyed or sparse tables; HappyView already turns
k[x], k[2], k.x into unknown parameters before Lua runs (new HTTP test), so
requests behave as before. listFeatures' sparse message now matches the rest.
…y parsers

listContributions uses query_string_values (identical messages; golden unchanged).
listVocabTags, getReactionCounts and feedActorReactions keep their own parsers because
their required-ness, count message, duplicate handling or shape message differ; each
now says so. AGENTS.md names the new shared array helpers, and the allowlist reasons
for the module-local query wrappers and listFeatures' occur-once check say why they differ.
The handler now rejects cursors over 8192 characters like every other list
endpoint, so the schema says the same. Regenerated docs snapshots, OpenAPI,
skill snapshot and the client.
@Kzoeps

Kzoeps commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

SonarCloud annotation fixtures.js:739 (reverse() mutates the array): valid, fixed with toReversed() in 0dfe16a. CodeRabbit skipped this PR (review limit). No other open threads, reviews or annotations.

@sonarqubecloud

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

This branch was successfully deployed

1 active deployment
Preview — 0dfe16a6 Deployed Nov 26, 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