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.
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
```
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 main2026-05-06 13:01:43 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What
Port
generate_sync_idfromscripts/sync_fio_to_sheets.pytogo/internal/domain/synch.GenerateSyncID.Key detail: float string format
amountin Fio transactions is always a Pythonfloat. Python'sstr(500.0)→"500.0", but Go'sstrconv.FormatFloat(500.0, 'g', -1, 64)→"500". The hash would silently differ. Fixed viaformatAmountwhich uses'f'notation in[1e-4, 1e16)and'e'outside — matching CPython'sstr(float)crossover thresholds.Changes
go/internal/domain/synch/synch.go—Transactionstruct,GenerateSyncID, internalformatAmountgo/internal/domain/synch/synch_test.go— 6 hash tests + 9 float-format tests, all expected values verified against live Pythondocs/plans/2026-05-06-1236-go-m2-6-synch-generate-sync-id.mdTest