Skip to content

CSV export shows raw cents instead of a formatted amount (#62) - #74

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

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

Conversation

@Param-Harrison

Copy link
Copy Markdown
Contributor

Summary

exportCsv now writes the amount column through formatCents (e.g. 45.00) instead of raw integer cents (4500). The CLI export command shares this code, so it is fixed too.

Closes #62

Plan

Plan comment (rev 1, .factory/runs/issue-62/plan-comment.md):

  • AC-1: every data row's amount equals formatCents(amountCents). Verified by bun test tests/csv.test.ts.
  • AC-2: header, column order, row count and escaping unchanged; CLI and route use the same output. Verified by bun test tests/csv.test.ts tests/routes.test.ts tests/cli.test.ts.
  • AC-3: full gate passes. Verified by make check.

Non-goals, all respected: no change to src/money/**, the CSV header or column set, routes, CLI, db or protected paths, or csvEscape (the \r quoting gap is left for another issue). No float arithmetic on money.

Gate evidence

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

Verify verdict

Verdict comment (.factory/runs/issue-62/verdict-comment.md): pass, with AC-1, AC-2 and AC-3 all passing.

Test that bites: with src/csv.ts restored from main, exportCsv formats the amount column with formatCents fails (expected ["45.00","12.00","30.00"], received ["4500","1200","3000"]). It passes with the fix.

Two non-blocking reviewer notes: the test ordering has no id tiebreaker, and there is no test for negative or sub-dollar amounts.

Risk and rollback

Low. The change is confined to src/csv.ts plus a new tests/csv.test.ts, with no schema or API-shape change. Roll back by reverting the PR; nothing is persisted, so there is no data migration.

Factory run

Stage Agent Duration Tool calls Cost Outcome
triage claude 12s 4 $0.07 ok
plan claude 47s 11 $0.26 ok
build claude 1m 24s 16 $0.30 ok
verify claude 58s 12 $0.36 pass
pr claude 14s 3 $0.08 ok

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

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 22:11
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