Repository navigation
fix(serve): measure METRICS sources live in getProjectState (#441) - #463
Merged
Merged
Conversation
getProjectState validated the static values written in .adf METRICS and never measured, so it reported "All constraints pass" while `adf evidence --auto-measure --ci` failed. It now measures manifest METRICS sources through measureMetricSources (the code adf evidence uses), resolved against the .ai/ parent, and reports failing constraints with the measured value and ceiling. Additive only: the existing text lines are kept; issue lines gain a "(measured)" / "(static value, not measured)" suffix, a Measurement section lists per-metric values with `measured: true|false`, and the result carries structuredContent with the same data. Logic lives in the new commands/project-state.ts (computeProjectState, formatProjectState). Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
MCP
getProjectStatechecked the static numbers written in.adfMETRICS and never measured anything. So it could say "All constraints pass" whileadf evidence --auto-measure --cifailed. It now measures the manifest METRICS sources live, usingmeasureMetricSourcesfromadf-ceilings.ts, the same codeadf evidence --auto-measureuses. When a constraint fails it reports the measured value and the ceiling.packages/cli/src/commands/project-state.ts:computeProjectState(aiDir, manifest)returns{ measured, allPassing, failCount, warnCount, metrics[], modules[] }. Each metric carriesvalue,ceiling,status,module,measured,source?andnote?.formatProjectState(state)renders the tool's text..ai/, ascomputeFileCeilingsdoes, so the result doesn't depend on the server's cwd. With the default.ai, this gives the same paths asadf evidence.measured: falseand a note like "static value, not measured (...)". The top-levelmeasuredis true only when every metric value was measured live.serve.tsdiff is confined to thegetProjectStatetool, plus its import line and the removal of the now-unusedvalidateConstraintsimport.Response shape (additive only)
## Project State,### <module> — N issue(s),- [FAIL] <message>,All constraints pass — no violations detected.(measured)or(static value, not measured)suffix.### Measurementsection is appended. It has ameasured: true|falseline and one line per metric.structuredContentfield carrying the same data.contentis still a single text item.Verified
pnpm install --frozen-lockfile: okpnpm exec tsc --build tsconfig.build.json: exit 0pnpm exec tsc --noEmit -p tsconfig.json: exit 0pnpm exec vitest run packages/cli/src/__tests__/project-state.test.ts packages/cli/src/__tests__/serve-zod4.test.ts packages/cli/src/__tests__/serve-context.test.ts:bundler_loc: 129 / 144is declared while the source has 149 lines. The result is[FAIL] bundler_loc: 149 / 144 [lines] -- FAIL (measured).getProjectState, run from an unrelated cwd, reports the failure.pnpm exec vitest run(full suite): 14 failures, all in files this PR doesn't touch.--no-file-parallelism, all of them passed except adf-vendor-doctor-score, which hit its 5s timeout again. With--testTimeout 60000it passes 61/61.node packages/cli/dist/bin.js adf evidence --auto-measure --ci --format text: Verdict PASS, exit 0. The pre-commit hook passed too.Not done
computeProjectState.Closes #441
Part of #437
🤖 Generated with Claude Code