Skip to content

Conversation

@aarsilv
Copy link
Contributor

@aarsilv aarsilv commented Jan 20, 2026

Summary

  • Adds getBanditsConfiguration() function to export bandit models as JSON
  • Complements getFlagsConfiguration() for complete offline initialization support

Stacked PRs

Test plan

  • Verify getBanditsConfiguration() returns null before initialization
  • Verify it returns null when no bandits are configured
  • Verify it returns valid JSON with bandit parameters matching bandit-models-v1.json structure

🤖 Generated with Claude Code

@aarsilv aarsilv force-pushed the aarsilv/ffesupport-461-offline-init-part2-get-bandits-configuration branch 2 times, most recently from 5c56e10 to eae1ff4 Compare January 20, 2026 03:10
@aarsilv aarsilv changed the title Add getBanditsConfiguration() to export bandit models as JSON Offline Init Part 2 of 4: Add getBanditsConfiguration() to export bandit models as JSON Jan 20, 2026
@aarsilv aarsilv force-pushed the aarsilv/ffesupport-461-offline-init-part2-get-bandits-configuration branch 2 times, most recently from 7396a8f to 128bac6 Compare January 20, 2026 03:41
src/index.ts Outdated
Comment on lines 276 to 268
const configuration: {
bandits: Record<string, BanditParameters>;
} = {
bandits,
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is simpler than the original flag configuration because we basically store bandit configurations (model parameters) as-is

@aarsilv aarsilv marked this pull request as ready for review January 20, 2026 03:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds getBanditsConfiguration() to export bandit model configurations as JSON, complementing the existing getFlagsConfiguration() for offline SDK initialization.

Changes:

  • Adds getBanditsConfiguration() function that serializes bandit models to JSON
  • Includes comprehensive tests validating the JSON structure against bandit-models-v1.json
  • Updates GitHub Actions workflow to use ** branch pattern instead of *

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/index.ts Adds getBanditsConfiguration() function to export bandit models as JSON
src/index.spec.ts Adds tests for getBanditsConfiguration() including null cases and structure validation
.github/workflows/lint-test-sdk.yml Updates branch pattern from * to ** for pull request triggers

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

src/index.ts Outdated
Comment on lines 264 to 270
export function getBanditsConfiguration(): string | null {
if (!banditModelConfigurationStore) {
return null;
}
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The early return when banditModelConfigurationStore is not initialized lacks test coverage. Add a test case that calls getBanditsConfiguration() before init() to verify it returns null.

Copilot uses AI. Check for mistakes.
on:
pull_request:
branches: [ "*" ]
branches: [ "**" ]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still apply if merging into branches with slashes in their name

@greghuels greghuels assigned aarsilv and unassigned sameerank Jan 21, 2026
@aarsilv aarsilv force-pushed the aarsilv/ffesupport-461-offline-init-part2-get-bandits-configuration branch 2 times, most recently from b235e30 to c35ea62 Compare January 26, 2026 02:48
Base automatically changed from aarsilv/ffesupport-461-offline-init-part1-get-flags-configuration to main January 27, 2026 00:10
aarsilv and others added 6 commits January 26, 2026 19:11
This function returns the current bandits configuration as a JSON string that
can be used together with getFlagsConfiguration() to bootstrap another SDK
instance. Returns null if no bandits are configured.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Fixes test isolation issue where tests ran after API server was closed.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Verify exact structure from bandit-models-v1.json including:
- Exact number of bandits (3)
- Specific bandit keys (banner_bandit, car_bandit, cold_start_bandit)
- Detailed banner_bandit structure verification
- Different settings for car_bandit and cold_start_bandit

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Change branches pattern from "*" to "**" so the workflow triggers
for PRs targeting branches like "aarsilv/feature-name" (stacked PRs).
The single asterisk doesn't match "/" characters in GitHub Actions.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add BanditsConfigurationResponse interface matching IBanditParametersResponse
  structure from the common package (with updatedAt optional since not stored)
- Update getBanditsConfiguration() to use the typed interface

This ensures consistency with getFlagsConfiguration() and provides better
type safety for the export/import workflow.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@aarsilv aarsilv force-pushed the aarsilv/ffesupport-461-offline-init-part2-get-bandits-configuration branch from 291bc6f to f3ee984 Compare January 27, 2026 00:12
@aarsilv aarsilv merged commit 44e1086 into main Jan 27, 2026
8 checks passed
@aarsilv aarsilv deleted the aarsilv/ffesupport-461-offline-init-part2-get-bandits-configuration branch January 27, 2026 00:13
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.

4 participants