Skip to content

🤖 fix: clarify event-only watch options after Kubernetes defaulting #112

Description

@ThomasK33

Problem

An event-only workspace watch with no resourceVersion is rejected by the deployed aggregated API. Kubernetes first defaults it into an initial-events request, which this storage intentionally does not implement. Clients need a documented way to request the supported local event stream.

During #109 validation on an owned KIND deployment, this request failed:

GET /apis/aggregation.coder.com/v1alpha1/namespaces/coder/coderworkspaces?watch=true&fieldSelector=metadata.name=<canonical-name>
HTTP/1.1 400 Bad Request

The Status body reported reason: BadRequest and:

invalid watch options: sendInitialEvents=true is not supported for this watch endpoint

In the same run, a watch with resourceVersion=12345&timeoutSeconds=2 returned HTTP 200. A focused matrix for absent/zero/current-token RV and explicit sendInitialEvents=false is planned; the latter cases are not yet runtime-verified.

Mechanism and evidence boundaries

  1. vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/defaults.go:25-38 injects sendInitialEvents=true and resourceVersionMatch=NotOlderThan when WatchList is enabled, RV is empty or 0, and neither option was supplied.
  2. vendor/k8s.io/apiserver/pkg/endpoints/handlers/get.go applies that defaulting before storage dispatch.
  3. internal/aggregated/storage/watch.go:44-59 rejects initial events and RV matching. Both workspace and template storage call this validator. TestWatchRejectsDefaultedLegacyWatchListOptions explicitly expects this rejection; it is not evidence of an accidentally missing exception.
  4. These files, the tests, and the vendored feature definitions are unchanged between 🤖 fix: make workspace resource versions reflect backend changes #109's candidate and its base 2fcd31d42a345a80841e2f5133ee8f796388da78. This establishes unchanged relevant source, not a separate live reproduction on the base.
  5. The workspace endpoint was observed directly. Template HTTP behavior still needs coverage. The preliminary harness audit missed the defaulting stage; its prediction that the unqualified request would reach streaming HTTP 200 was incorrect.

Acceptance criteria

  1. Test requests through generic option decoding/defaulting/validation, not only direct storage calls. Cover absent RV, 0, a nonzero opaque RV, explicit sendInitialEvents=false, explicit initial events, and RV matching for both resources.
  2. Document the exact supported event-only request form and the difference between option acceptance and storage ignoring an accepted RV. Keep the no-replay/no-out-of-band-event limitations explicit.
  3. Preserve honest initial-event semantics. Do not silently accept sendInitialEvents=true while omitting the promised initial events. Any expansion of watch behavior needs a separate design decision.
  4. Keep 🤖 fix: make workspace resource versions reflect backend changes #109's new watch explanation accurate before its publication. A new versioning change must not imply every watch query is accepted.
  5. Run the applicable test/docs gates and record HTTP evidence, screenshot/video, and exact owned-resource cleanup for any implementation.

Ownership and sequencing

Owner: maintainer desk. Track the compatibility/documentation work separately from #109's representation fingerprint. The fourth full #109 run remains failed, and full-suite relaunches for that validation tranche are stopped. Only separately authorized, bounded diagnostics and the missing acceptance scenarios may use the retained owned fixture; this issue does not authorize retries or a watch redesign.


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