Skip to content

feat(primitives): shared tables, read-only across patches #200

Closed

Description

@allisonmahmood

Part of #193. Implements the shared-table parts of spec §4 and §11; decisions Definition versus declaration, Open a patch and The tables surface §§ Read surface, Schema revision.

What to build

  • The manifest's uses sharedTable entries ({ alias, patchId, table, schemaRevision }, declared by patch id, never by name) are admitted. shared: true on a definition marks a table shared; marking is additive; unsharing (shared: false on a defined table) is allowed and reported with the count of declaring patches.
  • Publish resolves each declaration: the source patch exists in the same company, the publishing user can open it, and the table is shared, else patch_not_openable; a stamp behind the source's current revision is a warning.
  • shared.list, shared.get, shared.getMany in packages/api and the handler map: the read surface of tables.* over the source's indexes, no writes; resolved through the loaded version's manifest to the source's stable id; on every call the viewer must be able to open the source patch and the inventory's shared flag must be set, else the whole call is access_denied (never null-per-missing).
  • The catalog, generation and fixtures read a shared table's definition from the source's inventory (patchy.tables, columns, indexes), never its active manifest, so a table its source omitted stays readable by consumers and keeps its identity by source patch and table.
  • t.ref(uses.contacts) typing lands with ticket 10's builders; here the manifest carries a ref's target as the resolved id.

Admitted at merge

Manifests with sharedTable declarations and shared definitions.

Done when

  • A consumer reads a shared table through shared.* with the source's indexes; after the source unshares, the consumer's next call is access_denied and its own rows are untouched; a source deleted and recreated under the same name does not rebind; rollback of the source never changes sharing.
  • Publishing a consumer whose stamp is behind warns; one whose source is no longer shared refuses.
  • getMany on shared ids keeps order and returns null per dangling id while the source stays shared.

Surfaces

The wire, vocabulary (Shared table in Primitives; Declaration in Integrations covers shared tables), docs/product.md § Patches and other patches and § Primitives (shared tables).

Activity

  1. added
    ready-for-agent
    on Sep 10, 2026
  2. added a commit that references this issue on Sep 12, 2026
    333408e
  3. added a commit that references this issue on Sep 12, 2026
    8b03bc4
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

    ready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions