Skip to content

Aggregate example fix#692

Merged
DenhamPreen merged 7 commits intomainfrom
dp/aggregate-warning
Aug 20, 2025
Merged

Aggregate example fix#692
DenhamPreen merged 7 commits intomainfrom
dp/aggregate-warning

Conversation

@DenhamPreen
Copy link
Contributor

@DenhamPreen DenhamPreen commented Aug 20, 2025

Summary by CodeRabbit

  • Documentation
    • Added a guide section on “Aggregations: local vs hosted,” clarifying that aggregate helpers are local-only and advising precomputing/storing aggregates at indexing time, with an example workflow.
    • Included notes for exceptional cases and where to seek support.
    • Retained guidance on disabling Hasura for self-hosted indexers.
  • Tests
    • No changes.
  • Chores
    • No public API changes.

@DenhamPreen DenhamPreen requested a review from DZakh August 20, 2025 11:22
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 20, 2025

Warning

Rate limit exceeded

@DenhamPreen has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 15 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 95d7db6 and ab4dd65.

📒 Files selected for processing (1)
  • docs/HyperIndex/Guides/navigating-hasura.md (2 hunks)

Walkthrough

Adds a new “Aggregations: local vs hosted (avoid the foot‑gun)” section to docs/HyperIndex/Guides/navigating-hasura.md with schema and TypeScript examples for indexing-time aggregation; existing self-hosted Hasura guidance remains unchanged. No code or API changes.

Changes

Cohort / File(s) Summary
Docs — Hasura navigation guide
docs/HyperIndex/Guides/navigating-hasura.md
Added section explaining that GraphQL aggregate helpers exist locally but not on hosted service; recommends computing/storing aggregates at indexing time. Includes GraphQL schema and TypeScript EventHandler example, plus note on exceptional cases and existing self-hosted section unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested reviewers

  • moose-code

Poem

A rabbit taps on docs tonight,
Counting tokens by moonlit byte.
“Precompute,” I twitch and say,
So queries hop the faster way.
Local tallies, hosted calm—
Aggregates in index balm.
Thump! The guide now shows the way.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dp/aggregate-warning

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vercel
Copy link

vercel bot commented Aug 20, 2025

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

Project Deployment Preview Comments Updated (UTC)
envio-docs Ready Ready Preview Comment Aug 20, 2025 11:35am

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
docs/HyperIndex/Guides/navigating-hasura.md (2)

159-161: Clarify the Token.id comment to avoid type confusion.

The schema uses ID! but the comment says “incremental number,” which reads like Int!. Keeping ID! is fine; just clarify it’s an identifier (often stringified).

Apply this diff:

 type Token {
-  id: ID! # incremental number
+  id: ID! # incremental identifier (e.g., stringified counter)
   description: String!
 }

172-176: Optional: Initialize GlobalState if missing to make the example runnable end-to-end.

Instead of early return, seed a default state. This keeps the example self-contained and avoids a “first run” foot‑gun.

Apply this diff:

-  if (!globalState) {
-    context.log.error("global state doesn't exist");
-    return;
-  }
+  if (!globalState) {
+    const initial = { id: globalStateId, count: 0 };
+    context.GlobalState.set(initial);
+  }

Alternatively, continue with a local state variable so the same event proceeds:

-  const globalState = await context.GlobalState.get(globalStateId);
+  const globalState = await context.GlobalState.get(globalStateId);
+  const state = globalState ?? { id: globalStateId, count: 0 };
@@
-  const incrementedTokenId = globalState.count + 1;
+  const incrementedTokenId = state.count + 1;
@@
-  context.GlobalState.set({
-    ...globalState,
+  context.GlobalState.set({
+    ...state,
     count: incrementedTokenId,
   });
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b11e6a7 and 95d7db6.

📒 Files selected for processing (1)
  • docs/HyperIndex/Guides/navigating-hasura.md (1 hunks)
🔇 Additional comments (2)
docs/HyperIndex/Guides/navigating-hasura.md (2)

179-188: Confirm whether set operations are async and require await.

In some runtimes, context.Entity.set is batched/synchronous; in others it returns a Promise. If async, lack of await may lead to ordering issues.

If set is async, prefer:

await context.Token.set(...);
await context.GlobalState.set(...);

Can you confirm the contract of context.*.set in HyperIndex handlers?


141-146: Strong addition: clear guidance on avoiding runtime aggregates.

This section crisply explains local vs hosted behavior and the “precompute at indexing time” pattern. Good call-out to prevent prod slowdowns.

Copy link
Member

@DZakh DZakh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more comment.

Copy link
Member

@DZakh DZakh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can merge after fixing

DenhamPreen and others added 2 commits August 20, 2025 05:33
Co-authored-by: Dmitry Zakharov <dzakh.dev@gmail.com>
Co-authored-by: Dmitry Zakharov <dzakh.dev@gmail.com>
@DenhamPreen
Copy link
Contributor Author

Sorry, it was overwritten again on resolving a merge conflict

@DenhamPreen DenhamPreen merged commit 01ab1b3 into main Aug 20, 2025
2 of 3 checks passed
@DenhamPreen DenhamPreen deleted the dp/aggregate-warning branch August 20, 2025 11:34
@DenhamPreen DenhamPreen mentioned this pull request Sep 1, 2025
This was referenced Oct 30, 2025
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.

2 participants