Skip to content

Document effect cache#675

Merged
DZakh merged 4 commits intomainfrom
dz/v2.26
Jul 29, 2025
Merged

Document effect cache#675
DZakh merged 4 commits intomainfrom
dz/v2.26

Conversation

@DZakh
Copy link
Member

@DZakh DZakh commented Jul 29, 2025

Summary by CodeRabbit

  • New Features

    • Introduced built-in caching and persistence options for the Effect API, including updated documentation and usage examples.
    • Added detailed guidance on effect result caching, manual cache syncing, and hosted service limitations.
    • Updated guides to use the Effect API's caching and batching for token metadata and IPFS metadata fetching, replacing custom caching logic.
  • Documentation

    • Improved and clarified documentation across multiple guides, including new sections on Hasura Console access and disabling Hasura for self-hosted indexers.
    • Corrected and updated environment variable names and documentation links.
    • Enhanced formatting and readability in several documentation files.
  • Refactor

    • Refactored token metadata and IPFS metadata fetching logic to leverage the Effect API and loaders for better performance and maintainability.
    • Removed outdated custom caching implementations in favor of the new built-in caching mechanism.

@vercel
Copy link

vercel bot commented Jul 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
envio-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 29, 2025 3:04pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 29, 2025

Warning

Rate limit exceeded

@DZakh has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 7 minutes and 24 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 617dd17 and 26b32bf.

📒 Files selected for processing (2)
  • docs/HyperIndex/Advanced/loaders.md (6 hunks)
  • docs/HyperIndex/Guides/contract-state.md (5 hunks)

Walkthrough

The documentation has been updated across multiple guides and tutorials to clarify, enhance, and modernize descriptions and examples related to effect caching, IPFS integration, contract state fetching, and Hasura configuration. Several guides now demonstrate using the Effect API's built-in caching and batching features, replacing custom caching logic. Minor corrections, formatting improvements, and environment variable clarifications are also included.

Changes

Cohort / File(s) Change Summary
Effect API Caching & Persistence Documentation
docs/HyperIndex/Advanced/loaders.md
Expanded documentation on Effect API caching and persistence, added detailed guidance on enabling and persisting cache, cache reuse on reruns, and updated example code to use new cache option.
Contract State Guide Refactor
docs/HyperIndex/Guides/contract-state.md
Replaced custom token metadata caching with Effect API caching and batching. Refactored event handler and effect definition, removed manual cache logic, and updated guide steps and recommendations.
IPFS Metadata Guide Refactor
docs/HyperIndex/Guides/ipfs.md
Replaced custom IPFS fetching and caching with an Effect API effect and loader, improved error handling, updated event handler, removed SQLite cache example, and added caching best-practice notes.
Formatting and Link Fixes
docs/HyperIndex/Guides/environment-variables.md, docs/HyperIndex/Guides/event-handlers.mdx, docs/HyperIndex/Tutorials/tutorial-indexing-fuel.md, docs/HyperIndex/migration-guide.md
Added blank lines and improved formatting for readability; updated anchor fragments in documentation links for accuracy; standardized code block delimiters and hyperlink references.
Hasura Console and Self-Hosting Updates
docs/HyperIndex/Guides/navigating-hasura.md, docs/HyperIndex/Hosted_Service/self-hosting.md
Clarified Hasura Console access, added instructions for disabling Hasura in self-hosted indexers, and corrected database password environment variable name.
Environment Variable Corrections
docs/HyperIndex/Troubleshoot/common-issues.md, docs/HyperIndex/Hosted_Service/self-hosting.md
Corrected environment variable name for Postgres password from ENVIO_POSTGRES_PASSWORD to ENVIO_PG_PASSWORD.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant EventHandler
    participant EffectAPI
    participant Loader
    participant ExternalService

    User->>EventHandler: Trigger event (e.g., Transfer)
    EventHandler->>Loader: Batch event data
    Loader->>EffectAPI: Request effect (e.g., getIpfsMetadata or getTokenMetadata) with cache enabled
    EffectAPI->>EffectAPI: Check cache for result
    alt Cache hit
        EffectAPI-->>Loader: Return cached result
    else Cache miss
        EffectAPI->>ExternalService: Fetch data (e.g., IPFS, RPC)
        ExternalService-->>EffectAPI: Return data
        EffectAPI->>EffectAPI: Store result in cache
        EffectAPI-->>Loader: Return result
    end
    Loader-->>EventHandler: Provide effect results
    EventHandler-->>User: Complete event processing
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

