feat: complete pre-ai local completion v3

This commit is contained in:
OpenCode
2026-09-21 16:30:27 -03:00
parent 6731eeca08
commit 84b08c2150
41 changed files with 4141 additions and 9 deletions
+22
View File
@@ -422,3 +422,25 @@ Pilot profile: CONSTRUCAO (`pilot-construcao.env.example`); planned, not install
## Local Completion V2 (2026-09-20)
Audit outcome in `docs/LOCAL_COMPLETION_V2_REPORT.md`: origin rule invalid → rolled back (35,048); CFOP/IPPT weak-evidence writes rolled back; role no longer inferred from PROD_COZINHA alone; SPED 4.3.x dataset in `docs/sources/`; PIS/COFINS Simples rule from ERP emission evidence; questionnaire V2 (`docs/LOCAL_FISCAL_CONTEXT_QUESTIONS_V2.*`). Rollback tool: `scripts/rollback_field.py`; audit: `scripts/audit_local_writes.py`.
## Local Completion V3 Operations
Tasks 8-10 are CLI-first and review-first: company/group answers are validated
locally and emitted as JSON/CSV without import or Firebird writes; `MIXED_OR_DYNAMIC`
never invents a static entry CFOP; `STORE_IPI_PROFILE` requires an explicit choice
and produces only a rollback plan. Rollback previews are scoped by run, database,
field, and product and refuse drift where current differs from the audited after
value. `scripts/run_local_validation.py` and `scripts/generate_local_health.py`
are deterministic and emit `docs/LOCAL_PRODUCT_HEALTH_V1.json` with measured counts.
## PRE-AI Local Completion V3 (2026-09-21)
Offline completion is operationally ready. `DeterministicFakeSemanticProvider`
and the ID-correlated batch runner cover batch sizes 5/10/20 plus contract and
transport failures; budget, cache-key, dataset-drift, and zero-write E2E tests
are present. KB conflict audit is conservative: 90 observable GTIN/NCM conflicts
remain `NCM_CONFLICT`; 73 historical conflicts are explicitly uncovered by the
seed payload. Canonical identity is deterministic and excludes tenant fiscal
context. Retrieval V3 evidence hooks exist but V2 remains active until a full
untouched holdout replay proves no regression. Human/group questionnaire CLIs,
guarded rollback preview, local validation, and health report are available.
See `docs/PRE_AI_LOCAL_COMPLETION_V3_REPORT.md` for measured values.