Skip to content

N16 — type the bill direction, and support both Tally ageing methods - #171

Merged
lamemustafa merged 10 commits into
masterfrom
tapish-codex/n16-bill-direction-and-ageing
Aug 23, 2026
Merged

N16 — type the bill direction, and support both Tally ageing methods#171
lamemustafa merged 10 commits into
masterfrom
tapish-codex/n16-bill-direction-and-ageing

Conversation

@lamemustafa

Copy link
Copy Markdown
Owner

Closes #164. Closes #114.

#164 — bill direction becomes a type

StatementBill.kind and OpenBillRow.kind were &'static str, consumed with a catch-all that
silently classified anything unrecognised as receivable. A payable would have been reported to a
client as a receivable — inverting the figure rather than failing. Reconciliation would still have
passed, because the bill still lands in a bucket and subtotals still sum to bill_total. That is
what made it quiet.

Now an ExposureDirection enum with an exhaustive match and no _ arm, so a third variant fails to
compile. Same shape as #162's warning codes and #163's ageing subtotals — the catch-all removed here
sat one line above the match #163 made exhaustive.

Latent rather than live: into_open_bill_row validated at the IPC boundary, so the catch-all was
dead code. The point is that the guarantee now lives in the type rather than in one validation
function a second producer could bypass.

#114 — both ageing methods, and the basis is disclosed

Tally's F6: Ageing Method offers ageing by bill date and by due date, and the choice changes the
bucket. Bridge aged unconditionally from BILLDATE, never read BILLCREDITPERIOD, and never stated
which basis produced its buckets.

Now: credit periods are parsed, both bases are selectable in the single-company and all-client views,
the choice flows through native and legacy computation, and every export discloses the basis in
force.

Credit periods are not always in days

Measured on licensed TallyPrime 7.1 — Tally accepts and returns days, weeks and months:

sent stored and returned
2 Months 2 Months
3 Weeks 3 Weeks
1 Day 1 Days — Tally normalises the singular

A parser requiring a " Days" suffix would fail the entire outstandings read on any book with
month-based terms, which is ordinary. All six forms are handled; unrecognised units still fail
closed.

Month arithmetic matches Tally exactly

Months are a calendar operation, not a day count. Tally's rule, measured directly:

bill date credit Tally's due date
15-Jan-26 4 Weeks 12-Feb-26
30-Jan-26 1 Month 28-Feb-26
31-Jan-26 1 Month 28-Feb-26
31-Mar-26 2 Months 31-May-26

Add N calendar months preserving day-of-month, clamping to the last day of the target month when it
does not exist. Note 30-Jan and 31-Jan collapse onto the same due date — a +30 days
implementation gets both wrong, and wrong differently.

add_months_clamped was run against those exact cases and reproduces all of them, plus
2024-01-31 + 1M → 2024-02-29.

Verification

Full workspace, both feature configurations. Compatibility gate passes; pin mismatches resealed to
0 of 119 with the matrix repointed. All three sentinels pass.

Ageing behaviour was validated against BRIDGE CORPUS AGEING, a purpose-built book in which seven of
eight bills fall in different buckets under the two bases — so an implementation silently using
one basis cannot pass. Before that book existed, #114 was unfalsifiable, because every bill in the
reference corpus had an empty credit period and the two methods coincided.

🤖 Generated with Claude Code

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4b5eade6ac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src-tauri/crates/bridge-tally-protocol/src/outstandings/compute.rs
Comment thread src-tauri/crates/bridge-tally-protocol/src/outstandings/parser.rs Outdated
Comment thread src-tauri/src/reports/bulk_party_statement.rs Outdated
Comment thread src-tauri/crates/bridge-tally-protocol/tests/outstandings.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a5c91b4fcf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src-tauri/crates/bridge-tally-protocol/src/outstandings/compute.rs Outdated
Comment thread src-tauri/src/commands.rs

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e819b34ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/tally/compatibility/compatibility-surface.json Outdated
Comment thread src-tauri/crates/bridge-tally-protocol/src/outstandings/compute.rs
@lamemustafa
lamemustafa merged commit b0d823c into master Aug 23, 2026
12 checks passed
@lamemustafa
lamemustafa deleted the tapish-codex/n16-bill-direction-and-ageing branch August 23, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant