Skip to content
Astera Technology

Separate live relative filters from frozen snapshots

Reopen the supplied last-seven-day rule at its execution anchor.

Download complete case notes and answer keys ↓

Set the decision and its input

The fictional day indices are supplied integers, not timezone conversions. The filter was saved on day10 and runs on12. Its inclusive seven-day range is6..12, so B6 and C11 match; A4 leaves the live result. The frozen day10 snapshot still contains A4 and B6.

Filled local test worksheet
CaseInput JSON
Base test{"savedDay":10,"executedDay":12,"records":[{"id":"A","day":4},{"id":"B","day":6},{"id":"C","day":11}]}
Download editable CSV ↓

Run the supplied comparison

The executable selection preserves both live and snapshot identities. A saved relative expression and a persisted result are different artefacts; a changed live membership does not corrupt the original snapshot.

Faulty and required outputs
PathOutput JSON
Faulty path{"liveIds":["A","B","C"],"snapshotIds":["A","B"]}
Required path{"liveIds":["B","C"],"snapshotIds":["A","B"]}
Download editable CSV ↓
Complete local Node24.14.1 programme
import assert from 'node:assert/strict';

const run=function run(i,corrected=true){
    if(i.executedDay===null)return {held:true};const cutoff=(corrected?i.executedDay:i.savedDay)-6;
    return {liveIds:i.records.filter(r=>r.day>=cutoff&&r.day<=i.executedDay).map(r=>r.id),snapshotIds:i.records.filter(r=>r.day>=i.savedDay-6&&r.day<=i.savedDay).map(r=>r.id)};
  };
const cases=[{"input":{"savedDay":10,"executedDay":12,"records":[{"id":"A","day":4},{"id":"B","day":6},{"id":"C","day":11}]},"corrected":false,"expected":{"liveIds":["A","B","C"],"snapshotIds":["A","B"]}},{"input":{"savedDay":10,"executedDay":12,"records":[{"id":"A","day":4},{"id":"B","day":6},{"id":"C","day":11}]},"corrected":true,"expected":{"liveIds":["B","C"],"snapshotIds":["A","B"]}},{"input":{"savedDay":10,"executedDay":10,"records":[{"id":"A","day":4},{"id":"B","day":11}]},"corrected":true,"expected":{"liveIds":["A"],"snapshotIds":["A"]}},{"input":{"savedDay":10,"executedDay":null,"records":[]},"corrected":true,"expected":{"held":true}}];
for(const test of cases){const actual=await run(test.input,test.corrected);assert.deepEqual(actual,test.expected);console.log(actual);}
Download runnable example ↓

Choose from the boundary evidence

Running on the original day matches its snapshot anchor. Missing execution day is held rather than inferred from the save time.

  1. Read expression and snapshot anchor
  2. Resolve the execution window
  3. Retain both result identities

Do not silently turn a relative saved query into an old fixed cutoff.

Editable boundary inputs and outputs
ConditionInput JSONExpected output JSON
same execution day as snapshot{"savedDay":10,"executedDay":10,"records":[{"id":"A","day":4},{"id":"B","day":11}]}{"liveIds":["A"],"snapshotIds":["A"]}
execution anchor unknown{"savedDay":10,"executedDay":null,"records":[]}{"held":true}
Download editable CSV ↓

Which IDs belong to the base live result and snapshot?

Show the worked answer

Live B,C; snapshot A,B. Each uses its declared anchor, so both results can be correct together.

Related resources