Skip to content

refactor(ui-kit-chat): #456 single grouping machine for plain and page-session paths - #488

Closed
omridevk wants to merge 2 commits into
mainfrom
issue-456-dedupe-grouping
Closed

omridevk wants to merge 2 commits into
mainfrom
issue-456-dedupe-grouping

Conversation

@omridevk

@omridevk omridevk commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Closes #456.

grouping.ts kept two parallel grouping machines: groupPlain and groupWithPageSessions, duplicating reply placement, standalone classification, chain placement, and result-into-trailing-chain folding — the drift flagged twice during #437 review.

With pageActNames empty and no session ever opening, the page-session machine degenerates to exactly the plain machine's behavior: foldableParentIds returns the empty set, sessionMemberCall never matches, the fold-into-open-session branch is unreachable, and openCallIds bookkeeping is inert. pageToolPrefix without pageActNames stays inert too (prefix folding only fires inside an open session), matching the old plain-path behavior.

So: the plain machine is deleted and groupSegments always runs the single machine with an empty-set sentinel. Public API unchanged. Net −37 lines.

Gates: ui-kit-chat suite 172 tests green (incl. grouping 35 + grouping-diff 14), typecheck --filter=...@conciv/ui-kit-chat 69/69, fallow audit pass (0 introduced), lint clean on changed file.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Improved consistency when grouping chat segments, including cases where no page actions are configured.
    • Standardized grouping behavior across chat sessions.
    • Preserved existing segment grouping options and expected behavior.

…e-session paths

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 56516ba0-db4b-43cf-b57d-af97b1738cf7

📥 Commits

Reviewing files that changed from the base of the PR and between 83137cf and 088f974.

📒 Files selected for processing (1)
  • packages/ui-kit-chat/src/store/grouping.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/ui-kit-chat/src/store/grouping.ts

📝 Walkthrough

Walkthrough

groupSegments now always delegates to groupWithPageSessions. It uses an empty page-action set when pageActNames is absent. The separate plain-grouping helpers were removed.

Changes

Grouping unification

Layer / File(s) Summary
Unify segment grouping
packages/ui-kit-chat/src/store/grouping.ts
foldableParentIds returns an empty set when no page actions exist. groupSegments always uses page-session grouping and defaults missing pageActNames to a shared empty set.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 088f9

This PR consolidates duplicate grouping logic without changing the public API or intended behavior, and no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the refactor to use one grouping machine for plain and page-session paths.
Linked Issues check ✅ Passed The changes satisfy issue #456 by deduplicating the grouping helpers and preserving shared grouping behavior.
Out of Scope Changes check ✅ Passed The changes are limited to the grouping refactor described in issue #456 and its stated objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch issue-456-dedupe-grouping
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-456-dedupe-grouping

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Consolidates plain and page-session grouping into one grouping machine while preserving the public API.

Changes:

  • Removes duplicated plain-grouping helpers.
  • Uses an empty page-action set for plain grouping.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

return groupPlain(parts, standalone)
return groupWithPageSessions(
parts,
options?.pageActNames ?? emptyPageActNames,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 088f974 — foldableParentIds now short-circuits on an empty pageActNames, so the plain path does a single grouping pass again.

…s configured

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@omridevk

Copy link
Copy Markdown
Contributor Author

Obsolete: PR #483 (#458 data-derived grouping) rewrote grouping.ts and deleted the plain/page-session machines this PR deduplicated. On main the page-session grouper now layers on defaultGrouper, so the duplication #456 described no longer exists.

@omridevk omridevk closed this Aug 14, 2026
@omridevk
omridevk deleted the issue-456-dedupe-grouping branch August 14, 2026 19:06
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.

dedupe plain vs page-session grouping helpers in ui-kit-chat

2 participants