Skip to content

🧹 refactor: Keep Store Imports Out of the Chat Hooks - #16620

Merged
berry-13 merged 1 commit into
devfrom
berry-13/chat-store-free-hooks
Oct 1, 2026
Merged

berry-13 merged 1 commit into
devfrom
berry-13/chat-store-free-hooks

Conversation

@berry-13

@berry-13 berry-13 commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

#16591 put the app's message-parts host implementation in client/src/hooks/Chat/parts.tsx. That implementation reads the Recoil and Jotai stores. #16591 also made the chat contract import two types from ~/store. Together they added two files to the chat-hook store-import count that the audit tracks as chat criterion C1 (25 to 27 files).

This PR moves the host implementation to client/src/Providers/MessagePartsHostContext.tsx, beside ChatSettingsContext, where host-side code that reads the app store already lives. The parts import it from the new path. The PTC trace types move from store/ptc to common/ptc. PendingSteer joins the queue types in hooks/Chat/queue, because it is chat-owned steer state. The chat contract now imports no store module, and C1 is back to 25. Runtime behavior is unchanged.

Third link of the chat-owners stack, on top of #16604.

Type of change

  • Refactor

Testing

Tested environments/configuration:

  • Jest (jsdom). Playwright mock harness through reviewctl verify (desktop light, desktop dark, mobile).

Automated tests:

  • npx jest --findRelatedTests <changed files> --maxWorkers=2: 500 suites, 6653 tests.
  • npx tsc --noEmit -p client/tsconfig.json: clean. ESLint and Prettier: clean.
  • Existing scenarios re-run on this head cover the parts host and steer state: chat reasoning, the tool artifact row, the shared link with no host, and a cancelled steer that keeps its draft.
  • Audit: chat C1 drops from 27 to 25 files. parts-context.sh stays at 1 of 46.

Screenshots / recordings

No user-facing change.

Risk / compatibility

These are type and module moves only. store/families imports PendingSteer type-only from the chat feature, which is erased at build time, so no runtime cycle forms.

Checklist

  • I reviewed my own changes
  • Relevant tests have been added or updated
  • Existing relevant tests pass
  • The change does not introduce new warnings or errors
  • User-facing or complex behavior is documented where necessary
  • Required dependency changes have been merged/published
  • Required documentation PR: N/A

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T15:50:09.366891Z 71b25a9 New commits
🔒 Security Review ✅ Completed 2026-10-01T12:26:42.024879Z 23f6bcb PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@berry-13
berry-13 requested a review from danny-avila as a code owner October 1, 2026 14:06
@berry-13
berry-13 force-pushed the berry-13/chat-store-free-hooks branch from 23f6bcb to 16292ae Compare October 1, 2026 14:14
@berry-13
berry-13 added this pull request to stack #16629 October 1, 2026 15:23
Base automatically changed from berry-13/chat-settings-owners to dev October 1, 2026 15:47
The app's message parts host reads the stores, so it moves from
hooks/Chat/parts to Providers/MessagePartsHostContext, beside
ChatSettingsContext. The PTC trace types move to common, and PendingSteer
joins the queue types in hooks/Chat/queue, so the chat contract names no
store module.
@berry-13
berry-13 force-pushed the berry-13/chat-store-free-hooks branch from 16292ae to 71b25a9 Compare October 1, 2026 15:47
@berry-13
berry-13 merged commit e543f9b into dev Oct 1, 2026
30 checks passed
@berry-13
berry-13 deleted the berry-13/chat-store-free-hooks branch October 1, 2026 16:40
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.

1 participant