Skip to content

api: add batched reaction counts query - #40

Open
Kzoeps wants to merge 1 commit into
mainfrom
feed/batch-reaction-counts-contract
Open

Kzoeps wants to merge 1 commit into
mainfrom
feed/batch-reaction-counts-contract

Conversation

@Kzoeps

@Kzoeps Kzoeps commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add the public app.certified.feed.getReactionCounts query for batches of 1–100 subjects.
  • Return ordered, duplicate-preserving like/repost counts using distinct publisher DIDs and URI-only matching.
  • Register the handler, tests, API docs, explorer snapshots, consumer skill contract, and a minor Changeset.

Validation

  • node --test api/tests/unit/tooling/feed-reactions.test.js — 11/11 passed.
  • pnpm check — passed (351 unit tests, 17 docs tests; generated bundle current).
  • pnpm build — passed.
  • pnpm changeset status — minor bump for @hypercerts-org/hypercerts-api.
  • git diff --check — passed.

Runtime test limitation

PSQL_PATH="$(command -v psql)" pnpm test:http stopped at the cached-image preflight because the pinned PostgreSQL image is unavailable locally. No image pull or Compose startup occurred; installed HTTP/SQL behavior remains unverified.

Summary by CodeRabbit

  • New Features
    • Added a public query to retrieve like and repost counts for 1–100 subject records in one request. Results preserve the input order and duplicates, with zero counts for subjects without matching reactions.
    • The query does not require authentication; counts reflect currently indexed reactions and may change over time.

@vercel

vercel Bot commented Oct 14, 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 14, 2026 7:05am UTC

Request Review

@changeset-bot

changeset-bot Bot commented Oct 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: caaa349

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

This PR includes changesets to release 1 package
Name Type
@hypercerts-org/hypercerts-api Minor

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 Oct 14, 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: 5393682a-bddc-47a0-897b-88459a2af543
📥 Commits

Reviewing files that changed from the base of the PR and between 52658c3 and caaa349.

📒 Files selected for processing: 17
  • .agents/skills/hypercerts-api/SKILL.md
  • .agents/skills/hypercerts-api/references/endpoint-map.md
  • .agents/skills/hypercerts-api/references/openapi.json
  • .agents/skills/hypercerts-api/references/request-patterns.md
  • .changeset/batch-reaction-counts.md
  • api/README.md
  • api/lexicons/app.certified.feed.getReactionCounts.json
  • api/lua/endpoints/getReactionCounts.lua
  • api/lua/src/getReactionCounts.lua
  • api/manifest.json
  • api/modules/feed-reactions/manifest.json
  • api/tests/http/feed-reactions.http.test.js
  • api/tests/unit/tooling/feed-reactions.test.js
  • docs/coverage.json
  • docs/openapi.json
  • docs/sources/index.json
  • docs/sources/lexicons/app.certified.feed.getReactionCounts.json

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

Adds the public app.certified.feed.getReactionCounts query. It validates batches of subject AT-URIs, returns ordered like and repost counts, and registers and documents the endpoint.

Changes: Feed reaction counts

Layer / File(s) Summary
Query contract and subject validation
api/lexicons/app.certified.feed.getReactionCounts.json, docs/sources/lexicons/app.certified.feed.getReactionCounts.json, .agents/skills/hypercerts-api/references/openapi.json, docs/openapi.json, .agents/skills/hypercerts-api/references/endpoint-map.md, .agents/skills/hypercerts-api/references/request-patterns.md, api/README.md, api/lua/endpoints/getReactionCounts.lua, api/lua/src/getReactionCounts.lua
Defines the 1–100 repeated subjects input, per-subject count output, and declared errors. The endpoint validates subject AT-URIs and collection identifiers.
Indexed counts and ordered response
api/lua/endpoints/getReactionCounts.lua, api/lua/src/getReactionCounts.lua, api/tests/http/feed-reactions.http.test.js, api/tests/unit/tooling/feed-reactions.test.js
Queries distinct publishers in the like and repost collections. Returns counts in input order, preserves duplicate subjects, and uses zero for subjects without indexed reactions. Tests cover input validation and query failures.
Registration and endpoint references
api/manifest.json, api/modules/feed-reactions/manifest.json, docs/sources/index.json, docs/coverage.json, .changeset/batch-reaction-counts.md, .agents/skills/hypercerts-api/SKILL.md, .agents/skills/hypercerts-api/references/endpoint-map.md
Registers the query and lexicon, updates endpoint indexes and operation totals, and adds the package changeset and endpoint references.

Priority: ➖ Normal

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant LuaEndpoint as getReactionCounts
  participant PostgreSQL
  Client->>LuaEndpoint: Send subject AT-URIs
  LuaEndpoint->>PostgreSQL: Query distinct like and repost publisher counts
  PostgreSQL-->>LuaEndpoint: Return counts by subject URI
  LuaEndpoint-->>Client: Return counts in input order
Loading
Merge Risk: ⚪ Minimal · up to caaa3

No identified issue blocks merging the batched reaction-count query; the HTTP suite remains unverified because its PostgreSQL image was unavailable.

Pre-merge checks: Passed 4 · Failed 1

Failed 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 21 functions across 4 files. (13 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
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.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main change: adding a batched reaction-counts query to the API.
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 21 functions across 4 files. (13 skipped: 13 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
  • 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

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

@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 — caaa3499 Deployed Oct 14, 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