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

Aperta
#60 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
csharp, postgresql
Ambito
databases

Direzione di ricerca

Start by running the reported DataProviderMigrate command against supabase/postgres:15.8.1.060 and inspect the schema integrity check for default comparisons and grant probing. Done means the check accepts PostgreSQL's implicit ::text default casts and recognizes the declared public Schema and AllTablesInSchema grants without false negatives.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
C#
Stelle
68
Fork
4
Merge medio
50m
PR unite (30g)
2

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Nimblesite/DataProvider

Tutte le issue di Nimblesite/DataProvider

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.