Relationships
#2628 GCP enrichment snapshots omit the name field their model StateSchema requires
Opened by stack72 · 9/28/2026
Found while implementing swamp-club #2230. Four enrichment methods persist a snapshot object through writeResource on the state resource without a name field, although the model StateSchema declares name as a required string: inventory_enabled (serviceusage services), inventory_hierarchy (cloudresourcemanager organizations), audit_effective_policies (orgpolicy policies), inventory_recommendations (recommender recommendations). model.resources.state.schema.safeParse rejects such a snapshot (checked directly against the cloudasset assets schema: without name fails, with name passes). The enrichment test suites cannot catch this because they mock writeResource. Needs confirmation of whether Swamp core validates written data against the resource schema; if it does, these methods fail at runtime, and if it does not, the stored data still violates the declared schema. Suggested fix: add name set to the snapshot instance name, as done in #2230, plus a safeParse assertion in each suite.
Closed
No activity in this phase yet.
system commented 9/28/2026, 9:22:35 PM
Classified automatically when this issue was filed.
- Source: Extensions
If you feel this classification is incorrect, add a ripple to tell us so.
stack72 commented 9/28/2026, 9:34:39 PM
Fixed as part of the #2230 work, in the same PR: https://git.swamp-club.com/swamp-club/swamp-extensions/pulls/337 (commit fd5afa1). The four enrichment snapshots now carry name, and each suite asserts StateSchema acceptance.
Sign in to post a ripple.