Skip to content

feat(pull): implement Init orchestration and command handler #448

Description

@scottescue

Outcome

Implement the PullOptions.Init branch and its injected command-handler path without introducing a second public Pull API.

Context

The public contract is Pull(ctx, PullOptions{Init: bool}). Initialization reuses the source and initial-artifact plan from plain Pull, then adds a database lock, a fresh stable-snapshot comparison, and history recording without executing bootstrap SQL.

In scope

  • Provide an internal, testable initialization orchestrator used when PullOptions.Init is true.
  • Acquire the migration lock and validate empty history plus dialect-specific quiescence.
  • Re-introspect under the stable-state window and compare with the exact managed bootstrap artifact.
  • Record that artifact as applied without executing its SQL.
  • Return the ratified PullResult initialization fields and stable diagnostics through the shared Pull handler.

Out of scope

  • A separate exported PullInit function or independent result contract.
  • Reimplementing normal Pull introspection, rendering, or initial-artifact planning.
  • Exposing final CLI registration.

Acceptance criteria

  • Init: true refuses non-empty history, incompatible local artifacts, or non-quiescent state before history mutation.
  • The exact validated bootstrap artifact is recorded as applied without executing its SQL.
  • Lock acquisition, stable comparison, history insertion, rollback, release, and cleanup have deterministic error precedence.
  • Failure leaves no invalid or discoverable partial output; valid managed source or a valid bootstrap artifact may remain and be safely reused exactly as the specification permits.
  • PostgreSQL, MySQL, and SQLite capability paths are covered wherever initialization is supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:pullIntrospection and source generation (grizzle pull)priority:highHigh: must ship within the current milestone

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions