-
Couldn't load subscription status.
- Fork 77
feat!(network): uses meta.json instead of version.txt and removes GET /v1/version/{network} #2102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
❌ 49 Tests Failed:
View the top 3 failed test(s) by shortest run time
View the full list of 7 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
f104d49 to
bc35356
Compare
WalkthroughRemoves the public GET /version/{network} API and its service/controller implementation and tests; adds meta.json validation and consumption across net tooling and HTTP SDK (new NodeHttpService.getMeta); updates NetConfig method signatures to accept string and adds zod as a devDependency. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Script as packages/net/scripts/generate.ts
participant Fetch as Remote (net repo)
participant Zod as metaSchema.parse
participant Output as netConfigData.ts
Script->>Fetch: GET /{network}/meta.json
Fetch-->>Script: JSON (meta.json) / error
Script->>Zod: metaSchema.parse(json)
alt valid meta.json
Zod-->>Script: parsed Meta
Script->>Script: extract version, apis.rest, apis.rpc
Script->>Output: write netConfigData.ts with values
else invalid meta.json
Zod-->>Script: ZodError
Script->>Output: write fallback/null entries
end
sequenceDiagram
autonumber
participant Client
participant Router as networkRouter
participant Controller as NetworkController
participant Service as NetworkService
Note over Client,Router: GET /v1/version/{network} route removed
Client->>Router: GET /v1/version/{network}
Router-->>Client: 404 Not Found (no binding)
Note over Client,Controller: For other endpoints (e.g., GET /v1/nodes/{network}) normal flow remains:
Client->>Router: GET /v1/nodes/{network}
Router->>Controller: NetworkController.getNodes
Controller->>Service: NetworkService.getNodes
Service-->>Controller: Result (nodes)
Controller-->>Client: 200 application/json
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Nitpick comments (3)
packages/net/package.json (1)
23-23: Consider a tighter version constraint for zod.The version specification "3.*" allows all minor and patch updates within major version 3. For better reproducibility and to avoid unexpected breaking changes from future minor releases, consider using "^3.23.0" or similar.
- "zod": "3.*" + "zod": "^3.23.0"packages/net/scripts/generate.ts (1)
33-44: Consider logging which network failed validation.When meta.json validation fails, the error is logged but doesn't indicate which network had the invalid meta.json. This could make debugging more difficult.
.catch(error => { if (error instanceof ZodError) { - console.log("meta.json is invalid", error); + console.log(`meta.json is invalid for network ${network}`, error); } return null; }),packages/http-sdk/src/node/node-http.service.ts (1)
27-30: Consider wrapping validation errors in domain-specific exception for public API consumers.The
metaSchema.parse()will throw an unhandledZodErrorif the meta.json structure doesn't match the expected schema. SincegetMetais a public method of an exported service, consider catchingZodErrorand wrapping it in a domain-specific error to provide clearer error messages to SDK consumers.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
packages/net/src/generated/netConfigData.tsis excluded by!**/generated/**
📒 Files selected for processing (8)
apps/api/src/network/controllers/network/network.controller.ts(2 hunks)apps/api/src/network/routes/network/network.router.ts(3 hunks)apps/api/src/network/services/network/network.service.ts(1 hunks)apps/api/test/functional/nodes-v1.spec.ts(3 hunks)packages/http-sdk/src/node/node-http.service.ts(2 hunks)packages/net/package.json(1 hunks)packages/net/scripts/generate.ts(3 hunks)packages/net/src/NetConfig/NetConfig.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
apps/api/src/network/controllers/network/network.controller.tsapps/api/src/network/routes/network/network.router.tspackages/http-sdk/src/node/node-http.service.tsapps/api/src/network/services/network/network.service.tspackages/net/scripts/generate.tspackages/net/src/NetConfig/NetConfig.tsapps/api/test/functional/nodes-v1.spec.ts
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
apps/api/src/network/controllers/network/network.controller.tsapps/api/src/network/routes/network/network.router.tspackages/http-sdk/src/node/node-http.service.tsapps/api/src/network/services/network/network.service.tspackages/net/scripts/generate.tspackages/net/src/NetConfig/NetConfig.tsapps/api/test/functional/nodes-v1.spec.ts
**/*.spec.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)
Don't use
jest.mock()to mock dependencies in test files. Instead, usejest-mock-extendedto create mocks and pass mocks as dependencies to the service under test.
**/*.spec.{ts,tsx}: Usesetupfunction instead ofbeforeEachin test files
setupfunction must be at the bottom of the rootdescribeblock in test files
setupfunction creates an object under test and returns it
setupfunction should accept a single parameter with inline type definition
Don't use shared state insetupfunction
Don't specify return type ofsetupfunction
Files:
apps/api/test/functional/nodes-v1.spec.ts
🧬 Code graph analysis (6)
apps/api/src/network/controllers/network/network.controller.ts (1)
apps/api/src/network/http-schemas/network.schema.ts (1)
GetNodesParams(15-15)
apps/api/src/network/routes/network/network.router.ts (1)
apps/api/src/core/services/open-api-hono-handler/open-api-hono-handler.ts (1)
OpenApiHonoHandler(11-26)
packages/http-sdk/src/node/node-http.service.ts (2)
packages/net/src/NetConfig/NetConfig.ts (1)
SupportedChainNetworks(3-3)packages/http-sdk/src/http/http.service.ts (2)
extractData(12-14)extractData(17-19)
apps/api/src/network/services/network/network.service.ts (1)
apps/api/src/network/http-schemas/network.schema.ts (1)
GetNodesParams(15-15)
packages/net/src/NetConfig/NetConfig.ts (1)
packages/net/src/generated/netConfigData.ts (1)
netConfigData(1-55)
apps/api/test/functional/nodes-v1.spec.ts (1)
packages/net/src/NetConfig/NetConfig.ts (1)
NetConfig(5-44)
⏰ 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). (10)
- GitHub Check: validate (apps/provider-proxy) / validate-unsafe
- GitHub Check: validate (apps/api) / validate-unsafe
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: validate (apps/deploy-web) / should-validate-unsafe / should-validate
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: Validate local packages
🔇 Additional comments (9)
apps/api/src/network/services/network/network.service.ts (1)
32-34: LGTM! Effective simplification.The migration from async HTTP fetch to synchronous local config lookup correctly removes the need for memoization, error handling, and Result wrapping. This aligns well with the PR objective of using meta.json-based configuration.
apps/api/src/network/routes/network/network.router.ts (3)
8-9: LGTM! Cleaner module organization.Moving the export to the top of the file improves readability and follows common conventions.
30-39: LGTM! Proper Result handling.The getNodes route correctly handles the Result type with ok/val branching and error propagation.
58-61: LGTM! Simplified version endpoint.The route correctly adapts to the controller's synchronous getVersion method. Error handling via http-assert in the controller will properly propagate 404 errors through Hono's error handler.
packages/http-sdk/src/node/node-http.service.ts (1)
8-14: Schema definition looks correct.The metaSchema properly validates the meta.json structure for the codebase.recommended_version field. The schema is appropriately scoped to only the fields needed.
packages/net/scripts/generate.ts (2)
14-26: LGTM! Well-structured schemas.The zod schemas properly validate the meta.json structure with appropriate nesting. The apiSchema ensures each endpoint has an address field, and metaSchema combines this with codebase version validation.
46-51: Graceful degradation with null fallback.The networkConfig construction properly handles null meta responses by falling back to null/empty values. This ensures the script completes even if some networks have invalid meta.json files.
apps/api/src/network/controllers/network/network.controller.ts (1)
17-22: LGTM! Appropriate assertion for null version.The controller correctly uses http-assert to validate the version exists and return a 404 if not. This properly handles the nullable return from the service layer and aligns with the synchronous refactor.
apps/api/test/functional/nodes-v1.spec.ts (1)
54-67: Now let me check if there are references to meta.json or if the PR was supposed to migrate away from HTTP calls:<!-- [scratchpad_start]
[task verify_test_logic_and_http_calls 3/3]
[observations]
- Web search shows meta.json exists in akash-network/net repository and contains chain metadata
- version.txt also exists and is referenced in documentation (result 6)
- Both files coexist in the repository
- Review comment mentions PR should read from meta.json, but based on code findings, endpoint reads from NetConfig (static config), not HTTP
[analysis]- Web search confirms both version.txt and meta.json exist in external repository
- This doesn't clarify if PR changed endpoint behavior
- From code analysis: endpoint calls NetConfig.getVersion() which reads static config data
- The mock intercepts HTTP call that is never executed by endpoint
- NodeHttpService.getVersion() still calls version.txt, but endpoint doesn't use this service
[conclusion]- Review comment is CORRECT in substance: test logic is inconsistent
- However, the root cause is slightly different than stated:
- Mock is for HTTP call that endpoint does NOT make
- Endpoint uses NetConfig which reads static config
- Test validates endpoint returns what NetConfig says (tautological)
- Recommendation remains: remove mock since endpoint doesn't use HTTP
[done]
All analysis complete. Generating final response.
[scratchpad_start] -->Remove unnecessary nock mock interceptor; endpoint uses NetConfig static config, not HTTP.
The endpoint at
/v1/version/{network}(lines 58-60 in network.router.ts) delegates toNetworkController.getVersion()→NetworkService.getVersion()→NetConfig.getVersion().NetConfig.getVersion()returnsnetConfigData[this.mapped(network)].version(static configuration data), not an HTTP response.The mock at lines 57-62 intercepts calls to
/net/master/{network}/version.txt, but this HTTP endpoint is never invoked by the code path being tested. The test passes because both the mock setup and the assertion reference the samenetConfig.getVersion()call, creating a tautology.Remove the nock interceptor entirely since the endpoint doesn't perform HTTP calls to retrieve version data.
bc35356 to
25ede47
Compare
There was a problem hiding this 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 (3)
packages/net/scripts/generate.ts (1)
75-82: Resolved: fetchJson return type now matches actual usage.
Changing to Promise aligns with res.json().packages/net/src/NetConfig/NetConfig.ts (2)
27-30: Guard against empty apiUrls before returning.
Accessing apiUrls[0] may return undefined at runtime; keep contract by throwing a clear error.getBaseAPIUrl(network: string): string { - const apiUrls = netConfigData[this.mapped(network)].apiUrls; - return apiUrls[0]; + const apiUrls = netConfigData[this.mapped(network)].apiUrls; + const first = apiUrls?.[0]; + if (!first) { + throw new Error(`No API URLs configured for network "${network}"`); + } + return first; }
40-43: Guard against empty rpcUrls before returning.
Same issue for RPC; ensure non-empty or throw a descriptive error.getBaseRpcUrl(network: string): string { - const rpcUrls = netConfigData[this.mapped(network)].rpcUrls; - return rpcUrls[0]; + const rpcUrls = netConfigData[this.mapped(network)].rpcUrls; + const first = rpcUrls?.[0]; + if (!first) { + throw new Error(`No RPC URLs configured for network "${network}"`); + } + return first; }
🧹 Nitpick comments (5)
packages/net/scripts/generate.ts (4)
14-16: Validate endpoint addresses as URLs.
Tighten the schema by asserting valid URL format for addresses.-const apiSchema = z.object({ - address: z.string() -}); +const apiSchema = z.object({ + address: z.string().url() +});
18-26: Consider enforcing non-empty API/RPC lists (or warn loudly).
If empty arrays are undesirable, enforce with zod; else keep arrays optional but document/log clearly.- apis: z.object({ - rest: z.array(apiSchema), - rpc: z.array(apiSchema) - }) + apis: z.object({ + rest: z.array(apiSchema), // or .nonempty("meta.apis.rest must have at least one endpoint") + rpc: z.array(apiSchema) // or .nonempty("meta.apis.rpc must have at least one endpoint") + })Optionally refine versions:
- recommended_version: z.string() + recommended_version: z.string().regex(/^v[0-9].*$/, "expected semver prefixed with 'v'")
33-43: Improve error handling/logging for meta.json parsing/fetch.
Include network in logs and log non‑Zod errors; safeParse avoids throwing for invalid meta.- const [meta, faucetUrl] = await Promise.all([ - fetchJson(`${baseConfigUrl}/meta.json`) - .then(res => metaSchema.parse(res)) - .catch(error => { - if (error instanceof ZodError) { - console.log("meta.json is invalid", error); - } - - return null; - }), + const [meta, faucetUrl] = await Promise.all([ + fetchJson(`${baseConfigUrl}/meta.json`) + .then(raw => { + const parsed = metaSchema.safeParse(raw); + if (!parsed.success) { + console.warn(`[${network}] meta.json invalid`, parsed.error.issues); + return null; + } + return parsed.data; + }) + .catch(err => { + console.warn(`[${network}] meta.json fetch failed`, err); + return null; + }),
49-51: Normalize and de‑duplicate endpoint URLs.
Trim whitespace and remove duplicates to stabilize outputs.- apiUrls: meta?.apis?.rest?.map(({ address }) => address) ?? [], - rpcUrls: meta?.apis?.rpc?.map(({ address }) => address) ?? [] + apiUrls: [...new Set(meta?.apis?.rest?.map(({ address }) => address.trim()) ?? [])], + rpcUrls: [...new Set(meta?.apis?.rpc?.map(({ address }) => address.trim()) ?? [])]apps/api/src/network/routes/network/network.router.ts (1)
60-60: Refresh OpenAPI docs and response schema for GetVersion.
- Update description to reflect meta.json (and branch main) instead of version.txt.
- Declare a plain-text string response in OpenAPI.
Example:
responses: { - description: "Network version" + description: "Network version", + content: { + "text/plain": { + schema: { type: "string" } + } + } } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
packages/net/src/generated/netConfigData.tsis excluded by!**/generated/**
📒 Files selected for processing (8)
apps/api/src/network/controllers/network/network.controller.ts(2 hunks)apps/api/src/network/routes/network/network.router.ts(3 hunks)apps/api/src/network/services/network/network.service.ts(1 hunks)apps/api/test/functional/nodes-v1.spec.ts(1 hunks)packages/http-sdk/src/node/node-http.service.ts(2 hunks)packages/net/package.json(1 hunks)packages/net/scripts/generate.ts(3 hunks)packages/net/src/NetConfig/NetConfig.ts(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/http-sdk/src/node/node-http.service.ts
- packages/net/package.json
- apps/api/test/functional/nodes-v1.spec.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
packages/net/src/NetConfig/NetConfig.tspackages/net/scripts/generate.tsapps/api/src/network/controllers/network/network.controller.tsapps/api/src/network/services/network/network.service.tsapps/api/src/network/routes/network/network.router.ts
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
packages/net/src/NetConfig/NetConfig.tspackages/net/scripts/generate.tsapps/api/src/network/controllers/network/network.controller.tsapps/api/src/network/services/network/network.service.tsapps/api/src/network/routes/network/network.router.ts
🧬 Code graph analysis (4)
packages/net/src/NetConfig/NetConfig.ts (1)
packages/net/src/generated/netConfigData.ts (1)
netConfigData(1-55)
apps/api/src/network/controllers/network/network.controller.ts (1)
apps/api/src/network/http-schemas/network.schema.ts (1)
GetNodesParams(15-15)
apps/api/src/network/services/network/network.service.ts (1)
apps/api/src/network/http-schemas/network.schema.ts (1)
GetNodesParams(15-15)
apps/api/src/network/routes/network/network.router.ts (1)
apps/api/src/core/services/open-api-hono-handler/open-api-hono-handler.ts (1)
OpenApiHonoHandler(11-26)
⏰ 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). (10)
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: test-build
- GitHub Check: Validate local packages
🔇 Additional comments (7)
packages/net/scripts/generate.ts (2)
4-5: LGTM on adopting zod for runtime validation.
Solid move for guarding generator inputs.
47-47: LGTM on version sourcing from meta.codebase.recommended_version.
Matches PR objective to use meta.json.packages/net/src/NetConfig/NetConfig.ts (1)
23-25: LGTM on broadening to string network param.
Keeps mapping in one place and matches service/controller updates.apps/api/src/network/controllers/network/network.controller.ts (1)
17-22: LGTM: sync controller with assert-based 404.
Simple, consistent with service returning string | null.apps/api/src/network/routes/network/network.router.ts (2)
8-8: LGTM on exporting a single OpenApiHonoHandler instance.
Cleaner public surface.
30-39: LGTM on GetNodes route wiring.
Correctly unwraps Result and throws HttpError on failure.apps/api/src/network/services/network/network.service.ts (1)
32-34: Code simplification is correct; schema validation and tests confirm safety.The GetNodesParamsSchema restricts network to exactly
["mainnet", "testnet", "sandbox"], preventing invalid networks from reaching the service layer. The functional test suite explicitly validates all three networks work withnetConfig.getVersion(), and the controller adds a 404 assertion if the version is null. No risk of unhandled errors.
ab455b5 to
752a5ec
Compare
… /v1/version/{network}
BREAKING CHANGE: removes GET /v1/version/{network}
closes #2091
752a5ec to
bf95a25
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
packages/net/package.json (1)
23-23: Consider a more specific version constraint for zod.The version specifier
"3.*"will match any 3.x release, which may introduce inconsistencies across environments. A tighter constraint like"^3.24.0"would improve build reproducibility while still allowing patch updates.packages/net/scripts/generate.ts (1)
4-5: Consolidate zod imports.Both imports are from the same package and can be combined for cleaner code:
-import * as z from "zod"; -import { ZodError } from "zod"; +import { z, ZodError } from "zod";
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
apps/api/test/functional/__snapshots__/docs.spec.ts.snapis excluded by!**/*.snappackages/net/src/generated/netConfigData.tsis excluded by!**/generated/**
📒 Files selected for processing (8)
apps/api/src/network/controllers/network/network.controller.ts(0 hunks)apps/api/src/network/routes/network/network.router.ts(1 hunks)apps/api/src/network/services/network/network.service.ts(0 hunks)apps/api/test/functional/nodes-v1.spec.ts(0 hunks)packages/http-sdk/src/node/node-http.service.ts(2 hunks)packages/net/package.json(1 hunks)packages/net/scripts/generate.ts(3 hunks)packages/net/src/NetConfig/NetConfig.ts(2 hunks)
💤 Files with no reviewable changes (3)
- apps/api/test/functional/nodes-v1.spec.ts
- apps/api/src/network/controllers/network/network.controller.ts
- apps/api/src/network/services/network/network.service.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/http-sdk/src/node/node-http.service.ts
- packages/net/src/NetConfig/NetConfig.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never use type any or cast to type any. Always define the proper TypeScript types.
Files:
packages/net/scripts/generate.tsapps/api/src/network/routes/network/network.router.ts
**/*.{js,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{js,ts,tsx}: Never use deprecated methods from libraries.
Don't add unnecessary comments to the code
Files:
packages/net/scripts/generate.tsapps/api/src/network/routes/network/network.router.ts
🧬 Code graph analysis (1)
apps/api/src/network/routes/network/network.router.ts (1)
apps/api/src/core/services/open-api-hono-handler/open-api-hono-handler.ts (1)
OpenApiHonoHandler(11-26)
⏰ 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). (6)
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: test-build
🔇 Additional comments (5)
apps/api/src/network/routes/network/network.router.ts (2)
8-9: LGTM! Clean export placement.Moving the router export to the top of the file is good practice and makes the router instance available for immediate route binding.
10-39: LGTM! GetNodes route implementation is solid.The route definition and handler correctly implement the GET /v1/nodes/{network} endpoint with proper schema validation and error handling. The underlying meta.json integration occurs at the controller/service layer, which aligns with proper separation of concerns.
packages/net/scripts/generate.ts (3)
14-26: LGTM!The schema definitions correctly model the expected meta.json structure and will provide runtime validation for the network configuration data.
46-51: LGTM!The data extraction logic correctly uses optional chaining and provides sensible fallbacks (null for version, empty arrays for URLs) when meta.json is unavailable or invalid.
75-82: LGTM!The fetchJson helper function correctly returns
Promise<unknown>and includes proper error handling with status details. The type annotation issue from the previous review has been resolved.
| const [meta, faucetUrl] = await Promise.all([ | ||
| fetchJson(`${baseConfigUrl}/meta.json`) | ||
| .then(res => metaSchema.parse(res)) | ||
| .catch(error => { | ||
| if (error instanceof ZodError) { | ||
| console.log("meta.json is invalid", error); | ||
| } | ||
|
|
||
| return null; | ||
| }), | ||
| fetchText(`${baseConfigUrl}/faucet-url.txt`).catch(() => null) | ||
| ]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve error logging clarity.
The catch block handles all errors (network failures, JSON parsing errors, and validation errors) but only logs ZodError instances. Network or JSON parsing failures will silently return null without any logging, which could complicate debugging.
Consider logging all error types with appropriate context:
.catch(error => {
if (error instanceof ZodError) {
- console.log("meta.json is invalid", error);
+ console.error(`[${network}] meta.json validation failed:`, error.message);
+ } else {
+ console.error(`[${network}] Failed to fetch or parse meta.json:`, error.message);
}
return null;
}),Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In packages/net/scripts/generate.ts around lines 33 to 44, the current catch
only logs ZodError and swallows network/parse errors silently; update the catch
to log all errors with context and preserve the existing behavior of returning
null. Specifically, inside the catch, if error is a ZodError log a descriptive
message like "meta.json validation failed" plus the error details; otherwise log
a different descriptive message like "failed to fetch or parse meta.json" with
the error; use console.error (or the project logger if available) and then
return null.
closes #2091
Summary by CodeRabbit
New Features
Refactor
Breaking Changes
Chores
Tests