archgraph-argo 0.20.1 → 0.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -835,15 +835,26 @@ function scopeCanonicalIdentitiesForChannel(identities, channel) {
|
|
|
835
835
|
});
|
|
836
836
|
}
|
|
837
837
|
|
|
838
|
+
// Semantic vector records store their canonicalIdentity channel-prefixed
|
|
839
|
+
// (e.g. "Element:widget-1") so the scoped Cypher `node.canonicalIdentity IN
|
|
840
|
+
// $canonicalIdentities` matches. Every consumer of a seed's `id` — purpose
|
|
841
|
+
// closure anchors, provenance keys, and the canonical-subset score lookup —
|
|
842
|
+
// however keys on the BARE canonical graph id. Expose the bare id as `id` and
|
|
843
|
+
// keep the prefixed value as `canonicalIdentity` so a seed resolves against the
|
|
844
|
+
// canonical graph instead of a phantom prefixed id.
|
|
845
|
+
function bareCanonicalId(id) {
|
|
846
|
+
return String(id).replace(/^[^:]*:/, '');
|
|
847
|
+
}
|
|
848
|
+
|
|
838
849
|
function normalizeVectorRecord(raw, channel) {
|
|
839
850
|
if (!raw || typeof raw !== 'object') return undefined;
|
|
840
|
-
const
|
|
851
|
+
const canonicalIdentity = raw.canonicalIdentity || raw.id || raw.objectId;
|
|
841
852
|
const score = numberValue(raw.score);
|
|
842
|
-
if (!
|
|
853
|
+
if (!canonicalIdentity || !Number.isFinite(score)) return undefined;
|
|
843
854
|
return {
|
|
844
855
|
...raw,
|
|
845
|
-
id,
|
|
846
|
-
canonicalIdentity
|
|
856
|
+
id: bareCanonicalId(canonicalIdentity),
|
|
857
|
+
canonicalIdentity,
|
|
847
858
|
objectType: channel.objectType,
|
|
848
859
|
channel: channel.channel,
|
|
849
860
|
score,
|
|
@@ -1157,5 +1168,7 @@ module.exports = {
|
|
|
1157
1168
|
auditThresholdFor,
|
|
1158
1169
|
resolveTopK,
|
|
1159
1170
|
scopeCanonicalIdentitiesForChannel,
|
|
1171
|
+
bareCanonicalId,
|
|
1172
|
+
normalizeVectorRecord,
|
|
1160
1173
|
AUDIT_PURPOSES,
|
|
1161
1174
|
};
|
|
@@ -3462,7 +3462,11 @@ function buildCanonicalSemanticDocumentSubset(source, canonicalDocument = undefi
|
|
|
3462
3462
|
if (!item) continue;
|
|
3463
3463
|
const numericScore = Number(item.semanticScore);
|
|
3464
3464
|
if (!Number.isFinite(numericScore)) continue;
|
|
3465
|
-
|
|
3465
|
+
// Evidence ids may still carry the channel prefix (real Neo4j shape); the
|
|
3466
|
+
// seed-score map and canonical lookups are keyed on the bare canonical id,
|
|
3467
|
+
// so normalize before comparing (otherwise the rank-derived score lands on
|
|
3468
|
+
// a phantom prefixed key and the tiny fused RRF score wins for the element).
|
|
3469
|
+
const key = String(item.id !== undefined ? item.id : item.view_id).replace(/^[^:]*:/, '');
|
|
3466
3470
|
if (key && (!semanticScoreById.has(key) || numericScore > semanticScoreById.get(key))) {
|
|
3467
3471
|
semanticScoreById.set(key, numericScore);
|
|
3468
3472
|
}
|
package/package.json
CHANGED