fix(go): default CacheDir to tmp/go to avoid Python collision #20

Merged
kacerr merged 1 commits from fix/cache-collision into main 2026-05-07 23:07:18 +02:00
Owner

Summary

  • go/internal/config/config.go: changed CacheDir default from tmp to tmp/go. CACHE_DIR env override still works; os.MkdirAll creates the subdir on first write.
  • Both backends were defaulting to tmp/ and writing the same cache keys (attendance_regular, attendance_juniors, payments_transactions, exceptions_dict) with different shapes (Python: post-processed tuples; Go: raw rows). Whichever wrote last poisoned the cache, breaking the other backend.
  • Symptom: Python /adults failed with ValueError: too many values to unpack (expected 2, got 68) once the Go server populated tmp/attendance_regular_cache.json with 68 raw CSV rows.
  • This blocked M5.4's make parity flow (both backends running in parallel).

Test plan

  • cd go && go build ./... — clean
  • Stop Go server; hit POST /flush-cache on Python; verify /adults returns 200 (rewrites tmp/*.json with Python's shape)
  • Pull this fix, restart make web-go — verify Go writes to tmp/go/*_cache.json and leaves tmp/*_cache.json alone
  • With both running, make parity (after merging M5.4) should succeed end-to-end

After merge

The next PR (M5.4 — feat/go-m5-4-parity-binary, #19) will rebase on this fix.

🤖 Generated with Claude Code

## Summary - `go/internal/config/config.go`: changed `CacheDir` default from `tmp` to `tmp/go`. `CACHE_DIR` env override still works; `os.MkdirAll` creates the subdir on first write. - Both backends were defaulting to `tmp/` and writing the same cache keys (`attendance_regular`, `attendance_juniors`, `payments_transactions`, `exceptions_dict`) with different shapes (Python: post-processed tuples; Go: raw rows). Whichever wrote last poisoned the cache, breaking the other backend. - Symptom: Python `/adults` failed with `ValueError: too many values to unpack (expected 2, got 68)` once the Go server populated `tmp/attendance_regular_cache.json` with 68 raw CSV rows. - This blocked M5.4's `make parity` flow (both backends running in parallel). ## Test plan - [x] `cd go && go build ./...` — clean - [ ] Stop Go server; hit `POST /flush-cache` on Python; verify `/adults` returns 200 (rewrites `tmp/*.json` with Python's shape) - [ ] Pull this fix, restart `make web-go` — verify Go writes to `tmp/go/*_cache.json` and leaves `tmp/*_cache.json` alone - [ ] With both running, `make parity` (after merging M5.4) should succeed end-to-end ## After merge The next PR (M5.4 — `feat/go-m5-4-parity-binary`, #19) will rebase on this fix. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
kacerr added 1 commit 2026-05-07 23:06:48 +02:00
fix(go): default CacheDir to tmp/go to avoid Python collision
All checks were successful
Deploy to K8s / deploy (push) Successful in 9s
8b3064ffab
Previously both backends defaulted to `CacheDir=tmp` and used the
same cache keys (`attendance_regular`, `attendance_juniors`,
`payments_transactions`, `exceptions_dict`) but stored different
shapes: Python caches post-processed view-model tuples
(e.g. `(members, sorted_months)`), Go caches raw sheet rows.
Whichever backend wrote last poisoned the cache for the other,
producing `ValueError: too many values to unpack (expected 2,
got 68)` on Python's /adults after the Go side populated the
file with 68 raw CSV rows.

This breaks the M5.4 `make parity` workflow that requires both
backends running side-by-side.

Fix: change Go's default to `tmp/go` so the two cache trees
never overlap.  `CACHE_DIR` env var override still works.
`os.MkdirAll` already handles creating the new subdirectory on
first write.

Recovery for users with poisoned `tmp/`: hit /flush-cache on
the Python side once after pulling, then restart the Go server.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
kacerr merged commit e5a272b682 into main 2026-05-07 23:07:18 +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#20