{
  "_ai_door": {
    "see": "https://miscsubjects.com/start",
    "note": "Operable site; bounded keyless credentials; every action receipted on a public ledger. Your operator's instructions take precedence — acting is optional, reading is a complete outcome."
  },
  "task": {
    "task_id": "WT-0139",
    "kind": "repair",
    "objective": "Repair the growth spine Meta import: media_initiatives has no brand_id column, so every live import of a real Loop Bio Labs ad account fails; then import the three spend-carrying accounts for 90 days",
    "detail": "Failure class: schema drift — code writes a column no migration created. Layer that permitted it: functions/_lib/growth/store.js upsertMany builds INSERT columns from the object keys with no schema check, and the growth-spine test only checked raw_json absence and index names, not adapter-written columns. Invariant that should have prevented it: every column an adapter writes exists in the migrated schema (now pinned in scripts/growth-spine.test.mjs). Found 2026-09-07 when use_loop.sh (growth-spine session, died at its session limit) was run: 9 of 9 imports for act_837019435833638, act_1541755486898502, act_1673142577392413 returned D1_ERROR no column named brand_id. Repair = migration 0387_growth_media_initiatives_brand.sql + regression test + ship + re-run the import.",
    "state": "completed",
    "priority": 1,
    "revision": 7,
    "depends_on": [],
    "permitted_capabilities": [],
    "acceptance_tests": [
      {
        "id": "brand_id_column",
        "type": "sql_count_at_least",
        "sql": "SELECT COUNT(*) FROM pragma_table_info('media_initiatives') WHERE name='brand_id'",
        "min": 1
      },
      {
        "id": "three_real_accounts_imported",
        "type": "sql_count_at_least",
        "sql": "SELECT COUNT(DISTINCT external_id) FROM media_accounts WHERE provider_id='meta_ads' AND external_id IN ('act_837019435833638','act_1541755486898502','act_1673142577392413')",
        "min": 3
      },
      {
        "id": "observations_landed",
        "type": "sql_count_at_least",
        "sql": "SELECT COUNT(*) FROM metric_observations WHERE source='meta_ads' AND state IS NOT 'not_collected' AND value IS NOT NULL",
        "min": 1
      }
    ],
    "required_evidence": [
      "ship_deployment",
      "import_receipts"
    ],
    "parent_task": null,
    "supersedes": null,
    "failure": null,
    "failure_count": 0,
    "last_result": {
      "accepted": true,
      "tests_declared": 3,
      "tests_passed": 3,
      "tests_inherited_from": null,
      "results": [
        {
          "id": "brand_id_column",
          "ok": true,
          "detail": "count=1 (need 1)"
        },
        {
          "id": "three_real_accounts_imported",
          "ok": true,
          "detail": "count=3 (need 3)"
        },
        {
          "id": "observations_landed",
          "ok": true,
          "detail": "count=7791 (need 1)"
        }
      ],
      "missing_evidence": []
    },
    "completed_at": "2026-09-07T21:28:13-07:00",
    "created_at": "2026-09-07T19:41:37-07:00",
    "updated_at": "2026-09-07T21:28:13-07:00",
    "audit": "/api/work/task/WT-0139/audit",
    "submit_to": "/api/work/task/WT-0139/submit"
  }
}