feat(cli): use either Repository or JSON-RPC API to read data#738
feat(cli): use either Repository or JSON-RPC API to read data#738renatomaia wants to merge 6 commits intonext/2.0from
Conversation
efdc751 to
305b9fd
Compare
01145bf to
5ded42b
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces a ReadService abstraction for the CLI read subcommands so they can fetch data either from the local DB (via repository) or from a remote JSON-RPC endpoint, aligning CLI “read” outputs with the JSON-RPC API shapes.
Changes:
- Added
internal/read.ReadServiceinterface plus DB-backed (RepositoryReadService) and JSON-RPC-backed (JsonrpcReadService) implementations. - Updated multiple CLI
readsubcommands to use the new datasource abstraction. - Added a new config/env var/flag for selecting a remote JSON-RPC endpoint (
CARTESI_JSONRPC_ENDPOINT,--jsonrpc-endpoint).
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 30 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/read/types.go | Introduces ReadService interface for read operations. |
| internal/read/repository.go | Implements DB-backed read service using repository and marshals JSON-RPC-shaped responses. |
| internal/read/jsonrpc.go | Implements JSON-RPC-backed read service using the JSON-RPC client. |
| internal/config/generated.go | Adds CARTESI_JSONRPC_ENDPOINT to generated config and loads it into node/jsonrpc configs. |
| internal/config/generate/Config.toml | Declares CARTESI_JSONRPC_ENDPOINT in the config generator inputs. |
| cmd/cartesi-rollups-cli/root/root.go | Adds --jsonrpc-endpoint flag (bound to config). |
| cmd/cartesi-rollups-cli/root/read//.go | Switches subcommands to use ReadService and JSON-RPC params types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cmd/cartesi-rollups-cli/root/read/match_advances/match_advances.go
Outdated
Show resolved
Hide resolved
5ded42b to
18aea27
Compare
e84cea7 to
1b7160a
Compare
18aea27 to
a23cf08
Compare
1b7160a to
d93c155
Compare
6a0c122 to
2f44070
Compare
ac88e77 to
90c3e94
Compare
2f44070 to
e7b09d6
Compare
90c3e94 to
70e9d25
Compare
e7b09d6 to
892faa1
Compare
70e9d25 to
ef0433b
Compare
892faa1 to
a52a331
Compare
ef0433b to
aae86b4
Compare
a52a331 to
d9ccb60
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 11 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| // GetProcessedInputs retrieves the ProcessedInputs field from a application by Name or address. | ||
| func (r *PostgresRepository) GetProcessedInputs( | ||
| // GetProcessedInputCount retrieves the ProcessedInputs field from a application by Name or address. |
There was a problem hiding this comment.
Grammar: change 'a application' to 'an application'.
| // GetProcessedInputCount retrieves the ProcessedInputs field from a application by Name or address. | |
| // GetProcessedInputCount retrieves the ProcessedInputs field from an application by Name or address. |
| func NewRepositoryReadService(ctx context.Context, url string) (ReadService, error) { | ||
| repo, err := factory.NewRepositoryFromConnectionString(ctx, url) |
There was a problem hiding this comment.
New behavior is introduced via internal/read services (repository-backed JSON shaping + decode paths + validation), but no tests are added alongside it. Consider adding unit tests that exercise (at minimum) the input/output decoding paths, not-found behavior, and list pagination shaping so regressions in JSON formatting/validation are caught.
d9ccb60 to
b82b2c7
Compare
b82b2c7 to
c4485d9
Compare
closes #723