← all branches

feat/rpu-history

needs attentionviewing older commit
a4117da · incrementalPR #324reviewed 2026-07-22 20:40 UTC0H · 2M · 3L · 6I
The branch
Purpose
Close the RPU-agreements arc (#314/#319/#321/#323 already on main): rate-tag chip, regime timeline drawer, RPU-union bill count, evidence display refresh
Goal
Land §3 of rpu-agreements-model.md — the agreements-model UX
Sub-goals
  • Rate-tag chip (tariff code + Autoabasto) in Contratos backed by migration 0062
  • Per-bill regime in Historial's Tarifa column (bill's own TARIFA_REG wins)
  • RPU-union bill count across all non-deleted chapters sharing contract_number
  • Regime-timeline drawer: one card per chapter, deep-linked ?detail=<id>
  • RPU-complete exports audit (already correct — no code change)
  • Evidence display refresh: strictly-newer guard for serviceName/address rename + FCIS fix
The changes (whole branch)
What
This commit (a4117da1): removes step 2a unconditional rename, narrows evidenceName to contractFields?.serviceName only, adds 3 integration tests, clarifies 4+ unit tests, adds prod promote runbook.
Why
serviceName is the CFE access credential — a stale XML batch reverting it deadlocks Gobierno collection. Legacy step 2a (PR #34) had this defect.
Areas
apps/platform+85197domains/utility+89732packages/database+134880docs+4710
Blast
39 files, +15,578/−129 across apps/platform (UI), domains/utility (domain logic), packages/database (migration 0062 + snapshot), docs
migration-0062 rpu-union-count-semantics-change step-2a-deletion-legacy-pr34
CI (typecheck/tests)· Check run API returned 403CodeRabbit· No .coderabbit.yamlmergeable· PR is MERGEABLE

Findings · 11

correctness2

info

Absent contractFields silently produces no-op rename (intended)

domains/utility/src/utility-contract/utility-contract.decisions.ts:541

info

Behavioral contract change: job-level serviceName callers no longer rename

domains/utility/src/bill/bill.shells.ts:822

security1

info

Runbook SQL is dev-executed only — no injection surface

docs/development/rpu-history-promote-runbook.md:1

conventions1

info

Step 2a deletion correctly removes ad-hoc read-modify-write from shell (FCIS fix)

domains/utility/src/bill/bill.shells.ts:822

tests4

medium

Negative-path unit tests no longer guard their stated temporal invariant

domains/utility/src/utility-contract/__tests__/utility-contract.decisions.test.ts:632

4 pre-existing tests use withEvidence() which sets input.serviceName but NOT contractFields.serviceName. After the fix evidenceName=undefined in all four — they trivially pass regardless of date logic.

low

Missing unit test: contractFields.serviceName matching stored name does not refresh

domains/utility/src/utility-contract/__tests__/utility-contract.decisions.test.ts:668

The same-name no-refresh test uses withEvidence (no contractFields). The evidenceName !== existingByCompoundKey.serviceName guard has no direct unit coverage with contractFields.serviceName present.

low

Rename idempotency not tested

domains/utility/src/bill/__tests__/persist-historical-site.integration.test.ts:376

Second call with same strictly-newer bill not verified to be a no-op event-wise.

info

cfeAvailable gate makes new integration tests vacuous in offline CI

domains/utility/src/bill/__tests__/persist-historical-site.integration.test.ts:343

improvement3

medium

Orphaned prose comment block where step 2a was deleted

domains/utility/src/bill/bill.shells.ts:825

Lines 825-829 are a documentation comment with no code following. The policy is already in decisions.ts and tests. Remove or collapse to one line.

low

regimeBill helper inside describe scope — inconsistent with module-level staleBill

domains/utility/src/bill/__tests__/persist-historical-site.integration.test.ts:321

staleBill is at module scope; regimeBill is inside the describe block. Minor inconsistency.

info

buildContractInput create path still uses input.serviceName fallback (intentional)

domains/utility/src/utility-contract/utility-contract.decisions.ts:460

History · 3 commits

  1. 33484d7needs attentionincremental0H · 2M · 3L2026-07-22 21:00
  2. a4117daneeds attentionincremental0H · 2M · 3L2026-07-22 20:40current
  3. c45865dneeds attentionfull0H · 3M · 4L2026-07-22 19:15