Skip to content

🤖 fix: make workspace resource versions reflect backend changes #109

Description

@ThomasK33

Problem

CoderWorkspace.metadata.resourceVersion is derived from Coder's Workspace.UpdatedAt in the converter. In an owned KIND deployment running Coder v2.37.2, workspace builds, rename, TTL changes, and autostart changes did not advance that timestamp. The exposed resourceVersion therefore did not identify those same-object changes.

This limits the value of resourceVersion-based change detection and DELETE preconditions. UID checks protect object identity, not changes to the same object. This behavior predates the DELETE-precondition work in #108; changing version derivation is a separate contract. The template case is different: a tested metadata update changed its exposed resourceVersion.

Evidence and limits

During #108's isolated HTTP dogfood, successful backend mutations retained the same workspace ID and updated_at value. A test requiring a new resourceVersion after a same-ID rename failed; that failed receipt is retained. A deliberately different resourceVersion produced HTTP 409 with the workspace intact, but that proves equality checking only, not detection of real workspace changes.

These are observations of the listed operations on v2.37.2. They do not establish that the timestamp never changes, that it is set only at creation, or that every Coder version behaves identically. No cross-tenant or production exploit is claimed.

Acceptance criteria

  1. Establish which supported Coder fields identify changes to the workspace representation. Cover build state, rename, TTL, and autostart; do not assume a latest-build timestamp covers them all.
  2. Define the resourceVersion contract and compatibility implications before implementation. Keep values opaque to clients. Do not claim that hashing fields creates a monotonically increasing version.
  3. Add failing converter/storage tests for real representation changes, stable unchanged reads, and delete/recreate identity changes. Choose the smallest version scheme supported by the evidence; avoid a new persistence subsystem unless separately justified.
  4. Verify real backend changes on the same workspace ID produce the expected versions through the aggregated API. Then prove an old-version DELETE returns 409 and leaves the current object intact. Exercise LIST, GET, updates, and watch behavior so version changes do not introduce regressions.
  5. Preserve UID identity protection, namespace isolation, and the documented non-atomic backend-delete boundary. Run repository gates and retain exact-SHA recorded KIND evidence with owned-resource cleanup.

Ownership and sequencing

Owner: maintainer desk. Follow #108's DELETE-options enforcement and #107's canonical leaf-name fix. Resolve this issue before claiming workspace resourceVersion protects against updates to the same object. It does not expand either current fix into a new versioning design.


Generated with xum • Model: coder:openai/gpt-6-astra • Thinking: xhigh

Activity

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