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 from eae1ff4 to 3f88511 Compare January 20, 2026 03:20
aarsilv and others added 3 commits January 19, 2026 22:41
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 <noreply@anthropic.com>
Fixes test isolation issue where tests ran after API server was closed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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 <noreply@anthropic.com>
@aarsilv aarsilv force-pushed the aarsilv/ffesupport-461-offline-init-part2-get-bandits-configuration branch from 7396a8f to 128bac6 Compare January 20, 2026 03:41
Comment on lines +276 to +280
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

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 <noreply@anthropic.com>
@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.

Comment on lines +264 to +267
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
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