# Test-Contour Runbook: Universal Tools + FoxyLink

## Goal

Close hard gate check #2:

`posting -> subconto[1..3] -> counterparty / contract / item`

without breaking the existing OData read-only baseline.

## Status Update (2026-03-22)

UT branch is currently blocked for this lab contour:

- `UI.cfe` is not plug-and-play compatible with target `Бухгалтерия 2.0`.
- Missing required BSP/configuration objects in target base.
- Reference: `docs/ut_compatibility_blocker_2026-03-22.md`

Current critical path:

- OData baseline + FoxyLink deeper PoC.

## Current Local State

Prepared artifacts:

- Universal Tools extension file: `external/dist/UI.cfe`
- Universal Tools source repo: `external/tools_ui_1c`
- FoxyLink source repo: `external/FoxyLink`
- FoxyLink configuration dump: `external/FoxyLink/src`
- Baseline report: `logs/deep_accounting_mvp_gate.json`
- Baseline report: `logs/slot3_recon_report.json`

## Step 1: Preflight Readiness Snapshot

Run:

```powershell
cd X:\1C\NDC_1C
$EnvPython = Join-Path $env:USERPROFILE "miniconda3\envs\ndc_1c_mvp\python.exe"
if (-not (Test-Path $EnvPython)) { $EnvPython = Join-Path $env:USERPROFILE "Miniconda3\envs\ndc_1c_mvp\python.exe" }
& $EnvPython scripts/check_deeper_access_readiness.py
```

Expected artifact:

- `logs/deeper_access_readiness.json`

## Step 2: Universal Tools (Optional, Paused)

Important:

- This step is not on the critical path now.
- Perform only if a separate UT adaptation scope is approved.

Legacy flow (for future adaptation only):

1. Open 1C Configurator for test base.
2. Add extension from file `external/dist/UI.cfe` (configuration extensions menu).
3. Start enterprise mode and verify UT tools are visible.
4. Use UT query console for targeted slot3 diagnostics.
5. Use UT object/attribute editor to inspect source objects for slot3 population.
6. Use UT storage structure viewer to trace internal source tables/fields if needed.

Diagnostic objective (if adaptation is funded):

- Find posted document lines where slot `3` (`Субконто3`, `СубконтоДт3`, `СубконтоКт3`, `СубконтоНУ3`, etc.) is non-null.
- Capture proof tuple:
  - `Document.Ref`
  - `LineNumber`
  - `Recorder_Type`
  - slot `3` value + its type/category
  - `AccountDr/AccountCr`

## Step 3: FoxyLink PoC in Test Base

Local source currently available as configuration dump:

- `external/FoxyLink/src`

Suggested PoC scope (minimal):

1. Load/merge FoxyLink into isolated test contour.
2. Build one read-only extraction endpoint/job for failed segment only:
   - `document line -> posting -> slot3 semantic`
3. Export result in stable machine format (JSON/table).
4. Map output to existing canonical fields (no schema fork).

## Step 4: Evidence and Acceptance

Re-run probe stack:

```powershell
cd X:\1C\NDC_1C
powershell -ExecutionPolicy Bypass -File .\scripts\run_probe.ps1
```

Pass criteria for promotion decision:

1. `document -> posting -> debit/credit account`: `pass`
2. `posting -> subconto[1..3] -> counterparty/contract/item`: `pass`
3. `saldo explainability`: `pass`

Required artifacts:

- `logs/deep_accounting_mvp_gate.json`
- `logs/slot3_recon_report.json`
- `logs/deeper_access_readiness.json`
- Short note describing exact slot `3` extraction path and mapping.

## If Check #2 Still Fails

Interpretation:

- If UT confirms non-null slot `3` exists in 1C internals but OData still cannot reproduce it reliably, this is objective evidence for deeper-access runtime path.

Decision:

- Keep OData as wide read-only baseline.
- Promote FoxyLink PoC path for missing semantic closure.

## Controls

1. Test-only rollout before any production decision.
2. Read-only policy for OData remains mandatory.
3. License review required before production use:
   - FoxyLink: AGPL
   - Universal Tools: GPL-3.0
