0.9.11-beta: SchemaIntegrityVerifier false positives on Schema/AllTablesInSchema grants + text column ::text default

Abierto
#61 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
csharp, postgresql
Área
databases

Línea de trabajo

Start at SchemaIntegrityVerifier and its InspectSchemaGrants entry point, using the documented dotnet DataProviderMigrate command and PostgreSQL queries to reproduce both false positives. Review scripts/migrate_schema.py for the current workaround. Done means Schema and AllTablesInSchema grants are recognised, text defaults compare consistently, and repeated migrations converge without integrity failures.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Repro

YAML schema with:

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]

Run dotnet DataProviderMigrate --schema schema.yaml --output "<postgres-dsn>" --provider postgres.

Expected

Migration converges. SchemaIntegrityVerifier reports clean.

Actual

Migration completed successfully
SCHEMA INTEGRITY CHECK FAILED
grant Schema public: missing grant
grant AllTablesInSchema public: missing grant

Exit code 1. Re-running is non-converging — the verifier reports the same missing grants on every run.

Verification that the grants are actually applied

-- Schema USAGE: explicit grant present in nspacl
SELECT nspname, nspacl FROM pg_namespace WHERE nspname='public';
--  public | {... app_user=U/pg_database_owner, app_admin=U/pg_database_owner}

-- has_schema_privilege() returns true
SELECT has_schema_privilege('app_user',  'public', 'USAGE');  -- t
SELECT has_schema_privilege('app_admin', 'public', 'USAGE'); -- t

-- Table grants: every public table shows arwd in relacl for both roles
SELECT relname, relacl
  FROM pg_class
 WHERE relnamespace='public'::regnamespace AND relkind='r' LIMIT 1;
--  users | {... app_user=arwd/postgres, app_admin=arwd/postgres}

So the migrate step applies the grants correctly. The verifier's InspectSchemaGrants simply doesn't recognise the applied state.

Side issue (also new in 0.9.11): text column defaults

defaultValue: "'generating'" in YAML round-trips to 'generating'::text in information_schema.columns.column_default (Postgres normalises text literals). The verifier reports:

public.sites.status: default expected 'generating' but found 'generating'::text

Workaround: spell the YAML as defaultValue: "'generating'::text". The verifier should ideally strip the ::text cast (or apply the same normalisation to both sides) before comparing.

Environment

  • DataProviderMigrate 0.9.11-beta
  • Postgres 16 (Supabase docker stack)
  • Same YAML migrates cleanly under 0.9.10-beta (the verifier step appears to be new in 0.9.11).

Workaround we're shipping

Until this lands we invoke dotnet DataProviderMigrate via a Python wrapper that swallows exactly the two known false-positive lines after asserting Migration completed successfully is in stdout — see scripts/migrate_schema.py. Happy to delete the wrapper once the verifier is fixed.

Lenguaje dominante
C#
Estrellas
68
Forks
4
Merge medio
50 min
PR fusionados (30 d)
2

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Nimblesite/DataProvider

Todos los issues de Nimblesite/DataProvider

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.