Skip to content

rights: add rights retrieval and listing queries - #17

Merged
Kzoeps merged 14 commits into
mainfrom
queries/rights
Oct 6, 2026
Merged

Kzoeps merged 14 commits into
mainfrom
queries/rights

Conversation

@Kzoeps

@Kzoeps Kzoeps commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Scope

Adds public org.hypercerts.claim.getRights and org.hypercerts.claim.listRights endpoints, with repeated-author filtering, stable cursor pagination, publisher sidecars, Lexicons, manifests, and coverage.

Validation

  • Offline pnpm test:unit: 110/110 tests passed; pnpm check and pnpm build passed locally.
  • Local pnpm test:http was not run. Unit tests use local fixtures/fake adapters and do not install handlers, seed PostgreSQL, or contact HappyView. CI HTTP coverage exercises real XRPC over HTTP against the installed HappyView + PostgreSQL test environment; its result is pending from PR creation.

Summary by CodeRabbit

  • New Features

    • Added public endpoints to retrieve an individual rights record or list rights records.
    • Listing supports publisher filters, ascending or descending sorting, and cursor-based pagination.
    • Rights results include publisher details when available and preserve nullable indexing timestamps.
  • Documentation

    • Updated endpoint and HTTP test documentation to cover rights retrieval, filtering, errors, and pagination.

@changeset-bot

changeset-bot Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9207d24

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

@vercel

vercel Bot commented Oct 5, 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 Oct 6, 2026 3:42pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5eff1325-fae1-4a38-9c94-4637f9f1e246
📥 Commits

Reviewing files that changed from the base of the PR and between 06606f8 and 9207d24.

📒 Files selected for processing (20)
  • CONTRIBUTING.md
  • README.md
  • api/README.md
  • api/lexicons/org.hypercerts.claim.getRights.json
  • api/lexicons/org.hypercerts.claim.listRights.json
  • api/lua/endpoints/getRights.lua
  • api/lua/endpoints/listRights.lua
  • api/lua/shared/rightsIdentifier.lua
  • api/lua/shared/rightsView.lua
  • api/lua/src/getRights.lua
  • api/lua/src/listRights.lua
  • api/manifest.json
  • api/modules/rights/manifest.json
  • api/modules/shared/manifest.json
  • api/tests/http/fixtures/rights.fixture.js
  • api/tests/http/getRights.http.test.js
  • api/tests/http/listRights.http.test.js
  • api/tests/unit/endpoints/rights-edge-lua.test.js
  • api/tests/unit/endpoints/rights-lua.test.js
  • api/tests/unit/tooling/lexicons.test.js

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


📝 Walkthrough

Walkthrough

This change adds public rights retrieval and listing endpoints. Retrieval returns an indexed rights record and publisher sidecars. Listing supports author filters, timestamp-based ordering, and cursor pagination. Lexicons, manifests, documentation, and tests cover the endpoints.

Changes

Rights Queries

Layer / File(s) Summary
Query contracts and module registration
api/lexicons/*Rights.json, api/manifest.json, api/modules/{rights,shared}/manifest.json, api/lua/shared/rights*.lua, api/tests/unit/tooling/lexicons.test.js, api/README.md
Adds the retrieval and listing Lexicons, registers the rights module and shared rights Lexicon, and adds shared rights URI validation and view helpers.
Exact rights retrieval
api/lua/endpoints/getRights.lua, api/lua/src/getRights.lua, api/tests/http/getRights.http.test.js, api/tests/unit/endpoints/rights-edge-lua.test.js, api/tests/unit/endpoints/rights-lua.test.js
Adds exact-URI retrieval, PostgreSQL query handling, record view construction, and publisher sidecar hydration. Tests cover successful responses, invalid URIs, missing records, and nullable values.
Filtered listing and cursor pagination
api/lua/endpoints/listRights.lua, api/lua/src/listRights.lua, api/tests/http/fixtures/rights.fixture.js, api/tests/http/listRights.http.test.js, api/tests/unit/endpoints/rights-edge-lua.test.js, api/tests/unit/endpoints/rights-lua.test.js, README.md, CONTRIBUTING.md, api/README.md
Adds author filtering, timestamp fallback, URI tie-breaking, direction-bound cursors, and hydrated list results. Tests and documentation cover filters, pagination, validation, nullable sidecars, and errors.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Client as HTTP client
  participant List as listRights.handle
  participant DB as PostgreSQL
  participant Hydration as rights_hydrate_actor_views
  Client->>List: Send author and pagination parameters
  List->>DB: Query filtered rights rows in cursor order
  DB-->>List: Return limit plus one rows
  List->>Hydration: Hydrate publisher sidecars
  Hydration->>DB: Load publisher profile and organization records
  DB-->>Hydration: Return sidecar records
  Hydration-->>List: Return hydrated rights views
  List-->>Client: Return rights and optional next cursor
Loading

Merge Risk: ⚪ Minimal · up to 9207d

No identified rights-query issue remains that should prevent merge after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 57 functions across 12 files. (8 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding rights retrieval and listing queries.
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: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 57 functions across 12 files. (8 skipped: 8 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · 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

Comment @coderabbitai help to get the list of available commands.

@Kzoeps
Kzoeps marked this pull request as ready for review October 6, 2026 13:19
@sonarqubecloud

sonarqubecloud Bot commented Oct 6, 2026

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@Kzoeps
Kzoeps merged commit 13827ee into main Oct 6, 2026
7 of 8 checks passed
@Kzoeps
Kzoeps deleted the queries/rights branch October 6, 2026 15:48

This branch was successfully deployed

1 active deployment
Preview — 9207d24b Deployed Oct 6, 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