Skip to content

feat(statements): refuse partial-day exports and add finance review of organizer uploads (#57) - #243

Merged
JOY (JOY) merged 7 commits into
devfrom
claude/57-import-followups-4ca03b
Nov 18, 2026
Merged

JOY (JOY) merged 7 commits into
devfrom
claude/57-import-followups-4ca03b

Conversation

@JOY

@JOY JOY (JOY) commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Refs #57

Statement import follow-ups, app part (line:money). The database part is DOS/DOS.Me#1770 (migration 20261122090000_give_statement_import_followups). It must reach a database before this app code uses the new RPC and table. Until then the threshold reads as unknown and the notices are hidden. The Give Product Owner merges (second Money review).

Partial-day exports (parser contract)

  • ParsedStatement.coverage is now required: "full", "ends_early" or "partial". Every parser must state it from the file itself.
  • normalizeStatement refuses with STATEMENT_PARTIAL_EXPORT:
    • any partial export, today's included (PO decision);
    • an export that ends early, unless its last day is today and it was printed that day;
    • a parser that states no coverage.
  • A file without a print time stages its last day as unfinished. The export time sent is the upload time, capped at the last second of the period's last day, Hanoi time (PO decision).
    This applies to every parser, before anything is recorded.
  • Techcombank Business (tcb-business, feat(statement-parsers): Techcombank Business export parser (#17) #231):
    • it reads a time after either date on the "Từ ngày … Đến ngày …" line, and treats any other time, time range or time label in or after the period's cells, or a "Thời gian/Time" or "Từ giờ" row above the table, as partial;
    • a start after midnight makes the file partial, an end before 23:59 makes it ends_early;
    • a file without a period line is partial.
      The guide shows dates only, so real samples still have to confirm this.

Finance review of organizer uploads (JOY's decision, 2026-11-18)

  • /admin/statements:
    • new "Ngưỡng duyệt sao kê" section shows the per-row threshold and the daily limit; finance/admin can change each with a required note (set_statement_review_threshold, set_statement_review_daily_limit, audited);
    • finance_review rows appear in the existing queue: approve = "Nhập thành giao dịch mới" (or "Là giao dịch đã ghi"), reject = "Không phải giao dịch thật", with review wording;
    • the audit trail shows the system's balance_confirmed imports (actor "Hệ thống") and threshold changes.
  • /me/statements: tells account owners (not staff uploading for others) that a campaign's first upload, and every transaction at or above the threshold, waits for finance.
  • Labels for the new reason finance_review and resolution balance_confirmed.

Checks

  • vitest: 123 files, 1790 tests pass. tsc, lint, build pass.

Review record

A fresh-context subagent reviewed the diff over 5 rounds, each one checked against its own probe files:

  • Round 1 (2872df8): MUST_FIX: period times written 08h00, "lúc 14:30", "- 14:30", or in a separate Giờ/Time cell were taken as full. Wording SHOULD_FIX. Fixed in b5f5704.
  • Rounds 2 to 4: further forms (14g30, 14.30, a time range on its own row, a time after an empty or other cell, connectors) and false refusals of plain full files. Fixed in 38dc17d, e0eedcc and 583fc7d. The scan now covers only the period's own cells and the cells after it, up to "Printed on".
  • Round 5 (583fc7d): clean (73 probes).
  • Later re-checks: a time row above the table with any time, and date cells from 23:59:59.5, fixed in fb0a898 together with the daily-limit UI. The final re-check is clean.
  • PO Money review (583fc7d): time ranges in cells, 23:59:SS date cells, refuse partial outright, last day unfinished without a print time, plus nits. Fixed in a494b39, with tests: the Hanoi/UTC boundary, ranges, date cells, and page tests for the threshold section and the notice.

Known limits: the Techcombank export layout is still unconfirmed (no real sample), and every unknown time form is treated as partial (fail closed). Payloads recorded before this deploy are replayed by the cron without the coverage check.

🤖 Generated with Claude Code

…f organizer uploads (#57)

- Parser contract: ParsedStatement.coverage (full, ends_early, partial),
  required for every parser. normalizeStatement refuses a partial export
  (STATEMENT_PARTIAL_EXPORT) unless it covers today alone, and an export
  that ends early unless its last day is today. The Techcombank Business
  parser reads times on its period line; a file without a period is partial.
- /admin/statements: finance review threshold (set_statement_review_threshold,
  note required), reject wording for finance_review rows, labels for the
  balance_confirmed system resolution and its audit entries.
- /me/statements: tells organizers which uploads wait for finance review.

Needs DOS.Me migration 20261122090000_give_statement_import_followups.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
give Ready Ready Preview Nov 18, 2026 2:15pm UTC

Request Review

@JOY JOY (JOY) added the line:money Product line: money label Nov 18, 2026

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.

Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b47fcfaa-c6ef-4be7-9023-3bf0a71eb554

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

dos[bot]
dos Bot approved these changes Nov 18, 2026

@dos dos Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏱️ Code Review completed (15 eligible files · 46,753 chars · 4 model call(s) · 2 PR unit(s))

Whole diff with bounded context at base 854bda3 / head 2872df8.

✅ No verified defects

3 possible issue(s) could not be grounded in or verified against the snapshot source, so they are not published.

Context investigation was bounded to the explicitly requested snapshot paths.

…review wording (#57)

- TCB: any other time-like text on the period line (08h00, lúc 14:30,
  a Giờ/Time cell, AM/PM) makes the export partial.
- A partial or early-ending export of today must be printed before the
  next midnight.
- Wording: organizer rows wait until the campaign has its first approved
  row, not only on the first upload. Threshold input takes đ/VND suffixes
  and shows separators.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
dos[bot]
dos Bot approved these changes Nov 18, 2026

@dos dos Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏱️ Code Review completed (15 eligible files · 49,383 chars · 3 model call(s) · 2 PR unit(s))

Whole diff with bounded context at base 854bda3 / head b5f5704.

✅ CLEAN_PASS: Complete diff reviewed

Context investigation was bounded to the explicitly requested snapshot paths.

…ges on other rows (#57)

- Times written 14g30 / 14.30, and a Từ giờ/Đến giờ row above the table,
  make the export partial.
- Other text on the period row (print time, account name, address,
  amounts) no longer turns a full statement into a partial one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
dos[bot]
dos Bot approved these changes Nov 18, 2026

@dos dos Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏱️ Code Review completed (15 eligible files · 52,251 chars · 3 model call(s) · 2 PR unit(s))

Whole diff with bounded context at base 854bda3 / head 38dc17d.

✅ CLEAN_PASS: Complete diff reviewed

Context investigation was bounded to the explicitly requested snapshot paths.

@dos

dos Bot commented Nov 18, 2026

Copy link
Copy Markdown

⏸️ DOS Review: Automatic Review Limit Reached

DOS Code Review already reviewed 3 commits of this pull request automatically, the limit for one pull request, so this commit was not reviewed automatically and nothing was charged. Please step back before pushing another fix: a pull request that needs this many review rounds usually needs a rethink of its approach or a smaller scope, not one more patch. When you are ready, a maintainer can comment /review to review the current commit.

JOY (JOY) and others added 3 commits November 18, 2026 20:39
- Partial exports are refused outright, today's included; an export that
  ends early only when its last day is today and it was printed that day.
- A file without a print time stages its last day as unfinished (export
  time capped at the last second of that day).
- TCB: a time range in a cell after the period, or a Thời gian/Time row
  with a time above the table, makes the export partial; 23:59:SS (XLSX
  date cells) ends a full day.
- /me/statements notice only for uploaders who own an account;
  getReviewThreshold logs the error code.
- Tests: Hanoi/UTC day boundary, export time, ranges, date cells, the
  threshold section, review wording and the notice.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…es (#57)

- JOY 2026-11-18: /admin/statements shows and changes the daily limit
  (set_statement_review_daily_limit) next to the per-row threshold;
  getReviewSettings reads both; the organizer notice and the
  finance_review label mention it.
- TCB: a Thời gian/Time/Giờ row above the table with any time is partial;
  a period date cell from 23:59:59.5 stays on its day (reader clamps only
  beyond Excel float error).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@JOY

Copy link
Copy Markdown
Contributor Author

PO acceptance: merge at fb0a898. Money second review re-check: all original failing inputs handled, no blocker. Remaining should-fix items (labelled time cells on the period row, other range separators, non-leading time labels; maxLength still 20) are fail-safe through the balance chain and go to a follow-up, checked against JOY's real Techcombank samples. DOS Code Review shows its round cap, not a finding. DOS/DOS.Me#1770 merged first.

@JOY
JOY (JOY) merged commit eca23dc into dev Nov 18, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

line:money Product line: money

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant