Skip to content

[AI-139][triage] Consolidate CosmosClient instantiation logic across stores#70

Draft
roberthunterjr wants to merge 2 commits into
mainfrom
copilot/ai-139-consolidate-cosmosclient-instantiation
Draft

[AI-139][triage] Consolidate CosmosClient instantiation logic across stores#70
roberthunterjr wants to merge 2 commits into
mainfrom
copilot/ai-139-consolidate-cosmosclient-instantiation

Conversation

@roberthunterjr

@roberthunterjr roberthunterjr commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

This PR consolidates the CosmosClient instantiation logic across multiple store files into a shared utility.

Deliverables:

  • New Utility: Created cosmos-utils.js with getCosmosConfig() and createCosmosClient().
  • Security: Applied a production authentication guard consistently across all stores to prevent COSMOS_KEY usage in production.
  • Refactoring: Updated slack-users-store.js, feedback-store.js, interaction-store.js, conversation-capture-store.js, and setup-cosmos-emulator.js to use the new utility.
  • Testing: Added unit tests for cosmos-utils.js and ensured all existing tests pass.

Relates to AI-139.

Copilot AI and others added 2 commits July 2, 2026 22:13
…s.js

- Add getCosmosConfig() and createCosmosClient() to cosmos-utils.js
- createCosmosClient() includes production auth guard (COSMOS_KEY blocked in production)
- Refactor slack-users-store.js, feedback-store.js, interaction-store.js, and
  conversation-capture-store.js to use shared utilities
- Update setup-cosmos-emulator.js to use shared utilities
- Add 22 unit tests for cosmos-utils.js
- Update conversation-capture-store.test.js for new warning message

Resolves AI-139: https://edfi.atlassian.net/browse/AI-139

Co-authored-by: roberthunterjr <8196647+roberthunterjr@users.noreply.github.com>
@roberthunterjr roberthunterjr marked this pull request as draft July 7, 2026 18:15
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.

2 participants