Skip to content

Refuse a data copy the target can't hold before restoring (S-007-6..11) #125

Closed

Description

@shipmill-romamo

Builds part of spec S-007, docs/specs/007-data-copy-schemas.md (feature issue #82): the acceptance criteria below. Each needs a test that names its id (test_s007_<k>_..., or a proves: S-007-6 comment line).

This is the data copy preflight (missing schemas, extensions, roles, auth. references) and a restore that leaves no partial target. The flag is --source-schema (MCP source_schema), on the maintainer's answer on #134.

  • S-007-6: --source-schema missing for a schema the source lacks exits PRECONDITION with code data_copy_preflight_refused and missingSchemas of ["missing"], and no dump file is written
  • S-007-7: A selected table using a type from an extension that is not in the target's pg_available_extensions exits PRECONDITION with code data_copy_preflight_refused naming that extension under extensions, the target holds no new table, and no receipt is written
  • S-007-8: A policy TO anon, authenticated on a selected table, with neither role on the target, exits PRECONDITION with code data_copy_preflight_refused and roles of ["anon", "authenticated"]
  • S-007-9: With --source-schema public, a function public.current_tenant() whose body calls auth.uid() and a policy on public.notes whose USING calls auth.uid() are both named under authReferences, and the copy is refused
  • S-007-10: A source with a missing extension, a missing role, and an auth. reference at once is refused with all three named in one answer
  • S-007-11: A restore that fails after the preflight passes exits ENGINE_STEP_FAILED, leaves no table in the selected schemas of the target, writes no receipt, and a second run against the same target passes the empty-target check

Depends on #124

Activity

  1. shipmill-romamo commented on Oct 27, 2026

    @shipmill-romamo
    ContributorAuthor

    Triage: implement, for the next release candidate.

    The plan: build the criteria listed in the body, as docs/specs/007-data-copy-schemas.md (S-007, approved in #103) says, each with a test that names its id. A departure from a criterion goes back as a question, never a quiet change. Build issues start in order: this one starts once every issue on its Depends on lines has closed. I'll link the PR here.

  2. shipmill-romamo commented on Oct 30, 2026

    @shipmill-romamo
    ContributorAuthor

    Triage: implement, now that #124 merged in #134. The flag is --source-schema (MCP source_schema) on @romamo's answer on #134, and the body and spec 007 say so (#157). Since #134, schema names are a PostgresSchemaName (non-empty, at most 63 bytes, no control character or brace); S-007-12 tightens it to the spec's ^[a-z_][a-z0-9_]*$ and refuses a repeated name, which #134 still de-duplicates. S-007-6 also covers a gap #134 left: a named schema missing from the source is skipped while the receipt lists it. An implementer is on it.

  3. added a commit that references this issue on Oct 30, 2026
    745c129
  4. shipmill-romamo commented on Oct 30, 2026

    @shipmill-romamo
    ContributorAuthor

    Released in v0.8.0rc11 (pre-release).
    A plain install gets it with the next stable release.
    If you filed this: react 👍 on this comment once it works for you, or reply if it doesn't.

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions