FAILURE MAP
← Case archive

FA-11386 / Spreadsheet calculation semantics / Open access

A workbook name overrides a sheet-local definition · case 01

An expression resolves a name from the wrong sheet or workbook scope.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Name resolution ignores the active sheet when choosing definitions.

VERIFIED REPAIR

Check the active sheet namespace first, then the workbook namespace.

Unsuccessful approach: Checking all local namespaces finds a name belonging to an unrelated sheet.

Case contract

Names are exact strings. Resolve in local_names[active_sheet], then workbook_names; return #NAME? if absent. Numeric zero is a valid bound value.

Why this case matters

This isolated spreadsheet model makes cell semantics explicit; it does not claim compatibility with every workbook engine.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(name, sheet, workbook, local):
    return workbook.get(name, '#NAME?')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('active local shadows workbook', solve('rate','B',{'rate':N},{'A':{'rate':2*N},'B':{'rate':3*N}}),3*N)
check('other sheet does not shadow', solve('rate','B',{'rate':N},{'A':{'rate':2*N}}),N)
check('absent active sheet falls back', solve('rate','C',{'rate':N},{'A':{'rate':2*N}}),N)
check('zero local binding retained', solve('rate','B',{'rate':N},{'B':{'rate':0}}),0)
check('unknown name', solve('missing','B',{},{}),'#NAME?')
check('other sheet only name inaccessible', solve('rate','B',{}, {'A':{'rate':N}}),'#NAME?')
check('workbook only binding', solve('rate','B',{'rate':N},{}),N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
active local shadows workbook13Failed
other sheet does not shadow11Passed
absent active sheet falls back11Passed
zero local binding retained10Failed
unknown name#NAME?#NAME?Passed
other sheet only name inaccessible#NAME?#NAME?Passed
workbook only binding11Passed

SHA-256 / fa69dc71c422c13a73edf5dff574ed240b1cd32ea3bc68087382a8209ec0abd5

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(name, sheet, workbook, local):
    for namespace in local.values():
        if name in namespace:
            return namespace[name]
    return workbook.get(name, '#NAME?')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('active local shadows workbook', solve('rate','B',{'rate':N},{'A':{'rate':2*N},'B':{'rate':3*N}}),3*N)
check('other sheet does not shadow', solve('rate','B',{'rate':N},{'A':{'rate':2*N}}),N)
check('absent active sheet falls back', solve('rate','C',{'rate':N},{'A':{'rate':2*N}}),N)
check('zero local binding retained', solve('rate','B',{'rate':N},{'B':{'rate':0}}),0)
check('unknown name', solve('missing','B',{},{}),'#NAME?')
check('other sheet only name inaccessible', solve('rate','B',{}, {'A':{'rate':N}}),'#NAME?')
check('workbook only binding', solve('rate','B',{'rate':N},{}),N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
active local shadows workbook23Failed
other sheet does not shadow21Failed
absent active sheet falls back21Failed
zero local binding retained00Passed
unknown name#NAME?#NAME?Passed
other sheet only name inaccessible1#NAME?Failed
workbook only binding11Passed

SHA-256 / 84d220f2ccb7a552f48df5c268dc0fb494297fd1dab104c0258b8eaa74667db9

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(name, sheet, workbook, local):
    namespace = local.get(sheet, {})
    return namespace[name] if name in namespace else workbook.get(name, '#NAME?')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('active local shadows workbook', solve('rate','B',{'rate':N},{'A':{'rate':2*N},'B':{'rate':3*N}}),3*N)
check('other sheet does not shadow', solve('rate','B',{'rate':N},{'A':{'rate':2*N}}),N)
check('absent active sheet falls back', solve('rate','C',{'rate':N},{'A':{'rate':2*N}}),N)
check('zero local binding retained', solve('rate','B',{'rate':N},{'B':{'rate':0}}),0)
check('unknown name', solve('missing','B',{},{}),'#NAME?')
check('other sheet only name inaccessible', solve('rate','B',{}, {'A':{'rate':N}}),'#NAME?')
check('workbook only binding', solve('rate','B',{'rate':N},{}),N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
active local shadows workbook33Passed
other sheet does not shadow11Passed
absent active sheet falls back11Passed
zero local binding retained00Passed
unknown name#NAME?#NAME?Passed
other sheet only name inaccessible#NAME?#NAME?Passed
workbook only binding11Passed

SHA-256 / 09668b1cfbee3647619ba62373ace5d43f5740916a420e95817973d2ca88d0b7

Verification & scope

This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:38:47.447442+00:00.

Case digest / 25a9c0dea0c7ea4fe626a648e34b489810c73d70feedc99ff34e77b654104c7a