Set the decision and its input
One synthetic object has eighty logical units, thirty measured stored units after compression, and two stored copies. The three declared bases yield eighty, thirty and sixty. A quotation saying only “storage” has not selected one of those quantities.
| Case | Input JSON |
|---|---|
| Base test | {"basis":"all-stored-copies","logical":80,"stored":30,"copies":2} |
Run the supplied comparison
The local model uses the supplied measured sizes; it does not estimate a real compression ratio or bill a provider. Replica counts describe stored bytes under this quote rule, not independent recovery domains.
| Path | Output JSON |
|---|---|
| Faulty path | {"basis":"all-stored-copies","measuredUnits":80} |
| Required path | {"basis":"all-stored-copies","measuredUnits":60} |
import assert from 'node:assert/strict';
const smallWhole=(x,max)=>Number.isSafeInteger(x)&&x>=0&&x<=max;
const run=function run(i,corrected=true){
if(!['logical','one-stored-copy','all-stored-copies'].includes(i.basis)||![i.logical,i.stored,i.copies].every(x=>smallWhole(x,1000000)))return {held:true};
const quantities={logical:i.logical,'one-stored-copy':i.stored,'all-stored-copies':i.stored*i.copies};
return {basis:i.basis,measuredUnits:corrected?quantities[i.basis]:i.logical};
};
const cases=[{"input":{"basis":"all-stored-copies","logical":80,"stored":30,"copies":2},"corrected":false,"expected":{"basis":"all-stored-copies","measuredUnits":80}},{"input":{"basis":"all-stored-copies","logical":80,"stored":30,"copies":2},"corrected":true,"expected":{"basis":"all-stored-copies","measuredUnits":60}},{"input":{"basis":"one-stored-copy","logical":80,"stored":30,"copies":2},"corrected":true,"expected":{"basis":"one-stored-copy","measuredUnits":30}},{"input":{"basis":null,"logical":80,"stored":30,"copies":2},"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);}
Choose from the boundary evidence
One-copy mode yields thirty even with two copies. An absent metering definition is held before a comparison is presented.
- Name the metered layer
- Use its supplied size evidence
- Apply the copy rule
Keep an unknown size basis unresolved; do not invent compressed sizes.
| Condition | Input JSON | Expected output JSON |
|---|---|---|
| one stored copy basis | {"basis":"one-stored-copy","logical":80,"stored":30,"copies":2} | {"basis":"one-stored-copy","measuredUnits":30} |
| missing metering definition | {"basis":null,"logical":80,"stored":30,"copies":2} | {"held":true} |
How much is measured under the base all-copies rule?
Show the worked answer
Sixty: two measured copies of thirty. Eighty is logical size and cannot be substituted for that quote basis.