Skip to content

feat(group): the lifecycle in the app — acquisition, change of share, deconsolidation, former members, the unmapped-accounts blocker - #525

Merged
jfrench9 merged 3 commits into
mainfrom
feature/group-lifecycle-app
Oct 23, 2026
Merged

jfrench9 merged 3 commits into
mainfrom
feature/group-lifecycle-app

Conversation

@jfrench9

Copy link
Copy Markdown
Member

Summary

The client minors published over the last day (2.32.0, 2.33.0, 2.33.1, and the facade release that follows them) carry the group lifecycle and a new close blocker. This takes the batch into the app as one effort, as agreed.

Changes

  • Group lifecycle card (src/app/(app)/entity/components/GroupLifecycleCard.tsx) on a subsidiary's entity page. Three recordings, each a draft in the consolidation entity that the group close posts, with the figures the group's statements will carry shown back:
    • Record the acquisition: the price paid, optionally the outside owners' fair value, a confirmed bargain purchase, the basis — goodwill or the bargain gain returned.
    • Record a change in share: the month, the parent's share from then (50 or more), the price, the basis. A share going down is a sale within the method; the card shows the parent's own gain reversed and the carrying amount released, and that the group has no gain either way.
    • Record the deconsolidation, offered once the member has left: proceeds and basis — what came off, the results put back, the group's gain or loss.
    • The card says, in one line, that the parent's own purchase or sale is a journal entry in its books named to the seller or buyer; step-ups to named assets are left to the assistant.
  • Former members. A member whose last month is over (isFormer) reads as former: a former tag in the entity switcher beside parent; Former member · <treatment> · left YYYY-MM on the entities list, where a member still leaving reads leaves YYYY-MM; a former member badge on its page, which also says left rather than leaves after.
  • The unmapped_accounts close blocker (rs #1932): copy in the close panel pointing at Chart of Accounts, the accounts it holds the close on listed with and others past the sample, and no override, since nothing closes over it.
  • parseDollars moves to @/lib/ledger/formatters; the allocation-override panel re-exports it.
  • Packages: @robosystems/client pinned to ^2.34.0, the facade release that carries recordDeconsolidation, isFormer and the calendar's unmapped-account fields (ts #299 / py #283). @robosystems/core and @robosystems/report-components are already at their latest.

Sequencing

CI here is red until the facade release publishes (the lockfile cannot resolve 2.34.0 yet); developed against the packed client. Merge after that publish, release after the robosystems release that carries rs #1932, since the blocker and isFormer exist only on that server.

Testing

npm run test:all against the packed facade client: 1,228 tests across 137 files, format, lint, typecheck and cf-lint green. New tests: the lifecycle card's three recordings and its refusal path; the close panel naming unmapped accounts with no override; the entities list and entity page showing a former member.

🤖 Generated with Claude Code

https://claude.ai/code/session_015PxYaVzrbraKFeRALM7rXp

…ccounts blocker

The client minors of the last day (2.32.0–2.33.1 and the facade release
after them) carry the group lifecycle and a new close blocker; this takes
them into the app as one effort.

- A Group lifecycle card on a subsidiary's entity page: record the
  acquisition (price, the outside owners' fair value, a confirmed bargain
  purchase), a change in the parent's share either way (the sale shows
  the parent's gain reversed and the carrying amount released), and the
  deconsolidation once the member has left — each a draft the group close
  posts, with the figures the group's statements will carry shown back.
- A member whose last month is over reads as former: a tag in the
  switcher, "Former member · <treatment> · left YYYY-MM" on the entities
  list, a badge on its page; a member still leaving reads "leaves after".
- The close panel names the unmapped_accounts blocker, lists the accounts
  it holds the close on, and offers no way to close over it.
- parseDollars moves to the ledger formatters; the allocation panel
  re-exports it.
- @robosystems/client pinned to ^2.34.0, the facade release that carries
  recordDeconsolidation, isFormer and the calendar's unmapped-account
  fields (ts #299 / py #283); core and report-components are at latest.

Claude-Session: https://claude.ai/code/session_015PxYaVzrbraKFeRALM7rXp
@github-actions github-actions Bot added the change:normal Normal change: automated review documented on the pull request before merge label Oct 22, 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 22, 2026 •

Copy link
Copy Markdown

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


Review of PR #525: group lifecycle in the app

I read the full non-test diff. I did not run the tests or CI; the PR says CI is red until @robosystems/client@2.34.0 publishes.

Verdict: one real bug to fix before merge, plus a few smaller points.

Bug

1. The recorded-figures summary disappears right after a successful save. (entity/content.tsx:58-95, GroupLifecycleCard.tsx run)

  • On success, run calls done(result), then onRecorded(). onRecorded() bumps reloadKey.
  • The load effect then runs setEntity(null) and setLoading(true), and the page renders a spinner (content.tsx:225).
  • That unmounts GroupLifecycleCard, so its acquired, changed and left state is lost.
  • Net effect: the user records an entry and the card disappears. The goodwill, gain/loss and equity-adjustment figures are the point of the feature and are never seen.
  • The card tests probably pass because they render the card alone and mock onRecorded.
  • Fix options:
    • Do a silent refetch on reloadKey that doesn't clear entity or set loading.
    • Or lift the result state above the loading gate.
  • Add a page-level test that records an entry and asserts the summary is still visible.
  • The reload also discards any in-progress edit. The effect resets editing and formData.

Smaller points

2. The deconsolidation button stays available after recording. The card offers it whenever leftOn is set, and nothing marks it as done. If the server doesn't refuse a second recording, the user can post a second gain or loss. The refusal path is tested, but check that the server rejects duplicates. The same question applies to a second acquisition.

3. Share-change validation.

  • pct !== held compares a float to entity.ownershipPct, which is fine.
  • There is no upper bound check on pct, but <= 100 is there. OK.
  • The period isn't checked against joinedOn/leftOn. This is server territory, but a friendlier client hint would help.
  • The period state initialises to currentPeriod() and isn't reset when the entity changes, unlike the other fields. The same goes for price, sharePct and the other inputs: the [entity.id] effect clears modes and results, not the inputs. Switching entities can leave the previous entity's amounts in the form. open() only clears basis.

4. TextInput and Label ids (acq-price and others) are static. This is fine for one card per page.

5. Re-export. export { parseDollars } in AllocationOverridePanel is fine for compatibility. If nothing else imports it from there, drop the re-export and update the importers.

6. Formatting nit. In the entities list, entity.leftOn?.slice(0, 7) in the isFormer branch renders "left undefined" if leftOn is ever null. Guarding it is cheap.

7. unmapped_accounts blocker.

  • unmappedAccountCount === 0 returns null. Good.
  • The "and others" logic is correct.
  • The copy is consistent with the existing blocker entries, and the override is correctly absent.

8. Sequencing. Agreed: don't merge until 2.34.0 publishes and the lockfile resolves. package-lock.json should be included in the PR once it does. I excluded it from my diff, so I haven't checked whether it's already updated.

The conventions in CLAUDE.md look followed: colocated component, friendlyError used, no SWR, no version bump beyond the stated client pin. The client pin is described in the PR as intended.

The facade half of the group lifecycle shipped as a patch, 2.33.2, not
the 2.34.0 the pin anticipated; the lockfile resolves it from npm in
place of the packed build the branch was developed against.

Claude-Session: https://claude.ai/code/session_015PxYaVzrbraKFeRALM7rXp
…clean per entity

The review found the one real defect: recording an entry bumped a reload
key, the page's load effect cleared the entity and showed its spinner, and
the card unmounted with the goodwill or gain it had just been handed. The
page now re-reads the entity in place — no spinner, no abandoned edit — so
the figures stay up and the parent's share refreshes after a change.

Also from the review: the card's inputs reset when the entity changes (only
the recorded results did before); the former-member lines guard a missing
leftOn; parseDollars is imported from the formatters by its one other user
and the re-export goes. A page-level test records an acquisition and asserts
the summary survives the re-read; a card test switches entity and finds an
empty form.

Claude-Session: https://claude.ai/code/session_015PxYaVzrbraKFeRALM7rXp
@jfrench9

Copy link
Copy Markdown
Member Author

Review dispositions, in the order raised:

  1. Figures lost after a save — real, fixed. The page now re-reads the entity in place after a recording (no spinner, no abandoned edit), so the goodwill, gain or equity adjustment stays on screen and the parent's share refreshes after a change. A page-level test records an acquisition and asserts the summary survives the re-read.
  2. Deconsolidation and acquisition stay offered after recording — by design. The server replaces an earlier draft of the same recording and refuses once one is posted, so a second record corrects the draft rather than doubling the gain; the refusal shows as the card's alert. The button staying is how a figure gets corrected before the close.
  3. Inputs not reset on an entity change — fixed. Every input clears with the results; tested.
  4. Static ids — one card per page, left.
  5. Re-export — dropped. Its one other importer (the panel's test) reads the formatters.
  6. left undefined — guarded in the list and on the card.
  7. Blocker copy — no change.
  8. Lockfile — in. The facade shipped as 2.33.2 rather than 2.34.0; the pin and package-lock.json resolve it from npm.

Gate after the fixes: 1,230 tests across 137 files, format, lint, typecheck and cf-lint green.

@jfrench9
jfrench9 merged commit 6a7efbe into main Oct 23, 2026
7 checks passed
@jfrench9
jfrench9 deleted the feature/group-lifecycle-app branch October 23, 2026 00:46
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