# Invoice skill build update — gap review and local implementation

Reviewed 2026-09-09. Source: `D:/fileStorage/repos/invoice-skill-build`, from
`a558523f3f0ad97e6c3f60707d635b3d257d3392` (Stage 16 Round 30) to `616f10bb1154717b0d771d595cb720ccc00cc46f`
(Stage 19 Round 6). Sibyla working tree is based on `c054b7c`; changes are not
committed or deployed. This extends the [persistence slice](argus-persistence-slice-260909.md).

## Source changes and disposition

The source update changes accounting governance and derived data, not just prompts.
The interface assets themselves did not change. Historical capture corrections and retired
payment notices in the source corpus are evidence for rules, not documents to import into Sibyla.
The no-document-carryover decision and NP Group C6 protection remain in effect.

| Gap | Local implementation | Boundary / remaining work |
|---|---|---|
| ENTITM physical nature absent | ItemNature, StockRole and attributed NatureSource; human declaration in entity/item associations; within-company divergence quality measure | Nature is never inferred from SNC. Cross-company differences remain allowed. A full nature-to-account consistency report is still required. |
| Physical lines could enter without Quantity | Stock/Asset whole-document entry hold; existing-line quality measure | Null stays unknown; no default of one. The subsequent fiscal resolver now invokes this guard; see the persistence checkpoint. |
| Landed cost lacked a distinct memo | Nullable FDCDTL LandedUnitCost/LandedCostBasis, sync mapping and derived value preference | No invoice-price overwrite, capitalization or invented cost calculation. |
| No native physical movement projection | Transactional INVMOV projection for native Stock/Asset lines; durable owner/line identity and company-bound FK/RLS | Purchase IN, sale OUT, absolute quantity; nullable valuation. Source IMCode is a render sequence, not a durable identity. Opening stock is unknown; no depreciation or book value. Historical mirrored lines are not rebuilt. |
| No inventory interface | `/argus/inventory`, company access, filters, paging, document links, unknown-value/incoming-only/negative-position notices | This shows recorded movements, not a proved stock-on-hand balance. |
| ITGCHK importance ignored | Relevancy, BlockingLevel, RelevancySource imported; preflight returns explicit evaluated verdicts; review shows metadata and Not evaluated | Only explicit Consultive + Non-Blocking relaxes a failed check. Unknown/contradictory declarations fail closed; legacy checks retain Impact fallback. |
| BNKMAT provenance absent | EvidenceClass, MatchPriority, AmbiguityMarginDays stored/imported and visible in match details | Full Stage 19 receipt-date/priority matcher parity is still open; storing metadata alone does not implement that ladder. |
| Source ruling/supersession metadata absent | GovernedBy on review constraints; GovernedBy/SourceEntryCode/SupersededBy/SupersessionBasis on reference-only documents | No source history is imported by this change. |
| Direct reconciliation apply lacked a live/company recheck | Apply requires movement and document in the same accessible company and still live | Existing rejection constraints and human protection remain authoritative. |
| Flat correction form discarded v2 structure | Recursive header, line and movement facts editor; editable reference arrays; validated full v2 correction; original ResultJson immutable | Existing line/movement counts are retained; adding missing structured rows and creating absent optional objects remain open. Legacy/no-result hand-keying still needs a complete v2 authoring flow. |
| Stale corrections and evidence edits | Source digest checked while intake locked; client evidence changes refused; server removes obsolete not-printed claims when a person supplies a fact | Original evidence is preserved in ResultJson. Bank corrections remain held pending statement persistence. |
| Review overflow and error recovery | Scoped grid/table containment; localised number error; invalid field reveal/focus/ARIA; localized Unknown choice | PT/EN desktop/mobile browser evidence is recorded below. |

Primary source anchors: SKILL.md §31; ENTITM/ITGCHK/BNKMAT schemas;
`Scripts/build_invmov.py`; Stage 19 receipt-date matching and review-rule changes.
The accepted extraction package/model tuple is not silently advanced by this audit.

## Database boundary

Applied to Preview only:

- `20260909091919_Stage19ItemNatureInventoryAndRequirements`
- `20260909092951_MatchEvidencePriority`
- `20260909093650_SourceRuleProvenance`

The earlier `20260909022515_IntakeEntryReceipt` remains Preview-only too.
Main schema/table/AI-reader grant parity is an explicit release gate. The repository's
`local/migrate.ps1` records the owner rule that both databases must be level for release;
Preview-only validation here does not satisfy that rule. No Main data was migrated,
no sync was run, no Docker containers were created, and no acceptance sources were opened.

## Next implementation sequence

1. **Implemented locally:** governed fiscal resolution, revision-bound genuine-repeat decisions,
   intake-scoped provenance and worker/correction dispatch. See the second checkpoint in the
   [persistence slice](argus-persistence-slice-260909.md) for supported cases and conservative holds.
2. **Implemented locally:** statement account resolution, atomic movement persistence, continuity,
   duplicate/overlap holds and correction/retry hand-off. See the third checkpoint in the
   [persistence slice](argus-persistence-slice-260909.md); the editor supports inserting/removing movements.
**Operational checkpoint completed, 2026-09-09 12:26 UTC:** the owner-approved narrowed
[legacy application retirement](legacy-retirement-260909.md) passed postchecks under the
[reuse-protection register](legacy-reuse-protection-260909.md). The legacy database remains
protected pending data-handover reconciliation. Item 3 is the next coding step.

3. **Native checkpoint implemented locally:** receipt-date/FIFO and exact payable/receivable proposals, declared priority,
   ambiguity and competing-movement holds, permanent rejected-pair constraints, worker dispatch,
   and preserved human decisions. See [native matching checkpoint](stage19-native-matching-260909.md).
   This is not full parity: other source match shapes and reference-sheet ingestion remain separate.
4. Finish structural correction authoring (missing rows/optional objects) and item-nature/account
   consistency reporting. Refresh movement projections on every future native line mutation path.
5. Align Main/Preview migrations and grants as part of the release; freeze the candidate and
   fresh acceptance protocol before opening the separate sealed set. NP Group activation still
   requires its C6 cutover decision; do not remove its 52 sync-run rows as a shortcut.

## Validation

Final per-suite results: **1,081 passed, 3 failed, 0 skipped**. Argus 263,
Platform 548, API 56 and Browser 159 passed; TenantIsolation passed 55 and failed
only Main/Preview migration, table and AI-reader grant parity. The unfiltered solution run
also caught a missing Reference translation and a test locator selecting the parent disclosure;
both were fixed, then the complete browser suite passed 159/159. After the final translated
labels and mobile invalid-field centering change, all four correction/localization tests passed.
No other backend changes followed the full backend run.

Evidence (on this machine): `%TEMP%/sibyla-stage19-final.log`,
`%TEMP%/sibyla-stage19-browser-final.log`, `%TEMP%/sibyla-stage19-capture-final.log`;
final browser TRX files under `%TEMP%/sibyla-stage19-final/`. EF reports no pending
model changes. `git diff --check` passed; the invoice-skill-build source checkout remains clean.
These local tests do not establish sealed extraction accuracy or production readiness.

Independent interface verdict: **ship**, no remaining findings in the bounded review.

| Finding | Final score | Evidence |
|---|---|---|
| Containment | Resolved | Desktop modal and mobile viewport contain the grids; fixed actions remain visible. |
| Validation recovery | Resolved | Invalid Total is focused/highlighted with actionable PT/EN inline guidance above the mobile action bar. |
| Scalar reference editing | Resolved | Expanded controls show an editable reference and fitting Add/Remove actions on mobile. |
| Unknown state | Resolved | Blank type displays localized Unknown / Desconhecido. |

Screenshots: `local/artifacts/playwright/uploads-v2-review/`, each PT/EN desktop/mobile
`*-review.png`, `*-references.png` and `*-unknown.png`. Browser assertions also cover
horizontal overflow, focus/ARIA association and invalid-field visibility above fixed actions.
The incumbent design system is recorded in [DESIGN.md](../DESIGN.md) and its sidecar.
The Impeccable detector ran once on the changed correction, inventory, association,
integration-review and CSS surfaces: zero findings. This does not substitute for browser review.


The subsequent native bank-statement checkpoint is documented in
[argus-persistence-slice-260909.md](argus-persistence-slice-260909.md#third-implementation-checkpoint--native-bank-statements-2026-09-09).
It completes step 2 locally and adds movement-row authoring in the correction UI. Current per-test
validation is **1,122 passed / 3 known release-parity failures / 0 skipped**, including the final
confirmation of two intermittent browser/harness failures. The subsequent
[native matching checkpoint](stage19-native-matching-260909.md) implements receipt-date/FIFO
proposals and records **1,162 passed / 3 existing release-parity failures / 0 skipped**. It leaves
other source match shapes explicit; the persistence checkpoint still records the import limits.
