← all branches

fix/tariff-cov

needs attentionviewing older commit
eec3b04 · incrementalpre-PRreviewed 2026-08-07 18:27 UTC2H · 1M · 4L · 1I
The branch
Purpose
Close four holes in the CFE tariff rate pipeline identified by the second review panel
Goal
Ensure all nine tariffs are always named explicitly in repair operations and the e2e gate cannot be bypassed by a file rename
Sub-goals
  • SG-1: Make rateTypes required in CreateTariffJobApiInputSchema — remove GDMTH-only default
  • SG-2: Fix e2e smoke-test to track previous_filename on renamed files
  • SG-3: Improve watchdog issue body with full rateTypes repair instructions
  • SG-4: Strengthen config-integrity test to assert exact positional order for containedDivisions
The changes (whole branch)
What
rateTypes field made required in the API schema (breaking), jq filter extended in e2e.yml to capture renamed file paths, watchdog issue body now shows the full nine-tariff repair command, Valle de México config integrity test asserts exact zone order instead of sorted set.
Why
The previous GDMTH-only default was the same silent-failure pattern as the original pipeline incident — operators following the watchdog repair instructions would fix only one of nine tariffs. The renamed-file bug allowed a real prod scenario (middleware move) to skip the required smoke check.
Areas
.github/workflows+5710packages/api/src/schemas+182services/utility/tariffs/cfe/__tests__+91domains/utility+10814infra/cdk/src/stacks/services/utility/tariffs/cfe+246101services/utility/tariffs/cfe/src+689185scripts/db+1040.claude/rules+950
Blast
28 files, +1431/−314 across the branch. Core changes in tariff Lambda handlers and SFN stack; this increment is 4 files, +40/−9 (schema, CI, and test hardening only).
public-api breaking-schema-change
CI· Pre-PR branch — no PR checks availableCodeRabbit· No .coderabbit.yaml in repo

Findings · 8

correctness1

low

Hardcoded tariff list in watchdog may drift from rate-pages.json

.github/workflows/tariff-coverage-watchdog.yml:108

The repair instruction embeds a literal list of nine rate types; adding or retiring a tariff without updating this list silently gives operators a wrong repair command.

conventions2

low

JSDoc on rateTypes describes WHAT as well as WHY

packages/api/src/schemas/tariff-job.schemas.ts:22

Opening line restates what the schema already makes self-evident. The WHY and BAT-308 reference are valuable; the WHAT portion can be trimmed.

info

Watchdog hardcodes tariff list that duplicates registry

.github/workflows/tariff-coverage-watchdog.yml:108

Same drift risk as correctness lens; worth tracking in BAT-308 which already covers making the registry shareable.

tests4

high

No schema test verifying omitting rateTypes is rejected at API layer

packages/api/src/schemas/tariff-job.schemas.ts:39

tariff-job.schemas.test.ts does not exist in packages/api/src/__tests__/schemas/. The domain decision test verifies an empty array is rejected but doesn't cover the API parse layer. A body without rateTypes must parse-error with a 422 — this invariant is untested.

high

No double-parse idempotency test for CreateTariffJobApiInputSchema

packages/api/src/schemas/tariff-job.schemas.ts:39

Project convention (cfe-job.schemas.test.ts) requires a double-parse idempotency check when a schema has .default() values (ts-rest materialises defaults before the handler re-parses). divisions still has .default(null); no idempotency test exists for this schema.

medium

Order test doesn't verify config→scraper column mapping

services/utility/tariffs/cfe/__tests__/config-integrity.test.ts:81

The test pins exact order ['DL','DM','DN'] correctly. But if extractRateCellTables is refactored, the test still passes while prices cross-pollinate. A companion test verifying index-0 maps to the first table column would close this.

low

Rename-detection jq change has no automated test

.github/workflows/e2e.yml:74

The jq expression is correct but untested. A mock fixture exercised by a shell script in scripts/ would prevent regression.

improvement1

low

Watchdog tariff list could be derived from rate-pages.json at runtime

.github/workflows/tariff-coverage-watchdog.yml:108

If the workflow reads rate-pages.json via jq at runtime, the list stays authoritative without manual sync.

History · 14 commits

  1. 1ed035eneeds attentionincremental0H · 2M · 5L2026-08-11 02:03
  2. fcbe80dblockedfull6H · 12M · 14L2026-08-10 22:02
  3. 92353bdblockedincremental1H · 9M · 7L2026-08-10 19:32
  4. 5f2213eneeds attentionincremental1H · 6M · 10L2026-08-09 05:35
  5. c30da44needs attentionincremental1H · 4M · 2L2026-08-09 04:54
  6. 5940f56needs attentionincremental0H · 3M · 7L2026-08-07 19:15
  7. f222512needs attentionfull2H · 9M · 15L2026-08-07 18:58
  8. eec3b04needs attentionincremental2H · 1M · 4L2026-08-07 18:27current
  9. 0b43396needs attentionincremental0H · 2M · 6L2026-08-07 01:39
  10. 3eb9789needs attentionincremental0H · 3M · 5L2026-08-06 18:30
  11. 87fc06aneeds attentionincremental0H · 4M · 9L2026-08-06 01:21
  12. 76bcc76needs attentionincremental0H · 1M · 5L2026-08-06 00:51
  13. 8948608needs attentionincremental0H · 3M · 4L2026-08-05 23:49
  14. e44f6bbneeds attentionfull3H · 6M · 9L2026-08-05 19:29