Skip to content

test(nextly): the outbox lock suite registers its seeded collection, as a builder save does - #1813

Merged
mobeenabdullah merged 1 commit into
mainfrom
fix/outbox-lock-test-registers-its-collection
Sep 11, 2026
Merged

mobeenabdullah merged 1 commit into
mainfrom
fix/outbox-lock-test-registers-its-collection

Conversation

@mobeenabdullah

Copy link
Copy Markdown
Collaborator

What

Repairs main's Integration (postgres) and Integration (mysql), both failing at outbox-preimage-lock.integration.test.ts › serializes concurrent updates so neither event claims the other's field with expected [] to have a length of 2.

Ledger: finding:outbox-lock-suite-never-registered-its-collection.

What was true

The suite boots once, seeds its collection straight into the database with seedBuilderCollection, and writes through the handler. Both updates answer 500 — Table "dc_locktestposts" not found in schema registry, so no entry.updated event is written and the assertion sees none. The suite never asserts the updates' own results, so the failure presented as a missing event rather than a refused write.

Saving a collection in the Builder registers its new table with the schema resolver as part of the save (collection-metadata-service calls registerDynamicSchema). Seeding into the database does not, and seed-builder-entity's own docblock says to boot again afterwards — which the other two-phase suites (collection-mutation-service.m2m-atomicity, write-path-relations-tx-visibility, …) do and this one did not. Reads were unaffected because the read path builds its own runtime table; the ORM write path had nothing to resolve.

It surfaced now for two reasons: the legs are dialect-gated, so only pg/mysql run it, and my #1787 moved the transactional update onto the resolver — the raw statement it replaced quoted the table name itself, so an unregistered table had gone unnoticed here. The adapter's transactional delete has always required the resolver, so the same suite would have failed had it deleted.

How

After seeding, clearServices() and boot again over the same adapter — the documented pattern, three lines.

Verification

  • The suite self-skips without a dialect URL, so CI's Integration (postgres) and (mysql) are the oracle — read them by name on this head. No Docker here.
  • The mechanism is verified on SQLite, in a scratch probe running the same sequence (deleted; git status clean): without the second boot both updates answer that 500, nextly_events holds only entry.created, and getEntry/listEntries still succeed — the asymmetry above, measured. With it, both updates succeed and exactly two entry.updated events appear, changedFields ["alpha","updatedAt"] and ["beta","updatedAt"] — which also satisfies the property the suite exists for (neither event carries the other's field).
  • Gates: nextly lint 0, check-types 0, webhooks integration on SQLite 204 passed / 8 skipped.

No changeset: test-only.

…as a builder save does

main's Integration (postgres) and (mysql) fail here: both updates answer 500,
'Table "dc_locktestposts" not found in schema registry', so no entry.updated
event is written and the assertion sees none. The suite never asserted the
updates' own results, so the cause read as a missing event.

The collection is seeded straight into the database, and only a Builder save
registers a new table with the schema resolver (collection-metadata-service
does it as it saves). Reads build their own table and worked; the ORM write
path had nothing to resolve. Booting again over the same adapter after seeding
is what seed-builder-entity documents and what the other two-phase suites do.

Visible only on those legs because the suite is dialect-gated, and it surfaced
now because #1787 moved the transactional update onto the resolver - the raw
statement it replaced quoted the table name itself. Verified on SQLite through
the same sequence in a scratch probe: without the second boot both updates
answer that 500 and no entry.updated is recorded; with it, both succeed and
exactly two events appear, changedFields [alpha, updatedAt] and [beta,
updatedAt].
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-11T22:54:20.479500Z f611838 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added the scope: core nextly label Sep 11, 2026
@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 53 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: bb446888-a7a1-45e7-8b9c-dbd744915569

📥 Commits

Reviewing files that changed from the base of the PR and between a5bf4d1 and f611838.

📒 Files selected for processing (1)
  • packages/nextly/src/domains/webhooks/__tests__/outbox-preimage-lock.integration.test.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mobeenabdullah

Copy link
Copy Markdown
Collaborator Author

@codex review

@github-actions

Copy link
Copy Markdown
Contributor

Whole-Repository Code Hygiene Summary

Full dead-code, duplication, and complexity report for the PR branch as it stands now. Playground is excluded. Quality gate enforcement on introduced issues is performed by the Changed files job.

🌿 Fallow

Warning

Review needed

⚠️ 73 code issues · ⚠️ 685 clone groups · ⚠️ 1031 health findings

See inline review comments for per-finding details.

Code issues (73)
Category Count
Unused files 2
Unused exports 5
Unused dependencies 19
Unused devDependencies 6
Unresolved imports 2
Unlisted dependencies 1
Circular dependencies 38
Duplication (685 groups · 28738 lines · 4.1%)
Locations Lines Tokens
schemas/_dialect-bundles/mysql.relations.ts:40-134
schemas/_dialect-bundles/postgres.relations.ts:40-134
schemas/_dialect-bundles/sqlite.relations.ts:40-134
95 593
cli/commands/db-sync-demote.ts:70-75
cli/commands/db-sync-promote.ts:38-43
cli/commands/dev-build.ts:100-105
cli/commands/dev-build.ts:179-184
cli/commands/dev-build.ts:299-304
cli/commands/dev-build.ts:411-416
cli/commands/dev-build.ts:552-557
cli/commands/dev-server.ts:575-580
cli/commands/dev-server.ts:840-845
cli/commands/dev-server.ts:1143-1148
cli/commands/migrate-field-groups.ts:110-115
6 70
entries/EntryList/EntryTableSkeleton.tsx:74-98
collection/components/CollectionTableSkeleton.tsx:94-118
field-group/components/FieldGroupTableSkeleton.tsx:90-114
plugins/components/PluginsTableSkeleton.tsx:86-110
singles/components/SinglesTableSkeleton.tsx:77-101
src/components/table-skeleton.tsx:100-124
25 89
collections/config/validate-config.ts:380-433
field-groups/config/validate-field-group.ts:185-238
singles/config/validate-single.ts:190-243
54 152
dispatcher/handlers/collection-dispatcher.ts:925-967
field-groups/services/field-group-table-provisioning.ts:186-236
singles/services/reconcile-single-companion.ts:110-160
51 149

… and 680 more groups.

Across 422 files.

Complexity (1031 functions above threshold)
File Function Severity Cyclomatic Cognitive CRAP Lines
singles/services/single-mutation-service.ts:937 <arrow> critical 245 ! 307 ! 13210.4 ! 1588
collections/services/collection-mutation-service.ts:6110 <arrow> critical 169 ! 160 ! 6338.2 ! 1261
src/init/reload-config.ts:1319 applyReload critical 144 ! 228 ! 4623 ! 1433
shared/lib/entry-validation.ts:223 validateFieldValue critical 109 ! 157 ! 2675.3 ! 432
blocks-engine/src/measure-bytes.ts:646 surveyDocument critical 102 ! 250 ! 137.1 ! 658

5016 files, 76705 functions analyzed (thresholds: cyclomatic > 20, cognitive > 15, CRAP >= 30)

Codebase health

Metric Value
Maintainability 91.7 / 100
Avg complexity 1.8

Tip

Run fallow fix --dry-run to preview auto-fixes.
Add /** @public */ above exports to preserve them.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: f61183826e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@pkg-pr-new

pkg-pr-new Bot commented Sep 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

@nextlyhq/adapter-drizzle

npm i https://pkg.pr.new/@nextlyhq/adapter-drizzle@f611838

@nextlyhq/adapter-mysql

npm i https://pkg.pr.new/@nextlyhq/adapter-mysql@f611838

@nextlyhq/adapter-postgres

npm i https://pkg.pr.new/@nextlyhq/adapter-postgres@f611838

@nextlyhq/adapter-sqlite

npm i https://pkg.pr.new/@nextlyhq/adapter-sqlite@f611838

@nextlyhq/admin

npm i https://pkg.pr.new/@nextlyhq/admin@f611838

@nextlyhq/admin-css

npm i https://pkg.pr.new/@nextlyhq/admin-css@f611838

@nextlyhq/blocks-engine

npm i https://pkg.pr.new/@nextlyhq/blocks-engine@f611838

@nextlyhq/blocks-react

npm i https://pkg.pr.new/@nextlyhq/blocks-react@f611838

@nextlyhq/builder

npm i https://pkg.pr.new/@nextlyhq/builder@f611838

create-nextly-app

npm i https://pkg.pr.new/create-nextly-app@f611838

@nextlyhq/eslint-plugin

npm i https://pkg.pr.new/@nextlyhq/eslint-plugin@f611838

nextly

npm i https://pkg.pr.new/nextly@f611838

@nextlyhq/plugin-form-builder

npm i https://pkg.pr.new/@nextlyhq/plugin-form-builder@f611838

@nextlyhq/plugin-page-builder

npm i https://pkg.pr.new/@nextlyhq/plugin-page-builder@f611838

@nextlyhq/plugin-sdk

npm i https://pkg.pr.new/@nextlyhq/plugin-sdk@f611838

@nextlyhq/plugin-seo

npm i https://pkg.pr.new/@nextlyhq/plugin-seo@f611838

@nextlyhq/storage-s3

npm i https://pkg.pr.new/@nextlyhq/storage-s3@f611838

@nextlyhq/storage-uploadthing

npm i https://pkg.pr.new/@nextlyhq/storage-uploadthing@f611838

@nextlyhq/storage-vercel-blob

npm i https://pkg.pr.new/@nextlyhq/storage-vercel-blob@f611838

@nextlyhq/ui

npm i https://pkg.pr.new/@nextlyhq/ui@f611838

commit: f611838

@mobeenabdullah

Copy link
Copy Markdown
Collaborator Author

Lint / Typecheck / Test / Build (and so the blocking CI gate) fails here at step 19, Doc samples compile — main's own red since the first completed run after #1769, not this change. #1810 fixes it and is green on that job; merging it first clears this one. The oracle for this PR is Integration (postgres) and Integration (mysql), read by name.

@mobeenabdullah
mobeenabdullah merged commit 7d1be1c into main Sep 11, 2026
24 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant