Skip to main content

Developer Overview

Repositories, layout, versions and conventions. Verified against konsolidat 54d072a, konsol 3e220ba8 and konsol_cli on 2026-11-05.

Three repositories​

RepositoryPurposeTests
grynn-in/konsolidatWarehouse: dbt project, ClickHouse DDL, Docker stack, deploy.sh, Airbyte sourcesGitHub Actions dbt checks (parse, gold-domain coverage, DDL unit tests, a full build on a throwaway ClickHouse, fixture gate, TB-only first build) and deploy guards
grynn-in/konsolFrappe v16 app: doctypes, API, close app, Excel add-inHost tests scripts/run-host-tests.py (pytest, no bench), cd close-ui && yarn test (node tests), live checks on the running stack
grynn-in/konsol-cliCLI and MCP serverpytest tests/

The deploy-owned checkout repo/docker/frappe/konsol is a copy made by deploy.sh; never edit it.

konsolidat layout​

konsolidat/
├── dbt_project/
│ ├── models/
│ │ ├── staging/ # 30 views: canonical/ (7), d365_fo/ (16), erpnext/ (7); _staging__sources.yml
│ │ ├── bronze/ # 16 tables
│ │ ├── silver/ # 10 tables
│ │ └── gold/ # 45 tables, tagged domain:*
│ ├── macros/ # 16 files, 70 macros
│ ├── tests/ # 144 singular tests (139 + 5 in tests/staging)
│ └── dbt_project.yml # vars incl. the konsol-managed block (dimensions, measures)
├── clickhouse/
│ ├── init-db.sql # six databases
│ └── raw-schema.sql # epm_raw tables for trial-balance submissions
├── docker/
│ ├── frappe/ # Dockerfile (python:3.14-slim, Node 24, Frappe version-16), entrypoint, konsol/ (deploy-owned copy)
│ ├── configurator/ # site setup + bench migrate
│ ├── backup/backup.sh
│ └── caddy/Caddyfile
├── docker-compose.yml # 11 services; docker-compose.cluster.yml, docker-compose.v16.yml
├── deploy.sh # 5 steps + FX pre-check; backup / restore / status / logs / down
├── scripts/ # check-frappe-branch.sh, setup-airbyte.sh, ci_full_build.py, fixture_gate.py,
│ # check_gold_domains.py, extract_assertion_rules.py, ...
├── source-d365-fno/, source-erpnext/ # Airbyte source connectors
├── tests/ # Python unit tests run by CI
├── docs/ # MkDocs tree (second docs tree; see the roadmap)
├── excel/ # two sample workbooks and a README saying they are stale
└── excel-addin/README.md # pointer: the add-in moved to konsol

There is no seeds/ directory (konsolidat 85dff3b). The Makefile is stale (it names services that do not exist); use deploy.sh and docker compose.

konsol layout​

konsol/
├── konsol/
│ ├── epm/doctype/ # 25 doctypes: Entity, EPM Fiscal Year, Main Account, Dimension, Measure, Dataset, Scenario, Budget *, ...
│ ├── consolidation/doctype/ # 27 doctypes: Consolidation Group, Ownership Period, Group Exchange Rate, Consolidation Journal,
│ │ # Business Combination/Disposal, Trial Balance Upload/Submission, Assertion Run, Close Settings, ...
│ ├── consolidation/report/ # Desk reports: Period Close, Close Assertions, Consolidated Statement, Statement Drill, My Work
│ ├── pipeline/doctype/ # 13 doctypes: EPM Settings, Connector*, Pipeline*, Build Approval/Model/Scope
│ ├── close/ # 18 *_api.py (42 whitelisted methods) + *_model.py
│ ├── orchestrator/ # pipeline DAG runner, cron, reapers, fx, resources
│ ├── api.py # epm_value, epm_batch, budgets, hierarchies, add-in auth, report templates
│ ├── clickhouse.py # HTTP client, write-through, reconcile_all, sync watermark
│ ├── cli_api.py, config_service.py, schema_apply.py, dbt_config.py
│ ├── chart_upload.py, group_chart_model.py, group_rates.py, tb_bulk.py, tb_bulk_model.py
│ ├── entity_permissions.py, excel_addin_auth.py, excel_addin_cookies.py
│ ├── hooks.py, install.py, patches/, fixtures/ (reference data only), defaults/
│ ├── public/excel-addin/ # manifest.xml, manifest.demo.xml, functions.json, functions.js, index.html
│ ├── www/close.html, close.py # serves the close app
│ └── tests/ # pytest host tests
├── close-ui/ # Vue + Vite SPA; src/nav.js lists the 11 screens; *.test.mjs beside each module
├── docs/ # excel-addin.md, design/
├── CLAUDE.md, HANDOFF.md # working agreement and the dated status log
└── scripts/run-host-tests.py

Technology stack​

LayerTechnologyVersion (2026-11-05)Where pinned
WarehouseClickHouse24.8docker-compose.yml image tag
Transformationsdbt-core, dbt-clickhouse1.12.3, 1.9.3.github/workflows/dbt-checks.yml; the image installs the latest into the bench venv
ApplicationFrappev16 (version-16)docker/frappe/Dockerfile, scripts/check-frappe-branch.sh
RuntimePython, Node3.14, 24Dockerfile (python:3.14-slim-bookworm)
Frappe database, cache, queueMariaDB, Redis10.11, 7docker-compose.yml
ProxyCaddy2docker-compose.yml
Close appVue, Viteper close-ui/package.jsonclose-ui/
ExcelOffice.js custom functions, shared runtimemanifest 2.0.2.0public/excel-addin/manifest.xml
ELT (optional)Airbyte via abctl—scripts/setup-airbyte.sh

A native bench is not needed; everything runs in containers. If you run one, it needs Python 3.14 and Node 24.

Conventions​

dbt model naming​

{layer}_{domain}[_{qualifier}]

bronze_general_journal_account_entries, silver_gl_entries, gold_trial_balance, gold_pnl_quarterly, gold_consolidated_ytd. Staging adapters are stg_{erp}__{entity}; canonical staging models are stg_{entity}.

Schemas​

LayerClickHouse database
Raw (submissions, Airbyte)epm_raw
Staging views and konsol reference tablesepm_staging
Bronze / Silver / Goldepm_bronze / epm_silver / epm_gold

SQL style​

  • Lowercase keywords, snake_case identifiers, dim_ prefix for dimensions.
  • Use the db_adapter.sql macros (cast_to_string, cast_to_decimal128, build_date_from_year_period) rather than raw ClickHouse functions.
  • Use the dimension macros (dim_select, dim_group_by, dim_harmonize_select) rather than naming dimension columns; a site may declare zero dimensions and must still build (konsolidat#220).
  • Read reference data with source('epm_staging', ...); never add a seed.
  • Gold models carry a domain: tag and are registered in Build Model (scripts/check_gold_domains.py enforces it).

Materialization​

LayerMaterializationEngine
Stagingview—
Bronzetable (2 incremental)MergeTree
SilvertableMergeTree
Goldtable (3 incremental by period, 2 views)MergeTree

Consolidation models are incremental by period: a scoped build deletes and rebuilds the period and entity scope it names and keeps every other slice (konsolidat#116, #154).

Tests​

Every gold model has at least one test. Singular tests are assert_{what}.sql and return the rows that break the rule; 22 of 144 run at warn, which the close app shows as Amber. scripts/extract_assertion_rules.py turns the suite into a readable rules document.

konsol rules that bite​

From konsol/CLAUDE.md:

  • Any whitelisted method that writes is @frappe.whitelist(methods=["POST"]); a GET rolls back at the end of the request.
  • Never commit inside a document hook; use frappe.db.after_commit.add(fn) or frappe.enqueue(..., enqueue_after_commit=True).
  • Write-through to ClickHouse happens after the commit, once per transaction; delete sync goes in after_delete.
  • Keep _REFERENCE_TABLE_DDL in clickhouse.py identical to clickhouse/init-db.sql.
  • Submit is the approval: Draft → Pending Approval → Approved (submitted); Reject returns to Draft.
  • konsol/fixtures/ is force-reimported on every migrate and holds reference data only.
  • On v16, a has_permission hook must return exactly True; get_all orders by creation, so give order_by.

Key patterns​

Dimension auto-propagation​

select
data_area_id,
{{ dim_select('gl.') }}, -- gl.dim_cost_center, gl.dim_department, ... from the konsol-managed vars block
{{ measure_select() }} -- sum(debit_amount) as period_debit, ...
from {{ ref('silver_gl_entries') }} as gl
group by
data_area_id,
{{ dim_group_by('gl.') }}

Governed reference data​

select * from {{ source('epm_staging', 'group_exchange_rates') }}

Each source table is written by one konsol doctype and stamped in epm_staging.sync_watermark. The test assert_staging_not_stale fails the build when a table is EMPTIED or LAGGING.

Governed builds​

A data change (trial-balance submit, journal approval, rate approval) calls konsol.tasks.queue_consolidation_build, which creates a Build Approval for a scope; approval runs dbt inside the image with --select on the scope's models. Schema changes trigger a full refresh.

Next steps​