feat: Per-file token budget configuration in .waza.yaml#96
feat: Per-file token budget configuration in .waza.yaml#96spboyer wants to merge 1 commit intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support and documentation for configuring per-file token limits via .waza.yaml (tokens.limits) with a legacy fallback to .token-limits.json (now deprecated), and updates CLI behavior/tests to reflect the new precedence + warning.
Changes:
- Document
.waza.yamlper-file token limit configuration (glob patterns) and legacy fallback behavior. - Update
waza tokens check(and suggest’s shared path) to resolve limits from.waza.yamlfirst and emit a deprecation warning when.token-limits.jsonis used. - Add tests covering
.waza.yamloverriding legacy limits and the legacy deprecation warning path.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| site/src/content/docs/reference/cli.mdx | Adds docs + example YAML for per-file limits and notes legacy fallback warning. |
| internal/projectconfig/config.go | Updates TokenLimitsConfig comment to describe per-file glob/path patterns. |
| cmd/waza/tokens/helpers.go | Changes limits resolution to return (config, usedLegacy) for warning emission. |
| cmd/waza/tokens/check.go | Propagates usedLegacy and prints deprecation warnings (single + batch). |
| cmd/waza/tokens/check_test.go | Adds tests for .waza.yaml precedence over legacy + warning on legacy fallback. |
| cmd/waza/tokens/suggest.go | Updates to new resolveLimitsConfig signature and passes config into checker. |
| cmd/waza/tokens/root.go | Clarifies .token-limits.json is deprecated in command description. |
| .squad/log/* | Adds session logs (process documentation). |
| .squad/decisions.md | Records token diff distribution strategy + workflow directive. |
Comments suppressed due to low confidence (1)
cmd/waza/tokens/helpers.go:122
resolveLimitsConfigtreats.waza.yamllimits as “missing” whentokens.limits.defaultsis nil and will fall back to legacy.token-limits.jsonif it exists. This can unexpectedly ignore a.waza.yamlconfig that provides onlytokens.limits.overrides(or any non-defaults-driven config), and it also makes precedence dependent on whether defaults are set rather than whethertokens.limitsis present. Consider treatingtokens.limitsas present when either defaults or overrides are provided (and avoid legacy fallback in that case), or explicitly error/warn when defaults are absent so the behavior isn’t silent. Adding a test for “overrides-only.waza.yaml+ legacy file present” would lock in the intended precedence.
pcfg, err := projectconfig.Load(skillDir)
if err != nil || pcfg.Tokens.Limits == nil || pcfg.Tokens.Limits.Defaults == nil {
if _, statErr := os.Stat(filepath.Join(skillDir, ".token-limits.json")); statErr == nil {
return checks.TokenLimitsConfig{}, true
}
return checks.TokenLimitsConfig{}, false
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #96 +/- ##
=======================================
Coverage ? 72.21%
=======================================
Files ? 128
Lines ? 14259
Branches ? 0
=======================================
Hits ? 10297
Misses ? 3197
Partials ? 765
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
spboyer
left a comment
There was a problem hiding this comment.
LGTM — Rusty. Clean per-file token budget config. resolveLimitsConfig returning (config, bool) to track legacy fallback is the right pattern. Deprecation warning for .token-limits.json is exactly what we need. Tests cover both override priority and fallback warning paths. Docs updated. Ship it. (Self-authored PR — cannot self-approve via API.)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
8887b98 to
cc83331
Compare
Closes #86