fix: accept regional layer CLI lists
This commit is contained in:
@@ -59,6 +59,19 @@ def test_layer_registry_matches_verified_official_grb_collections() -> None:
|
||||
operator.selected_definitions("buildings")
|
||||
|
||||
|
||||
def test_layer_selection_accepts_space_and_comma_cli_forms() -> None:
|
||||
operator = load_operator()
|
||||
|
||||
assert [item.key for item in operator.selected_definitions(["roads", "water", "parcels"])] == [
|
||||
"roads",
|
||||
"water",
|
||||
"parcels",
|
||||
]
|
||||
assert [item.key for item in operator.selected_definitions("roads,parcels")] == ["roads", "parcels"]
|
||||
with pytest.raises(ValueError, match="Unsupported layers"):
|
||||
operator.selected_definitions(["roads", "imaginary"])
|
||||
|
||||
|
||||
def test_line_owner_uses_intersection_length_and_deterministic_tie_break() -> None:
|
||||
operator = load_operator()
|
||||
scopes = __import__("geographic_scopes")
|
||||
|
||||
@@ -9,7 +9,7 @@ Changed:
|
||||
Tested before deployment:
|
||||
- `python -m py_compile scripts/provision_regional_grb_context.py`.
|
||||
- `python -m pytest backend/tests/test_sprint191_regional_grb_context.py backend/tests/test_sprint190_regional_grb_buildings.py backend/tests/test_sprint106_map_bbox_extract.py -q` (`19 passed`).
|
||||
- `bash scripts/run_readiness_check.sh` (`552 passed`; one Alembic head; frontend typecheck/build and script syntax gates passed).
|
||||
- `bash scripts/run_readiness_check.sh` (`553 passed`; one Alembic head; frontend typecheck/build and script syntax gates passed).
|
||||
|
||||
Next:
|
||||
- Pass the complete release gate, deploy the operator and provision all three live regional snapshots before claiming runtime readiness.
|
||||
|
||||
@@ -112,7 +112,12 @@ LAYER_BY_KEY = {definition.key: definition for definition in LAYERS}
|
||||
def parse_args() -> argparse.Namespace:
|
||||
parser = argparse.ArgumentParser(description="Provision municipality-partitioned regional GRB context layers.")
|
||||
parser.add_argument("--scope", choices=sorted(GEOGRAPHIC_SCOPES), default=DEFAULT_SCOPE_KEY)
|
||||
parser.add_argument("--layers", default=",".join(LAYER_BY_KEY), help="Comma-separated subset: roads,water,parcels")
|
||||
parser.add_argument(
|
||||
"--layers",
|
||||
nargs="+",
|
||||
default=list(LAYER_BY_KEY),
|
||||
help="Space- or comma-separated subset: roads water parcels",
|
||||
)
|
||||
parser.add_argument("--observed-date", type=date.fromisoformat, default=date.today())
|
||||
parser.add_argument("--base-url", default=os.environ.get("GEOINTEL_INTERNAL_API_URL", DEFAULT_API_URL))
|
||||
parser.add_argument(
|
||||
@@ -131,8 +136,14 @@ def parse_args() -> argparse.Namespace:
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def selected_definitions(raw_layers: str) -> list[LayerDefinition]:
|
||||
requested = {item.strip().lower() for item in raw_layers.split(",") if item.strip()}
|
||||
def selected_definitions(raw_layers: str | list[str]) -> list[LayerDefinition]:
|
||||
values = [raw_layers] if isinstance(raw_layers, str) else raw_layers
|
||||
requested = {
|
||||
item.strip().lower()
|
||||
for value in values
|
||||
for item in value.split(",")
|
||||
if item.strip()
|
||||
}
|
||||
unknown = requested - set(LAYER_BY_KEY)
|
||||
if unknown or not requested:
|
||||
raise ValueError(f"Unsupported layers: {sorted(unknown)}")
|
||||
|
||||
Reference in New Issue
Block a user