Skip to content

fix(mirror): tolerate NULL hash on v2 sources with hash logs disabled#1484

Merged
gfyrag merged 1 commit into
release/v3.0from
fix/mirror-hash-null
Jul 2, 2026
Merged

fix(mirror): tolerate NULL hash on v2 sources with hash logs disabled#1484
gfyrag merged 1 commit into
release/v3.0from
fix/mirror-hash-null

Conversation

@gfyrag

@gfyrag gfyrag commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • v2 ledgers with LEDGER_FEATURE_HASH_LOGS disabled leave logs.hash NULL, breaking the postgres mirror source scan:

    scanning log row: can't scan into dest[4] (col: encode): cannot scan NULL into *string
    
  • Coalesce the hex-encoded hash to '' at the SQL layer. V2Log.Hash is not consumed downstream, so the empty-string default preserves current behavior.

Test plan

  • Point a v2 mirror at a source ledger with hash-logs feature disabled and verify the mirror progresses past the first log page instead of erroring on scan.
  • Existing v2 sources with hashes populated continue to sync with the hex hash string flowing through unchanged.

v2 ledgers with LEDGER_FEATURE_HASH_LOGS disabled leave logs.hash NULL,
which failed the postgres source scan with:

  scanning log row: can't scan into dest[4] (col: encode): cannot scan NULL into *string

COALESCE the hex-encoded hash to '' at the SQL layer. V2Log.Hash is not
consumed downstream, so the empty-string default preserves current
behavior.
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • main

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 766ca2c9-9c41-4353-8c35-1fb15a9c7f85

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/mirror-hash-null

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@NumaryBot

Copy link
Copy Markdown
Contributor

✅ Approve — automated review

The change narrowly addresses nullable v2 log hashes by coercing the SQL expression to a non-null text value before scanning into a Go string. No downstream usage or compatibility issue was found in the modified path.

No findings.

@gfyrag gfyrag merged commit e9d5ca1 into release/v3.0 Jul 2, 2026
9 checks passed
@gfyrag gfyrag deleted the fix/mirror-hash-null branch July 2, 2026 14:32
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 74.09%. Comparing base (aa373d5) to head (6fa2b48).
⚠️ Report is 2 commits behind head on release/v3.0.

Files with missing lines Patch % Lines
internal/adapter/v2/source_postgres.go 0.00% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@               Coverage Diff                @@
##           release/v3.0    #1484      +/-   ##
================================================
+ Coverage         73.66%   74.09%   +0.43%     
================================================
  Files               388      388              
  Lines             39747    39734      -13     
================================================
+ Hits              29278    29442     +164     
+ Misses             7951     7767     -184     
- Partials           2518     2525       +7     
Flag Coverage Δ
e2e 74.09% <0.00%> (+0.43%) ⬆️
scenario 74.09% <0.00%> (+0.43%) ⬆️
unit 74.09% <0.00%> (+0.43%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

4 participants