Skip to content

CSV export shows raw cents instead of a formatted amount (#188) - #189

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

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

Conversation

@Param-Harrison

Copy link
Copy Markdown
Contributor

Summary

The CSV export's amount column now prints a formatted decimal amount (10.00) instead of raw integer cents (1000), by formatting it with formatCents in exportCsv. The HTTP route and CLI export pick up the fix through exportCsv.

Closes #188

Plan

Plan comment (rev 1), approved with /factory approve:

  • AC-1: seeded amount cells are 45.00, 12.00, 30.00, verified by bun test tests/csv.test.ts
  • AC-2: a non-round amount (1005 cents) exports as 10.05, verified by bun test tests/csv.test.ts
  • AC-3: header, row count and escaping are unchanged, and the route and CLI tests still pass, verified by bun test tests/csv.test.ts tests/routes.test.ts tests/cli.test.ts
  • AC-4: the full gate passes, verified by make check

Left out on purpose (non-goals): src/money/** (including the separate splitCents remainder defect), CSV header, escaping and SQL, src/routes/**, src/cli.ts, public/index.html, and all protected paths.

Gate evidence

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

The audit gate is optional and was skipped. It is not part of make check.

Verify verdict

Verdict: pass in 1 round, with no reviewer findings. Evidence is in .factory/runs/issue-188/verdict-comment.md.

The tests bite. With src/csv.ts reverted, both new tests fail on assertions: the amounts come out as "4500","1200","3000" and 1005. With the change, bun test tests/csv.test.ts tests/routes.test.ts tests/cli.test.ts gives 16 pass, 0 fail.

Pre-existing issues the reviewer noted, not caused by this diff and worth separate issues:

  • csvEscape doesn't quote \r or neutralise spreadsheet formulas.
  • splitCents drops the remainder.

Risk and rollback

Low: it changes 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 cell changes. formatCents throws on non-integer cents, so a bad value now fails loudly instead of being exported. To roll back, revert this PR; nothing else depends on it.

Factory run

Stage Agent Duration Tool calls Cost Outcome
triage claude 14s 6 $0.08 ok
plan claude 32s 6 $0.26 ok
build claude 58s 14 $0.33 ok
verify claude 46s 10 $0.30 pass
pr claude 17s 5 $0.10 ok

Proof: the new test fails without the change.

5 stage runs, 2m 47s, $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 20:47
@Param-Harrison
Param-Harrison deleted the factory/issue-188 branch October 13, 2026 20:49
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