feat(go/M2.6): port domain/synch.GenerateSyncID #8

Merged
kacerr merged 1 commits from feat/m2-6-synch-generate-sync-id into main 2026-05-06 13:01:43 +02:00
Owner

What

Port generate_sync_id from scripts/sync_fio_to_sheets.py to go/internal/domain/synch.GenerateSyncID.

Key detail: float string format

amount in Fio transactions is always a Python float. Python's str(500.0)"500.0", but Go's strconv.FormatFloat(500.0, 'g', -1, 64)"500". The hash would silently differ. Fixed via formatAmount which uses 'f' notation in [1e-4, 1e16) and 'e' outside — matching CPython's str(float) crossover thresholds.

Changes

  • go/internal/domain/synch/synch.goTransaction struct, GenerateSyncID, internal formatAmount
  • go/internal/domain/synch/synch_test.go — 6 hash tests + 9 float-format tests, all expected values verified against live Python
  • Progress tracker: M2.6 ticked
  • CHANGELOG entry added
  • Plan doc: docs/plans/2026-05-06-1236-go-m2-6-synch-generate-sync-id.md

Test

cd go && go test ./internal/domain/synch/...
make go-lint && make go-build
## What Port `generate_sync_id` from `scripts/sync_fio_to_sheets.py` to `go/internal/domain/synch.GenerateSyncID`. ## Key detail: float string format `amount` in Fio transactions is always a Python `float`. Python's `str(500.0)` → `"500.0"`, but Go's `strconv.FormatFloat(500.0, 'g', -1, 64)` → `"500"`. The hash would silently differ. Fixed via `formatAmount` which uses `'f'` notation in `[1e-4, 1e16)` and `'e'` outside — matching CPython's `str(float)` crossover thresholds. ## Changes - `go/internal/domain/synch/synch.go` — `Transaction` struct, `GenerateSyncID`, internal `formatAmount` - `go/internal/domain/synch/synch_test.go` — 6 hash tests + 9 float-format tests, all expected values verified against live Python - Progress tracker: M2.6 ticked - CHANGELOG entry added - Plan doc: `docs/plans/2026-05-06-1236-go-m2-6-synch-generate-sync-id.md` ## Test ```sh cd go && go test ./internal/domain/synch/... make go-lint && make go-build ```
kacerr added 1 commit 2026-05-06 12:44:05 +02:00
feat(go/M2.6): port domain/synch.GenerateSyncID
All checks were successful
Deploy to K8s / deploy (push) Successful in 6s
54a783ea00
SHA-256 dedup hash from sync_fio_to_sheets.py generate_sync_id.
Key subtlety: Python str(float) emits "500.0" for whole-valued floats
and switches to scientific notation at |f|>=1e16 or |f|<1e-4 —
replicated via formatAmount using 'f'/'e' format selection.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
kacerr merged commit c2bffed1b8 into main 2026-05-06 13:01:43 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kacerr/fuj-management#8