{
 "protocol": "AI answers over company data, orchestrated round: pipelines in both directions under an orchestrator, broken on a declared schedule and by held-out breaks written blind",
 "status": "Frozen before any break was run and before any outcome was computed. Earlier rounds, their files and results are unchanged. No model is called and nothing costs money.",
 "design": "DESIGN-orchestrated.md",
 "question": "When one of six common breaks hits an hourly warehouse loop (CRM, billing and product data landed in DuckDB, modelled in dbt, two computed fields written back to the CRM under Dagster), how many wrong values reach the CRM, how many accounts are wrongly acted on, how many simulated hours pass before a check stops the sync, and what does each guard cost in false stops on clean runs? The same for breaks an independent author writes without seeing the guards.",
 "world": {
  "generator": "orchestrated/world.py",
  "customer_accounts": 2400,
  "prospects": 300,
  "history_days": 35,
  "clock_hours": [
   0,
   59
  ],
  "warm_up_hours": [
   0,
   23
  ],
  "break_start_hours": [
   24,
   35
  ],
  "window_hours": 24,
  "synthetic": true
 },
 "orchestrator": {
  "tool": "Dagster, in process on a simulated clock (orchestrated/run.py)",
  "definitions": "orchestrated/definitions.py",
  "dbt_project": "orchestrated/dbt_project"
 },
 "acted_on": "An account is acted on when one of three CRM automations fires for it (at_risk_task, collections_email, win_back_email); wrongly acted on when the true value at that hour was not in the state that fires it. Defined in DESIGN-orchestrated.md, \"The CRM and what acted on means\".",
 "arms": {
  "guarded": "every check blocking, dbt tests at error severity, as-of guard on",
  "unguarded": "the same checks recorded but non-blocking, dbt tests at warn severity, as-of guard off"
 },
 "guards": [
  "freshness policy per raw table (fails when more than 3 hours old)",
  "schema contract per raw table",
  "dbt data tests mapped to asset checks",
  "change-volume breaker on sync/plan (max(20, 3 x the most in the previous 24 writing runs), learning period of 6 runs)",
  "read-back reconciliation on sync/plan",
  "as-of guard inside the sync (drops older values, stops nothing)"
 ],
 "breaks": {
  "grammar": "orchestrated/grammar.md",
  "injector": "orchestrated/faults.py",
  "declared": {
   "file": "orchestrated/breaks/declared.json",
   "count": 6
  },
  "held_out": {
   "slot": "reserved in this protocol before any break was run",
   "file": "orchestrated/breaks/heldout.json",
   "sha256": "c95501966c8ca810636802e0069ceea21ab156bab92db50bbb775c85869887a0",
   "count_requested": 12,
   "rule": "The author receives only the author bundle below, runs once read-only from a clean folder holding only those files, and its output file is copied byte for byte to the file above; its sha256 is recorded here in a commit before any break run. Breaks the grammar cannot express are reported with the reason, never dropped. Scored by the same code as the declared breaks and reported apart, never pooled.",
   "received": "Filled in the reserved slot after the author finished and before any break run: 12 breaks H01 to H12; H12 carries the author's own \"not_expressible\" note. The author's brief and record of every file it read are _private/orchestrated-held-out-author/heldout-author-brief.txt and heldout-author-record.txt; the bundle it received is orchestrated/author-bundle/ (hashes as above)."
  },
  "author_bundle_sha256": {
   "business.md": "e8e87dc6144f13e81c66f2033a452219b7f08ed24ba2c277308e90eadce49b51",
   "clock.md": "248f3a8191215e0ea84efccd618db656953f2db63f9a8021ba0f3fa76907d7aa",
   "grammar.md": "2b608a391b062ce4da087c4eb8f3b44c80b839650854c7b01d1ef9ae3afb8ed8",
   "models.md": "29a5fbbbd0ecc18f7b9b79263cba837d9c696c8ed6ea80690451ce0435262442",
   "source-schemas.md": "f325e0431da5768634fad1cf1bb27ff25340b66dfd88eff8accc1bb8637badb1",
   "sync-targets.md": "51dc496094931db11d9b6c1fc8d75c291ec4e500b9a57777a57a37735db93843"
  },
  "author_bundle_contents": "business description, source schemas, dbt model list (one line each), the sync target fields, the simulated clock range, the fault grammar; no checks, thresholds, freshness policies, guards, declared schedule or predictions"
 },
 "runs": {
  "clean_guarded_seeds": [
   1,
   30
  ],
  "clean_unguarded_seeds": [
   1,
   3
  ],
  "break_seeds": [
   1,
   2,
   3
  ],
  "break_runs": "both arms, each from its clean twin state at the end of hour 23, hours 24 to start + 23",
  "plan": "python -B -m orchestrated.run make-plan <runs.json> [orchestrated/breaks/heldout.json]",
  "method_failures": "a step failure that is not a check failure undoes that hour and stops the run; it is logged to method_errors.jsonl, never scored, and reported"
 },
 "measures": "orchestrated/measure.py: wrong values written, accounts wrongly acted on (and all acted on), missed actions, CRM field-hours wrong and accounts wrong at window end, hours until a check stopped the sync (attributed against the clean same-arm twin), first hour each check fails, rows held back by the as-of guard; false stops per guard family over 30 clean guarded runs, hours 24 to 59, with Clopper-Pearson 95% intervals over runs and a run-cluster bootstrap (10,000 resamples, seed 20261028) for hours stopped",
 "analysis": "per break, arm and seed, and the range over three seeds; never pooled across breaks or across the declared and held-out sets; a difference between arms is clear for a break when it has the same sign in all three seeds; worked example rule fixed in the design",
 "predictions": "DESIGN-orchestrated.md, \"Predictions (declared before any break was run)\"; each reported as held, missed or untestable against its band",
 "environment": {
  "python": "3.12.3",
  "lock_file": "orchestrated/requirements.lock",
  "lock_inputs": "orchestrated/requirements.in",
  "key_versions": {
   "dagster": "1.13.27",
   "dagster-dbt": "0.29.27",
   "dbt-core": "1.12.6",
   "dbt-duckdb": "1.11.1",
   "duckdb": "2.0.0"
  },
  "threads": "OPENBLAS_NUM_THREADS=OMP_NUM_THREADS=MKL_NUM_THREADS=1, dbt threads 1"
 },
 "one_command": "bash portfolio/ai-answers-over-company-data/orchestrated/demo.sh <scratch folder outside the repo>",
 "pre_freeze_checks": "Mechanics tests on small fixtures (orchestrated/tests, 10 tests, including each inbound grammar operation on a four-row table and the sync, CRM and guard rules; no pipeline run, no check evaluated on a break). Clean development runs on seeds 101 and 102 only (not study seeds), short clean smoke runs of the same seeds, and one run of the one-command demo (clean seed 101). No break was run through the pipeline and no measure was computed on a study seed. Changes made after development runs are listed in the design, \"Development runs (disclosed)\".",
 "outputs": {
  "runs": "outside the repo (ORCH_SCRATCH)",
  "results": "orchestrated/results/",
  "page": "a new page of this study, linked from index.html and outbound-sync.html"
 },
 "file_sha256": {
  "DESIGN-orchestrated.md": "2c127b4d6e8891fdf950da3485b5b50d7afe33e1ea30140fc2ad96fc1d2b2fd0",
  "orchestrated/breaks/declared.json": "996d42cf4bdecc5ece8ab1dd03854d5fe42b896270a801da0a9377a333fe8207",
  "orchestrated/crm.py": "1395bd70907bcc10db436dbc60f25ca73b12f2fece5dda4f58505ed7e0ca2aab",
  "orchestrated/dbt_project/dbt_project.yml": "99ee0cb1c436b7dfdb039a47f45d033a43f7b183f5793cf3d72bd53c87f623de",
  "orchestrated/dbt_project/macros/generic_tests.sql": "e3965a723685922b7a5d54b44d6e17e390616f52636d4c2461e4e27eb86fb3f6",
  "orchestrated/dbt_project/models/intermediate/int_account_billing.sql": "90d4ba1b0c13362223df906e0a7584e04532fa208f3fa56975c728de276d50bb",
  "orchestrated/dbt_project/models/intermediate/int_account_usage.sql": "9cd19499858dd0fc8daf50e64142a737ed42017a4fad51fcb3ce27903f32565a",
  "orchestrated/dbt_project/models/marts/mart_account_pipeline.sql": "f55e730906eb99eda13c5f9aff02b8976860e2f3efd2f2098c5109f04ea8e6b1",
  "orchestrated/dbt_project/models/marts/mart_account_scores.sql": "4b519f825ee1305c04d1a3c33022c1ffb3d829d5e381188a4903e0e71c04ab32",
  "orchestrated/dbt_project/models/marts/mart_account_sync_hourly.sql": "94da19dd2ebed2c8cd4ea0f8cf6c14a85bbfe88ac021eecbdfaac323e388c5b1",
  "orchestrated/dbt_project/models/schema.yml": "065fa9459926f7ac499f602edc1ec2e883dfed011cef3945fac22c2334bf780a",
  "orchestrated/dbt_project/models/sources.yml": "259ad18cc8b4cc43e93fbc93d391ef45d1d3055c8dfa24f2ab39ee4b45ac2a2f",
  "orchestrated/dbt_project/models/staging/stg_billing__customers.sql": "da2443ca19225b79d3142bbf663c2886095982630ad6e8b7b6c2fc08ed706ca2",
  "orchestrated/dbt_project/models/staging/stg_billing__invoices.sql": "41057730cdcd07b73cc038a439639452ff4400cfa182c822293f42e955a973fc",
  "orchestrated/dbt_project/models/staging/stg_billing__payment_events.sql": "d2b0d48ca8310090d694f374122c742cd98962884cec61178fa2db9204a7f96b",
  "orchestrated/dbt_project/models/staging/stg_billing__refund_events.sql": "0961af6b9bce7e12a49b6d8992bd269f26eef1cd94680dc7d44b0ca1f4229560",
  "orchestrated/dbt_project/models/staging/stg_billing__subscriptions.sql": "f088cd07fcb46ae00efff974c564b46a7310f6e95840a8746324b4607632447b",
  "orchestrated/dbt_project/models/staging/stg_crm__accounts.sql": "18586adb3050fdec5052097db74ca20291856b773ece81064fe7db34bb02d7ff",
  "orchestrated/dbt_project/models/staging/stg_crm__contacts.sql": "26549c02177ec661e96af81eb8c8a39c6859d17148476c5626e052ae102ae0c1",
  "orchestrated/dbt_project/models/staging/stg_crm__opportunities.sql": "5515c7db7b8baf1d09384d820a3c0232216951019e3b5346787ef0639594c709",
  "orchestrated/dbt_project/models/staging/stg_product__bookings.sql": "e7fa3b06da2a11771bb34ba398f1fdb3492160302a760aaa8ba381f80f1af43b",
  "orchestrated/dbt_project/models/staging/stg_product__locations.sql": "9476945a225ba07c69ed0141362f96004851611fea01bc52e24350518204eb2f",
  "orchestrated/dbt_project/models/staging/stg_product__staff.sql": "1e1d6d7b8005719ec55bd473c765ae05abec93479edad41f1b90c346a7f81131",
  "orchestrated/dbt_project/profiles.yml": "63456e4b5bbdf98b87d1c3982aebb3c6e813468bc5844914e7dc9433f96b5760",
  "orchestrated/definitions.py": "4b54e61d0e8fd45bd4bbe93680cafce0d700c536410b2c65b205e5dab8f804ac",
  "orchestrated/demo.sh": "51dc75b1c43c2f6365efaaaa87e13456ff18aac7f3cda4c11d55d4bf15175ee9",
  "orchestrated/faults.py": "a78961e86a5dc097421064a42daa401a9f153cd1722efa0ddf3e619a0b3f48a8",
  "orchestrated/grammar.md": "2b608a391b062ce4da087c4eb8f3b44c80b839650854c7b01d1ef9ae3afb8ed8",
  "orchestrated/guards.py": "b606bae0d47aae67a2b546de61c93e438192b72fa8f55fd8076492c5c23191ee",
  "orchestrated/measure.py": "0186dc1b4ab60a683fc8cd545d29c5a1aca514855e11e60a47b2e7acf3528cba",
  "orchestrated/requirements.in": "0c645de65e29dc2a24cafd74edb71c360e3855df50728f77fe272e8bf7d333fb",
  "orchestrated/requirements.lock": "f38cd5a91ea3fe7394b77e42cff13d03c727c030df16d357a79284a1444b4313",
  "orchestrated/run.py": "e0eb28c62e2b2004e8d049a0d004a2931139ab13f9a2a02d43f6252a021cd851",
  "orchestrated/sources.py": "ecfe1ec5dfda935f3d31468a9356f4039cc03f66405a6649eb15ead5b635fdf8",
  "orchestrated/sync.py": "98c17cb55b77c244365a76420a7d603b1f87789e93c3370f45eb694822db187a",
  "orchestrated/tests/test_mechanics.py": "9a6e351d20285b5369f14c8f7cadaa48569043cb2ebbbf3025c2f9d173e43420",
  "orchestrated/world.py": "b0fb4161cfe3e1f3a0cd738caeb9a799ef99e82357606b0f0d52fb5dadb30228"
 },
 "changes_to_the_protocol": [
  {
   "change": 1,
   "made": "after the held-out breaks arrived and before any break was run",
   "what": "Reading the injector against the held-out operations showed that any operation without a source (skip_runs, backfill_sync, rerun and the CRM operations) would have crashed the extract hook while active, and rerun (which has no from_hour) would have crashed every hook. The extract hook now considers only extract operations, and an operation without from_hour is never active by window. A mechanics test now applies every break of both files to a three-row world and a fake CRM for every hour (no check evaluated). No measure, threshold, guard or break changed.",
   "file_sha256": {
    "orchestrated/faults.py": "3c9b391a7f85a9b310a094fca3609db8b362958b25cafb50cb6ecea49c646de3",
    "orchestrated/tests/test_mechanics.py": "bce4cd349083058418d948fb234fbba4ae732a853540ec7ec13d0dc0a44077bf"
   }
  },
  {
   "change": 2,
   "made": "after the held-out breaks arrived and before any break was run",
   "what": "H12 carries the author's own \"not_expressible\" note (the grammar cannot drop only successful payment events). It is reported as not expressible with the author's reason, and its closest operations, as the author wrote them, are run and scored apart from the eleven expressible breaks. Every held-out operation passed the grammar validator (orchestrated/faults.py validate); nothing was dropped or rewritten."
  },
  {
   "change": 3,
   "made": "while the runs were in progress, before any result was computed or read",
   "what": "Wording only: run-time phrases removed from the design (two sentences), the demo script's comment and a docstring in orchestrated/definitions.py, because public files carry no timings. No rule, threshold, measure, prediction or code path changed.",
   "file_sha256": {
    "DESIGN-orchestrated.md": "7cf4f182c21bc91e91e3af2390185edd800a2ef0dc59f36175bb72e7958bf853",
    "orchestrated/demo.sh": "43e516d9d1f8889571f59e682d9c3408ed83b886537b9c1dd6961146b4cadfe8",
    "orchestrated/definitions.py": "2abc60d22c93a1e30652de5130fc7f3a6f6cbead17d7aa88b69b77ba927244b6"
   }
  },
  {
   "change": 4,
   "made": "after the results: the first scoring of all 108 break runs had been computed and seen before the fault was found",
   "what": "The first scoring was invalid. The driver copied each clean twin's hour-23 state without DuckDB's write-ahead log, so every break run started from a warehouse as of hour 19 beside a CRM as of hour 23, and the read-back check stopped every guarded break run from its first hour. Fix in orchestrated/run.py: checkpoint the warehouse before copying it, and copy any write-ahead log left. The six hour-23 snapshots were made again by rerunning hours 0 to 23 of each clean twin (checks and CRM history identical to the original clean runs), and all 108 break runs were run again from them and scored by the same code. The clean runs were unaffected (no read-back failure in any of the 33). The first scoring and its run folders are kept privately (_private/orchestrated-invalid-first-scoring/), outside every score. No prediction band, guard, threshold, measure or break changed. export.py now uses the site assembler's company matcher (ruling D63) in place of its own any-case match.",
   "file_sha256": {
    "orchestrated/run.py": "4101b55a113f7a0176722ed358d605a672e52118b952d794cc3fdf1ed27279ae",
    "DESIGN-orchestrated.md": "3250e4429795ebf3ab73dd73a5c2505e1e6f7ee5e5abd51f3c6777acfe54635d",
    "export.py": "813f11eef6bf173c527d67dc151b5b15c43168a54660abe8d7d2b189431b24b3"
   }
  },
  {
   "change": 5,
   "made": "after the results: during the rerun of the 108 break runs that followed Change 4",
   "what": "The run driver opens a source warehouse to checkpoint it only when a write-ahead log is present; a snapshot is already checkpointed, so runs starting from one shared snapshot no longer contend for its write lock (those runs had stopped before their first hour). Runs cut off part-way (85 after a machine crash, 23 after a stalled session, 3 whose last hour was interrupted when a chunk was stopped) were discarded whole and run again from the start; no partial run is scored. No prediction band, guard, threshold, measure or break changed.",
   "file_sha256": {
    "orchestrated/run.py": "41d0e208f7bcfed25e348782cde9177ce1c284d94368835113bf23c63fd052d4",
    "DESIGN-orchestrated.md": "56384e28faf22c27075919b5e0231e069d2fd8b030062b99af388b9460542db4"
   }
  }
 ],
 "file_moves": [
  {
   "made": "after the results, on review",
   "what": "The independent author's brief and run record moved from orchestrated/breaks/ to _private/orchestrated-held-out-author/ (git mv, content unchanged); the path in breaks.held_out.received was updated to match. No hash in this protocol covers either file."
  }
 ]
}
