diff --git a/scripts/check-rank-feedback.mjs b/scripts/check-rank-feedback.mjs index b3e7a7c..be443d3 100644 --- a/scripts/check-rank-feedback.mjs +++ b/scripts/check-rank-feedback.mjs @@ -883,7 +883,43 @@ try { assert.equal(snakeCaseBridge.handoff.readiness.status, 'ready'); assert.deepEqual(snakeCaseBridge.handoff.warnings, []); - console.log(JSON.stringify({ ok: true, top: data.ranked[0].id, hintedTop: hinted.ranked[0].id, actionTop: actions.ranked[0].id, nestedConceptTop: nestedConcept.ranked[0].id, nonGoalTop: nonGoal.ranked[0].id, structuredContextTop: structuredContext.ranked[0].id, lensOnlyTop: lensOnly.ranked[0].id, scattermindPaidShapeTop: scattermindPaidShape.ranked[0].id, mergedContextTop: mergedContext.ranked[0].id, embeddedJsonTop: embeddedJson.ranked[0].id, fencedJsonTop: fencedJson.ranked[0].id, embeddedSnapshotTop: embeddedSnapshot.ranked[0].id, sourceExcerptTop: sourceExcerpt.ranked[0].id, snakeCaseBridgeTop: snakeCaseBridge.ranked[0].id, duplicateIds: duplicateIds.ranked.map(item => item.id), readiness: data.handoff.readiness.status, provenance: data.input.provenance, buildOrder: data.buildOrder }, null, 2)); + const nextStepsAliasResponse = await fetch(`${base}/api/rank-feedback`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + sourceName: 'Scattermind', + artifactId: 'concept_map_next_steps_aliases', + originalPrompt: 'Scattermind exported next_steps / recommended_next_steps rather than nextActions.', + idea: 'Ranker should keep schema-light continuation exports rankable without asking Scattermind to rename step fields.', + mode: 'mvp', + context: { + targetAudience: 'Tired non-AI-native solo builder', + nonGoals: ['Avoid saved workspaces before the first proof'], + }, + concept_map: { + next_steps: [ + { id: 'manual-step-preview', next_step: 'Manual step preview', why: 'Turn one Concept Map into a defended first move.', evidence_needed: 'Can one tired user explain the first move?', suggested_lane: 'do-first', ranker_hints: { value: 9, effort: 2, confidence: 8, urgency: 8, risk: 2 } }, + { id: 'copyable-followup', recommended_next_step: 'Copyable follow-up brief', why: 'Let the build order survive outside Ranker.', evidence_needed: 'Does the brief preserve reason and source?', suggested_lane: 'validate-next' }, + ], + recommended_next_steps: [], + parking_lot: [ + { id: 'saved-workspace', next_step: 'Saved workspace dashboard', why: 'Accounts and saved projects for every idea.', evidence_needed: 'No proof yet.', suggested_lane: 'park' }, + ], + }, + }), + }); + assert.equal(nextStepsAliasResponse.status, 200); + const nextStepsAlias = await nextStepsAliasResponse.json(); + assert.equal(nextStepsAlias.input.optionCount, 3); + assert.equal(nextStepsAlias.ranked[0].id, 'manual-step-preview'); + assert.equal(nextStepsAlias.ranked[0].title, 'Manual step preview'); + assert.equal(nextStepsAlias.ranked[0].provenance.sourceSection, 'concept-map.nextActions'); + assert.equal(nextStepsAlias.ranked.find(item => item.id === 'copyable-followup').title, 'Copyable follow-up brief'); + assert.equal(nextStepsAlias.ranked.find(item => item.id === 'copyable-followup').lane.id, 'test'); + assert.equal(nextStepsAlias.ranked.find(item => item.id === 'saved-workspace').lane.id, 'park'); + assert.deepEqual(nextStepsAlias.handoff.warnings, []); + + console.log(JSON.stringify({ ok: true, top: data.ranked[0].id, hintedTop: hinted.ranked[0].id, actionTop: actions.ranked[0].id, nestedConceptTop: nestedConcept.ranked[0].id, nonGoalTop: nonGoal.ranked[0].id, structuredContextTop: structuredContext.ranked[0].id, lensOnlyTop: lensOnly.ranked[0].id, scattermindPaidShapeTop: scattermindPaidShape.ranked[0].id, mergedContextTop: mergedContext.ranked[0].id, embeddedJsonTop: embeddedJson.ranked[0].id, fencedJsonTop: fencedJson.ranked[0].id, embeddedSnapshotTop: embeddedSnapshot.ranked[0].id, sourceExcerptTop: sourceExcerpt.ranked[0].id, snakeCaseBridgeTop: snakeCaseBridge.ranked[0].id, nextStepsAliasTop: nextStepsAlias.ranked[0].id, duplicateIds: duplicateIds.ranked.map(item => item.id), readiness: data.handoff.readiness.status, provenance: data.input.provenance, buildOrder: data.buildOrder }, null, 2)); } finally { server.kill('SIGTERM'); } diff --git a/server.js b/server.js index e955bcf..544d5cc 100644 --- a/server.js +++ b/server.js @@ -701,7 +701,7 @@ function nonGoalConflicts(optionText, decisionContext = {}) { function normalizeFeatureOption(item, index, fallbackId = 'feature', defaultSourceSection = '', defaultRecommendedLane = '') { const rawValue = typeof item === 'string' || typeof item === 'number' ? String(item) : ''; const raw = rawValue ? { action: rawValue } : objectFrom(item); - const title = cleanText(raw.title || raw.name || raw.action || raw.move || raw.experiment || raw.testName || raw.hypothesis || raw.label || '', 140); + const title = cleanText(raw.title || raw.name || raw.action || raw.move || raw.nextMove || raw.next_move || raw.nextStep || raw.next_step || raw.recommendedNextStep || raw.recommended_next_step || raw.experiment || raw.testName || raw.test_name || raw.hypothesis || raw.label || '', 140); const proofSteps = cleanTextList(raw.proofSteps || raw.proof_steps || raw.proof || raw.validationSteps || raw.validation_steps || raw.steps || raw.method, 5, 180); const dependencies = cleanTextList(raw.dependencies || raw.blockedBy, 5, 120); const evidenceNeeded = cleanText(raw.evidenceNeeded || raw.evidence_needed || raw.evidence || raw.test || raw.evidenceQuestion || raw.evidence_question || raw.questionToAnswer || raw.question_to_answer || raw.question || raw.learningGoal || raw.learning_goal || '', 260); @@ -842,8 +842,8 @@ function optionsFromBody(body = {}) { { items: featureSet.features, sourceSection: 'feature-set.features' }, { items: body.actions, sourceSection: 'actions' }, { items: featureSet.actions, sourceSection: 'feature-set.actions' }, - { items: body.nextActions || body.next_actions, sourceSection: 'nextActions' }, - { items: featureSet.nextActions || featureSet.next_actions, sourceSection: 'feature-set.nextActions' }, + { items: body.nextActions || body.next_actions || body.nextSteps || body.next_steps || body.recommendedNextSteps || body.recommended_next_steps, sourceSection: 'nextActions' }, + { items: featureSet.nextActions || featureSet.next_actions || featureSet.nextSteps || featureSet.next_steps || featureSet.recommendedNextSteps || featureSet.recommended_next_steps, sourceSection: 'feature-set.nextActions' }, { items: body.nextMoves || body.next_moves, sourceSection: 'nextMoves' }, { items: featureSet.nextMoves || featureSet.next_moves, sourceSection: 'feature-set.nextMoves' }, { items: body.candidates, sourceSection: 'candidates' }, @@ -856,7 +856,7 @@ function optionsFromBody(body = {}) { { items: featureSet.proofTests || featureSet.proof_tests, sourceSection: 'feature-set.experiments', defaultLane: 'validate-next' }, ]); const conceptMapCandidateGroup = compactCandidateGroup([ - { items: conceptMap.nextActions || conceptMap.next_actions, sourceSection: 'concept-map.nextActions' }, + { items: conceptMap.nextActions || conceptMap.next_actions || conceptMap.nextSteps || conceptMap.next_steps || conceptMap.recommendedNextSteps || conceptMap.recommended_next_steps, sourceSection: 'concept-map.nextActions' }, { items: conceptMap.nextMoves || conceptMap.next_moves, sourceSection: 'concept-map.nextMoves' }, { items: conceptMap.features, sourceSection: 'concept-map.features' }, { items: conceptMap.candidates, sourceSection: 'concept-map.candidates' }, @@ -868,7 +868,7 @@ function optionsFromBody(body = {}) { { items: conceptMap.parkingLot || conceptMap.parking_lot || conceptMap.park || conceptMap.parked, sourceSection: 'concept-map.parkingLot', defaultLane: 'park' }, ]); const snapshotCandidateGroup = compactCandidateGroup([ - { items: snapshot.nextActions || snapshot.next_actions, sourceSection: 'snapshot.nextActions' }, + { items: snapshot.nextActions || snapshot.next_actions || snapshot.nextSteps || snapshot.next_steps || snapshot.recommendedNextSteps || snapshot.recommended_next_steps, sourceSection: 'snapshot.nextActions' }, { items: snapshot.nextMoves || snapshot.next_moves, sourceSection: 'snapshot.nextMoves' }, { items: snapshot.actions, sourceSection: 'snapshot.actions' }, { items: snapshot.features, sourceSection: 'snapshot.features' },