Repository navigation
test(core): OutboxJobRecordSchema は、doc が null と書く claimedAt・completedAt・failedAt の null を通すことを縛る - #2102
Open
takecchi wants to merge 1 commit into
Open
test(core): OutboxJobRecordSchema は、doc が null と書く claimedAt・completedAt・failedAt の null を通すことを縛る#2102takecchi wants to merge 1 commit into
takecchi wants to merge 1 commit into
Conversation
…dAt・failedAt の null を通すことを縛る OutboxJobRecord の doc は、一度も claim されていなければ claimedAt が null、未完了なら completedAt が null、失敗していなければ failedAt が null と書いている。一方、既存の試験はこの3欄を省くか Date で埋めたジョブしか schema に通しておらず、どれかの nullable を外して null を断る実装にしても緑のままだった。 claimedBy・lastError の null は doc に言葉が無いので、ここでは縛らない。
takecchi
marked this pull request as ready for review
October 11, 2026 17:02
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.
**クローン(miku)の判断で当てた変異試験から出した PR で、オーナーの判断ではない。**マネージャー mgr-f7fec4fe が当てた。
なぜ
OutboxJobRecordの doc(packages/core/src/outbox.ts)は、次の3欄が null になる状態を書いている。claimedAt: 「一度も claim されていなければnull」completedAt: 「未完了ならnull」failedAt: 「失敗していなければnull」OutboxJobRecordSchemaは「値を実行時に検査するときに使う(型OutboxJobRecordと揃えてある)」とされている。しかし既存の試験は、この3欄を省くかDateで埋めたジョブしか schema に通していなかった。そのため、どれかの.nullable()を外して null を断る実装(やりすぎた実装)にしても、core の関係する試験(10ファイル66件)と型検査がすべて緑のままだった。satisfies z.ZodType<OutboxJobRecord>は出力の型が狭まることを許すので、型検査でも捕まらない。足した試験
packages/core/src/__tests__/outbox-job-record-schema-null-fields.test.ts。キューに積まれたまま・claim 済みで未完了・完了済みの3つの状態のジョブが、doc が null と書く欄を null にしたまま schema を通ることを見る。確かめたこと
claimedAtの.nullable()を外すcompletedAtの.nullable()を外すfailedAtの.nullable()を外すclaimedByの.nullable()を外す(対照。縛らない形)縛らなかったもの
claimedBy・lastErrorの null は、型にはあるが doc に言葉が無い。縛ると約束を足すことになるので、この PR には入れていない。オーナーに決めてほしいこととして、別の Issue にまとめる。