fix(py): parity coercions — amount/message types + junior '?' sticky #25

Merged
kacerr merged 3 commits from fix/py-parity-coercions into main 2026-05-08 00:26:39 +02:00
Owner

Summary

Three make parity diffs fixed, all Python-side:

match_payments.py — tx field coercions

  • amount: non-numeric sheet values like "---" were passed through as strings; Go's parseFloat silently returns 0.0. Added get_float helper that matches.
  • message: numeric cell values (bank references in the message column) came through as float64; Go's getVal uses fmt.Sprint → always a string. Applied get_str to message.

views.py — junior "?" cell text sticky across exception overrides

  • Go's build_juniors sets cellText = "?" + countStr whenever IsUnknown is true, regardless of exceptions. Python was checking expected == "?", but reconcile overwrites expected with the exception amount (e.g. 0) before the view builder runs — dropping the "?" to "-".
  • Fix: derive is_unknown from original_expected == "?" (captured before exception substitution). Also aligned the tooltip guard to match Go: only show Received/Expected tooltip for non-unknown months (or when paid > 0).

Test plan

  • make test — 31 tests, all green
  • Restart make web + POST /flush-cache, then make parity — confirm these three diffs gone

🤖 Generated with Claude Code

## Summary Three `make parity` diffs fixed, all Python-side: **`match_payments.py` — tx field coercions** - `amount`: non-numeric sheet values like `"---"` were passed through as strings; Go's `parseFloat` silently returns `0.0`. Added `get_float` helper that matches. - `message`: numeric cell values (bank references in the message column) came through as `float64`; Go's `getVal` uses `fmt.Sprint` → always a string. Applied `get_str` to `message`. **`views.py` — junior `"?"` cell text sticky across exception overrides** - Go's `build_juniors` sets `cellText = "?" + countStr` whenever `IsUnknown` is true, regardless of exceptions. Python was checking `expected == "?"`, but `reconcile` overwrites `expected` with the exception amount (e.g. `0`) before the view builder runs — dropping the `"?"` to `"-"`. - Fix: derive `is_unknown` from `original_expected == "?"` (captured before exception substitution). Also aligned the tooltip guard to match Go: only show Received/Expected tooltip for non-unknown months (or when paid > 0). ## Test plan - [x] `make test` — 31 tests, all green - [ ] Restart `make web` + `POST /flush-cache`, then `make parity` — confirm these three diffs gone 🤖 Generated with [Claude Code](https://claude.com/claude-code)
kacerr added 3 commits 2026-05-08 00:26:28 +02:00
fix(py): coerce VS column to string in payments tx projection
All checks were successful
Deploy to K8s / deploy (push) Successful in 7s
07ca1cd9e1
The Sheets API returns VS (variabilní symbol) cells as float64 when
the column is number-formatted, so Python was emitting vs: 0 (a JSON
number) while Go's getVal uses fmt.Sprint and always emits vs: "0"
(a string). Add get_str helper that converts whole-number floats via
int() first (matching Go's %g formatting), applied to the vs field.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two remaining make parity diffs vs Go:

- amount: non-numeric sheet values like "---" passed through as strings;
  Go's parseFloat silently returns 0.0 for unparseable values. Add
  get_float helper that matches that behaviour.
- message: numeric cell values (e.g. a bank reference in the message
  column) passed through as float64; Go's getVal uses fmt.Sprint and
  always emits a string. Apply get_str to the message field.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(py): make junior '?' cell text sticky across exception overrides
All checks were successful
Deploy to K8s / deploy (push) Successful in 8s
58973473c9
Go's build_juniors sets cellText = "?" + countStr whenever
md.IsUnknown is true, regardless of whether an exception overrides the
expected amount. Python was checking expected == "?" for this branch,
but reconcile replaces expected with the exception amount (e.g. 0)
before the view builder runs, so the "?" was silently dropped to "-".

Fix: derive is_unknown from original_expected == "?" (set before
exception substitution) instead of expected == "?". Also align the
tooltip guard: Go only shows Received/Expected tooltip for non-unknown
months (or when paid > 0), matching the same is_unknown flag.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
kacerr merged commit 709a2f2335 into main 2026-05-08 00:26:39 +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#25