Skip to content

v0.9.11-beta: post-migration integrity check false negatives on Text defaults (::text echo) and pre-existing public-schema grants #60

@MelbourneDeveloper

Description

@MelbourneDeveloper

Repro

  • Run DataProviderMigrate migrate --schema migrations/schema.yaml --provider postgres --allow-destructive --output <DSN> --allow-destructive against a fresh Postgres (supabase/postgres:15.8.1.060) with NAP's migrations/schema.yaml.
  • Migration applies successfully ("Migration completed successfully").
  • Then SCHEMA INTEGRITY CHECK FAILED with:
public.tenant_credit_event.note: default expected '' but found ''::text
public.api_keys.label: default expected '' but found ''::text
public.agent_configs.system_prompt: default expected '' but found ''::text
public.agent_configs.agent_type: default expected 'disembodied' but found 'disembodied'::text
public.agent_configs.base_agent: default expected 'pydantic-ai' but found 'pydantic-ai'::text
public.agent_logs.level: default expected 'info' but found 'info'::text
public.tool_calls.status: default expected 'pending' but found 'pending'::text
grant Schema public: missing grant
grant AllTablesInSchema public: missing grant

Analysis

Two distinct regressions vs 0.9.10-beta:

  1. Text default cast normalization. Postgres echoes 'pending' as 'pending'::text in pg_attrdef / information_schema.columns.column_default. The integrity check is comparing the raw YAML literal ('pending') against Postgres's echoed form ('pending'::text) without normalizing the implicit cast. Either side should be normalized before the equality check.

  2. Schema / AllTablesInSchema grants false negative. schema.yaml declares:

    grants:
      - schema: public
        target: Schema
        privileges: [USAGE]
        roles: [app_user, app_admin]
      - schema: public
        target: AllTablesInSchema
        privileges: [SELECT, INSERT, UPDATE, DELETE]
        roles: [app_user, app_admin]

    These grants ARE applied to the DB (verified via \dn+ and \dp), but the integrity check reports them missing. The probe likely doesn't pick up AllTablesInSchema grants when they were applied via per-table GRANTs, or doesn't pick up the schema-level USAGE grant.

Impact

NAP CI is blocked. Pinning back to 0.9.10-beta (which has no integrity check on these dimensions) until this is resolved.

Environment

  • DP version: 0.9.11-beta
  • Postgres: supabase/postgres:15.8.1.060

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions