Member Junction
    Preparing search index...

    Resolves a ScoringScope into records and drives the MLModelInferenceProcessor batch path.

    Implements

    Index

    Constructors

    Methods

    • Persist predictions back onto the scored records per the request's write-back OutputMapping, returning a WriteBackOutcome the summary folds in.

      No-ops (and reports wroteBack: false) when:

      • write-back is not requested, or is the boolean form (no explicit mapping — a default-mapping write-back is owned by the higher Record Process layer, not this runner), or
      • request.dryRun is true (compute-only — predictions are surfaced but never persisted, matching ProcessRun.DryRun in the substrate).

      Otherwise, for each Succeeded record (paired 1:1 with records in order), it resolves the target BaseEntity, validates + applies the mapped fields, and Save()s. A record whose Save fails is recorded in failedIndexes so summarize can move it from scored -> failed.

      Parameters

      Returns Promise<WriteBackOutcome>

    • Validate every mapped target field name against the entity's real fields, throwing on the first unknown name. The mapping is caller-supplied, so an unknown field would otherwise silently no-op (or be swallowed by Set); we reject loudly — the same defensive posture as primaryKeyFilter.

      Parameters

      • entityInfo: EntityInfo
      • mapping: ScoringOutputMapping

      Returns void

    • Build a Field='value'-style filter from a primary-key object. Each KEY is validated against the entity's real fields BEFORE interpolation — an unknown field name is rejected (SQL-injection defense for the untrusted key names, mirroring how the write-entity-fields action validates field names). Values are still single-quote-escaped.

      Parameters

      Returns string

    • Resolve a MJ: Lists id into its member records as entity objects. Mirrors the substrate's ListSource membership contract — a List's members live in MJ: List Details (which store a composite-key-safe RecordID), NOT in a backing User View. We (1) read the list's target EntityID/name, (2) read its member RecordIDs from MJ: List Details, then (3) load those target rows as entity_objects so the inference processor gets the same preloaded-row shape as the other scopes.

      Parameters

      Returns Promise<RecordRef[]>

    • Fold per-record results into the run summary (counts + predictions / write-back). The MLModelInferenceProcessor.ProcessBatch contract returns results 1:1 with the input records in the SAME order, so we pair each result with its record by walking both together and key each prediction off the PAIRED record's RecordID (record-correlated, not a bare positional lookup that would silently misalign if the lengths ever diverged). All three outcome buckets — Succeeded / Failed / Skipped — are tallied.

      wroteBack reflects what was ACTUALLY persisted: it is true only when at least one record's prediction was Saved. A record that scored but whose write-back Save failed (its index is in writeBack.failedIndexes) is moved from the scored bucket into the failed bucket — its prediction did not land. Predictions are surfaced ephemerally only when nothing was written back.

      Parameters

      Returns ScoreRecordSetResult