Skip to content

feat(primitives): authorised file handles: minting on metadata, redemption, url/download/useFileUrl #408

Closed

Description

@allisonmahmood

Part of #384. Implements spec §10's handles; decisions composition points 3–7, the reference CRM (redemption order, the cut-off line), limits (handle size).

What to build

  • Minting: every entry from ctx.files.<store>.list, ctx.shared.<alias>.list and stat(name) carries handle, host-minted, 57 characters, fixed-length, no filename, no clock. It is bound to viewer, company, consuming patch, loaded version, source store and exact object, and deterministic for that tuple, so unchanged-result suppression holds. t.fileHandle() in results only. Handles minted inside ctx.run results carry the same binding. Handle bytes count against the existing result and page bounds.
  • Redemption through the shell: the MAC first, then the pointer (not_found when the name no longer points at that object), then access (access_denied). When a replace and an access loss coincide the answer is not_found. Every redemption is re-authorised live, broker byte-cache hits included. Possessing a handle never authenticates anyone; redemption needs the viewer's signed-in shell. Redemptions are reads and are not logged.
  • The page: patchy.files.url(handle) returns a frame-local blob URL, never a redeemable HTTP URL; patchy.files.download(handle, filename?); useFileUrl(handle) in patchy/preact returns { url, error }, drops a stale image on failure and releases the URL on unmount. Tier 1 keeps name-based url(name) and download(name).
  • The skill (patchy-files and patchy-server): what the page sees is what handlers return; a handle freezes that selection until the query re-runs; filtering by viewer is the patch's code; "to cut off a file when a record narrows (private, handed over, deleted), re-put or delete it; handles already selected keep redeeming until then."

Admitted at merge

Tier 2 pages show and download files.

Done when

A handle used by another viewer or pasted into another patch is refused; a replaced file's old handle is not_found and the re-run delivers the new one; an unshared store's handle is access_denied; a cached image is re-authorised on redemption.

Surfaces

The wire (docs/API.md), the Primitives glossary (Authorised file handle, The patch's filter), docs/product.md § Files, the skills.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:primitivesready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions