-
Notifications
You must be signed in to change notification settings - Fork 1
fix(core): tune provider generation and drift coverage #170
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
18267db
update models for anthropic and openai
parse 9289f90
refactor openai provider with new api
parse 051e2a9
remove adr log
parse f31d4d5
refactor: use intent-based provider generation profiles
parse b953e7e
fix(core): tune gemini generation controls
parse ff18c19
fix(core): tune provider generation controls
parse 97d51a9
fix(core): improve drift model update coverage
parse 8b9cac8
Merge branch 'main' into parse/update-models
parse 8e3821b
chore: address provider review cleanup
parse 2927b1b
fix(core): address provider review comments
parse 3be29e2
fix(core): unwrap fenced model patch responses
parse 936ad1c
fix: address review comments and web lint
parse 4271caf
fix(core): restore drift analysis output headroom
parse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,3 @@ | ||
| #!/bin/sh | ||
|
|
||
| # Post-commit hook: Auto-generate ADR for architectural changes | ||
| # Runs Claude Code headlessly in background to analyze commits | ||
|
|
||
| COMMIT_MSG=$(git log -1 --pretty=%B) | ||
|
|
||
| # Opt-out checks | ||
| if echo "$COMMIT_MSG" | grep -qiE "\[(skip-adr|no-adr)\]"; then | ||
| exit 0 | ||
| fi | ||
| [ "$SKIP_ADR" = "1" ] && exit 0 | ||
|
|
||
| # Check for Claude CLI | ||
| command -v claude >/dev/null 2>&1 || exit 0 | ||
|
|
||
| # Check for architectural indicators | ||
| if echo "$COMMIT_MSG" | grep -qiE "(refactor|architecture|migrate|introduce|domain layer|api version)"; then | ||
| echo "" | ||
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | ||
| echo " Architectural change detected" | ||
| echo " Running ADR generation in background..." | ||
| echo " Check .claude-adr.log for output" | ||
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | ||
|
|
||
| nohup "$(dirname "$0")/adr-generator.sh" >> .claude-adr.log 2>&1 & | ||
| fi | ||
|
|
||
| echo "Post-commit checks passed!" | ||
| exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
packages/core/src/providers/__tests__/generation-profile.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { AnalysisPhase } from '../analysis-phase.js'; | ||
| import { | ||
| getGenerationProfileForModelPatch, | ||
| getGenerationProfileForPhase, | ||
| resolveOutputTokenLimit, | ||
| } from '../generation-profile.js'; | ||
|
|
||
| describe('getGenerationProfileForPhase', () => { | ||
| it('uses small low-effort generation for simple phases', () => { | ||
| expect(getGenerationProfileForPhase(AnalysisPhase.COMPONENT_RESOLUTION)).toEqual({ | ||
| outputSize: 'small', | ||
| reasoningEffort: 'low', | ||
| }); | ||
| expect(getGenerationProfileForPhase(AnalysisPhase.DEPENDENCY_SCAN)).toEqual({ | ||
| outputSize: 'small', | ||
| reasoningEffort: 'low', | ||
| }); | ||
| }); | ||
|
|
||
| it('uses large low-effort generation for drift analysis', () => { | ||
| expect(getGenerationProfileForPhase(AnalysisPhase.CHANGE_ANALYSIS)).toEqual({ | ||
| outputSize: 'large', | ||
| reasoningEffort: 'low', | ||
| }); | ||
| }); | ||
|
|
||
| it('uses medium medium-effort generation for model updates', () => { | ||
| expect(getGenerationProfileForPhase(AnalysisPhase.MODEL_UPDATE)).toEqual({ | ||
| outputSize: 'medium', | ||
| reasoningEffort: 'medium', | ||
| }); | ||
| }); | ||
|
|
||
| it('adds a dynamic output content hint for model patches', () => { | ||
| const profile = getGenerationProfileForModelPatch('x'.repeat(40_000), [' comp.a -> comp.b']); | ||
|
|
||
| expect(profile).toMatchObject({ | ||
| outputSize: 'medium', | ||
| reasoningEffort: 'medium', | ||
| }); | ||
| expect(profile.outputContentHint?.characters).toBeGreaterThan(16_384); | ||
| }); | ||
|
|
||
| it('resolves output token limits from profile size and content hints', () => { | ||
| expect( | ||
| resolveOutputTokenLimit( | ||
| { outputSize: 'medium', outputContentHint: { characters: 40_000 } }, | ||
| { small: 600, medium: 1500, large: 3000 } | ||
| ) | ||
| ).toBe(10_000); | ||
|
|
||
| expect( | ||
| resolveOutputTokenLimit({ outputSize: 'medium' }, { small: 600, medium: 1500, large: 3000 }) | ||
| ).toBe(1500); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.