A calendar library returned the same answer for every year — and my tests agreed with it
Description and use
The saju service now correctly computes year pillars based on accurate solar‑term instants, and the test suite reliably detects parameter‑ignoring bugs.
Problem
A deterministic Korean saju service relied on a solar‑term library that returned the same instant for every year, causing incorrect year pillars for users born on solar‑term days.
Outcome
The saju service now correctly computes year pillars based on accurate solar‑term instants, and the test suite reliably detects parameter‑ignoring bugs.
Workflow
- 1. Identify that the library function getSolarTermsByYear ignores its year argument.
- 2. Dump 입춘 values for consecutive years and compare to an independent astronomical calculation.
- 3. Discover that the library returns the same instant for all years, causing wrong year pillars.
- 4. Realize tests are using the same source of truth and cannot catch the bug.
- 5. Write a property test asserting that solar‑term instants vary with year.
- 6. Replace lookup with astronomical computation via astronomy-engine (root‑find on solar longitude).
- 7. Cache results per year and expose both wall‑clock and instant values.
- 8. Re‑anchor golden tests to real boundaries and add variance assertion.
- 9. Deploy corrected engine and ensure existing charts are not silently recomputed.
- Record date: 2026-09-09T04:30:46.042Z