Skip to content

CSV export shows raw cents instead of a formatted amount (#161) - #167

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

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

Conversation

@Param-Harrison

Copy link
Copy Markdown
Contributor

Summary

The CSV export's amount column now goes through formatCents, so it reads 45.00 instead of raw cents (4500). The CLI export command and the /export.csv route share exportCsv, so both get the fix.

Closes #161

Plan

Plan comment (rev 1) on issue #161, risk low:

  • AC-1: the amount column is formatted for flat-4b (45.00, 12.00, 30.00). Verified by bun test tests/csv.test.ts (exportCsv formats the amount column as a decimal amount).
  • AC-2: a non-round amount keeps its cents (1005 exports as 10.05). Verified by bun test tests/csv.test.ts (exportCsv keeps the cents of a non-round amount).
  • AC-3: the CLI export prints formatted amounts. Verified by bun test tests/cli.test.ts (splitbill export prints formatted amounts).
  • AC-4: header, row count and order are unchanged and the suite stays green. Verified by make check.

Non-goals, all respected: no changes to src/money/**, to the CSV columns, header, order or escaping, to routes, the CLI, the db or protected paths, and no schema change or float money math.

Gate evidence

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

Verify verdict

Verdict comment on issue #161: pass, AC-1 to AC-4 all pass, no reviewer findings. The test that bites: with src/csv.ts reverted, exportCsv keeps the cents of a non-round amount fails (Expected: "10.05" Received: "1005"), and the other two new tests fail too. All three are assertion failures, not compile errors.

Not in this PR: csvEscape doesn't quote \r and doesn't guard against spreadsheet formula injection. Both exist on main already and should be their own issue.

Risk and rollback

Low: the only production change is in src/csv.ts, and it reuses the existing formatCents. Only the text of the amount values changes, and no schema or protected path is involved. To roll back, revert this PR's commit. No data migration is needed because amounts are still stored as integer cents.

Factory run

Stage Agent Duration Tool calls Cost Outcome
triage claude 15s 5 $0.07 ok
plan claude 32s 6 $0.20 ok
build claude 1m 45s 16 $0.34 ok
verify claude 44s 11 $0.26 pass
pr claude 18s 4 $0.08 ok

5 stage runs, 3m 35s, $0.95.

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 8, 2026 21:50
@Param-Harrison
Param-Harrison deleted the factory/issue-161 branch October 8, 2026 22:06
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