Skip to content

[codex] Extract PPQ provider panels#455

Merged
elkimek merged 1 commit into
mainfrom
codex/extract-ppq-provider-panels
May 30, 2026
Merged

[codex] Extract PPQ provider panels#455
elkimek merged 1 commit into
mainfrom
codex/extract-ppq-provider-panels

Conversation

@elkimek
Copy link
Copy Markdown
Owner

@elkimek elkimek commented May 30, 2026

Summary

  • Extract PPQ account, balance, and top-up/payment behavior into js/provider-ppq-panels.js
  • Keep provider-panels.js as the shared provider coordinator and delegate PPQ init/timer cleanup to the new module
  • Add service worker cache coverage and focused PPQ extraction/export tests
  • Bump version.js for cache invalidation

Validation

  • node tests/test-ppq-provider.js
  • node tests/test-openrouter.js
  • node tests/test-custom-api.js
  • node tests/test-audit.js
  • node --check js/provider-panels.js
  • node --check js/provider-ppq-panels.js
  • ./run-tests.sh

@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
get-based Ready Ready Preview, Comment May 30, 2026 2:12pm

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 30, 2026

Greptile Summary

This PR extracts all PPQ provider panel logic (~315 lines) from provider-panels.js into a new js/provider-ppq-panels.js module, following the same dependency-injection pattern already used by provider-local-ai-controls.js and provider-wallet-panels.js. The service-worker cache list, audit test, and a new focused PPQ test are all updated consistently.

  • provider-ppq-panels.js is a faithful extraction of account creation, key save/remove, balance display, top-up picker, and invoice polling; returnToChatIfOnboarding is injected via configurePpqPanels() at module init time in provider-panels.js.
  • All previously-exported PPQ symbols are re-exported through provider-panels.js and correctly registered on window for inline onclick handlers, preserving backward compatibility.
  • The version bump from 1.8.2821.8.283 correctly invalidates the service-worker cache after adding the new asset to APP_SHELL.

Confidence Score: 5/5

Clean refactor with no behavioral changes; all window exports, timers, and callbacks are correctly wired.

The extraction is a near line-for-line move of existing code. Dependency injection is used correctly, the window assignment block in provider-panels.js includes all PPQ symbols, service-worker cache and tests are updated, and the version bump is present. No logic was changed; no new code paths were opened.

No files require special attention.

Important Files Changed

Filename Overview
js/provider-ppq-panels.js New module containing all extracted PPQ account/balance/topup logic, using dependency injection for the onboarding callback; code is a faithful port of the logic that previously lived in provider-panels.js.
js/provider-panels.js Removes ~315 lines of PPQ-specific code, re-imports and re-exports the extracted symbols from provider-ppq-panels.js, calls configurePpqPanels at init time, and delegates initSettingsPpqPanel/clearPpqTopupTimers to the new module; all window assignments are preserved.
service-worker.js Adds /js/provider-ppq-panels.js to APP_SHELL cache list so the new module is covered by the PWA cache.
tests/test-ppq-provider.js New node-side test file verifying extraction boundaries, function ownership, runtime window exports, and service-worker cache entry for the new module.
tests/test-audit.js Adds a single assertion confirming the new module is present in the service-worker APP_SHELL.
version.js Patch bump from 1.8.282 to 1.8.283 to bust the service-worker cache after adding the new JS module to APP_SHELL.

Sequence Diagram

sequenceDiagram
    participant PP as provider-panels.js
    participant PPQ as provider-ppq-panels.js
    participant API as api.js
    participant QR as provider-qr.js
    participant PMC as provider-model-controls.js

    Note over PP,PPQ: Module init
    PP->>PPQ: "import { cancelPpqTopup, clearPpqTopupTimers, configurePpqPanels, ... }"
    PP->>PPQ: "configurePpqPanels({ returnToChatIfOnboarding })"

    Note over PP,PPQ: switchAIProvider()
    PP->>PPQ: clearPpqTopupTimers()

    Note over PP,PPQ: initSettingsModelFetch()
    PP->>PPQ: initSettingsPpqPanel()
    PPQ->>API: getPpqKey() / fetchPpqModels() / getPpqBalance()
    PPQ->>PMC: renderPpqModelDropdown(models)

    Note over PP,PPQ: User: handleCreatePpqAccount()
    PP->>+PPQ: "handleCreatePpqAccount() via window.*"
    PPQ->>API: createPpqAccount()
    PPQ->>API: savePpqKey() / savePpqCreditId()
    PPQ->>API: fetchPpqModels()
    PPQ-->>-PP: panel re-renders key reveal UI

    Note over PP,PPQ: User: doPpqTopup(amount)
    PP->>+PPQ: "doPpqTopup(amount) via window.*"
    PPQ->>API: createPpqTopup(amount, method)
    PPQ->>QR: ensureQRCode()
    PPQ->>PPQ: setInterval poll checkPpqTopupStatus()
    PPQ-->>-PP: balance refreshed on payment
Loading

Reviews (1): Last reviewed commit: "Extract PPQ provider panels" | Re-trigger Greptile

@elkimek elkimek merged commit 6bafff2 into main May 30, 2026
5 checks passed
@elkimek elkimek deleted the codex/extract-ppq-provider-panels branch May 30, 2026 15: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