list_dynamic_ref_constraint_candidates()
Return sorted leaf cells missing dynamic-ref constraint entries.
Usage
list_dynamic_ref_constraint_candidates(
workbook,
targets,
*,
dynamic_refs=None,
max_depth=50,
max_range_cells=DEFAULT_MAX_RANGE_CELLS,
type_analysis_cache=None,
blank_ranges=None,
undomained_exact_match=None
)These are leaf cell addresses that feed dynamic-ref arguments (OFFSET/INDIRECT/INDEX) but have no entry in dynamic_refs.cell_type_env. Cells in blank_ranges are structural numeric zeros, so they are not candidates. INDEX and OFFSET inference uses those same rectangles.
Unlike create_dependency_graph, this function does not raise DynamicRefError when constraints are missing. Instead it collects all missing leaf addresses in a single pass and returns them sorted.
undomained_exact_match, when provided, receives lookup cells that exact MATCH kept only because they have no cell type. That list is not merged into the returned must-bind addresses. Proven misses, cells after a certain hit, and lookups whose needle was never scanned are omitted. The scan still warns via ExactMatchUndomainedCellWarning. An empty dynamic_refs skips inference, so the collection stays empty.
When dynamic_refs is None the function treats it as an empty constraint environment: all leaf cells that feed dynamic-ref arguments are returned as candidates.
Completeness caveat: Cells reachable only through unresolvable dynamic refs will not be visited, so their constraint candidates won’t appear in the output. A second call after adding the first batch of constraints will quickly find any remaining missing entries.
OFFSET argument domains that are known but too wide to enumerate under max_branches still walk the bounding rectangle of possible targets, so a failed exact inference does not hide downstream missing leaves.
Raises
DynamicRefCellLimitError-
An inferred OFFSET/INDEX/INDIRECT target set exceeds
max_cells. The scan refuses to return an incomplete list.