Skip to content

Review follow-ups: P&L doc clarifications and slices.Sort - #3

Merged
tanem merged 3 commits into
mainfrom
chore/review-followups
Jun 13, 2026
Merged

Review follow-ups: P&L doc clarifications and slices.Sort#3
tanem merged 3 commits into
mainfrom
chore/review-followups

Conversation

@tanem

@tanem tanem commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Small follow-ups from a full-codebase review. Three focused commits; no behaviour change to any command.

Changes

docs: clarify P&L semantics in the README — make three existing behaviours explicit rather than discoverable:

  • The exporter owns which deals count (closing deals only; cash flows and entry legs excluded upstream) and the sign convention; the CLI does not re-check them. This is the largest correctness surface, so it's now stated loudly with a "keep the two in step" warning.
  • Dates, --last and "today" are interpreted in UTC and deals bucket by UTC day — which can differ from local day from a far-offset timezone (e.g. NZ) near midnight.
  • --last runs from N units ago through today inclusive, so 30d covers 31 calendar days.

refactor: sort with slices over the sort packageslices.Sort works on any ordered type, so the int64 less-closure in sort.Slice disappears and sort.Strings becomes slices.Sort. Behaviour unchanged; covered by existing aggregate tests.

docs: explain the decoded-but-unused fields — a comment on OpenPositions/CashFlows records that they're kept for schema fidelity, that cash flows are deliberately excluded from trading P&L, and that open positions are reserved for a future command — so a future tidy-up doesn't delete them and reintroduce a cash-flow bug.

Decisions explicitly not taken

The review also considered a runtime guard on the exporter contract, a --tz flag, changing --last Nd to exactly N days, switching %v%w, reconciling rounded rows to the total, and extracting a shared-flags helper. Each was deliberately declined as premature or incorrect for this tool; see commit messages / review notes.

Verification

go build, go vet, gofmt -d, and go test ./... all clean after every change.

🤖 Generated with Claude Code

tanem and others added 3 commits June 14, 2026 11:04
Make three behaviours explicit in the README so they are stated rather
than discovered:

- the exporter owns which deals count and the sign convention, and the
  CLI does not re-check them — keep the two in step;
- dates, --last and "today" are interpreted in UTC and deals bucket by
  UTC day, which can differ from local day from a far-offset timezone;
- --last runs from N units ago through today inclusive, so 30d covers
  31 calendar days.

No behaviour change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
slices.Sort works on any ordered type, so the int64 less-closure in
sort.Slice is no longer needed and sort.Strings becomes slices.Sort.
Behaviour is unchanged; covered by the existing aggregate tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Both fields are kept for schema fidelity with the exporter; cash flows
are deliberately excluded from trading P&L and open positions are
reserved for a future command. The comment stops a future tidy-up from
deleting them and reintroducing a cash-flow bug or breaking the schema
contract.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.65%. Comparing base (6f3129a) to head (2e8661d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main       #3   +/-   ##
=======================================
  Coverage   78.65%   78.65%           
=======================================
  Files          11       11           
  Lines         431      431           
=======================================
  Hits          339      339           
  Misses         75       75           
  Partials       17       17           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tanem
tanem merged commit 5aa53d5 into main Jun 13, 2026
6 checks passed
@tanem
tanem deleted the chore/review-followups branch June 13, 2026 23:47
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.

1 participant