Skip to main content
← Back to list
01Issue
BugShippedExtensions
Assigneesstack72

#367 Missing 'parent' field in GlobalArgsSchema for several @swamp/gcp/* models causes get to fail

Opened by thescarletmanuka · 5/17/2026· Shipped 5/18/2026

Summary

Several @swamp/gcp/* extension models (auto-generated) reference g["parent"] in their get (and create/update/delete) method implementations, but parent is not declared in the corresponding GlobalArgsSchema. Runtime validation rejects setting parent in globalArguments:

Global arguments validation failed: Unknown argument(s): parent.
Valid arguments are: annotations, binaryAuthorization, ..., serviceId, location

This makes it impossible to use get to fetch an existing GCP resource that needs a parent path (project + location). The same pattern is present in the other affected models' create methods, so I expect it to break create and delete similarly.

Affected extensions and models (versions current as of 2026-05-16)

The pattern is shared across all the auto-generated GCP extension models, so it likely affects more model types beyond the five I happen to have hit during a real inventory exercise.

Reproduction

swamp extension pull @swamp/gcp/run
swamp model create @swamp/gcp/run/services my-test
# edit the YAML to add:
#   globalArguments:
#     parent: projects/<your-project>/locations/us-central1
swamp model method run my-test get --input identifier=some-existing-service

Expected: get succeeds and writes the service's state to the model's data store.

Actual:

{
  "error": "Global arguments validation failed: Unknown argument(s): parent. Valid arguments are: annotations, binaryAuthorization, buildConfig, client, clientVersion, customAudiences, defaultUriDisabled, description, iapEnabled, ingress, invokerIamDisabled, labels, launchStage, multiRegionSettings, name, scaling, template, terminalCondition, traffic, serviceId, location",
  "code": "method_execution_failed"
}

Code reference

In each affected model's get method (the path is the same in every model; here is @swamp/gcp/run/models/services.ts):

get: {
  ...
  execute: async (args, context) => {
    const g = context.globalArgs;
    const params = { project: projectId };
    params["name"] = buildResourceName(String(g["parent"] ?? ""), args.identifier);
    ...
  }
}

But GlobalArgsSchema in the same file does not declare a parent field. The Zod schema rejects the field at validation time, so the ??"" fallback always wins and buildResourceName produces a malformed name.

Workaround in use

We hand-patched .swamp/bundles/<hash>/<model>.js for each affected model to insert parent: z.string().describe("The parent resource path").optional(), at the top of the GlobalArgsSchema. This works at runtime but is lost on any swamp extension install because the bundles are regenerated from the registry sources.

Proposed fix

Add to each affected model's GlobalArgsSchema:

parent: z.string().describe("The parent resource path, e.g. projects/{project}/locations/{location}").optional(),

Alternatively, derive parent from existing fields where applicable (location, serviceId, etc.), but adding parent as an explicit optional field is the smaller, more compatible change.

Why this matters

This blocks the inventory / replication use case where existing GCP resources need to be brought under swamp management without re-creating them. get is the standard read-only path for that and is hit on every adopted resource.

Environment

  • swamp version: 20260515.175436.0-sha.2f8e98af
  • Linux x86_64

Upstream repository: https://github.com/systeminit/swamp-extensions

Environment

  • Extension: @swamp/gcp/[email protected]
  • swamp: 20260515.175436.0-sha.2f8e98af
  • OS: linux (x86_64)
  • Deno: 2.7.14+19bd3d8
  • Shell: /bin/bash
02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 2 MOREREVIEW+ 3 MOREPR_MERGEDSHIPPED

Shipped

5/18/2026, 8:39:36 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack725/18/2026, 6:04:28 PM
Editable. Press Enter to edit.

thescarletmanuka commented 5/19/2026, 2:32:50 AM

Thanks for the quick fix! I upgraded to the new versions today and confirmed the parent validation error is gone. However, the fix is incomplete for two of the originally-reported models — the parent construction projects/${projectId}/locations/${g["location"] ?? ""} assumes a fixed three-segment parent, which doesn't match every GCP API's resource path:

1. @swamp/gcp/secretmanager/secrets — global secrets are broken

Global Secret Manager secrets live at projects/{p}/secrets/{s} (no /locations/global/ segment). The new code constructs projects/{p}/locations/global/secrets/{s} when location: global is set, which the API rejects:

$ swamp model method run secret-manager get --input identifier=jwt-keys
Read failed (400):
{
  "error": {
    "code": 400,
    "message": "The provided Secret ID [projects/rev79-232812/locations/global/secrets/jwt-keys] does not match the expected format [projects/*/secrets/*]",
    "status": "INVALID_ARGUMENT"
  }
}

The pre-fix parent workaround let users set parent: projects/{p} and produced the right URL. Now there's no way to express "global secret" through location.

Possible fix: if location is empty/global, fall back to projects/{p} (no locations segment) for secrets — or require the user to set location only when they actually have a regional secret.

2. @swamp/gcp/cloudbuild/connections-repositories — missing connection segment

Cloud Build repositories are nested under connections: projects/{p}/locations/{loc}/connections/{conn}/repositories/{repo}. The new code builds projects/{p}/locations/{loc}/repositories/{repo} — the connections/{conn}/ segment is missing — so the GET returns 404:

$ swamp model method run cloudbuild-repos-sil-rev79 get --input identifier=rev79-backend
Read failed (404)

The pre-fix parent workaround let users set parent: projects/{p}/locations/{loc}/connections/{conn} and buildResourceName appended /repositories/{shortName} correctly. Now there's no field in GlobalArgsSchema to carry the connection.

Possible fix: add a connection (or connectionId) field to the connections-repositories GlobalArgsSchema and use it in the parent path construction.

Working models (for reference)

These four work correctly with the new fix:

  • @swamp/gcp/run/services (with location: us-central1) ✓
  • @swamp/gcp/cloudbuild/connections (with location: us-central1) ✓
  • @swamp/gcp/artifactregistry/repositories (with location: us) ✓
  • @swamp/gcp/cloudkms/keyrings (with location: global) ✓

Environment

Sign in to post a ripple.