delete the mappings ledger — per-job in-memory resolution + notes fingerprint guard
The persisted (chatId, sourceId)→node table was a shared namespace across independent chunk/batch jobs: each chunk's extractor mints local ids fresh (p1..pN), so later chunks collided with earlier ones — propositions silently skipped as 'already resolved' (coverage checkpointed anyway: permanent silent loss) and edges resolved onto the wrong nodes (the 'everything links to everything' mush). Owner ruling 2026-09-29: mergeFindings resolves THIS job's ids in memory, nothing persists between jobs; cross-job identity is the auditor's linkTo verdicts alone. - contracts: NodeMapping dies; NotesSource.contentFp — sha256 of the text at the last run, the re-import guard (unchanged re-import = TRUE no-op, no model calls, no usage; changed text re-runs; legacy unstamped sources re-run once) - merger: job-local resolution map, in-submit duplicate ids skip once, edges resolve extractor-local ids only - ports/store: appendMapping/readMappings, LEDGER_FILES.mappings, rewriteLedgers.mappings gone (stale data/graph/mappings.jsonl just stops being read) - session-clusters: birthSessionOf is provenance-only — the legacy mapping-line fallback for provenance-empty notes nodes dies - deletion: no mapping rows to strip; stats lose mappingsRemoved - replay-layout batches nodes by first provenance point - graph.test pins the new independence semantics (re-merge re-creates; duplicate ids within one submit resolve once); extraction tests pin per-chunk merges + the fingerprint guard
This commit is contained in:
@@ -19,7 +19,7 @@ const depthMode: "off" | "vertical" | "radial" =
|
||||
depthArg === "--depth=vertical" ? "vertical" : depthArg === "--depth=radial" ? "radial" : "off";
|
||||
import { incrementalLayout } from "../src/core/layout.ts";
|
||||
import { birthSessionPartition } from "../src/core/session-clusters.ts";
|
||||
import type { GraphNode, NodeMapping, Position } from "../src/core/contracts.ts";
|
||||
import type { GraphNode, Position } from "../src/core/contracts.ts";
|
||||
|
||||
function main() {
|
||||
const t0 = Date.now();
|
||||
@@ -35,17 +35,17 @@ function main() {
|
||||
const edges = graphStore.readEdges();
|
||||
// The cluster source (wave 7): the birth-session partition, derived on
|
||||
// read — same as the real settle (core/layout-settle.ts).
|
||||
const birthClusters = birthSessionPartition(nodes, graphStore.readMappings());
|
||||
const birthClusters = birthSessionPartition(nodes);
|
||||
|
||||
// Batches: each imported file, in real import order (sources.json
|
||||
// importedAt). A node belongs to the file whose mapping first claims it
|
||||
// (mapping line order = arrival); nodes no mapping covers (legacy) ride
|
||||
// importedAt). A node belongs to the session of its FIRST provenance
|
||||
// point (line order = arrival); nodes with no provenance (legacy) ride
|
||||
// the final batch.
|
||||
const sources = [...graphStore.readSources()].sort((a, b) => a.importedAt.localeCompare(b.importedAt));
|
||||
const mappings: NodeMapping[] = graphStore.readMappings();
|
||||
const batchOf = new Map<string, string>(); // nodeId → srcId
|
||||
for (const m of mappings) {
|
||||
if (!batchOf.has(m.graphNodeId)) batchOf.set(m.graphNodeId, m.chatId);
|
||||
for (const node of nodes) {
|
||||
const birth = node.provenance[0]?.chatId;
|
||||
if (birth !== undefined && !batchOf.has(node.id)) batchOf.set(node.id, birth);
|
||||
}
|
||||
|
||||
const delivered = new Set<string>();
|
||||
|
||||
Reference in New Issue
Block a user