Skip to content

Commit ee643ed

Browse files
dhaneshclaude
andcommitted
Fix CLI bugs: Required Truths and Constraints parsing
Bugs fixed: - Required Truths showing 0/6 instead of 6/6 for converged manifolds - Constraints showing undefined/NaN% when verification data present Root causes: - status.ts checked anchors.required_truths (planning-time) not verification section - verify.ts expected generation.coverage.constraints_addressed which doesn't exist for all manifold types Fixes: - Added verification field to Manifold interface in parser.ts - status.ts now checks verification.required_truths_satisfied first - verify.ts now checks verification.constraints_satisfied first Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 40b88f3 commit ee643ed

4 files changed

Lines changed: 54 additions & 11 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@ build/
5353
# Note: .manifold/ is NOT ignored - it should be tracked
5454
# for team collaboration and cross-machine continuity
5555
# ===========================================
56+
*.bun-build

cli/commands/status.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,24 @@ function printFeatureStatus(data: FeatureData, includeHistory?: boolean): void {
204204
println(formatKeyValue('Tensions', formatTensionSummary(resolved, manifold.tensions.length)));
205205
}
206206

207-
// Anchors
207+
// Anchors - check verification section first (post-verification), then fall back to anchors (planning-time)
208208
if (manifold.anchors?.required_truths?.length) {
209-
const satisfied = manifold.anchors.required_truths.filter(
210-
rt => rt.status === 'SATISFIED'
211-
).length;
212-
println(formatKeyValue('Required Truths', `${satisfied}/${manifold.anchors.required_truths.length} satisfied`));
209+
const total = manifold.anchors.required_truths.length;
210+
let satisfied: number;
211+
212+
// Check if verification has the satisfied count (post-verification is more accurate)
213+
if (manifold.verification?.required_truths_satisfied) {
214+
// Parse from string like "6/6 (100%)" or just use the number
215+
const rtStr = String(manifold.verification.required_truths_satisfied);
216+
const match = rtStr.match(/^(\d+)/);
217+
satisfied = match ? parseInt(match[1], 10) : 0;
218+
} else {
219+
// Fall back to counting from anchors
220+
satisfied = manifold.anchors.required_truths.filter(
221+
rt => rt.status === 'SATISFIED'
222+
).length;
223+
}
224+
println(formatKeyValue('Required Truths', `${satisfied}/${total} satisfied`));
213225
}
214226

215227
if (manifold.anchors?.recommended_option) {

cli/commands/verify.ts

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,19 @@ function calculateCoverage(manifold: Manifold): NonNullable<VerificationResult['
265265
const constraintCounts = countConstraints(manifold);
266266
const totalConstraints = constraintCounts.total;
267267

268-
// Count satisfied from generation coverage or estimate from phase
268+
// Count satisfied from verification, generation coverage, or estimate from phase
269269
let satisfiedConstraints = 0;
270-
if (manifold.generation?.coverage) {
270+
271+
// Priority 1: Check verification section (most accurate, post-verification)
272+
if (manifold.verification?.constraints_satisfied !== undefined) {
273+
satisfiedConstraints = manifold.verification.constraints_satisfied;
274+
}
275+
// Priority 2: Check generation coverage
276+
else if (manifold.generation?.coverage?.constraints_addressed !== undefined) {
271277
satisfiedConstraints = manifold.generation.coverage.constraints_addressed;
272-
} else {
273-
// Estimate based on phase
278+
}
279+
// Priority 3: Estimate based on phase
280+
else {
274281
const phaseProgress: Record<string, number> = {
275282
'INITIALIZED': 0,
276283
'CONSTRAINED': 0.2,
@@ -282,9 +289,18 @@ function calculateCoverage(manifold: Manifold): NonNullable<VerificationResult['
282289
satisfiedConstraints = Math.floor(totalConstraints * (phaseProgress[manifold.phase] ?? 0));
283290
}
284291

285-
// Count required truths
292+
// Count required truths - check verification first, then anchors
286293
const requiredTruths = manifold.anchors?.required_truths ?? [];
287-
const satisfiedTruths = requiredTruths.filter(rt => rt.status === 'SATISFIED').length;
294+
let satisfiedTruths = 0;
295+
296+
// Check if verification has the satisfied count
297+
if (manifold.verification?.required_truths_satisfied) {
298+
const rtStr = String(manifold.verification.required_truths_satisfied);
299+
const match = rtStr.match(/^(\d+)/);
300+
satisfiedTruths = match ? parseInt(match[1], 10) : 0;
301+
} else {
302+
satisfiedTruths = requiredTruths.filter(rt => rt.status === 'SATISFIED').length;
303+
}
288304

289305
const percentage = totalConstraints > 0
290306
? Math.round((satisfiedConstraints / totalConstraints) * 100)

cli/lib/parser.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,20 @@ export interface Manifold {
5757

5858
generation?: Generation;
5959
integration?: Integration;
60+
61+
// Inline verification data (alternative to separate .verify.yaml)
62+
verification?: {
63+
timestamp?: string;
64+
result?: string;
65+
constraints_verified?: number;
66+
constraints_satisfied?: number;
67+
gaps_found?: number;
68+
gaps_blocking?: number;
69+
gaps_nonblocking?: number;
70+
required_truths_satisfied?: string | number;
71+
coverage?: Record<string, string | number>;
72+
verify_document?: string;
73+
};
6074
}
6175

6276
export interface Constraint {

0 commit comments

Comments
 (0)