Accept Scattermind experiment sections
This commit is contained in:
@@ -45,7 +45,7 @@ Ranker's continuation job is narrow:
|
||||
|
||||
`Snapshot / Concept Map → candidate feature/action set → Rank-ready build order`
|
||||
|
||||
`POST /api/rank-feedback` accepts a `prioritix-feature-set-v1`-style payload from Scattermind and returns ranked items plus `buildOrder.doFirst / validateNext / defer / park`. It accepts candidate arrays as `features`, `actions`, `nextMoves`, or `candidates` either at the top level or under `featureSet`, and it can consume a nested Concept Map directly, so Scattermind can hand off `conceptMap.nextActions / nextMoves` without renaming them into fake software features. Sectioned Concept Maps may also include `validateNext`, `deferred`, and `parkingLot`; Ranker combines those sections into one build-order pass while preserving `sourceSection` and treating deferred/parked sections as lane hints. Ranker also accepts an already-laned Build Order object at top level, under `featureSet`, or as `conceptMap.buildOrder` (`doFirst` / `validateNext` / `deferred` / `parkingLot`, with aliases like `buildNow`, `testManually`, and `probablyNoise`). String items in those lanes are normalized into candidate actions, while object items can use `move`, `questionToAnswer`, or `evidenceQuestion` aliases. Normalized candidate objects may also use `lane` as a lane hint (`do-first`, `validate-next`, `defer`, `park`) without overwriting `sourceSection`, so Scattermind exports that separate recommendation from provenance remain traceable. Empty wrapper arrays are ignored rather than allowed to shadow a real nested Concept Map action set, and non-empty normalized wrappers are merged with Concept Map validation/deferred/parking sections rather than dropping that context. That keeps partially-normalized Scattermind exports rankable without losing the source lane contract. It also returns a `brief` with source, next-48-hour actions, carried-forward assumptions/constraints/non-goals, and `whatWouldChangeRanking` checks, lane-level `buildOrderDetails` with each item's reason, next step, evidence question, success/kill signals, source section, lane source, score, and confidence, plus a `handoff` object (`rank-feedback-result-v1`) with source provenance, item trace rows, explicit next-step/success/kill signals when Scattermind provides them, and contract warnings for missing artifact IDs, source sections, original prompt provenance, or evidence on active items. If Scattermind sends the current paid Concept Map shape as lenses rather than arrays, Ranker can parse `conceptMap.lenses.channel.content` / `buildOrder` labels (`Build first`, `Test manually`, `Defer`, `Probably noise`) into rank-ready candidates and can read guardrails from the risk lens. Keep this contract action-first; do not use it as a reason to add generic dashboard, auth, billing, or workspace layers before the bridge has proof.
|
||||
`POST /api/rank-feedback` accepts a `prioritix-feature-set-v1`-style payload from Scattermind and returns ranked items plus `buildOrder.doFirst / validateNext / defer / park`. It accepts candidate arrays as `features`, `actions`, `nextMoves`, `candidates`, `experiments`, `validationTests`, or `proofTests` either at the top level or under `featureSet`, and it can consume a nested Concept Map directly, so Scattermind can hand off `conceptMap.nextActions / nextMoves` without renaming them into fake software features. Experiment/proof-test arrays default into Validate next candidates, preserving source provenance while keeping them out of the active build-first lane. Sectioned Concept Maps may also include `validateNext`, `deferred`, and `parkingLot`; Ranker combines those sections into one build-order pass while preserving `sourceSection` and treating deferred/parked sections as lane hints. Ranker also accepts an already-laned Build Order object at top level, under `featureSet`, or as `conceptMap.buildOrder` (`doFirst` / `validateNext` / `deferred` / `parkingLot`, with aliases like `buildNow`, `testManually`, and `probablyNoise`). String items in those lanes are normalized into candidate actions, while object items can use `move`, `questionToAnswer`, or `evidenceQuestion` aliases. Normalized candidate objects may also use `lane` as a lane hint (`do-first`, `validate-next`, `defer`, `park`) without overwriting `sourceSection`, so Scattermind exports that separate recommendation from provenance remain traceable. Empty wrapper arrays are ignored rather than allowed to shadow a real nested Concept Map action set, and non-empty normalized wrappers are merged with Concept Map validation/deferred/parking sections rather than dropping that context. That keeps partially-normalized Scattermind exports rankable without losing the source lane contract. It also returns a `brief` with source, next-48-hour actions, carried-forward assumptions/constraints/non-goals, and `whatWouldChangeRanking` checks, lane-level `buildOrderDetails` with each item's reason, next step, evidence question, success/kill signals, source section, lane source, score, and confidence, plus a `handoff` object (`rank-feedback-result-v1`) with source provenance, item trace rows, explicit next-step/success/kill signals when Scattermind provides them, and contract warnings for missing artifact IDs, source sections, original prompt provenance, or evidence on active items. If Scattermind sends the current paid Concept Map shape as lenses rather than arrays, Ranker can parse `conceptMap.lenses.channel.content` / `buildOrder` labels (`Build first`, `Test manually`, `Defer`, `Probably noise`) into rank-ready candidates and can read guardrails from the risk lens. Keep this contract action-first; do not use it as a reason to add generic dashboard, auth, billing, or workspace layers before the bridge has proof.
|
||||
|
||||
Candidate items may include optional 1–10 `rankerHints` (`value`, `effort`, `confidence`, `urgency`, `revenue`, `novelty`, `risk`). Ranker blends those explicit Scattermind hints with text heuristics; `effort` is inverted into feasibility. Hints improve the defended order, but `recommendedLane: "defer"` or `"park"` remains a safety rail so dashboard-swamp items do not get promoted by flashy wording. For clean bridge handoff, Scattermind should send `sourceSection` and `evidenceNeeded` on each active next move. Scattermind can also send `targetAudience`, `constraints`, `assumptions`, and `nonGoals` / `avoid` at the top level, in `featureSet`, inside `conceptMap.context`, or as a structured top-level `context` object with `summary`, `targetAudience`, `constraints`, `nonGoals` / `avoid`, and `assumptions`; Ranker merges these sources rather than letting a shallow wrapper context shadow deeper Concept Map guardrails. Lens-only Concept Maps may additionally send audience / constraints / assumptions / risk lens content, and Ranker will split sentence-style lens notes into readable decision context instead of leaking `[object Object]`. If Scattermind only has a flat context string, Ranker now extracts simple guardrails such as `Solo builder`, `Manual proof`, `Avoid ...`, `No ...`, and `Do not ...` into `input.decisionContext` / `handoff.decisionContext` so early bridge exports still protect against dashboard/auth/billing drift. Ranker returns that decision context in `input.decisionContext` and `handoff.decisionContext`, and penalizes candidates that conflict with source non-goals (for example saved workspaces/auth/billing before the continuation proof). If Scattermind sends duplicate candidate IDs, Ranker keeps the first ID, suffixes later duplicates (`preview-2`), and reports the normalization in `handoff.warnings` / `handoff.itemTrace` so downstream build-order references remain addressable. Ranker also accepts Scattermind's paid Concept Map object directly when it arrives with top-level `reference_code`, `working_name`, `ideaText`, and string-valued `lenses.channel` / `lenses.risk` fields; the reference code becomes source provenance, the working name becomes the source title, and labelled Build Order text is turned into rank-ready candidates without requiring Scattermind to wrap it first.
|
||||
|
||||
|
||||
@@ -245,6 +245,44 @@ try {
|
||||
assert.equal(sectionedConcept.handoff.itemTrace.find(item => item.id === 'saved-team-workspace').sourceSection, 'concept-map.parkingLot');
|
||||
assert.deepEqual(sectionedConcept.handoff.warnings, []);
|
||||
|
||||
const experimentSectionResponse = await fetch(`${base}/api/rank-feedback`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
sourceName: 'Scattermind',
|
||||
artifactId: 'concept_map_experiments',
|
||||
originalPrompt: 'The Concept Map emitted experiments separately from next actions.',
|
||||
idea: 'Ranker should merge validation experiments into the build order instead of dropping them.',
|
||||
mode: 'mvp',
|
||||
conceptMap: {
|
||||
nextActions: [
|
||||
{ id: 'manual-build-order', action: 'Manual build-order preview', why: 'Create one defended first move from the source artifact.', evidence: 'Can one tired user act on it?', suggestedLane: 'do-first', rankerHints: { value: 9, effort: 2, confidence: 8, urgency: 8, risk: 2 } },
|
||||
],
|
||||
experiments: [
|
||||
{ id: 'five-user-comprehension', hypothesis: 'Five-user comprehension test', question: 'Can 3 of 5 non-AI-native users explain the first recommended move?', method: ['Show the copyable brief', 'Ask what they would do next'], sourceItemId: 'experiment-1', sourceTitle: 'Validation experiments' },
|
||||
],
|
||||
proofTests: [
|
||||
{ id: 'copy-paste-proof', testName: 'Copy-paste proof test', learningGoal: 'Does the build-order brief survive being pasted into notes?', steps: ['Copy the brief', 'Read it the next morning'], sourceItemId: 'experiment-2', sourceTitle: 'Validation experiments' },
|
||||
],
|
||||
parkingLot: [
|
||||
{ id: 'accounted-test-library', action: 'Saved experiment library', why: 'Auth dashboard for every validation test.', evidence: 'No bridge proof yet' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
});
|
||||
assert.equal(experimentSectionResponse.status, 200);
|
||||
const experimentSection = await experimentSectionResponse.json();
|
||||
assert.equal(experimentSection.input.optionCount, 4);
|
||||
assert.equal(experimentSection.ranked[0].id, 'manual-build-order');
|
||||
assert.equal(experimentSection.ranked.find(item => item.id === 'five-user-comprehension').lane.id, 'test');
|
||||
assert.equal(experimentSection.ranked.find(item => item.id === 'five-user-comprehension').lane.source, 'hint');
|
||||
assert.equal(experimentSection.ranked.find(item => item.id === 'five-user-comprehension').provenance.sourceSection, 'concept-map.experiments');
|
||||
assert.equal(experimentSection.ranked.find(item => item.id === 'five-user-comprehension').factors.evidenceNeeded, 'Can 3 of 5 non-AI-native users explain the first recommended move?');
|
||||
assert.equal(experimentSection.ranked.find(item => item.id === 'copy-paste-proof').lane.id, 'test');
|
||||
assert.equal(experimentSection.ranked.find(item => item.id === 'copy-paste-proof').provenance.sourceSection, 'concept-map.experiments');
|
||||
assert.equal(experimentSection.ranked.find(item => item.id === 'accounted-test-library').lane.id, 'park');
|
||||
assert.deepEqual(experimentSection.handoff.warnings, []);
|
||||
|
||||
const emptyWrapperResponse = await fetch(`${base}/api/rank-feedback`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
|
||||
@@ -675,10 +675,10 @@ function nonGoalConflicts(optionText, decisionContext = {}) {
|
||||
|
||||
function normalizeFeatureOption(item, index, fallbackId = 'feature', defaultSourceSection = '', defaultRecommendedLane = '') {
|
||||
const raw = typeof item === 'string' || typeof item === 'number' ? { action: String(item) } : objectFrom(item);
|
||||
const title = cleanText(raw.title || raw.name || raw.action || raw.move || raw.label || '', 140);
|
||||
const proofSteps = cleanTextList(raw.proofSteps || raw.proof || raw.validationSteps, 5, 180);
|
||||
const title = cleanText(raw.title || raw.name || raw.action || raw.move || raw.experiment || raw.testName || raw.hypothesis || raw.label || '', 140);
|
||||
const proofSteps = cleanTextList(raw.proofSteps || raw.proof || raw.validationSteps || raw.steps || raw.method, 5, 180);
|
||||
const dependencies = cleanTextList(raw.dependencies || raw.blockedBy, 5, 120);
|
||||
const evidenceNeeded = cleanText(raw.evidenceNeeded || raw.evidence || raw.test || raw.evidenceQuestion || raw.questionToAnswer || '', 260);
|
||||
const evidenceNeeded = cleanText(raw.evidenceNeeded || raw.evidence || raw.test || raw.evidenceQuestion || raw.questionToAnswer || raw.question || raw.learningGoal || '', 260);
|
||||
const userValue = cleanText(raw.userValue || raw.value || raw.outcome || raw.why, 260);
|
||||
const risk = cleanText(raw.risk || raw.assumption || raw.unknown || '', 220);
|
||||
const nextStep = cleanText(raw.nextStep || raw.nextAction || raw.firstStep || raw.manualStep || raw.actionToTake || '', 260);
|
||||
@@ -692,7 +692,7 @@ function normalizeFeatureOption(item, index, fallbackId = 'feature', defaultSour
|
||||
const sourceQuote = cleanMultiline(raw.sourceQuote || raw.sourceExcerpt || raw.evidenceQuote || raw.quote || raw.originalText || raw.rawText || '', 420);
|
||||
const recommendedLane = cleanText(raw.recommendedLane || raw.laneHint || raw.suggestedLane || (laneLooksLikeHint ? rawLane : '') || defaultRecommendedLane || '', 40).toLowerCase();
|
||||
const descriptionParts = [
|
||||
raw.description || raw.brief || '',
|
||||
raw.description || raw.brief || (raw.hypothesis && raw.hypothesis !== title ? `Hypothesis: ${raw.hypothesis}` : ''),
|
||||
userValue && `User value: ${userValue}`,
|
||||
evidenceNeeded && `Evidence needed: ${evidenceNeeded}`,
|
||||
risk && `Risk: ${risk}`,
|
||||
@@ -817,6 +817,12 @@ function optionsFromBody(body = {}) {
|
||||
{ items: featureSet.nextMoves, sourceSection: 'feature-set.nextMoves' },
|
||||
{ items: body.candidates, sourceSection: 'candidates' },
|
||||
{ items: featureSet.candidates, sourceSection: 'feature-set.candidates' },
|
||||
{ items: body.experiments, sourceSection: 'experiments', defaultLane: 'validate-next' },
|
||||
{ items: body.validationTests, sourceSection: 'experiments', defaultLane: 'validate-next' },
|
||||
{ items: body.proofTests, sourceSection: 'experiments', defaultLane: 'validate-next' },
|
||||
{ items: featureSet.experiments, sourceSection: 'feature-set.experiments', defaultLane: 'validate-next' },
|
||||
{ items: featureSet.validationTests, sourceSection: 'feature-set.experiments', defaultLane: 'validate-next' },
|
||||
{ items: featureSet.proofTests, sourceSection: 'feature-set.experiments', defaultLane: 'validate-next' },
|
||||
]);
|
||||
const conceptMapCandidateGroup = compactCandidateGroup([
|
||||
{ items: conceptMap.nextActions, sourceSection: 'concept-map.nextActions' },
|
||||
@@ -824,6 +830,9 @@ function optionsFromBody(body = {}) {
|
||||
{ items: conceptMap.features, sourceSection: 'concept-map.features' },
|
||||
{ items: conceptMap.candidates, sourceSection: 'concept-map.candidates' },
|
||||
{ items: conceptMap.validateNext || conceptMap.validate || conceptMap.validation, sourceSection: 'concept-map.validateNext', defaultLane: 'validate-next' },
|
||||
{ items: conceptMap.experiments, sourceSection: 'concept-map.experiments', defaultLane: 'validate-next' },
|
||||
{ items: conceptMap.validationTests, sourceSection: 'concept-map.experiments', defaultLane: 'validate-next' },
|
||||
{ items: conceptMap.proofTests, sourceSection: 'concept-map.experiments', defaultLane: 'validate-next' },
|
||||
{ items: conceptMap.deferred || conceptMap.defer || conceptMap.later, sourceSection: 'concept-map.deferred', defaultLane: 'defer' },
|
||||
{ items: conceptMap.parkingLot || conceptMap.park || conceptMap.parked, sourceSection: 'concept-map.parkingLot', defaultLane: 'park' },
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user