MotirBuilding in public
MOTIR · moooon
onMotir
You’re viewing a public project. Anyone can view it — no account needed. Sign in to submit, upvote, or comment on requests.View-only — you can’t edit work items
MOTIR-3801

Planning bug: the delivery-reader inventory's own re-measurement was short by two — its grep cannot match `?.workItemId`

Done
Description

Found while running MOTIR-3756 (EXPAND-2), on branch subtask/MOTIR-3756-delivery-readers-visible, base origin/main 17a3aba23. The correction is ALREADY APPLIED — docs/decisions/delivery-reader-migration.md gains a § B′ amendment in motir-core#2426. This card is the telemetry, not the work.

What was wrong

docs/decisions/delivery-reader-migration.md §0 exists specifically to correct an undercount: MOTIR-3751 had scoped its command to one file while its claim quantified over the codebase, and §0 re-measured, printed both commands beside their numbers, and landed on 17 sites.

Its command B is:

git grep -nE "(pr|existingPr|existing|candidate|row|target|m)\.workItemId" -- lib app packages

The \. is a literal dot. TypeScript's optional-chaining operator is ?., which that pattern cannot match. Re-measured on the same ref:

$ git grep -nE "\?\.workItemId" origin/main -- lib app packages components scripts
lib/services/githubPullRequestService.ts:277:      const previousWorkItemId = existing?.workItemId ?? null;
lib/services/historicalPullRequestBackfillService.ts:286:  if (existing?.workItemId != null) {

Two reads of github_pull_request.work_item_id that no table in the ADR carries. The real total is 19.

Why it matters, and why it is not just a number

Both missed rows attach to the two WRITERS rather than to a reader that had to move, so EXPAND-2's scope is unaffected and nothing shipped wrong:

  • githubPullRequestService.ts:277 computes movedFrom, which reports on W1 (setWorkItemLink)'s move.
  • historicalPullRequestBackfillService.ts:286 is the sweep's STICKY-LINK guard, which exists so the backfill does not overwrite a stored link.

The card that pays is MOTIR-3757 (CONTRACT). It drops the column, so it retires both of these too — and it was authored against a table that does not name them. A card sized against 17 sites that meets 19 is the ordinary shape of a build that runs long for no legible reason. That obligation is recorded as a COMMENT on MOTIR-3757 rather than as a criterion here — see What this card does not own, below.

The takeaway, which is the section's own applied to itself

The claim quantifies over every site that reads the column; the command enumerated every site that reads it through a plain dot. X ⊋ Y, one notch smaller than the miss the section was written to correct.

It is the third and fourth instance of one shape inside this epic, and the fourth was found independentlyMOTIR-3733 recorded it against the five-row table; MOTIR-3751 was the correction and undercounted by scoping to one file; §0 corrected THAT and missed ?.; and motir-core#2424 (MOTIR-3770) is amending the SAME section, in the same week, because its row S2 enumerates the CONSUMERS of a projection where the claim is about what each of them WRITES TO. Four corrections to one enumeration is a property of the instrument, not of the authors.

What made this one survive a careful reading: the section prints its commands, argues for printing them, and both commands are correct as written and correct in their answers. A reader checking it re-runs the command, gets the same number, and confirms it. The defect is a gap between the regex's alphabet and the language's grammar, which no re-run can surface — only re-deriving the PREDICATE from scratch does.

Acceptance criteria

  1. docs/decisions/delivery-reader-migration.md carries § B′ — the corrected command, the two missed sites, their disposition, and the amended total of 19. Satisfied by motir-core#2426; this card closes when that merges.
  2. The obligation the amendment creates for MOTIR-3757 is RECORDED where that card's runner will read it — a comment on MOTIR-3757 naming the corrected total and the pattern its own sweep must use. Satisfied at filing time (comment posted 2026-08-28).

What this card does NOT own

The fix inside MOTIR-3757 is MOTIR-3757's, and this card must not be left open waiting for it — a telemetry card whose closure condition is another card's build is a card nothing ever closes. The obligation travels as a comment on that card (AC 2), not as a criterion here.

Nor does it own a RULE CHANGE. If one is judged worth writing, it is one line in the authoring corpus — a grep whose subject is a JS/TS property access must admit ?., because a pattern anchored on \. silently under-reports optional chaining — and it belongs in motir-meta, on its own card, not here.

Evidence

  • Command and output: above, on origin/main 17a3aba23.
  • The corrected inventory: docs/decisions/delivery-reader-migration.md § B′ (motir-core#2426).
  • The section it corrects: the same file, §0 · B.
  • The independent fourth instance: motir-core#2424's hunk on the same section.