From 8a9f445a98c366095493381881c53713f442ae78 Mon Sep 17 00:00:00 2001 From: drzo <15202748+drzo@users.noreply.github.com> Date: Wed, 21 Oct 2026 00:28:13 +0200 Subject: [PATCH] Sync zonent/ mirror to the canonical model (cogpy/zonent, 2026-10-20) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per zonent's Refinement Protocol: the canonical repo was brought level with every sibling first, then propagated outward. This mirror had been frozen since the 2026-03-23 initial copy (or, for fincosys, since its July 2026 sync of zonent master). What changes here, and why each file is a superset of what it replaces: - CROSS_PARADIGM_SPEC: adds the two review notes (account_health_index 0.7572 vs the documented 0.7907; canonical_id and AGENT_RST/ENTITY_RST identifier conflicts) and carries the PERSON_005 entity-code rename DJF→DF that fincosys applied on 2026-08-18. - MEMBRANE_COA_SPEC: adds the FNB shell-assignment gap (neither branch had recorded it) and the intercompany reconciliation note (~R18.9M residual = the unquantified RST<->RWD leg), on top of master's classifier-verified code-range and RWW notes. - NEON_SCHEMA_REFERENCE: adds the Access Control section (RLS requirement for a database of forensic evidence — the mirror had none), the DDL-not-runnable callout, and the owning-schema note for the unqualified evidence/timeline_events/cases tables. - SF_SDM_SPEC (ad-res-j7 only): adopts fincosys's version, which carries the ⛔ `stock-stolen` withdrawn-claims banner. - REFINEMENTS_PENDING: revstream2's 2026-10-10 copy, the most complete in circulation, with two C2 table rows updated to the register's 2026-10-10 correction (`tb-246m-working-copy`): the 18 Feb 2024 SLG TB is a print of the live books carrying mis-scaled journal 789, not a working copy. As written on 2026-10-07 those rows affirmed the withdrawn claim and tripped the withdrawn-claims guard; the replacement text is the register's own correction verbatim. Registry files and the remaining model specs are unchanged: already byte-identical to canonical. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01RhnQGYVyHEssuk1gAvThvC --- zonent/REFINEMENTS_PENDING.md | 125 ++++++++++++++++++ .../model/integration/CROSS_PARADIGM_SPEC.md | 29 +++- .../model/membrane-coa/MEMBRANE_COA_SPEC.md | 47 +++++-- zonent/schema/NEON_SCHEMA_REFERENCE.md | 71 +++++++++- 4 files changed, 260 insertions(+), 12 deletions(-) create mode 100644 zonent/REFINEMENTS_PENDING.md diff --git a/zonent/REFINEMENTS_PENDING.md b/zonent/REFINEMENTS_PENDING.md new file mode 100644 index 0000000..4c0c9be --- /dev/null +++ b/zonent/REFINEMENTS_PENDING.md @@ -0,0 +1,125 @@ + +> ⛔ **This file contains claims since withdrawn or corrected (flagged 2026-10-10).** Do not reuse them; use the corrections: +> - corrected (`tb-246m-working-copy`): The 18 Feb 2024 SLG TB is a print of the live books carrying mis-scaled journal 789 (22 Nov 2023), not a corrupted working copy; FY2024 was closed at least twice. +> Register and sources: `docs/strategic/WITHDRAWN_CLAIMS_REGISTER.json` (cogpy/ad-res-j7). + +# ZONENT Model Refinements — Pending Application + +Per the Refinement Protocol (CLAUDE.md), discoveries are recorded here FIRST, then propagated +to source repos and synced to Neon (fincosys Stage 6a). + +## From: Forensic Inventory & Manufacturing BOM Audit (2026-07-21) + +Source: `ad-res-j7/docs/audit/FORENSIC_INVENTORY_MANUFACTURING_BOM_AUDIT_2026_07_21.md` (§9) + +### Entity additions (Layer 3 ER-ABM / registry) + +| Entity | Type | Evidence base | +|---|---|---| +| SUPP-ADDARORY (Addarory (Pty) Ltd) | SUPPLIER | R2.6M+ documented payments (Pastel/correspondence); ZERO bank trace in 76,098 txns — flag `settlement_channel_unknown` | +| Coptis SAS | PLATFORM/SUPPLIER | Subscription contract N° 1105 (18 Aug 2015), €1,010/yr, 3 users, signed Jacqui Faucitt (RST CEO) | +| Stock2Shop (Pty) Ltd | PLATFORM/SUPPLIER | 138 invoices (true range 13619 → 39701, 8 Dec 2017 → 28 Jun 2025; ⛔ the earlier "7754" start was withdrawn as unverifiable, ad-res-j7 audit §10), R502,563.58 extracted set, all addressed to Peter Faucitt / RWW | +| Sage South Africa (Pty) Ltd | SUPPLIER | Continuous 2016–2026; INV6008343 (4 Jul 2025): Pastel 5→10 users R20,750, order SO2059500 | + +### Relation additions (Layer 3) + +- REL_OWN: Darren Dennis Farrar → Addarory (Pty) Ltd (director; Rynette admission 8 Oct 2024) +- REL_SUPPLY: Addarory → SLG/RST (packaging + Guaiazulene; order SPO30431, 13 Feb 2025) +- REL_STOCK: Addarory supply categories ↔ SLG ~~disappeared~~ written-off stock categories — ⛔ *2026-10-07: do not model the FY2025 write-off as physical disappearance; see Corrections §C1 below* + +### Event additions (Layer 4 ET-DSM) + +| Date | Event | Amount | +|---|---|---| +| 2020-08-13 | Bantjies distributes final TBs + AJEs to pete@regima.com (et al.) | — | +| 2020-08-26 | Stock2Shop "Cancel Integration" email correspondence | — | +| 2025-07-04 | Sage 50cloud Pastel upgraded 5→10 users (month of server seizure) | R20,750.00 | + +### Corrections + +1. **Event dedup**: EVENT_051 duplicates EVENT_H005 (2020-02-20, AJEs R1,642,000) — merge; also EVENT_026 title:null near-duplicate. +2. **Classification fix**: Proficos rows in `fincosys/coa/classified_transactions.csv` misclassified — 56 rows coded intercompany (1.EXPENSE.INTERCO.SLC→RST), 33 coded self-transfer (0.ASSET.BANK.RST.INTERNAL); Proficos is an external third-party manufacturer — re-code as external. +3. **Entity-label misattribution**: `fincosys/membrane_coa/data/forensic/trial_balances.json` labels several "Strategic TB" / "TB SL" files as `entity: RST`; filenames are authoritative (SLG). +4. **Data-quality**: 77 GBP Goringe Accountants (UK) invoices misfiled under `mazaudit/suppliers/stock2shop/r2_invoices/` — re-attribute. +5. **Classification fix (gap-closure, confirmed 2026-07-21)**: `TXN_2f01f23f0cc7cd50` (SLG→"Regima Jars", R1,216,740.25, 2022-10-18) coded intercompany SLC→RST (shell 1, confidence 0.8) in `coa/classified_transactions.csv` — very likely a substring-match error on "Regima" in the payee name "Regima Jars"; sibling legs of the same 3-leg flow (RST→"Qu0056879" outbound, "Containers"→SLG inbound) are both correctly coded external. Strong circumstantial evidence this leg is a mislabeled Addarory payment (product context: containers/jars). Pending beneficiary-account confirmation, re-code to external (shell 2). +6. **Addarory supplier node — bank evidence found**: exact-amount search located both known Addarory payment amounts in the bank corpus: R1,216,740.25 (2022-10-18, three-leg flow via SLG, TXN_67bb242e2621e832/TXN_f322f8d92a00d856/TXN_2f01f23f0cc7cd50) and R1,388,883.75 (2024-12-03, RWD FNB OB payment, TXN_82c8acd526a8b7a5, ref 000000086, narration "...Regima Containers"). Neither field literally reads "Addarory" — counterparty labels are "Qu0056879"/"Containers"/"Regima Jars"/"Regima Containers". This updates the "zero bank trace" status noted in the initial refinement entry above: the SUPP-ADDARORY node should link these transaction IDs as candidate evidence, flagged `beneficiary_match: circumstantial_not_confirmed`. +7. **New candidate supplier entity**: "Alistin" — recurring SLG supplier, Xero invoice series 73,000-77,000+ (2020-2021, `data/xero_imports/62432501494/`). Strong candidate match for the VAT return's unidentified "MACC" INV73722 reference (R310,500 incl VAT, 20/08/2020) — a same-amount SLG payment to "Alistin" (TXN_b0f3c1b88eb8399f) occurs 8 days later (28/08/2020), funded by a same-day "Loan To Strategic" self-transfer (TXN_a35abc6f2cb0aa96). + +### Stock-Flow parameter updates (Layer 5 SF-SDM) + +- SLG Feb 2025 inventory adjustment, exact ledger figure: **R5,241,372.98** (P&L 2100/000, all inventory categories) — this is the single authoritative figure for the FY2025 event. **Do not additionally model the R1,443,217.78 (phantom opening finished goods) and R2,756,321.85 (impossible closing finished goods) figures as separate stocks/losses** — they are the balance-sheet Finished Goods (7700/000) component of this same event (their swing = R4,199,539.63), not additive amounts. A ~R1.04M residual (R5,241,372.98 − R4,199,539.63) falls on other inventory categories (raw materials/packaging/boxes/containers) not yet separately quantified. See `ad-res-j7/docs/strategic/STOCK_LOSS_SCHEDULE_2026_04_23.md` §1a for full reconciliation. +- FY2020 RST manufacturing signature: finished goods R12,805,083.10; Manufacture Cost/Recovery R0.00; 8200/050 Prime Products raw materials **-R150,562.11**. +- ~~Multiple-books flag: SLG TB versions diverge FY2020 (R7.33M), FY2022 (R5.47M), FY2024 (3 irreconcilable versions incl. suspected ×1000 scale corruption of the R246,372 "R246k" entry, file dated 18 Feb 2024).~~ ⛔ **Superseded 2026-10-07 — do not apply as written.** Re-derived from the source spreadsheets: the FY2020 R7.33M divergence does not exist (all four files identical on inventory; aggregate artefact); FY2022 R5.47M is unverified (no source held); FY2024 has **two** statements differing by a real retrospective restatement of **R936,873.05** (97% packaging), plus one working copy (18 Feb 2024, pre-year-end) to be excluded, with the ×1000 reading consistent-with but not proven. See Corrections §C2. + +### Reconciliation with a parallel investigation branch (2026-07-21) + +A concurrent branch (`claude/review-bom-docs-uMY6H`, merged to ad-res-j7 main via PR #4892) +independently worked overlapping evidence. Two of its findings materially affect items above and +the wider entity model: + +- **Guaiazulene supplier corrected**: live SLG stock records (two independent 2025 snapshots, + 4 months apart) show the registered Guaiazulene supplier as **Symrise (SYM0001)**, not + Addarory. The Addarory/Guaiazulene "circular supply" hypothesis has **no direct supporting + evidence for this specific ingredient** — model it as an unproven hypothesis, not an + established relation. The Addarory bank-evidence findings above (item 6) stand on their own + (payment amounts located in the corpus); they do not, on their own, establish the + circular-supply mechanism. +- **New live BOM/MRP data available**: 17 SLG finished-good formulas, 88 raw materials, real + ERPNext consumption data (Apr–Nov 2025) — see `ad-res-j7/docs/strategic/MANUFACTURING_BOM_2026_07_21.md` + and `ad-res-j7/evidence/manufacturing_bom/mrp_bom_graph.json`. Confirms "Alistin SC" (item + R1905059) as an active current ingredient/supplier — independent corroboration of item 7 + above. Note: MRP entries are labelled "Suggested job" (planning-stage), not confirmed + executed production — model accordingly if adding to the stock-flow layer. +- **Physical stock count claim scoped**: a genuine count exists for a separate UK "Salco" + channel (23 Jul 2020–10 Nov 2021, favourable variance) — but SLG/RST's own SA warehouse stock + (the entities central to this refinement file) still has no documented count located. + +--- + +## Corrections (2026-10-07) — apply these in place of the superseded entries above + +Source: `ad-res-j7/docs/audit/PHANTOM_STOCK_ROOT_CAUSE_2026_09_08.md`, `…_ADDENDUM_2026_09_22.md`, +`…_ADDENDUM2_2026_09_29.md`, and `ad-res-j7/docs/audit/BOM_INVESTIGATION_LEDGER.md` §2–§3. +Every figure re-derived from the primary trial-balance xlsx files, not from any aggregate. + +### C1. The FY2025 write-off is a bookkeeping residue, not missing goods (model as such) + +- `2400/000 Manufacture Cost / Recovery` = R0.00 in every held SLG and RST trial balance, + FY2017–FY2025: the raw-materials→finished-goods conversion journal was never posted. +- Consequence in the books: packaging accumulates (R5.78M FY2019 → R8,424,603.19 FY2025), + finished goods drains to a credit (R1,443,217.78 DR → R2,756,321.85 CR), and the FY2025 + `2100/000` plug of R5,241,372.98 is **96.62% explained by ledger movements alone** + (FG collapse R4,199,539.63 + other inventory capitalised R1,219,150.81; residual R177,317.46). +- ZONENT impact: EVENT_025/EVENT_028 and any `REL_STOCK` edge must carry + `nature: accounting_artefact_unposted_conversion`, not `physical_loss`. The R5.4M headline, + the R5,241,372.98 ledger figure and the R4.2M FG swing are one event measured three ways — + never summed (already noted at the 2026-07-22 entry; this makes it explicit for the edge type). +- Physical control: raw materials at Prime (4 Aug 2025) value to R931,511.91 at count-quarter + list price and **reconcile** to book (R740,345.71 Feb 2025 / R970,881.11 Feb 2024). + Packaging (R8.42M) has no count anywhere — untested, not inferred either way. + +### C2. "Multiple books" — what survives + +| Claim as recorded above | Status | Replace with | +|---|---|---| +| FY2020 versions diverge R7.33M | **Refuted** | Four files identical on all inventory rows (Boxes 898,930.17); the 8,231,078 was the FY2019 inventory total read into the Boxes row by the extractor | +| FY2022 R5.47M | **Unverified** | No FY2022 spreadsheet held; JSON-only; do not model | +| FY2024 three irreconcilable versions | **Superseded** | Two statements, reconciling to the cent via a retrospective **−R936,873.05** write-down (R905,004.19 packaging). ⛔ Corrected 2026-10-10 (`tb-246m-working-copy`): the 18 Feb 2024 file is a print of the live books carrying journal 789 (22 Nov 2023, mis-scaled raw-material values to 2100/000; running balance −R246,372,003.80), not a working copy; the journal was reversed at year end and FY2024 was closed at least twice (CR R440,961.47 vs DR R6,159,023.12). Source: `docs/audit/PHANTOM_STOCK_ROOT_CAUSE_ADDENDUM4_2026_10_10.md` | +| ×1000 scale corruption | **Superseded** | ⛔ Corrected 2026-10-10 (`tb-246m-working-copy`): not a corruption — journal 789 carried mis-scaled values and was reversed at year end; do not cite the file as a working copy or as corrupted. Its link to Bantjies' 'R246k' query is unestablished | + +### C3. New, verified, not yet in the model + +- **FY2025 TB in evidence does not foot** by R2,485,098.35, all in 5200/000 opening retained + income. Inventory rows unaffected; the file is a working document. Any FY2025 balance taken + into ZONENT must carry `source_status: working_document_unfooted` until the signed AFS/GL is held. +- **FY2023 raw materials credit balance**: 7540/000 = −R8,570,989.06 in the earlier FY2024 + file's comparative, +R429,010.94 in the issued one — a change of exactly R9,000,000.00 to a + closed year (8001/000 changed by exactly R1,100,000.00 in the same pair). The negative-asset + signature on raw materials two years before it appeared on finished goods. Weight limited by + the working-copy source; needs the FY2023 primary TB (ledger gap 18). + +### C4. Stock-count claim + +The blanket "no physical stock count ever performed" is **refuted** (counts by Prime Mar 2021, +joint RegimA/Salco 1 Sep 2021, SOLO 8 Feb 2022; Salco is a South African logistics provider, +not a UK channel). Do not attach a `no_count_ever` attribute to any SLG/RST inventory node. diff --git a/zonent/model/integration/CROSS_PARADIGM_SPEC.md b/zonent/model/integration/CROSS_PARADIGM_SPEC.md index 79503aa..f9614ba 100644 --- a/zonent/model/integration/CROSS_PARADIGM_SPEC.md +++ b/zonent/model/integration/CROSS_PARADIGM_SPEC.md @@ -20,6 +20,18 @@ FNB | First National Bank | FIN_INST | FNB_001 | PERSON_JF | Jacqueline Faucitt | PERSON | PERSON_JF | natural_person_JF | NULL | HG_PERSON_JF ``` +> **Known inconsistencies in this sample — do not treat as resolved.** +> +> 1. `canonical_id` values above use three naming styles (`AYMAC`, `VILLA_VIA`, `PERSON_JF`) +> that do not match the canonical entity codes in `registry/MASTER_ENTITIES.md` +> (`AYM`, `VVA`, `JF`). Cross-repo joins keyed on the registry code will not match this +> table without an alias mapping. +> 2. `model/SYSTEM_MODEL.md` documents `RST`'s `agent_model_id` as `AGENT_RST`, whereas this +> table records `ENTITY_RST`. +> +> Both reflect the upstream `fincosys/sql_batches/12_entity_mappings.sql` content as-is. +> Reconciling them requires checking the deployed Neon table rather than editing these docs. + ## Cross-Reference Types ### OWNERSHIP @@ -76,6 +88,16 @@ Statement-level analysis snapshots capture cross-paradigm metrics: } ``` +> **`account_health_index` does not reproduce from the documented formula.** +> `model/stock-flow/SF_SDM_SPEC.md` defines it as `credits / (credits + debits + fees)`, +> which for these values gives `5055 / (5055 + 1477.53 + 143) = 0.7572`, not `0.7907`. +> `net_change`, `fee_burden_ratio` and the closing balance all reconcile, so the discrepancy +> is isolated to this one metric — but not to this one file: the sample table in +> `model/stock-flow/SF_SDM_SPEC.md` also reports 79% health for this account, so `0.7907` +> appears in two places and both would need correcting if the formula is authoritative. +> Confirm against `fincosys/models/stock_flow/system_dynamics_model.py` before relying on +> either value. + ## Observer Pattern for Cross-Model Communication The `BaseModel` class implements an observer pattern allowing models to notify @@ -103,7 +125,8 @@ When an entity changes in one paradigm: | PERSON_002 | - | Rynette Farrar | | PERSON_003 | - | Adderory (Rynette's Son) | | PERSON_004 | JF | Jacqueline Faucitt | -| PERSON_005 | DJF | Daniel James Faucitt | +| PERSON_005 | DF | Daniel James Faucitt | +| PERSON_006 | - | Linda (Bookkeeper, Rynette's sister) | | PERSON_007 | - | Danie Bantjies | | ORG_001 | RWD | Regima Worldwide Distribution | | ORG_002 | RST | Regima Skin Treatments CC | @@ -114,6 +137,10 @@ When an entity changes in one paradigm: | ORG_008 | REZ | Rezonance (Pty) Ltd | | TRUST_001 | FFT | Faucitt Family Trust | +Persons with fincosys code `-` have no fincosys entity code of their own (they are not +account holders in the FNB corpus); they are carried by revstream2 alias only. See +`registry/MASTER_ENTITIES.md` ("Key Non-Entity Persons") for the full PERSON_001-012 list. + ## Neon Sync Pipeline The fincosys membrane workflow Stage 6a orchestrates Neon sync: diff --git a/zonent/model/membrane-coa/MEMBRANE_COA_SPEC.md b/zonent/model/membrane-coa/MEMBRANE_COA_SPEC.md index 23a9deb..96cf9cb 100644 --- a/zonent/model/membrane-coa/MEMBRANE_COA_SPEC.md +++ b/zonent/model/membrane-coa/MEMBRANE_COA_SPEC.md @@ -9,7 +9,7 @@ of financial activity. The consolidation hub is **REZ (Rezonance)**. ## 4-Shell Structure ``` -┌──────────────────────────────────────────────────────────────────┐ +┌──────────────────────────────────────────────────────────────┐ │ ARENA (Shell 4) │ │ Code Range: 40100-69900 │ │ Entities: PORT, NEW (external parties) │ @@ -21,24 +21,32 @@ of financial activity. The consolidation hub is **REZ (Rezonance)**. │ │ Entities: RWD, VVA, FFT │ │ │ │ Treatment: INTERCOMPANY ELIMINATION │ │ │ │ │ │ -│ │ ┌──────────────────────────────────────────────────┐ │ │ +│ │ ┌────────────────────────────────────────────────┐ │ │ │ │ │ AGENT (Shell 2) │ │ │ │ │ │ Code Range: 10200-20200 │ │ │ │ │ │ Entities: RST, RSA, SLG, REZ, RZA, RZI, │ │ │ │ │ │ AYM, COR, RDH, RUK, KCH, KRN │ │ │ │ │ │ Treatment: INCLUDED in group consolidation │ │ │ │ │ │ │ │ │ -│ │ │ ┌──────────────────────────────────────────┐ │ │ │ +│ │ │ ┌──────────────────────────────────────┐ │ │ │ │ │ │ │ ARCHE (Shell 1) │ │ │ │ │ │ │ │ Code Range: 10100 │ │ │ │ │ │ │ │ Entities: DJF, JF, PF (directors) │ │ │ │ │ │ │ │ Treatment: EXCLUDED from consolidation │ │ │ │ -│ │ │ └──────────────────────────────────────────┘ │ │ │ -│ │ └──────────────────────────────────────────────────┘ │ │ -│ └──────────────────────────────────────────────────────────┘ │ -└──────────────────────────────────────────────────────────────────┘ +│ │ │ └──────────────────────────────────────┘ │ │ │ +│ │ └────────────────────────────────────────────────┘ │ │ +│ └────────────────────────────────────────────────────────┘ │ +└──────────────────────────────────────────────────────────────┘ ``` +> **Note on code ranges**: the shell code ranges above are indicative groupings from the +> 88-account REZ QBO chart of accounts and are **not disjoint** (Relatio's 10300-70400 +> band overlaps Arena's 40100-69900). Shell membership is never derived from a numeric +> range alone: it is determined by the explicit per-entity assignments in this document +> and `registry/ENTITY_XERO_MAPPING.md`, and — for transactions — by the rule-based +> classifier (`fincosys/membrane_coa/scripts/classify_with_reconciliation.py`), which +> assigns shells 0-3 by entity and counterparty classification, not by account code. + ## Entity Registry by Shell ### Arche (Personal Boundary) @@ -50,7 +58,7 @@ of financial activity. The consolidation hub is **REZ (Rezonance)**. ### Agent (Operational Core) | Code | Legal Name | Type | Country | -|------|-----------|------|---------| +|------|-----------|------|----------| | RST | Regima Skin Treatments CC | CC | ZA | | RSA | Regima SA Pty Ltd | Pty | ZA | | SLG | Strategic Logistics CC | CC | ZA | @@ -64,9 +72,22 @@ of financial activity. The consolidation hub is **REZ (Rezonance)**. | KCH | Kerchoonz Ltd | Ltd | UK | | KRN | Karen Morris | Sole Trader | UK | +> **Known model gap (RWW)**: `registry/MASTER_ENTITIES.md` lists RWW (Regima Worldwide +> UK) as an organization with an active MOC account (62836164880), but RWW carries no +> shell assignment in the source fincosys model (`data/ENTITY_XERO_MAPPING.json` has no +> RWW entry; account 62836164880 is mapped under RWD in Relatio). Whether RWW is a +> distinct Agent-shell entity or an alias of RWD's UK operation is an open refinement +> question for the model owner — do not assume either treatment in consolidation logic. + +> **Known model gap (FNB)**: `registry/MASTER_ENTITIES.md` lists FNB (First National Bank) +> as a financial institution, and it is the counterparty in the FEE cross-reference in +> `model/integration/CROSS_PARADIGM_SPEC.md`, but it carries no shell assignment here or in +> any registry. Its consolidation treatment is therefore undefined. Unlike the RWW gap above +> this one is not recorded upstream — it was identified in review of cogpy/zonent#9. + ### Relatio (Inter-Entity) | Code | Legal Name | Type | Significance | -|------|-----------|------|-------------| +|------|-----------|------|---------------| | RWD | Regima Worldwide Distribution Pty Ltd | Pty | Distribution hub - NO independent revenue | | VVA | Villa Via Arcadia No 2 CC | CC | Property rental - R22.8M capital extraction | | FFT | Faucitt Family Trust | Trust | Trust vehicle - R2.85M violations | @@ -103,6 +124,14 @@ Key elimination pairs: - VVA <-> Group entities (rental charges, member loans) - Trust <-> Beneficiaries (trust distributions, loans) +> Three of the four pairs above are quantified — RST<->SLG (R13M), VVA<->Group (R22.8M) and +> Trust<->Beneficiaries (R2.85M) — and `registry/ENTITY_XERO_MAPPING.md` supplies a fourth +> term that is **not** in the list above: REZ<->Group at R1.035M (IT services creditor). +> Those four total ~R39.7M against the stated R58.58M, leaving a ~R18.9M residual that +> corresponds to the one unquantified pair above, RST<->RWD. Note the terms are drawn from +> two documents, so the total is not reconstructible from this bullet list alone. Quantify +> the RST<->RWD leg before citing R58.58M as an auditable figure. + ## Neon Schema ```sql diff --git a/zonent/schema/NEON_SCHEMA_REFERENCE.md b/zonent/schema/NEON_SCHEMA_REFERENCE.md index 45ceb4d..4c5fe22 100644 --- a/zonent/schema/NEON_SCHEMA_REFERENCE.md +++ b/zonent/schema/NEON_SCHEMA_REFERENCE.md @@ -13,21 +13,81 @@ ## Schema Overview | Schema | Tables | Purpose | -|--------|--------|---------| +|--------|--------|----------| | `entity_relation` | entities, relations | ER-ABM agent graph | | `event_timeline` | events, state_machines, state_transitions, transactions | Discrete event simulation | | `stock_flow` | variables, flows, feedback_loops, simulation_history | System dynamics | | `hypergraph` | nodes, hyperedges, symbolic_rules, type_hierarchy | Neuro-symbolic inference | | `integration` | entity_mappings, cross_references, analysis_snapshots | Cross-paradigm binding | | `consolidated_accounts` | accounts, transactions, elimination_entries, membrane_summary, qbo_entity_mapping | Group consolidation | +| `fund_flow` | edges, anomalies, entities | Forensic fund tracing | | `accountant_records` | trial_balances, annual_financial_statements, invoices, sars_vat_documents | Forensic audit | +> **Note**: the seven core schemas enumerated in `CLAUDE.md` end with `fund_flow`, whose +> tables are confirmed live in the fincosys audit cycles (see +> `fincosys/audit/AUDIT_REPORT_2026-05-09.md` and the KSM cycle reports probing +> `fund_flow.edges` / `fund_flow.anomalies` / `fund_flow.entities`). `accountant_records` +> is an additional forensic-audit ingestion schema documented here; verify it against the +> live Neon project before building against it. + ## Extensions Required ```sql CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; CREATE EXTENSION IF NOT EXISTS "pgcrypto"; ``` +> **The DDL below is a reference, not a runnable script.** Tables are created +> schema-qualified, but the accompanying index and foreign-key statements use bare table +> names, reproducing the upstream fincosys source. None of these tables exist in `public`, +> so running the file top-to-bottom under a default `search_path` will fail. `transactions` +> is additionally declared in two schemas (`event_timeline` here, and `consolidated_accounts` +> whose DDL lives in `model/membrane-coa/MEMBRANE_COA_SPEC.md` — itself unqualified, so it +> shares this problem), so an unqualified reference to it is ambiguous as well as +> unresolvable. Qualify the names when provisioning. + +--- + +## Access Control + +> **Status: requires policy review before provisioning.** + +Every schema in this database holds forensic financial records, communications evidence, and +legal material relating to named individuals in active High Court proceedings (case +2025-137857 — sourced from `cogpy/ad-res-j7`, the case-management repository for this +matter; this file is not the origin of that number). + +The DDL below specifies **no access control whatsoever** — no +`ALTER TABLE ... ENABLE ROW LEVEL SECURITY`, no policies, no grants. Whatever subset of it +you successfully provision is readable in full by any role holding a connection string, +including `evidence` (with OCR text), `timeline_events`, `cases`, and +`integration.analysis_snapshots`. + +Requirements for any deployment provisioned from this reference: + +1. **Enable RLS on every table in every schema listed in the Schema Overview above.** Two of + them have no DDL in this file: `consolidated_accounts` is defined in + `model/membrane-coa/MEMBRANE_COA_SPEC.md`, and `accountant_records` is not transcribed + anywhere in this repo — so this requirement spans documents and cannot be satisfied by + reading this file alone. It also covers the unqualified tables in the Enhanced Schema + section below. Note the Schema Overview's own caveat: `CLAUDE.md` enumerates seven schemas + and its Purpose line says five, so the exact set is unsettled. This requirement is + deliberately phrased against *whatever schemas actually exist* rather than a fixed count, + so a miscount cannot leave one unprotected. +2. **Default deny.** RLS with no policy denies all access to non-owner roles; add policies + explicitly rather than relying on a permissive default. +3. **Separate the service role from human roles.** Sync pipelines (fincosys Stage 6a) need + broad write access; analyst and reporting roles should not inherit it. +4. **Do not grant `authenticated` blanket read** over evidence or accountant records. + Scope reads to the entities a principal is authorised for. +5. **Audit reads, not just writes.** For evidence tables, read access is itself material to + chain of custody. + +The concrete policy set is a decision for whoever owns the Neon project — it depends on the +role model in use (Neon native roles vs a Supabase-style `service_role`/`authenticated` +split), which is not recorded anywhere in this repo. It is deliberately not invented here, +because a wrong-but-runnable policy on forensic evidence is worse than an explicit gap. +Replace this paragraph with the agreed `CREATE POLICY` set once settled. + --- ## ENTITY_RELATION Schema @@ -383,6 +443,13 @@ CREATE INDEX idx_snapshots_type ON analysis_snapshots(analysis_type); ## Enhanced Schema (ad-res-j7) +> **Owning schema not established.** The tables in this section — together with +> `entity_relationships` and `entity_versions` above — are declared without schema +> qualification and appear in no row of the Schema Overview, so it is not recorded which +> schema they belong to. The Access Control section requires RLS on `evidence`, +> `timeline_events` and `cases`; that requirement **cannot be actioned until their owning +> schema is established**. Resolve against the deployed project before provisioning. + ### evidence ```sql CREATE TABLE evidence ( @@ -478,7 +545,7 @@ $$ LANGUAGE plpgsql; ## SQL Batch Files (fincosys) | File | Lines | Content | -|------|-------|---------| +|------|-------|----------| | 01_entities.sql | 2,645 | Entity INSERT statements | | 02_relations.sql | 249 | Relation INSERT statements | | 03_events.sql | 3,740 | Event INSERT statements |