Skip to content
Astera Technology

Keep diagnostic text outside the business payload

An adapter imports a diagnostic channel as part of a customer-facing field.

Download complete case notes and answer keys ↓

Define the local evaluation task

A synthetic result envelope supplies separate diagnostic and payload channels. Only payload is the business value; diagnostic is retained separately for local review. Payload must exist as an own property, including a permitted null value. A diagnostic that resembles the desired answer is never a fallback payload. These channels are authored labels, not claimed model-provider features.

  1. Check payload channel presence
  2. Read business value only from that channel
  3. Keep diagnostic text separate

Missing payload requires envelope correction, not a diagnostic fallback.

Use the filled cases

Original synthetic input and literal answer key
CaseSupplied inputExpected structured outputDecision and reason
Diagnostic text differs from label{"diagnostic":"drafting","payload":{"label":"A"}}{"status":"payload-present","value":{"label":"A"}}Business label A comes only from payload.
Only diagnostic channel{"diagnostic":"label A"}{"status":"missing-payload"}A plausible diagnostic cannot fill the missing business channel.
Explicit null payload{"diagnostic":"nothing found","payload":null}{"status":"payload-present","value":null}Presence and value are separate: the channel exists with null.
Download editable CSV ↓

Work the explicit-null-payload case. Which output is required, and why?

Show the worked answer

{"status":"payload-present","value":null} — Presence and value are separate: the channel exists with null.

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){return Object.hasOwn(x,'payload')?{status:'payload-present',value:x.payload}:{status:'missing-payload'};}

const cases = [
  {
    "id": "diagnostic-not-label",
    "input": {
      "diagnostic": "drafting",
      "payload": {
        "label": "A"
      }
    },
    "expected": {
      "status": "payload-present",
      "value": {
        "label": "A"
      }
    }
  },
  {
    "id": "diagnostic-only",
    "input": {
      "diagnostic": "label A"
    },
    "expected": {
      "status": "missing-payload"
    }
  },
  {
    "id": "explicit-null-payload",
    "input": {
      "diagnostic": "nothing found",
      "payload": null
    },
    "expected": {
      "status": "payload-present",
      "value": null
    }
  }
];
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 ↓

Use a separate validator for the extracted business value. Channel separation does not prove the value is correct, complete or authorised for import.

Related resources