Rename HyperSyncSolanaClient to SvmHyperSyncClient - #1309
Conversation
…k.time Investigation of the "blockTime = undefined" report: instruction.block.time is joined correctly from the response's blocks table (verified live against solana.hypersync.xyz for the Metaplex window). However, the server returns rows for the transaction/log/token-balance tables only when the table's field list is non-empty, so the per-selection include_transaction / include_logs flags silently returned nothing and instruction.transaction / instruction.logs were always undefined. Spell out the needed columns whenever an event config opts into them. - New mocked-client regression test covers the blockTime join and the field-selection shape of the outgoing query. - The live Metaplex demo now persists instruction.block.time and asserts every write carries a sane block time and a transaction signature. - The live client test additionally asserts every matched instruction's slot comes back with a blockTime. https://claude.ai/code/session_013QfKfr5YDVHaomTUZLn6dG
…e mode Mirrors the svm_hypersync_source naming on the Rust side: HyperSyncSolanaClient -> SvmHyperSyncClient, HyperSyncSolanaSource -> SvmHyperSyncSource (tests renamed to match). The server's default merge mode is released, so the per-selection include_transaction / include_logs / include_token_balances flags are no longer needed: requesting a table's columns in the field selection is what opts the matched result set into that join. Drop the flags from the built query and lock the full query shape into the mocked-client test. Verified live that transactions/logs/token balances come back scoped to the matched instructions without the flags. https://claude.ai/code/session_013QfKfr5YDVHaomTUZLn6dG
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis PR migrates SvmHyperSyncSource from the legacy HyperSyncSolanaClient to the newer SvmHyperSyncClient library, restructures instruction-selection queries, updates generated indexer API types for SVM, adds lastUpdatedTime tracking to Metaplex metadata handlers, and provides test coverage for the new client. ChangesSVM HyperSync Client Migration and Feature Enhancements
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scenarios/test_codegen/test/SvmHyperSyncClient_test.res`:
- Around line 28-43: The test currently reads the first instruction with
Array.getUnsafe(0) (assigned to `first`) before checking `hasInstructions`,
which can throw on empty responses; change the logic to only access
`resp.data.instructions` when its length is > 0 (the same condition used for
`hasInstructions`) — e.g. compute `hasInstructions` first from
`resp.data.instructions->Array.length`, then conditionally obtain `first` (or
use a safe option-get) and only reference `first.programId` and `first.data`
when the option/conditional proves an instruction exists; update references in
the summary block accordingly so no unsafe indexing occurs.
In `@scenarios/test_codegen/test/SvmHyperSyncSource_test.res`:
- Around line 93-99: The test mutates global Core.addonRef to inject a mock
HypersyncSolanaClient and never restores it; wrap the setup so you save the
original value of Core.addonRef before assigning the mock (e.g.,
originalAddonRef = Core.addonRef), run SvmHyperSyncSource.make(...) and the
assertions, and then restore Core.addonRef back to originalAddonRef in a
finally/cleanup block (or use the test framework's afterEach/teardown) to avoid
leaking the mock into other tests.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e53a5981-e607-4b66-8501-8c55a304b2b6
📒 Files selected for processing (12)
packages/envio/src/ChainFetcher.respackages/envio/src/Main.respackages/envio/src/sources/SvmHyperSyncClient.respackages/envio/src/sources/SvmHyperSyncSource.resscenarios/svm_flow_xray/src/indexer.test.tsscenarios/svm_metaplex_demo/schema.graphqlscenarios/svm_metaplex_demo/src/handlers/TokenMetadataHandlers.tsscenarios/svm_metaplex_demo/src/indexer.test.tsscenarios/svm_test/src/Indexer.resscenarios/test_codegen/test/HyperSyncSolanaClient_test.resscenarios/test_codegen/test/SvmHyperSyncClient_test.resscenarios/test_codegen/test/SvmHyperSyncSource_test.res
💤 Files with no reviewable changes (1)
- scenarios/test_codegen/test/HyperSyncSolanaClient_test.res
…7ied68 # Conflicts: # packages/envio/src/sources/SvmHyperSyncSource.res # scenarios/test_codegen/test/HyperSyncSolanaClient_test.res
Read the first instruction as an option so an empty live response fails the shape assertion instead of throwing, and save/restore Core.addonRef around the mocked client injection so the mock can't leak into other tests sharing the process. Mock fromConfig now also takes the user-agent argument added in client v0.0.7. https://claude.ai/code/session_013QfKfr5YDVHaomTUZLn6dG
Rename the Solana HyperSync client module from
HyperSyncSolanaClienttoSvmHyperSyncClientfor consistency with SVM (Solana Virtual Machine) naming conventions used throughout the codebase.Key Changes
HyperSyncSolanaClient→SvmHyperSyncClientacross all imports and type referencesincludeTransaction/includeLogs/includeTokenBalancesflags to a centralizedfieldsobject that explicitly lists requested columns for each tableinstruction.transactiondataSvmHyperSyncSource_test.res) verifying:instruction.block.timecorrectly carries the slot's blockTime from the responseHyperSyncSolanaClient_test.res→SvmHyperSyncClient_test.reswith updated query structurelastUpdatedTimefield to TokenMetadata schema and handler to track block timestampslastUpdatedTimeandlastTxSignaturein instruction handlersImplementation Details
The field selection change ensures that when
includeTransactionis true on an event config, the query explicitly requests all transaction columns (Slot,TransactionIndex,Signatures,FeePayer,Success,Err,Fee,ComputeUnitsConsumed,AccountKeys,RecentBlockhash,Version). Similarly for logs and token balances. This prevents silent data loss and makes the query intent explicit.https://claude.ai/code/session_013QfKfr5YDVHaomTUZLn6dG
Summary by CodeRabbit
New Features
Improvements
Tests