Skip to content

refactor: route runtime toast helper directly#260

Closed
ndycode wants to merge 1 commit intorefactor/pr4-runtime-toast-helperfrom
refactor/pr4-runtime-toast-direct3
Closed

refactor: route runtime toast helper directly#260
ndycode wants to merge 1 commit intorefactor/pr4-runtime-toast-helperfrom
refactor/pr4-runtime-toast-direct3

Conversation

@ndycode
Copy link
Copy Markdown
Owner

@ndycode ndycode commented Mar 21, 2026

Summary

  • remove the remaining inline runtime toast wrapper from index.ts
  • route toast notifications directly through the extracted helper

What Changed

  • deleted the inline showToast() wrapper
  • updated current toast call sites to call showRuntimeToast(client, ...) directly while preserving variant/title/duration behavior

Validation

  • npm run lint
  • npm run typecheck
  • npm run build

Risk and Rollback

  • Risk level: low
  • Rollback plan: revert 30d509b to restore the inline runtime toast wrapper in index.ts

Additional Notes

  • this removes another dispatcher-only runtime wrapper after the helper extraction landed

note: greptile review for oc-chatgpt-multi-auth. cite files like lib/foo.ts:123. confirm regression tests + windows concurrency/token redaction coverage.

Greptile Summary

removes the inline showToast closure from OpenAIOAuthPlugin and routes all 16 toast call sites directly through the already-extracted showRuntimeToast(client, ...) helper in lib/runtime/toast.ts. this is a pure mechanical cleanup — no behavioral change, no new logic.

  • all 16 call sites updated correctly; the deleted wrapper was a straight pass-through so behavior is identical
  • existing index.test.ts coverage (client.tui.showToast mock at line 559; showToast error handling suite at line 3305) continues to validate the path via the helper
  • no windows filesystem changes, no token handling touched, no concurrency model change
  • lib/runtime/toast.ts still has no dedicated unit test file despite now being the sole toast path for the entire plugin — follow-up toast.test.ts suite recommended
  • falsy-guard in the helper (options?.duration && ...) silently drops duration: 0; no current call site is affected but worth a != null fix

Confidence Score: 5/5

  • safe to merge — pure mechanical refactor with no behavioral change and existing test coverage intact
  • deleted wrapper was a one-liner pass-through; all 16 replacements are correct and verified against the helper signature; existing mocks in index.test.ts continue to exercise the path; no filesystem, token, or concurrency concerns introduced
  • lib/runtime/toast.ts — no dedicated unit tests and a minor falsy-guard issue; neither is blocking

Important Files Changed

Filename Overview
index.ts removed inline showToast closure wrapper; all 16 call sites mechanically updated to call showRuntimeToast(client, ...) directly — behavior identical, refactor is correct
lib/runtime/toast.ts helper is correct but has a falsy-guard issue (options?.duration && ... drops duration: 0) and no dedicated vitest unit coverage — now the sole path for all 16 toast call sites

Sequence Diagram

sequenceDiagram
    participant P as OpenAIOAuthPlugin (index.ts)
    participant H as showRuntimeToast (lib/runtime/toast.ts)
    participant T as client.tui.showToast

    note over P: before this PR
    P->>P: showToast(msg, variant, opts)
    P->>H: showRuntimeToast(client, msg, variant, opts)
    H->>T: showToast({ body: { message, variant, ...opts } })

    note over P: after this PR
    P->>H: showRuntimeToast(client, msg, variant, opts)
    H->>T: showToast({ body: { message, variant, ...opts } })
Loading

Fix All in Codex

Prompt To Fix All With AI
This is a comment left during a code review.
Path: lib/runtime/toast.ts
Line: 22-23

Comment:
**`duration: 0` silently dropped**

`options?.duration` is falsy when duration is `0`, so `...(options?.duration && { duration: options.duration })` would silently omit it. no current call site passes `0`, but the same is true for `title: ""`. pre-existing in the helper, but now 16 call sites in `index.ts` route directly through it — worth hardening.

```suggestion
				...(options?.title != null && { title: options.title }),
				...(options?.duration != null && { duration: options.duration }),
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: lib/runtime/toast.ts
Line: 1-30

Comment:
**missing vitest coverage for `showRuntimeToast`**

no dedicated unit test file exists for `lib/runtime/toast.ts`. `index.test.ts` covers it indirectly via `client.tui.showToast` mock (line 559, 3305–3333), but the helper's own branches — `tui` absent, `showToast` absent, options spreading, error swallowing — have no isolated assertions. project threshold is 80% and this helper is now the single toast path for all 16 call sites. a `toast.test.ts` unit suite would close the gap.

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: "refactor: route runt..."

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 21, 2026

Important

Review skipped

Auto reviews are limited based on label configuration.

🚫 Review skipped — only excluded labels are configured. (1)
  • skip-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4a9f2af2-7046-4cc6-bb30-c7986e45eba8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/pr4-runtime-toast-direct3
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch refactor/pr4-runtime-toast-direct3

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@ndycode ndycode added the passed label Mar 21, 2026
ndycode added a commit that referenced this pull request Mar 23, 2026
@ndycode
Copy link
Copy Markdown
Owner Author

ndycode commented Mar 23, 2026

Closing because this work is now included in main via #318 and #319.

@ndycode ndycode closed this Mar 23, 2026
@ndycode ndycode deleted the refactor/pr4-runtime-toast-direct3 branch March 24, 2026 18:34
ndycode added a commit that referenced this pull request Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant