fix(reconstruction): resolve latest verifier observations without input-order bias
Group observations by exact normalized instant, retaining arbitrary fractional precision and offset equivalence. Coalesce equivalent assessments and all supporting Evidence; report conflicting latest assessments as unknown with verifier-result-ambiguous. Use the same instant comparison for freshness and future checks. Replace first-input-wins coverage with permutation, provenance, offset, sub-millisecond ordering, and future-clock regressions, including the public MCP workflow. Validation: focused reconstruction/offset tests and MCP workflow passed; converted JSON Schema validation, typecheck/lint, and docs checks passed. Full suite and real-provider lanes were not run.
This commit is contained in:
@@ -19,7 +19,10 @@ import {
|
||||
} from "./reconstructionCoverageEvaluation.js";
|
||||
import { digestSchema } from "./../domain/digests.js";
|
||||
import { prefixedDigestSchema } from "./../domain/digests.js";
|
||||
import { offsetDateTimeSchema } from "./offsetDateTime.js";
|
||||
import {
|
||||
offsetDateTimeInstantFromEpochMilliseconds,
|
||||
offsetDateTimeSchema,
|
||||
} from "./offsetDateTime.js";
|
||||
|
||||
const evidenceIdSchema = prefixedDigestSchema("ev");
|
||||
const stableIdSchema = z
|
||||
@@ -213,6 +216,7 @@ const closureReasonSchema = z.strictObject({
|
||||
"verifier-result-missing",
|
||||
"verifier-result-stale",
|
||||
"verifier-result-incompatible",
|
||||
"verifier-result-ambiguous",
|
||||
"verifier-failed",
|
||||
"verifier-unknown",
|
||||
"active-unknown",
|
||||
@@ -274,10 +278,12 @@ export const evaluateReconstructionClosure = (
|
||||
);
|
||||
if (boundary === undefined)
|
||||
throw new TypeError(`Unknown reconstruction boundary: ${boundaryId}`);
|
||||
const nowInstant = offsetDateTimeInstantFromEpochMilliseconds(nowEpochMs);
|
||||
const context: ReconstructionEvaluationContext = {
|
||||
coverage,
|
||||
boundary,
|
||||
nowEpochMs,
|
||||
nowInstant,
|
||||
reasons: [],
|
||||
evidenceIds: new Set<string>(),
|
||||
};
|
||||
@@ -394,6 +400,7 @@ const closureStatus = (
|
||||
[
|
||||
"verifier-result-stale",
|
||||
"verifier-result-incompatible",
|
||||
"verifier-result-ambiguous",
|
||||
"verifier-unknown",
|
||||
"active-unknown",
|
||||
"owner-path-unknown",
|
||||
|
||||
Reference in New Issue
Block a user