[aw-compat] Migrate max-effective-tokens: -1 to max-ai-credits: -1 in codemod#38850
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
max-effective-tokens: -1 to max-ai-credits: -1 in codemod
There was a problem hiding this comment.
Pull request overview
This pull request fixes an inconsistency in the effective-tokens-to-ai-credits codemod so that the run-level sentinel value max-effective-tokens: -1 is migrated to max-ai-credits: -1, matching the existing sentinel handling for max-daily-effective-tokens. It also adds a regression test to prevent this legacy key from being left behind by gh aw fix --write.
Changes:
- Treat
max-effective-tokens: -1as a migratable sentinel by allowing-1in the run-level normalization path. - Add a focused unit test verifying the run-level
-1sentinel is rewritten tomax-ai-credits: -1and the legacy key is removed.
Show a summary per file
| File | Description |
|---|---|
| pkg/cli/codemod_effective_tokens_to_ai_credits.go | Enables -1 sentinel migration for run-level max-effective-tokens by allowing negative-one normalization. |
| pkg/cli/codemod_effective_tokens_to_ai_credits_test.go | Adds regression coverage for run-level max-effective-tokens: -1 migration and legacy key removal. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. No ADR enforcement needed: PR #38850 does not have the 'implementation' label and has only 19 new lines of code in business logic directories (≤100 threshold). |
|
🧪 Test Quality Sentinel completed test quality analysis. |
🧪 Test Quality Sentinel Report✅ Test Quality Score: 90/100 — Excellent
📊 Metrics & Test Classification (1 test analyzed)
Test Classification Details
Language SupportTests analyzed:
|
There was a problem hiding this comment.
✅ Test Quality Sentinel: 90/100. Test quality is excellent — 0% of new tests are implementation tests (threshold: 30%). The new test TestEffectiveTokensToAICreditsCodemod_MigratesRunNegativeOne is a well-structured behavioral design test that directly validates the bug fix (migrating max-effective-tokens: -1 to max-ai-credits: -1).
Cross-repo compile audits identified one persistent default-mode failure: workflows using
max-effective-tokens: -1were not migrated bygh aw fix --write, leaving an unknown legacy property behind. Positive values were already migrated; only the-1sentinel path was skipped.Codemod behavior correction
effective-tokens-to-ai-creditsmigration logic to treat run-levelmax-effective-tokenswith the same-1sentinel semantics already used formax-daily-effective-tokens.max-effective-tokens: -1to remain unmigrated.Regression coverage
max-effective-tokens: -1rewrites tomax-ai-credits: -1