{ "questions": [ { "question": "D1 \u2014 Which parser should the two new Retry-After callers use?\nProject/branch/task: fixture app, branch main, planning src/import-worker.ts and src/sync-route.ts (not yet written).\nELI10: Both new files need to turn a Retry-After header into a number of seconds, exactly the way the scheduler already does. The scheduler gets that from one small existing function, lib/retry-after.ts, whose signature already matches what the plan asks for (string or null, injected clock, caller fallback, 3600 cap). The draft plan instead writes a fresh copy of that logic inside each new file. The question is whether to import the existing function or write two copies.\nStakes if we pick wrong: with copies, a header like '-5' or a past date can quietly produce a different delay in each file, and the plan's fixed compatibility requirement cannot be proven; with reuse but thin tests, a later change to the helper could break all three callers before anyone notices.\nRecommendation: A because the plan fixes behavior to the existing helper, so importing it is the only way to make equivalence true by construction, and the extra contract tests are a few lines.\nCompleteness: A=10/10, B=7/10, C=5/10\nPros / cons:\nA) Reuse helper + contract tests (recommended)\n \u2705 Equivalence with scheduler behavior holds by construction, including engine-dependent Date.parse edges like '-5' \u2192 0\n \u2705 Adds about six shared assertions that document null+fallback, past date \u2192 0, ceiling and injected now, which today's test omits\n \u274c Any regression in lib/retry-after.ts now affects three callers at once instead of one\nB) Reuse helper, existing tests\n \u2705 Same by-construction equivalence as A with the smallest possible diff (two import lines plus caller tests)\n \u2705 No change to the shared test file, so nothing outside the two new callers is touched\n \u274c Edge cases the new callers rely on (custom fallback, past dates, ceiling on dates, non-zero now) stay unproven at the contract level\nC) Local parser per caller\n \u2705 Each caller is self-contained and can be read without following an import\n \u2705 No shared blast radius: a bug in one copy cannot break the scheduler\n \u274c Three copies of the same ~14 lines that must stay identical forever; the plan's fixed-compatibility requirement is only provable by copying verbatim, and drift is silent\nNet: trading a slightly wider shared blast radius (already accepted for the scheduler) for provable compatibility and about 26 fewer implementation lines; B is A without the proof, C is the draft's duplication.", "header": "Parser reuse", "multiSelect": false, "options": [ { "label": "Reuse helper + contract tests", "description": "Import retrySeconds from lib/retry-after.ts in both new callers and pass each caller's injected now and fallback through. Extend test/retry-after.test.ts with ~6 assertions (null + custom fallback, whitespace \u2192 fallback, past HTTP-date \u2192 0, HTTP-date beyond ceiling \u2192 3600, unsafe-integer \u2192 fallback, non-zero injected now). Each caller's integration test asserts now and fallback are forwarded and the 3600 ceiling holds. lib/retry-after.ts semantics and existing callers unchanged. Completeness 10/10. human ~1 h / CC ~5 min. \u2705 Equivalence by construction, including engine-dependent edges. \u2705 Contract edges the callers depend on become tested once. \u274c A helper regression affects scheduler plus both callers; mitigated by the shared tests." }, { "label": "Reuse helper, existing tests", "description": "Import retrySeconds from lib/retry-after.ts in both new callers exactly as in A, but leave test/retry-after.test.ts at its current 5 assertions. Each caller's integration test asserts now and fallback are forwarded and the ceiling holds. lib/retry-after.ts semantics and existing callers unchanged. Completeness 7/10. human ~30 min / CC ~3 min. \u2705 Same by-construction equivalence, smallest diff. \u2705 Touches nothing outside the two new callers and their tests. \u274c Null + custom fallback, past dates, date ceiling and non-zero now remain unproven at the shared-contract level." }, { "label": "Local parser per caller", "description": "Keep the draft: write a parser inside src/import-worker.ts and inside src/sync-route.ts reproducing lib/retry-after.ts:2-15, each with its own ~8-assertion edge suite plus the integration test. lib/retry-after.ts and existing callers untouched. Completeness 5/10. human ~3 h / CC ~15 min. \u2705 Self-contained files, no import to follow. \u2705 No shared blast radius. \u274c Three copies that must stay identical; engine-dependent Date.parse behavior cannot be proven equal without verbatim copying, and later drift is silent." } ] } ] }