Skip to content

schema test fixes - #5689

Merged
akshaydeo merged 2 commits into
mainfrom
dev
Jul 30, 2026
Merged

schema test fixes#5689
akshaydeo merged 2 commits into
mainfrom
dev

Conversation

@akshaydeo

Copy link
Copy Markdown
Contributor

No description provided.

## Summary

Adds support for user-scoped pricing overrides by introducing a `user_id` field to the model config scope schema, adds a `BudgetOverrideModeNone` constant for the zero/default override state, and excludes the derived `virtual_key_count` field from schema sync validation since it is a non-persisted, response-only field.

## Changes

- Added `user_id` field to `config.schema.json` under model config scopes to support user-scoped pricing overrides
- Added `BudgetOverrideModeNone` (`""`) as an explicit named constant for the default/zero value of `BudgetOverrideMode`
- Added `virtual_key_count` to the `ignoreGoFields` map in the schema sync script, since `TableCustomer.VirtualKeyCount` is a `gorm:"-"` derived field populated only on read and is not user-configurable via `config.json`

## Type of change

- [ ] Bug fix
- [x] Feature
- [ ] Refactor
- [ ] Documentation
- [ ] Chore/CI

## Affected areas

- [x] Core (Go)
- [x] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [ ] UI (React)
- [ ] Docs

## How to test

```sh
go test ./...
```

- Verify that a model config scope with a `user_id` field passes schema validation.
- Verify that the schema sync script no longer flags `virtual_key_count` as an unrecognized field.
- Verify that `BudgetOverrideModeNone` correctly represents the default (empty string) override mode.

## Screenshots/Recordings

N/A

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

N/A

## Security considerations

The `user_id` field in pricing override scopes should be validated server-side to ensure callers can only apply overrides to users within their authorized scope.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
@akshaydeo
akshaydeo requested a review from a team as a code owner July 30, 2026 12:44
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@akshaydeo
akshaydeo merged commit 1165cff into main Jul 30, 2026
14 of 17 checks passed
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0f0cdae9-4f77-4ad6-9242-5f80570ead24

📥 Commits

Reviewing files that changed from the base of the PR and between ecc14ea and b593665.

📒 Files selected for processing (3)
  • .github/workflows/scripts/schemasync/main.go
  • framework/configstore/tables/budget.go
  • transports/config.schema.json

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added support for user-scoped provider pricing overrides using a user identifier.
    • Added an explicit “no override” budget mode to represent the default state.
  • Bug Fixes

    • Improved configuration schema handling for derived governance fields, reducing unnecessary validation discrepancies.

Walkthrough

The changes define an explicit no-override budget mode, add user_id to provider pricing overrides, and exclude the derived virtual_key_count field from schemasync reconciliation.

Changes

Configuration schema alignment

Layer / File(s) Summary
Pricing override contract
framework/configstore/tables/budget.go, transports/config.schema.json
Adds the empty BudgetOverrideModeNone default and documents the string-based user_id field for user-scoped pricing overrides.
Derived field schemasync exception
.github/workflows/scripts/schemasync/main.go
Excludes the derived virtual_key_count customer field from Go-to-schema reconciliation checks.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: pratham-mishra04, roroghost17, bearts

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Comment @coderabbitai help to get the list of available commands.

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