Skip to content

feat(cli): use either Repository or JSON-RPC API to read data#738

Open
renatomaia wants to merge 6 commits intonext/2.0from
features/cli-read-jsonrpc
Open

feat(cli): use either Repository or JSON-RPC API to read data#738
renatomaia wants to merge 6 commits intonext/2.0from
features/cli-read-jsonrpc

Conversation

@renatomaia
Copy link

closes #723

@renatomaia renatomaia requested a review from vfusco February 19, 2026 19:02
@renatomaia renatomaia self-assigned this Feb 19, 2026
@renatomaia renatomaia force-pushed the features/cli-read-prt-data branch from efdc751 to 305b9fd Compare February 19, 2026 19:42
@renatomaia renatomaia force-pushed the features/cli-read-jsonrpc branch from 01145bf to 5ded42b Compare February 19, 2026 19:51
@vfusco vfusco requested a review from Copilot February 20, 2026 15:20
@vfusco vfusco added this to the 2.0.0 milestone Feb 20, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.ReadService interface plus DB-backed (RepositoryReadService) and JSON-RPC-backed (JsonrpcReadService) implementations.
  • Updated multiple CLI read subcommands 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.

@renatomaia renatomaia force-pushed the features/cli-read-jsonrpc branch from 5ded42b to 18aea27 Compare February 20, 2026 18:29
@renatomaia renatomaia force-pushed the features/cli-read-prt-data branch from e84cea7 to 1b7160a Compare February 20, 2026 19:01
@renatomaia renatomaia force-pushed the features/cli-read-jsonrpc branch from 18aea27 to a23cf08 Compare February 20, 2026 19:01
@renatomaia renatomaia force-pushed the features/cli-read-prt-data branch from 1b7160a to d93c155 Compare February 20, 2026 21:08
@renatomaia renatomaia force-pushed the features/cli-read-jsonrpc branch 2 times, most recently from 6a0c122 to 2f44070 Compare February 20, 2026 22:35
@renatomaia renatomaia force-pushed the features/cli-read-prt-data branch 2 times, most recently from ac88e77 to 90c3e94 Compare February 21, 2026 03:19
@renatomaia renatomaia force-pushed the features/cli-read-jsonrpc branch from 2f44070 to e7b09d6 Compare February 21, 2026 03:19
@renatomaia renatomaia force-pushed the features/cli-read-prt-data branch from 90c3e94 to 70e9d25 Compare February 23, 2026 19:08
@renatomaia renatomaia force-pushed the features/cli-read-jsonrpc branch from e7b09d6 to 892faa1 Compare February 23, 2026 19:09
@renatomaia renatomaia force-pushed the features/cli-read-prt-data branch from 70e9d25 to ef0433b Compare February 23, 2026 20:26
@renatomaia renatomaia force-pushed the features/cli-read-jsonrpc branch from 892faa1 to a52a331 Compare February 23, 2026 20:26
@renatomaia renatomaia force-pushed the features/cli-read-prt-data branch from ef0433b to aae86b4 Compare February 23, 2026 21:05
Base automatically changed from features/cli-read-prt-data to next/2.0 February 24, 2026 21:00
@renatomaia renatomaia force-pushed the features/cli-read-jsonrpc branch from a52a331 to d9ccb60 Compare February 24, 2026 21:17
@vfusco vfusco requested review from Copilot and mpolitzer February 25, 2026 14:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Grammar: change 'a application' to 'an application'.

Suggested change
// GetProcessedInputCount retrieves the ProcessedInputs field from a application by Name or address.
// GetProcessedInputCount retrieves the ProcessedInputs field from an application by Name or address.

Copilot uses AI. Check for mistakes.
Comment on lines +883 to +884
func NewRepositoryReadService(ctx context.Context, url string) (ReadService, error) {
repo, err := factory.NewRepositoryFromConnectionString(ctx, url)
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@renatomaia renatomaia force-pushed the features/cli-read-jsonrpc branch from d9ccb60 to b82b2c7 Compare February 25, 2026 18:17
@renatomaia renatomaia force-pushed the features/cli-read-jsonrpc branch from b82b2c7 to c4485d9 Compare February 25, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants