Skip to content

feat: the consolidating entries on the consolidation entity's close - #487

Merged
jfrench9 merged 1 commit into
mainfrom
feature/consolidation-drafts
Oct 18, 2026
Merged

jfrench9 merged 1 commit into
mainfrom
feature/consolidation-drafts

Conversation

@jfrench9

Copy link
Copy Markdown
Member

What

On the consolidation entity, the Closing Book's period panel gains a Consolidating entries section:

  • the month's entries as the engine computes them from the members' books (preview-consolidation-entries), one row per kind and member, with the engine's basis and the amount
  • residuals, shown as withheld until explained: never drafted, never plugged
  • intercompany figures the two sides do not agree on, and the engine's notes
  • Draft entries (propose-consolidation-entries) writes them as drafts in the consolidation entity. The existing draft review lists them and the month's close posts them. Once drafted, the button reads Draft again and replaces them.
  • a closed month reads as posted, with nothing to draft

Operating entities' close panels are unchanged. The consolidation entity is reached from the group page (/entities → Select), as before; the switcher still leaves it out.

Moves @robosystems/client to 2.19.0 (RoboFinSystems/robosystems-typescript-client#277).

Server dependency

The two operations ship in the robosystems release after v1.18.8 (RoboFinSystems/robosystems#1853, RoboFinSystems/robosystems#1854, RoboFinSystems/robosystems#1855, RoboFinSystems/robosystems#1856). Until that release deploys, the section shows the friendly error in place of the preview. Deploy this app after the server release.

Verified

  • npm run test:all: 987 passed, plus format, lint, typecheck and cf-lint.
  • Run in the browser against the local stack on the Driftline group: the consolidation entity's September close listed the four engine entries (two intercompany eliminations, the 30% outside share of Harbor's result, the 40% equity-method pickup on the kiosk), and the draft review showed the four drafts, balanced. Draft again rewrote them in place: still four drafts, no duplicates. The parent's close panel is unchanged.

🤖 Generated with Claude Code

https://claude.ai/code/session_01M6TRefZ8MTAxax6pMxer4q

On the consolidation entity, the Closing Book's period panel shows the
month's consolidating entries as the engine computes them from the
members' books, by kind and member, with what was withheld, the
intercompany figures that do not agree, and the engine's notes. Draft
entries writes them as drafts in the consolidation entity, where the
draft review lists them and the month's close posts them; drafting
again replaces them. A closed month reads as posted.

Moves @robosystems/client to 2.19.0 (typescript-client #277).

Claude-Session: https://claude.ai/code/session_01M6TRefZ8MTAxax6pMxer4q
@github-actions github-actions Bot added the change:normal Normal change: automated review documented on the pull request before merge label Oct 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Change classification: normal — platform or application code changed.

A normal change carries a documented automated review on this pull request before merge, in place of a second human approver. The change-classification job requests that review and passes once it has been posted. Recorded by the change-classification job.

@jfrench9

Copy link
Copy Markdown
Member Author

@claude please review this PR

@claude

claude Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Claude finished @jfrench9's task in 22s —— View job


PR review: Consolidating entries panel

Verdict: looks good to merge, with a few non-blocking suggestions. I read the new component and the PeriodClosePanel wiring. I did not run the test suite, and I did not read the new test files or the package-lock.json diff. The PR description reports test:all passing.

  • Read the diff and the new component
  • Checked it against CLAUDE.md conventions

What works

  • Colocation and conventions: the panel sits in close/components/, uses friendlyError from @/lib/ledger/errors, and uses LoadingState. It adds no SWR or React Query.
  • Role gating: scopedEntity?.entityRole === 'consolidation' keeps operating entities' close panels unchanged.
  • Stale responses: the seq ref in loadPreview drops out-of-order preview responses when period or graphId changes.
  • Refresh after drafting: handleConsolidationDrafted refreshes the entry list, close status and drafts. This matches the existing refresh patterns.
  • Amounts: proposalTotal sums debit cents and divides by 100 for formatCurrencyDollars. That matches the other ledger code.
  • Withheld residuals: they are shown as withheld and never drafted, as the PR describes.

Suggestions (non-blocking)

  1. handleDraft has no stale-period guard (ConsolidationEntriesPanel.tsx:96-114). If the user switches month while a draft call is in flight, onDrafted and loadPreview still run. loadPreview is bound to the old period in that closure, so it uses its own seq and a newer preview wins. The catch still sets an error that belongs to the old month. This is low risk. Capturing seq.current at the start and checking it in the catch would close it.
  2. Draft failure and preview failure share one error state. If proposeConsolidationEntries succeeds but the follow-up loadPreview fails, the draft succeeded but the user sees only a preview error. That is acceptable. A distinct message such as "Drafted, but couldn't refresh the preview" would be clearer.
  3. React keys. Proposal rows use ${p.memo}-${i}, which is fine. Residuals use r.entity_id alone. If an entity can carry more than one residual, such as one per kind, the keys collide. Consider adding the index or a kind.
  4. Error helper. errors.ts also exports apiErrorMessage(err, fallback) (line 216). It may replace the two err instanceof Error ? … : … plus friendlyError(...).message blocks. This is only worth doing if it behaves the same way.
  5. "Draft again" is disabled when there are no proposals. If a member's books change so that nothing is called for, the stale drafts can't be replaced or cleared from this panel. I haven't confirmed whether the server's "up to date" state covers this. Please confirm that case is handled.
  6. Server dependency. Until the robosystems release after v1.18.8 deploys, the section shows the friendly error. The PR notes to deploy this app after the server release. Please keep to that order.

@jfrench9
jfrench9 merged commit ffb8809 into main Oct 18, 2026
7 checks passed
@jfrench9
jfrench9 deleted the feature/consolidation-drafts branch October 18, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:normal Normal change: automated review documented on the pull request before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant