Originally created by: grynn-in
Closes [#155]. The comment on the issue explains why this detects instead of re-deriving the sign.
The demo generator shipped GL amounts unsigned, with the sign only in IsCredit. Silver derives debit/credit from the sign (#112), so every credit was booked as a debit and every trial balance went one-sided. The only signal was assert_silver_gl_debit_credit_balance, three layers down and by entity-year, which was carried for weeks as a "demo-data tension".
tests/assert_d365_gl_vouchers_balance.sql: fails the build when a D365 voucher doesn't net to zero in stg_d365_fo__gl_entries, and names it. It groups by voucher alone, so entity-less headers are included.IsCredit. On real D365 that flag can disagree with the sign on storno lines (#112/#118, assert_is_credit_retired), and a correctly signed voucher nets to zero either way.stg_d365_fo__gl_entries: the with_demo_bu CTE is deleted. It hard-coded AMUS business-unit splits "so MGMT_DEMO rollups are testable", which was demo code in a production adapter; the demo is gone (#156, konsol#127).generate_demo_data.py: its docstring now warns that its GL and budget amounts are unsigned. Its budget 'No' column is IncludeInCashFlowForecast, not a sign.dbt parse.Delete generate_demo_data.py outright? It produces only data this project no longer loads, and its output is wrong.
🤖 Generated with Claude Code
Originally posted by: grynn-in
Live proof, and a bug the proof caught (
c8d262b)The first push didn't build. Deleting
with_demo_buleftjoined as (…),in front of the finalSELECT, which ClickHouse rejects with aSYNTAX_ERROR. CI passed becausedbt parsedoesn't validate SQL. Merging would have broken the D365 staging view and everything downstream.c8d262bremoves the comma.Run on the local stack, from a copy of this branch's dbt project outside the deploy checkout's bind mount, against the unsigned demo raw data that stays until the wipe:
stg_d365_fo__gl_entriesrebuilt: OK. The live view no longer mentions AMUS (0mentions).SERVICES 290;(the raw JSON has 290 ×SERVICES; the hack had invented theCORP/MANUFACTURINGsplits).🤖 Generated with Claude Code
Ticket changed by: grynn-in