Skip to content

Conversation

@tmosleyIII
Copy link
Contributor

This pull request introduces enhancements to the documentation and significant updates to the SaveContractInvocationsToPostgreSQL functionality in the consumer module. The changes include adding new JSONB columns and indexes for contract arguments, improving logging, and updating the documentation with environment setup details and common pipeline types.

Documentation Updates:

  • Added a note in CLAUDE.md clarifying that the codebase lacks test files and relies on Docker-based integration and manual testing.
  • Updated CLAUDE.md to include environment variable overrides for configuration, Go version requirements, system library dependencies, and descriptions of common pipeline types.

Database Schema Enhancements:

  • Added arguments and arguments_decoded JSONB columns to the contract_invocations table in consumer_save_contract_invocations_to_postgresql.go. These columns store raw and decoded contract invocation arguments.
  • Created GIN indexes on the new arguments and arguments_decoded columns to improve query performance.
  • Added a migration script to ensure the new columns and indexes are created if they do not already exist.

Code Enhancements:

  • Updated the Process method to handle and insert arguments and arguments_decoded into the database, with error handling for JSON marshaling.
  • Enhanced logging to include details about the number of arguments and decoded arguments for each contract invocation.

@tmosleyIII tmosleyIII requested a review from Copilot July 10, 2025 22:58
@tmosleyIII tmosleyIII self-assigned this Jul 10, 2025
Copy link
Contributor

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 enhances how contract invocation arguments are stored and logged in PostgreSQL and updates the project documentation with environment and testing details.

  • Adds arguments and arguments_decoded JSONB columns plus GIN indexes (with migration)
  • Updates Process to marshal/store arguments and includes detailed logging
  • Improves CLAUDE.md with test notes, env var overrides, Go requirements, system libs, and common pipeline types

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
consumer/consumer_save_contract_invocations_to_postgresql.go Added JSONB columns and GIN indexes, migration block, marshaling in Process, and enhanced logging
CLAUDE.md Added note on lack of test files, environment overrides, Go version, system libs, and common pipeline types
Comments suppressed due to low confidence (3)

consumer/consumer_save_contract_invocations_to_postgresql.go:128

  • This error message is used after the migration block as well, which can be misleading. Consider changing it to reflect that a schema migration step failed, e.g., "failed to migrate contract_invocations schema".
		return fmt.Errorf("failed to create contract_invocations table: %w", err)

CLAUDE.md:50

  • [nitpick] For consistency with the surrounding list items, prefix this line with a hyphen (-) so it matches the bullet style.
Note: The codebase currently has no test files (*_test.go). Testing relies on Docker-based integration testing and manual configuration testing.

consumer/consumer_save_contract_invocations_to_postgresql.go:261

  • Consider adding unit or integration tests for the new JSONB marshalling and insertion logic to verify that both raw and decoded arguments are correctly stored and handled.
	var argumentsJSON, argumentsDecodedJSON interface{}

CREATE INDEX IF NOT EXISTS idx_contract_invocations_ledger_sequence ON contract_invocations(ledger_sequence);
CREATE INDEX IF NOT EXISTS idx_contract_invocations_transaction_hash ON contract_invocations(transaction_hash);
CREATE INDEX IF NOT EXISTS idx_contract_invocations_function_name ON contract_invocations(function_name);
CREATE INDEX IF NOT EXISTS idx_contract_invocations_arguments_gin ON contract_invocations USING gin(arguments);
Copy link

Copilot AI Jul 10, 2025

Choose a reason for hiding this comment

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

[nitpick] The GIN index creation for arguments appears both in the initial schema setup and again in the migration block. Consider consolidating or removing the redundancy to simplify the initialization logic.

Copilot uses AI. Check for mistakes.
@tmosleyIII tmosleyIII merged commit f271eeb into main Jul 10, 2025
@tmosleyIII tmosleyIII deleted the feature/tmosley/update-contract-invocations-consumer branch July 10, 2025 23:01
@claude claude bot mentioned this pull request Nov 19, 2025
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