Skip to content
Astera Technology

Bind a later argument to the correct earlier tool result

A valid identifier is taken from the wrong call result.

Download complete case notes and answer keys ↓

Define the local evaluation task

A synthetic call plan names the exact preceding step and output field supplying a later argument. The provided results are keyed by step ID. Accept the later argument only when that field exists as an own output property and its value equals the supplied argument. A valid-looking ID from another step fails provenance.

  1. Read explicit step/field reference
  2. Resolve only that preceding result
  3. Compare later argument with resolved value

Absent preceding output holds the argument binding.

Use the filled cases

Original synthetic input and literal answer key
CaseSupplied inputExpected structured outputDecision and reason
Argument from wrong result{"results":{"S1":{"caseId":"C7"},"S2":{"docId":"D2"}},"ref":{"step":"S1","field":"caseId"},"argument":"D2"}{"status":"wrong-value","expected":"C7"}S1.caseId is C7; the valid document ID D2 belongs to S2.
Correct step field{"results":{"S1":{"caseId":"C7"}},"ref":{"step":"S1","field":"caseId"},"argument":"C7"}{"status":"bound","expected":"C7"}The exact argument retains its declared preceding-result source.
Field not produced{"results":{"S1":{"docId":"D2"}},"ref":{"step":"S1","field":"caseId"},"argument":"C7"}{"status":"missing-reference"}Do not fill an absent result field from memory or another call.
Download editable CSV ↓

Work the field-not-produced case. Which output is required, and why?

Show the worked answer

{"status":"missing-reference"} — Do not fill an absent result field from memory or another call.

Run the self-contained evaluator

Save as .mjs and run with Node.js; supplied fixtures only
import assert from 'node:assert/strict';

function evaluate(x){
 if(!Object.hasOwn(x.results,x.ref.step)||!Object.hasOwn(x.results[x.ref.step],x.ref.field))return {status:'missing-reference'};
 const expected=x.results[x.ref.step][x.ref.field];return {status:x.argument===expected?'bound':'wrong-value',expected};
}

const cases = [
  {
    "id": "wrong-result-id",
    "input": {
      "results": {
        "S1": {
          "caseId": "C7"
        },
        "S2": {
          "docId": "D2"
        }
      },
      "ref": {
        "step": "S1",
        "field": "caseId"
      },
      "argument": "D2"
    },
    "expected": {
      "status": "wrong-value",
      "expected": "C7"
    }
  },
  {
    "id": "correct-reference",
    "input": {
      "results": {
        "S1": {
          "caseId": "C7"
        }
      },
      "ref": {
        "step": "S1",
        "field": "caseId"
      },
      "argument": "C7"
    },
    "expected": {
      "status": "bound",
      "expected": "C7"
    }
  },
  {
    "id": "field-not-produced",
    "input": {
      "results": {
        "S1": {
          "docId": "D2"
        }
      },
      "ref": {
        "step": "S1",
        "field": "caseId"
      },
      "argument": "C7"
    },
    "expected": {
      "status": "missing-reference"
    }
  }
];
for (const c of cases) assert.deepEqual(evaluate(c.input), c.expected, c.id);
console.log(JSON.stringify({checked:cases.length,caseIds:cases.map(c=>c.id)}));
Download runnable example ↓

Retain provenance references as well as values in a plan evaluator. This fixture tests exact scalar references; it makes no external call and does not authorise a later write.

Related resources

Development services →