Treat candidate lane as rank hint
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. 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`, 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.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
@@ -341,6 +341,35 @@ try {
|
||||
assert.equal(mixedWrapper.handoff.itemTrace.find(item => item.id === 'account-dashboard').sourceSection, 'concept-map.parkingLot');
|
||||
assert.deepEqual(mixedWrapper.handoff.warnings, []);
|
||||
|
||||
const laneAliasResponse = await fetch(`${base}/api/rank-feedback`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
sourceName: 'Scattermind',
|
||||
artifactId: 'concept_map_lane_aliases',
|
||||
originalPrompt: 'Scattermind exported normalized candidates with lane fields instead of recommendedLane.',
|
||||
idea: 'Ranker should treat lane as a lane hint when it is do-first/validate-next/defer/park, while preserving the actual source section.',
|
||||
mode: 'mvp',
|
||||
featureSet: {
|
||||
features: [
|
||||
{ id: 'manual-bridge-proof', title: 'Manual bridge proof', description: 'Defended build order from one Concept Map.', evidenceNeeded: 'Can one tired user act on the first move?', lane: 'do-first', sourceSection: 'concept-map.nextActions', rankerHints: { value: 9, effort: 2, confidence: 8, urgency: 8, risk: 2 } },
|
||||
{ id: 'copyable-decision-brief', title: 'Copyable decision brief', description: 'Export the defended order as plain text.', evidenceNeeded: 'Does the copied brief preserve the next action?', lane: 'validate-next', sourceSection: 'concept-map.nextActions' },
|
||||
{ id: 'auth-workspace', title: 'Auth workspace', description: 'Accounts, dashboard, saved projects, and collaboration.', evidenceNeeded: 'No bridge proof yet.', lane: 'park', sourceSection: 'concept-map.parkingLot' },
|
||||
],
|
||||
},
|
||||
}),
|
||||
});
|
||||
assert.equal(laneAliasResponse.status, 200);
|
||||
const laneAlias = await laneAliasResponse.json();
|
||||
assert.equal(laneAlias.ranked[0].id, 'manual-bridge-proof');
|
||||
assert.equal(laneAlias.ranked.find(item => item.id === 'manual-bridge-proof').provenance.sourceSection, 'concept-map.nextActions');
|
||||
assert.equal(laneAlias.ranked.find(item => item.id === 'copyable-decision-brief').lane.id, 'test');
|
||||
assert.equal(laneAlias.ranked.find(item => item.id === 'copyable-decision-brief').lane.source, 'hint');
|
||||
assert.equal(laneAlias.ranked.find(item => item.id === 'auth-workspace').lane.id, 'park');
|
||||
assert.equal(laneAlias.ranked.find(item => item.id === 'auth-workspace').lane.source, 'hint');
|
||||
assert.equal(laneAlias.handoff.itemTrace.find(item => item.id === 'auth-workspace').sourceSection, 'concept-map.parkingLot');
|
||||
assert.deepEqual(laneAlias.handoff.warnings, []);
|
||||
|
||||
const duplicateIdResponse = await fetch(`${base}/api/rank-feedback`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
|
||||
@@ -684,8 +684,10 @@ function normalizeFeatureOption(item, index, fallbackId = 'feature', defaultSour
|
||||
const nextStep = cleanText(raw.nextStep || raw.nextAction || raw.firstStep || raw.manualStep || raw.actionToTake || '', 260);
|
||||
const successSignal = cleanText(raw.successSignal || raw.successCriteria || raw.successMetric || raw.greenLight || raw.signalToSee || '', 260);
|
||||
const killSignal = cleanText(raw.killSignal || raw.stopSignal || raw.redFlag || raw.failureSignal || raw.cutIf || '', 260);
|
||||
const sourceSection = cleanText(raw.sourceSection || raw.section || raw.lane || raw.origin || defaultSourceSection, 80);
|
||||
const recommendedLane = cleanText(raw.recommendedLane || raw.laneHint || raw.suggestedLane || defaultRecommendedLane || '', 40).toLowerCase();
|
||||
const rawLane = cleanText(raw.lane || '', 40);
|
||||
const laneLooksLikeHint = Boolean(normalizeLaneHint(rawLane));
|
||||
const sourceSection = cleanText(raw.sourceSection || raw.section || raw.origin || (!laneLooksLikeHint ? rawLane : '') || defaultSourceSection, 80);
|
||||
const recommendedLane = cleanText(raw.recommendedLane || raw.laneHint || raw.suggestedLane || (laneLooksLikeHint ? rawLane : '') || defaultRecommendedLane || '', 40).toLowerCase();
|
||||
const descriptionParts = [
|
||||
raw.description || raw.brief || '',
|
||||
userValue && `User value: ${userValue}`,
|
||||
|
||||
Reference in New Issue
Block a user