Skip to content

Feature/mocks transaction builder#55

Merged
aron23 merged 12 commits intostagingfrom
feature/mocks-transaction-builder
Jan 23, 2026
Merged

Feature/mocks transaction builder#55
aron23 merged 12 commits intostagingfrom
feature/mocks-transaction-builder

Conversation

@aron23
Copy link
Copy Markdown
Contributor

@aron23 aron23 commented Jan 23, 2026

This pull request introduces a new mock implementation for transaction builders, improving support for mocking transactional workflows in tests. It also updates documentation to demonstrate the new mocking pattern, adds type aliases for easier usage, and enhances the behavior of mock transaction-related methods to reduce boilerplate in unit tests. Additionally, version numbers and changelogs are updated to reflect these changes.

Mocking and Testing Improvements:

  • Added MockTransactionBuilder in pkg/mocks/transaction_builder.go, providing a comprehensive mock for the core.TransactionBuilder interface, including support for fluent transaction DSL and execution of update callbacks.
  • Enhanced MockExtendedDB in pkg/mocks/extended_db.go to use the new transaction builder mock, enabling automatic execution of transaction callbacks and reducing test boilerplate. [1] [2]
  • Added helper function mustTransactionBuilder in pkg/mocks/query.go for safe type assertions when returning mocked transaction builders.
  • Introduced type alias TransactionBuilder in pkg/mocks/mocks.go and verified it in pkg/mocks/mocks_test.go for more concise test code. [1] [2]

Documentation Updates:

  • Updated pkg/mocks/README_SIMPLE_EXAMPLE.md to include a new pattern for mocking transactions with TransactWrite and MockTransactionBuilder, illustrating the improved approach.

Changelog and Versioning:

  • Updated CHANGELOG.md with new features and bug fixes, and incremented versions in .release-please-manifest.json and .release-please-manifest.premain.json to 1.2.0 and 1.2.0-rc respectively. [1] [2] [3]
  • Updated evidence timestamp in hgm-infra/evidence/hgm-rubric-report.json.

aron23 and others added 12 commits January 22, 2026 08:27
Adds MockTransactionBuilder for core.TransactionBuilder and teaches MockExtendedDB.TransactWrite / MockDB.Transaction to execute callbacks by default (less boilerplate in downstream tests).

Tests: make test-unit
Adds additional mocks tests to cover transaction builder branches and satisfy the 90% library coverage gate.

Coverage: bash scripts/coverage.sh
Fixes govet fieldalignment on MockExtendedDB and handles callback errors to satisfy errcheck.

Rubric: make rubric
Reduces flakiness in COM-8 when GitHub intermittently returns HTTP 5xx during shallow fetches.

Rubric: make rubric
…ilder

feat(mocks): add transaction builder mock
chore: sync premain -> main
@aron23 aron23 merged commit 1d2b219 into staging Jan 23, 2026
8 checks passed
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