-
Notifications
You must be signed in to change notification settings - Fork 5
feat(platform): wire default model resolver and add governance tab #1390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { useConvexQuery } from '@/app/hooks/use-convex-query'; | ||
| import { api } from '@/convex/_generated/api'; | ||
|
|
||
| export function useDefaultModel(organizationId: string) { | ||
| return useConvexQuery(api.governance.default_model_query.getMyDefaultModel, { | ||
| organizationId, | ||
| }); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| import { describe, it, vi } from 'vitest'; | ||
|
|
||
| import { checkAccessibility } from '@/test/utils/a11y'; | ||
| import { render } from '@/test/utils/render'; | ||
|
|
||
| import { DefaultModelEditor } from './default-model-editor'; | ||
|
|
||
| vi.mock('@/app/hooks/use-toast', () => ({ | ||
| useToast: () => ({ toast: vi.fn() }), | ||
| })); | ||
|
|
||
| vi.mock('../hooks/mutations', () => ({ | ||
| useUpsertGovernancePolicy: () => ({ mutateAsync: vi.fn(), isPending: false }), | ||
| })); | ||
|
|
||
| vi.mock('../hooks/queries', () => ({ | ||
| useGovernancePolicy: () => ({ | ||
| data: null, | ||
| isLoading: false, | ||
| }), | ||
| })); | ||
|
|
||
| vi.mock('@/app/features/settings/teams/hooks/queries', () => ({ | ||
| useOrgTeams: () => ({ | ||
| teams: [{ id: 'team-1', name: 'Engineering' }], | ||
| isLoading: false, | ||
| }), | ||
| })); | ||
|
|
||
| vi.mock('@/app/features/settings/providers/hooks/queries', () => ({ | ||
| useListProviders: () => ({ | ||
| providers: [ | ||
| { | ||
| name: 'openai', | ||
| displayName: 'OpenAI', | ||
| models: [ | ||
| { | ||
| id: 'openai/gpt-4o', | ||
| displayName: 'GPT-4o', | ||
| tags: ['chat'], | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| isLoading: false, | ||
| }), | ||
| })); | ||
|
|
||
| vi.mock('@/app/hooks/use-ability', () => ({ | ||
| useAbility: () => ({ | ||
| can: () => true, | ||
| cannot: () => false, | ||
| }), | ||
| })); | ||
|
|
||
| vi.mock('@/app/hooks/use-organization-id', () => ({ | ||
| useOrganizationId: () => 'org-1', | ||
| })); | ||
|
|
||
| describe('DefaultModelEditor', () => { | ||
| describe('accessibility', () => { | ||
| it('passes axe audit', async () => { | ||
| const { container } = render( | ||
| <DefaultModelEditor organizationId="org-1" />, | ||
| ); | ||
| await checkAccessibility(container); | ||
| }); | ||
| }); | ||
| }); | ||
|
Comment on lines
+60
to
+69
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Add functional and error-path tests beyond the axe audit. Line 62 only verifies accessibility. Please also add happy-path and failure-path tests for rule CRUD/save behavior (e.g., add/remove rule, invalid selection, mutation failure toast) to prevent regressions in this new governance editor. As per coding guidelines 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align model fallback logic across send entry points.
Line 419 applies governance fallback for normal sends, but edit-and-branch still resolves model from override-only (Line 470). That creates inconsistent model selection behavior depending on how the user sends.
Suggested patch
🤖 Prompt for AI Agents