codex

Suggested reviewers

  • moose-code

Poem

A bunny with docs in its paws,
Hopped through caching’s clever laws.
No more manual caches to chase,
Effects now persist with elegant grace.
Hasura’s console, IPFS too—
All polished up for the indexing crew.
🐇✨ Cheers to code that’s neat and new!

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dz/v2.26

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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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.

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: 3

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

23-25: Add a definite article for smoother reading

“Hasura Console is automatically available” reads a little abrupt.

-When running HyperIndex locally, Hasura Console is automatically available at:
+When running HyperIndex locally, **the** Hasura Console is automatically available at:

141-144: Clarify default & scope of ENVIO_HASURA

Stating only how to disable leaves readers wondering what the default is and whether the variable is respected in local envio dev runs. Consider amending:

-Starting from `envio@2.26.0` it's possible to disable Hasura integration for self-hosted indexers. To do so, set the `ENVIO_HASURA` environment variable to `false`.
+Starting from `envio@2.26.0`, Hasura integration is **enabled by default**.  
+Set `ENVIO_HASURA=false` (e.g. in `.env` or the hosting panel) to disable it for self-hosted indexers.  
+The variable is ignored when you run `envio dev` locally, where Hasura is always started.
docs/HyperIndex/migration-guide.md (3)

16-17: Tighten wording & fix link caption

Minor language cleanup:

-Migrating from a subgraph to HyperIndex is designed to be a developer-friendly process. HyperIndex draws strong inspiration from TheGraph’s subgraph architecture, which makes the migration simple, especially with the help of coding assistants like Cursor and AI tools (don't forget to use our ai friendly docs [llm-docs.envio.dev](https://llm-docs.envio.dev)).
+Migrating from a subgraph to HyperIndex is a developer-friendly process. HyperIndex draws strong inspiration from TheGraph’s subgraph architecture, which keeps the migration straightforward—especially with coding assistants such as Cursor or AI tools. (See our **AI-friendly docs** at [llm-docs.envio.dev](https://llm-docs.envio.dev).)

31-35: Fix numbered list rendering

Three lines are all numbered “1.” which renders as a single list item in some Markdown engines. Use explicit numbering or leave one “1.” and rely on automatic incrementing:

-1. Subgraph.yaml migration
-1. Schema migration - near copy paste
-1. Event handler migration
+1. Subgraph.yaml migration  
+2. Schema migration (nearly copy-paste)  
+3. Event-handler migration

137-137: Over-used intensifier

“it’s quite simple” → “it’s simple” / “relatively simple”

-...it's quite simple to copy and paste the code...
+...it's simple to copy and paste the code...
docs/HyperIndex/Guides/contract-state.md (1)

225-229: Type-safety nitpick

decimals returned from viem is number | bigint depending on the ABI. Currently you coerce it into number, which can truncate big values in custom tokens. Consider keeping it as bigint and updating the schema accordingly.

docs/HyperIndex/Guides/ipfs.md (1)

124-128: File path mismatch may confuse readers

The paragraph says to place the file in src/effects/ipfs.ts, but the code block header shows // src/utils/ipfs.ts.

Align the path in either the paragraph or the comment to prevent copy-paste errors.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4e66839 and 2386f46.

📒 Files selected for processing (10)
  • docs/HyperIndex/Advanced/loaders.md (6 hunks)
  • docs/HyperIndex/Guides/contract-state.md (5 hunks)
  • docs/HyperIndex/Guides/environment-variables.md (3 hunks)
  • docs/HyperIndex/Guides/event-handlers.mdx (1 hunks)
  • docs/HyperIndex/Guides/ipfs.md (4 hunks)
  • docs/HyperIndex/Guides/navigating-hasura.md (2 hunks)
  • docs/HyperIndex/Hosted_Service/self-hosting.md (1 hunks)
  • docs/HyperIndex/Troubleshoot/common-issues.md (1 hunks)
  • docs/HyperIndex/Tutorials/tutorial-indexing-fuel.md (1 hunks)
  • docs/HyperIndex/migration-guide.md (7 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/HyperIndex/migration-guide.md

[style] ~137-~137: As an alternative to the over-used intensifier ‘quite’, consider replacing this phrase.
Context: ...yscript is a subset of typescript, it's quite simple to copy and paste the code, especially ...

(EN_WEAK_ADJECTIVE)

🪛 markdownlint-cli2 (0.17.2)
docs/HyperIndex/Guides/ipfs.md

285-285: Blank line inside blockquote

(MD028, no-blanks-blockquote)

🔇 Additional comments (5)
docs/HyperIndex/Tutorials/tutorial-indexing-fuel.md (1)

114-115: Anchor Verified: #features-supported-on-fuel Exists

The heading “### Features Supported on Fuel” in docs/HyperIndex/fuel/fuel.md generates the exact slug #features-supported-on-fuel. No changes are needed.

docs/HyperIndex/Guides/environment-variables.md (1)

15-16: Markdown spacing tweaks look good

The added blank lines improve list and fence rendering; no further action needed.

Also applies to: 42-43, 50-51, 83-83

docs/HyperIndex/Troubleshoot/common-issues.md (1)

178-180: No lingering ENVIO_POSTGRES_PASSWORD references found
Ran rg -n "ENVIO_POSTGRES_PASSWORD" across the repo with zero matches—rename is complete.

docs/HyperIndex/Guides/event-handlers.mdx (1)

164-165: Anchors Verified – No Action Needed

Both target headings exist and generate the correct fragments in docs/HyperIndex/Advanced/wildcard-indexing.mdx:

  • Line 165: ## Multiple Filters#multiple-filters
  • Line 256: ## Different Filters per Network#different-filters-per-network

The existing links in docs/HyperIndex/Guides/event-handlers.mdx will resolve correctly.

docs/HyperIndex/Hosted_Service/self-hosting.md (1)

54-56: Consistency fix looks good

ENVIO_PG_PASSWORD now matches the rest of the docs. No further issues spotted.

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: 0

♻️ Duplicate comments (1)
docs/HyperIndex/Advanced/loaders.md (1)

191-192: Clarify that persistence is opt-in, not automatic

The bullet still implies that effect results are persisted by default, contradicting the detailed explanation in the “Persistence” section (lines 303–308). Please harmonise the wording:

- **Persistence**: Built-in persistence of effect results for indexer reruns
+ **Persistence**: Built-in support for result persistence (opt-in via `cache: true`) for indexer reruns
🧹 Nitpick comments (1)
docs/HyperIndex/Advanced/loaders.md (1)

323-325: Nit: natural placement of “also”

Re-order “also” for smoother flow:

- The same `.envio/cache` can be also used to populate the initial cache on the hosted service.
+ The same `.envio/cache` can also be used to populate the initial cache on the hosted service.
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2386f46 and 617dd17.

📒 Files selected for processing (1)
  • docs/HyperIndex/Advanced/loaders.md (6 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/HyperIndex/Advanced/loaders.md

[style] ~325-~325: To make your writing flow more naturally, try moving ‘also’ before the verb.
Context: ...Hosted Service The same .envio/cache can be also used to populate the initial cache on t...

(ALSO_PLACEMENT)

DZakh and others added 2 commits July 29, 2025 19:02
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Member

@moose-code moose-code left a comment

Choose a reason for hiding this comment

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

Nice! well documented

@DZakh DZakh merged commit 60dc117 into main Jul 29, 2025
3 checks passed
@DZakh DZakh deleted the dz/v2.26 branch July 29, 2025 15:08
@coderabbitai coderabbitai bot mentioned this pull request Aug 20, 2025
@coderabbitai coderabbitai bot mentioned this pull request Nov 10, 2025
@coderabbitai coderabbitai bot mentioned this pull request Dec 19, 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