mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-11-30 23:47:58 +00:00
* fix(context): dedupe references before limits Select distinct relationship types and symbols in all seven graph queries before applying their existing 30-row limits. Repeated call sites must not hide other callers. Refs #3500 * fix(graph): validate reference provenance Check source identities and spans before either writer drops provenance. Retain full spans so nested calls sharing a start stay distinct. Reject invalid records without publishing a clean receipt; preserve the prior published index on failure. Expose repository-wide ingestion receipts to MCP callers. Legacy, collapsed, point-only and extracted-buffer provenance stays unverified. Identical identities keep the existing first-writer-wins evidence policy. Refs #3500 * fix(graph): leave notebook spans unverified Notebook captures map JSON rows but retain extracted-code columns. Keep these identities explicitly unverified instead of certifying a span that no single source buffer can validate. Refs #3500 * feat(graph): log ingestion integrity checks Record summary counts, bounded debug examples, and actionable rejection diagnostics before provenance is discarded. Document the debug command and verify both graph writers retain the logging contract. Refs #3500 * refactor(graph): simplify reference validation Refs #3500 * fix(graph): harden reference integrity checks Reject conflicting sites across streaming partitions. Preserve DISTINCT limits with indexed label anchors. Verify span migrations without weakening benchmark gates. Refs #3500, #3845. * fix(graph): validate canonical reference spans Reject access-kind prefixes and use parser UTF-16 column units for source bounds. Cover both writers with malformed identities and native Unicode parser regressions. Refs #3500, #3845 * test(graph): verify streamed integrity runs Force streaming in cold and changed-source cases and assert the emitted manifest. Clarify complete-span identity and successful Cypher response docs. Refs #3500, #3845 * fix(graph): preserve parsed-source provenance Keep concurrent source edits unverified, bound streamed identity probes, and distinguish transient MCP uncertainty from missing receipts. Refs #3845, #3500 * fix(graph): avoid retaining skipped endpoint IDs Resolve parser identity before allocating test directories. Refs #3845, #3500 --------- Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
43 lines
1.8 KiB
JavaScript
43 lines
1.8 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
|
|
const verifiedNote =
|
|
'Source-reference identities and source spans were checked before writing. This validates ingestion provenance, not resolution accuracy or query completeness.';
|
|
const unverifiedNote =
|
|
'Some reference edges have only a caller/target identity, extracted-buffer coordinates, or incomplete source provenance. Their original source-site distinctness is unverified; query deduplication is not an integrity check.';
|
|
|
|
/** Compare a new receipt with its own fixture metadata before bridging a legacy baseline. */
|
|
export function parityBody(body, variant, indexes) {
|
|
if (indexes.baseline.relationshipIntegrity !== undefined) return body;
|
|
if (variant === 'baseline') {
|
|
assert(
|
|
!Object.hasOwn(body, 'graph_integrity'),
|
|
'Legacy baseline unexpectedly returned graph_integrity',
|
|
);
|
|
return body;
|
|
}
|
|
assert.equal(variant, 'candidate');
|
|
const receipt = indexes.candidate.relationshipIntegrity;
|
|
assert(
|
|
receipt?.version === 1 &&
|
|
['checkedSites', 'unverifiedEdges', 'duplicatesSuppressed'].every(
|
|
(key) => Number.isSafeInteger(receipt[key]) && receipt[key] >= 0,
|
|
),
|
|
'Candidate index has no valid relationship integrity receipt',
|
|
);
|
|
const verified = receipt.unverifiedEdges === 0;
|
|
assert.deepEqual(
|
|
body.graph_integrity,
|
|
{
|
|
status: verified ? 'verified' : 'unverified',
|
|
scope: 'source-reference-ingestion',
|
|
checkedSites: receipt.checkedSites,
|
|
unverifiedEdges: receipt.unverifiedEdges,
|
|
duplicatesSuppressed: receipt.duplicatesSuppressed,
|
|
note: verified ? verifiedNote : unverifiedNote,
|
|
},
|
|
'Candidate graph_integrity does not match its index receipt',
|
|
);
|
|
const comparable = { ...body };
|
|
delete comparable.graph_integrity;
|
|
return comparable;
|
|
}
|