Skip to content

CSV export shows raw cents instead of a formatted amount (#170) - #176

Closed
Param-Harrison wants to merge 2 commits into
mainfrom
factory/issue-170
Closed

Param-Harrison wants to merge 2 commits into
mainfrom
factory/issue-170

Conversation

@Param-Harrison

Copy link
Copy Markdown
Contributor

Summary

The CSV export (and the CLI export command that shares it) now prints the amount column as a formatted decimal (10.00) via formatCents, instead of raw integer cents (1000).

Closes #170

Plan

Plan comment (rev 1):

  • AC-1: exportCsv writes formatCents(amountCents) (1000 → 10.00, 1005 → 10.05), verified by bun test tests/csv.test.ts ("formats the amount column as a 2-decimal amount").
  • AC-2: the seeded Flat 4B export shows 45.00, 12.00, 30.00, verified by bun test tests/csv.test.ts ("seeded flat-4b export uses formatted amounts").
  • AC-3: header and row count unchanged; existing CLI and route export tests pass, verified by make test.
  • AC-4: full gate passes, verified by make check.

Deliberately left out (non-goals): no change to src/money/** (including the separate splitCents remainder bug), the CSV header/columns/csvEscape, routes, CLI, auth, schema or stored data. No float math on money.

Gate evidence

FACTORY_GATES: status=GREEN passed=3 failed=0 skipped=1 failed_gates=audit

(audit is skipped; it is not part of make check.)

Verify verdict

Verdict: pass, all four ACs. The verdict comment is on the issue thread (#170) and is not copied here.

Test that bites: with src/csv.ts reverted, "formats the amount column as a 2-decimal amount" fails with Expected ["10.00","10.05"], Received ["1000","1005"]. The seeded-export test fails the same way (["4500","1200","3000"]).

Noted by the reviewer as separate pre-existing issues, not part of this PR: csvEscape does not neutralise formula-leading characters, and formatCents throws on a non-integer amountCents.

Risk and rollback

Low: a change confined to one non-protected module (src/csv.ts) plus a new test file, with no schema or API-shape change. Only the text of the amount values changes. Rollback: revert this PR; stored data is untouched.

Factory run

Stage Agent Duration Tool calls Cost Outcome
triage claude 17s 6 $0.09 ok
plan claude 28s 5 $0.25 ok
build claude 1m 12s 17 $0.35 ok
verify claude 46s 11 $0.32 pass
pr claude 13s 3 $0.08 ok

Proof: the new test fails without the change.

5 stage runs, 2m 56s, $1.09.

Went well

  • triage, plan, build, verify, pr passed on the first attempt
  • verify approved on the first round

Needed help

  • nothing

@Param-Harrison
Param-Harrison marked this pull request as ready for review October 13, 2026 08:28
@Param-Harrison
Param-Harrison deleted the factory/issue-170 branch October 13, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSV export shows raw cents instead of a formatted amount

1 participant