feat(import): T7 batch_id scope reresolve_account — R1 INCHIS
- reresolve_account(conn, account_id, batch_id=None): - batch_id specificat -> scope la batch-ul exact (import commit explicit) - fara batch_id (POST /v1/mapari) -> EXCLUSIV canal API (batch_id IS NULL) - salvarea unei mapari NU mai re-queues randuri cross-batch (R1 inchis) - 6 teste: izolare batch A/B, regresie API canal, batch explicit nu atinge API, schema batch_id/row_index, 3 batches izolate Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -298,16 +298,20 @@ def reresolve_account(conn, account_id: int | None, batch_id: int | None = None)
|
||||
mapping = {op: meta["cod_prestatie"] for op, meta in mapping_meta.items()}
|
||||
|
||||
if batch_id is not None:
|
||||
# T7: scope la batch-ul specificat
|
||||
# T7: scope la batch-ul specificat (import commit explicit).
|
||||
# NU atinge randuri din alte batches sau din feed API.
|
||||
rows = conn.execute(
|
||||
"SELECT id, payload_json FROM submissions "
|
||||
"WHERE status='needs_mapping' AND account_id=? AND batch_id=?",
|
||||
(acct, batch_id),
|
||||
).fetchall()
|
||||
else:
|
||||
# Canal API (batch_id IS NULL) + legacy (batch_id nesetat)
|
||||
# POST /v1/mapari (save manual): re-rezolva EXCLUSIV canalul API (batch_id IS NULL).
|
||||
# T7/R1 INCHIS: salvarea unei mapari NU re-queues randuri din batches de import
|
||||
# (cross-batch / cross-feed). Batches de import sunt re-rezolvate doar la commit explicit.
|
||||
rows = conn.execute(
|
||||
"SELECT id, payload_json FROM submissions WHERE status='needs_mapping' AND account_id=?",
|
||||
"SELECT id, payload_json FROM submissions "
|
||||
"WHERE status='needs_mapping' AND account_id=? AND batch_id IS NULL",
|
||||
(acct,),
|
||||
).fetchall()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user