Skip to content

Reproducible public.wsg_outlet builder + single-WSG downstream-state guard #227

Description

@NewGraphEnvironment

public.wsg_outlet (per-WSG outlet wscode_ltree) drives study-area drainage
closure + downstream-first ordering via fresh::frs_wsg_drainage() ->
link::lnk_wsg_resolve(). No repo builds it — it is an assumed-preexisting fwapg
table, "materialized ad-hoc," so it vanishes when the local docker volume is
recreated. Symptom: test-lnk_wsg_resolve.R closure-mode tests error
relation "public.wsg_outlet" does not exist.

Related footgun: data-raw/wsg_run_one.R computes a WSG's access on whatever
downstream barriers happen to be persisted, with no guard — run standalone on an
empty/incomplete DB it silently misses downstream dams.

Two fixes:

  1. A reproducible wsg_outlet builder (fresh data-raw/ or documented SQL) wired
    into setup so it survives volume rebuilds.
  2. A precondition guard so a single-WSG run fails loud if its downstream closure
    is not persisted.

Surfaced during #223 validation. NOT a #223 correctness issue — the single-WSG
re-runs were correct because full provincial state pre-existed (proven by exact
dam_dnstr_ind match on FINA/PCEA). Relates to #223.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions