Skip to content

CSV export shows raw cents instead of a formatted amount (#179) - #185

Closed
Param-Harrison wants to merge 3 commits into
mainfrom
factory/issue-179
Closed

Param-Harrison wants to merge 3 commits into
mainfrom
factory/issue-179

Conversation

@Param-Harrison

Copy link
Copy Markdown
Contributor

Summary

exportCsv (shared by GET /api/groups/:id/export.csv and splitbill export) now prints the amount column through formatCents (10.00) instead of raw integer cents (1000).

Closes #179

Plan

Plan comment (rev 1):

  • AC-1 a 1000-cent expense exports as 10.00, verified by bun test tests/csv.test.ts.
  • AC-2 non-round amounts keep two decimals (1005 → 10.05, 7 → 0.07), verified by bun test tests/csv.test.ts.
  • AC-3 the seeded flat-4b export shows 45.00, 12.00, 30.00 and the header is unchanged, verified by bun test tests/csv.test.ts.
  • AC-4 existing route and CLI export tests and the full gate still pass, verified by make check.

Left out on purpose (non-goals):

  • No change to the CSV header, column order, row order or csvEscape.
  • No change to src/money/cents.ts (including the separate splitCents remainder defect), routes, the CLI or the schema.
  • No currency symbols or locale formatting.
  • No edits to protected paths.

Gate evidence

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

The audit gate was skipped, not failed.

Verify verdict

Verdict: pass on all four ACs, no reviewer findings (full text in .factory/runs/issue-179/verdict-comment.md; it isn't posted on the issue thread yet, so there is no comment link). With src/csv.ts reverted, all 3 new tests fail (for example Expected ["10.05","0.07"], Received ["1005","7"]). They pass with the change. Not covered: no test uses a negative amount, though formatCents is unit-tested elsewhere.

Risk and rollback

Low: the change is confined to src/csv.ts plus a new test file, with no schema or API-shape change. Only the text of the amount column changes. To roll back, revert this PR. Nothing is stored, so there is no data migration.

Factory run

Stage Agent Duration Tool calls Cost Outcome
triage claude 13s 5 $0.06 ok
plan claude 29s 6 $0.19 ok
build claude 1m 28s 18 $0.32 ok
verify claude 42s 11 $0.25 pass
pr claude 26s 5 $0.10 ok

Proof: the new test fails without the change.

5 stage runs, 3m 19s, $0.92.

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:43
@Param-Harrison

Copy link
Copy Markdown
Contributor Author

/factory revise add a test for an amount under one dollar, like 5 cents

@Param-Harrison
Param-Harrison marked this pull request as draft October 13, 2026 09:23
@Param-Harrison
Param-Harrison marked this pull request as ready for review October 13, 2026 09:25
@Param-Harrison

Copy link
Copy Markdown
Contributor Author

/factory revise add a test for an amount under one dollar, like 5 cents

@Param-Harrison
Param-Harrison marked this pull request as draft October 13, 2026 10:11
@Param-Harrison
Param-Harrison marked this pull request as ready for review October 13, 2026 10:14
@Param-Harrison
Param-Harrison deleted the factory/issue-179 branch October 13, 2026 13:26
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