Repository navigation
fix(data): don't treat write-restricted tables as schema drift - #58
Merged
Merged
Conversation
The schema compatibility check required every advisory `_meta` inflection type (create/update/delete payloads, create input, patch) and every enum column in the create and patch inputs, whether or not the caller can perform that operation. PostGraphile generates neither a type for an operation the grants do not allow nor an input field for a column the caller may not write, so append-only tables and platform-owned columns (a storage files table's `status`) were reported as incompatible and the Sheets adapter refused the whole endpoint. Require the create/update/delete types only when `_meta.query` declares the operation, as `checkOperation` already does for the mutations, and accept an enum column that is absent from an input while still rejecting one present with another type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… rule Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review complete. No issues found — approved ✅. This PR makes
Two low-confidence residual concerns remain out-of-band: the missing-field early return also fires when Reviewed commit: 95030eb |
The upload op creates the files row before the bytes are sent. On a storage module without confirm-upload nothing ever settles that row, so a failed PUT left a file listed in the bucket whose download 404s. The upload seam now discovers the file type's delete-by-id mutation and removes the row it just created before rethrowing the PUT error. Deduplicated uploads are untouched. A PUT the browser cannot complete now reports STORAGE_UPLOAD_BLOCKED and names the bucket's allowed origins (CORS), the usual cause, instead of a generic network error.
The registry smoke install typechecks Sheets inside a fresh host, where `.catch(() => undefined)` fails TS7011. Swallow the cleanup error with a plain try/catch instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The schema compatibility check fails every database with a storage module, so the dashboard Storage page shows only
SCHEMA_INTROSPECTION_INCOMPATIBLE.Why
_metainflection is advisory: it names create/update/delete payload and patch types even for tables the caller cannot write. PostGraphile generates neither the types for an operation the grants do not allow, nor an input field for a column the caller may not write. Two shapes hit this today:data_room_file_eventsgrants INSERT/SELECT only, and_meta.query.update/.deleteare null. The check still reportsUpdateDataRoomFileEventPayload,DeleteDataRoomFileEventPayloadandDataRoomFileEventPatchmissing.data_room_files_chunkshas no UPDATE and fails the same way.filename/description/tags. The check reportsAppFilePatch.inputFields.statusandDataRoomFilePatch.inputFields.statusmissing.The Sheets adapter throws on any non-compatible result, so the whole page fails.
Fix
_meta.querydeclares that operation. This is the same rulecheckOperationalready applies to the mutations themselves.Trade-off: if a writable enum column disappears from an input, it is no longer reported, because
_metacarries no per-column privilege. GraphQL validation still rejects such a write.Before / after
Live tenants. I ran the dashboard's
@constructive-io/data@0.7.0and this branch's build against two local tenants, using each tenant's real_metaand introspection:0.7.0Drift detection is unchanged on this branch: removing
UpdateAppFilePayloadorAppFilePatch(a writable table) is still incompatible.Unit tests. There are 4 new tests. I swapped in the
mainsource to run them:mainand pass here: the append-only table, the enum column absent from the patch input, and the enum column absent from the create input._metadeclares the operations. It is a guard, not a reproduction.The 8 existing tests pass on both.
Suites on this branch:
packages/data157/157 andpackages/sheets369/369, after building@constructive-io/ui.tsc --noEmitpasses fordataandsheets.Not verified: the dashboard page with this build installed. The dashboard pins
@constructive-io/data@0.7.0and would need a release and a bump.🤖 Generated with Claude Code