fix(rectification): centralize delivery authority
This commit is contained in:
@@ -30,6 +30,7 @@ import {
|
||||
resolveExactSkillPackage,
|
||||
} from "../src/lib/skill-package-registry.ts";
|
||||
import {
|
||||
OPEN_ENGINE_CAPABILITY_CEILING,
|
||||
CASE_ID,
|
||||
CANDIDATE_ID,
|
||||
FOCUS_ID,
|
||||
@@ -55,6 +56,7 @@ const UNIQUE_MINUTE_COPY = /±5 分钟确定性/;
|
||||
|
||||
function collectDecision(candidates: readonly { time: string; relativeSupport?: number }[]) {
|
||||
return decideRectification({
|
||||
engineCeiling: OPEN_ENGINE_CAPABILITY_CEILING,
|
||||
methodCoverageAll: false,
|
||||
trainingGateOpen: false,
|
||||
candidateScores: candidates.map((item) => ({ time: item.time, score: item.relativeSupport ?? 0 })),
|
||||
@@ -198,6 +200,7 @@ const ENGINE_SCORE = {
|
||||
display_allowed: true,
|
||||
selection_allowed: true,
|
||||
acceptance_allowed: true,
|
||||
propose_allowed: true,
|
||||
confirmation_allowed: false,
|
||||
accept_allowed: true,
|
||||
confirm_allowed: false,
|
||||
@@ -856,6 +859,7 @@ test("read-case follows method plan and keeps D9/D10 type tables when SQL missin
|
||||
policy_version: "rectification-candidate-policy-v2",
|
||||
selection_allowed: true,
|
||||
acceptance_allowed: true,
|
||||
propose_allowed: true,
|
||||
confirmation_allowed: false,
|
||||
representative_candidate_id: CANDIDATE_ID,
|
||||
overall_confidence: "medium",
|
||||
@@ -1373,6 +1377,15 @@ test("public tool surface stays at 14 and new cases bind 10.0.13", () => {
|
||||
selectionKind: null,
|
||||
algorithmVersion: "rectification-v5",
|
||||
decisionReceipt: {
|
||||
acceptance_allowed: true,
|
||||
selection_allowed: true,
|
||||
propose_allowed: true,
|
||||
confirmation_allowed: false,
|
||||
inference_state: producedInferenceState(plateauCandidates.map((item) => ({
|
||||
id: item.candidateId,
|
||||
time: item.time,
|
||||
relative_support: item.relativeSupport,
|
||||
}))),
|
||||
execution_ledger: [
|
||||
{ method: "vimshottari-dasha", status: "executed" },
|
||||
{ method: "narayana-dasha", status: "executed" },
|
||||
@@ -1389,7 +1402,7 @@ test("public tool surface stays at 14 and new cases bind 10.0.13", () => {
|
||||
// The execution ledger does not prove same-range support or raw-result agreement.
|
||||
assert.equal(plateau.rectification_label, "manual_pattern_consensus");
|
||||
assert.deepEqual(plateau.executed_methods, ["vimshottari-dasha", "narayana-dasha"]);
|
||||
const completed = latestResultToolProjection({
|
||||
const collecting = latestResultToolProjection({
|
||||
resultId: RESULT_ID,
|
||||
candidates: plateauCandidates,
|
||||
selectionAllowed: true,
|
||||
@@ -1405,6 +1418,7 @@ test("public tool surface stays at 14 and new cases bind 10.0.13", () => {
|
||||
],
|
||||
},
|
||||
}, decideRectification({
|
||||
engineCeiling: OPEN_ENGINE_CAPABILITY_CEILING,
|
||||
methodCoverageAll: false,
|
||||
trainingGateOpen: false,
|
||||
datedEventCount: 2,
|
||||
@@ -1414,10 +1428,41 @@ test("public tool surface stays at 14 and new cases bind 10.0.13", () => {
|
||||
score: item.relativeSupport,
|
||||
})),
|
||||
}));
|
||||
assert.equal(completed.rectification_label, "user_history_verification_required");
|
||||
assert.equal(completed.evidence_stop_reason, "insufficient_dated_events");
|
||||
assert.equal(collecting.rectification_label, "user_history_verification_required");
|
||||
assert.equal(collecting.evidence_stop_reason, "insufficient_dated_events");
|
||||
assert.deepEqual(collecting.executed_methods, ["vimshottari-dasha", "narayana-dasha"]);
|
||||
|
||||
const exhaustedCandidates = plateauCandidates.map((item, index) => ({
|
||||
...item,
|
||||
relativeSupport: index < 2 ? 40 : 20,
|
||||
}));
|
||||
const completed = latestResultToolProjection({
|
||||
resultId: RESULT_ID,
|
||||
candidates: exhaustedCandidates,
|
||||
selectionAllowed: true,
|
||||
confirmationAllowed: false,
|
||||
representativeTime: "04:45",
|
||||
selectedTime: null,
|
||||
selectionKind: null,
|
||||
algorithmVersion: "rectification-v5",
|
||||
decisionReceipt: {
|
||||
acceptance_allowed: true,
|
||||
selection_allowed: true,
|
||||
propose_allowed: true,
|
||||
confirmation_allowed: false,
|
||||
},
|
||||
}, decideRectification({
|
||||
engineCeiling: OPEN_ENGINE_CAPABILITY_CEILING,
|
||||
methodCoverageAll: true,
|
||||
trainingGateOpen: true,
|
||||
datedEventCount: 3,
|
||||
datedDomainCount: 2,
|
||||
candidateScores: exhaustedCandidates.map((item) => ({
|
||||
time: item.time,
|
||||
score: item.relativeSupport,
|
||||
})),
|
||||
}));
|
||||
assert.equal(completed.termination_copy, "当前最优结果是候选时间段,而不是已经确认的唯一出生分钟。临时代表时间仅用于下一轮验证与比较。");
|
||||
assert.deepEqual(completed.executed_methods, ["vimshottari-dasha", "narayana-dasha"]);
|
||||
const skill = readFileSync(new URL("../../skills/jyotish-birth-time-rectification/SKILL.md", import.meta.url), "utf8");
|
||||
assert.match(skill, /method_followup_plan/);
|
||||
assert.match(skill, /感情 → 事业 → 家人 → 职业 → 占问/);
|
||||
@@ -1435,12 +1480,12 @@ test("public tool surface stays at 14 and new cases bind 10.0.13", () => {
|
||||
|
||||
test("Mastra hides active candidates when the receipt range is corrupted", () => {
|
||||
const candidates = [
|
||||
{ candidateId: CANDIDATE_ID, time: "05:00", rank: 1, relativeSupport: 20, tiedMinuteCount: 1 },
|
||||
{ candidateId: SECOND_CANDIDATE_ID, time: "05:07", rank: 2, relativeSupport: 15, tiedMinuteCount: 1 },
|
||||
{ candidateId: CANDIDATE_ID, time: "05:00", rank: 1, relativeSupport: 58, tiedMinuteCount: 1 },
|
||||
{ candidateId: SECOND_CANDIDATE_ID, time: "05:07", rank: 2, relativeSupport: 42, tiedMinuteCount: 1 },
|
||||
];
|
||||
const inferenceState = producedInferenceState([
|
||||
{ id: CANDIDATE_ID, time: "05:00", relative_support: 20 },
|
||||
{ id: SECOND_CANDIDATE_ID, time: "05:07", relative_support: 15 },
|
||||
{ id: CANDIDATE_ID, time: "05:00", relative_support: 58 },
|
||||
{ id: SECOND_CANDIDATE_ID, time: "05:07", relative_support: 42 },
|
||||
]);
|
||||
const latest = {
|
||||
resultId: RESULT_ID,
|
||||
@@ -1451,9 +1496,16 @@ test("Mastra hides active candidates when the receipt range is corrupted", () =>
|
||||
selectedTime: null,
|
||||
selectionKind: null,
|
||||
algorithmVersion: "rectification-v5",
|
||||
decisionReceipt: { inference_state: inferenceState },
|
||||
decisionReceipt: {
|
||||
acceptance_allowed: true,
|
||||
selection_allowed: true,
|
||||
propose_allowed: true,
|
||||
confirmation_allowed: false,
|
||||
inference_state: inferenceState,
|
||||
},
|
||||
};
|
||||
const session = decideRectification({
|
||||
engineCeiling: OPEN_ENGINE_CAPABILITY_CEILING,
|
||||
methodCoverageAll: true,
|
||||
userStopped: true,
|
||||
candidateScores: candidates.map((item) => ({ time: item.time, score: item.relativeSupport })),
|
||||
@@ -1468,6 +1520,7 @@ test("Mastra hides active candidates when the receipt range is corrupted", () =>
|
||||
const invalid = latestResultToolProjection({
|
||||
...latest,
|
||||
decisionReceipt: {
|
||||
...latest.decisionReceipt,
|
||||
inference_state: { ...inferenceState, credible_range: ["04:00", "04:10"] },
|
||||
},
|
||||
}, session);
|
||||
@@ -2896,11 +2949,15 @@ test("paused case with selection_allowed may offer the escape hatch", async () =
|
||||
...receiptHandlers,
|
||||
get_agentic_rectification_case_dossier: () => dossierFixture({
|
||||
status: "paused",
|
||||
evidence: [educationEvidence],
|
||||
evidence: [educationEvidence, familyEvidence, careerEvidence],
|
||||
latestResult: candidateSnapshotFixture({
|
||||
selectionAllowed: true,
|
||||
representativeTime: "04:48",
|
||||
evidenceLedgerFingerprint: scoreableFingerprintForRawEvidence([educationEvidence]),
|
||||
evidenceLedgerFingerprint: scoreableFingerprintForRawEvidence([
|
||||
educationEvidence,
|
||||
familyEvidence,
|
||||
careerEvidence,
|
||||
]),
|
||||
candidates: [
|
||||
{ candidate_id: CANDIDATE_ID, rank: 1, time: "04:48", relative_support: 58, tied_minute_count: 1 },
|
||||
{ candidate_id: SECOND_CANDIDATE_ID, rank: 2, time: "04:49", relative_support: 42, tied_minute_count: 2 },
|
||||
|
||||
Reference in New Issue
Block a user