Skip to content

impl(fleet-hosted): service skeleton — Worker route modules, RP-token auth validation, tenancy mapping, health/capabilities #12583

Open

Description

@dezren39

Design: doc/2026-11-22T14-28-45Z_design_fleet-tool-workers-edition §3.1 (component C of epic #9078, design issue #9081). Parent: #9081.

Scope

Stand up the fleet-hosted service skeleton: one Cloudflare Worker with route modules for the component-C front doors (stamping, query, queue door, ingestion, sync), sharing one auth/tenancy/DB plumbing layer.

Acceptance

  • Worker deploys; health/capabilities answer with the hosted door's identity.
  • A request with a valid RP token resolves to a tenancy binding_id; invalid/absent tokens are refused on every non-public route.
  • A per-user Turso DB credential presented as service auth is refused (design §3.3.3).

Activity

  1. developing-today commented on Nov 22, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Picked up by felix — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while felix posts progress markers; after 30 minutes of silence any other worker may pick this up.)

  3. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: skeleton slice landed as PR #12822, unmerged for review
    by: agent felix (kind muse, Muse sandbox seat)
    at: 2026-11-22

    PR: #12822 — pkgs/fleet/hosted-worker, the fleet-hosted skeleton per design §3.1: one Worker, route modules for the stamping / query / queue / ingestion / sync doors over one shared plumbing layer (router pipeline: authenticate → caller-tenancy assertion → service-token route scope → handler).

    Real in this slice: RP-token validation (JWS vs provider JWKS via WebCrypto, iss/aud/exp/nbf; provider is configuration — #9077 is design-stage), the three §4.1 caller kinds (RP; #1253 agent role with lane/session claims required as the caller's ceiling; per-caller service tokens by SHA-256, scoped to named doors), tenancy mapping to the minted binding_id (never email/subject; unmapped or inactive fails closed), cross-tenant header assertions refused, per-user Turso credentials refused as data-plane credentials (§3.3 rule 3, own error code), and public /health + /capabilities mirroring the native fleet capabilities shape with the §2 hosted dispositions. Doors stub 501 naming their filling issues (#12585/#12587/#12589/#12590/#12591); session registry (#12584) and stamp signing (#12586) deliberately not absorbed.

    Evidence (full record on the PR): fail-before 0/4 test files on pristine main; 28/28 tests pass after; tsc clean; in-process smoke run answers the acceptance checks. Named seams: TenancyDirectory is an interface with a fixture implementation until component E's DB lands; /v1/ route paths are the skeleton's, final verb shapes belong to the filling issues.

    Not claimed from the acceptance: "Worker deploys" — verified locally only; production deployment is a later slice's step. The issue stays open for that leg and the live-provider integration.

  4. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Released by felix (outcome: done). Skeleton slice landed as PR #12822 (unmerged, for Felix's review): pkgs/fleet/hosted-worker — route modules for the five C doors over shared auth/tenancy plumbing; RP-token validation, tenancy binding_id mapping, cross-tenant + Turso-credential refusals, health/capabilities mirroring native shape. 28/28 tests pass, fail-before 0/4 on pristine main, tsc clean, smoke run green. Issue stays open for the production-deploy leg (later slice).

  5. added a commit that references this issue on Nov 23, 2026
  6. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: PR #12822 MERGED — the fleet-hosted service skeleton is on main
    by: agent felix (kind muse, Muse sandbox seat), reviewing and merging the lane's PR
    at: 2026-11-22

    Merged 2026-11-23T03:24:17Z. Felix's review read the security-critical code directly (src/jwt.ts, src/auth.ts): the RP validation is the standard shape done right — alg allowlist (RS256/ES256) with key-type binding so no algorithm confusion, kid required and resolved against the JWKS, signature verified before any claim is trusted, iss/aud/exp/nbf all enforced; tenancy comes only from the credential (a disagreeing client binding header is refused as cross-tenant); service tokens are looked up by SHA-256 and route-scoped; per-user Turso data-plane credentials are refused by shape with their own code, per §3.3 rule 3; unconfigured auth fails closed. Felix re-ran the suite independently: 28/28 pass.

    #12583 stays open for exactly the leg the lane did not claim: a production Worker deploy (local verification was the slice's evidence bar). The sibling slices (#12584 session registry next) now build on this skeleton.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions