Skip to content

feat(metaschema-modules): add events_module.record_error - #126

Merged
pyramation merged 1 commit into
mainfrom
feat/events-record-error
Sep 6, 2026
Merged

feat(metaschema-modules): add events_module.record_error#126
pyramation merged 1 commit into
mainfrom
feat/events-record-error

Conversation

@pyramation

Copy link
Copy Markdown
Contributor

Summary

Upstreams the metaschema-modules half of constructive-io/constructive-db#3683 so it can be published: events_module gains the discovery column beside record_event.

ALTER TABLE metaschema_modules_public.events_module
  ADD COLUMN record_error text NOT NULL DEFAULT '';

record_error names the tenant's generated private function that records a refused operation under its error code as the event name (event_types row category = 'error', feeds_levels = false), so a trust ladder's revoked_by names the code directly (e.g. PRINCIPAL_CHILD_WIDENS) instead of a transport-shaped graphql.error {code, operation} payload. The graphql-server side reads this column to build the call (constructive-io/constructive#1810), so it is blocked on a publish of this package.

Copied verbatim from the merged constructive-db change (deploy/revert/verify triple + plan entry), with version numbering left to this repo's lerna version; sql/metaschema-modules--0.44.0.{sql,bundle.tar.gz} regenerated with pgpm package (pgpm 5.18.0, the CI version).

packages/metaschema-modules jest suite passes locally against constructiveio/postgres-plus:18.

Design: constructive-io/constructive-planning#1986

Link to Devin session: https://app.devin.ai/sessions/835118130e99423c9344bb04415a7398
Open in Devin Desktop: https://app.devin.ai/desktop/session/835118130e99423c9344bb04415a7398?variant=devin
Requested by: @pyramation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@tenki-reviewer

tenki-reviewer Bot commented Sep 6, 2026

Copy link
Copy Markdown

Review complete. 🟡 1 medium

💬 Inline comments (1)


This PR adds a new record_error column to the events module table through a pgpm change triple (deploy/verify/revert) and updates the generated bundle and plan.

Files Change
deploy/.../add_record_error.sql, verify/.../add_record_error.sql, revert/.../add_record_error.sql Adds a record_error column with a default, verifies it, and reverts it symmetrically.
pgpm.plan Registers the new add_record_error change.
sql/metaschema-modules--0.44.0.sql Appends the ALTER TABLE to the generated bundle.

The main concern is that the generated sql/ bundle was hand-edited rather than regenerated via pgpm package, which AGENTS.md forbids and can break byte-reproducibility.

Reviewed commit: da4106b

@pyramation
pyramation merged commit 9f5d6f4 into main Sep 6, 2026
30 checks passed
@pyramation
pyramation deleted the feat/events-record-error branch September 6, 2026 19:36

@tenki-reviewer tenki-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds a record_error column to the events_module table via a new deploy/verify/revert triple, with the generated SQL bundle updated.

Key findings

Comment on lines +6562 to +6565
ALTER TABLE metaschema_modules_public.events_module
ADD COLUMN record_error text
NOT NULL
DEFAULT ''; No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 bug · medium

Hand-edit generated SQL bundle artifact

The generated bundle packages/metaschema-modules/sql/metaschema-modules--0.44.0.sql was hand-edited to append the ALTER TABLE ... ADD COLUMN record_error statement (packages/metaschema-modules/sql/metaschema-modules--0.44.0.sql:6562), but AGENTS.md requires this artifact to be regenerated via pgpm package and never edited by hand. Hand-editing breaks the byte-reproducibility guarantee and can leave the committed bundle diverging from what deploy/ + pgpm.plan would produce, causing deploy inconsistencies.

📋 Prompt for AI Agents

In packages/metaschema-modules/sql/metaschema-modules--0.44.0.sql, delete lines 6562-6565 (the hand-appended ALTER TABLE ... ADD COLUMN record_error block). Then run pgpm package in the metaschema-modules directory so the bundle artifact is regenerated from deploy/ and pgpm.plan, and commit the regenerated artifact together with the deploy change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant