Skip to content

targets: version the build_number context field; revalidate watched targets before prebuild (#421 follow-up) #424

Closed

Description

@apotema

Codex findings on #421's last pass (cad4979), after that PR used its three review-fix rounds (provider targets, now on development).

  • src/cli/provider_contract.zig:38: Version the new build-number context field When bundle --build-number invokes a provider built against the existing 1.0.0 wire contract, the CLI now emits build_number while still advertising contract_version: "1.0.0". The v1 contract requires unknown fields to be rejected, and the previous Context decoder does exactly that, so already-published bundle hooks can fail parsing instead of packaging. Introduce a negotiated contract version for this field, or otherwise preserve compatibility with strict 1.0.0 consumers.
  • src/cli/pipeline.zig:645: Revalidate watched targets before running prebuild steps When a wasm serve --watch edit removes or unpins the target owner, this new check is reached through rebuildStaged only after that function has already run the startup .prebuild commands. Thus an invalid target configuration can still execute arbitrary side-effecting prebuild work once before the rebuild is refused. Fresh evidence beyond the earlier ownership finding is the current ordering: prebuild.runAll is at lines 168–171, while this confirmTarget call runs later during replan; perform the re-read and ownership check before prebuild execution.

The first matters for the contract: a new optional field under an unchanged contract_version: "1.0.0" breaks v1 providers that reject unknown fields. Either bump the minor contract version and gate emission on the provider's declared range, or make v1 decoders ignore unknown optional fields and document it. Part of #406.

https://claude.ai/code/session_01R2K5sJDL5Msn1uRTkybiDP

Activity

  1. apotema commented on Sep 26, 2026

    @apotema
    ContributorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions