Repository navigation
fix: release gate, packaging, dual-build instanceof, Mongo primary reads and Postgres upgrade error - #100
Merged
Conversation
tsconfig.cjs.json inherited incremental builds with outDir dist/cjs, so tsc wrote its 532 kB tsconfig.cjs.tsbuildinfo into dist/ and every npm tarball shipped it. Write it next to tsconfig.cjs.json instead, where the clean script and .gitignore already expect it.
The release workflow published to npm without running anything, so a red main could ship. It now calls the test workflow and only versions or publishes once that passes; write and OIDC permissions are scoped to the release job, and the test workflow runs with read-only contents. The README says the Redis store is tested against Valkey 8, but CI only ran Redis 8; run the Redis store tests against Valkey too. Also typecheck examples/pg, which nothing checked.
…before 0.6 migrate() creates missing tables but doesn't add columns, so upgrading from 0.5 without the documented ALTER TABLE failed every publish and claim with a bare 'column "defer_until" does not exist'. Name the table, the column and the statement to run, and point at MIGRATING.md.
…checks When the ESM and CommonJS builds both load in one process, each has its own error classes. A handler throwing the CommonJS ErrorUnprocessableEventHandler into an ESM processor was retried until maxAttempts instead of being dead-lettered at once, and a TxOBError's backoffUntil was ignored. Brand the classes with registered symbols so instanceof matches instances from either copy.
The collections inherited the client's read preference, so with secondaryPreferred the claim's counts and its read-back of leased deliveries could hit a lagging secondary: per-key and handler limits could be exceeded and claimed deliveries could be missing from the result until their lease expired.
… Redis keys - publish type-checks with a pool, Prisma's root client or a MongoDB session outside a transaction; say plainly what happens then. - A handler that ignores its timeout signal keeps its lease and slot until the process exits. - Fan-out is idempotent rather than fenced by the lease token. - Each Redis claim walks every key at its per-key limit; give measured numbers. - Point the README banner at the 0.6 column migration and fix the types badge link.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #100 +/- ##
=======================================
Coverage 96.04% 96.04%
=======================================
Files 34 34
Lines 2478 2504 +26
Branches 497 504 +7
=======================================
+ Hits 2380 2405 +25
- Misses 81 82 +1
Partials 17 17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merged
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.
What was wrong, and what changed
Each item is its own commit.
release.ymlranchangeset publishwithout typecheck, build or tests, so a redmaincould ship. Write and OIDC permissions were workflow-wide.coverage.ymlhad nopermissions.coverage.ymlgainsworkflow_callandpermissions: contents: read.release.ymlhas atestjob (uses: ./.github/workflows/coverage.yml,secrets: inherit, read-only), andreleaseneeds: test. Write/OIDC permissions move to the release job; the workflow level is{}.valkey/valkey:8-alpineon 6380 and re-runstest/redis.test.tsagainst it.examples/pgwas never typechecked.pnpm --filter ./examples/pg typecheck.incrementalwithoutDir dist/cjs, so every tarball shippeddist/tsconfig.cjs.tsbuildinfo(532 kB of 1.5 MB).tsBuildInfoFile: ./tsconfig.cjs.tsbuildinfo, which is already gitignored and removed byclean..DS_Storewas tracked;repository.urlusedgit://; the types badge linked to a nonexistentsrc/cache.ts.git+https://; the badge links tosrc/index.ts.ErrorUnprocessableEventHandlerthrown into an ESM processor failedinstanceof. It was retried tomaxAttemptsinstead of dead-lettered, and aTxOBError'sbackoffUntilwas ignored. Repro againstdist/: 3 handler calls, dead after 3 attempts.Symbol.for("txob.<Name>")brand on its prototype and aSymbol.hasInstancethat checks it. Subclasses keep the defaultinstanceof. After: 1 call, dead immediately.secondaryPreferredon the client makescollection.readPreference.mode === "secondaryPreferred"). Claims count leased deliveries and read back what they just leased, so a lagging secondary could break limits or drop claimed deliveries until their lease expired.client.db(name, { readPreference: "primary" })for txob's collections. Read concern is unchanged: forcingmajoritycould hide the claim's own writes underw: 1.column "defer_until" does not exist.insertEvent,claimEventsForFanoutandclaimDeliveriesrethrow, withcause, as:"txob_events" has no defer_until column. txob 0.6 added it, and migrate() doesn't add columns to existing tables; run ALTER TABLE ... ADD COLUMN IF NOT EXISTS defer_until TIMESTAMPTZ (see MIGRATING.md). The README banner now points at the 0.6 migration too.publishtype-checks with a pool, Prisma's root client, or a Mongo session outside a transaction. The event is then committed on its own.publish. A runtime guard isn't reliable. A pool is the documented way to publish a standalone event. Prisma's root client andtxare structurally the same. Mongo'ssession.inTransaction()is detectable, but sessions are also used for causal consistency without a transaction, and rejecting them would break code that works today.completeFanout.lua-time-limitaround 1M keys. It is real but needs a data-structure change (e.g. a separate set of saturated keys), so this PR only documents it, with the numbers.Compatibility
instanceofis now true for instances from the other build, which is the point.release.yml: a release now waits for the full suite (about 4 minutes) and doesn't run if it fails. A Codecov upload failure doesn't fail the run (fail_ci_if_erroris unset), so it can't block a release.patch.How it was tested
Real backends in temporary containers: Postgres 17, MongoDB 9 replica set, Redis 8, Valkey 8, DynamoDB Local.
pnpm install --frozen-lockfile,pnpm test:prepare,pnpm typecheck,pnpm build,pnpm --filter ./examples/pg typecheck: pass.test/redis.test.tsagainst Valkey 8 (ioredis, node-redis, iovalkey): 109/109.src/change reverted:src/error.test.ts: errors from a second module instance (./error.js?copy) passinstanceof; subclasses keep normal semantics.test/mongodb.test.ts: all txob collections read from the primary when the client issecondaryPreferred.test/pg.test.ts: withdefer_untildropped, publish, fan-out claim and delivery claim all throw the explanatory error.pnpm pack --dry-run: notsbuildinfo; 308 files, 0.98 MB unpacked (was 309 files, 1.50 MB).actionlint: only the two existing warnings (actions/checkout@v2,codecov/codecov-action@v2).dist/: 3 handler calls before, 1 after.For the reviewer to decide
inTransaction()check could be added as opt-in if you want it.Left out, with reasons
checkout@v2,codecov@v2, Dependabot: these are dependency/action upgrades, which the brief excludes.src/date.tsdead code, tag scheme, CHANGELOG 0.6p-limitwording, MIGRATING 0.5 "Node 20.3+": historical text or harmless; editing released notes isn't worth the churn.src/: fixing that means shippingsrc/or inlining sources, which is a packaging choice for you.