Skip to content

error-endpoint - #685

Merged
DenhamPreen merged 2 commits into
mainfrom
dp/error-endpoint
Aug 15, 2025
Merged

DenhamPreen merged 2 commits into
mainfrom
dp/error-endpoint

Conversation

@DenhamPreen

@DenhamPreen DenhamPreen commented Aug 15, 2025

Copy link
Copy Markdown
Contributor

improve error msg to hypersync_config

Summary by CodeRabbit

  • Documentation
    • Error messages now reference centralized documentation links, offering clearer guidance when a sync RPC is set alongside HyperSync settings and when HyperSync endpoint auto-discovery fails.
    • Added a direct link to the HyperSync configuration schema reference to streamline troubleshooting and setup.

@DenhamPreen
DenhamPreen requested a review from DZakh August 15, 2025 10:54
@coderabbitai

coderabbitai Bot commented Aug 15, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Error messages in DataSource construction were updated to use centralized documentation link constants. A new public constant for the HyperSync config schema link was added to the links module. No behavior or control flow changes; only message content and constants extended.

Changes

Cohort / File(s) Summary of Changes
CLI config parsing error messages
codegenerator/cli/src/config_parsing/system_config.rs
Replaced hard-coded doc URLs in error messages with constants: DOC_CONFIGURATION_FILE and DOC_CONFIGURATION_SCHEMA_HYPERSYNC_CONFIG.
Constants: documentation links
codegenerator/cli/src/constants.rs
Added pub const DOC_CONFIGURATION_SCHEMA_HYPERSYNC_CONFIG with the HyperSync config schema URL.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

I twitch my ears at links made neat,
No strays, no trails—centralized and sweet.
Hop-hop through configs, I find my way,
With constants guiding every day.
Carrot-shaped URLs? Not yet—
But tidy docs? The best I’ve met! 🥕🐇

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dp/error-endpoint

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.

@DenhamPreen
DenhamPreen enabled auto-merge (squash) August 15, 2025 10:56

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
codegenerator/cli/src/config_parsing/system_config.rs (1)

976-987: Action: Replace the hard-coded docs URL with links::DOC_CONFIGURATION_FILE in system_config.rs (and update the test); consider centralizing other runtime docs links.

constants.rs already defines links::DOC_CONFIGURATION_FILE; a repo search found multiple hard-coded docs URLs. At minimum update the two occurrences in system_config.rs and the test; consider centralizing other code occurrences (not template/README content) into constants.rs.

Files needing attention (from search):

  • codegenerator/cli/src/config_parsing/system_config.rs:976
  • codegenerator/cli/src/config_parsing/system_config.rs:1985 (test assertion)
  • codegenerator/cli/src/config_parsing/validation.rs:208 (different docs path — consider adding a constant)
  • codegenerator/cli/npm/envio/src/sources/SourceManager.res:262
  • many README / template files under codegenerator/cli/templates/** and other docs references (these are content files — decide whether to centralize)

Suggested diffs:

Replace the runtime error message (system_config.rs ~976):

-            (Some(_), Some(_)) => Err(anyhow!("EE106: Cannot define both rpc and deprecated rpc_config for the same network, please only use the rpc option. Read more in our docs https://docs.envio.dev/docs/configuration-file"))?,
+            (Some(_), Some(_)) => Err(anyhow!(
+                "EE106: Cannot define both rpc and deprecated rpc_config for the same network, please only use the rpc option. Read more in our docs {}",
+                links::DOC_CONFIGURATION_FILE
+            ))?,

Update the test assertion (system_config.rs ~1985):

-        assert_eq!(error.to_string(), "EE106: Cannot define both hypersync_config and rpc as a data-source for historical sync at the same time, please choose only one option or set RPC to be a fallback. Read more in our docs https://docs.envio.dev/docs/configuration-file");
+        assert_eq!(
+            error.to_string(),
+            format!(
+                "EE106: Cannot define both hypersync_config and rpc as a data-source for historical sync at the same time, please choose only one option or set RPC to be a fallback. Read more in our docs {}",
+                links::DOC_CONFIGURATION_FILE
+            )
+        );

Notes:

  • Ensure the links module is in scope where you use it (e.g., add use crate::constants::links; or fully qualify crate::constants::links::DOC_CONFIGURATION_FILE).
  • For other code hits (validation.rs, SourceManager.res, etc.) either add matching constants in constants.rs (and expose them to the relevant language/package) or decide intentionally to leave some README/template content unchanged.
📜 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 147154f and 37fbbf6.

📒 Files selected for processing (2)
  • codegenerator/cli/src/config_parsing/system_config.rs (1 hunks)
  • codegenerator/cli/src/constants.rs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (2)
codegenerator/cli/src/config_parsing/system_config.rs (2)

1017-1017: Swapping hard-coded link for centralized constant is correct.

Using links::DOC_CONFIGURATION_FILE keeps the message consistent with other places and avoids drift if the docs URL changes.


1023-1027: Docs anchor verified — no change required.

Verified: the HyperIndex "Configuration Schema Reference" page on docs.envio.dev contains a "HypersyncConfig" section reachable at the #hypersyncconfig anchor, so the link used in the error message is correct.

  • File: codegenerator/cli/src/config_parsing/system_config.rs (lines 1023–1027) — keep the existing reference to links::DOC_CONFIGURATION_SCHEMA_HYPERSYNC_CONFIG.

Comment on lines +12 to +13
pub const DOC_CONFIGURATION_SCHEMA_HYPERSYNC_CONFIG: &str =
"https://docs.envio.dev/docs/HyperIndex/config-schema-reference#hypersyncconfig";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Good addition; consistent naming and scoping.

Public constant is appropriately placed under links and naming matches existing style.

Optionally add a brief doc comment to clarify where/when to use this specific link.

 pub mod links {
     pub const DOC_CONFIGURATION_FILE: &str = "https://docs.envio.dev/docs/configuration-file";
+    /// Docs anchor for HyperSyncConfig within the HyperIndex config schema reference.
     pub const DOC_CONFIGURATION_SCHEMA_HYPERSYNC_CONFIG: &str =
         "https://docs.envio.dev/docs/HyperIndex/config-schema-reference#hypersyncconfig";
 }

Please verify that the URL and anchor are still correct (docs sometimes move). If helpful, run this web search:


🌐 Web query:

Is the HyperSync config schema anchor at:
https://docs.envio.dev/docs/HyperIndex/config-schema-reference#hypersyncconfig

💡 Result:

The documentation currently does not expose a dedicated schema anchor labeled specifically #hypersyncconfig at https://docs.envio.dev/docs/HyperIndex/config-schema-reference#hypersyncconfig. There is, however, detailed material about HyperSync configuration spread throughout the related Envio docs, especially regarding how HyperSync is used by default in HyperIndex and the structure of configuration files[1][3][4][6].

Key findings:

  • The official Envio documentation at /HyperIndex/config-schema-reference does not directly provide an anchor for #hypersyncconfig in the search results, nor does any search result mention it specifically by anchor or title.
  • HyperSync settings are generally not specified as a standalone schema section. Instead, HyperSync behavior is determined by the absence of a historical rpc in the config file; if no RPC is set, HyperIndex will default to HyperSync for supported networks[1].
  • The main configuration schema is documented at /HyperIndex/configuration-file and /HyperIndex/config-schema-reference, but search results only surface configurations related to indexers, contracts, and network fields, not a specific “hypersyncconfig” section[3].
  • The start_block: 0 trick, automatic contract deployment detection, and RPC fallback logic are documented, but again not under a hypersyncconfig heading[1][4].
  • Envio documentation is structured such that HyperSync configuration is implicit via network and indexing options, not via a dedicated “hypersyncconfig” object/schema[1][3][6].

Summary:
There appears to be no officially documented, stable anchor or schema block at [/HyperIndex/config-schema-reference#hypersyncconfig] as of August 2025. HyperSync configuration is typically part of the general HyperIndex config YAML file, with no separate “hypersyncconfig” schema. If you require a schema reference, use the main configuration guide and schema explorer at /HyperIndex/config-schema-reference, and look for relevant fields like networks, rpc, and start_block.[1][3][4][6]

If you need explicit schema examples or YAML snippets for HyperSync, refer to /HyperIndex/configuration-file and related usage docs, which document all fields affecting HyperSync operation[1][3].

Citations:


Fix required — constant links to a non‑existent docs anchor; update the URL

The docs do not expose a #hypersyncconfig anchor at the referenced page. Replace the anchor URL with the HyperSync docs (or the main config schema page) and keep the brief doc comment.

  • File: codegenerator/cli/src/constants.rs (around lines 12–13)

Suggested diff:

 pub mod links {
     pub const DOC_CONFIGURATION_FILE: &str = "https://docs.envio.dev/docs/configuration-file";
-    /// Docs anchor for HyperSyncConfig within the HyperIndex config schema reference.
-    pub const DOC_CONFIGURATION_SCHEMA_HYPERSYNC_CONFIG: &str =
-        "https://docs.envio.dev/docs/HyperIndex/config-schema-reference#hypersyncconfig";
+    /// Link to the HyperSync documentation (there is no dedicated `#hypersyncconfig` anchor on the schema page).
+    pub const DOC_CONFIGURATION_SCHEMA_HYPERSYNC_CONFIG: &str =
+        "https://docs.envio.dev/docs/HyperIndex/hypersync";
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
pub const DOC_CONFIGURATION_SCHEMA_HYPERSYNC_CONFIG: &str =
"https://docs.envio.dev/docs/HyperIndex/config-schema-reference#hypersyncconfig";
pub mod links {
pub const DOC_CONFIGURATION_FILE: &str = "https://docs.envio.dev/docs/configuration-file";
/// Link to the HyperSync documentation (there is no dedicated `#hypersyncconfig` anchor on the schema page).
pub const DOC_CONFIGURATION_SCHEMA_HYPERSYNC_CONFIG: &str =
"https://docs.envio.dev/docs/HyperIndex/hypersync";
}
🤖 Prompt for AI Agents
In codegenerator/cli/src/constants.rs around lines 12–13, the
DOC_CONFIGURATION_SCHEMA_HYPERSYNC_CONFIG constant points to a non-existent
#hypersyncconfig anchor; update the string to a valid docs URL (for example
replace the value with the main config schema page
"https://docs.envio.dev/docs/HyperIndex/config-schema-reference" or the correct
HyperSync docs page URL if available) and retain the existing brief doc comment.

@DenhamPreen
DenhamPreen merged commit cef9a67 into main Aug 15, 2025
2 checks passed
@DenhamPreen
DenhamPreen deleted the dp/error-endpoint branch August 15, 2025 13:18
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