Skip to content

[codex] Extract API provider storage#452

Merged
elkimek merged 2 commits into
mainfrom
codex/extract-api-provider-storage
May 30, 2026
Merged

[codex] Extract API provider storage#452
elkimek merged 2 commits into
mainfrom
codex/extract-api-provider-storage

Conversation

@elkimek
Copy link
Copy Markdown
Owner

@elkimek elkimek commented May 30, 2026

Summary

  • Move persisted AI provider settings, key helpers, model selectors, model display cache reads, and Venice E2EE cache state into js/api-provider-storage.js.
  • Keep API transport, OAuth, provider model fetching, validation, and chat completion calls in js/api.js while re-exporting the same public API.
  • Add the new module to the service worker app shell and bump version.js to 1.8.278.

Validation

  • node tests/test-openrouter.js
  • node tests/test-custom-api.js
  • node tests/test-venice-e2ee.js
  • node tests/test-audit.js
  • ./run-tests.sh
  • post-cleanup smoke: node -e "import('./tests/_node-shim.js').then(()=>import('./js/api.js')).then(()=>console.log('api import ok')).catch(e=>{console.error(e); process.exit(1)})"
  • post-cleanup: node tests/test-audit.js
  • git diff --check

@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 1:01pm

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 30, 2026

Greptile Summary

This PR extracts persisted AI provider settings, key helpers, model selectors, display-cache reads, and Venice E2EE state from js/api.js into a new js/api-provider-storage.js module. api.js retains API transport, OAuth, model fetching, validation, and chat-completion logic, and re-exports every previously public symbol from the storage module so all existing callers are unaffected.

  • All ~50 previously exported functions are re-exported verbatim through api.js, preserving backward compatibility.
  • The new module is added to the service-worker APP_SHELL and the cache-busting version is bumped to 1.8.278.
  • Test assertions are redirected to the new source file; the fetchVeniceModels filter (!m.id.startsWith('e2ee-')) is now explicitly guarded in test-venice-e2ee.js, addressing the gap flagged in the previous review.

Confidence Score: 5/5

Safe to merge — this is a pure code-organisation refactoring with no logic changes and full backward-compatible re-exports.

Every previously public function is re-exported through api.js unchanged, the service worker cache is updated, and the tests have been correctly redirected to the new module without introducing coverage gaps.

No files require special attention.

Important Files Changed

Filename Overview
js/api-provider-storage.js New module extracting persisted AI provider settings, key helpers, model selectors, display cache reads, and Venice E2EE state — code moved verbatim from api.js with no logic changes.
js/api.js Imports the storage helpers from api-provider-storage.js and re-exports them under the original names, preserving the full public API; all previously exported symbols verified present in the new re-export block.
service-worker.js Adds /js/api-provider-storage.js to APP_SHELL cache so the new module is available offline — correct and necessary change.
tests/test-venice-e2ee.js Updates assertions to match the module split; the fetchVeniceModels filter (!m.id.startsWith('e2ee-')) is now explicitly asserted in apiSrc, addressing the gap noted in the previous review.
tests/test-audit.js Redirects Venice/OpenRouter guard assertions from api.js to api-provider-storage.js and adds a new APP_SHELL assertion for the new module.
tests/test-custom-api.js Redirects source-inspection assertions to api-provider-storage.js for all custom-API storage functions that moved there.
tests/test-openrouter.js Redirects OpenRouter function-existence and key-helper assertions to api-provider-storage.js; no coverage gaps introduced.
version.js Patch version bump from 1.8.277 → 1.8.278 to bust the service-worker cache for the new module.

Reviews (2): Last reviewed commit: "Tighten Venice E2EE source assertion" | Re-trigger Greptile

@elkimek elkimek merged commit 6910abf into main May 30, 2026
5 checks passed
@elkimek elkimek deleted the codex/extract-api-provider-storage branch May 30, 2026 13:04
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