From ef1eb33506246210c7d7d6cf25092d7789f4007a Mon Sep 17 00:00:00 2001 From: Peli de Halleux <4175913+pelikhan@users.noreply.github.com> Date: Fri, 30 Oct 2026 06:42:19 -0700 Subject: [PATCH 1/5] Add configurable company ingestion stress engine and PR calculator Generate synthetic AW evidence for configurable company workloads, exercise real PostgreSQL ingestion and query paths, and expose a declarative dashboard calculator with opt-in CI coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/cgo.yml | 4 + .github/workflows/company-stress.yml | 121 +++++++++ .../site/dashboard-fragments/simulators.json | 229 +++++++++++++++- dashboard/site/scripts/build.mjs | 3 + .../site/src/agent/catalog.generated.json | 252 ++++++++++++++++++ .../site/src/agent/queries.generated.json | 2 +- .../pull-request-simulator-contract.json | 15 ++ .../test/unit/pull-request-simulator.test.js | 89 +++++++ docs/dashboard-language.md | 18 ++ package.json | 1 + scripts/company-stress.mjs | 87 ++++++ scripts/simulate-dashboard-pages.mjs | 10 +- server/COMPANY-STRESS.md | 63 +++++ server/README.md | 7 + .../server/company_calculator_test.go | 75 ++++++ server/internal/server/company_stress_test.go | 197 ++++++++++++++ server/internal/simulator/company.go | 144 ++++++++++ server/internal/simulator/company_test.go | 166 ++++++++++++ server/internal/simulator/lake.go | 109 ++++---- server/internal/testutil/postgres.go | 10 +- tests/e2e/dashboard-pages.spec.mjs | 31 ++- tests/fixtures/company-stress/large.json | 12 + tests/fixtures/company-stress/medium.json | 12 + tests/fixtures/company-stress/small.json | 12 + tests/helpers/dashboard-pages-preview.mjs | 4 +- tests/unit/company-stress.test.mjs | 73 +++++ .../unit/dashboard-pages-simulation.test.mjs | 4 + tests/unit/dashboard-site-build.test.mjs | 7 +- 28 files changed, 1702 insertions(+), 55 deletions(-) create mode 100644 .github/workflows/company-stress.yml create mode 100644 dashboard/site/test/fixtures/pull-request-simulator-contract.json create mode 100644 dashboard/site/test/unit/pull-request-simulator.test.js create mode 100644 scripts/company-stress.mjs create mode 100644 server/COMPANY-STRESS.md create mode 100644 server/internal/server/company_calculator_test.go create mode 100644 server/internal/server/company_stress_test.go create mode 100644 server/internal/simulator/company.go create mode 100644 server/internal/simulator/company_test.go create mode 100644 tests/fixtures/company-stress/large.json create mode 100644 tests/fixtures/company-stress/medium.json create mode 100644 tests/fixtures/company-stress/small.json create mode 100644 tests/unit/company-stress.test.mjs diff --git a/.github/workflows/cgo.yml b/.github/workflows/cgo.yml index e2102379e9..fc1a91b8d9 100644 --- a/.github/workflows/cgo.yml +++ b/.github/workflows/cgo.yml @@ -26,6 +26,8 @@ on: - .github/workflows/cao-activity.yml - .github/actions/setup-cao-runtime/** - server/** + - tests/fixtures/company-stress/** + - scripts/company-stress.mjs - "!dashboard/site/**/*.md" - "!server/**/*.md" push: @@ -39,6 +41,8 @@ on: - activity/** - dashboard/site/** - server/** + - tests/fixtures/company-stress/** + - scripts/company-stress.mjs - scripts/test-dashboard-backfill.sh - scripts/run-daily-run-counts-conformance.mjs - package.json diff --git a/.github/workflows/company-stress.yml b/.github/workflows/company-stress.yml new file mode 100644 index 0000000000..2cddc67c96 --- /dev/null +++ b/.github/workflows/company-stress.yml @@ -0,0 +1,121 @@ +name: Synthetic company ingestion stress + +on: + workflow_dispatch: + inputs: + preset: + description: Company size (ignored when scenario JSON is supplied) + type: choice + options: [small, medium, large] + default: small + scenario: + description: Optional complete company scenario JSON; every workload input is configurable + type: string + default: "" + workflow_call: + inputs: + preset: + type: string + default: small + scenario: + type: string + default: "" + +permissions: + contents: read + +concurrency: + group: company-stress-${{ github.ref }} + cancel-in-progress: false + +jobs: + company-stress: + runs-on: ubuntu-latest + timeout-minutes: 45 + env: + COMPANY_PRESET: ${{ inputs.preset }} + COMPANY_SCENARIO: ${{ inputs.scenario }} + CAO_COMPANY_REPORT_DIR: ${{ github.workspace }}/test-results/company-stress + GH_TOKEN: "" + GITHUB_TOKEN: "" + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version: 24 + - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 + with: + go-version-file: server/go.mod + cache: false + - name: Start disposable loopback PostgreSQL + shell: bash + run: | + set -euo pipefail + mkdir -p "$CAO_COMPANY_REPORT_DIR" + docker run --detach --name cao-company-stress-postgres \ + --env POSTGRES_HOST_AUTH_METHOD=trust --env POSTGRES_DB=cao_company \ + --publish 127.0.0.1::5432 postgres:16-alpine \ + postgres -c max_locks_per_transaction=1024 + ready=false + for attempt in $(seq 1 60); do + if docker exec cao-company-stress-postgres pg_isready -U postgres -d cao_company; then + ready=true + break + fi + sleep 1 + done + test "$ready" = true + address=$(docker port cao-company-stress-postgres 5432/tcp) + echo "POSTGRES_URL=postgres://postgres@$address/cao_company?sslmode=disable" >> "$GITHUB_ENV" + - name: Resolve explicit company configuration + shell: bash + run: | + node --input-type=module <<'JS' + import { readFileSync, writeFileSync } from 'node:fs'; + const preset = process.env.COMPANY_PRESET || 'small'; + if (!['small', 'medium', 'large'].includes(preset)) throw new Error('Unknown company preset'); + const scenario = process.env.COMPANY_SCENARIO?.trim() + || readFileSync(`tests/fixtures/company-stress/${preset}.json`, 'utf8'); + writeFileSync(`${process.env.RUNNER_TEMP}/company-scenario.json`, JSON.stringify(JSON.parse(scenario))); + JS + - name: Generate and ingest synthetic AW evidence + shell: bash + run: | + set -euo pipefail + npm run test:stress:company -- \ + --scenario "$RUNNER_TEMP/company-scenario.json" \ + --report-dir "$CAO_COMPANY_REPORT_DIR" \ + 2>&1 | tee "$CAO_COMPANY_REPORT_DIR/go-test.txt" + - name: Publish measured results + if: always() + shell: bash + run: | + { + echo '## Synthetic company ingestion stress' + echo 'Generated AW evidence only: no agents, completion simulation, GitHub traffic or spending.' + if [ -f "$CAO_COMPANY_REPORT_DIR/company-stress.json" ]; then + echo '```json' + cat "$CAO_COMPANY_REPORT_DIR/company-stress.json" + echo '```' + else + echo 'FAILED / INCOMPLETE: no report was produced; inspect the job log.' + fi + } >> "$GITHUB_STEP_SUMMARY" + - name: Capture PostgreSQL logs and stop the test container + if: always() + shell: bash + run: | + set -euo pipefail + mkdir -p "$CAO_COMPANY_REPORT_DIR" + docker logs cao-company-stress-postgres > "$CAO_COMPANY_REPORT_DIR/postgres.log" 2>&1 + docker rm --force --volumes cao-company-stress-postgres + - name: Upload stress evidence + if: always() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: company-stress + path: test-results/company-stress/ + if-no-files-found: error + retention-days: 14 diff --git a/dashboard/site/dashboard-fragments/simulators.json b/dashboard/site/dashboard-fragments/simulators.json index f9d946e130..33fdc805fe 100644 --- a/dashboard/site/dashboard-fragments/simulators.json +++ b/dashboard/site/dashboard-fragments/simulators.json @@ -90,6 +90,68 @@ "acceptance": "Three modeled table sizes and their summed final value are shown without a growth chart.", "from": "simulator-database-size", "union": ["simulator-database-total"] + }, + { + "name": "simulator-pr-inputs", + "subject": "Model company PR volume, AW fan-out and AI Credits from editable assumptions.", + "objective": "Compare hypothetical company sizes without launching workflows or claiming measured capacity.", + "acceptance": "Developers multiply PRs per developer per day, AW runs per PR and AIC per run; repositories divide averages only. Duration scales totals independently of the synthetic day source.", + "from": "simulation-days", + "parameters": [ + { "name": "repositories", "type": "number" }, + { "name": "developers", "type": "number" }, + { "name": "prs-per-developer-per-day", "type": "number" }, + { "name": "aw-runs-per-pr", "type": "number" }, + { "name": "days", "type": "number" }, + { "name": "aic-per-run", "type": "number" } + ], + "filter": { "predicates": [{ "field": "day", "equals": 1 }] }, + "compute": [ + { "as": "daily-prs", "function": "product", "args": [{ "parameter": "developers" }, { "parameter": "prs-per-developer-per-day" }] }, + { "as": "daily-runs", "function": "product", "args": [{ "field": "daily-prs" }, { "parameter": "aw-runs-per-pr" }] }, + { "as": "daily-aic", "function": "product", "args": [{ "field": "daily-runs" }, { "parameter": "aic-per-run" }] }, + { "as": "total-prs", "function": "product", "args": [{ "field": "daily-prs" }, { "parameter": "days" }] }, + { "as": "total-runs", "function": "product", "args": [{ "field": "daily-runs" }, { "parameter": "days" }] }, + { "as": "total-aic", "function": "product", "args": [{ "field": "daily-aic" }, { "parameter": "days" }] }, + { "as": "prs-per-repo", "function": "quotient", "args": [{ "field": "daily-prs" }, { "parameter": "repositories" }] }, + { "as": "runs-per-repo", "function": "quotient", "args": [{ "field": "daily-runs" }, { "parameter": "repositories" }] }, + { "as": "runs-per-second", "function": "quotient", "args": [{ "field": "daily-runs" }, { "value": 86400 }] } + ] + }, + { + "name": "simulator-pr-counts", + "subject": "Show modeled daily and horizon pull request counts.", + "objective": "Separate developer activity from repository scope.", + "acceptance": "PR totals depend on developers and duration, not repository count.", + "from": "simulator-pr-inputs", + "compute": [{ "as": "measure", "function": "literal", "args": [{ "value": "Pull requests" }] }], + "select": [{ "field": "measure" }, { "field": "daily-prs", "as": "daily" }, { "field": "total-prs", "as": "total" }] + }, + { + "name": "simulator-pr-runs", + "subject": "Show modeled AW runs generated by pull requests.", + "objective": "Expose the selected AW fan-out.", + "acceptance": "Daily and horizon runs use the configured AW runs per PR.", + "from": "simulator-pr-inputs", + "compute": [{ "as": "measure", "function": "literal", "args": [{ "value": "AW runs" }] }], + "select": [{ "field": "measure" }, { "field": "daily-runs", "as": "daily" }, { "field": "total-runs", "as": "total" }] + }, + { + "name": "simulator-pr-aic", + "subject": "Show modeled AI Credits, not actual spending or currency.", + "objective": "Make the editable AIC-per-run assumption explicit.", + "acceptance": "AIC totals multiply modeled runs by AIC per AW run; no dollar conversion or budget enforcement is inferred.", + "from": "simulator-pr-inputs", + "compute": [{ "as": "measure", "function": "literal", "args": [{ "value": "AI Credits (AIC)" }] }], + "select": [{ "field": "measure" }, { "field": "daily-aic", "as": "daily" }, { "field": "total-aic", "as": "total" }] + }, + { + "name": "simulator-pr-summary", + "subject": "Compare daily and horizon PR, AW-run and AI Credit estimates.", + "objective": "Support side-effect-free company workload planning.", + "acceptance": "Exactly three modeled measures are shown and recompute from all six form inputs.", + "from": "simulator-pr-counts", + "union": ["simulator-pr-runs", "simulator-pr-aic"] } ], "pages": [ @@ -107,7 +169,8 @@ "route": { "tab": "database-size", "tabs": [ - { "id": "database-size", "label": "Database size", "icon": "database", "page": "simulators" } + { "id": "database-size", "label": "Database size", "icon": "database", "page": "simulators" }, + { "id": "pull-request", "label": "Pull request", "icon": "git-pull-request", "page": "simulator-pull-request" } ] }, "form": { @@ -142,6 +205,170 @@ } } ] + }, + { + "id": "simulator-pull-request", + "kind": "custom", + "intent": "Explore PR-driven company workloads with editable AW and AIC assumptions.", + "subject": "Hypothetical pull requests, AW runs and AI Credits for the selected company size and duration.", + "objective": "Compare workload volume, not predict observed throughput or spending.", + "acceptance": "All six inputs are editable and recompute daily and horizon totals. Repositories affect averages only. No agents, stress tests, GitHub actions or spending are triggered.", + "title": "Pull request simulator", + "description": "Compare modeled PR, AW-run and AI Credit totals without launching workflows, running stress tests or spending credits.", + "icon": "git-pull-request", + "experimental": true, + "route": { + "navigation-page": "simulators", + "tab": "pull-request", + "tabs": [ + { + "id": "database-size", + "label": "Database size", + "icon": "database", + "page": "simulators" + }, + { + "id": "pull-request", + "label": "Pull request", + "icon": "git-pull-request", + "page": "simulator-pull-request" + } + ] + }, + "form": { + "title": "Company workload", + "description": "PRs are per developer per day, not per repository. Duration counts calendar days. The CLI stress runner independently bounds generated records to five million.", + "fields": [ + { + "id": "repositories", + "label": "Repositories", + "control": "slider", + "min": 1, + "max": 50000, + "step": 1, + "default": 10000 + }, + { + "id": "developers", + "label": "Developers", + "control": "slider", + "min": 1, + "max": 1000000, + "step": 1, + "default": 10000 + }, + { + "id": "prs-per-developer-per-day", + "label": "PRs per developer per day", + "control": "slider", + "min": 0, + "max": 1000, + "step": 1, + "default": 10 + }, + { + "id": "aw-runs-per-pr", + "label": "AW runs per PR", + "control": "slider", + "min": 0, + "max": 1000, + "step": 1, + "default": 5 + }, + { + "id": "days", + "label": "Duration (days)", + "control": "slider", + "min": 1, + "max": 31, + "step": 1, + "default": 1 + }, + { + "id": "aic-per-run", + "label": "AIC per AW run", + "control": "slider", + "min": 0, + "max": 10000, + "step": 0.01, + "default": 100 + } + ], + "update": { + "strategy": "debounce", + "delay-ms": 250 + } + }, + "views": [ + { + "id": "simulator-pr-totals", + "title": "Modeled daily and horizon totals", + "subject": "Synthetic PR, AW-run and AI Credit counts.", + "objective": "Compare daily activity with the selected duration.", + "acceptance": "Counts use the selected assumptions; AIC is modeled credits, not measured billing or currency.", + "description": "Daily PRs = developers × PRs/developer/day. AW runs = PRs × AW runs/PR. AI Credits = AW runs × AIC/run. Horizon totals multiply daily values by the selected duration.", + "data": { + "source": "simulator-pr-summary", + "query-context": false + }, + "mark": "table", + "controls": "static", + "layout": "full", + "encoding": { + "columns": [ + { + "field": "measure", + "type": "nominal", + "title": "Modeled measure" + }, + { + "field": "daily", + "type": "quantitative", + "title": "Per day" + }, + { + "field": "total", + "type": "quantitative", + "title": "Selected duration" + } + ] + } + }, + { + "id": "simulator-pr-averages", + "disclosure": "supplemental", + "subject": "Daily per-repository and per-second workload averages.", + "objective": "Explain how repository count distributes the same developer workload.", + "acceptance": "Averages are not peak traffic, measured throughput, storage predictions or capacity guarantees.", + "description": "Uniform averages over repositories and 86,400 seconds per day. Bursts, execution duration, retries and storage overhead are excluded.", + "data": { + "source": "simulator-pr-inputs", + "query-context": false + }, + "mark": "table", + "controls": "static", + "layout": "full", + "encoding": { + "columns": [ + { + "field": "prs-per-repo", + "type": "quantitative", + "title": "PRs / repository / day" + }, + { + "field": "runs-per-repo", + "type": "quantitative", + "title": "AW runs / repository / day" + }, + { + "field": "runs-per-second", + "type": "quantitative", + "title": "AW runs / second" + } + ] + } + } + ] } ] } diff --git a/dashboard/site/scripts/build.mjs b/dashboard/site/scripts/build.mjs index 36ca4d2169..ca43aa72e5 100644 --- a/dashboard/site/scripts/build.mjs +++ b/dashboard/site/scripts/build.mjs @@ -178,6 +178,9 @@ export function filterExperimentalDashboardViews(document, enabled = false) { .filter((section) => section?.experimental === true) .flatMap((section) => Array.isArray(section.pages) ? section.pages : []), ); + for (const page of document.dashboard.pages) { + if (page.experimental === true) experimentalPageIds.add(page.id); + } if (experimentalPageIds.size === 0) return document; return { ...document, diff --git a/dashboard/site/src/agent/catalog.generated.json b/dashboard/site/src/agent/catalog.generated.json index d17ec90e46..6ceae9b70c 100644 --- a/dashboard/site/src/agent/catalog.generated.json +++ b/dashboard/site/src/agent/catalog.generated.json @@ -12095,6 +12095,258 @@ ] } }, + { + "id": "simulator-pr-inputs", + "subject": "Model company PR volume, AW fan-out and AI Credits from editable assumptions.", + "objective": "Compare hypothetical company sizes without launching workflows or claiming measured capacity.", + "acceptance": "Developers multiply PRs per developer per day, AW runs per PR and AIC per run; repositories divide averages only. Duration scales totals independently of the synthetic day source.", + "description": "", + "parameters": [ + { + "name": "aic-per-run", + "type": "number", + "required": true + }, + { + "name": "aw-runs-per-pr", + "type": "number", + "required": true + }, + { + "name": "days", + "type": "number", + "required": true + }, + { + "name": "developers", + "type": "number", + "required": true + }, + { + "name": "prs-per-developer-per-day", + "type": "number", + "required": true + }, + { + "name": "repositories", + "type": "number", + "required": true + } + ], + "sources": [ + "simulation-days" + ], + "used-by-pages": [], + "execution": { + "local": true, + "backend": "sqlite", + "requirements": [ + "simulation-days" + ] + } + }, + { + "id": "simulator-pr-counts", + "subject": "Show modeled daily and horizon pull request counts.", + "objective": "Separate developer activity from repository scope.", + "acceptance": "PR totals depend on developers and duration, not repository count.", + "description": "", + "parameters": [ + { + "name": "aic-per-run", + "type": "number", + "required": true + }, + { + "name": "aw-runs-per-pr", + "type": "number", + "required": true + }, + { + "name": "days", + "type": "number", + "required": true + }, + { + "name": "developers", + "type": "number", + "required": true + }, + { + "name": "prs-per-developer-per-day", + "type": "number", + "required": true + }, + { + "name": "repositories", + "type": "number", + "required": true + } + ], + "sources": [ + "simulator-pr-inputs" + ], + "used-by-pages": [], + "execution": { + "local": true, + "backend": "sqlite", + "requirements": [ + "simulation-days" + ] + } + }, + { + "id": "simulator-pr-runs", + "subject": "Show modeled AW runs generated by pull requests.", + "objective": "Expose the selected AW fan-out.", + "acceptance": "Daily and horizon runs use the configured AW runs per PR.", + "description": "", + "parameters": [ + { + "name": "aic-per-run", + "type": "number", + "required": true + }, + { + "name": "aw-runs-per-pr", + "type": "number", + "required": true + }, + { + "name": "days", + "type": "number", + "required": true + }, + { + "name": "developers", + "type": "number", + "required": true + }, + { + "name": "prs-per-developer-per-day", + "type": "number", + "required": true + }, + { + "name": "repositories", + "type": "number", + "required": true + } + ], + "sources": [ + "simulator-pr-inputs" + ], + "used-by-pages": [], + "execution": { + "local": true, + "backend": "sqlite", + "requirements": [ + "simulation-days" + ] + } + }, + { + "id": "simulator-pr-aic", + "subject": "Show modeled AI Credits, not actual spending or currency.", + "objective": "Make the editable AIC-per-run assumption explicit.", + "acceptance": "AIC totals multiply modeled runs by AIC per AW run; no dollar conversion or budget enforcement is inferred.", + "description": "", + "parameters": [ + { + "name": "aic-per-run", + "type": "number", + "required": true + }, + { + "name": "aw-runs-per-pr", + "type": "number", + "required": true + }, + { + "name": "days", + "type": "number", + "required": true + }, + { + "name": "developers", + "type": "number", + "required": true + }, + { + "name": "prs-per-developer-per-day", + "type": "number", + "required": true + }, + { + "name": "repositories", + "type": "number", + "required": true + } + ], + "sources": [ + "simulator-pr-inputs" + ], + "used-by-pages": [], + "execution": { + "local": true, + "backend": "sqlite", + "requirements": [ + "simulation-days" + ] + } + }, + { + "id": "simulator-pr-summary", + "subject": "Compare daily and horizon PR, AW-run and AI Credit estimates.", + "objective": "Support side-effect-free company workload planning.", + "acceptance": "Exactly three modeled measures are shown and recompute from all six form inputs.", + "description": "", + "parameters": [ + { + "name": "aic-per-run", + "type": "number", + "required": true + }, + { + "name": "aw-runs-per-pr", + "type": "number", + "required": true + }, + { + "name": "days", + "type": "number", + "required": true + }, + { + "name": "developers", + "type": "number", + "required": true + }, + { + "name": "prs-per-developer-per-day", + "type": "number", + "required": true + }, + { + "name": "repositories", + "type": "number", + "required": true + } + ], + "sources": [ + "simulator-pr-aic", + "simulator-pr-counts", + "simulator-pr-runs" + ], + "used-by-pages": [], + "execution": { + "local": true, + "backend": "sqlite", + "requirements": [ + "simulation-days" + ] + } + }, { "id": "overview-run-summary", "subject": "Summarize successful, failed, and active runs with rollout-mode counts.", diff --git a/dashboard/site/src/agent/queries.generated.json b/dashboard/site/src/agent/queries.generated.json index f4cf60bccc..8fc453f9ef 100644 --- a/dashboard/site/src/agent/queries.generated.json +++ b/dashboard/site/src/agent/queries.generated.json @@ -1 +1 @@ -[{"name":"command-queue","subject":"Show the durable local CLI command queue.","objective":"Inspect command lifecycle and reconnect to output without rerunning work.","acceptance":"Preserve persistent command IDs and all six server states; closing output never cancels execution. Unavailable local authority is not an empty queue.","from":"cli-commands","compute":[{"as":"command-action","function":"coalesce","args":[{"field":"actionId"},{"value":""}]},{"as":"command-title","function":"coalesce","args":[{"field":"command"},{"field":"actionId"}]},{"as":"command-target","function":"coalesce","args":[{"field":"repository"},{"field":"campaign"},{"field":"package-source"},{"value":"Local control repository"}]},{"as":"command-created-at","function":"coalesce","args":[{"field":"createdAt"},{"value":null}]},{"as":"command-href","function":"concat","args":[{"value":"#page-command?command="},{"field":"id"}]},{"as":"command-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"command-href"},{"field":"command-title"},{"field":"id"}]}]},{"name":"event-base","subject":"Project shared event fields before combining run-owned records.","objective":"Provide the narrow retained event evidence needed for inspection and run import-coverage analysis.","acceptance":"The result unions retained audit, domain, tool, and issue records with their available run identity; an empty or unavailable preview cannot establish zero source activity or complete import coverage.","from":"audits","union":["domains","tools","issues"],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"event"},{"field":"event-source"},{"field":"event-type"},{"field":"event-summary"},{"field":"event-status"},{"field":"github-entity-type"},{"field":"safe-output-type"},{"field":"safe-output-url"},{"field":"correlation-id"},{"field":"implementation-pull-request-url"},{"field":"event-timestamp"},{"field":"run-link"}]},{"name":"audit-event-runs","subject":"Count imported audit records per run before combining event sources.","objective":"Bound audit evidence for run import-coverage analysis.","acceptance":"Count only retained audit records with event identity by run attempt; missing evidence does not establish zero activity.","from":"audits","aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"event","as":"events","reducer":"count"}]}},{"name":"domain-event-runs","subject":"Count imported domain records per run before combining event sources.","objective":"Bound domain evidence for run import-coverage analysis.","acceptance":"Count only retained domain records with event identity by run attempt; missing evidence does not establish zero activity.","from":"domains","aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"event","as":"events","reducer":"count"}]}},{"name":"tool-event-runs","subject":"Count imported tool records per run before combining event sources.","objective":"Bound tool evidence for run import-coverage analysis.","acceptance":"Count only retained tool records with event identity by run attempt; missing evidence does not establish zero activity.","from":"tools","aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"event","as":"events","reducer":"count"}]}},{"name":"issue-event-runs","subject":"Count imported issue records per run before combining event sources.","objective":"Bound issue evidence for run import-coverage analysis.","acceptance":"Count only retained issue records with event identity by run attempt; missing evidence does not establish zero activity.","from":"issues","aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"event","as":"events","reducer":"count"}]}},{"name":"event-runs","subject":"Identify each workflow run that has one or more imported run-owned records.","objective":"Identify run attempts with retained imported records so their presence can be compared with observed runs.","acceptance":"One row per organization, repository, workflow, run, and attempt contains events, the count of matching retained records; no row in an available result does not prove that no event was produced.","description":"Distinct workflow runs represented by imported domain, tool, audit, or issue records.","from":"audit-event-runs","union":["domain-event-runs","tool-event-runs","issue-event-runs"],"aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"events","as":"events","reducer":"sum"}]}},{"name":"run-import-status","subject":"Identify observed runs that have one or more imported run-owned records.","objective":"Compare observed run attempts with retained run-owned event evidence to locate import-coverage gaps for investigation.","acceptance":"Keep each observed run and its run-attempt identity; imported-event-count is zero and imported is false without a matching retained event, but missing events alone do not establish an ingestion failure.","description":"Observed runs enriched with imported-record status.","from":"runs","joins":[{"source":"event-runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"events","as":"imported-events"}]}],"compute":[{"as":"imported-event-count","function":"coalesce","args":[{"field":"imported-events"},{"value":0}]},{"as":"imported","function":"greater-than","args":[{"field":"imported-event-count"},{"value":0}]}]},{"name":"workflow-run-totals","subject":"Summarize observed run counts and imported runs by declared workflow.","objective":"Compare observed run attempts, conclusions, and imported-record coverage for each workflow.","acceptance":"Group by organization, repository, and workflow; report distinct run-attempt totals, successful and failed conclusion counts, and imported-run totals only from retained evidence. Missing run records cannot establish zero execution.","description":"Observed run and imported-run totals for each declared workflow.","from":"run-import-status","compute":[{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run-attempt-identity","as":"runs","reducer":"distinct-count"},{"field":"run-conclusion","as":"successful-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","equals":"success"}]}},{"field":"run-conclusion","as":"failed-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","stale","timed-out"]}]}},{"field":"imported","as":"imported-runs","reducer":"sum"}]}},{"name":"workflow-aic-run-totals","subject":"Summarize observed run attempts and AI Credits for workflow cost comparison.","objective":"Count retained run attempts and recorded AI Credits without loading imported-event coverage.","acceptance":"Count all distinct retained run attempts, but include only positive recorded AIC in cost totals and cost denominators; zero and missing telemetry cannot skew cost averages.","from":"runs","compute":[{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run-attempt-identity","as":"runs","reducer":"distinct-count"},{"field":"run-attempt-identity","as":"aic-runs","reducer":"distinct-count","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"aic-total","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}}]}},{"name":"workflow-aic-totals","subject":"Summarize observed AI Credit usage by declared workflow.","objective":"Expose retained AI Credit consumption per workflow for bounded cost review alongside observed execution.","acceptance":"Sum only positive recorded aic-total by organization, repository, and workflow; exclude zero and missing costs rather than treating them as free execution.","description":"Observed AI Credit totals for each declared workflow.","from":"workflow-aic-run-totals","filter":{"predicates":[{"field":"aic-runs","gte":1}]},"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"aic"},{"field":"aic-runs"}]},{"name":"mcp-tool-workflow-totals","subject":"Summarize observed MCP calls by tool and workflow before the tool inventory is materialized.","objective":"Keep MCP inventory intermediates bounded without dropping calls or changing byte totals.","acceptance":"Count retained observation identities and sum request and response bytes per server, tool, and workflow; retain safe-output-server classification for downstream exclusion.","from":"mcp-calls","compute":[{"as":"safe-output-server","function":"equals-any","args":[{"field":"mcp-server"},{"value":"safe_outputs"},{"value":"safeoutputs"}]},{"as":"mcp-tool-label","function":"concat","args":[{"field":"mcp-server"},{"value":"/"},{"field":"mcp-tool"}]},{"as":"workflow-key","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}],"aggregate":{"by":["safe-output-server","mcp-tool-label","mcp-server","mcp-tool","workflow-key"],"values":[{"field":"mcp-observation","as":"calls","reducer":"count"},{"field":"request-bytes","as":"request-bytes","reducer":"sum"},{"field":"response-bytes","as":"response-bytes","reducer":"sum"}]}},{"name":"mcp-tool-calls","subject":"Prepare MCP tool calls for aggregation with safe-output-server calls identified for downstream exclusion.","objective":"Identify retained MCP call labels and safe-output-server classification for downstream tool-use investigation.","acceptance":"Preserve each retained call with its workflow key and tool label and mark safe-output-server calls explicitly; downstream exclusion must not be mistaken for absence of those calls or complete tool telemetry.","description":"Observed MCP tool calls labeled with whether they belong to the internal safe outputs server.","from":"mcp-calls","compute":[{"as":"safe-output-server","function":"equals-any","args":[{"field":"mcp-server"},{"value":"safe_outputs"},{"value":"safeoutputs"}]},{"as":"mcp-tool-label","function":"concat","args":[{"field":"mcp-server"},{"value":"/"},{"field":"mcp-tool"}]},{"as":"workflow-key","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}]},{"name":"issue-safe-outputs","subject":"List retained GitHub issue safe outputs.","objective":"Inspect retained issue safe outputs and their observed closure state before deciding which items need follow-up.","acceptance":"Include only safe_output.result issue records, not pull requests; preserve issue and run links, timestamps, state, and status detail. Unknown or unobserved closure state must not be presented as closed.","description":"Issue-only projection of retained safe-output items.","from":"issues","filter":{"predicates":[{"field":"event-type","equals":"safe_output.result"},{"field":"is-pull-request","equals":false}]},"joins":[{"source":"runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"run-link","as":"linked-run"}]}],"compute":[{"as":"_issue-state-open","function":"equals-any","args":[{"field":"issue-state"},{"value":"OPEN"}]},{"as":"_issue-state-closed","function":"equals-any","args":[{"field":"issue-state"},{"value":"CLOSED"}]},{"as":"_issue-open-status","function":"if","args":[{"field":"_issue-state-open"},{"value":"Open"},{"value":"Unknown"}]},{"as":"issue-status","function":"if","args":[{"field":"_issue-state-closed"},{"value":"Closed"},{"field":"_issue-open-status"}]},{"as":"_issue-closing-reason","function":"coalesce","args":[{"field":"issue-state-reason"},{"value":"unknown"}]},{"as":"_issue-closing-reason-normalized","function":"lower","args":[{"field":"_issue-closing-reason"}]},{"as":"issue-closing-status","function":"title-case","args":[{"field":"_issue-closing-reason-normalized"}]},{"as":"_issue-closed-status-detail","function":"concat","args":[{"value":"Closed: "},{"field":"issue-closing-status"}]},{"as":"issue-status-detail","function":"if","args":[{"field":"_issue-state-closed"},{"field":"_issue-closed-status-detail"},{"field":"issue-status"}]}],"select":[{"field":"event-timestamp","as":"observed-at"},{"field":"github-entity-type"},{"field":"is-pull-request"},{"field":"safe-output-type"},{"field":"issue-state"},{"field":"issue-closed"},{"field":"issue-state-reason"},{"field":"issue-status"},{"field":"issue-closing-status"},{"field":"issue-status-detail"},{"field":"issue-closed-at"},{"field":"issue-status-observed-at"},{"field":"event-summary"},{"field":"correlation-id","as":"entity-url"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"linked-run","as":"run-link"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"entity-url","direction":"asc"}]},{"name":"issue-safe-output-label-options","subject":"List observed safe-output badges for the issue list Labels filter.","objective":"Choose retained safe-output types without scanning or filtering presented cards.","acceptance":"Return distinct observed badge values in ascending order; missing evidence is not an empty label inventory.","from":"issue-safe-outputs","aggregate":{"by":["safe-output-type"],"values":[{"field":"entity-url","as":"items","reducer":"count"}]},"order-by":[{"field":"safe-output-type","direction":"asc"}]},{"name":"issue-status-label-options","subject":"List observed status badges for the issue list Status filter.","objective":"Choose retained issue states and closing reasons without inferring resolution.","acceptance":"Return distinct observed status details in ascending order; Unknown remains distinct from Open and Closed.","from":"issue-safe-outputs","aggregate":{"by":["issue-status-detail"],"values":[{"field":"entity-url","as":"items","reducer":"count"}]},"order-by":[{"field":"issue-status-detail","direction":"asc"}]},{"name":"issue-repository-totals","subject":"Rank the ten repositories with the most retained GitHub issue safe outputs.","objective":"Locate repositories with the largest observed issue-safe-output volume for a bounded review of linked records.","acceptance":"Return at most ten repository coordinates ordered by retained issue-record count; ties or missing issue evidence must not imply a complete fleet ranking or unique issue count.","description":"Top repositories by retained issue safe-output count.","from":"issue-safe-outputs","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]}],"aggregate":{"by":["repository-coordinate"],"values":[{"field":"entity-url","as":"issues","reducer":"count"}]},"order-by":[{"field":"issues","direction":"desc"},{"field":"repository-coordinate","direction":"asc"}],"limit":10},{"name":"campaign-import-audit-count","subject":"Count retained audit identities for campaign inventory source quality.","objective":"Retain audit provenance without reconstructing run coverage.","acceptance":"Count canonical audit IDs; missing evidence stays unavailable and the count is not displayed as import coverage.","from":"audits","aggregate":{"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"campaign-import-domain-count","subject":"Count retained domain identities for campaign inventory source quality.","objective":"Retain domain provenance without reconstructing run coverage.","acceptance":"Count canonical domain IDs; missing evidence stays unavailable and the count is not displayed as import coverage.","from":"domains","aggregate":{"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"campaign-import-tool-count","subject":"Count retained tool identities for campaign inventory source quality.","objective":"Retain tool provenance without reconstructing run coverage.","acceptance":"Count canonical tool IDs; missing evidence stays unavailable and the count is not displayed as import coverage.","from":"tools","aggregate":{"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"campaign-import-issue-count","subject":"Count retained issue identities for campaign inventory source quality.","objective":"Retain issue provenance without reconstructing run coverage.","acceptance":"Count canonical issue IDs; missing evidence stays unavailable and the count is not displayed as import coverage.","from":"issues","aggregate":{"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"campaign-workflow-import-evidence","subject":"Compose retained import-source quality for campaign workflow execution totals.","objective":"Preserve all four import dependencies without counting unused per-run or per-workflow coverage.","acceptance":"Compose audit, domain, tool, and issue availability, freshness, and completeness exactly as event-runs. The retained-record count carries source quality only; it is not displayed or used as horizon-specific import coverage, executions, or outcomes. Run and AI Credit totals retain their selected horizon.","from":"campaign-import-audit-count","union":["campaign-import-domain-count","campaign-import-tool-count","campaign-import-issue-count"],"time":{"range":"all"},"compute":[{"as":"import-scope","function":"literal","args":[{"value":"retained"}]}],"aggregate":{"by":["import-scope"],"values":[{"field":"records","as":"events","reducer":"sum"}]}},{"name":"campaign-workflow-execution-base","subject":"Summarize retained run attempts and AI Credits before campaign workflow enrichment.","objective":"Read run identity and recorded AI Credits together instead of enriching every run with import status.","acceptance":"Count distinct run-attempt identities and sum aic-total per organization, repository, and workflow; missing retained evidence is not proof of no execution or cost.","from":"runs","compute":[{"as":"import-scope","function":"literal","args":[{"value":"retained"}]},{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["organization","repository","workflow","import-scope"],"values":[{"field":"run-attempt-identity","as":"runs","reducer":"distinct-count"},{"field":"aic-total","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}}]}},{"name":"campaign-workflow-execution-totals","subject":"Attach retained import-evidence quality to compact workflow execution totals.","objective":"Preserve the public inventory's run and import availability composition after aggregating run evidence.","acceptance":"Keep runs and AI Credits unchanged; unavailable run evidence fails closed and optional import evidence degrades quality exactly as in run-import-status.","description":"Only source quality is consumed from import evidence. Join its compact retained-source summary after run aggregation; do not build unused run-level import coverage or change horizon-specific execution totals.","from":"campaign-workflow-execution-base","joins":[{"source":"campaign-workflow-import-evidence","type":"left","on":[{"left":"import-scope","right":"import-scope"}],"fields":[{"field":"events","as":"imported-events"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"runs"},{"field":"aic"}]},{"name":"campaign-workflow-declarations","subject":"Project reusable campaign workflow declarations without execution evidence.","objective":"Share declaration display fields between structural topology and execution inventory without joining runs or import evidence.","acceptance":"Preserve raw organization, repository, workflow and declaration fields for joins. Select orchestrator and worker roles once, retaining inactive and unknown declarations; only list consumers select active entries. Display defaults and repository links do not establish execution, enrollment or authority.","from":"workflows","filter":{"predicates":[{"field":"workflow-role","in":["orchestrator","worker"]}]},"compute":[{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"declared-mode","function":"coalesce","args":[{"field":"rollout-mode"},{"value":"unknown"}]},{"as":"declared-registration","function":"coalesce","args":[{"field":"workflow-active"},{"value":"unknown"}]},{"as":"campaign-title","function":"title-case","args":[{"field":"campaign"}]},{"as":"campaign-display-name","function":"coalesce","args":[{"field":"campaign-name"},{"field":"campaign-title"},{"value":"Repository-owned"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-slug"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-slug"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-slug"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"campaign"},{"field":"campaign-name"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"rollout-mode"},{"field":"workflow-active"},{"field":"repository-link"},{"field":"workflow-link"},{"field":"repository-slug"},{"field":"declared-mode"},{"field":"declared-registration"},{"field":"campaign-display-name"},{"field":"workflow-display-name"},{"field":"repository-dashboard-link"}]},{"name":"campaign-workflow-inventory","subject":"Project declared campaign workflows with lean execution and configuration evidence.","objective":"Provide campaign totals and lists from shared declarations with separate execution and import-quality evidence.","acceptance":"Keep all declared orchestrators and workers, including inactive and unobserved entries; preserve inventory ordering, configuration defaults, execution totals, and import-evidence quality.","description":"Lean campaign inventory with execution totals that retain the public workflow inventory's evidence-quality dependencies.","from":"campaign-workflow-declarations","joins":[{"source":"campaign-workflow-execution-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"aic","as":"observed-aic"}]}],"compute":[{"as":"total-runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"total-aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"organization"},{"field":"repository-slug","as":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"declared-registration","as":"workflow-active"},{"field":"total-runs","as":"runs"},{"field":"total-aic","as":"aic"},{"field":"repository-link"},{"field":"workflow-link"},{"field":"campaign-display-name"},{"field":"workflow-display-name"},{"field":"repository-dashboard-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"workflow-inventory","subject":"List declared workflows with their campaign, repository, configuration, and observed execution totals.","objective":"Compare declared workflow configuration with retained run, import-coverage, and AI Credit evidence to select a workflow for closer inspection.","acceptance":"Keep one row per declared workflow with identity, role, mode, registration, links, observed totals, and ingestion indicator; zero joined totals and missing evidence must not be treated as proof of no execution or complete ingestion.","description":"Central campaign and repository-owned workflow inventory with observed execution totals.","from":"workflows","joins":[{"source":"workflow-run-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"successful-runs","as":"observed-successful-runs"},{"field":"failed-runs","as":"observed-failed-runs"},{"field":"imported-runs","as":"observed-imported-runs"}]},{"source":"workflow-aic-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"aic","as":"observed-aic"},{"field":"aic-runs","as":"observed-aic-runs"}]}],"compute":[{"as":"campaign-title","function":"title-case","args":[{"field":"campaign"}]},{"as":"campaign-display-name","function":"coalesce","args":[{"field":"campaign-name"},{"field":"campaign-title"},{"value":"Repository-owned"}]},{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"declared-role","function":"coalesce","args":[{"field":"workflow-role"},{"value":"standalone"}]},{"as":"declared-mode","function":"coalesce","args":[{"field":"rollout-mode"},{"value":"unknown"}]},{"as":"declared-registration","function":"coalesce","args":[{"field":"workflow-active"},{"value":"unknown"}]},{"as":"total-runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"total-successful-runs","function":"coalesce","args":[{"field":"observed-successful-runs"},{"value":0}]},{"as":"has-observed-runs","function":"greater-than","args":[{"field":"total-runs"},{"value":0}]},{"as":"total-failed-runs","function":"coalesce","args":[{"field":"observed-failed-runs"},{"value":0}]},{"as":"total-aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]},{"as":"aic-per-run","function":"quotient","args":[{"field":"total-aic"},{"field":"observed-aic-runs"}]},{"as":"total-imported-runs","function":"coalesce","args":[{"field":"observed-imported-runs"},{"value":0}]},{"as":"ingestion-rate","function":"quotient","args":[{"field":"total-imported-runs"},{"field":"total-runs"}]},{"as":"ingestion","function":"format-percent","args":[{"field":"ingestion-rate"}]},{"as":"encoded-campaign","function":"url-encode","args":[{"field":"campaign"}]},{"as":"campaign-dashboard-href","function":"concat","args":[{"value":"#page-campaign-insights?campaign="},{"field":"encoded-campaign"}]},{"as":"campaign-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"campaign-display-name"},{"value":" campaign dashboard"}]},{"as":"campaign-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"campaign-dashboard-href"},{"field":"campaign-dashboard-label"},{"field":"campaign"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-slug"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-slug"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-slug"}]},{"as":"workflow-identity","function":"concat","args":[{"field":"repository-slug"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-identity"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-display-name"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-identity"}]}],"select":[{"field":"campaign"},{"field":"campaign-display-name","as":"campaign-name"},{"field":"organization"},{"field":"repository-slug","as":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-identity","as":"workflow-label"},{"field":"declared-role","as":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"declared-registration","as":"workflow-active"},{"field":"total-aic","as":"aic"},{"field":"total-runs","as":"runs"},{"field":"total-successful-runs","as":"successful-runs"},{"field":"total-failed-runs","as":"failed-runs"},{"field":"aic-per-run"},{"field":"has-observed-runs"},{"field":"ingestion"},{"field":"campaign-dashboard-link","as":"campaign-link"},{"field":"repository-dashboard-link","as":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"repository-run-statistics","subject":"Reduce run counts, conclusions, and positive AI Credits before repository enrichment.","objective":"Share one row-local run aggregate between repository execution and cost summaries.","acceptance":"Keep organization/repository grain, distinct run IDs, existing failure and approval counts, and positive recorded AIC. Reduce before joins; missing evidence is not zero activity or free execution.","from":"runs","compute":[{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["organization","repository"],"values":[{"field":"run","as":"runs","reducer":"distinct-count"},{"field":"run-conclusion","as":"failed","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","timed-out"]}]}},{"field":"run-conclusion","as":"action-required","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","equals":"action-required"}]}},{"field":"run","as":"aic-runs","reducer":"count","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"aic-total","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}}]}},{"name":"repository-aic-totals","subject":"Summarize observed AI Credit usage by repository.","objective":"Provide repository-level retained AI Credit totals for comparing observed usage with run activity.","acceptance":"Sum only positive recorded aic-total by organization and repository; exclude zero and missing costs rather than treating them as free execution.","description":"Observed AI Credit totals for each repository.","from":"repository-run-statistics","filter":{"predicates":[{"field":"aic-runs","gte":1}]},"select":[{"field":"organization"},{"field":"repository"},{"field":"aic"}]},{"name":"maintenance-campaign-packages","subject":"Installed campaign packages with retained source coordinates and update evidence.","objective":"Show installed/current source revisions and gate update actions on exact retained provenance.","acceptance":"Return every package. Set campaign-update-action-visible only for update-available rows with a non-empty source; missing provenance stays visible and non-actionable.","from":"campaigns","compute":[{"as":"campaign-source-unavailable","function":"equals-any","args":[{"field":"campaign-source"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"campaign-action-state","function":"if","args":[{"field":"campaign-source-unavailable"},{"value":"unknown"},{"field":"campaign-update-state"}]},{"as":"campaign-update-action-visible","function":"equals-any","args":[{"field":"campaign-action-state"},{"value":"update-available"}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"campaign-description"},{"field":"campaign-icon"},{"field":"campaign-source"},{"field":"campaign-version"},{"field":"campaign-current-version"},{"field":"campaign-update-state"},{"field":"campaign-registration"},{"field":"campaign-update-action-visible"}],"order-by":[{"field":"campaign-name","direction":"asc"}]},{"name":"maintenance-standalone-workflows","subject":"Standalone workflows with retained upstream provenance and update evidence.","objective":"Represent source-managed and local workflows without synthetic campaign membership.","acceptance":"Retain exact coordinates and revisions for source-managed rows; keep local or incomplete rows visible and non-actionable with an explicit reason.","from":"workflows","filter":{"predicates":[{"field":"workflow-role","equals":"standalone"},{"field":"workflow-source-kind","in":["source-managed","local"]}]},"compute":[{"as":"workflow-source-installed-unavailable","function":"equals-any","args":[{"field":"workflow-source-version"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"workflow-source-latest-unavailable","function":"equals-any","args":[{"field":"workflow-source-current-version"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"workflow-is-local","function":"equals-any","args":[{"field":"workflow-source-kind"},{"value":"local"}]},{"as":"workflow-source-state","function":"if","args":[{"field":"workflow-is-local"},{"value":"local"},{"field":"workflow-source-update-state"}]},{"as":"workflow-source-update-available","function":"equals-any","args":[{"field":"workflow-source-state"},{"value":"update-available"}]},{"as":"workflow-source-update-unknown","function":"equals-any","args":[{"field":"workflow-source-state"},{"value":"unknown"}]},{"as":"workflow-update-state-known","function":"if","args":[{"field":"workflow-source-update-available"},{"value":"Update available"},{"value":"Current"}]},{"as":"workflow-update-state-with-unknown","function":"if","args":[{"field":"workflow-source-update-unknown"},{"value":"Update status unavailable"},{"field":"workflow-update-state-known"}]},{"as":"workflow-update-state","function":"if","args":[{"field":"workflow-is-local"},{"value":"Local workflow"},{"field":"workflow-update-state-with-unknown"}]},{"as":"workflow-update-reason-installed","function":"if","args":[{"field":"workflow-source-installed-unavailable"},{"value":"Installed source revision unavailable."},{"value":"Installed and upstream source revisions are available."}]},{"as":"workflow-update-reason-latest","function":"if","args":[{"field":"workflow-source-latest-unavailable"},{"value":"Latest upstream source revision unavailable."},{"field":"workflow-update-reason-installed"}]},{"as":"workflow-update-status-reason","function":"if","args":[{"field":"workflow-is-local"},{"value":"No upstream source coordinate was retained; update manually."},{"field":"workflow-update-reason-latest"}]},{"as":"workflow-update-action-visible","function":"equals-any","args":[{"field":"workflow-source-state"},{"value":"update-available"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-source-kind"},{"field":"workflow-source"},{"field":"workflow-source-version"},{"field":"workflow-source-current-version"},{"field":"workflow-source-update-state"},{"field":"workflow-update-state"},{"field":"workflow-update-status-reason"},{"field":"workflow-update-action-visible"}],"order-by":[{"field":"workflow-update-action-visible","direction":"desc"},{"field":"workflow-name","direction":"asc"}]},{"name":"maintenance-repository-versions","subject":"Group installed and current gh-aw compiler versions and upgrade evidence by repository.","objective":"Identify repositories with declared Markdown workflows whose retained compiler-version evidence warrants upgrade review.","acceptance":"Group Markdown workflow declarations by repository coordinate and return distinct known installed/current version lists, distinct counts, upgrade-required evidence, and separate missing-installed/missing-latest flags. Never infer unavailable versions.","from":"workflows","filter":{"predicates":[{"field":"workflow","includes":".md"}]},"compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"installed-version-unavailable","function":"equals-any","args":[{"field":"gh-aw-version"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"current-version-unavailable","function":"equals-any","args":[{"field":"gh-aw-current-version"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"known-installed-version","function":"if","args":[{"field":"installed-version-unavailable"},{"value":null},{"field":"gh-aw-version"}]},{"as":"known-current-version","function":"if","args":[{"field":"current-version-unavailable"},{"value":null},{"field":"gh-aw-current-version"}]},{"as":"installed-version-unavailable-value","function":"if","args":[{"field":"installed-version-unavailable"},{"value":1},{"value":0}]},{"as":"current-version-unavailable-value","function":"if","args":[{"field":"current-version-unavailable"},{"value":1},{"value":0}]},{"as":"compiler-versions-match","function":"equals-any","args":[{"field":"gh-aw-version"},{"field":"gh-aw-current-version"}]},{"as":"upgrade-candidate-value","function":"if","args":[{"field":"compiler-versions-match"},{"value":0},{"value":1}]},{"as":"upgrade-with-current-evidence","function":"if","args":[{"field":"current-version-unavailable"},{"value":0},{"field":"upgrade-candidate-value"}]},{"as":"upgrade-required-value","function":"if","args":[{"field":"installed-version-unavailable"},{"value":0},{"field":"upgrade-with-current-evidence"}]}],"aggregate":{"by":["repository-coordinate"],"values":[{"field":"known-installed-version","as":"gh-aw-version","reducer":"distinct-list"},{"field":"known-current-version","as":"gh-aw-current-version","reducer":"distinct-list"},{"field":"known-installed-version","as":"installed-version-count","reducer":"distinct-count"},{"field":"known-current-version","as":"current-version-count","reducer":"distinct-count"},{"field":"upgrade-required-value","as":"upgrade-required","reducer":"max"},{"field":"installed-version-unavailable-value","as":"installed-version-unavailable","reducer":"max"},{"field":"current-version-unavailable-value","as":"current-version-unavailable","reducer":"max"}]}},{"name":"maintenance-repositories","subject":"List each repository with recorded compiler versions and computed upgrade state.","objective":"Expose recorded compiler versions, computed upgrade state, and a concise evidence diagnostic per repository, with its GitHub home URL for inspection.","acceptance":"Return repository, repository-url, known version lists, upgrade-required, upgrade-state, upgrade-status-reason, and upgrade-action-visible. Show Upgrade only when known evidence establishes an outdated compiler; missing or conflicting evidence stays visible and non-actionable.","from":"maintenance-repository-versions","compute":[{"as":"repository-url","function":"concat","args":[{"value":"https://github.com/"},{"field":"repository-coordinate"}]},{"as":"should-upgrade","function":"equals-any","args":[{"field":"upgrade-required"},{"value":1}]},{"as":"installed-version-mixed","function":"greater-than","args":[{"field":"installed-version-count"},{"value":1}]},{"as":"current-version-conflicting","function":"greater-than","args":[{"field":"current-version-count"},{"value":1}]},{"as":"installed-version-missing","function":"equals-any","args":[{"field":"installed-version-unavailable"},{"value":1}]},{"as":"current-version-missing","function":"equals-any","args":[{"field":"current-version-unavailable"},{"value":1}]},{"as":"latest-version-evidence-unavailable","function":"if","args":[{"field":"current-version-missing"},{"value":true},{"field":"current-version-conflicting"}]},{"as":"upgrade-status-unavailable","function":"if","args":[{"field":"installed-version-missing"},{"value":true},{"field":"latest-version-evidence-unavailable"}]},{"as":"current-or-unavailable","function":"if","args":[{"field":"should-upgrade"},{"value":true},{"field":"upgrade-status-unavailable"}]},{"as":"upgrade-state-known","function":"if","args":[{"field":"should-upgrade"},{"value":"Upgrade recommended"},{"value":"Current"}]},{"as":"upgrade-state","function":"if","args":[{"field":"upgrade-status-unavailable"},{"value":"Upgrade status unavailable"},{"field":"upgrade-state-known"}]},{"as":"upgrade-reason-known","function":"if","args":[{"field":"should-upgrade"},{"value":"At least one retained workflow uses an older gh-aw compiler version."},{"value":"All retained workflow compiler versions match the latest stable gh-aw release."}]},{"as":"upgrade-reason-mixed","function":"if","args":[{"field":"installed-version-mixed"},{"value":"Mixed installed gh-aw compiler versions were retained; at least one upgrade is recommended."},{"field":"upgrade-reason-known"}]},{"as":"upgrade-reason-installed","function":"if","args":[{"field":"installed-version-missing"},{"value":"Installed gh-aw compiler version unavailable for one or more workflows."},{"field":"upgrade-reason-mixed"}]},{"as":"upgrade-reason-current","function":"if","args":[{"field":"current-version-missing"},{"value":"Latest stable gh-aw release unavailable."},{"field":"upgrade-reason-installed"}]},{"as":"both-compiler-versions-missing","function":"if","args":[{"field":"installed-version-missing"},{"field":"current-version-missing"},{"value":false}]},{"as":"upgrade-reason-both","function":"if","args":[{"field":"both-compiler-versions-missing"},{"value":"Installed compiler version and latest stable gh-aw release are unavailable."},{"field":"upgrade-reason-current"}]},{"as":"upgrade-status-reason","function":"if","args":[{"field":"current-version-conflicting"},{"value":"Conflicting latest gh-aw release evidence was retained."},{"field":"upgrade-reason-both"}]},{"as":"upgrade-action-visible","function":"if","args":[{"field":"upgrade-status-unavailable"},{"value":false},{"field":"should-upgrade"}]},{"as":"installed-version-available","function":"greater-than","args":[{"field":"installed-version-count"},{"value":0}]},{"as":"current-version-available","function":"greater-than","args":[{"field":"current-version-count"},{"value":0}]},{"as":"gh-aw-version-label","function":"if","args":[{"field":"installed-version-available"},{"field":"gh-aw-version"},{"value":"unknown"}]},{"as":"gh-aw-current-version-label","function":"if","args":[{"field":"current-version-available"},{"field":"gh-aw-current-version"},{"value":"unknown"}]}],"select":[{"field":"repository-coordinate","as":"repository"},{"field":"repository-url"},{"field":"gh-aw-version-label","as":"gh-aw-version"},{"field":"gh-aw-current-version-label","as":"gh-aw-current-version"},{"field":"upgrade-required"},{"field":"upgrade-action-visible"},{"field":"upgrade-state"},{"field":"upgrade-status-reason"}],"order-by":[{"field":"repository","direction":"asc"}]},{"name":"maintenance-campaign-updates","subject":"Expose at most one CAO package update row for the Updates navigation indicator.","objective":"Determine whether retained campaign metadata contains an update-available signal for the Updates indicator.","acceptance":"Return zero or one campaign-update-state row only when it equals update-available; an empty result means no matching retained signal, not that every campaign is current.","from":"maintenance-campaign-packages","filter":{"predicates":[{"field":"campaign-update-action-visible","equals":true}]},"select":[{"field":"campaign-update-action-visible"}],"limit":1},{"name":"maintenance-standalone-updates","subject":"Expose at most one standalone workflow source update row for the Updates navigation indicator.","objective":"Determine whether retained source-managed standalone workflow metadata contains an actionable update signal for the Updates indicator.","acceptance":"Return zero or one workflow-update-action-visible row only when it is true; unmanaged local workflows and incomplete source evidence do not activate the indicator.","from":"maintenance-standalone-workflows","filter":{"predicates":[{"field":"workflow-update-action-visible","equals":true}]},"select":[{"field":"workflow-update-action-visible"}],"limit":1},{"name":"maintenance-repository-upgrades","subject":"Expose at most one gh-aw compiler upgrade row for the Updates navigation indicator.","objective":"Determine whether repository compiler metadata contains an upgrade-required signal for the Updates indicator.","acceptance":"Return zero or one upgrade-action-visible row only when known retained evidence establishes an outdated compiler; missing evidence remains non-actionable and does not activate the indicator.","from":"maintenance-repositories","filter":{"predicates":[{"field":"upgrade-action-visible","equals":true}]},"select":[{"field":"upgrade-action-visible"}],"limit":1},{"name":"run-incomplete-outcomes","subject":"Project retained report-incomplete terminal outcomes as concise run diagnoses.","objective":"Find recorded report_incomplete terminal outcomes that can explain a specific run's incomplete reporting.","acceptance":"Include only runs with a recorded report_incomplete terminal outcome, preserving run-attempt identity, outcome kind, and recorded diagnosis; absence is not proof that reporting completed.","description":"One retained incomplete-evidence diagnosis per workflow Run when the agent explicitly reported that required evidence or access was unavailable.","from":"runs","filter":{"predicates":[{"field":"terminal-outcome","equals":"report_incomplete"}]},"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"terminal-outcome","as":"outcome-kind"},{"field":"terminal-outcome-detail","as":"outcome-diagnosis"}]},{"name":"campaign-runs","subject":"Project workflow runs with campaign attribution and retained failure evidence.","objective":"Connect retained run status and failure details to declared campaign/workflow identity for run-level diagnosis.","acceptance":"Expose run and attempt identity, declared attribution, runtime and target repositories, status, failure and incomplete-outcome evidence, timestamps, and drill-down links; do not infer an outcome from runtime success or missing details.","description":"Canonical workflow runs joined to their declared campaign and workflow identity.","from":"runs","joins":[{"source":"workflows","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"declared-campaign"},{"field":"campaign-name","as":"declared-campaign-name"},{"field":"workflow-name","as":"declared-workflow-name"},{"field":"workflow-role","as":"declared-workflow-role"},{"field":"workflow-link","as":"declared-workflow-link"}]},{"source":"run-incomplete-outcomes","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"outcome-kind","as":"outcome-kind"},{"field":"outcome-diagnosis","as":"outcome-diagnosis"}]}],"compute":[{"as":"status","function":"coalesce","args":[{"field":"run-conclusion"},{"field":"run-status"},{"value":"unknown"}]},{"as":"effective-outcome-kind","function":"coalesce","args":[{"field":"outcome-kind"},{"field":"terminal-outcome"},{"value":""}]},{"as":"is-incomplete-outcome","function":"equals-any","args":[{"field":"effective-outcome-kind"},{"value":"report_incomplete"}]},{"as":"diagnosis-kind","function":"if","args":[{"field":"is-incomplete-outcome"},{"value":"incomplete_evidence"},{"value":""}]},{"as":"error-signature","function":"coalesce","args":[{"field":"diagnosis-kind"},{"field":"failure-kind"},{"field":"classification"},{"field":"status"}]},{"as":"_error-signature-default-label","function":"title-case","args":[{"field":"error-signature"}]},{"as":"_is-driver-exit","function":"equals-any","args":[{"field":"error-signature"},{"value":"driver_exit"},{"value":"driver-exit"}]},{"as":"error-signature-label","function":"if","args":[{"field":"_is-driver-exit"},{"value":"Agent process exited unexpectedly"},{"field":"_error-signature-default-label"}]},{"as":"status-detail","function":"coalesce","args":[{"field":"outcome-diagnosis"},{"field":"terminal-outcome-detail"},{"field":"failure-detail"},{"field":"failure-message"},{"field":"failure-step"},{"field":"admission-reason"},{"value":""}]},{"as":"runtime-repository","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"is-worker","function":"equals-any","args":[{"field":"declared-workflow-role"},{"value":"worker"}]},{"as":"is-orchestrator","function":"equals-any","args":[{"field":"declared-workflow-role"},{"value":"orchestrator"}]},{"as":"root-dispatch-type","function":"if","args":[{"field":"is-orchestrator"},{"value":"Campaign orchestrator"},{"value":"Standalone workflow"}]},{"as":"dispatch-type","function":"if","args":[{"field":"is-worker"},{"value":"Campaign worker"},{"field":"root-dispatch-type"}]},{"as":"campaign-display-name","function":"coalesce","args":[{"field":"declared-campaign-name"},{"field":"declared-campaign"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"declared-workflow-name"},{"field":"workflow"}]},{"as":"encoded-campaign","function":"url-encode","args":[{"field":"declared-campaign"}]},{"as":"campaign-dashboard-href","function":"concat","args":[{"value":"#page-campaign-insights?campaign="},{"field":"encoded-campaign"}]},{"as":"campaign-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"campaign-display-name"},{"value":" campaign dashboard"}]},{"as":"campaign-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"campaign-dashboard-href"},{"field":"campaign-dashboard-label"},{"field":"declared-campaign"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"runtime-repository"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"runtime-repository"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"runtime-repository"}]},{"as":"workflow-identity","function":"concat","args":[{"field":"runtime-repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-identity"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-display-name"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-identity"}]}],"select":[{"field":"started-at"},{"field":"dispatch-type"},{"field":"declared-campaign","as":"campaign"},{"field":"declared-campaign-name","as":"campaign-name"},{"field":"declared-workflow-name","as":"workflow-name"},{"field":"run"},{"field":"run-attempt"},{"field":"run-title"},{"field":"event"},{"field":"runtime-repository"},{"field":"target-repository"},{"field":"rollout-mode"},{"field":"status"},{"field":"run-status"},{"field":"error-signature"},{"field":"error-signature-label"},{"field":"status-detail"},{"field":"outcome-kind"},{"field":"outcome-diagnosis"},{"field":"declared-workflow-role","as":"workflow-role"},{"field":"failure-job"},{"field":"failure-message"},{"field":"failure-step"},{"field":"failure-log"},{"field":"engine"},{"field":"engine-version"},{"field":"gh-aw-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"aic-total"},{"field":"safe-items-count"},{"field":"resource-reset-at","as":"status-detail-at"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"declared-workflow-link","as":"workflow-source-link"},{"field":"run-link"},{"field":"campaign-dashboard-link","as":"campaign-link"},{"field":"repository-dashboard-link","as":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"}],"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"campaign-runtime-health-runs","subject":"Project only the run and workflow fields required to classify current campaign runtime health.","objective":"Provide the retained run identity, timing, role, dispatch type, repository, and status needed to assess campaign runtime-health groups.","acceptance":"Project the selected fields from overview-runs without converting missing statuses or unattributed workflows into failures; unavailable run history leaves health assessment incomplete.","description":"A bounded runtime-health input that excludes audit outcomes and presentation-only campaign run fields.","from":"overview-runs","compute":[{"as":"status","function":"coalesce","args":[{"field":"run-conclusion"},{"field":"run-status"},{"value":"unknown"}]},{"as":"runtime-repository","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"is-worker","function":"equals-any","args":[{"field":"workflow-role"},{"value":"worker"}]},{"as":"is-orchestrator","function":"equals-any","args":[{"field":"workflow-role"},{"value":"orchestrator"}]},{"as":"root-dispatch-type","function":"if","args":[{"field":"is-orchestrator"},{"value":"Campaign orchestrator"},{"value":"Standalone workflow"}]},{"as":"dispatch-type","function":"if","args":[{"field":"is-worker"},{"value":"Campaign worker"},{"field":"root-dispatch-type"}]}],"select":[{"field":"started-at"},{"field":"campaign"},{"field":"campaign-name"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"dispatch-type"},{"field":"runtime-repository"},{"field":"run"},{"field":"run-status"},{"field":"status"}]},{"name":"campaign-runtime-health-groups","subject":"Compute each campaign workflow and runtime repository's latest consecutive failure streak in the selected horizon.","objective":"Locate campaign workflow/runtime-repository groups whose most recent retained completed runs have consecutive runtime failures.","acceptance":"Group completed runs by campaign, workflow, role, dispatch type, and runtime repository; failure-count is the latest retained failure streak, not a rate or a claim about runs outside the available horizon.","description":"Current retained failure streaks grouped by campaign workflow and runtime repository, considering only concluded Runs so an in-flight retry cannot mask an active failure streak.","from":"campaign-runtime-health-runs","filter":{"predicates":[{"field":"run-status","equals":"completed"}]},"compute":[{"as":"is-runtime-failure","function":"equals-any","args":[{"field":"status"},{"value":"failure"},{"value":"startup-failure"},{"value":"stale"},{"value":"timed-out"}]},{"as":"runtime-failure-streak-point","function":"failure-streak-point","args":[{"field":"started-at"},{"field":"run"},{"field":"is-runtime-failure"}]}],"aggregate":{"by":["campaign","campaign-name","workflow","workflow-name","workflow-role","dispatch-type","runtime-repository"],"values":[{"field":"runtime-failure-streak-point","as":"failure-count","reducer":"latest-failure-streak"}]}},{"name":"workflow-run-observation-counts","subject":"Count retained Runs for each workflow identity in the selected horizon.","objective":"Measure retained run presence by workflow identity to compare with active orchestrator declarations.","acceptance":"Count overview-runs by organization, repository, and workflow; a missing group indicates no retained matching run in the available horizon, not proof of no executions.","description":"One row per organization, repository, and workflow with retained Run counts, safe to join without row multiplication.","from":"overview-runs","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run","as":"observed-run-count","reducer":"count"}]}},{"name":"campaign-active-orchestrator-run-presence","subject":"Count retained Runs for each active campaign orchestrator in the selected horizon.","objective":"Compare active orchestrator declarations with retained run observations to identify missing visibility.","acceptance":"Keep only workflows declared active with orchestrator role and expose their identity, runtime repository, and observed-run-count; a zero joined count means no retained match, not necessarily a stopped schedule.","description":"Active campaign orchestrators annotated with retained Run presence.","from":"workflows","joins":[{"source":"workflow-run-observation-counts","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"observed-run-count","as":"joined-observed-run-count"}]}],"filter":{"predicates":[{"field":"workflow-role","equals":"orchestrator"},{"field":"workflow-active","equals":"true"}]},"compute":[{"as":"runtime-repository","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"observed-run-count","function":"coalesce","args":[{"field":"joined-observed-run-count"},{"value":0}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"runtime-repository"},{"field":"observed-run-count"}]},{"name":"campaign-unobserved-orchestrator-candidates","subject":"Mark active campaign orchestrators with no retained Runs in the selected horizon.","objective":"Mark active orchestrators lacking retained run evidence for bounded telemetry or schedule review.","acceptance":"Preserve active orchestrator identity and observed-run-count; is-unobserved marks zero retained matches and must not be interpreted as a runtime failure or evidence that dispatch was expected.","description":"Active orchestrators annotated with whether runtime evidence is absent.","from":"campaign-active-orchestrator-run-presence","compute":[{"as":"is-unobserved","function":"equals-any","args":[{"field":"observed-run-count"},{"value":0}]},{"as":"failure-count","function":"sum","args":[{"value":0},{"value":0}]},{"as":"dispatch-type","function":"coalesce","args":[{"value":"Campaign orchestrator"},{"value":"Campaign orchestrator"}]},{"as":"problem-kind","function":"coalesce","args":[{"value":"not-observed"},{"value":"not-observed"}]}]},{"name":"campaign-unobserved-orchestrators","subject":"Show active campaign orchestrators with no retained Runs in the selected horizon.","objective":"List active orchestrator declarations with no retained run observations for follow-up on evidence availability.","acceptance":"Return only is-unobserved candidates with their workflow and repository identity; an empty result does not certify run completeness or scheduler health.","description":"Active campaign orchestrators whose runtime state cannot be established from retained evidence.","from":"campaign-unobserved-orchestrator-candidates","filter":{"predicates":[{"field":"is-unobserved","equals":true}]}},{"name":"dispatches","subject":"Select workflow-dispatch runs from campaign-attributed workflow run evidence.","objective":"Inspect retained workflow_dispatch runs attributed to campaigns before comparing campaign dispatch activity.","acceptance":"Include only campaign-runs with event workflow_dispatch and preserve run, attempt, attribution, status, and time; absence does not establish that no dispatch occurred beyond retained evidence.","description":"Canonical workflow runs whose authoritative trigger is workflow_dispatch.","from":"campaign-runs","filter":{"predicates":[{"field":"event","equals":"workflow_dispatch"}]},"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"campaign-dispatch-inventory","subject":"Project retained dispatch identity and campaign attribution before campaign counting.","objective":"Count dispatches without materializing run diagnoses and presentation links.","acceptance":"Keep workflow_dispatch runs in timestamp order with declared campaign attribution; preserve workflow and incomplete-outcome join quality and duplicate-key failure behavior.","description":"Lean dispatch-count input; the incomplete-outcome join preserves the full campaign run source's evidence quality and fail-closed validation.","from":"runs","joins":[{"source":"workflows","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"declared-campaign"}]},{"source":"run-incomplete-outcomes","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"outcome-kind","as":"outcome-kind"}]}],"filter":{"predicates":[{"field":"event","equals":"workflow_dispatch"}]},"select":[{"field":"declared-campaign","as":"campaign"},{"field":"run"},{"field":"started-at"}],"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"campaign-dispatch-totals","subject":"Summarize observed workflow dispatches for each centrally managed campaign.","objective":"Compare retained workflow_dispatch run counts across attributed campaigns.","acceptance":"Count distinct run identifiers per campaign from dispatches; do not treat missing campaign attribution or unretained dispatches as zero actual activity.","description":"Observed workflow-dispatch run totals grouped by campaign.","from":"campaign-dispatch-inventory","aggregate":{"by":["campaign"],"values":[{"field":"run","as":"dispatches","reducer":"distinct-count"}]}},{"name":"campaign-workflow-totals","subject":"Summarize observed workflow and execution totals for each centrally managed campaign.","objective":"Compare declared orchestrator/worker composition, rollout registration, observed runs, and AI Credit usage by campaign.","acceptance":"Group only orchestrator and worker workflow-inventory rows by campaign; retain workflow count, distinct roles/modes/registration and summed observed runs and AIC, without inferring successful outcomes.","description":"Observed workflow, rollout, run, and AI Credit totals grouped by campaign.","from":"campaign-workflow-inventory","aggregate":{"by":["campaign"],"values":[{"field":"workflow","as":"workflows","reducer":"count"},{"field":"workflow-role","as":"roles","reducer":"distinct-list"},{"field":"rollout-mode","as":"modes","reducer":"distinct-list"},{"field":"workflow-active","as":"registration","reducer":"distinct-list"},{"field":"runs","as":"runs","reducer":"sum"},{"field":"aic","as":"aic","reducer":"sum"}]}},{"name":"campaign-repository-coverage","subject":"Count distinct registered target repositories reached by successful worker dispatches for each campaign.","objective":"Estimate observed campaign target reach from successful worker workflow_dispatch runs joined to registered repositories.","acceptance":"Count distinct matched target-repository values per campaign only for successful worker dispatches; this is observed reach, not verified target outcomes or complete fleet coverage.","description":"Campaign repository coverage derived from successful worker dispatch runs in the selected horizon.","from":"runs","joins":[{"source":"workflows","type":"inner","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"campaign"},{"field":"workflow-role","as":"workflow-role"}]},{"source":"repositories","type":"inner","on":[{"left":"target-repository","right":"repository-coordinate"}],"fields":[{"field":"repository-coordinate","as":"registered-target-repository"}]}],"filter":{"predicates":[{"field":"event","equals":"workflow_dispatch"},{"field":"run-conclusion","equals":"success"},{"field":"workflow-role","equals":"worker"}]},"aggregate":{"by":["campaign"],"values":[{"field":"target-repository","as":"covered-repositories","reducer":"distinct-count"}]}},{"name":"campaign-inventory-preview","subject":"Show declared campaigns before execution evidence is evaluated.","objective":"Expose campaign identities and navigation links while observed totals remain pending.","acceptance":"Preserve every declared campaign and its dashboard link without reporting missing execution totals as zero.","from":"campaigns","compute":[{"as":"encoded-campaign","function":"url-encode","args":[{"field":"campaign"}]},{"as":"campaign-dashboard-href","function":"concat","args":[{"value":"#page-campaign-insights?campaign="},{"field":"encoded-campaign"}]},{"as":"campaign-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"campaign-name"},{"value":" campaign dashboard"}]},{"as":"campaign-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"campaign-dashboard-href"},{"field":"campaign-dashboard-label"},{"field":"campaign"}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"campaign-dashboard-link"}],"order-by":[{"field":"campaign-name","direction":"asc"}]},{"name":"campaign-inventory","subject":"List centrally managed campaigns with their observed workflow and execution totals.","objective":"Compare declared campaigns with retained workflow composition, dispatches, target reach, runs, and AIC to choose an evidence-backed drill-down.","acceptance":"Keep declared campaigns with campaign identity and link plus joined totals; defaulted zero values mean no matching retained evidence and cannot certify no activity, complete coverage, or successful outcomes.","description":"Canonical campaign inventory enriched with observed workflow, rollout, run, repository coverage, and AI Credit totals.","from":"campaigns","joins":[{"source":"campaign-workflow-totals","type":"left","on":[{"left":"campaign","right":"campaign"}],"fields":[{"field":"workflows","as":"observed-workflows"},{"field":"roles","as":"observed-roles"},{"field":"modes","as":"observed-modes"},{"field":"registration","as":"observed-registration"},{"field":"runs","as":"observed-runs"},{"field":"aic","as":"observed-aic"}]},{"source":"campaign-dispatch-totals","type":"left","on":[{"left":"campaign","right":"campaign"}],"fields":[{"field":"dispatches","as":"observed-dispatches"}]},{"source":"campaign-repository-coverage","type":"left","on":[{"left":"campaign","right":"campaign"}],"fields":[{"field":"covered-repositories","as":"observed-covered-repositories"}]}],"compute":[{"as":"workflows","function":"coalesce","args":[{"field":"observed-workflows"},{"value":0}]},{"as":"roles","function":"coalesce","args":[{"field":"observed-roles"},{"value":""}]},{"as":"modes","function":"coalesce","args":[{"field":"observed-modes"},{"field":"campaign-mode"}]},{"as":"registration","function":"coalesce","args":[{"field":"observed-registration"},{"field":"campaign-registration"}]},{"as":"runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"dispatches","function":"coalesce","args":[{"field":"observed-dispatches"},{"value":0}]},{"as":"covered-repositories","function":"coalesce","args":[{"field":"observed-covered-repositories"},{"value":0}]},{"as":"aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]},{"as":"encoded-campaign","function":"url-encode","args":[{"field":"campaign"}]},{"as":"campaign-dashboard-href","function":"concat","args":[{"value":"#page-campaign-insights?campaign="},{"field":"encoded-campaign"}]},{"as":"campaign-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"campaign-name"},{"value":" campaign dashboard"}]},{"as":"campaign-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"campaign-dashboard-href"},{"field":"campaign-dashboard-label"},{"field":"campaign"}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"campaign-dashboard-link"},{"field":"workflows"},{"field":"roles"},{"field":"modes"},{"field":"registration"},{"field":"runs"},{"field":"dispatches"},{"field":"covered-repositories"},{"field":"aic"}],"order-by":[{"field":"campaign-name","direction":"asc"}]},{"name":"firewall-domain-totals","subject":"Show each observed firewall domain with the number of runs and total accepted and blocked requests.","objective":"Identify domains with observed denied requests for a closer review of firewall evidence.","acceptance":"Report distinct observed runs and native accepted and blocked request totals by domain; a denied request alone does not justify allowing egress, and no row does not prove no requests occurred.","description":"Distinct runs and accepted and blocked request totals by firewall domain.","from":"firewall-observations","filter":{"predicates":[{"field":"decision","in":["allowed","denied"]}]},"aggregate":{"by":["domain"],"values":[{"field":"run","as":"run","reducer":"distinct-count"},{"field":"request-count","as":"accepted","reducer":"sum","filter":{"predicates":[{"field":"decision","equals":"allowed"}]}},{"field":"request-count","as":"blocked","reducer":"sum","filter":{"predicates":[{"field":"decision","equals":"denied"}]}}]},"order-by":[{"field":"blocked","direction":"desc"},{"field":"accepted","direction":"desc"},{"field":"domain","direction":"asc"}]},{"name":"firewall-most-blocked-domains","subject":"Highlight the domains with the most blocked firewall requests.","objective":"Prioritize up to ten observed domains by blocked request total for investigation.","acceptance":"Rank by observed blocked totals and inspect underlying domain/workflow evidence before deciding whether a block needs attention; the ranking is not a policy authorization or an incidence rate.","description":"The ten domains with the highest observed blocked request totals.","from":"firewall-domain-totals","order-by":[{"field":"blocked","direction":"desc"},{"field":"domain","direction":"asc"}],"limit":10},{"name":"firewall-domain-workflows","subject":"Show workflows that allowed or blocked requests to each observed firewall domain.","objective":"Locate which observed workflows contributed accepted or denied requests for a domain.","acceptance":"Preserve workflow scope, source link, distinct runs, and native accepted and blocked totals; investigate the run and egress context rather than assuming a denied request is a failure or grounds for wider access.","description":"Workflow-level accepted and blocked request totals by firewall domain.","from":"firewall-observations","filter":{"predicates":[{"field":"decision","in":["allowed","denied"]}]},"compute":[{"as":"workflow-source-url","function":"link-href","args":[{"field":"workflow-link"}]}],"aggregate":{"by":["domain","organization","repository","workflow","workflow-source-url"],"values":[{"field":"run","as":"runs","reducer":"distinct-count"},{"field":"request-count","as":"accepted","reducer":"sum","filter":{"predicates":[{"field":"decision","equals":"allowed"}]}},{"field":"request-count","as":"blocked","reducer":"sum","filter":{"predicates":[{"field":"decision","equals":"denied"}]}}]},"order-by":[{"field":"blocked","direction":"desc"},{"field":"accepted","direction":"desc"},{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"mcp-tool-totals","subject":"Group observed MCP activity by tool and count calls and calling workflows, excluding the internal safe outputs server.","objective":"Expose tool-level call, workflow, and byte totals to investigate observed MCP usage.","acceptance":"Group only observed non-safe-output-server calls by server and tool, preserving counts and byte totals; lack of calls does not establish no access, and call volume does not establish value or permission.","description":"Observed MCP tool-call totals grouped by MCP server and tool, with the number of distinct calling workflows.","from":"mcp-tool-workflow-totals","filter":{"predicates":[{"field":"safe-output-server","equals":false}]},"aggregate":{"by":["mcp-tool-label","mcp-server","mcp-tool"],"values":[{"field":"calls","as":"calls","reducer":"sum"},{"field":"workflow-key","as":"workflows","reducer":"distinct-count"},{"field":"request-bytes","as":"request-bytes","reducer":"sum"},{"field":"response-bytes","as":"response-bytes","reducer":"sum"}]},"select":[{"field":"mcp-tool-label"},{"field":"mcp-tool"},{"field":"mcp-server"},{"field":"calls"},{"field":"workflows"},{"field":"request-bytes"},{"field":"response-bytes"}],"order-by":[{"field":"calls","direction":"desc"},{"field":"mcp-tool-label","direction":"asc"}]},{"name":"mcp-top-tools","subject":"Show the ten most frequently called MCP tools.","objective":"Identify up to ten tools with the highest observed non-safe-output-server call counts for inspection.","acceptance":"Rank observed calls by tool label and inspect grouped tool evidence before drawing conclusions; do not treat popularity as effectiveness or authority to add tools.","description":"The ten MCP tools with the most observed calls, excluding the internal safe outputs server.","from":"mcp-tool-totals","order-by":[{"field":"calls","direction":"desc"},{"field":"mcp-tool-label","direction":"asc"}],"limit":10},{"name":"steering-events","subject":"Prepare observed gateway steering warnings for aggregation by steering type and workflow.","objective":"Expose warning identity, run context, type, and timestamp for downstream steering diagnostics.","acceptance":"Project recorded gateway steering events with workflow and run attribution where available; a warning is not a completed budget overrun, failure, or reason to increase limits.","description":"Gateway steering warnings emitted when a run approaches its AI Credit budget, time limit, or another declared limit, labelled with a readable steering type.","from":"audits","filter":{"predicates":[{"field":"event-type","equals":"firewall.steering"}]},"joins":[{"source":"workflows","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"campaign"},{"field":"workflow-name","as":"workflow-name"}]}],"compute":[{"as":"steering-code","function":"coalesce","args":[{"field":"code"},{"field":"event-status"},{"value":"unknown"}]},{"as":"_token-steering","function":"equals-any","args":[{"field":"steering-code"},{"value":"token_steering"}]},{"as":"_timeout-steering","function":"equals-any","args":[{"field":"steering-code"},{"value":"timeout_steering"}]},{"as":"_turn-steering","function":"equals-any","args":[{"field":"steering-code"},{"value":"turn_steering"},{"value":"max_turns_steering"}]},{"as":"_turn-steering-type","function":"if","args":[{"field":"_turn-steering"},{"value":"Running out of turns"},{"field":"steering-code"}]},{"as":"_timeout-steering-type","function":"if","args":[{"field":"_timeout-steering"},{"value":"Running out of time"},{"field":"_turn-steering-type"}]},{"as":"steering-type","function":"if","args":[{"field":"_token-steering"},{"value":"Running out of tokens"},{"field":"_timeout-steering-type"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"workflow-label","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow-coordinate"}]}],"select":[{"field":"id"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-coordinate"},{"field":"workflow-label"},{"field":"campaign"},{"field":"run"},{"field":"run-link"},{"field":"steering-code"},{"field":"steering-type"},{"field":"event-summary"},{"field":"observed-at"}]},{"name":"steering-type-totals","subject":"Show how often each kind of steering warning occurred.","objective":"Identify steering warning categories to inspect in their run context.","acceptance":"Report observed event totals and distinct runs and workflows by type; confirm underlying warnings before interpreting frequency, and do not infer actual limit breaches.","description":"Observed gateway steering warnings grouped by steering type with the number of affected runs and workflows.","from":"steering-events","aggregate":{"by":["steering-type","steering-code"],"values":[{"field":"id","as":"events","reducer":"count"},{"field":"run","as":"runs","reducer":"distinct-count"},{"field":"workflow-coordinate","as":"workflows","reducer":"distinct-count"}]},"select":[{"field":"steering-type"},{"field":"steering-code"},{"field":"events"},{"field":"runs"},{"field":"workflows"}],"order-by":[{"field":"events","direction":"desc"},{"field":"steering-type","direction":"asc"}]},{"name":"steering-workflow-totals","subject":"Count steering warnings for each workflow.","objective":"Expose workflow-level warning totals and token/time warning breakdowns for downstream review.","acceptance":"Count recorded events and distinct runs by workflow, retaining the declared token/time categories; other types remain in total events and no warning alone establishes a failure.","description":"Gateway steering warnings grouped by workflow, split into token-budget and time-limit warnings.","from":"steering-events","aggregate":{"by":["workflow-coordinate","organization","repository","workflow","workflow-label","campaign"],"values":[{"field":"id","as":"events","reducer":"count"},{"field":"run","as":"runs","reducer":"distinct-count"},{"field":"id","as":"token-events","reducer":"count","filter":{"predicates":[{"field":"steering-code","equals":"token_steering"}]}},{"field":"id","as":"time-events","reducer":"count","filter":{"predicates":[{"field":"steering-code","equals":"timeout_steering"}]}},{"field":"steering-type","as":"steering-types","reducer":"distinct-count"}]},"order-by":[{"field":"events","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}]},{"name":"steering-workflows","subject":"Present workflow steering totals with a link to each workflow dashboard.","objective":"Show observed workflow steering totals with navigation to the affected run context.","acceptance":"Keep workflow identity, link, events, runs, and warning breakdowns tied to their grouped evidence; use drill-through before recommending changes, not warning counts as a basis to widen budgets.","description":"Workflow steering totals labelled with a link to the workflow runtime page.","from":"steering-workflow-totals","compute":[{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-label"}]}],"select":[{"field":"workflow-coordinate"},{"field":"workflow-label"},{"field":"workflow-dashboard-link"},{"field":"organization"},{"field":"repository"},{"field":"campaign"},{"field":"events"},{"field":"runs"},{"field":"token-events"},{"field":"time-events"},{"field":"steering-types"}],"order-by":[{"field":"events","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}]},{"name":"steering-top-workflows","subject":"Highlight the workflows with the most steering warnings.","objective":"Prioritize up to ten workflows by observed warning count for investigation.","acceptance":"Rank recorded warning totals with workflow context, checking underlying events and telemetry coverage; a high rank neither proves overrun nor justifies a limit change.","description":"The ten workflows with the highest observed gateway steering warning totals.","from":"steering-workflows","order-by":[{"field":"events","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}],"limit":10},{"name":"entity-workflow-run-totals","subject":"Summarize run outcomes and AI Credit consumption for reusable workflow cards.","objective":"Compare retained run-attempt activity, recorded conclusions, and AI Credit usage per workflow card.","acceptance":"Group by organization, repository, and workflow; expose distinct run-attempt count, success/failure conclusion counts, and sum of recorded AIC, without treating missing run history as zero actual activity.","from":"runs","compute":[{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run-attempt-identity","as":"runs","reducer":"distinct-count"},{"field":"run-attempt-identity","as":"aic-runs","reducer":"distinct-count","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"run-conclusion","as":"successful-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","equals":"success"}]}},{"field":"run-conclusion","as":"failed-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","stale","timed-out"]}]}},{"field":"aic-total","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}}]}},{"name":"entity-workflows","subject":"Project workflow entities for reusable workflow cards and repository drill-down.","objective":"Relate declared workflows to observed run and AIC totals for workflow-level drill-down.","acceptance":"Keep declared workflow identity, role, registration, campaign, link, and joined totals; a missing run match defaults to displayed zeros but does not establish no executions or outcomes.","from":"workflows","joins":[{"source":"entity-workflow-run-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"successful-runs","as":"observed-successful-runs"},{"field":"failed-runs","as":"observed-failed-runs"},{"field":"aic","as":"observed-aic"},{"field":"aic-runs","as":"observed-aic-runs"}]}],"compute":[{"as":"runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"successful-runs","function":"coalesce","args":[{"field":"observed-successful-runs"},{"value":0}]},{"as":"failed-runs","function":"coalesce","args":[{"field":"observed-failed-runs"},{"value":0}]},{"as":"aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]},{"as":"aic-per-run","function":"quotient","args":[{"field":"aic"},{"field":"observed-aic-runs"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"workflow-active"},{"field":"campaign-name"},{"field":"observed-at"},{"field":"runs"},{"field":"successful-runs"},{"field":"failed-runs"},{"field":"aic-per-run"},{"field":"workflow-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"repository-runs","subject":"Project canonical runs into repository-addressable run evidence.","objective":"Expose retained run chronology and status for a selected repository's drill-down.","acceptance":"Retain repository coordinate, workflow, run identity, title, event, start time, conclusion, mode, AIC, and run link; absent details or runs do not establish a healthy or idle repository.","description":"Workflow runs with a stable repository route key.","from":"runs","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]}],"select":[{"field":"repository-coordinate"},{"field":"workflow"},{"field":"run"},{"field":"run-title"},{"field":"event"},{"field":"started-at"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"rollout-mode"},{"field":"aic-total"},{"field":"run-link"}],"order-by":[{"field":"started-at","direction":"desc"},{"field":"run","direction":"desc"}]},{"name":"repository-workflow-totals","subject":"Summarize declared and disabled workflow counts by repository.","objective":"Compare declared and disabled workflow counts for each repository in the retained workflow inventory.","acceptance":"Count declared workflows and workflow-active=false entries by organization and repository; missing declarations must not be interpreted as a complete zero-workflow inventory.","description":"Declared and disabled workflow totals for each repository.","from":"workflows","aggregate":{"by":["organization","repository"],"values":[{"field":"workflow","as":"workflows","reducer":"count"},{"field":"workflow","as":"disabled","reducer":"count","filter":{"predicates":[{"field":"workflow-active","equals":"false"}]}}]}},{"name":"repository-report-totals","subject":"Summarize published outcome report counts by repository.","objective":"Show retained outcome-report volume per repository for comparison with observed execution.","acceptance":"Count retained outcome rows by organization and repository; a missing aggregate does not prove no reports were published or that reported outcomes succeeded.","description":"Published report totals for each repository.","from":"outcomes","aggregate":{"by":["organization","repository"],"values":[{"field":"repository","as":"reports","reducer":"count"}]}},{"name":"repository-run-identities","subject":"Project the run-attempt identities needed to match imported evidence.","objective":"Keep import-coverage joins narrow without carrying run details, links, or costs.","acceptance":"Preserve each selected run attempt and its organization, repository, workflow, run, and attempt keys. Do not deduplicate attempts or change selected-horizon semantics.","from":"runs","select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"}]},{"name":"repository-import-totals","subject":"Count selected run attempts with matching retained imported records.","objective":"Join compact run identities to already reduced event evidence, then reduce import coverage by repository.","acceptance":"Match all five run-attempt keys and count each selected run row once when events are positive. Preserve optional-evidence quality and horizon filters; records for unselected runs do not establish coverage.","from":"repository-run-identities","joins":[{"source":"event-runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"events","as":"imported-events"}]}],"compute":[{"as":"imported","function":"greater-than","args":[{"field":"imported-events"},{"value":0}]}],"aggregate":{"by":["organization","repository"],"values":[{"field":"imported","as":"imported-runs","reducer":"sum"}]}},{"name":"repository-run-totals","subject":"Summarize distinct runs, failures, and approval-required runs by repository.","objective":"Join already reduced run statistics and import coverage at repository grain.","acceptance":"Group by organization and repository; preserve distinct run IDs, configured failure/action-required conclusion counts, and imported-run sums. Missing enrichment or run history must not be treated as complete coverage.","description":"Distinct run and conclusion totals for each repository.","from":"repository-run-statistics","joins":[{"source":"repository-import-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"imported-runs","as":"imported-runs"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"runs"},{"field":"failed"},{"field":"action-required"},{"field":"imported-runs"}]},{"name":"repository-activity-preview","subject":"List repository identities before execution metrics are computed.","objective":"Show retained repository identities and drill links while activity metrics are pending.","acceptance":"List repositories by organization with repository drill links; this preview does not establish activity totals or outcomes.","description":"Fast repository inventory with drill links; activity fields remain pending.","from":"repositories","compute":[{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-slug"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-slug"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-slug"}]}],"select":[{"field":"organization"},{"field":"repository-slug","as":"repository"},{"field":"repository-dashboard-link","as":"repository-link"}],"order-by":[{"field":"repository","direction":"asc"}]},{"name":"repository-activity-core","subject":"Join each repository with its workflow, report, and run totals.","objective":"Attach retained workflow, report, and run aggregates to each repository for bounded inventory review.","acceptance":"Preserve each repository and the available joined aggregates by organization and repository; unmatched metrics remain missing evidence, not confirmed zero activity or evaluated outcomes.","description":"Repository inventory joined with workflow, report, evaluation, and run totals.","from":"repositories","joins":[{"source":"repository-workflow-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"workflows","as":"observed-workflows"},{"field":"disabled","as":"observed-disabled"}]},{"source":"repository-report-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"reports","as":"observed-reports"}]},{"source":"repository-run-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"failed","as":"observed-failed"},{"field":"action-required","as":"observed-action-required"},{"field":"imported-runs","as":"observed-imported-runs"}]}]},{"name":"repository-activity","subject":"Show repository-level execution health, outcome activity, and AI Credit usage in an actionable inventory.","objective":"Prioritize repository drill-down using declared workflows, observed runs, reports, failures, import coverage, and AIC.","acceptance":"Return repository identity and link with retained counts, ingestion indicator, failure summary, AIC, and computed status; statuses describe retained evidence only, and an empty or unavailable preview cannot verify health, outcomes, or zero activity.","description":"Repository-local execution health and attributed outcome totals.","from":"repository-activity-core","joins":[{"source":"repository-aic-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"aic","as":"observed-aic"}]}],"compute":[{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflows","function":"coalesce","args":[{"field":"observed-workflows"},{"value":0}]},{"as":"disabled","function":"coalesce","args":[{"field":"observed-disabled"},{"value":0}]},{"as":"runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"failed","function":"coalesce","args":[{"field":"observed-failed"},{"value":0}]},{"as":"imported-runs","function":"coalesce","args":[{"field":"observed-imported-runs"},{"value":0}]},{"as":"ingestion-rate","function":"quotient","args":[{"field":"imported-runs"},{"field":"runs"}]},{"as":"ingestion","function":"format-percent","args":[{"field":"ingestion-rate"}]},{"as":"action-required","function":"coalesce","args":[{"field":"observed-action-required"},{"value":0}]},{"as":"aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]},{"as":"has-failures","function":"greater-than","args":[{"field":"failed"},{"value":0}]},{"as":"has-action-required","function":"greater-than","args":[{"field":"action-required"},{"value":0}]},{"as":"has-runs","function":"greater-than","args":[{"field":"runs"},{"value":0}]},{"as":"has-disabled","function":"greater-than","args":[{"field":"disabled"},{"value":0}]},{"as":"outcomes-observed","function":"coalesce","args":[{"field":"observed-reports"},{"value":0}]},{"as":"has-outcomes","function":"greater-than","args":[{"field":"outcomes-observed"},{"value":0}]},{"as":"failure-rate","function":"quotient","args":[{"field":"failed"},{"field":"runs"}]},{"as":"failure-percent","function":"format-percent","args":[{"field":"failure-rate"}]},{"as":"failure-count","function":"format-count","args":[{"field":"failed"}]},{"as":"observed-failure-summary","function":"concat","args":[{"field":"failure-percent"},{"value":" · "},{"field":"failure-count"},{"value":" failed"}]},{"as":"failure-summary","function":"if","args":[{"field":"has-runs"},{"field":"observed-failure-summary"},{"value":"—"}]},{"as":"outcome-status","function":"if","args":[{"field":"has-outcomes"},{"value":"Outcomes observed"},{"value":"No recent activity"}]},{"as":"disabled-status","function":"if","args":[{"field":"has-disabled"},{"value":"Disabled workflows"},{"field":"outcome-status"}]},{"as":"run-status","function":"if","args":[{"field":"has-runs"},{"value":"No failures observed"},{"field":"disabled-status"}]},{"as":"action-status","function":"if","args":[{"field":"has-action-required"},{"value":"Approval required"},{"field":"run-status"}]},{"as":"status","function":"if","args":[{"field":"has-failures"},{"value":"Needs attention"},{"field":"action-status"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-slug"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-slug"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-slug"}]}],"select":[{"field":"organization"},{"field":"repository","as":"repository-name"},{"field":"repository-slug","as":"repository"},{"field":"workflows"},{"field":"observed-reports","as":"reports"},{"field":"runs"},{"field":"ingestion"},{"field":"failure-summary"},{"field":"aic"},{"field":"status"},{"field":"repository-dashboard-link","as":"repository-link"},{"field":"failed"}],"order-by":[{"field":"failed","direction":"desc"},{"field":"runs","direction":"desc"},{"field":"repository","direction":"asc"}]},{"name":"repository-daily-run-buckets","subject":"Select repository run counts by whole UTC start-day buckets.","objective":"Keep count selection independent of retained Run detail.","acceptance":"Use UTC midnight and request bounds, matching the Runs daily chart; do not fabricate sub-day totals or missing days.","from":"daily-run-counts","compute":[{"as":"day-midnight","function":"concat","args":[{"field":"day"},{"value":"T00:00:00Z"}]},{"as":"day-ms","function":"timestamp","args":[{"field":"day-midnight"}]},{"as":"start-ms","function":"timestamp","args":[{"context":"time-start"}]},{"as":"end-ms","function":"timestamp","args":[{"context":"time-end"}]},{"as":"before-start","function":"greater-than","args":[{"field":"start-ms"},{"field":"day-ms"}]},{"as":"before-end","function":"greater-than","args":[{"field":"end-ms"},{"field":"day-ms"}]}]},{"name":"repository-observed-run-counts","subject":"Count observed logical Runs by repository from persistent daily buckets.","objective":"Supply the run-volume chart without computing activity health, ingestion coverage, or workflow costs.","acceptance":"Sum daily totals, not attempts or retained detail. Select whole UTC start-day buckets by midnight and preserve partial or unavailable coverage.","from":"repository-daily-run-buckets","filter":{"predicates":[{"field":"before-start","in":[false,null]},{"field":"before-end","in":[true,null]}]},"compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]}],"aggregate":{"by":["organization","repository-coordinate"],"values":[{"field":"total","as":"runs","reducer":"sum"}]}},{"name":"repository-run-inventory","subject":"Registered repositories and observed daily logical Run counts.","objective":"Compare repository execution volume and choose repositories for drill-down.","acceptance":"Keep top 100 identities and drill links with stable count and repository ordering. Zero means no admitted dated Runs in selected UTC buckets, not inactivity. Preserve partial coverage; unavailable daily evidence must not produce zeros. Table keeps full inventory.","from":"repository-activity-preview","joins":[{"source":"repository-observed-run-counts","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository-coordinate"}],"fields":[{"field":"runs","as":"observed-runs"}]}],"compute":[{"as":"runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"runs"},{"field":"repository-link"}],"order-by":[{"field":"runs","direction":"desc"},{"field":"repository","direction":"asc"}],"limit":100},{"name":"workflow-route-record","subject":"Project the selected workflow's identity and registration for its route shell.","objective":"Identify the workflow and its recorded campaign registration before inspecting route-specific evidence.","acceptance":"Preserve organization, repository, workflow identity, recorded role, activation, campaign, rollout mode, and source link; absent registration is not inferred from runs, and displayed activation does not grant execution authority.","from":"workflows","select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"workflow-active"},{"field":"campaign"},{"field":"campaign-name"},{"field":"rollout-mode"},{"field":"workflow-link"}]},{"name":"workflow-runtime-health-summary","subject":"Sum daily runtime conclusion counts for the selected workflow.","objective":"Inspect observed dated runs independently of retained detail.","acceptance":"Sum by organization/repository/workflow without adding detail; successful, failed, approval, pending, and other sum to total. Dates use UTC run start; undated evidence is incomplete and missing projection is unavailable. Pending is last-observed state, success is not a verified outcome, and sub-day filters are unsupported.","from":"daily-run-counts","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"total","as":"total","reducer":"sum"},{"field":"successful","as":"successful","reducer":"sum"},{"field":"failed","as":"failed","reducer":"sum"},{"field":"approval","as":"approval","reducer":"sum"},{"field":"pending","as":"pending","reducer":"sum"},{"field":"other","as":"other","reducer":"sum"}]}},{"name":"workflow-runtime-usage-summary","subject":"Sum retained AI Credits and count telemetry rows for the selected workflow without transferring runs.","objective":"Inspect a workflow's observed AI Credit consumption together with the amount of retained usage telemetry.","acceptance":"AI Credits sum the retained aic values within each organization, repository, and workflow, and telemetry-count counts its usage records; absent telemetry does not establish zero cost or complete run coverage.","from":"usage","compute":[{"as":"positive-aic","function":"greater-than","args":[{"field":"aic"},{"value":0}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"aic","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"run","as":"telemetry-count","reducer":"count"}]}},{"name":"outcome-route-record","subject":"Project the selected safe-output record for the outcome route and its sections.","objective":"Inspect a retained safe output's recorded disposition and follow its durable evidence links.","acceptance":"Preserve safe-output and run identity, title, category, disposition, summary, timestamps, rollout mode, workflow context, and retained links; missing fields stay unknown and a recorded disposition is not independently verified operational impact.","from":"outcomes","select":[{"field":"safe-output"},{"field":"run"},{"field":"outcome-title"},{"field":"outcome-number"},{"field":"outcome-category"},{"field":"outcome-status"},{"field":"outcome-state"},{"field":"outcome-summary"},{"field":"published-at"},{"field":"observed-at"},{"field":"rollout-mode"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-link"},{"field":"external-link"},{"field":"issue-link"},{"field":"pull-request-link"},{"field":"run-link"}]},{"name":"entity-runs","subject":"Project run entities for reusable run cards and workflow drill-down.","objective":"Expose retained run-attempt identity, execution timing, conclusion, and link for a bounded workflow-run inspection.","acceptance":"Keep organization, repository, workflow, run and attempt with status, conclusion, event, branch, duration, timestamps, and run link; missing timing or conclusion remains unknown rather than inferred success.","from":"runs","select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"target-repository"},{"field":"run"},{"field":"run-attempt"},{"field":"run-title"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"event"},{"field":"branch"},{"field":"duration"},{"field":"started-at"},{"field":"ended-at"},{"field":"run-link"}],"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"workflow-runs","subject":"Project canonical runs into route-addressable workflow run evidence.","objective":"Trace retained runs and recorded failure evidence for a selected workflow route.","acceptance":"Preserve workflow route, run identity, start/end, status, conclusion, failure fields, mode, engine/model metadata, and run link; missing failure details do not prove success or rule out incomplete import.","description":"Workflow runs with a stable repository and workflow route key.","from":"runs","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-route","function":"concat","args":[{"field":"repository-coordinate"},{"value":":"},{"field":"workflow"}]}],"select":[{"field":"workflow-route"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-title"},{"field":"event"},{"field":"started-at"},{"field":"ended-at"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"failure-job"},{"field":"failure-message"},{"field":"failure-step"},{"field":"failure-log"},{"field":"rollout-mode"},{"field":"engine"},{"field":"engine-version"},{"field":"gh-aw-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"run-link"}],"order-by":[{"field":"started-at","direction":"desc"},{"field":"run","direction":"desc"}]},{"name":"workflow-failure-trend","subject":"Show recent failure counts and their change for each workflow.","objective":"Spot a change in observed workflow failure activity without treating unknown conclusions as failures.","acceptance":"Each observed failure counts once within its own workflow; the first change is undefined and the seven-observation window is not a seven-day calendar interval.","from":"workflow-runs","compute":[{"as":"is-failure","function":"equals-any","args":[{"field":"run-conclusion"},{"value":"failure"},{"value":"timed_out"}]},{"as":"failure-count","function":"if","args":[{"field":"is-failure"},{"value":1},{"value":0}]}],"window":[{"operation":"rolling","field":"failure-count","as":"recent-failure-count","frame":7,"reducer":"sum","order-by":[{"field":"started-at","direction":"asc"},{"field":"run","direction":"asc"}],"groupby":["workflow-route"]},{"operation":"change","field":"recent-failure-count","as":"failure-count-change","mode":"absolute","order-by":[{"field":"started-at","direction":"asc"},{"field":"run","direction":"asc"}],"groupby":["workflow-route"]}]},{"name":"workflow-reports","subject":"Project retained outcomes into route-addressable workflow reports.","objective":"Review retained workflow outcome reports separately from execution status before interpreting operational results.","acceptance":"Keep route, safe output, report title and summary, recorded status, category, observation time, metadata, and external link; missing reports or status do not imply success or no work.","description":"Workflow outcome reports with stable route keys and disposition fields.","from":"outcomes","compute":[{"as":"report-repository","function":"coalesce","args":[{"field":"runtime-repository"},{"field":"repository"}]},{"as":"workflow-route","function":"concat","args":[{"field":"report-repository"},{"value":":"},{"field":"workflow"}]},{"as":"report-status","function":"coalesce","args":[{"field":"outcome-status"},{"field":"outcome-state"},{"value":"unknown"}]}],"select":[{"field":"workflow-route"},{"field":"safe-output"},{"field":"outcome-title"},{"field":"outcome-summary"},{"field":"report-status","as":"outcome-status"},{"field":"rollout-mode"},{"field":"engine"},{"field":"engine-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"outcome-category"},{"field":"observed-at"},{"field":"external-link"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"outcome-title","direction":"asc"}]},{"name":"value-measurement-facts","subject":"Original native primary and diagnostic observations from reviewed batch evaluators.","objective":"Keep periods, native units, evaluator identity and missingness inspectable without inventing delivery events.","acceptance":"Null is unavailable, not zero. Interval measurements are not snapshots or cumulative accepted contributions.","from":"workflow-value-measurements","time":{"range":"all"},"compute":[{"as":"measurement-marker","function":"literal","args":[{"value":1}]},{"as":"measurement-missing","function":"equals-any","args":[{"field":"value"},{"value":null}]},{"as":"known-measurement","function":"concat","args":[{"field":"value"},{"value":" "},{"field":"metric-unit"}]},{"as":"measurement-label","function":"if","args":[{"field":"measurement-missing"},{"value":"Not measured"},{"field":"known-measurement"}]},{"as":"measurement-context","function":"concat","args":[{"field":"repository"},{"value":" · "},{"field":"workflow-name"}]}]},{"name":"value-measurement-order","subject":"Latest assessment of each workflow measure, including unavailable assessments.","objective":"Do not let an older numeric value hide a newer incomplete period.","acceptance":"Choose latest cutoff and assessment before considering value or coverage; preserve evaluator digest.","from":"value-measurement-facts","window":[{"operation":"change","field":"measurement-marker","as":"older-measurement","mode":"absolute","groupby":["repository","workflow-route","workflow-slug","campaign","value-id"],"order-by":[{"field":"window-end","direction":"desc"},{"field":"observed-at","direction":"desc"}]}]},{"name":"value-current-measurements","subject":"Latest native primary measurements, separately from event-ledger reports.","objective":"Expose ordinary reviewed batch results on the same Value surface.","acceptance":"Do not infer healthy outcomes, accepted implementations or complete coverage from a non-null value.","from":"value-measurement-order","filter":{"predicates":[{"field":"older-measurement","equals":"unknown"},{"field":"metric-role","equals":"primary"}]}},{"name":"value-evidence-facts","subject":"Published original evidence for frozen workflow value contracts.","objective":"Keep report identity, target repository, workflow and capture together.","acceptance":"Read canonical evidence only. No GitHub acquisition, HTML loading or fabricated evidence on navigation.","from":"operational-value-evidence","time":{"range":"all"}},{"name":"value-contracts","subject":"One retained contract per repository, workflow and versioned native measure.","objective":"Compute each report independently before selecting current workflow results.","acceptance":"Preserve separate versions and exact report identity. Latest-version selection belongs to the workflow result query.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"contract"}]},"compute":[{"as":"report-marker","function":"literal","args":[{"value":1}]}]},{"name":"value-measurement-captures","subject":"Accepted complete native batch assessments, separately from collection decisions.","objective":"Expose actual retained capture clocks without advancing them on failure or partial data.","acceptance":"Only mature complete non-null primary assessments establish an accepted capture; zero remains valid.","from":"value-measurement-facts","filter":{"predicates":[{"field":"metric-role","equals":"primary"},{"field":"measurement-missing","equals":false},{"field":"coverage-status","equals":"complete"},{"field":"maturity-status","equals":"matured"}]},"compute":[{"as":"report-marker","function":"literal","args":[{"value":1}]}],"select":[{"field":"workflow-route"},{"field":"observed-at"},{"field":"window-end"},{"field":"id","as":"capture-id"},{"field":"report-marker"}]},{"name":"value-contract-captures","subject":"Original capture clocks from accepted rich evidence packets.","objective":"Align capture metadata without merging measured populations.","acceptance":"This union is capture metadata only, never combined metric totals.","from":"value-contracts","select":[{"field":"workflow-route"},{"field":"observed-at"},{"field":"window-end"},{"field":"report-id","as":"capture-id"},{"field":"report-marker"}]},{"name":"value-capture-order","subject":"Actual captures across the retained measures of each workflow.","objective":"Expose the last accepted capture independently of collection decisions.","acceptance":"Select by original capture time. A deferred or failed check cannot advance evidence clocks.","from":"value-contract-captures","union":["value-measurement-captures"],"window":[{"operation":"change","field":"report-marker","as":"later-capture","mode":"absolute","groupby":["workflow-route"],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"capture-id","direction":"desc"}]}]},{"name":"value-latest-capture","subject":"One last accepted capture per workflow, not a freshness claim.","objective":"Join capture and cutoff without multiplying collection registrations.","acceptance":"Missing packets remain unavailable, never zero or an inferred successful collection.","from":"value-capture-order","filter":{"predicates":[{"field":"later-capture","equals":"unknown"}]}},{"name":"value-collection-health","subject":"Reviewed registration and authoritative collection decisions, with independently retained evidence.","objective":"Explain disabled, unconfigured, deferred, failed and not-yet-captured workflows.","acceptance":"Use published collector facts, not missing result cards. Preserve decision, attempt, capture and cutoff as distinct clocks.","from":"workflow-value-collections","time":{"range":"all"},"joins":[{"source":"value-latest-capture","type":"left","on":[{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"observed-at","as":"captured-at"},{"field":"window-end","as":"evidence-cutoff"}]}],"compute":[{"as":"workflow-context","function":"concat","args":[{"field":"workflow"},{"value":" · "},{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"capture-missing","function":"equals-any","args":[{"field":"captured-at"},{"value":null}]},{"as":"evidence-state","function":"if","args":[{"field":"capture-missing"},{"value":"No retained capture"},{"value":"Retained evidence available"}]}],"order-by":[{"field":"organization","direction":"asc"},{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"value-registered-collections","subject":"Reviewed Value registrations, including explicit disables and registrations with no report.","objective":"Make collection health visible before the first accepted packet.","acceptance":"Registration is independent of measured outcomes. No enrollment or acquisition follows from navigation.","from":"value-collection-health","filter":{"predicates":[{"field":"registration","in":["enabled","disabled"]}]},"limit":1000},{"name":"value-snapshots","subject":"Independent repository-state observations and exact item drill-downs.","objective":"Keep everyone's changes separate from workflow-linked delivery.","acceptance":"Retain observed native values, dates and immutable references. Do not invent intermediate observations.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"snapshot"}]},"compute":[{"as":"snapshot-marker","function":"literal","args":[{"value":1}]},{"as":"encoded-snapshot","function":"url-encode","args":[{"field":"snapshot-route"}]},{"as":"snapshot-href","function":"concat","args":[{"value":"#page-value-snapshot?snapshot="},{"field":"encoded-snapshot"}]}],"order-by":[{"field":"at","direction":"asc"},{"field":"fact-id","direction":"asc"}]},{"name":"value-first-snapshot-order","subject":"First independently observed repository state.","objective":"Name the actual first-snapshot reference rather than an invented baseline.","acceptance":"Strictly use retained snapshot time. A post-adoption snapshot is not a pre-adoption baseline.","from":"value-snapshots","window":[{"operation":"change","field":"snapshot-marker","as":"earlier-snapshot","mode":"absolute","groupby":["report-id","workflow-route"],"order-by":[{"field":"at","direction":"asc"}]}]},{"name":"value-first-snapshot","subject":"First retained snapshot per report.","objective":"Provide the explicit reference value and date.","acceptance":"No retained reference means no comparison.","from":"value-first-snapshot-order","filter":{"predicates":[{"field":"earlier-snapshot","equals":"unknown"}]}},{"name":"value-last-snapshot-order","subject":"Latest independently observed repository state.","objective":"Show the actual last measurement rather than an extrapolation.","acceptance":"Preserve the latest retained snapshot even if unchanged.","from":"value-snapshots","window":[{"operation":"change","field":"snapshot-marker","as":"later-snapshot","mode":"absolute","groupby":["report-id","workflow-route"],"order-by":[{"field":"at","direction":"desc"}]}]},{"name":"value-last-snapshot","subject":"Last retained snapshot per report.","objective":"Provide the current native observation.","acceptance":"One snapshot establishes state, not movement.","from":"value-last-snapshot-order","filter":{"predicates":[{"field":"later-snapshot","equals":"unknown"}]}},{"name":"value-output-counts","subject":"Retained safe outputs and applied creation receipts.","objective":"Describe output activity without treating it as accepted value.","acceptance":"Count distinct validated output facts. Tracking corroboration is not an applied receipt.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"output"}]},"aggregate":{"by":["report-id","workflow-route"],"values":[{"field":"fact-id","as":"retained-outputs","reducer":"count"},{"field":"fact-id","as":"receipt-outputs","reducer":"count","filter":{"predicates":[{"field":"origin","equals":"receipt-verified"}]}}]}},{"name":"value-implementation-counts","subject":"Distinct accepted implementations and their measured native effects.","objective":"Count each accepted implementation once, including zero and negative effects.","acceptance":"Validated implementation identities are unique; many-to-many output edges must not multiply value. Complete coverage is checked separately.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"implementation"}]},"compute":[{"as":"accepted-ms","function":"timestamp","args":[{"field":"at"}]},{"as":"cutoff-ms","function":"timestamp","args":[{"field":"window-end"}]},{"as":"current-start","function":"difference","args":[{"field":"cutoff-ms"},{"value":2419200000}]},{"as":"previous-start","function":"difference","args":[{"field":"cutoff-ms"},{"value":4838400000}]},{"as":"before-current","function":"greater-than","args":[{"field":"current-start"},{"field":"accepted-ms"}]},{"as":"before-previous","function":"greater-than","args":[{"field":"previous-start"},{"field":"accepted-ms"}]},{"as":"current-effect","function":"if","args":[{"field":"before-current"},{"value":0},{"field":"value"}]},{"as":"previous-candidate","function":"if","args":[{"field":"before-previous"},{"value":0},{"field":"value"}]},{"as":"previous-effect","function":"if","args":[{"field":"before-current"},{"field":"previous-candidate"},{"value":0}]}],"aggregate":{"by":["report-id","workflow-route"],"values":[{"field":"fact-id","as":"accepted-implementations","reducer":"count"},{"field":"value","as":"known-result","reducer":"sum"},{"field":"current-effect","as":"known-recent","reducer":"sum"},{"field":"previous-effect","as":"known-previous","reducer":"sum"}]}},{"name":"value-covered-durations","subject":"Explicit complete evidence durations in the report and adjacent 28-day delivery periods.","objective":"Distinguish known zero from gaps or incomplete evidence.","acceptance":"The producer validates non-overlapping bounded coverage. Count only complete intervals, clipped to each exact half-open period.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"coverage"},{"field":"coverage-status","equals":"complete"}]},"compute":[{"as":"left-ms","function":"timestamp","args":[{"field":"at"}]},{"as":"right-ms","function":"timestamp","args":[{"field":"end-at"}]},{"as":"cutoff-ms","function":"timestamp","args":[{"field":"window-end"}]},{"as":"current-start","function":"difference","args":[{"field":"cutoff-ms"},{"value":2419200000}]},{"as":"previous-start","function":"difference","args":[{"field":"cutoff-ms"},{"value":4838400000}]},{"as":"after-current","function":"greater-than","args":[{"field":"left-ms"},{"field":"current-start"}]},{"as":"after-previous","function":"greater-than","args":[{"field":"left-ms"},{"field":"previous-start"}]},{"as":"before-current-end","function":"greater-than","args":[{"field":"current-start"},{"field":"right-ms"}]},{"as":"current-left","function":"if","args":[{"field":"after-current"},{"field":"left-ms"},{"field":"current-start"}]},{"as":"previous-left","function":"if","args":[{"field":"after-previous"},{"field":"left-ms"},{"field":"previous-start"}]},{"as":"previous-right","function":"if","args":[{"field":"before-current-end"},{"field":"right-ms"},{"field":"current-start"}]},{"as":"duration","function":"difference","args":[{"field":"right-ms"},{"field":"left-ms"}]},{"as":"current-duration","function":"difference","args":[{"field":"right-ms"},{"field":"current-left"}]},{"as":"previous-duration","function":"difference","args":[{"field":"previous-right"},{"field":"previous-left"}]},{"as":"positive-current","function":"greater-than","args":[{"field":"current-duration"},{"value":0}]},{"as":"positive-previous","function":"greater-than","args":[{"field":"previous-duration"},{"value":0}]},{"as":"covered-current","function":"if","args":[{"field":"positive-current"},{"field":"current-duration"},{"value":0}]},{"as":"covered-previous","function":"if","args":[{"field":"positive-previous"},{"field":"previous-duration"},{"value":0}]}],"aggregate":{"by":["report-id","workflow-route"],"values":[{"field":"duration","as":"covered-duration","reducer":"sum"},{"field":"covered-current","as":"covered-current","reducer":"sum"},{"field":"covered-previous","as":"covered-previous","reducer":"sum"}]}},{"name":"value-report-delivery","subject":"Evidence-qualified output and accepted-contribution totals.","objective":"Keep populations and native units separate without an implied conversion rate.","acceptance":"Absent output context is unknown. Missing coverage withholds complete totals and recent zero, retaining labelled known subtotals.","from":"value-contracts","joins":[{"source":"value-output-counts","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"retained-outputs","as":"retained-outputs"},{"field":"receipt-outputs","as":"retained-receipts"}]},{"source":"value-implementation-counts","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"accepted-implementations","as":"retained-implementations"},{"field":"known-result","as":"known-result"},{"field":"known-recent","as":"known-recent"},{"field":"known-previous","as":"known-previous"}]},{"source":"value-covered-durations","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"covered-duration","as":"covered-duration"},{"field":"covered-current","as":"covered-current"},{"field":"covered-previous","as":"covered-previous"}]}],"compute":[{"as":"start-ms","function":"timestamp","args":[{"field":"window-start"}]},{"as":"end-ms","function":"timestamp","args":[{"field":"window-end"}]},{"as":"report-duration","function":"difference","args":[{"field":"end-ms"},{"field":"start-ms"}]},{"as":"complete-report","function":"equals-any","args":[{"field":"covered-duration"},{"field":"report-duration"}]},{"as":"complete-current","function":"equals-any","args":[{"field":"covered-current"},{"value":2419200000}]},{"as":"complete-previous","function":"equals-any","args":[{"field":"covered-previous"},{"value":2419200000}]},{"as":"show-workflow-trail","function":"equals-any","args":[{"field":"measurement-basis"},{"value":"workflow-contribution"}]},{"as":"known-output-count","function":"coalesce","args":[{"field":"retained-outputs"},{"value":0}]},{"as":"known-receipt-count","function":"coalesce","args":[{"field":"retained-receipts"},{"value":0}]},{"as":"receipt-outputs","function":"if","args":[{"field":"outputs-available"},{"field":"known-receipt-count"},{"value":null}]},{"as":"accepted-implementations","function":"coalesce","args":[{"field":"retained-implementations"},{"value":0}]},{"as":"output-count","function":"if","args":[{"field":"outputs-available"},{"field":"known-output-count"},{"value":null}]},{"as":"native-result","function":"coalesce","args":[{"field":"known-result"},{"value":0}]},{"as":"current-subtotal","function":"coalesce","args":[{"field":"known-recent"},{"value":0}]},{"as":"previous-subtotal","function":"coalesce","args":[{"field":"known-previous"},{"value":0}]},{"as":"recent-result","function":"if","args":[{"field":"complete-current"},{"field":"current-subtotal"},{"value":null}]},{"as":"previous-result","function":"if","args":[{"field":"complete-previous"},{"field":"previous-subtotal"},{"value":null}]}]},{"name":"value-report-summary","subject":"Shared native card and report comparison against the first retained snapshot.","objective":"Show signed repository-wide movement, the goal direction and the exact comparison dates.","acceptance":"This first/last snapshot comparison is not the adjacent-period alert policy, a pre-adoption baseline or causal workflow credit. One snapshot is not zero change.","from":"value-report-delivery","joins":[{"source":"value-first-snapshot","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"value","as":"reference-value"},{"field":"at","as":"reference-at"}]},{"source":"value-last-snapshot","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"value","as":"current-value"},{"field":"at","as":"current-at"},{"field":"snapshot-href","as":"current-snapshot-href"}]}],"compute":[{"as":"same-snapshot","function":"equals-any","args":[{"field":"reference-at"},{"field":"current-at"}]},{"as":"raw-change","function":"difference","args":[{"field":"current-value"},{"field":"reference-value"}]},{"as":"native-change","function":"if","args":[{"field":"same-snapshot"},{"value":null},{"field":"raw-change"}]},{"as":"change-missing","function":"equals-any","args":[{"field":"native-change"},{"value":null}]},{"as":"rising","function":"greater-than","args":[{"field":"native-change"},{"value":0}]},{"as":"falling","function":"greater-than","args":[{"value":0},{"field":"native-change"}]},{"as":"unchanged","function":"equals-any","args":[{"field":"native-change"},{"value":0}]},{"as":"decrease-goal","function":"equals-any","args":[{"field":"snapshot-direction"},{"value":"decrease"}]},{"as":"increase-goal","function":"equals-any","args":[{"field":"snapshot-direction"},{"value":"increase"}]},{"as":"increase-movement","function":"if","args":[{"field":"rising"},{"value":"Better"},{"value":"Worse"}]},{"as":"decrease-movement","function":"if","args":[{"field":"falling"},{"value":"Better"},{"value":"Worse"}]},{"as":"directed-movement","function":"if","args":[{"field":"decrease-goal"},{"field":"decrease-movement"},{"field":"increase-movement"}]},{"as":"known-movement","function":"if","args":[{"field":"unchanged"},{"value":"Unchanged"},{"field":"directed-movement"}]},{"as":"movement","function":"if","args":[{"field":"change-missing"},{"value":"Comparison unavailable"},{"field":"known-movement"}]},{"as":"increase-direction-label","function":"if","args":[{"field":"increase-goal"},{"value":"↑ Higher is better"},{"value":"Direction not retained"}]},{"as":"direction-label","function":"if","args":[{"field":"decrease-goal"},{"value":"↓ Lower is better"},{"field":"increase-direction-label"}]},{"as":"change-arrow","function":"if","args":[{"field":"rising"},{"value":"↑ +"},{"value":"↓ "}]},{"as":"change-number","function":"format-count","args":[{"field":"native-change"}]},{"as":"directional-delta","function":"concat","args":[{"field":"change-arrow"},{"field":"change-number"},{"value":" "},{"field":"snapshot-unit"}]},{"as":"known-delta","function":"if","args":[{"field":"unchanged"},{"value":"Unchanged"},{"field":"directional-delta"}]},{"as":"delta-label","function":"if","args":[{"field":"change-missing"},{"value":"Comparison unavailable"},{"field":"known-delta"}]},{"as":"signed-change","function":"concat","args":[{"field":"change-arrow"},{"field":"change-number"},{"value":" "},{"field":"snapshot-unit"},{"value":" · "},{"field":"movement"}]},{"as":"unchanged-change","function":"if","args":[{"field":"unchanged"},{"value":"Unchanged"},{"field":"signed-change"}]},{"as":"change-label","function":"if","args":[{"field":"change-missing"},{"value":"Comparison unavailable"},{"field":"unchanged-change"}]},{"as":"reference-day","function":"date-day","args":[{"field":"reference-at"}]},{"as":"known-comparison-label","function":"concat","args":[{"value":"Since "},{"field":"reference-day"},{"value":" · Everyone's work"}]},{"as":"comparison-label","function":"if","args":[{"field":"change-missing"},{"value":"No earlier snapshot for comparison"},{"field":"known-comparison-label"}]},{"as":"workflow-label","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"workflow-context","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":" · "},{"field":"workflow-label"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-route"}]},{"as":"workflow-value-href","function":"concat","args":[{"value":"#page-workflow-value?workflow="},{"field":"encoded-workflow"}]},{"as":"encoded-report","function":"url-encode","args":[{"field":"report-id"}]},{"as":"report-href","function":"concat","args":[{"value":"#page-value-report?report="},{"field":"encoded-report"}]}]},{"name":"value-workflow-result-order","subject":"Version ordering after independently computing each report.","objective":"Keep exact report queries partition-local without changing latest-version selection.","acceptance":"Rank cutoffs then captures within each workflow and measure. Explicit report links do not need other report facts.","from":"value-report-summary","window":[{"operation":"change","field":"report-marker","as":"older-report","mode":"absolute","groupby":["organization","repository","workflow","workflow-route","metric-id"],"order-by":[{"field":"window-end","direction":"desc"},{"field":"observed-at","direction":"desc"},{"field":"report-id","direction":"desc"}]}]},{"name":"value-workflow-results","subject":"Current published report results per native measure.","objective":"Expose the latest coherent packet on the workflow Value tab.","acceptance":"Never replace missing facts with an older measured version. Explicit report links retain their own version.","from":"value-workflow-result-order","filter":{"predicates":[{"field":"older-report","equals":"unknown"}]}},{"name":"value-workflow-headline-order","subject":"Most recent current report across the measures of each workflow.","objective":"Give each workflow and repository one headline result; other measures stay on the workflow page.","acceptance":"Select by cutoff then capture. Never replace a missing result with an older or zero value.","from":"value-workflow-results","window":[{"operation":"change","field":"report-marker","as":"older-headline","mode":"absolute","groupby":["workflow-route"],"order-by":[{"field":"window-end","direction":"desc"},{"field":"observed-at","direction":"desc"},{"field":"report-id","direction":"desc"}]}]},{"name":"value-workflow-headlines","subject":"One headline result per workflow and repository.","objective":"Join cleanly to collection health without multiplying rows.","acceptance":"Exactly one row per workflow route.","from":"value-workflow-headline-order","filter":{"predicates":[{"field":"older-headline","equals":"unknown"}]}},{"name":"value-workflow-reported-overview","subject":"Workflows with a retained headline result, with any published collection state.","objective":"Show a report even when no collection fact was published for its workflow.","acceptance":"A missing collection fact stays unknown, never an inferred registration.","from":"value-workflow-headlines","joins":[{"source":"value-collection-health","type":"left","on":[{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"collection-state","as":"overview-state"},{"field":"reason","as":"overview-reason"}]}],"compute":[{"as":"overview-title","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":" · "},{"field":"workflow-label"}]},{"as":"overview-evidence","function":"literal","args":[{"value":"Retained evidence available"}]}],"select":[{"field":"workflow-route"},{"field":"overview-title"},{"field":"overview-state"},{"field":"overview-reason"},{"field":"overview-evidence"},{"field":"observed-at","as":"overview-captured"},{"field":"window-end","as":"overview-cutoff"},{"field":"change-label","as":"trend-label"},{"field":"movement","as":"trend-movement"},{"field":"snapshot-name","as":"trend-measure"},{"field":"report-href","as":"overview-href"}]},{"name":"value-workflow-registered-reports","subject":"Registered workflows marked with whether a headline result exists.","objective":"Separate registration from retained outcomes before selecting unreported workflows.","acceptance":"Join on workflow route only; one row per registration.","from":"value-registered-collections","joins":[{"source":"value-workflow-headlines","type":"left","on":[{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"report-id","as":"headline-report"}]}],"compute":[{"as":"has-report","function":"equals-any","args":[{"field":"headline-report"},{"value":null}]}]},{"name":"value-workflow-unreported-overview","subject":"Registered workflows that have no retained headline result.","objective":"Keep collection health visible before the first accepted packet.","acceptance":"No result is not zero value or a healthy outcome.","from":"value-workflow-registered-reports","filter":{"predicates":[{"field":"has-report","equals":true}]},"compute":[{"as":"overview-title","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":" · "},{"field":"workflow"}]},{"as":"trend-label","function":"literal","args":[{"value":"No retained result"}]},{"as":"trend-movement","function":"literal","args":[{"value":"No result to compare"}]},{"as":"trend-measure","function":"literal","args":[{"value":"Not available"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-route"}]},{"as":"overview-href","function":"concat","args":[{"value":"#page-workflow-value?workflow="},{"field":"encoded-workflow"}]}],"select":[{"field":"workflow-route"},{"field":"overview-title"},{"field":"collection-state","as":"overview-state"},{"field":"reason","as":"overview-reason"},{"field":"evidence-state","as":"overview-evidence"},{"field":"captured-at","as":"overview-captured"},{"field":"evidence-cutoff","as":"overview-cutoff"},{"field":"trend-label"},{"field":"trend-movement"},{"field":"trend-measure"},{"field":"overview-href"}]},{"name":"value-workflow-overview","subject":"One row per workflow and repository: collection health plus its headline result trend.","objective":"Show the first-to-last trend and collection state in a single card.","acceptance":"Missing reports remain unavailable, never zero. Registration and outcome stay independent facts.","from":"value-workflow-reported-overview","union":["value-workflow-unreported-overview"],"order-by":[{"field":"overview-title","direction":"asc"}],"limit":1000},{"name":"value-intent-sources","subject":"Immutable extracted workflow intent sources.","objective":"Let readers inspect the original goal and requirements.","acceptance":"Only retained HTTPS evidence is linked; workflow text remains untrusted.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"intent-source"}]}},{"name":"value-requirements","subject":"Original full acceptance requirements.","objective":"Distinguish the measured structural facet from all workflow safeguards.","acceptance":"Requirements are source text, not proof they passed.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"requirement"}]}},{"name":"value-outputs","subject":"Retained safe-output lifecycle facts.","objective":"Show receipts, current-at-cutoff state and originating evidence.","acceptance":"A closed output is not automatically an accepted implementation; absence of a link is unknown.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"output"}]},"order-by":[{"field":"at","direction":"desc"},{"field":"fact-id","direction":"asc"}]},{"name":"value-output-origin-evidence","subject":"Retained producer and applied safe-output evidence.","objective":"Let readers distinguish receipt-confirmed creation from corroborated tracking.","acceptance":"Tracking identities locate outputs but do not establish accepted value. Keep unavailable producer evidence explicit.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"output-evidence"}]},"joins":[{"source":"value-outputs","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"parent-id","right":"fact-id"}],"fields":[{"field":"label","as":"output-label"},{"field":"url","as":"output-url"}]}]},{"name":"value-implementations","subject":"Accepted implementations and native before/after effects.","objective":"Expose delivery time and immutable acceptance evidence.","acceptance":"Do not equate acceptance with full quality verification or omit negative effects.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"implementation"}]},"order-by":[{"field":"at","direction":"desc"},{"field":"fact-id","direction":"asc"}]},{"name":"value-output-trails","subject":"Explicit output-to-implementation edges.","objective":"Make the trail from a proposal to an accepted measured change inspectable.","acceptance":"Use retained dated edges only. Many-to-many links do not duplicate headline counts or values.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"output-implementation"}]},"joins":[{"source":"value-outputs","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"parent-id","right":"fact-id"}],"fields":[{"field":"label","as":"output-label"},{"field":"url","as":"output-url"}]},{"source":"value-implementations","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"related-id","right":"fact-id"}],"fields":[{"field":"label","as":"implementation-label"},{"field":"url","as":"implementation-url"},{"field":"value","as":"implementation-value"},{"field":"at","as":"trail-accepted-at"}]}]},{"name":"value-implementation-files","subject":"Measured implementation files and retained lineage sources.","objective":"Link to exact Git facts rather than only a repository tree.","acceptance":"No URL is reconstructed from an unrelated revision. Preserve before, after and replacement file evidence.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","in":["implementation-evidence","implementation-lineage"]}]},"joins":[{"source":"value-implementations","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"parent-id","right":"fact-id"}],"fields":[{"field":"label","as":"implementation-label"},{"field":"url","as":"implementation-url"}]}]},{"name":"value-quality-checks","subject":"Explicit independent verification checks.","objective":"Keep unverified behavior, tests and other safeguards visible.","acceptance":"Missing or not-verified is not a passing check.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"quality-check"}]}},{"name":"value-limitations","subject":"Retained evidence and attribution limitations.","objective":"Qualify claims without inventing completeness.","acceptance":"Treat source limitations as untrusted text and never suppress them.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"limitation"}]}},{"name":"value-snapshot-items","subject":"Actual counted items at an independent immutable snapshot.","objective":"Open exact per-item evidence from the plotted observation.","acceptance":"Only retained items are shown. Missing item evidence must not look like an empty measured population.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"snapshot-item"}]},"joins":[{"source":"value-snapshots","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"parent-id","right":"fact-id"},{"left":"snapshot-route","right":"snapshot-route"}],"fields":[{"field":"at","as":"snapshot-at"}]}]},{"name":"audit-event-summary-buckets","subject":"Aggregate high- and medium-severity audit events with the same severity and summary by workflow.","objective":"Select recurring high- or medium-severity audit summaries for run-level investigation.","acceptance":"Each bucket's event count is traceable to retained audit or tool observations with the same campaign, severity, workflow, and summary; missing workflow attribution stays unknown, and a count alone does not verify impact.","description":"High- and medium-severity audit event counts grouped by severity, workflow, and shared summary.","from":"audits","union":["tools"],"filter":{"predicates":[{"field":"event-type","in":["audit.finding","audit.observability","audit.recommendation","audit.missing_tool","audit.missing_data","audit.noop","audit.mcp_failure","skill.invoked"]},{"field":"event-status","in":["high","medium"]}]},"joins":[{"source":"workflows","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"campaign"}]}],"aggregate":{"by":["campaign","event-status","workflow","event-summary"],"values":[{"field":"event","as":"events","reducer":"count"}]},"select":[{"field":"campaign"},{"field":"event-status"},{"field":"workflow"},{"field":"event-summary"},{"field":"events"}],"order-by":[{"field":"event-status","direction":"asc"},{"field":"events","direction":"desc"},{"field":"workflow","direction":"asc"},{"field":"event-summary","direction":"asc"}]},{"name":"campaign-workflows","subject":"List campaign-owned orchestrator and worker workflows with database-backed execution totals.","objective":"Choose an active campaign workflow whose observed execution warrants inspection.","acceptance":"Listed workflows match active declared orchestrator or worker inventory entries; runs and AI Credits agree with the selected-horizon inventory, and absence is not evidence of disabled authority or no executions. Rollout mode is context, not permission to change policy.","description":"Campaign workflows projected from lean canonical inventory, with shared declaration names and active-only workflow drill-down links.","from":"campaign-workflow-inventory","filter":{"predicates":[{"field":"workflow-active","equals":"true"}]},"compute":[{"as":"workflow-identity","function":"concat","args":[{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-identity"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-display-name"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-identity"}]}],"select":[{"field":"campaign"},{"field":"campaign-display-name","as":"campaign-name"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-role"},{"field":"rollout-mode"},{"field":"workflow-active"},{"field":"runs"},{"field":"aic"},{"field":"repository-dashboard-link","as":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"}],"order-by":[{"field":"campaign-name","direction":"asc"},{"field":"workflow-role","direction":"asc"},{"field":"workflow-name","direction":"asc"}]},{"name":"campaign-repository-declarations","subject":"List active declared campaign workflows and their owning repositories without execution evidence.","objective":"Inspect campaign repository topology without computing unused run totals or import coverage.","acceptance":"Preserve active orchestrator and worker identities, display names, rollout context, links, and ordering. Declaration counts are not target enrollment, dispatch coverage, or execution totals. Empty inventory and unavailable workflow evidence remain distinct.","description":"Declaration-only repository topology. Run totals and import-evidence quality belong to execution views, not this inventory.","from":"campaign-workflow-declarations","filter":{"predicates":[{"field":"workflow-active","equals":"true"}]},"select":[{"field":"campaign"},{"field":"campaign-display-name","as":"campaign-name"},{"field":"organization"},{"field":"repository-slug","as":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"workflow-active"},{"field":"repository-dashboard-link","as":"repository-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"campaign-repository-inventory","subject":"Present declared campaign repository topology in workflow display order.","objective":"Filter and search projected repository coordinates and workflow names without time-filtering structural declarations.","acceptance":"Preserve the campaign workflow list's stable ordering and declaration-only evidence quality; runtime horizons must not remove declared workflows.","from":"campaign-repository-declarations","order-by":[{"field":"campaign-name","direction":"asc"},{"field":"workflow-role","direction":"asc"},{"field":"workflow-name","direction":"asc"}]},{"name":"campaign-reports","subject":"Project retained outcomes into campaign-addressable report evidence.","objective":"Identify a campaign report whose durable outcome record needs follow-up.","acceptance":"Each report's campaign, title, source link, observation time, and disposition match its retained outcome; missing status is labeled unknown rather than accepted or resolved, and report production is not verified impact.","description":"Campaign outcome reports with database-backed disposition fields.","from":"outcomes","compute":[{"as":"report-status","function":"coalesce","args":[{"field":"outcome-status"},{"field":"outcome-state"},{"value":"unknown"}]}],"select":[{"field":"campaign"},{"field":"safe-output"},{"field":"outcome-title"},{"field":"outcome-summary"},{"field":"report-status","as":"outcome-status"},{"field":"rollout-mode"},{"field":"engine"},{"field":"engine-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"outcome-category"},{"field":"observed-at"},{"field":"external-link"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"outcome-title","direction":"asc"}]},{"name":"campaign-worker-issues","subject":"Project issue outcomes created by campaign worker workflows.","objective":"Choose a campaign worker issue whose current recorded disposition needs review.","acceptance":"Include only issues whose producing run joins declared worker inventory on organization, repository, and workflow, even when the issue lands elsewhere. Preserve campaign and role across Activity imports. Retain run and status evidence; missing closure details stay unknown and closure is not proof of resolution.","description":"Campaign-addressable issue outcomes restricted to declared worker workflows.","from":"outcomes","joins":[{"source":"workflows","type":"inner","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"workflow-role","as":"declared-workflow-role"}]}],"filter":{"predicates":[{"field":"outcome-category","equals":"issue"},{"field":"declared-workflow-role","equals":"worker"}]},"select":[{"field":"campaign"},{"field":"organization"},{"field":"repository"},{"field":"safe-output"},{"field":"outcome-number"},{"field":"outcome-title","as":"event-summary"},{"field":"outcome-title"},{"field":"outcome-summary"},{"field":"outcome-status"},{"field":"outcome-state"},{"field":"issue-state"},{"field":"issue-closed"},{"field":"issue-state-reason"},{"field":"issue-status"},{"field":"issue-closing-status"},{"field":"issue-status-detail"},{"field":"issue-closed-at"},{"field":"issue-status-observed-at"},{"field":"outcome-category","as":"safe-output-type"},{"field":"workflow"},{"field":"workflow-name"},{"field":"run"},{"field":"observed-at"},{"field":"issue-link"},{"field":"external-link"},{"field":"run-link"}],"order-by":[{"field":"observed-at","direction":"desc"}]},{"name":"campaign-issue-tab-counts","subject":"Count the retained worker issues available for each campaign Reports tab.","objective":"Decide whether a campaign has retained worker issue reports to inspect.","acceptance":"For each returned campaign, items equals the number of rows in campaign-worker-issues for that campaign in the same horizon; missing campaigns are not treated as zero issues or verified resolution.","description":"One campaign row with the number of retained issue outcomes produced by campaign workers.","from":"campaign-worker-issues","aggregate":{"by":["campaign"],"values":[{"field":"campaign","as":"items","reducer":"count"}]}},{"name":"campaign-readme-orchestrators","subject":"Resolve one repository link for each campaign README from its declared orchestrator workflow.","objective":"Locate the declared orchestrator repository to contextualize a campaign README.","acceptance":"Each returned campaign and repository link traces to a declared orchestrator workflow; missing or multiple declarations are reported as uncertain rather than inventing a canonical repository.","from":"workflows","filter":{"predicates":[{"field":"workflow-role","equals":"orchestrator"}]},"select":[{"field":"campaign"},{"field":"repository-link"}]},{"name":"campaign-readme-details","subject":"Present retained campaign README content with its repository-relative link context.","objective":"Open the campaign's retained README in its declared repository context before relying on its guidance.","acceptance":"The README text and path match the campaign record and any repository link resolves through a declared orchestrator; absent content or repository linkage remains unavailable, not inferred.","from":"campaigns","joins":[{"source":"campaign-readme-orchestrators","type":"left","on":[{"left":"campaign","right":"campaign"}],"fields":[{"field":"repository-link","as":"repository-link"}]}],"select":[{"field":"campaign"},{"field":"campaign-readme"},{"field":"campaign-readme-path"},{"field":"repository-link"}]},{"name":"campaign-memory-campaigns","subject":"Provide the registered campaigns whose repository memory can be browsed together.","objective":"Choose a registered campaign for repository-memory inspection.","acceptance":"Each campaign identity and display name matches the retained campaign registry in the selected scope; listing a campaign does not establish that memory observations exist or are complete.","description":"Registered campaigns ordered for the all-campaign repository-memory browser.","from":"campaigns","select":[{"field":"campaign"},{"field":"campaign-name"}],"order-by":[{"field":"campaign-name","direction":"asc"}]},{"name":"campaign-performance-baseline-totals","subject":"Establish a selected-horizon campaign baseline from concluded run attempts while keeping reliability, unverified production, and efficiency as separate facts.","objective":"Select campaigns whose retained run reliability, output production, or AI Credit efficiency merits closer examination.","acceptance":"Concluded and successful attempts, outputs, and mean AI Credits reconcile to filtered retained runs; absent denominators or costs stay unknown. Produced outputs are unverified, not operational value.","description":"Canonical campaign run attempts aggregated into bounded selected-horizon baseline totals without treating runtime success or produced outputs as operational value.","from":"campaign-runs","compute":[{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["campaign"],"values":[{"field":"run-attempt-identity","as":"concluded-runs","reducer":"count","filter":{"predicates":[{"field":"status","in":["success","failure","cancelled","timed-out","action-required","neutral","skipped","stale","startup-failure"]}]}},{"field":"run-attempt-identity","as":"successful-runs","reducer":"count","filter":{"predicates":[{"field":"status","equals":"success"}]}},{"field":"safe-items-count","as":"runs-with-output-evidence","reducer":"count","filter":{"predicates":[{"field":"status","equals":"success"}]}},{"field":"safe-items-count","as":"produced-outputs","reducer":"sum","filter":{"predicates":[{"field":"status","equals":"success"}]}},{"field":"aic-total","as":"aic-per-successful-run","reducer":"mean","filter":{"predicates":[{"field":"status","equals":"success"},{"field":"positive-aic","equals":true}]}}]}},{"name":"campaign-performance-baseline","subject":"Turn each campaign's selected-horizon baseline totals into deterministic reliability and production signals with an explicit successful-run efficiency fact.","objective":"Decide which campaign baseline signal needs run- or output-level verification next.","acceptance":"Success-rate and signal labels follow the retained totals and their explicit denominators; no concluded attempts or output evidence is distinguished from zero verified impact, and AI Credits per successful run remain a separate cost fact rather than a value score.","description":"A bounded, explainable baseline that distinguishes runtime reliability, unverified output production, and AI Credit efficiency.","from":"campaign-performance-baseline-totals","compute":[{"as":"success-rate","function":"quotient","args":[{"field":"successful-runs"},{"field":"concluded-runs"}]},{"as":"success-rate-display","function":"format-percent","args":[{"field":"success-rate"}]},{"as":"success-rate-percent","function":"product","args":[{"field":"success-rate"},{"value":100}]},{"as":"has-concluded-runs","function":"greater-than","args":[{"field":"concluded-runs"},{"value":0}]},{"as":"has-unsuccessful-runs","function":"greater-than","args":[{"field":"concluded-runs"},{"field":"successful-runs"}]},{"as":"observed-reliability-signal","function":"if","args":[{"field":"has-unsuccessful-runs"},{"value":"Unsuccessful runs observed"},{"value":"No unsuccessful runs observed"}]},{"as":"reliability-signal","function":"if","args":[{"field":"has-concluded-runs"},{"field":"observed-reliability-signal"},{"value":"No concluded runs observed"}]},{"as":"has-output-evidence","function":"greater-than","args":[{"field":"runs-with-output-evidence"},{"value":0}]},{"as":"has-produced-outputs","function":"greater-than","args":[{"field":"produced-outputs"},{"value":0}]},{"as":"observed-production-signal","function":"if","args":[{"field":"has-produced-outputs"},{"value":"Outputs produced; acceptance unverified"},{"value":"No outputs observed"}]},{"as":"production-signal","function":"if","args":[{"field":"has-output-evidence"},{"field":"observed-production-signal"},{"value":"Output evidence unavailable"}]}],"select":[{"field":"campaign"},{"field":"concluded-runs"},{"field":"successful-runs"},{"field":"success-rate"},{"field":"success-rate-display"},{"field":"success-rate-percent"},{"field":"reliability-signal"},{"field":"produced-outputs"},{"field":"production-signal"},{"field":"aic-per-successful-run"}]},{"name":"campaign-problem-runs","subject":"List retained failed runs for campaign problem investigation.","objective":"Choose a recent failed campaign run to investigate with its diagnostic evidence.","acceptance":"Each row corresponds to a retained campaign run with a declared failure, startup-failure, stale, or timed-out status; campaign-problem-run-evidence orders matching rows newest first. Absence is not proof of healthy execution or complete ingestion.","description":"Private failed-run input with retained diagnostic metadata; the evidence consumer orders only runs matching current runtime problems.","from":"campaign-runs","filter":{"predicates":[{"field":"status","in":["failure","startup-failure","stale","timed-out"]}]}},{"name":"campaign-problem-runtime-failures","subject":"Select current failing runtime partitions without presentation ordering.","objective":"Retain the exact current-failure eligibility needed by the problem evidence join.","acceptance":"A latest failure streak is a nonnegative integer, so failure-count at least one is equivalent to has-current-failure; missing or incomplete runtime evidence remains unknown.","description":"Private unsorted failure partitions for problem evidence; ordering is supplied by the retained failed runs.","from":"campaign-runtime-health-groups","filter":{"predicates":[{"field":"failure-count","gte":1}]},"compute":[{"as":"problem-kind","function":"coalesce","args":[{"value":"failure"},{"value":"failure"}]}]},{"name":"campaign-problem-runtime-partitions","subject":"Project current runtime problem keys and diagnoses for the failed-run evidence join.","objective":"Avoid sorting and retaining unused runtime problem presentation fields.","acceptance":"Retain both current failures and unobserved orchestrators, including their metadata and duplicate-key failure semantics; this projection does not establish health or root cause.","description":"Private compact equivalent of campaign-runtime-problems for equality enrichment, not presentation.","from":"campaign-problem-runtime-failures","union":["campaign-unobserved-orchestrators"],"select":[{"field":"campaign"},{"field":"workflow"},{"field":"runtime-repository"},{"field":"failure-count"},{"field":"problem-kind"}]},{"name":"campaign-problem-run-evidence","subject":"Attach the current campaign runtime problem summary to each retained failed Run for that partition.","objective":"Inspect the failure count and problem kind alongside a failed run without inferring its root cause.","acceptance":"Each returned row joins a retained failed run to a runtime problem on campaign, workflow, and runtime repository; the inner join drops unmatched runs, so compare with campaign-problem-runs before interpreting absence as no problem.","description":"Failed campaign runs annotated with the failure-count and problem-kind of their active runtime problem, one row per retained failed Run.","from":"campaign-problem-runs","joins":[{"source":"campaign-problem-runtime-partitions","type":"inner","on":[{"left":"campaign","right":"campaign"},{"left":"workflow","right":"workflow"},{"left":"runtime-repository","right":"runtime-repository"}],"fields":[{"field":"failure-count","as":"failure-count"},{"field":"problem-kind","as":"problem-kind"}]}],"order-by":[{"field":"started-at","direction":"desc"},{"field":"run","direction":"desc"}]},{"name":"campaign-problem-latest-target-runs","subject":"Identify the most recent retained failed Run for each campaign workflow target repository.","objective":"Select the latest retained failed run identity for each campaign workflow and target partition.","acceptance":"For every returned campaign, workflow, runtime repository, and target repository, latest-target-run agrees with the maximum retained failed run identity in that partition; a missing partition is not a healthy target.","description":"One row per campaign workflow and target repository with its most recent retained failed Run identity.","from":"campaign-problem-run-evidence","aggregate":{"by":["campaign","workflow","runtime-repository","target-repository"],"values":[{"field":"run","as":"latest-target-run","reducer":"max"}]}},{"name":"campaign-problem-error-groups","subject":"Cluster retained failed Run evidence by workflow, runtime repository, target repository, and error signature so repeated identical failures for one target collapse into one diagnosable group.","objective":"Rank repeated target-specific error signatures for investigation without merging unrelated failures.","acceptance":"Occurrence-count and latest-run match retained failed runs grouped by campaign, workflow, repositories, problem kind, and signature; unknown signatures may group together. Counts do not prove a root cause.","description":"One row per distinct target repository and error signature within a campaign runtime problem partition, with an occurrence count and the most recent matching Run identity for follow-up.","from":"campaign-problem-run-evidence","aggregate":{"by":["campaign","campaign-name","workflow","workflow-name","workflow-role","runtime-repository","target-repository","rollout-mode","failure-count","problem-kind","error-signature","error-signature-label"],"values":[{"field":"run","as":"occurrence-count","reducer":"count"},{"field":"run","as":"latest-run","reducer":"max"}]}},{"name":"campaign-current-problem-error-groups","subject":"Keep only the newest error signature for each campaign workflow target repository.","objective":"Focus investigation on the signature associated with the latest retained failed run per target.","acceptance":"Each returned group joins campaign-problem-latest-target-runs on campaign, workflow, runtime repository, and latest run ID; target repository is not a join key, so verify target identity against underlying runs before claiming one current signature per target.","description":"Current target-specific error groups whose representative Run is the target repository's most recent retained failed Run.","from":"campaign-problem-error-groups","joins":[{"source":"campaign-problem-latest-target-runs","type":"inner","on":[{"left":"campaign","right":"campaign"},{"left":"workflow","right":"workflow"},{"left":"runtime-repository","right":"runtime-repository"},{"left":"latest-run","right":"latest-target-run"}],"fields":[{"field":"latest-target-run","as":"current-target-run"}]}]},{"name":"campaign-problem-items","subject":"Attach the most recent representative Run evidence to each distinct campaign runtime problem error signature.","objective":"Open the representative failed run and target for each current campaign problem group.","acceptance":"Check joined run-link, run ID, campaign, workflow, and runtime repository; verify target against run evidence (not a join key). Unobserved orchestrators need inventory review. Missing evidence remains unknown; rollout mode does not authorize policy changes.","description":"Current campaign runtime problems represented by the newest error signature for each target repository, with its effective rollout mode, an occurrence count, the most recent matching failed Run, and a repair prompt.","from":"campaign-current-problem-error-groups","joins":[{"source":"campaign-problem-run-evidence","type":"inner","on":[{"left":"campaign","right":"campaign"},{"left":"workflow","right":"workflow"},{"left":"runtime-repository","right":"runtime-repository"},{"left":"latest-run","right":"run"}],"fields":[{"field":"started-at","as":"started-at"},{"field":"run","as":"run"},{"field":"status","as":"status"},{"field":"status-detail","as":"status-detail"},{"field":"failure-job","as":"failure-job"},{"field":"failure-message","as":"failure-message"},{"field":"failure-step","as":"failure-step"},{"field":"failure-log","as":"failure-log"},{"field":"gh-aw-version","as":"gh-aw-version"},{"field":"engine","as":"engine"},{"field":"engine-version","as":"engine-version"},{"field":"requested-model","as":"requested-model"},{"field":"resolved-model","as":"resolved-model"},{"field":"run-link","as":"run-link"},{"field":"repository-link","as":"repository-link"},{"field":"workflow-link","as":"workflow-link"},{"field":"workflow-source-link","as":"workflow-source-link"}]}],"union":["campaign-unobserved-orchestrators"],"compute":[{"as":"problem-title","function":"coalesce","args":[{"field":"failure-message"},{"field":"status-detail"},{"field":"error-signature-label"},{"field":"workflow-name"}]},{"as":"_runtime-repository-encoded","function":"url-encode","args":[{"field":"runtime-repository"}]},{"as":"_runtime-repository-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"_runtime-repository-encoded"}]},{"as":"runtime-repository-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"_runtime-repository-href"},{"field":"runtime-repository"},{"field":"runtime-repository"}]},{"as":"_target-repository-encoded","function":"url-encode","args":[{"field":"target-repository"}]},{"as":"_target-repository-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"_target-repository-encoded"}]},{"as":"target-repository-link","function":"dashboard-link","args":[{"field":"target-repository"},{"field":"_target-repository-href"},{"field":"target-repository"}]}],"order-by":[{"field":"workflow-name","direction":"asc"},{"field":"runtime-repository","direction":"asc"},{"field":"occurrence-count","direction":"desc"},{"field":"started-at","direction":"desc"}]},{"name":"campaign-problem-tab-counts","subject":"Count the current runtime problem items available for each campaign Problems tab.","objective":"Determine whether the campaign has current retained failure groups requiring review.","acceptance":"For every returned campaign, items equals the number of campaign-problem-items rows in the same horizon; a missing count does not establish zero failures or healthy execution.","description":"One campaign row with the number of current runtime problem groups.","from":"campaign-problem-items","aggregate":{"by":["campaign"],"values":[{"field":"campaign","as":"items","reducer":"count"}]}},{"name":"campaign-baseline-successful-runs","subject":"Project successful concluded attempts from the selected-horizon campaign baseline.","objective":"Show the successful share of concluded runs without implying verified impact.","acceptance":"Counts reconcile to campaign-performance-baseline-totals; missing campaigns do not imply zero runs.","from":"campaign-performance-baseline-totals","compute":[{"as":"outcome","function":"concat","args":[{"value":"Successful attempts"},{"value":""}]}],"select":[{"field":"campaign"},{"field":"outcome"},{"field":"successful-runs","as":"runs"}]},{"name":"campaign-baseline-other-runs","subject":"Project non-successful concluded attempts from the selected-horizon campaign baseline.","objective":"Show the remaining concluded runs for reliability review.","acceptance":"Runs equal concluded-runs minus successful-runs; the category includes every other concluded status, not just failures.","from":"campaign-performance-baseline-totals","compute":[{"as":"outcome","function":"concat","args":[{"value":"Other concluded attempts"},{"value":""}]},{"as":"other-runs","function":"difference","args":[{"field":"concluded-runs"},{"field":"successful-runs"}]}],"select":[{"field":"campaign"},{"field":"outcome"},{"field":"other-runs","as":"runs"}]},{"name":"campaign-baseline-outcome-distribution","subject":"Compare successful and other concluded attempts in the selected horizon.","objective":"Spot campaign run reliability that needs inspection.","acceptance":"Successful and other counts sum to concluded attempts; neither runtime result nor output production establishes operational value.","from":"campaign-baseline-successful-runs","union":["campaign-baseline-other-runs"]},{"name":"campaign-audit-summary-plot-inventory","subject":"Describe the rendered audit-summary chart using the shared campaign Insights plot contract.","objective":"Find campaigns with retained high- or medium-severity audit summaries worth reviewing.","acceptance":"Each campaign's bucket count equals its retained audit-event-summary-buckets rows; the count describes displayed groups, not distinct incidents or confirmed harm, and missing buckets are not proof of safety.","description":"One plot-inventory row per campaign when its high- and medium-severity audit summary chart has data.","from":"audit-event-summary-buckets","aggregate":{"by":["campaign"],"values":[{"field":"event-summary","as":"buckets","reducer":"count"}]}},{"name":"campaign-insight-plot-inventory","subject":"Inventory every plot rendered on each campaign Insights page through one reusable plot contract.","objective":"Choose an available campaign Insights plot to inspect its underlying evidence.","acceptance":"Each plot entry is supplied by the audit summary plot inventory for the same campaign; experimental operational-value evidence is excluded, no plot count is treated as outcome quality, and unavailable evidence is not synthesized into a plot.","description":"One campaign row per rendered Insights plot, independent of the plot's data source or renderer.","from":"campaign-audit-summary-plot-inventory"},{"name":"campaign-insight-tab-counts","subject":"Count the plots declared by the shared campaign Insights plot inventory.","objective":"Determine whether a campaign has evidence-backed Insights plots to inspect.","acceptance":"For every returned campaign, items equals its rows in campaign-insight-plot-inventory for the same horizon; absent rows do not establish absent value, and plot counts do not measure impact.","description":"One campaign row with the number of rendered Insights plots, independent of plot type.","from":"campaign-insight-plot-inventory","aggregate":{"by":["campaign"],"values":[{"field":"campaign","as":"items","reducer":"count"}]}},{"name":"workflow-ordered-runs","subject":"Order retained run attempts within each workflow by their observed start time.","objective":"Identify each workflow's latest execution without importing event coverage or outcome totals.","acceptance":"The first chronological attempt in each workflow partition has no preceding run delta; break timestamp ties by run ID and attempt, and use creation time for queued runs.","from":"runs","compute":[{"as":"latest-run-at","function":"coalesce","args":[{"field":"started-at"},{"field":"created-at"}]}],"window":[{"operation":"change","field":"run","as":"preceding-run-delta","mode":"absolute","groupby":["organization","repository","workflow"],"order-by":[{"field":"latest-run-at","direction":"desc"},{"field":"run","direction":"desc"},{"field":"run-attempt","direction":"desc"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"latest-run-at"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"preceding-run-delta"},{"field":"run-link"}]},{"name":"workflow-latest-runs","subject":"Project the latest retained run attempt for each workflow.","objective":"Expose each workflow's latest observed execution state without implying aggregate outcomes.","acceptance":"Select only the first chronologically ordered attempt per workflow; preserve queued and in-progress states instead of treating unknown conclusions as failures.","from":"workflow-ordered-runs","filter":{"predicates":[{"field":"preceding-run-delta","equals":"unknown"}]},"compute":[{"as":"observed-conclusion","function":"coalesce","args":[{"field":"run-conclusion"},{"value":"unknown"}]},{"as":"completed","function":"equals-any","args":[{"field":"run-status"},{"value":"completed"}]},{"as":"latest-run-status","function":"if","args":[{"field":"completed"},{"field":"observed-conclusion"},{"field":"run-status"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"latest-run-at"},{"field":"latest-run-status"},{"field":"run-link"}]},{"name":"workflow-list-preview","subject":"Show workflow declarations while latest-run evidence is still loading.","objective":"Make workflow identities and drill links available before retained runs are evaluated.","acceptance":"Preserve every declared workflow and its drill link; leave latest-run fields absent until the complete projection arrives.","from":"workflows","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-label","function":"concat","args":[{"field":"repository-coordinate"},{"value":":"},{"field":"workflow"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"declared-role","function":"coalesce","args":[{"field":"workflow-role"},{"value":"standalone"}]},{"as":"declared-mode","function":"coalesce","args":[{"field":"rollout-mode"},{"value":"unknown"}]},{"as":"declared-registration","function":"coalesce","args":[{"field":"workflow-active"},{"value":"unknown"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-label"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-display-name"},{"field":"workflow-label"}]}],"select":[{"field":"organization"},{"field":"repository-coordinate","as":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-label"},{"field":"campaign-name"},{"field":"declared-role","as":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"declared-registration","as":"workflow-active"},{"field":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"workflow-list","subject":"List declared workflows in latest observed run order.","objective":"Open a dedicated workflow page from a lightweight inventory with its latest execution status.","acceptance":"Preserve textual run identities and keep unobserved workflows last with an explicit missing-run state; use only workflow declarations and retained runs, not event coverage or aggregate success/failure counters.","from":"workflows","joins":[{"source":"workflow-latest-runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"run","as":"latest-run"},{"field":"latest-run-at","as":"latest-run-at"},{"field":"latest-run-status","as":"observed-run-status"},{"field":"run-link","as":"run-link"}]}],"compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-label","function":"concat","args":[{"field":"repository-coordinate"},{"value":":"},{"field":"workflow"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"declared-role","function":"coalesce","args":[{"field":"workflow-role"},{"value":"standalone"}]},{"as":"declared-mode","function":"coalesce","args":[{"field":"rollout-mode"},{"value":"unknown"}]},{"as":"declared-registration","function":"coalesce","args":[{"field":"workflow-active"},{"value":"unknown"}]},{"as":"observed-run-id","function":"coalesce","args":[{"field":"latest-run"},{"value":"0"}]},{"as":"has-observed-run","function":"greater-than","args":[{"field":"observed-run-id"},{"value":0}]},{"as":"latest-run-status","function":"coalesce","args":[{"field":"observed-run-status"},{"value":"No observed run"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-label"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-display-name"},{"field":"workflow-label"}]}],"select":[{"field":"organization"},{"field":"repository-coordinate","as":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-label"},{"field":"campaign-name"},{"field":"declared-role","as":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"declared-registration","as":"workflow-active"},{"field":"latest-run"},{"field":"latest-run-at"},{"field":"latest-run-status"},{"field":"has-observed-run"},{"field":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"},{"field":"run-link"}],"order-by":[{"field":"has-observed-run","direction":"desc"},{"field":"latest-run-at","direction":"desc"},{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"runs-daily-health-buckets","subject":"Select whole UTC start-day buckets against the requested time bounds.","objective":"Expose UTC bucket boundaries for declarative daily time selection.","acceptance":"Compute bounds from observed execution-start days only; missing request bounds remain unset and no sub-day totals or missing days are fabricated.","from":"daily-run-counts","compute":[{"as":"day-midnight","function":"concat","args":[{"field":"day"},{"value":"T00:00:00Z"}]},{"as":"day-ms","function":"timestamp","args":[{"field":"day-midnight"}]},{"as":"start-ms","function":"timestamp","args":[{"context":"time-start"}]},{"as":"end-ms","function":"timestamp","args":[{"context":"time-end"}]},{"as":"before-start","function":"greater-than","args":[{"field":"start-ms"},{"field":"day-ms"}]},{"as":"before-end","function":"greater-than","args":[{"field":"end-ms"},{"field":"day-ms"}]}]},{"name":"runs-daily-health-totals","subject":"Sum observed daily run health across the selected scope.","objective":"Keep daily activity counts independent of detail retention.","acceptance":"Sum only daily counts, never retained Runs. UTC start-day buckets are selected by midnight; sub-day totals are unsupported. Missing or undated evidence remains unavailable or partial.","from":"runs-daily-health-buckets","filter":{"predicates":[{"field":"before-start","in":[false,null]},{"field":"before-end","in":[true,null]}]},"aggregate":{"by":["day"],"values":[{"field":"successful","as":"successful","reducer":"sum"},{"field":"failed","as":"failed","reducer":"sum"},{"field":"approval","as":"approval","reducer":"sum"},{"field":"pending","as":"pending","reducer":"sum"},{"field":"other","as":"other","reducer":"sum"}]}},{"name":"runs-daily-successful","subject":"Observed daily successful run counts.","objective":"Expose the successful class for the daily runtime-health chart.","acceptance":"Project successful counts from scoped daily totals without re-reading detail; runtime success does not imply accepted outcomes.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Successful"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"successful","as":"runs"}]},{"name":"runs-daily-failed","subject":"Observed daily failed run counts.","objective":"Expose the failed class for the daily runtime-health chart.","acceptance":"Project failed counts from scoped daily totals, preserving zero counts and aggregate coverage without deriving incidents.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Failed"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"failed","as":"runs"}]},{"name":"runs-daily-approval","subject":"Observed daily approval-required run counts.","objective":"Expose approval-required observations in the daily runtime-health chart.","acceptance":"Project approval counts from scoped daily totals without treating approval-required observations as successes or failures.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Approval required"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"approval","as":"runs"}]},{"name":"runs-daily-pending","subject":"Observed daily pending run counts.","objective":"Expose last-observed pending state in the daily runtime-health chart.","acceptance":"Project pending counts from scoped daily totals; counts describe last-observed evidence, not a live execution census.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Pending"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"pending","as":"runs"}]},{"name":"runs-daily-other","subject":"Observed daily unclassified terminal or missing-status run counts.","objective":"Expose the remaining runtime-health class without implying success.","acceptance":"Project other counts from scoped daily totals; preserve zeros and coverage without interpreting skipped, cancelled, or unknown evidence as success.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Other"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"other","as":"runs"}]},{"name":"runs-daily-conclusions","subject":"Daily observed runtime health classes for the Runs chart.","objective":"Investigate daily activity independently of retained run detail.","acceptance":"Classes sum to observed dated Runs, not attempts or verified outcomes. Pending is last-observed state; Other is not success. Select whole UTC start-day buckets by midnight, not sub-day totals. Preserve partial or unavailable coverage.","from":"runs-daily-successful","union":["runs-daily-failed","runs-daily-approval","runs-daily-pending","runs-daily-other"],"order-by":[{"field":"day","direction":"asc"},{"field":"runtime-health","direction":"asc"}]},{"name":"entity-events","subject":"Project all run-owned records for reusable cards and run drill-down.","objective":"Expose run-owned event identity, status, provenance, timestamp, and available navigation links for inspection.","acceptance":"Projected event fields and fallback URL trace to the source record; a missing link or event is not proof of no output, and event status alone does not verify downstream impact.","from":"event-base","compute":[{"as":"event-url","function":"coalesce","args":[{"field":"safe-output-url"},{"field":"correlation-id"},{"field":"implementation-pull-request-url"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"event"},{"field":"event-source"},{"field":"event-type"},{"field":"event-summary"},{"field":"event-status"},{"field":"github-entity-type"},{"field":"safe-output-type"},{"field":"event-url"},{"field":"event-timestamp","as":"observed-at"},{"field":"run-link"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"event","direction":"asc"}]},{"name":"runs-table","subject":"Show observed workflow runs in a table with execution, repository, workflow, engine, model, and navigation details.","objective":"Locate observed runs whose recorded status or conclusion needs closer inspection.","acceptance":"Show recorded run identity, status, conclusion, scope, execution metadata, and source links in newest-first order; absent runs require a freshness and coverage check, and a successful run is not proof of accepted outcomes.","description":"Observed workflow runs ordered from newest to oldest.","from":"runs","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]}],"select":[{"field":"run"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"repository-coordinate"},{"field":"workflow"},{"field":"rollout-mode"},{"field":"engine"},{"field":"engine-version"},{"field":"gh-aw-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"started-at"},{"field":"repository-link"},{"field":"workflow-link"},{"field":"run-link"}],"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"workflow-aic-per-run","subject":"List declared workflows with recorded positive AI Credit costs and their average cost per run.","objective":"Identify workflows with observed run AIC averages worth investigating alongside run evidence.","acceptance":"Include only declared workflows with at least one run attempt reporting positive AIC; exclude zero and missing telemetry from the average and ranking, without interpreting missing telemetry as free execution.","description":"Workflow AI Credit averages limited to run attempts with recorded positive AIC.","from":"workflows","joins":[{"source":"workflow-aic-run-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"aic-runs","as":"observed-aic-runs"},{"field":"aic","as":"observed-aic"}]}],"compute":[{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"workflow-identity","function":"concat","args":[{"field":"repository-slug"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-identity"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-display-name"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-identity"}]},{"as":"aic-per-run","function":"quotient","args":[{"field":"observed-aic"},{"field":"observed-aic-runs"}]}],"filter":{"predicates":[{"field":"observed-aic-runs","gte":1}]},"select":[{"field":"workflow-identity","as":"workflow-label"},{"field":"workflow-dashboard-link","as":"workflow-link"},{"field":"aic-per-run"}],"order-by":[{"field":"aic-per-run","direction":"desc"}],"limit":10},{"name":"dashboard-ingestion-health","subject":"Expose the current collection state for the global ingestion indicator.","objective":"Distinguish reported ingestion failure or recovery from the age of retained workflow evidence.","acceptance":"Use the authorized server collection-health classification, not cumulative failures or browser refresh time. Missing or unauthorized health remains unknown and static dashboards do not request this source.","from":"collection-health","select":[{"field":"configured"},{"field":"health"}],"limit":1},{"name":"dashboard-data-freshness","subject":"Find the newest workflow activity timestamp in retained canonical data.","objective":"Warn globally when the ingested workflow evidence has not advanced for 24 hours.","acceptance":"Use upstream updated-at, falling back to created-at, never browser import or refresh time. Missing or invalid timestamps remain unknown; inactivity alone does not prove an ingestion failure.","from":"runs","compute":[{"as":"data-at","function":"coalesce","args":[{"field":"updated-at"},{"field":"created-at"}]},{"as":"data-at-ms","function":"timestamp","args":[{"field":"data-at"}]}],"aggregate":{"values":[{"field":"data-at-ms","as":"latest-data-at","reducer":"max"}]}},{"name":"indexing-shards","subject":"List retained Activity shard import receipts.","objective":"Inspect which shards were ingested, when, and how many records they committed.","acceptance":"Show shard scope, phase, import status, import timestamp, counts and payload identity from retained receipts. Import time is not upstream freshness and missing receipts do not prove complete coverage.","from":"transactions","filter":{"predicates":[{"field":"kind","in":["ingest-normalized-jsonl","ingest-jsonl","ingest-jsonl-failed","runs","records"]}]},"select":[{"field":"id"},{"field":"payloadScope","as":"shard"},{"field":"kind"},{"field":"activity-status","as":"status"},{"field":"createdAt","as":"ingested-at"},{"field":"committedRecords","as":"committed-records"},{"field":"rawRuns","as":"workflow-runs"},{"field":"payloadHash","as":"payload-hash"}],"order-by":[{"field":"ingested-at","direction":"desc"}]},{"name":"ingestion-queued","subject":"Label the shared collection task queue depth for the administrator queue chart.","objective":"Identify total ready and scheduled collection work, including backfill tasks.","acceptance":"Show the observed shared queue depth only when collection is configured; missing or unauthorized health data is not zero pending work.","from":"collection-health","filter":{"predicates":[{"field":"configured","equals":true}]},"compute":[{"as":"queue","function":"coalesce","args":[{"value":"Ready and scheduled"},{"value":"Ready and scheduled"}]}],"select":[{"field":"queue"},{"field":"queue-depth","as":"tasks"}]},{"name":"ingestion-inflight","subject":"Label current in-flight collection tasks for the administrator queue chart.","objective":"Distinguish leased collection tasks from work awaiting collection.","acceptance":"Show the observed pending task count only when collection is configured; do not infer a count from an unavailable source.","from":"collection-health","filter":{"predicates":[{"field":"configured","equals":true}]},"compute":[{"as":"queue","function":"coalesce","args":[{"value":"In flight"},{"value":"In flight"}]}],"select":[{"field":"queue"},{"field":"pending-tasks","as":"tasks"}]},{"name":"ingestion-backfill","subject":"Label cumulative backfill run admissions for the administrator ingestion chart.","objective":"Compare historically admitted run tasks with current outstanding work without treating admissions as a live backlog.","acceptance":"Show the cumulative run task admissions only when collection is configured; this value does not decrease as tasks complete and missing health data does not imply completed backfill.","from":"collection-health","filter":{"predicates":[{"field":"configured","equals":true}]},"compute":[{"as":"queue","function":"coalesce","args":[{"value":"Backfill admitted (total)"},{"value":"Backfill admitted (total)"}]}],"select":[{"field":"queue"},{"field":"backfill-queued-run-tasks","as":"tasks"}]},{"name":"ingestion-queue-sizes","subject":"Compare current shared queue pressure, in-flight tasks, and cumulative historical backfill admissions from the administrator-only server snapshot.","objective":"Spot a growing backlog without treating past backfill admissions as outstanding work.","acceptance":"Current queue sizes and cumulative admissions come only from an authorized collection-health snapshot; unavailable state is not zero.","from":"ingestion-queued","union":["ingestion-inflight","ingestion-backfill"],"select":[{"field":"queue"},{"field":"tasks"}]},{"name":"ingestion-webhook-status","subject":"Inspect live webhook delivery counters for the current server process.","objective":"Distinguish signature validation, acknowledgements, rejections and failures without polling GitHub.","acceptance":"Show only authorized process-local counters, including in-flight requests, duplicate acknowledgements and signed pings. Counters reset on restart, are not replica totals, and do not establish GitHub-side webhook registration or completed collection. Refresh the active subscription even without canonical data changes.","from":"webhook-status","compute":[{"as":"configuration","function":"if","args":[{"field":"configured"},{"value":"Configured"},{"value":"Not configured"}]}],"limit":1},{"name":"ingestion-health","subject":"Show the current Redis-backed webhook and collection health snapshot.","objective":"Determine whether the reported collection, webhook, queue, and backfill state warrants inspecting ingestion diagnostics.","acceptance":"Report the observed health, queue, failure, success, and projection timestamps together; verify freshness and configuration before calling collection healthy, and treat missing state as unknown rather than zero.","from":"collection-health","select":[{"field":"configured"},{"field":"health"},{"field":"queue-depth"},{"field":"pending-tasks"},{"field":"dead-letters"},{"field":"oldest-pending-age"},{"field":"backfill"},{"field":"backfill-failures"},{"field":"backfill-queued-run-tasks"},{"field":"webhook-load"},{"field":"collection-load"},{"field":"failure-load"},{"field":"last-projected"},{"field":"last-webhook-at"},{"field":"last-failure-at"},{"field":"last-failure-code"},{"field":"last-success-at"},{"field":"webhook-received"},{"field":"webhook-duplicate"},{"field":"webhook-admission-failed"},{"field":"task-queued"},{"field":"task-coalesced"},{"field":"collection-succeeded"},{"field":"collection-failed"},{"field":"collection-retried"},{"field":"collection-dead-lettered"}]},{"name":"github-api-usage","subject":"Show retained GitHub API quota usage per bucket and in aggregate over the last 24 hours.","objective":"Determine whether any GitHub App installation or the CAO fleet as a whole is approaching its GitHub API rate limit.","acceptance":"Report peak usage percentages with their limits, used, and reserved counts; treat a slot without observations as unknown rather than idle, and never infer credentials from bucket identity.","from":"github-quota-usage","select":[{"field":"observed-at"},{"field":"scope"},{"field":"bucket"},{"field":"app"},{"field":"installation"},{"field":"resource"},{"field":"buckets"},{"field":"limit"},{"field":"used"},{"field":"reserved"},{"field":"usage-percent"}]},{"name":"marketplace-directory","subject":"Browse packages from configured marketplace registries.","objective":"Present a stable alphabetical directory that can be loaded in bounded pages.","acceptance":"Preserve resolver-produced provenance and package metadata. Order by package name and immutable source so continuation pages neither skip nor duplicate entries; discovery grants no installation authority.","from":"marketplace-packages","order-by":[{"field":"package-name","direction":"asc"},{"field":"package-source","direction":"asc"}]},{"name":"marketplace-package-detail","subject":"Expose normalized marketplace package records for source-coordinate lookup by the detail view.","objective":"Locate the resolver-produced package record for a source coordinate supplied by the consuming view.","acceptance":"Use the returned package-source, registry, ref, and resolved-commit fields when inspecting a matching record; the query itself does not filter by coordinate, and an absent match is not proof of package nonexistence or approval.","from":"marketplace-packages"},{"name":"friction-by-workflow","subject":"Rank workflows by observed gh-aw audit friction AI Credit totals for investigation.","objective":"Identify which repository and workflow combinations have the largest measured friction totals in retained observations.","acceptance":"Compare friction-aic and distinct runs with the underlying measurement states and attribution evidence; do not equate a ranking with avoidable cost or a validated saving.","description":"Total gh-aw audit friction cost grouped by repository and workflow.","from":"friction","compute":[{"as":"positive-aic","function":"greater-than","args":[{"field":"aic"},{"value":0}]},{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}],"aggregate":{"by":["workflow-coordinate","repository-coordinate","workflow"],"values":[{"field":"aic","as":"friction-aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"run","as":"runs","reducer":"distinct-count"}]},"order-by":[{"field":"friction-aic","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}]},{"name":"friction-observations","subject":"List retained gh-aw audit friction measurements with their run context and attribution totals.","objective":"Trace each reported friction measurement to a run and distinguish counted, suppressed, and unattributed occurrences.","acceptance":"Preserve native AIC, total-run AIC, measurement state, timestamps, links, and occurrence counts; missing or unattributed evidence remains uncertain, not a verified opportunity for savings.","description":"Newest friction measurements first, preserving the native audit values and uncertainty state.","from":"friction","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"friction-percent","function":"format-percent","args":[{"field":"friction-ratio"}]}],"select":[{"field":"event-timestamp","as":"observed-at"},{"field":"repository-coordinate"},{"field":"workflow"},{"field":"run"},{"field":"run-link"},{"field":"measurement-state"},{"field":"aic"},{"field":"total-run-aic"},{"field":"friction-percent"},{"field":"counted-occurrences"},{"field":"suppressed-occurrences"},{"field":"unattributed-occurrences"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"run","direction":"desc"}]},{"name":"indexing-shard-dates","subject":"Read the activity date encoded in each retained transaction's shard filename.","objective":"Separate source shard dates from ingestion timestamps.","acceptance":"Keep every transaction and leave absent, invalid, or structural shard dates unknown; never substitute import time.","from":"transactions","compute":[{"as":"shard-day","function":"activity-shard-day","args":[{"field":"payloadScope"}]},{"as":"missing-shard-day","function":"equals-any","args":[{"field":"shard-day"},{"value":null}]}]},{"name":"indexing-ingestion-runs","subject":"Show retained ingestion transactions at the activity date encoded in their shard filename.","objective":"Compare reported run counts by source shard activity date, independently of import time.","acceptance":"Preserve every dated transaction, including coincident dates, all kinds, and zero counts, without grouping, limits, or page filters. Omit missing or invalid shard dates; never substitute import time. Missing counts use labeled zero-position placeholders, not measured zeroes.","from":"indexing-shard-dates","filter":{"predicates":[{"field":"missing-shard-day","equals":false}]},"compute":[{"as":"workflow-runs","function":"coalesce","args":[{"field":"rawRuns"},{"value":0}]},{"as":"missing-run-count","function":"equals-any","args":[{"field":"rawRuns"},{"value":null}]},{"as":"run-count-status","function":"if","args":[{"field":"missing-run-count"},{"value":"Run count unavailable (shown at 0)"},{"value":"Reported run count"}]}],"select":[{"field":"id"},{"field":"kind"},{"field":"createdAt"},{"field":"shard-day"},{"field":"rawRuns"},{"field":"workflow-runs"},{"field":"run-count-status"}],"order-by":[{"field":"shard-day","direction":"asc"},{"field":"id","direction":"asc"}]},{"name":"indexing-daily-run-counts","subject":"Inspect admitted daily logical Run counts independently of retained detail and shard receipts.","objective":"Make the daily run-count projection visible as an ingestion diagnostic.","acceptance":"Sum daily buckets by observed UTC execution-start day across repositories and workflows, without page filters, detail fallback, fabricated days or zero populations. Preserve aggregate coverage and partial or unavailable evidence; counts do not prove upstream completeness.","from":"daily-run-counts","aggregate":{"by":["day"],"values":[{"field":"total","as":"runs","reducer":"sum"}]},"select":[{"field":"day","as":"date"},{"field":"runs"}],"order-by":[{"field":"date","direction":"asc"}]},{"name":"indexing-campaigns-table-count","subject":"Count retained campaigns rows in the dashboard database.","objective":"Provide the retained campaigns row count for the table-count diagnostic.","acceptance":"Label the result campaigns and count campaign rows in the current database; absence or zero does not establish completeness or expected campaign coverage.","from":"campaigns","compute":[{"as":"table","function":"literal","args":[{"value":"campaigns"}]}],"aggregate":{"by":["table"],"values":[{"field":"campaign","as":"records","reducer":"count"}]}},{"name":"indexing-repositories-table-count","subject":"Count retained repositories rows in the dashboard database.","objective":"Provide the retained repositories row count for the table-count diagnostic.","acceptance":"Label the result repositories and count repository rows in the current database; absence or zero does not establish completeness or expected repository coverage.","from":"repositories","compute":[{"as":"table","function":"literal","args":[{"value":"repositories"}]}],"aggregate":{"by":["table"],"values":[{"field":"repository","as":"records","reducer":"count"}]}},{"name":"indexing-workflows-table-count","subject":"Count retained workflows rows in the dashboard database.","objective":"Provide the retained workflows row count for the table-count diagnostic.","acceptance":"Label the result workflows and count workflow rows in the current database; absence or zero does not establish completeness or expected workflow coverage.","from":"workflows","compute":[{"as":"table","function":"literal","args":[{"value":"workflows"}]}],"aggregate":{"by":["table"],"values":[{"field":"workflow","as":"records","reducer":"count"}]}},{"name":"indexing-runs-table-count","subject":"Count retained workflow runs rows in the dashboard database.","objective":"Provide the retained workflow runs row count for the table-count diagnostic.","acceptance":"Label the result workflow runs and count run rows in the current database; absence or zero does not establish completeness or expected execution volume.","from":"runs","compute":[{"as":"table","function":"literal","args":[{"value":"runs"}]}],"aggregate":{"by":["table"],"values":[{"field":"run","as":"records","reducer":"count"}]}},{"name":"indexing-domains-table-count","subject":"Count retained network domains rows in the dashboard database.","objective":"Provide the retained network domains row count for the table-count diagnostic.","acceptance":"Label the result network domains and count domain event rows in the current database; absence or zero does not prove no network activity.","from":"domains","compute":[{"as":"table","function":"literal","args":[{"value":"domains"}]}],"aggregate":{"by":["table"],"values":[{"field":"event","as":"records","reducer":"count"}]}},{"name":"indexing-tools-table-count","subject":"Count retained tool events rows in the dashboard database.","objective":"Provide the retained tool events row count for the table-count diagnostic.","acceptance":"Label the result tool events and count tool event rows in the current database; absence or zero does not prove no tool use.","from":"tools","compute":[{"as":"table","function":"literal","args":[{"value":"tools"}]}],"aggregate":{"by":["table"],"values":[{"field":"table","as":"records","reducer":"count"}]}},{"name":"indexing-audits-table-count","subject":"Count retained audit events rows in the dashboard database.","objective":"Provide the retained audit events row count for the table-count diagnostic.","acceptance":"Label the result audit events and count audit event rows in the current database; absence or zero does not prove no audit findings.","from":"audits","compute":[{"as":"table","function":"literal","args":[{"value":"audits"}]}],"aggregate":{"by":["table"],"values":[{"field":"event","as":"records","reducer":"count"}]}},{"name":"indexing-issues-table-count","subject":"Count retained issue events rows in the dashboard database.","objective":"Provide the retained issue events row count for the table-count diagnostic.","acceptance":"Label the result issue events and count issue event rows in the current database; absence or zero does not prove no issues exist.","from":"issues","compute":[{"as":"table","function":"literal","args":[{"value":"issues"}]}],"aggregate":{"by":["table"],"values":[{"field":"event","as":"records","reducer":"count"}]}},{"name":"indexing-operational-values-table-count","subject":"Count retained operational values rows in the dashboard database.","objective":"Provide the retained operational values row count for the table-count diagnostic.","acceptance":"Label the result operational values and count operational-value rows in the current database; absence or zero does not imply zero value or an evaluated outcome.","from":"operational-values","compute":[{"as":"table","function":"literal","args":[{"value":"operationalValues"}]}],"aggregate":{"by":["table"],"values":[{"field":"operational-value","as":"records","reducer":"count"}]}},{"name":"indexing-transactions-table-count","subject":"Count retained ingestion transactions rows in the dashboard database.","objective":"Provide the retained ingestion transactions row count for the table-count diagnostic.","acceptance":"Label the result ingestion transactions and count transaction IDs in the current database; absence or zero does not establish whether upstream ingestion ran.","from":"transactions","compute":[{"as":"table","function":"literal","args":[{"value":"transactions"}]}],"aggregate":{"by":["table"],"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"indexing-database-table-counts","subject":"Count retained canonical dashboard database rows by table.","objective":"Compare the retained table row counts to identify tables needing further ingestion or coverage investigation.","acceptance":"Union the named table-count projections and report their table labels and counts; check source availability, retention, and separate transaction evidence before interpreting an empty or small table as an ingestion defect.","from":"indexing-campaigns-table-count","union":["indexing-repositories-table-count","indexing-workflows-table-count","indexing-runs-table-count","indexing-domains-table-count","indexing-tools-table-count","indexing-audits-table-count","indexing-issues-table-count","indexing-operational-values-table-count","indexing-transactions-table-count"],"order-by":[{"field":"records","direction":"desc"},{"field":"table","direction":"asc"}]},{"name":"indexing-transactions","subject":"Prepare retained ingestion transactions for card presentation.","objective":"Expose transaction identity, kind, timestamp, committed-record count, and payload hash for ingestion traceability.","acceptance":"Projected fields match retained transactions without implying successful upstream coverage from a committed count or hash alone; missing transactions require a freshness and availability check.","from":"transactions","select":[{"field":"id"},{"field":"kind"},{"field":"createdAt","as":"created-at"},{"field":"committedRecords","as":"committed-records"},{"field":"payloadHash","as":"payload-hash"}]},{"name":"engines-models-sample-distribution","subject":"Describe agent and model combinations in the seven-day statistical run sample.","objective":"Find sampled combinations to investigate without scanning the full retained run history.","acceptance":"Count unweighted selected Runs after frame selection. Keep statistical-frame-id in grouped rows and frame metadata on empty results. Zero-allocation strata are not population zeros. Preserve unknown identifiers; failure reserves can alter composition. Never mix sample counts with exact usage or infer population shares.","description":"Unweighted composition of the seven-day statistical sample; not a population estimate. Failure outcomes may be oversampled.","from":"statistical-runs","compute":[{"as":"summary","function":"concat","args":[{"field":"agent-id"},{"value":" / "},{"field":"model-id"}]}],"aggregate":{"by":["summary","statistical-frame-id"],"values":[{"field":"run","as":"sampled-runs","reducer":"count"}]},"order-by":[{"field":"sampled-runs","direction":"desc"},{"field":"summary","direction":"asc"}]},{"name":"engines-models-usage","subject":"Summarize run-level AIC and token usage by agent and model identifiers without treating unavailable telemetry as zero.","objective":"Locate agent and model combinations whose observed per-run AIC or token usage merits checking against individual runs.","acceptance":"Report run counts and native minimum, mean, and maximum values only for reported metrics; inspect underlying runs for per-metric telemetry coverage and context before comparing combinations, and infer neither efficiency nor outcome value from usage alone.","description":"Observed workflow runs grouped by agent ID and model ID. AIC statistics use only positive-AIC runs; token statistics use runs that reported each token metric.","from":"runs","compute":[{"as":"summary","function":"concat","args":[{"field":"agent-id"},{"value":" / "},{"field":"model-id"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["summary"],"values":[{"field":"run","as":"runs","reducer":"count"},{"field":"aic-total","as":"minimum-aic-per-run","reducer":"min","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"aic-total","as":"average-aic-per-run","reducer":"mean","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"aic-total","as":"maximum-aic-per-run","reducer":"max","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"input-tokens","as":"minimum-input-tokens-per-run","reducer":"min"},{"field":"input-tokens","as":"average-input-tokens-per-run","reducer":"mean"},{"field":"input-tokens","as":"maximum-input-tokens-per-run","reducer":"max"},{"field":"output-tokens","as":"minimum-output-tokens-per-run","reducer":"min"},{"field":"output-tokens","as":"average-output-tokens-per-run","reducer":"mean"},{"field":"output-tokens","as":"maximum-output-tokens-per-run","reducer":"max"},{"field":"cache-read-tokens","as":"minimum-cache-read-tokens-per-run","reducer":"min"},{"field":"cache-read-tokens","as":"average-cache-read-tokens-per-run","reducer":"mean"},{"field":"cache-read-tokens","as":"maximum-cache-read-tokens-per-run","reducer":"max"},{"field":"cache-write-tokens","as":"minimum-cache-write-tokens-per-run","reducer":"min"},{"field":"cache-write-tokens","as":"average-cache-write-tokens-per-run","reducer":"mean"},{"field":"cache-write-tokens","as":"maximum-cache-write-tokens-per-run","reducer":"max"},{"field":"reasoning-tokens","as":"minimum-reasoning-tokens-per-run","reducer":"min"},{"field":"reasoning-tokens","as":"average-reasoning-tokens-per-run","reducer":"mean"},{"field":"reasoning-tokens","as":"maximum-reasoning-tokens-per-run","reducer":"max"}]},"select":[{"field":"summary"},{"field":"runs"},{"field":"average-aic-per-run"},{"field":"minimum-aic-per-run"},{"field":"maximum-aic-per-run"},{"field":"minimum-input-tokens-per-run"},{"field":"average-input-tokens-per-run"},{"field":"maximum-input-tokens-per-run"},{"field":"minimum-output-tokens-per-run"},{"field":"average-output-tokens-per-run"},{"field":"maximum-output-tokens-per-run"},{"field":"minimum-cache-read-tokens-per-run"},{"field":"average-cache-read-tokens-per-run"},{"field":"maximum-cache-read-tokens-per-run"},{"field":"minimum-cache-write-tokens-per-run"},{"field":"average-cache-write-tokens-per-run"},{"field":"maximum-cache-write-tokens-per-run"},{"field":"minimum-reasoning-tokens-per-run"},{"field":"average-reasoning-tokens-per-run"},{"field":"maximum-reasoning-tokens-per-run"}],"order-by":[{"field":"runs","direction":"desc"},{"field":"summary","direction":"asc"}]},{"name":"skill-invocations","subject":"Select observed skill invocations for skill usage analytics.","objective":"Expose skill event identity, scope, invocation counts, and failed counts for downstream usage analysis.","acceptance":"Keep each observed event and its repository/workflow attribution with native counts; missing records or failed counts alone do not establish whether a skill was useful or available.","from":"skills","select":[{"field":"event","as":"id"},{"field":"name","as":"skill"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"invocation-count"},{"field":"failed-count"}]},{"name":"skill-invocations-by-skill","subject":"Rank skills by their observed invocation count.","objective":"Identify skills with the highest observed invocation totals for follow-up inspection.","acceptance":"Sum observed invocation counts by skill and retain the rank as a usage description; do not equate popularity with effectiveness or infer unobserved invocations.","from":"skill-invocations","aggregate":{"by":["skill"],"values":[{"field":"invocation-count","as":"invocations","reducer":"sum"}]},"order-by":[{"field":"invocations","direction":"desc"},{"field":"skill","direction":"asc"}]},{"name":"skill-invocations-by-workflow-totals","subject":"Rank workflows by their observed skill invocation count.","objective":"Produce repository-scoped workflow invocation totals for downstream skill-usage comparison.","acceptance":"Sum observed invocation counts by organization, repository, and workflow; totals describe recorded usage only, not success or expected adoption.","from":"skill-invocations","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"invocation-count","as":"invocations","reducer":"sum"}]}},{"name":"skill-invocations-by-workflow","subject":"Present workflow skill invocation totals with drill-through navigation to the workflow dashboard.","objective":"Expose observed workflow skill invocation totals with a link to inspect each workflow.","acceptance":"Each projected workflow coordinate, link, and invocation total traces to the grouped source; using a link to investigate does not establish that usage caused an outcome.","from":"skill-invocations-by-workflow-totals","compute":[{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-coordinate"}]}],"select":[{"field":"workflow-coordinate"},{"field":"workflow-link"},{"field":"invocations"}],"order-by":[{"field":"invocations","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}]},{"name":"skill-workflow-totals","subject":"Count observed invocations for each skill and workflow.","objective":"Produce skill-by-workflow invocation totals for the downstream inventory.","acceptance":"Sum observed invocation counts by skill, organization, repository, and workflow; missing combinations are not evidence that a skill could not run.","from":"skill-invocations","aggregate":{"by":["skill","organization","repository","workflow"],"values":[{"field":"invocation-count","as":"invocations","reducer":"sum"}]}},{"name":"skill-workflow-inventory","subject":"List observed skills by workflow with drill-through navigation to the workflow dashboard.","objective":"Identify observed skill/workflow combinations and provide a workflow link for inspecting their runs.","acceptance":"Show the repository, workflow, skill, link, and observed invocation total from the grouped evidence; an absent row does not prove non-use, and a high count does not prove effectiveness.","from":"skill-workflow-totals","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-coordinate"}]}],"select":[{"field":"skill"},{"field":"repository-coordinate"},{"field":"workflow"},{"field":"workflow-link"},{"field":"invocations"}],"order-by":[{"field":"invocations","direction":"desc"},{"field":"skill","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"experiment-assignment-coverage","subject":"Count observed run assignments for each experiment and workflow without inferring a completion target.","objective":"Expose assignment counts by experiment and workflow for investigating observed experiment coverage.","acceptance":"Count retained assignment rows in each experiment/workflow group, not distinct runs; do not invent a target, infer missing assignments from absent groups, or treat assignments as eval or grader outcomes.","from":"experiment-assignments","compute":[{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}],"aggregate":{"by":["workflow-coordinate","experiment"],"values":[{"field":"run","as":"assignments","reducer":"count"}]}},{"name":"eval-status-ledger","subject":"Inspect every explicitly classified eval answer, including UNKNOWN.","objective":"Expose retained eval observations with their workflow, run evidence and observation time.","acceptance":"Keep recorded YES, NO and UNKNOWN answers distinct; unknown or absent evidence must not imply success or failure, and historical answers are not current verdicts or validated operational outcomes.","from":"eval-observations","compute":[{"as":"_recorded-run-href","function":"link-href","args":[{"field":"evidence-link"}]},{"as":"_eval-run-href","function":"coalesce","args":[{"field":"_recorded-run-href"},{"field":"evidence-link"}]},{"as":"run-link","function":"link","args":[{"field":"_eval-run-href"},{"field":"run"}]}],"filter":{"predicates":[{"field":"eval-result","in":["YES","NO","UNKNOWN"]}]}},{"name":"eval-answer-counts","subject":"Count recorded YES, NO and UNKNOWN answers for each workflow-scoped eval.","objective":"Provide complete answer denominators before expanding each eval into three bars.","acceptance":"Keep canonical eval identities separate and count only explicitly classified observations. Select at most 33 complete eval groups, never truncate an answer group.","from":"eval-status-ledger","aggregate":{"by":["organization","repository","workflow","eval"],"values":[{"field":"eval-result","as":"answers","reducer":"count"},{"field":"eval-result","as":"yes","reducer":"count","filter":{"predicates":[{"field":"eval-result","equals":"YES"}]}},{"field":"eval-result","as":"no","reducer":"count","filter":{"predicates":[{"field":"eval-result","equals":"NO"}]}},{"field":"eval-result","as":"unknown","reducer":"count","filter":{"predicates":[{"field":"eval-result","equals":"UNKNOWN"}]}}]},"order-by":[{"field":"eval","direction":"asc"},{"field":"organization","direction":"asc"},{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}],"limit":33},{"name":"eval-yes-shares","subject":"Compute the YES share of each eval's recorded answers.","objective":"Expose recorded YES proportions for comparing answer categories without inferring verified operational outcomes.","acceptance":"Emit one YES row per retained canonical eval group, including zero YES counts; answer-share is yes / answers across recorded YES, NO and UNKNOWN observations. Do not count absent observations.","from":"eval-answer-counts","compute":[{"as":"eval-result","function":"literal","args":[{"value":"YES"}]},{"as":"answer-order","function":"literal","args":[{"value":0}]},{"as":"answer-share","function":"quotient","args":[{"field":"yes"},{"field":"answers"}]}]},{"name":"eval-no-shares","subject":"Compute the NO share of each eval's recorded answers.","objective":"Expose recorded NO proportions for comparing answer categories without treating historical answers as current verdicts.","acceptance":"Emit one NO row per retained canonical eval group, including zero NO counts; answer-share is no / answers across recorded YES, NO and UNKNOWN observations. Do not count absent observations.","from":"eval-answer-counts","compute":[{"as":"eval-result","function":"literal","args":[{"value":"NO"}]},{"as":"answer-order","function":"literal","args":[{"value":1}]},{"as":"answer-share","function":"quotient","args":[{"field":"no"},{"field":"answers"}]}]},{"name":"eval-unknown-shares","subject":"Compute the explicit UNKNOWN share of each eval's recorded answers.","objective":"Expose explicitly recorded UNKNOWN proportions without conflating absent observations with classified uncertainty.","acceptance":"Emit one UNKNOWN row per retained canonical eval group, including zero UNKNOWN counts; answer-share is unknown / answers across recorded YES, NO and UNKNOWN observations. Missing observations are not UNKNOWN answers.","from":"eval-answer-counts","compute":[{"as":"eval-result","function":"literal","args":[{"value":"UNKNOWN"}]},{"as":"answer-order","function":"literal","args":[{"value":2}]},{"as":"answer-share","function":"quotient","args":[{"field":"unknown"},{"field":"answers"}]}]},{"name":"eval-answer-distribution","subject":"Compare YES, NO and UNKNOWN percentages within each eval.","objective":"Show three horizontal bars per eval that together account for all recorded answers.","acceptance":"Emit all three answer categories, including zero shares; percentages sum to 100 per canonical eval. Missing observations are not UNKNOWN answers. Preserve workflow and repository attribution.","from":"eval-yes-shares","union":["eval-no-shares","eval-unknown-shares"],"compute":[{"as":"answer-percent","function":"product","args":[{"field":"answer-share"},{"value":100}]},{"as":"eval-label","function":"concat","args":[{"field":"eval"},{"value":" | "},{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}],"order-by":[{"field":"eval-label","direction":"asc"},{"field":"answer-order","direction":"asc"}]},{"name":"grader-observed-maxima","subject":"Find each workflow-scoped grader's maximum retained value in the selected data.","objective":"Provide an observed normalization denominator without mixing grader identities or claiming a theoretical maximum.","acceptance":"Group by canonical grader identity, not display name; ignore missing values and preserve zero or negative maxima without substituting a denominator.","from":"grader-observations","aggregate":{"by":["grader-id"],"values":[{"field":"value","as":"max-grader-value","reducer":"max"}]}},{"name":"grader-normalized-observations","subject":"Normalize each grader observation by that grader's observed maximum.","objective":"Compare relative grader values over time while preserving native measurements and run provenance.","acceptance":"Compute value / max-grader-value without clamping or inverting lower-is-better measures; zero or missing denominators produce null, never a fabricated zero or infinity.","from":"grader-observations","joins":[{"source":"grader-observed-maxima","type":"left","on":[{"left":"grader-id","right":"grader-id"}],"fields":[{"field":"max-grader-value","as":"max-grader-value"}]}],"compute":[{"as":"normalized-value","function":"quotient","args":[{"field":"value"},{"field":"max-grader-value"}]},{"as":"_observation-time","function":"timestamp","args":[{"field":"observed-at"}]},{"as":"_unplottable-value","function":"equals-any","args":[{"field":"normalized-value"},{"value":null}]},{"as":"_unplottable-time","function":"equals-any","args":[{"field":"_observation-time"},{"value":null}]},{"as":"grader-series","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":" / "},{"field":"workflow"},{"value":" / "},{"field":"grader"}]}]},{"name":"grader-value-scatter","subject":"Plot timed grader observations with a defined value-to-observed-maximum ratio.","objective":"Show relative grader measurements at their recorded observation times.","acceptance":"Keep each eligible observation and its run link; omit missing ratios or observation times from the plot while retaining those records in the native-value ledger. Ratios are not eval answers or evidence of improvement.","from":"grader-normalized-observations","filter":{"predicates":[{"field":"_unplottable-value","equals":false},{"field":"_unplottable-time","equals":false}]},"order-by":[{"field":"observed-at","direction":"asc"}]},{"name":"grader-status-ledger","subject":"Report grader measurements, units and explicit statuses without confusing them with binary eval answers.","objective":"Preserve numeric grader evidence and distinguish explicit per-observation pass and fail verdicts from unknown statuses.","acceptance":"Retain native grader values, units and statuses. Map only pass/passed to YES and fail/failed to NO in the auxiliary verdict field, leaving all other statuses unknown; never infer an eval answer, current success, causation or policy authority from a grader score.","from":"grader-observations","compute":[{"as":"is-pass","function":"equals-any","args":[{"field":"status"},{"value":"pass"},{"value":"passed"}]},{"as":"is-fail","function":"equals-any","args":[{"field":"status"},{"value":"fail"},{"value":"failed"}]},{"as":"non-pass-verdict","function":"if","args":[{"field":"is-fail"},{"value":"NO"},{"value":"unknown"}]},{"as":"verdict","function":"if","args":[{"field":"is-pass"},{"value":"YES"},{"field":"non-pass-verdict"}]}]},{"name":"routing-session-observations","subject":"Read metadata-only unified-session routing evidence.","objective":"Keep routing analytics independent of native logs and inferred run totals.","acceptance":"Only recognized session events contribute; event clocks remain absent when unrecorded.","from":"audits","filter":{"predicates":[{"field":"event-type","in":["session.format","workflow.info","workflow.job_result","agent.execution","firewall.model_routing","firewall.token_usage","usage.report","firewall.steering","firewall.upstream_error","model.config","model.baseline_estimate","model.resolution","model_routing.outcome","model_endpoint.mismatch","session.collection","session.collection_warning","subagent.request","subagent.started","subagent.configured","subagent.completed","subagent.failed","subagent.model_unavailable"]}]},"compute":[{"as":"record-clock","function":"timestamp","args":[{"field":"event-timestamp"}]},{"as":"event-clock","function":"coalesce","args":[{"field":"routing-session-clock"},{"field":"record-clock"}]},{"as":"routing-run-key","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"run"}]},{"as":"agent-phase","function":"equals-any","args":[{"field":"phase"},{"value":"agent"}]},{"as":"proxy-selection","function":"equals-any","args":[{"field":"routing-stage"},{"value":"selection"}]},{"as":"proxy-failure","function":"equals-any","args":[{"field":"routing-stage"},{"value":"failure"}]},{"as":"has-agent-name","function":"greater-than","args":[{"field":"routing-agent-name"},{"value":""}]}]},{"name":"routing-session-attempts","from":"routing-session-observations","subject":"Identify available session files and their earliest recorded clocks.","objective":"Keep rerun attempts from multiplying routing denominators.","acceptance":"Attempt order is only a tie-breaker after the recorded session clock.","aggregate":{"by":["routing-run-key","run-attempt"],"values":[{"field":"event-clock","as":"session-clock","reducer":"min"}]}},{"name":"routing-session-order","from":"routing-session-attempts","subject":"Order duplicate run sessions by run time and attempt.","objective":"Keep the latest file for each repository/run identity.","acceptance":"Only one attempt contributes to routing facts.","window":[{"operation":"row-number","field":"run-attempt","as":"session-position","groupby":["routing-run-key"],"order-by":[{"field":"session-clock","direction":"desc"},{"field":"run-attempt","direction":"desc"}]}]},{"name":"routing-latest-sessions","from":"routing-session-order","subject":"Retain one authoritative session attempt per run.","objective":"Avoid mixing picks or accounting from reruns.","acceptance":"Duplicate attempts remain available in session coverage.","filter":{"predicates":[{"field":"session-position","equals":1}]}},{"name":"routing-session-events","from":"routing-session-observations","subject":"Read routing metadata from the latest session file per run.","objective":"Deduplicate rerun attempts before any metric.","acceptance":"Earlier attempts never add cost or change the selected pick.","joins":[{"source":"routing-latest-sessions","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"session-clock","as":"session-clock"}]}]},{"name":"routing-run-facts","subject":"Collect per-session source facts without interpreting absence as success.","objective":"Resolve routing states and coverage from runner and proxy evidence.","acceptance":"Agent-phase proxy selection wins over failure and harness status; untimed observations keep unknown time.","from":"routing-session-events","aggregate":{"by":["routing-run-key","organization","repository","workflow","run"],"values":[{"field":"event-clock","as":"run-clock","reducer":"min"},{"field":"run-link","as":"run-link","reducer":"unique"},{"field":"engine","as":"engine","reducer":"unique"},{"field":"event","as":"workflow-info-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"},{"field":"required","equals":true}]}},{"field":"event-status","as":"session-format","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"session.format"}]}},{"field":"event","as":"selection-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"selection"},{"field":"phase","equals":"agent"}]}},{"field":"event","as":"failure-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"failure"},{"field":"phase","equals":"agent"}]}},{"field":"event","as":"local-effort-failures","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"failure"},{"field":"code","equals":"unsupported_reasoning_effort"}]}},{"field":"event","as":"proxy-record-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"phase","equals":"agent"}]}},{"field":"event","as":"agent-accounting-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.token_usage"},{"field":"phase","equals":"agent"}]}},{"field":"event","as":"subagent-count","reducer":"count","filter":{"predicates":[{"field":"event-type","in":["subagent.started","subagent.request","subagent.configured","subagent.completed","subagent.failed","subagent.model_unavailable"]}]}},{"field":"routing-status","as":"harness-status","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-enabled","as":"configured-enabled","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"model.config"}]}},{"field":"routing-selected-model","as":"harness-model","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"telemetry-model","as":"workflow-model","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-selected-effort","as":"harness-effort","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-mode","as":"harness-mode","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-awf-version","as":"session-awf-version","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-goal","as":"configured-goal","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"model.config"}]}},{"field":"routing-configured-mode","as":"configured-routing-mode","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"model.config"}]}},{"field":"routing-max-credits","as":"configured-max-credits","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"model.config"}]}},{"field":"event-status","as":"agent-result","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.job_result"},{"field":"name","equals":"agent"},{"field":"event-status","in":["success","failure","cancelled","skipped"]}]}},{"field":"event","as":"warnings","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"session.collection_warning"}]}}]}},{"name":"routing-ordered-selections","subject":"Order proxy selections within each session.","objective":"Use the last selection by normalized clock and file order.","acceptance":"Harness and advisory picks never override proxy selections.","from":"routing-session-events","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"selection"},{"field":"phase","equals":"agent"}]},"window":[{"operation":"row-number","field":"source-sequence","as":"selection-position","groupby":["routing-run-key"],"order-by":[{"field":"event-timestamp","direction":"desc"},{"field":"source-sequence","direction":"desc"}]}]},{"name":"routing-selections","subject":"Retain one authoritative proxy pick per run.","objective":"Avoid multiplying requests or run counts after re-selection.","acceptance":"One row per identified run uses the final proxy selection.","from":"routing-ordered-selections","filter":{"predicates":[{"field":"selection-position","equals":1}]}},{"name":"routing-resolved-runs","subject":"Resolve routing state, pick and label cells from unified sessions.","objective":"Distinguish selected, failed, harness-only, configured, inferred and unknown evidence.","acceptance":"Proxy evidence wins; configuration conflicts are visible; missing picks and time remain unknown.","from":"routing-run-facts","joins":[{"source":"routing-selections","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"routing-selected-model","as":"proxy-model"},{"field":"routing-selected-effort","as":"proxy-effort"},{"field":"routing-goal","as":"proxy-goal"},{"field":"routing-mode","as":"proxy-mode"},{"field":"routing-configured-mode","as":"proxy-configured-mode"},{"field":"routing-task-type","as":"routing-task-type"},{"field":"routing-scope","as":"routing-scope"},{"field":"routing-complexity","as":"routing-complexity"},{"field":"routing-latency-ms","as":"routing-latency-ms"},{"field":"routing-degraded","as":"routing-degraded"},{"field":"routing-classifier-attempts","as":"routing-classifier-attempts"},{"field":"routing-classifier-model","as":"routing-classifier-model"},{"field":"routing-classifier-effort","as":"routing-classifier-effort"},{"field":"routing-schema","as":"routing-schema"},{"field":"routing-awf-version","as":"proxy-awf-version"},{"field":"routing-router-version","as":"routing-router-version"}]}],"compute":[{"as":"observed-at","function":"iso-timestamp","args":[{"field":"run-clock"}]},{"as":"routing-awf-version","function":"coalesce","args":[{"field":"session-awf-version"},{"field":"proxy-awf-version"}]},{"as":"routing-mode","function":"coalesce","args":[{"field":"proxy-mode"},{"field":"harness-mode"}]},{"as":"routing-goal","function":"coalesce","args":[{"field":"proxy-goal"},{"field":"configured-goal"}]},{"as":"routing-configured-mode","function":"coalesce","args":[{"field":"proxy-configured-mode"},{"field":"configured-routing-mode"}]},{"as":"has-selection","function":"greater-than","args":[{"field":"selection-count"},{"value":0}]},{"as":"has-failure","function":"greater-than","args":[{"field":"failure-count"},{"value":0}]},{"as":"has-harness","function":"equals-any","args":[{"field":"harness-status"},{"value":null}]},{"as":"has-usage","function":"greater-than","args":[{"field":"agent-accounting-count"},{"value":0}]},{"as":"no-proxy","function":"equals-any","args":[{"field":"proxy-record-count"},{"value":0}]},{"as":"usage-state","function":"if","args":[{"field":"has-usage"},{"value":"unrouted_inferred"},{"value":"unknown"}]},{"as":"inferred-state","function":"if","args":[{"field":"no-proxy"},{"field":"usage-state"},{"value":"unknown"}]},{"as":"enabled","function":"equals-any","args":[{"field":"configured-enabled"},{"value":true}]},{"as":"disabled","function":"equals-any","args":[{"field":"configured-enabled"},{"value":false}]},{"as":"enabled-state","function":"if","args":[{"field":"enabled"},{"value":"configured_unrecorded"},{"field":"inferred-state"}]},{"as":"configured-state","function":"if","args":[{"field":"disabled"},{"value":"unrouted"},{"field":"enabled-state"}]},{"as":"reported-state","function":"if","args":[{"field":"has-harness"},{"field":"configured-state"},{"value":"harness_reported"}]},{"as":"failure-state","function":"if","args":[{"field":"has-failure"},{"value":"selection_failed"},{"field":"reported-state"}]},{"as":"routing-state","function":"if","args":[{"field":"has-selection"},{"value":"selected"},{"field":"failure-state"}]},{"as":"observed-pick-model","function":"if","args":[{"field":"has-selection"},{"field":"proxy-model"},{"field":"harness-model"}]},{"as":"observed-pick-effort","function":"if","args":[{"field":"has-selection"},{"field":"proxy-effort"},{"field":"harness-effort"}]},{"as":"pick-model","function":"coalesce","args":[{"field":"observed-pick-model"},{"value":"unknown"}]},{"as":"pick-effort","function":"coalesce","args":[{"field":"observed-pick-effort"},{"value":"unknown"}]},{"as":"pick","function":"concat","args":[{"field":"pick-model"},{"value":" / "},{"field":"pick-effort"}]},{"as":"has-proxy-decision","function":"if","args":[{"field":"has-selection"},{"value":true},{"field":"has-failure"}]},{"as":"has-decision","function":"if","args":[{"field":"has-harness"},{"field":"has-proxy-decision"},{"value":true}]},{"as":"configuration-conflict","function":"if","args":[{"field":"disabled"},{"field":"has-decision"},{"value":false}]},{"as":"unknown-pick-model","function":"equals-any","args":[{"field":"pick-model"},{"value":"unknown"}]},{"as":"unknown-pick-effort","function":"equals-any","args":[{"field":"pick-effort"},{"value":"unknown"}]},{"as":"unknown-pick","function":"if","args":[{"field":"unknown-pick-model"},{"value":true},{"field":"unknown-pick-effort"}]},{"as":"routing-key-encoded","function":"url-encode","args":[{"field":"routing-run-key"}]},{"as":"routing-href","function":"concat","args":[{"value":"#page-routing-run?routing-run="},{"field":"routing-key-encoded"}]},{"as":"routing-dashboard-link","function":"dashboard-link","args":[{"field":"run-link"},{"field":"routing-href"},{"field":"run"}]}],"filter":{"predicates":[{"field":"workflow-info-count","gte":1}]}},{"name":"routing-filter-candidates","from":"routing-aggregates","subject":"Apply one run-level scope before every routing metric and event join.","objective":"Filter complete sessions, never fragments of their evidence.","acceptance":"Unknown run time is excluded from a bounded range; blank filters retain all known values.","parameters":[{"name":"routing-filter-workflow","type":"string"},{"name":"routing-filter-repository","type":"string"},{"name":"routing-filter-engine","type":"string"},{"name":"routing-filter-state","type":"string"},{"name":"routing-filter-goal","type":"string"},{"name":"routing-filter-mode","type":"string"},{"name":"routing-filter-awf","type":"string"},{"name":"routing-filter-start","type":"string"},{"name":"routing-filter-end","type":"string"}],"compute":[{"as":"full-repository","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"all-workflows","function":"equals-any","args":[{"parameter":"routing-filter-workflow"},{"value":""}]},{"as":"same-workflow","function":"equals-any","args":[{"field":"workflow"},{"parameter":"routing-filter-workflow"}]},{"as":"include-workflow","function":"if","args":[{"field":"all-workflows"},{"value":true},{"field":"same-workflow"}]},{"as":"all-repositories","function":"equals-any","args":[{"parameter":"routing-filter-repository"},{"value":""}]},{"as":"same-repository","function":"equals-any","args":[{"field":"full-repository"},{"parameter":"routing-filter-repository"}]},{"as":"include-repository","function":"if","args":[{"field":"all-repositories"},{"value":true},{"field":"same-repository"}]},{"as":"all-engines","function":"equals-any","args":[{"parameter":"routing-filter-engine"},{"value":""}]},{"as":"same-engine","function":"equals-any","args":[{"field":"engine"},{"parameter":"routing-filter-engine"}]},{"as":"include-engine","function":"if","args":[{"field":"all-engines"},{"value":true},{"field":"same-engine"}]},{"as":"all-states","function":"equals-any","args":[{"parameter":"routing-filter-state"},{"value":""}]},{"as":"same-state","function":"equals-any","args":[{"field":"routing-state"},{"parameter":"routing-filter-state"}]},{"as":"include-state","function":"if","args":[{"field":"all-states"},{"value":true},{"field":"same-state"}]},{"as":"all-goals","function":"equals-any","args":[{"parameter":"routing-filter-goal"},{"value":""}]},{"as":"same-goal","function":"equals-any","args":[{"field":"routing-goal"},{"parameter":"routing-filter-goal"}]},{"as":"include-goal","function":"if","args":[{"field":"all-goals"},{"value":true},{"field":"same-goal"}]},{"as":"all-modes","function":"equals-any","args":[{"parameter":"routing-filter-mode"},{"value":""}]},{"as":"same-mode","function":"equals-any","args":[{"field":"routing-mode"},{"parameter":"routing-filter-mode"}]},{"as":"include-mode","function":"if","args":[{"field":"all-modes"},{"value":true},{"field":"same-mode"}]},{"as":"all-awf","function":"equals-any","args":[{"parameter":"routing-filter-awf"},{"value":""}]},{"as":"same-awf","function":"equals-any","args":[{"field":"routing-awf-version"},{"parameter":"routing-filter-awf"}]},{"as":"include-awf","function":"if","args":[{"field":"all-awf"},{"value":true},{"field":"same-awf"}]},{"as":"all-starts","function":"equals-any","args":[{"parameter":"routing-filter-start"},{"value":""}]},{"as":"start-clock","function":"timestamp","args":[{"parameter":"routing-filter-start"}]},{"as":"start-before","function":"difference","args":[{"field":"start-clock"},{"value":1}]},{"as":"after-start","function":"greater-than","args":[{"field":"run-clock"},{"field":"start-before"}]},{"as":"include-start","function":"if","args":[{"field":"all-starts"},{"value":true},{"field":"after-start"}]},{"as":"all-ends","function":"equals-any","args":[{"parameter":"routing-filter-end"},{"value":""}]},{"as":"end-clock","function":"timestamp","args":[{"parameter":"routing-filter-end"}]},{"as":"before-end","function":"greater-than","args":[{"field":"end-clock"},{"field":"run-clock"}]},{"as":"include-end","function":"if","args":[{"field":"all-ends"},{"value":true},{"field":"before-end"}]}]},{"name":"routing-runs","from":"routing-filter-candidates","subject":"Retain identified runs matching every selected routing filter.","objective":"Use the same population for adoption, accounting and outcomes.","acceptance":"A time bound excludes untimed runs and does not remove individual events from retained sessions.","filter":{"predicates":[{"field":"include-workflow","equals":true},{"field":"include-repository","equals":true},{"field":"include-engine","equals":true},{"field":"include-state","equals":true},{"field":"include-goal","equals":true},{"field":"include-mode","equals":true},{"field":"include-awf","equals":true},{"field":"include-start","equals":true},{"field":"include-end","equals":true}]}},{"name":"routing-events","from":"routing-session-events","subject":"Retain all evidence belonging to scoped identified runs.","objective":"Filter event metrics by the resolved run rather than by individual event clocks.","acceptance":"State, pick and accounting are computed before the scope is applied.","joins":[{"source":"routing-runs","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"routing-state","as":"run-routing-state"}]}]},{"name":"routing-phase-sources","subject":"Choose one nonoverlapping accounting source per run and phase.","objective":"Prefer proxy token usage over usage reports.","acceptance":"Snapshot totals and cumulative totalAic never enter additive cost.","from":"routing-events","aggregate":{"by":["routing-run-key","phase"],"values":[{"field":"event","as":"proxy-usage-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.token_usage"}]}},{"field":"event","as":"report-usage-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"usage.report"}]}},{"field":"event","as":"proxy-source-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"session.collection"},{"field":"name","equals":"token-usage.jsonl"},{"field":"event-status","equals":"collected"}]}},{"field":"event","as":"report-source-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"session.collection"},{"field":"name","in":["agent_usage.json","usage.json","usage.jsonl","usage-report.jsonl"]},{"field":"event-status","equals":"collected"}]}}]}},{"name":"routing-accounting-candidates","subject":"Read nonoverlapping per-response accounting records.","objective":"Expose recorded credits and token classes without repricing unknown usage.","acceptance":"Each phase uses proxy accounting when present and usage.report otherwise; absent AIC is counted.","from":"routing-events","joins":[{"source":"routing-phase-sources","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"}],"fields":[{"field":"proxy-usage-count","as":"proxy-usage-count"}]}],"compute":[{"as":"has-proxy-accounting","function":"greater-than","args":[{"field":"proxy-usage-count"},{"value":0}]},{"as":"accounting-identity","function":"coalesce","args":[{"field":"correlation-id"},{"field":"event"}]},{"as":"accounting-source","function":"if","args":[{"field":"has-proxy-accounting"},{"value":"firewall.token_usage"},{"value":"usage.report"}]},{"as":"selected-accounting","function":"equals-any","args":[{"field":"event-type"},{"field":"accounting-source"}]},{"as":"unknown-aic","function":"equals-any","args":[{"field":"aic"},{"value":null}]},{"as":"unknown-aic-count","function":"if","args":[{"field":"unknown-aic"},{"value":1},{"value":0}]}],"window":[{"operation":"row-number","field":"source-sequence","as":"accounting-position","groupby":["routing-run-key","phase","event-type","accounting-identity"],"order-by":[{"field":"event-timestamp","direction":"desc"},{"field":"source-sequence","direction":"desc"}]}]},{"name":"routing-accounting","subject":"Select the authoritative accounting source for each phase.","objective":"Exclude overlapping usage reports and snapshots.","acceptance":"Every accounting row contributes at most once.","from":"routing-accounting-candidates","filter":{"predicates":[{"field":"selected-accounting","equals":true},{"field":"accounting-position","equals":1},{"field":"phase","in":["agent","detection","evals"]}]}},{"name":"routing-request-candidates","subject":"Keep per-request routing decisions separate from accounting.","objective":"Join routed outcomes by run, phase and request ID.","acceptance":"Rejected requests establish local zero cost; other unmatched requests retain unknown cost.","from":"routing-events","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"request"}]},"compute":[{"as":"request-identity","function":"coalesce","args":[{"field":"correlation-id"},{"field":"event"}]}],"window":[{"operation":"row-number","field":"source-sequence","as":"request-position","groupby":["routing-run-key","phase","request-identity"],"order-by":[{"field":"event-timestamp","direction":"desc"},{"field":"source-sequence","direction":"desc"}]}]},{"name":"routing-request-records","from":"routing-request-candidates","subject":"Retain the latest record for each request identity.","objective":"Avoid duplicate request joins and overlapping totals.","acceptance":"Requests without IDs remain independent, not falsely correlated.","filter":{"predicates":[{"field":"request-position","equals":1}]}},{"name":"routing-subagent-candidates","subject":"Read engine-reported sub-agent request ownership.","objective":"Use exact request-ID ownership before falling back to unsplit traffic.","acceptance":"Only request identities can assign exact ownership; advisory outcomes never assign credits.","from":"routing-events","filter":{"predicates":[{"field":"event-type","equals":"subagent.request"}]},"compute":[{"as":"subagent-identity","function":"coalesce","args":[{"field":"correlation-id"},{"field":"event"}]}],"window":[{"operation":"row-number","field":"source-sequence","as":"subagent-position","groupby":["routing-run-key","phase","subagent-identity"],"order-by":[{"field":"event-timestamp","direction":"desc"},{"field":"source-sequence","direction":"desc"}]}]},{"name":"routing-subagent-requests","from":"routing-subagent-candidates","subject":"Retain one sub-agent observation per request identity.","objective":"Keep exact ownership joins unique.","acceptance":"Missing identities do not match unrelated requests.","filter":{"predicates":[{"field":"subagent-position","equals":1}]}},{"name":"routing-exact-accounting","subject":"Attribute each accounting record to exactly one traffic bucket.","objective":"Keep detection, evals, classifier, exact sub-agent, main, unsplit and unattributed credits distinct.","acceptance":"Detection and evals use phase, missing purpose is never agent by default, and snapshot credits are excluded.","from":"routing-accounting","joins":[{"source":"routing-request-records","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"},{"left":"correlation-id","right":"correlation-id"}],"fields":[{"field":"event","as":"request-event"},{"field":"routing-routed","as":"request-routed"},{"field":"routing-deviations","as":"request-deviations"},{"field":"routing-outcome","as":"request-outcome"},{"field":"routing-requested-model","as":"request-model"},{"field":"routing-requested-effort","as":"request-effort"}]},{"source":"routing-subagent-requests","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"},{"left":"correlation-id","right":"correlation-id"}],"fields":[{"field":"routing-agent-name","as":"exact-agent-name"}]},{"source":"routing-run-facts","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"subagent-count","as":"subagent-count"}]}],"compute":[{"as":"exact-owner","function":"coalesce","args":[{"field":"routing-agent-name"},{"field":"exact-agent-name"}]},{"as":"no-exact-owner","function":"equals-any","args":[{"field":"exact-owner"},{"value":null}]}]},{"name":"routing-correlation-usage-candidates","from":"routing-exact-accounting","subject":"Find accounting records without exact sub-agent ownership.","objective":"Correlate only fully recorded token quartets in file order.","acceptance":"Missing token classes never match by model alone.","filter":{"predicates":[{"field":"phase","equals":"agent"},{"field":"no-exact-owner","equals":true}]},"compute":[{"as":"token-quartet","function":"sum","args":[{"field":"input-tokens"},{"field":"output-tokens"},{"field":"cache-read-tokens"},{"field":"cache-write-tokens"}]},{"as":"is-classifier","function":"equals-any","args":[{"field":"routing-purpose"},{"value":"routing_classification"}]}]},{"name":"routing-correlation-usage","from":"routing-correlation-usage-candidates","subject":"Order unmatched accounting within model and token quartet.","objective":"Match each engine-reported request at most once.","acceptance":"Classifier, incomplete and already-exact requests are excluded.","filter":{"predicates":[{"field":"token-quartet","gte":0},{"field":"is-classifier","equals":false}]},"window":[{"operation":"row-number","field":"source-sequence","as":"correlation-position","groupby":["routing-run-key","telemetry-model","input-tokens","output-tokens","cache-read-tokens","cache-write-tokens"],"order-by":[{"field":"source-sequence","direction":"asc"}]}]},{"name":"routing-correlation-subagent-candidates","from":"routing-subagent-requests","subject":"Exclude engine requests already matched by proxy request ID.","objective":"Prevent exact and correlated ownership from claiming the same request.","acceptance":"Only engine requests with a complete quartet and a definition name can correlate.","joins":[{"source":"routing-accounting","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"},{"left":"correlation-id","right":"correlation-id"}],"fields":[{"field":"event","as":"exact-accounting-event"}]}],"compute":[{"as":"token-quartet","function":"sum","args":[{"field":"input-tokens"},{"field":"output-tokens"},{"field":"cache-read-tokens"},{"field":"cache-write-tokens"}]}]},{"name":"routing-correlation-subagents","from":"routing-correlation-subagent-candidates","subject":"Order unmatched engine requests within each model/token quartet.","objective":"Produce deterministic one-to-one correlated ownership.","acceptance":"Correlation is labelled separately from exact evidence.","filter":{"predicates":[{"field":"exact-accounting-event","equals":null},{"field":"token-quartet","gte":0},{"field":"phase","equals":"agent"}]},"window":[{"operation":"row-number","field":"source-sequence","as":"correlation-position","groupby":["routing-run-key","telemetry-model","input-tokens","output-tokens","cache-read-tokens","cache-write-tokens"],"order-by":[{"field":"source-sequence","direction":"asc"}]}]},{"name":"routing-correlated-accounting","from":"routing-correlation-usage","subject":"Join proxy usage with unmatched engine requests by model, quartet and occurrence.","objective":"Use the spec's correlated sub-agent attribution without duplicating credits.","acceptance":"Each engine request and accounting record participates at most once.","joins":[{"source":"routing-correlation-subagents","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"telemetry-model","right":"telemetry-model"},{"left":"input-tokens","right":"input-tokens"},{"left":"output-tokens","right":"output-tokens"},{"left":"cache-read-tokens","right":"cache-read-tokens"},{"left":"cache-write-tokens","right":"cache-write-tokens"},{"left":"correlation-position","right":"correlation-position"}],"fields":[{"field":"routing-agent-name","as":"correlated-owner"}]}],"select":[{"field":"routing-run-key"},{"field":"event"},{"field":"correlated-owner"}]},{"name":"routing-attributed-accounting","from":"routing-exact-accounting","subject":"Assign every accounting record to exactly one exclusive bucket.","objective":"Keep exact and correlated sub-agent ownership distinct.","acceptance":"Phase wins over purpose; missing ownership remains unsplit or unattributed.","joins":[{"source":"routing-correlated-accounting","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"event","right":"event"}],"fields":[{"field":"correlated-owner","as":"correlated-owner"}]}],"compute":[{"as":"agent-name","function":"coalesce","args":[{"field":"exact-owner"},{"field":"correlated-owner"}]},{"as":"unknown-agent","function":"equals-any","args":[{"field":"agent-name"},{"value":null}]},{"as":"unknown-request","function":"equals-any","args":[{"field":"request-event"},{"value":null}]},{"as":"has-subagents","function":"greater-than","args":[{"field":"subagent-count"},{"value":0}]},{"as":"is-subagent-purpose","function":"equals-any","args":[{"field":"routing-purpose"},{"value":"subagent"}]},{"as":"is-agent-purpose","function":"equals-any","args":[{"field":"routing-purpose"},{"value":"agent"}]},{"as":"matched-bucket","function":"if","args":[{"field":"has-subagents"},{"value":"agent_unsplit"},{"value":"main_agent"}]},{"as":"request-bucket","function":"if","args":[{"field":"unknown-request"},{"value":"unattributed"},{"field":"matched-bucket"}]},{"as":"subagent-bucket","function":"if","args":[{"field":"is-subagent-purpose"},{"value":"agent_unsplit"},{"field":"request-bucket"}]},{"as":"purpose-bucket","function":"if","args":[{"field":"is-agent-purpose"},{"value":"main_agent"},{"field":"subagent-bucket"}]},{"as":"subagent-attribution","function":"if","args":[{"field":"no-exact-owner"},{"value":"subagent_correlated"},{"value":"subagent_exact"}]},{"as":"ownership-bucket","function":"if","args":[{"field":"unknown-agent"},{"field":"purpose-bucket"},{"field":"subagent-attribution"}]},{"as":"classifier","function":"equals-any","args":[{"field":"routing-purpose"},{"value":"routing_classification"}]},{"as":"classifier-bucket","function":"if","args":[{"field":"classifier"},{"value":"classifier"},{"field":"ownership-bucket"}]},{"as":"evals","function":"equals-any","args":[{"field":"phase"},{"value":"evals"}]},{"as":"phase-bucket","function":"if","args":[{"field":"evals"},{"value":"evals"},{"field":"classifier-bucket"}]},{"as":"detection","function":"equals-any","args":[{"field":"phase"},{"value":"detection"}]},{"as":"bucket","function":"if","args":[{"field":"detection"},{"value":"detection"},{"field":"phase-bucket"}]}]},{"name":"routing-joined-requests","subject":"Inspect per-request deviations and outcomes against proxy picks.","objective":"Keep requests without accounting visible and never invent a deviation cause.","acceptance":"Unmatched requests have unknown cost; each request retains its own requested and selected model.","from":"routing-request-records","joins":[{"source":"routing-accounting","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"},{"left":"correlation-id","right":"correlation-id"}],"fields":[{"field":"aic","as":"accounted-aic"},{"field":"event","as":"accounting-event"}]}],"compute":[{"as":"missing-accounting","function":"equals-any","args":[{"field":"accounting-event"},{"value":null}]},{"as":"failed-request","function":"equals-any","args":[{"field":"routing-outcome"},{"value":"failed"}]},{"as":"failed-unaccounted","function":"if","args":[{"field":"missing-accounting"},{"field":"failed-request"},{"value":false}]}],"order-by":[{"field":"event-timestamp","direction":"desc"}]},{"name":"routing-unaccounted-failures","from":"routing-joined-requests","subject":"Count failed requests lacking accounting per run.","objective":"Recognize only unambiguous AWF-local effort failures.","acceptance":"A run-level effort failure cannot assign zero to multiple failed requests.","aggregate":{"by":["routing-run-key"],"values":[{"field":"event","as":"failed-unaccounted-count","reducer":"count","filter":{"predicates":[{"field":"failed-unaccounted","equals":true}]}}]}},{"name":"routing-deviations","from":"routing-joined-requests","subject":"Resolve explicit local zero costs and preserve all other unknown request costs.","objective":"Avoid partial-cost comparisons based on missing accounting.","acceptance":"Only guard rejection or an unambiguous local effort failure establishes zero AIC.","joins":[{"source":"routing-unaccounted-failures","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"failed-unaccounted-count","as":"failed-unaccounted-count"}]},{"source":"routing-run-facts","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"local-effort-failures","as":"local-effort-failures"}]}],"compute":[{"as":"only-unaccounted-failure","function":"equals-any","args":[{"field":"failed-unaccounted-count"},{"value":1}]},{"as":"has-local-failure","function":"greater-than","args":[{"field":"local-effort-failures"},{"value":0}]},{"as":"unambiguous-local-failure","function":"if","args":[{"field":"only-unaccounted-failure"},{"field":"has-local-failure"},{"value":false}]},{"as":"local-code","function":"equals-any","args":[{"field":"code"},{"value":"unsupported_reasoning_effort"}]},{"as":"local-evidence","function":"if","args":[{"field":"local-code"},{"value":true},{"field":"unambiguous-local-failure"}]},{"as":"local-failure","function":"if","args":[{"field":"failed-request"},{"field":"local-evidence"},{"value":false}]},{"as":"guard-rejection","function":"equals-any","args":[{"field":"routing-outcome"},{"value":"rejected"}]},{"as":"zero-local-cost","function":"if","args":[{"field":"guard-rejection"},{"value":true},{"field":"local-failure"}]},{"as":"local-cost","function":"if","args":[{"field":"zero-local-cost"},{"value":0},{"value":null}]},{"as":"request-aic","function":"coalesce","args":[{"field":"accounted-aic"},{"field":"local-cost"}]},{"as":"unknown-request-cost","function":"equals-any","args":[{"field":"request-aic"},{"value":null}]},{"as":"unknown-request-count","function":"if","args":[{"field":"unknown-request-cost"},{"value":1},{"value":0}]}]},{"name":"routing-phase-usage","from":"routing-accounting","subject":"Sum nonoverlapping accounting per run and phase.","objective":"Establish complete costs only with known response values.","acceptance":"Unknown response costs remain counted.","aggregate":{"by":["routing-run-key","phase"],"values":[{"field":"aic","as":"recorded-aic","reducer":"sum"},{"field":"aic","as":"known-responses","reducer":"count"},{"field":"unknown-aic-count","as":"unknown-responses","reducer":"sum"}]}},{"name":"routing-request-coverage","from":"routing-deviations","subject":"Count requests whose cost remains unknown.","objective":"Exclude incomplete runs from distribution comparisons.","acceptance":"Unmatched nonlocal requests cannot be treated as free.","aggregate":{"by":["routing-run-key","phase"],"values":[{"field":"unknown-request-count","as":"unknown-requests","reducer":"sum"}]}},{"name":"routing-phase-costs","from":"routing-phase-sources","subject":"Evaluate accounting completeness using collected source receipts and request joins.","objective":"Exclude partial costs from medians and comparisons.","acceptance":"A complete phase has its selected accounting source, no missing AIC and no unaccounted nonlocal requests.","joins":[{"source":"routing-phase-usage","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"}],"fields":[{"field":"recorded-aic","as":"recorded-aic"},{"field":"unknown-responses","as":"unknown-responses"},{"field":"known-responses","as":"known-responses"}]},{"source":"routing-request-coverage","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"}],"fields":[{"field":"unknown-requests","as":"unknown-requests"}]}],"compute":[{"as":"has-proxy","function":"greater-than","args":[{"field":"proxy-usage-count"},{"value":0}]},{"as":"has-report","function":"greater-than","args":[{"field":"report-usage-count"},{"value":0}]},{"as":"any-source-count","function":"sum","args":[{"field":"proxy-source-count"},{"field":"report-source-count"}]},{"as":"report-or-empty-source","function":"if","args":[{"field":"has-report"},{"field":"report-source-count"},{"field":"any-source-count"}]},{"as":"accounting-source-count","function":"if","args":[{"field":"has-proxy"},{"field":"proxy-source-count"},{"field":"report-or-empty-source"}]},{"as":"source-present","function":"greater-than","args":[{"field":"accounting-source-count"},{"value":0}]},{"as":"missing-responses","function":"coalesce","args":[{"field":"unknown-responses"},{"value":0}]},{"as":"missing-requests","function":"coalesce","args":[{"field":"unknown-requests"},{"value":0}]},{"as":"missing-count","function":"sum","args":[{"field":"missing-responses"},{"field":"missing-requests"}]},{"as":"all-values-known","function":"equals-any","args":[{"field":"missing-count"},{"value":0}]},{"as":"complete","function":"if","args":[{"field":"source-present"},{"field":"all-values-known"},{"value":false}]},{"as":"known-sum","function":"coalesce","args":[{"field":"recorded-aic"},{"value":0}]},{"as":"complete-aic","function":"if","args":[{"field":"complete"},{"field":"known-sum"},{"value":null}]}]},{"name":"routing-agent-costs","from":"routing-phase-costs","subject":"Select complete or explicitly partial agent-phase costs.","objective":"Keep detection and evals out of agent-phase comparisons.","acceptance":"Classifier remains part of agent-phase cost.","filter":{"predicates":[{"field":"phase","equals":"agent"}]}},{"name":"routing-detection-costs","from":"routing-phase-costs","subject":"Retain detection-phase cost completeness separately.","objective":"Do not count detection as classifier or agent traffic.","acceptance":"Missing detection evidence remains unknown, not zero.","filter":{"predicates":[{"field":"phase","equals":"detection"}]}},{"name":"routing-cost-runs","from":"routing-resolved-runs","subject":"Attach accounting completeness to identified routing runs.","objective":"Provide comparable costs only for complete runs.","acceptance":"An absent cost stays unknown and never inherits aggregate run AIC.","joins":[{"source":"routing-runs","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"main-aic","as":"main-aic"},{"field":"baseline-model","as":"baseline-model"},{"field":"baseline-aic","as":"baseline-aic"},{"field":"baseline-complete","as":"baseline-complete"}]},{"source":"routing-agent-costs","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"complete-aic","as":"complete-aic"},{"field":"complete","as":"cost-complete"},{"field":"missing-count","as":"missing-cost-records"}]},{"source":"routing-detection-costs","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"complete-aic","as":"detection-aic"},{"field":"complete","as":"detection-complete"}]}],"compute":[{"as":"run-cost-complete","function":"if","args":[{"field":"cost-complete"},{"field":"detection-complete"},{"value":false}]},{"as":"run-aic","function":"sum","args":[{"field":"complete-aic"},{"field":"detection-aic"}]},{"as":"budget-use","function":"quotient","args":[{"field":"run-aic"},{"field":"configured-max-credits"}]}]},{"name":"routing-run-summary","from":"routing-runs","subject":"Keep the selected Run's compact routing and baseline evidence visible.","objective":"Preserve the comparison when shorter-lived Audit detail expires.","acceptance":"Retained aggregate costs and baseline evidence survive Audit expiry; absent phase details stay unknown.","joins":[{"source":"routing-cost-runs","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"cost-complete","as":"cost-complete"},{"field":"missing-cost-records","as":"missing-cost-records"},{"field":"detection-aic","as":"detection-aic"},{"field":"run-aic","as":"run-aic"},{"field":"budget-use","as":"budget-use"}]}]},{"name":"routing-weekly-cost-totals","from":"routing-runs","subject":"Summarize complete agent-phase costs by UTC ISO week and routing state.","objective":"Expose trends without including partial costs.","acceptance":"Untimed runs cannot enter time buckets.","filter":{"predicates":[{"field":"run-clock","gte":0}]},"compute":[{"as":"week","function":"date-bucket","args":[{"field":"observed-at"},{"value":"week"}]}],"aggregate":{"by":["week","routing-state"],"values":[{"field":"run","as":"runs","reducer":"count"},{"field":"complete-aic","as":"complete-runs","reducer":"count"},{"field":"complete-aic","as":"observed-median","reducer":"median"}]}},{"name":"routing-weekly-accounting-cost","from":"routing-weekly-cost-totals","subject":"Gate weekly medians by complete sample size.","objective":"Keep sparse weeks from implying meaningful cost trends.","acceptance":"Weeks below the configurable minimum display insufficient data.","parameters":[{"name":"minimum-sample","type":"number"}],"compute":[{"as":"cost-series","function":"concat","args":[{"value":"Agent-phase accounting: "},{"field":"routing-state"}]},{"as":"sample-floor","function":"difference","args":[{"parameter":"minimum-sample"},{"value":1}]},{"as":"enough-samples","function":"greater-than","args":[{"field":"complete-runs"},{"field":"sample-floor"}]},{"as":"median-aic","function":"if","args":[{"field":"enough-samples"},{"field":"observed-median"},{"value":null}]},{"as":"sample-status","function":"if","args":[{"field":"enough-samples"},{"value":"observational"},{"value":"insufficient data"}]}],"order-by":[{"field":"week","direction":"asc"}]},{"name":"routing-resolutions","from":"routing-session-events","subject":"Read runner-written configured-model resolutions for scoped routing runs.","objective":"Explain what each workflow role's configured model resolved to before the engine launched.","acceptance":"Only model.resolution facts from latest scoped attempts contribute; missing or unsafe values and failed null resolutions remain unknown.","joins":[{"source":"routing-runs","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"run-clock","as":"run-clock"},{"field":"observed-at","as":"run-observed-at"},{"field":"full-repository","as":"full-repository"},{"field":"routing-dashboard-link","as":"routing-dashboard-link"},{"field":"routing-state","as":"run-routing-state"}]}],"filter":{"predicates":[{"field":"event-type","equals":"model.resolution"}]},"compute":[{"as":"resolution-engine","function":"coalesce","args":[{"field":"telemetry-engine"},{"value":"unknown"}]},{"as":"resolution-role-label","function":"coalesce","args":[{"field":"resolution-role"},{"value":"unknown"}]},{"as":"configured-model","function":"coalesce","args":[{"field":"resolution-configured-model"},{"value":"unknown"}]},{"as":"resolved-model-label","function":"coalesce","args":[{"field":"resolution-resolved-model"},{"value":"unknown"}]},{"as":"resolution-provider","function":"coalesce","args":[{"field":"provider"},{"value":"unknown"}]},{"as":"resolution-status","function":"coalesce","args":[{"field":"event-status"},{"value":"unknown"}]},{"as":"failed-resolution","function":"equals-any","args":[{"field":"event-status"},{"value":"failed"}]},{"as":"failure-cause","function":"coalesce","args":[{"field":"code"},{"value":"unknown"}]},{"as":"resolution-cause","function":"if","args":[{"field":"failed-resolution"},{"field":"failure-cause"},{"field":"code"}]},{"as":"unknown-resolved-model","function":"equals-any","args":[{"field":"resolution-resolved-model"},{"value":null}]},{"as":"untimed","function":"equals-any","args":[{"field":"run-clock"},{"value":null}]},{"as":"configured-to-resolved","function":"concat","args":[{"field":"configured-model"},{"value":" → "},{"field":"resolved-model-label"}]},{"as":"workflow-key","function":"concat","args":[{"field":"full-repository"},{"value":":"},{"field":"workflow"}]},{"as":"resolution-actor","function":"concat","args":[{"field":"resolution-engine"},{"value":"/"},{"field":"resolution-role-label"},{"value":"/"},{"field":"resolution-provider"}]},{"as":"resolution-series","function":"concat","args":[{"field":"workflow-key"},{"value":" | "},{"field":"resolution-actor"},{"value":" | "},{"field":"configured-model"}]}]},{"name":"routing-health-totals","from":"routing-runs","subject":"Count routed runs and their selection, failure, adherence, outcome and cost evidence per repository and workflow.","objective":"Answer whether routing is on and working from one row per routed workflow.","acceptance":"Only selected, selection_failed, harness_reported and configured_unrecorded runs contribute; runs without evidence stay out of each denominator.","filter":{"predicates":[{"field":"routing-state","in":["selected","selection_failed","harness_reported","configured_unrecorded"]}]},"compute":[{"as":"has-routing-failure","function":"greater-than","args":[{"field":"failure-count"},{"value":0}]},{"as":"failure-or-fallback","function":"if","args":[{"field":"has-routing-failure"},{"value":true},{"field":"routing-degraded"}]},{"as":"adherence-known","function":"greater-than","args":[{"field":"flagged-requests"},{"value":0}]},{"as":"no-deviation","function":"equals-any","args":[{"field":"deviated-requests"},{"value":0}]}],"aggregate":{"by":["full-repository","workflow","baseline-model"],"values":[{"field":"paired-main-aic","as":"paired-main-aic","reducer":"sum"},{"field":"paired-baseline-aic","as":"paired-baseline-aic","reducer":"sum"},{"field":"run","as":"routed-runs","reducer":"count"},{"field":"run","as":"selected-runs","reducer":"count","filter":{"predicates":[{"field":"routing-state","equals":"selected"}]}},{"field":"run","as":"failure-runs","reducer":"count","filter":{"predicates":[{"field":"failure-or-fallback","equals":true}]}},{"field":"run","as":"adherence-known-runs","reducer":"count","filter":{"predicates":[{"field":"adherence-known","equals":true}]}},{"field":"run","as":"followed-runs","reducer":"count","filter":{"predicates":[{"field":"adherence-known","equals":true},{"field":"no-deviation","equals":true}]}},{"field":"agent-result","as":"known-outcomes","reducer":"count"},{"field":"run","as":"successes","reducer":"count","filter":{"predicates":[{"field":"agent-result","equals":"success"}]}},{"field":"complete-aic","as":"complete-runs","reducer":"count"},{"field":"complete-aic","as":"median-aic","reducer":"median"}]}},{"name":"routing-health","subject":"Show routing health shares per repository and workflow.","objective":"Tell whether routing is on and working from selection, failure or fallback, pick adherence, known outcomes and complete cost.","acceptance":"A zero denominator or no complete cost is unknown, never zero; unknown job outcomes are excluded from the success rate.","from":"routing-health-totals","compute":[{"as":"estimated-cost-vs-baseline","function":"quotient","args":[{"field":"paired-main-aic"},{"field":"paired-baseline-aic"}]},{"as":"estimated-cost-percent","function":"format-percent","args":[{"field":"estimated-cost-vs-baseline"}]},{"as":"selected-share","function":"quotient","args":[{"field":"selected-runs"},{"field":"routed-runs"}]},{"as":"failure-share","function":"quotient","args":[{"field":"failure-runs"},{"field":"routed-runs"}]},{"as":"followed-share","function":"quotient","args":[{"field":"followed-runs"},{"field":"adherence-known-runs"}]},{"as":"success-rate","function":"quotient","args":[{"field":"successes"},{"field":"known-outcomes"}]},{"as":"selected-percent","function":"format-percent","args":[{"field":"selected-share"}]},{"as":"failure-percent","function":"format-percent","args":[{"field":"failure-share"}]},{"as":"followed-percent","function":"format-percent","args":[{"field":"followed-share"}]},{"as":"success-percent","function":"format-percent","args":[{"field":"success-rate"}]}],"order-by":[{"field":"routed-runs","direction":"desc"},{"field":"full-repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"routing-weekly-models","from":"routing-runs","subject":"Count proxy-selected runs by UTC ISO week and picked model.","objective":"Show what the router chooses over time.","acceptance":"Only selected runs with a known pick model and a recorded run clock contribute; an unrecorded effort does not exclude a run.","filter":{"predicates":[{"field":"routing-state","equals":"selected"},{"field":"unknown-pick-model","equals":false},{"field":"run-clock","gte":0}]},"compute":[{"as":"week","function":"date-bucket","args":[{"field":"observed-at"},{"value":"week"}]}],"aggregate":{"by":["week","pick-model"],"values":[{"field":"run","as":"runs","reducer":"count"}]},"order-by":[{"field":"week","direction":"asc"},{"field":"pick-model","direction":"asc"}]},{"name":"routing-weekly-paired-totals","from":"routing-runs","subject":"Weekly paired complete main-request costs by baseline model.","objective":"Compare routing cost trends with each named baseline using identical main-request populations.","acceptance":"Only timed runs with complete positive baseline estimates and matching known main-request costs contribute to both medians.","filter":{"predicates":[{"field":"paired","equals":true},{"field":"run-clock","gte":0}]},"compute":[{"as":"week","function":"date-bucket","args":[{"field":"observed-at"},{"value":"week"}]}],"aggregate":{"by":["week","baseline-model"],"values":[{"field":"run","as":"complete-runs","reducer":"count"},{"field":"paired-main-aic","as":"observed-main-median","reducer":"median"},{"field":"paired-baseline-aic","as":"baseline-estimate-median","reducer":"median"}]}},{"name":"routing-weekly-paired-cost","from":"routing-weekly-paired-totals","subject":"Paired main-request samples that meet the chosen evidence floor.","objective":"Avoid changing routing policy based on insufficient paired evidence.","acceptance":"Observed and estimated series share the same complete-run count and configurable minimum sample.","parameters":[{"name":"minimum-sample","type":"number"}],"compute":[{"as":"sample-floor","function":"difference","args":[{"parameter":"minimum-sample"},{"value":1}]},{"as":"enough-samples","function":"greater-than","args":[{"field":"complete-runs"},{"field":"sample-floor"}]}]},{"name":"routing-weekly-main-observed","from":"routing-weekly-paired-cost","subject":"Observed main-request AIC for the same eligible runs as each baseline.","objective":"Identify weeks when routed main-request costs exceed the matching baseline estimate.","acceptance":"Observed medians exclude classifier and sub-agent costs and remain unknown below the paired sample floor.","compute":[{"as":"cost-series","function":"concat","args":[{"value":"Main requests observed (baseline: "},{"field":"baseline-model"},{"value":")"}]},{"as":"median-aic","function":"if","args":[{"field":"enough-samples"},{"field":"observed-main-median"},{"value":null}]}]},{"name":"routing-weekly-baseline-estimate","from":"routing-weekly-paired-cost","subject":"Explicitly estimated baseline AIC for paired main-agent requests.","objective":"Show the named counterfactual against which owners can assess routing goal or mode.","acceptance":"The series is labelled estimated, separates baseline models and uses exactly the observed series' eligible runs.","compute":[{"as":"cost-series","function":"concat","args":[{"value":"Baseline estimate (estimated, main requests): "},{"field":"baseline-model"}]},{"as":"median-aic","function":"if","args":[{"field":"enough-samples"},{"field":"baseline-estimate-median"},{"value":null}]}]},{"name":"routing-weekly-cost","from":"routing-weekly-accounting-cost","union":["routing-weekly-main-observed","routing-weekly-baseline-estimate"],"subject":"Compare the same main-agent requests to an explicitly estimated baseline.","objective":"Change routing goal or mode when paired observed cost exceeds the named baseline.","acceptance":"Keep agent-phase accounting separate, baseline models distinct and sparse weeks as gaps.","order-by":[{"field":"week","direction":"asc"},{"field":"cost-series","direction":"asc"}]},{"name":"routing-failure-problems","from":"routing-runs","subject":"Runs whose routing failure codes require investigation.","objective":"Investigate routing configuration or execution failures before changing rollout.","acceptance":"Emit one row per run with recorded routing failure identifiers, excluding upstream errors handled by their own kind.","filter":{"predicates":[{"field":"routing-failure-codes","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"routing failure"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"routing-failure-codes"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-deviation-problems","from":"routing-runs","subject":"Runs whose requests deviated from the routing pick.","objective":"Investigate why requests did not follow the selected model or effort.","acceptance":"Emit one row per run with distinct recorded deviation causes, without inferring causes from model names.","filter":{"predicates":[{"field":"routing-deviation-codes","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"deviation"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"routing-deviation-codes"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-resolution-problems","from":"routing-runs","subject":"Runs whose configured models could not be resolved.","objective":"Correct model aliases or restore catalogue availability for failed resolutions.","acceptance":"Emit one row per run with recorded resolution failure causes, not absence of resolution evidence.","filter":{"predicates":[{"field":"routing-resolution-codes","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"resolution failure"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"routing-resolution-codes"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-upstream-problems","from":"routing-runs","subject":"Provider-rejected requests with distinct upstream error codes.","objective":"Correct model or effort settings rejected by the provider.","acceptance":"Emit one upstream-error row per run with distinct safe codes or unknown, never a duplicate generic routing failure.","filter":{"predicates":[{"field":"routing-upstream-codes","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"upstream error"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"routing-upstream-codes"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-candidate-problems","from":"routing-runs","subject":"Runs whose full eligible pool contains choices the router cannot rank.","objective":"Review allowed models when the router cannot rank the complete eligible pool.","acceptance":"Emit one row only when both pool counters are known and overlap is below eligibility, displaying the observed ratio.","filter":{"predicates":[{"field":"candidate-coverage","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"candidates not rankable"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"candidate-coverage"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-problems","from":"routing-failure-problems","union":["routing-deviation-problems","routing-resolution-problems","routing-upstream-problems","routing-candidate-problems"],"subject":"List routing failures, deviations and resolution failures with one row per run and kind.","objective":"Show what needs attention and link each problem to its run page.","acceptance":"Time is the run's recorded observation time and stays unknown without a run clock; untimed rows sort after timed rows.","joins":[{"source":"routing-runs","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"run","as":"run"},{"field":"full-repository","as":"full-repository"},{"field":"workflow","as":"workflow"},{"field":"run-clock","as":"run-clock"},{"field":"observed-at","as":"observed-at"},{"field":"routing-dashboard-link","as":"routing-dashboard-link"}]}],"compute":[{"as":"untimed","function":"equals-any","args":[{"field":"run-clock"},{"value":null}]}],"order-by":[{"field":"untimed","direction":"asc"},{"field":"run-clock","direction":"desc"},{"field":"run","direction":"desc"},{"field":"problem-kind","direction":"asc"}]},{"name":"simulator-database-inputs","subject":"Model daily run volume and 30-day retained detail from user-supplied scenario inputs.","objective":"Compare hypothetical workload choices without treating results as observed activity.","acceptance":"Each simulated day uses the selected inputs; skipped runs retain summaries and detailed records have a 30-day lifetime.","description":"Each simulated day includes all accumulated run summaries; tools and issues belong only to non-skipped runs and expire after 30 days.","from":"simulation-days","parameters":[{"name":"repositories","type":"number"},{"name":"runs-per-day","type":"number"},{"name":"tools-per-run","type":"number"},{"name":"issues-per-run","type":"number"},{"name":"skip-rate","type":"number"}],"compute":[{"as":"runs-daily","function":"product","args":[{"parameter":"repositories"},{"parameter":"runs-per-day"}]},{"as":"skip-fraction","function":"quotient","args":[{"parameter":"skip-rate"},{"value":100}]},{"as":"active-fraction","function":"difference","args":[{"value":1},{"field":"skip-fraction"}]},{"as":"summary-runs","function":"product","args":[{"field":"day"},{"field":"runs-daily"}]},{"as":"past-ttl","function":"greater-than","args":[{"field":"day"},{"value":30}]},{"as":"detail-days","function":"if","args":[{"field":"past-ttl"},{"value":30},{"field":"day"}]},{"as":"detail-runs","function":"product","args":[{"field":"detail-days"},{"field":"runs-daily"},{"field":"active-fraction"}]},{"as":"tools-per-run","function":"literal","args":[{"parameter":"tools-per-run"}]},{"as":"issues-per-run","function":"literal","args":[{"parameter":"issues-per-run"}]}]},{"name":"simulator-run-size","subject":"Estimate retained run-summary table size at 512 bytes per run.","objective":"Show modeled accumulation of run summaries.","acceptance":"Summary size includes every simulated run at 512 bytes and is not presented as measured storage.","from":"simulator-database-inputs","compute":[{"as":"table","function":"literal","args":[{"value":"Run summaries"}]},{"as":"bytes","function":"product","args":[{"field":"summary-runs"},{"value":512}]}],"select":[{"field":"day"},{"field":"table"},{"field":"bytes"}]},{"name":"simulator-tool-size","subject":"Estimate retained tool table size at 256 bytes per tool on non-skipped runs.","objective":"Show modeled tool-record growth under the selected workload.","acceptance":"Tool size uses only non-skipped simulated runs and 256 bytes per tool over the retained period.","from":"simulator-database-inputs","compute":[{"as":"table","function":"literal","args":[{"value":"Tools (30-day TTL)"}]},{"as":"bytes","function":"product","args":[{"field":"detail-runs"},{"field":"tools-per-run"},{"value":256}]}],"select":[{"field":"day"},{"field":"table"},{"field":"bytes"}]},{"name":"simulator-issue-size","subject":"Estimate retained issue table size at 512 bytes per issue on non-skipped runs.","objective":"Show modeled issue-record growth under the selected workload.","acceptance":"Issue size uses only non-skipped simulated runs and 512 bytes per issue over the retained period.","from":"simulator-database-inputs","compute":[{"as":"table","function":"literal","args":[{"value":"Issues (30-day TTL)"}]},{"as":"bytes","function":"product","args":[{"field":"detail-runs"},{"field":"issues-per-run"},{"value":512}]}],"select":[{"field":"day"},{"field":"table"},{"field":"bytes"}]},{"name":"simulator-database-size","subject":"Show modeled run-summary, tool, and issue table bytes after 30 days.","objective":"Compare hypothetical database table sizes at the end of the retention horizon.","acceptance":"The model presents separate summary, tool, and issue estimates after 30 simulated days, never observed storage.","description":"Run summaries accumulate; detailed records have a 30-day TTL.","from":"simulator-run-size","union":["simulator-tool-size","simulator-issue-size"],"filter":{"predicates":[{"field":"day","equals":30}]},"select":[{"field":"table"},{"field":"bytes"}]},{"name":"simulator-database-total","subject":"Sum the modeled table sizes after 30 days.","objective":"Show the final estimated size of the modeled database tables.","acceptance":"The final value is the sum of the three modeled table sizes after 30 days.","from":"simulator-database-size","compute":[{"as":"total-label","function":"literal","args":[{"value":"Total"}]}],"aggregate":{"by":["total-label"],"values":[{"field":"bytes","as":"bytes","reducer":"sum"}]},"select":[{"field":"total-label","as":"table"},{"field":"bytes"}]},{"name":"simulator-database-summary","subject":"List modeled table sizes and their final total after 30 days.","objective":"Present the 30-day estimate in a compact table.","acceptance":"Three modeled table sizes and their summed final value are shown without a growth chart.","from":"simulator-database-size","union":["simulator-database-total"]},{"name":"overview-run-summary","subject":"Summarize successful, failed, and active runs with rollout-mode counts.","objective":"Expose observed success, failure, and active run counts, including active live and review modes, for the selected horizon.","acceptance":"Each count follows its declared conclusion, status, and rollout-mode filters; run success is not treated as a verified outcome, and incomplete or stale evidence is identified.","from":"overview-runs","aggregate":{"values":[{"field":"run-conclusion","as":"successful-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","equals":"success"}]}},{"field":"run-conclusion","as":"failed-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","stale","timed-out"]}]}},{"field":"run-status","as":"active-runs","reducer":"count","filter":{"predicates":[{"field":"run-status","in":["queued","in-progress","in_progress"]}]}},{"field":"run-status","as":"active-live","reducer":"count","filter":{"predicates":[{"field":"run-status","in":["queued","in-progress","in_progress"]},{"field":"rollout-mode","equals":"live"}]}},{"field":"run-status","as":"active-review","reducer":"count","filter":{"predicates":[{"field":"run-status","in":["queued","in-progress","in_progress"]},{"field":"rollout-mode","equals":"review"}]}}]}},{"name":"overview-delivery-summary","subject":"Count distinct target repositories with successful worker dispatch runs in the selected horizon.","objective":"Measure observed reach among registered repositories with successful dispatched worker runs.","acceptance":"Distinct delivered-repositories is limited to registered targets and successful workflow_dispatch worker runs in the selected horizon; it does not establish accepted delivery or authorized coverage.","from":"overview-runs","joins":[{"source":"repositories","type":"inner","on":[{"left":"target-repository","right":"repository-coordinate"}],"fields":[{"field":"repository-coordinate","as":"registered-target-repository"}]}],"filter":{"predicates":[{"field":"event","equals":"workflow_dispatch"},{"field":"run-conclusion","equals":"success"},{"field":"workflow-role","equals":"worker"}]},"aggregate":{"values":[{"field":"target-repository","as":"delivered-repositories","reducer":"distinct-count"}]}},{"name":"overview-value-summary","subject":"Count all observed grader results.","objective":"Identify whether any grader observations are available to the Overview status presentation.","acceptance":"The value-gains field counts observed grader records only; inspect each result's native measure, unit, direction, maturity, and uncertainty before claiming an outcome or improvement.","from":"grader-observations","aggregate":{"values":[{"field":"grader","as":"value-gains","reducer":"count"}]}},{"name":"overview-issue-summary","subject":"Count retained issue and pull request safe-output records for Overview.","objective":"Restore the issue and pull request counter with a link to its evidence inventory.","acceptance":"The count includes retained canonical issue and pull request records, not inferred outcomes; unavailable evidence remains unavailable.","from":"issues","aggregate":{"values":[{"field":"id","as":"value","reducer":"count"}]},"limit":1},{"name":"overview-issue-station","subject":"Present the retained issue and pull request count for Overview.","objective":"Provide a presentation-ready count and accessible evidence description.","acceptance":"The value matches overview-issue-summary and describes retained safe outputs, not accepted outcomes.","from":"overview-issue-summary","compute":[{"as":"detail","function":"concat","args":[{"value":"Retained safe"},{"value":" outputs"}]},{"as":"description","function":"concat","args":[{"field":"value"},{"value":" retained issues and pull requests"}]}],"limit":1},{"name":"overview-value-station","subject":"Present the observed grader-result count as the legacy Value gains counter.","objective":"Restore the Value gains counter while making its observation-count semantics explicit.","acceptance":"The count matches overview-value-summary, including zero; grader presence is not proof of improvement and unavailable evidence is not zero.","from":"overview-value-summary","compute":[{"as":"detail","function":"concat","args":[{"value":"Observed grader"},{"value":" results"}]},{"as":"description","function":"concat","args":[{"field":"value-gains"},{"value":" observed grader results, not verified improvements"}]}],"select":[{"field":"value-gains","as":"value"},{"field":"detail"},{"field":"description"}],"limit":1},{"name":"overview-run-status-input","subject":"Prepare the compact run summary for declarative factory status classification.","objective":"Carry successful-runs, failed-runs, and active-runs into the status join without changing their meaning.","acceptance":"The projected counts retain the selected horizon and match overview-run-summary; the join key is only a presentation key, not additional evidence.","from":"overview-run-summary","compute":[{"as":"status-join-key","function":"concat","args":[{"value":"factory"},{"value":"-status"}]}],"select":[{"field":"status-join-key"},{"field":"successful-runs"},{"field":"failed-runs"},{"field":"active-runs"}]},{"name":"overview-value-status-input","subject":"Prepare the compact value summary for declarative factory status classification.","objective":"Carry the grader-observation count into the optional status join.","acceptance":"The projected value-gains count matches overview-value-summary; a zero count does not establish complete grader coverage, and a nonzero count is not proof of gain.","from":"overview-value-summary","compute":[{"as":"status-join-key","function":"concat","args":[{"value":"factory"},{"value":"-status"}]}],"select":[{"field":"status-join-key"},{"field":"value-gains"}]},{"name":"overview-factory-status","subject":"Classify the factory heading from compact run and optional value evidence.","objective":"Provide a bounded Overview heading based on observed run counts and optional grader-record presence.","acceptance":"The heading matches the declared run-count and optional grader-presence branches; grader presence is not verified value, and the heading does not authorize any policy change.","from":"overview-run-status-input","joins":[{"source":"overview-value-status-input","type":"left","on":[{"left":"status-join-key","right":"status-join-key"}],"fields":[{"field":"value-gains","as":"value-gains"}]}],"compute":[{"as":"has-successful-runs","function":"greater-than","args":[{"field":"successful-runs"},{"value":0}]},{"as":"has-failed-runs","function":"greater-than","args":[{"field":"failed-runs"},{"value":0}]},{"as":"failures-exceed-successes","function":"greater-than","args":[{"field":"failed-runs"},{"field":"successful-runs"}]},{"as":"has-active-runs","function":"greater-than","args":[{"field":"active-runs"},{"value":0}]},{"as":"has-value-gains","function":"greater-than","args":[{"field":"value-gains"},{"value":0}]},{"as":"successful-heading","function":"if","args":[{"field":"has-successful-runs"},{"value":"Your factory is humming."},{"value":"Your factory is idle."}]},{"as":"attention-heading","function":"if","args":[{"field":"has-failed-runs"},{"value":"Your factory needs attention."},{"field":"successful-heading"}]},{"as":"strain-heading","function":"if","args":[{"field":"failures-exceed-successes"},{"value":"Your factory is under strain."},{"field":"attention-heading"}]},{"as":"active-heading","function":"if","args":[{"field":"has-active-runs"},{"value":"Your factory is humming."},{"field":"strain-heading"}]},{"as":"factory-heading","function":"if","args":[{"field":"has-value-gains"},{"value":"Your factory is delivering value."},{"field":"active-heading"}]}],"select":[{"field":"factory-heading"}]},{"name":"overview-registered-repository-summary","subject":"Count canonical repository identities registered in the resolved control-plane scope.","objective":"Provide the registered-repository denominator for observed worker reach.","acceptance":"The count reflects canonical repository records in the resolved scope; it is not evidence of live enrollment, successful execution, or full inventory completeness.","from":"repositories","aggregate":{"values":[{"field":"repository","as":"registered-repositories","reducer":"count"}]}},{"name":"overview-delivery-coverage-input","subject":"Prepare successful delivery totals for the repository coverage summary.","objective":"Carry the distinct delivered-repositories count into the coverage join.","acceptance":"The projected count equals overview-delivery-summary for the selected horizon; the join key adds no repository observations.","from":"overview-delivery-summary","compute":[{"as":"coverage-key","function":"concat","args":[{"value":"repository-coverage"},{"value":""}]}],"select":[{"field":"delivered-repositories"},{"field":"coverage-key"}]},{"name":"overview-registered-repository-coverage-input","subject":"Prepare registered repository totals for the repository coverage summary.","objective":"Carry the registered-repositories count into the coverage denominator join.","acceptance":"The projected count equals overview-registered-repository-summary for the resolved scope; missing inventory is not treated as zero eligible targets.","from":"overview-registered-repository-summary","compute":[{"as":"coverage-key","function":"concat","args":[{"value":"repository-coverage"},{"value":""}]}],"select":[{"field":"registered-repositories"},{"field":"coverage-key"}]},{"name":"overview-rhythm","subject":"Compare all workflow runs by weekday, layering this week over last week.","objective":"Show the observed weekday pattern across both calendar weeks, regardless of status or conclusion.","acceptance":"Verify weekday order, counts including unsuccessful and in-flight runs, and reached-day flags. Missing rhythm is unavailable, not zero activity; do not attribute changes to workflow improvements.","from":"overview-runs","time":{"range":"15d"},"compute":[{"as":"rhythm-point","function":"calendar-week-point","args":[{"field":"started-at"},{"context":"time-end"},{"value":true}]}],"aggregate":{"values":[{"field":"rhythm-point","as":"rhythm","reducer":"calendar-week-rhythm"}]}},{"name":"overview-repository-coverage-summary","subject":"Aggregate reached and total repositories across the resolved organization scope.","objective":"Pair observed reached-repositories and registered-repositories-total for a comparable coverage denominator.","acceptance":"Both totals come from their named input queries and share the resolved scope; verify the left-joined inventory source independently before interpreting a zero total, since a missing join can aggregate to zero.","from":"overview-delivery-coverage-input","joins":[{"source":"overview-registered-repository-coverage-input","type":"left","on":[{"left":"coverage-key","right":"coverage-key"}],"fields":[{"field":"registered-repositories","as":"registered-repositories-total"}]}],"aggregate":{"values":[{"field":"delivered-repositories","as":"reached-repositories","reducer":"sum"},{"field":"registered-repositories-total","as":"registered-repositories-total","reducer":"sum"}]}},{"name":"overview-repository-coverage","subject":"Measure registered repository reach from successful worker execution.","objective":"Present observed successful-worker repository reach as a ratio alongside numerator and denominator.","acceptance":"repository-coverage is reached-repositories divided by registered-repositories-total when available; preserve the counts and undefined denominator, and do not call reach successful outcomes.","from":"overview-repository-coverage-summary","compute":[{"as":"repository-coverage","function":"quotient","args":[{"field":"reached-repositories"},{"field":"registered-repositories-total"}]}],"select":[{"field":"repository-coverage"},{"field":"reached-repositories"},{"field":"registered-repositories-total"}]},{"name":"overview-workflow-health-groups","subject":"Assess current runtime failures for every workflow across CAO and targeted repositories.","objective":"Compute the latest consecutive completed-run failure streak for each repository-scoped workflow without requiring campaign membership.","acceptance":"Group by organization, repository, and workflow; in-flight retries do not clear failures, and later non-failing completed runs reset the streak within the selected horizon.","from":"overview-runs","filter":{"predicates":[{"field":"run-status","equals":"completed"}]},"compute":[{"as":"is-runtime-failure","function":"equals-any","args":[{"field":"run-conclusion"},{"value":"failure"},{"value":"startup-failure"},{"value":"stale"},{"value":"timed-out"}]},{"as":"runtime-failure-streak-point","function":"failure-streak-point","args":[{"field":"started-at"},{"field":"run"},{"field":"is-runtime-failure"}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"runtime-failure-streak-point","as":"failure-count","reducer":"latest-failure-streak"}]}},{"name":"overview-workflow-health-summary","subject":"Count all registered workflows and those without current observed runtime failures.","objective":"Provide Factory health numerator and denominator across CAO and targeted repositories, including standalone and campaign workflows.","acceptance":"Each repository-scoped workflow counts once regardless of campaign or role; no retained failure is not proof of successful execution, missing inventory remains unavailable, and missing run evidence marks the result incomplete.","from":"workflows","joins":[{"source":"overview-workflow-health-groups","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"failure-count","as":"observed-failures"}]}],"compute":[{"as":"normalized-failures","function":"coalesce","args":[{"field":"observed-failures"},{"value":0}]},{"as":"problem-present","function":"greater-than","args":[{"field":"normalized-failures"},{"value":0}]}],"aggregate":{"values":[{"field":"workflow","as":"workflows","reducer":"count"},{"field":"workflow","as":"healthy-workflows","reducer":"count","filter":{"predicates":[{"field":"problem-present","equals":false}]}}]}},{"name":"overview-workflow-health-presentation-input","subject":"Prepare all-workflow health counts for Overview presentation.","objective":"Carry Factory health counts into the header and station presentation.","acceptance":"Both counts match overview-workflow-health-summary and preserve missing evidence metadata.","from":"overview-workflow-health-summary","compute":[{"as":"overview-presentation-key","function":"concat","args":[{"value":"overview"},{"value":"-presentation"}]}],"select":[{"field":"overview-presentation-key"},{"field":"workflows"},{"field":"healthy-workflows"}]},{"name":"overview-factory-health-presentation","subject":"Produce presentation-ready Factory health values for the Overview header and floor.","objective":"Display the ratio of workflows without current observed runtime failures to all registered workflows with both underlying counts.","acceptance":"The percentage and detail agree with healthy-workflows and workflows; a missing or zero denominator remains unavailable, and the ratio is not proof of impact.","from":"overview-workflow-health-presentation-input","compute":[{"as":"factory-health","function":"quotient","args":[{"field":"healthy-workflows"},{"field":"workflows"}]},{"as":"factory-health-display","function":"format-percent","args":[{"field":"factory-health"}]},{"as":"healthy-workflows-display","function":"format-count","args":[{"field":"healthy-workflows"}]},{"as":"workflows-display","function":"format-count","args":[{"field":"workflows"}]},{"as":"factory-health-detail","function":"concat","args":[{"field":"healthy-workflows-display"},{"value":"/"},{"field":"workflows-display"},{"value":" healthy workflows"}]},{"as":"factory-health-description","function":"concat","args":[{"field":"factory-health-display"},{"value":" factory health"}]}],"select":[{"field":"overview-presentation-key"},{"field":"factory-health"},{"field":"factory-health-display"},{"field":"factory-health-detail"},{"field":"factory-health-description"}]},{"name":"overview-header-status-presentation-input","subject":"Prepare the factory status heading for the declarative Overview header.","objective":"Carry the factory heading into the Overview header join unchanged.","acceptance":"The heading matches overview-factory-status; the presentation key does not imply additional evidence or a policy recommendation.","from":"overview-factory-status","compute":[{"as":"overview-presentation-key","function":"concat","args":[{"value":"overview"},{"value":"-presentation"}]}],"select":[{"field":"overview-presentation-key"},{"field":"factory-heading"}]},{"name":"overview-header-presentation","subject":"Resolve the Overview heading from declarative status and factory-health evidence.","objective":"Display the configured heading corresponding to observed run status and factory health.","acceptance":"The selected heading follows the declared presentation branches; numeric branch boundaries are UI classification only, not operational targets or rollout thresholds.","from":"overview-header-status-presentation-input","joins":[{"source":"overview-factory-health-presentation","type":"left","on":[{"left":"overview-presentation-key","right":"overview-presentation-key"}],"fields":[{"field":"factory-health","as":"factory-health"}]}],"compute":[{"as":"factory-health-positive","function":"greater-than","args":[{"field":"factory-health"},{"value":0}]},{"as":"factory-health-below-threshold","function":"greater-than","args":[{"value":0.66},{"field":"factory-health"}]},{"as":"positive-factory-health-heading","function":"if","args":[{"field":"factory-health-below-threshold"},{"value":"Your factory needs attention."},{"field":"factory-heading"}]},{"as":"heading","function":"if","args":[{"field":"factory-health-positive"},{"field":"positive-factory-health-heading"},{"field":"factory-heading"}]}],"select":[{"field":"heading"}]},{"name":"overview-run-motion-presentation-input","subject":"Prepare active run state for Overview station presentation.","objective":"Expose whether at least one queued or in-progress run was observed for station display.","acceptance":"active reflects overview-run-summary's active-runs count; no observed active run does not prove the fleet is idle when the snapshot is incomplete.","from":"overview-run-summary","compute":[{"as":"overview-presentation-key","function":"concat","args":[{"value":"overview"},{"value":"-presentation"}]},{"as":"active","function":"greater-than","args":[{"field":"active-runs"},{"value":0}]}],"select":[{"field":"overview-presentation-key"},{"field":"active"}]},{"name":"overview-factory-station","subject":"Provide the presentation-ready Factory health station for Overview.","objective":"Show the all-workflow runtime health ratio, supporting counts, and observed run motion together.","acceptance":"Station value, display, detail, description, and active flag match their input queries; neither absence of failures nor run motion is verified workflow effectiveness.","from":"overview-factory-health-presentation","joins":[{"source":"overview-run-motion-presentation-input","type":"left","on":[{"left":"overview-presentation-key","right":"overview-presentation-key"}],"fields":[{"field":"active","as":"active"}]}],"select":[{"field":"factory-health","as":"value"},{"field":"factory-health-display","as":"display-value"},{"field":"factory-health-detail","as":"detail"},{"field":"factory-health-description","as":"description"},{"field":"active"}]},{"name":"overview-repository-station-presentation-input","subject":"Prepare repository coverage for the presentation-ready Overview station.","objective":"Format repository reach with its reached and registered counts for the station.","acceptance":"The percentage and detail preserve overview-repository-coverage's numerator and denominator; unavailable coverage remains unavailable, not zero or complete reach.","from":"overview-repository-coverage","compute":[{"as":"overview-presentation-key","function":"concat","args":[{"value":"overview"},{"value":"-presentation"}]},{"as":"display-value","function":"format-percent","args":[{"field":"repository-coverage"}]},{"as":"reached-repositories-display","function":"format-count","args":[{"field":"reached-repositories"}]},{"as":"registered-repositories-display","function":"format-count","args":[{"field":"registered-repositories-total"}]},{"as":"detail","function":"concat","args":[{"field":"reached-repositories-display"},{"value":"/"},{"field":"registered-repositories-display"},{"value":" repositories reached"}]},{"as":"description","function":"concat","args":[{"field":"display-value"},{"value":" average repository coverage"}]}],"select":[{"field":"overview-presentation-key"},{"field":"repository-coverage","as":"value"},{"field":"display-value"},{"field":"detail"},{"field":"description"}]},{"name":"overview-repository-station","subject":"Provide the presentation-ready repository coverage station for Overview.","objective":"Show observed registered-repository worker reach and run motion in one station.","acceptance":"Value and formatted evidence match the coverage presentation input, and active matches run motion; neither changes policy or establishes accepted outcomes.","from":"overview-repository-station-presentation-input","joins":[{"source":"overview-run-motion-presentation-input","type":"left","on":[{"left":"overview-presentation-key","right":"overview-presentation-key"}],"fields":[{"field":"active","as":"active"}]}],"select":[{"field":"value"},{"field":"display-value"},{"field":"detail"},{"field":"description"},{"field":"active"}]},{"name":"cost-by-repository","subject":"Present observed AI Credit cost grouped by repository.","objective":"Locate repositories with higher observed AI Credit totals for evidence-led investigation.","acceptance":"Each repository coordinate and native aic total agrees with repository-aic-totals; confirm the selected horizon and underlying runs before attributing cost or proposing a change.","from":"repository-aic-totals","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-coordinate"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-coordinate"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-coordinate"}]}],"select":[{"field":"repository-coordinate"},{"field":"repository-dashboard-link"},{"field":"aic"}],"order-by":[{"field":"aic","direction":"desc"}]},{"name":"cost-by-workflow","subject":"Present observed AI Credit cost grouped by repository-owned workflow.","objective":"Locate repository workflows with higher observed AI Credit totals and open their workflow evidence.","acceptance":"Workflow identity, link, and native aic total match workflow-aic-totals in descending order; cost alone does not establish waste, quality, or value.","from":"workflow-aic-totals","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-coordinate"}]}],"select":[{"field":"repository-coordinate"},{"field":"workflow"},{"field":"workflow-coordinate"},{"field":"workflow-dashboard-link"},{"field":"aic"}],"order-by":[{"field":"aic","direction":"desc"}]},{"name":"cost-per-workflow-run","subject":"Present the average observed AI Credit cost of a single run for each repository-owned workflow.","objective":"Compare observed AI Credit per run across repository workflows with each observed-runs denominator.","acceptance":"Include only workflows with positive-AIC run attempts, and use only those attempts in cost averages; observed-runs still counts all retained attempts.","description":"Observed AI Credit totals divided by positive-AIC run attempts for each declared workflow.","from":"workflow-aic-run-totals","filter":{"predicates":[{"field":"aic-runs","gte":1}]},"compute":[{"as":"aic-per-run","function":"quotient","args":[{"field":"aic"},{"field":"aic-runs"}]},{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-coordinate"}]}],"select":[{"field":"repository-coordinate"},{"field":"workflow"},{"field":"workflow-coordinate"},{"field":"workflow-dashboard-link"},{"field":"runs","as":"observed-runs"},{"field":"aic-per-run"}],"order-by":[{"field":"aic-per-run","direction":"desc"}]},{"name":"failure-run-base","subject":"Select retained runs with failure, startup-failure, stale, or timed-out conclusions for the failed-run ledger and streak inputs.","objective":"Provide one consistent failure-conclusion evidence set to downstream Overview queries.","acceptance":"Each selected run has one of the four declared conclusions within the selected horizon; other conclusions remain outside this set, and missing run coverage is not interpreted as no failures.","from":"runs","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","stale","timed-out"]}]}},{"name":"failed-runs","subject":"List failed workflow runs that need operator attention.","objective":"Give operators the most recent observed failed runs to inspect in GitHub.","acceptance":"Unprojected run rows retain available conclusion, started-at, and run evidence fields in descending started-at order; inspect source logs and missing links before attributing a cause or declaring resolution.","from":"failure-run-base","order-by":[{"field":"started-at","direction":"desc"}]},{"name":"overview-failing-runs","subject":"Identify failed runs in the selected snapshot horizon so subsequent streak logic can use the same declarative failure definition.","objective":"Project distinct failure-run counts by organization, repository, workflow, and run for streak joins.","acceptance":"Each grouped run identity has a failing-runs count derived from failure-run-base in the selected horizon; this stage does not assert a consecutive streak or require action.","from":"failure-run-base","aggregate":{"by":["organization","repository","workflow","run"],"values":[{"field":"run","as":"failing-runs","reducer":"distinct-count"}]}},{"name":"overview-failing-workflows","subject":"Identify only workflows that have at least one failed run in the selected snapshot horizon before computing streaks.","objective":"Provide workflow identities with observed failed runs for the streak computation.","acceptance":"Each organization/repository/workflow group has a distinct failing-runs count from overview-failing-runs; the count covers observed failures, not the latest consecutive streak.","from":"overview-failing-runs","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run","as":"failing-runs","reducer":"distinct-count"}]}},{"name":"overview-repeated-failure-groups","subject":"Group each workflow's latest consecutive failing run sequence in the selected snapshot horizon, resetting the group after any successful run.","objective":"Project the latest observed consecutive failure-count per workflow for downstream blocked-work matching.","acceptance":"failure-count follows run ordering and the declared latest-failure-streak reducer, with non-failing runs breaking the streak; missing earlier runs or incomplete snapshots limit the observed sequence.","from":"runs","joins":[{"source":"overview-failing-workflows","type":"inner","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"failing-runs","as":"failing-runs"}]},{"source":"overview-failing-runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"}],"fields":[{"field":"failing-runs","as":"run-failing-count"}]}],"compute":[{"as":"failure-streak-point","function":"failure-streak-point","args":[{"field":"started-at"},{"field":"run"},{"field":"run-failing-count"}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"failure-streak-point","as":"failure-count","reducer":"latest-failure-streak"}]}},{"name":"overview-repeated-failure-candidates","subject":"Attach selected-horizon failure counts to each workflow's latest canonical work item.","objective":"Pair blocked work items with observed workflow failure streaks and retained run evidence before attention filtering.","acceptance":"Candidates are filtered to blocked items with a matching organization/repository/workflow streak; is-repeated reflects failure-count greater than one, while selected evidence-link and run-link can be absent or refer to the work item rather than the latest failed run.","from":"work-items","joins":[{"source":"overview-repeated-failure-groups","type":"inner","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"failure-count","as":"failure-count"}]}],"filter":{"predicates":[{"field":"lifecycle-state","equals":"blocked"}]},"compute":[{"as":"is-repeated","function":"greater-than","args":[{"field":"failure-count"},{"value":1}]},{"as":"attention-signal-id","function":"concat","args":[{"value":"repeated-failure:"},{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"kind","function":"coalesce","args":[{"value":"Repeated workflow failures"},{"value":"Repeated workflow failures"}]},{"as":"title","function":"coalesce","args":[{"field":"workflow"},{"value":"Workflow"}]},{"as":"attention-reason","function":"concat","args":[{"field":"failure-count"},{"value":" failed runs in the selected horizon"}]},{"as":"action","function":"coalesce","args":[{"value":"Open latest failed run on GitHub"},{"value":"Open latest failed run on GitHub"}]},{"as":"icon","function":"coalesce","args":[{"value":"x-circle"},{"value":"x-circle"}]},{"as":"tone","function":"coalesce","args":[{"value":"critical"},{"value":"critical"}]},{"as":"priority","function":"number","args":[{"value":0}]}],"select":[{"field":"is-repeated"},{"field":"attention-signal-id"},{"field":"kind"},{"field":"title"},{"field":"scope"},{"field":"attention-reason","as":"reason"},{"field":"observed-at"},{"field":"action"},{"field":"evidence-link"},{"field":"run-link"},{"field":"icon"},{"field":"tone"},{"field":"priority"},{"field":"failure-count"}]},{"name":"overview-repeated-failure-attention","subject":"Keep only unresolved workflows with two or more failures in the selected horizon.","objective":"Surface blocked workflow items with observed repeated failures for bounded run investigation.","acceptance":"Every row inherits a blocked item with is-repeated true and projects evidence-link and run-link when available; verify run order, links, and current state before treating the failure as still unresolved.","from":"overview-repeated-failure-candidates","filter":{"predicates":[{"field":"is-repeated","equals":true}]},"select":[{"field":"attention-signal-id"},{"field":"kind"},{"field":"title"},{"field":"scope"},{"field":"reason"},{"field":"observed-at"},{"field":"action"},{"field":"evidence-link"},{"field":"run-link"},{"field":"icon"},{"field":"tone"},{"field":"priority"},{"field":"failure-count"}]},{"name":"overview-review-attention","subject":"Select only unresolved outputs explicitly awaiting human review with their retained GitHub evidence destination.","objective":"Present review-state work items and their retained GitHub destination to a human reviewer.","acceptance":"Rows are filtered to lifecycle-state review and project the work-item ID as attention-signal-id, plus reason, evidence-link, and run-link where present; reviewer disposition must be checked at source.","from":"work-items","filter":{"predicates":[{"field":"lifecycle-state","equals":"review"}]},"compute":[{"as":"kind","function":"coalesce","args":[{"value":"Human review required"},{"value":"Human review required"}]},{"as":"title","function":"coalesce","args":[{"field":"objective"},{"value":"Produced output"}]},{"as":"action","function":"coalesce","args":[{"value":"Open review item on GitHub"},{"value":"Open review item on GitHub"}]},{"as":"icon","function":"coalesce","args":[{"value":"eye"},{"value":"eye"}]},{"as":"tone","function":"coalesce","args":[{"value":"action"},{"value":"action"}]},{"as":"priority","function":"number","args":[{"value":1}]}],"select":[{"field":"work-item-id","as":"attention-signal-id"},{"field":"kind"},{"field":"title"},{"field":"scope"},{"field":"reason"},{"field":"observed-at"},{"field":"action"},{"field":"evidence-link"},{"field":"run-link"},{"field":"icon"},{"field":"tone"},{"field":"priority"}]},{"name":"overview-needs-attention","subject":"Combine grouped repeated failures and unresolved review outputs without introducing ordinary activity or duplicate work items.","objective":"Prioritize observed blocked repeated-failure work and review-state outputs for investigation.","acceptance":"Rows come only from the repeated-failure or review inputs and retain their source reasons, links, and ordering; confirm fresh source status before acting, and do not equate a missing row with resolved work.","from":"overview-repeated-failure-attention","union":["overview-review-attention"],"order-by":[{"field":"priority","direction":"asc"},{"field":"observed-at","direction":"desc"},{"field":"attention-signal-id","direction":"asc"}]},{"name":"domain-route-record","subject":"Project the selected domain header and one retained run link.","objective":"Identify the selected domain and open a retained run before investigating its traffic evidence.","acceptance":"The route header preserves the selected domain and a run link from its retained observations; missing observations or links remain unavailable, and a header does not establish access policy or traffic completeness.","from":"domains","select":[{"field":"domain"},{"field":"run-link"}]},{"name":"domain-run-records","subject":"Retained run-linked observations for the selected domain.","objective":"Find related runs without returning the unscoped domain collection alongside the paginated view.","acceptance":"Preserve every domain observation field, exact route scope, filtering, ordering, total count, provenance and related-run links; only the bounded view payload crosses the worker boundary.","from":"domains"},{"name":"tool-route-record","subject":"Project the selected MCP tool header and one retained run link.","objective":"Identify the selected MCP tool and open a retained run before investigating its call evidence.","acceptance":"The route header preserves the selected MCP tool label and a run link from its retained calls; absent calls or links remain unavailable and do not imply zero usage or tool effectiveness.","from":"mcp-tool-calls","select":[{"field":"mcp-tool-label"},{"field":"run-link"}]},{"name":"audit-route-record","subject":"Project the selected audit summary header and one retained run link.","objective":"Identify the selected audit summary and open a retained run before investigating its observations.","acceptance":"The route header preserves the selected event summary and a run link from its retained audit observations; absent evidence remains unavailable and neither the header nor its absence establishes incident severity or a clean audit.","from":"audits","select":[{"field":"event-summary"},{"field":"run-link"}]},{"name":"domain-entity-insights","subject":"Summarize one domain entity for its dedicated Insights view.","objective":"Identify domain decisions with request volume worth investigating before considering any egress change.","acceptance":"For the selected domain, request totals match the retained domain observations grouped by decision; missing data or blocked traffic does not establish a need for access, which requires underlying request and policy review.","from":"domains","aggregate":{"by":["domain","decision"],"values":[{"field":"request-count","as":"requests","reducer":"sum"}]},"order-by":[{"field":"requests","direction":"desc"},{"field":"decision","direction":"asc"}]},{"name":"tool-entity-insights","subject":"Summarize one tool entity for its dedicated Insights view.","objective":"Select a tool and status combination whose recorded call volume merits investigation.","acceptance":"For the selected tool, observation counts match retained MCP call observations grouped by server, tool, and status; missing calls are not zero usage and status counts do not establish effectiveness or cause.","from":"mcp-tool-calls","aggregate":{"by":["mcp-tool-label","mcp-server","mcp-tool","mcp-status"],"values":[{"field":"mcp-observation","as":"observations","reducer":"count"}]},"order-by":[{"field":"observations","direction":"desc"},{"field":"mcp-status","direction":"asc"}]},{"name":"audit-entity-insights","subject":"Summarize one audit event entity for its dedicated Insights view.","objective":"Select an audit summary and status requiring closer review of underlying observations.","acceptance":"For the selected summary, counts agree with retained audit observation IDs grouped by event status; repeated observations are not silently treated as distinct incidents, and absence does not prove no findings.","from":"audits","aggregate":{"by":["event-summary","event-status"],"values":[{"field":"id","as":"observations","reducer":"count"}]},"order-by":[{"field":"observations","direction":"desc"},{"field":"event-status","direction":"asc"}]}] +[{"name":"command-queue","subject":"Show the durable local CLI command queue.","objective":"Inspect command lifecycle and reconnect to output without rerunning work.","acceptance":"Preserve persistent command IDs and all six server states; closing output never cancels execution. Unavailable local authority is not an empty queue.","from":"cli-commands","compute":[{"as":"command-action","function":"coalesce","args":[{"field":"actionId"},{"value":""}]},{"as":"command-title","function":"coalesce","args":[{"field":"command"},{"field":"actionId"}]},{"as":"command-target","function":"coalesce","args":[{"field":"repository"},{"field":"campaign"},{"field":"package-source"},{"value":"Local control repository"}]},{"as":"command-created-at","function":"coalesce","args":[{"field":"createdAt"},{"value":null}]},{"as":"command-href","function":"concat","args":[{"value":"#page-command?command="},{"field":"id"}]},{"as":"command-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"command-href"},{"field":"command-title"},{"field":"id"}]}]},{"name":"event-base","subject":"Project shared event fields before combining run-owned records.","objective":"Provide the narrow retained event evidence needed for inspection and run import-coverage analysis.","acceptance":"The result unions retained audit, domain, tool, and issue records with their available run identity; an empty or unavailable preview cannot establish zero source activity or complete import coverage.","from":"audits","union":["domains","tools","issues"],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"event"},{"field":"event-source"},{"field":"event-type"},{"field":"event-summary"},{"field":"event-status"},{"field":"github-entity-type"},{"field":"safe-output-type"},{"field":"safe-output-url"},{"field":"correlation-id"},{"field":"implementation-pull-request-url"},{"field":"event-timestamp"},{"field":"run-link"}]},{"name":"audit-event-runs","subject":"Count imported audit records per run before combining event sources.","objective":"Bound audit evidence for run import-coverage analysis.","acceptance":"Count only retained audit records with event identity by run attempt; missing evidence does not establish zero activity.","from":"audits","aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"event","as":"events","reducer":"count"}]}},{"name":"domain-event-runs","subject":"Count imported domain records per run before combining event sources.","objective":"Bound domain evidence for run import-coverage analysis.","acceptance":"Count only retained domain records with event identity by run attempt; missing evidence does not establish zero activity.","from":"domains","aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"event","as":"events","reducer":"count"}]}},{"name":"tool-event-runs","subject":"Count imported tool records per run before combining event sources.","objective":"Bound tool evidence for run import-coverage analysis.","acceptance":"Count only retained tool records with event identity by run attempt; missing evidence does not establish zero activity.","from":"tools","aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"event","as":"events","reducer":"count"}]}},{"name":"issue-event-runs","subject":"Count imported issue records per run before combining event sources.","objective":"Bound issue evidence for run import-coverage analysis.","acceptance":"Count only retained issue records with event identity by run attempt; missing evidence does not establish zero activity.","from":"issues","aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"event","as":"events","reducer":"count"}]}},{"name":"event-runs","subject":"Identify each workflow run that has one or more imported run-owned records.","objective":"Identify run attempts with retained imported records so their presence can be compared with observed runs.","acceptance":"One row per organization, repository, workflow, run, and attempt contains events, the count of matching retained records; no row in an available result does not prove that no event was produced.","description":"Distinct workflow runs represented by imported domain, tool, audit, or issue records.","from":"audit-event-runs","union":["domain-event-runs","tool-event-runs","issue-event-runs"],"aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"events","as":"events","reducer":"sum"}]}},{"name":"run-import-status","subject":"Identify observed runs that have one or more imported run-owned records.","objective":"Compare observed run attempts with retained run-owned event evidence to locate import-coverage gaps for investigation.","acceptance":"Keep each observed run and its run-attempt identity; imported-event-count is zero and imported is false without a matching retained event, but missing events alone do not establish an ingestion failure.","description":"Observed runs enriched with imported-record status.","from":"runs","joins":[{"source":"event-runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"events","as":"imported-events"}]}],"compute":[{"as":"imported-event-count","function":"coalesce","args":[{"field":"imported-events"},{"value":0}]},{"as":"imported","function":"greater-than","args":[{"field":"imported-event-count"},{"value":0}]}]},{"name":"workflow-run-totals","subject":"Summarize observed run counts and imported runs by declared workflow.","objective":"Compare observed run attempts, conclusions, and imported-record coverage for each workflow.","acceptance":"Group by organization, repository, and workflow; report distinct run-attempt totals, successful and failed conclusion counts, and imported-run totals only from retained evidence. Missing run records cannot establish zero execution.","description":"Observed run and imported-run totals for each declared workflow.","from":"run-import-status","compute":[{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run-attempt-identity","as":"runs","reducer":"distinct-count"},{"field":"run-conclusion","as":"successful-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","equals":"success"}]}},{"field":"run-conclusion","as":"failed-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","stale","timed-out"]}]}},{"field":"imported","as":"imported-runs","reducer":"sum"}]}},{"name":"workflow-aic-run-totals","subject":"Summarize observed run attempts and AI Credits for workflow cost comparison.","objective":"Count retained run attempts and recorded AI Credits without loading imported-event coverage.","acceptance":"Count all distinct retained run attempts, but include only positive recorded AIC in cost totals and cost denominators; zero and missing telemetry cannot skew cost averages.","from":"runs","compute":[{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run-attempt-identity","as":"runs","reducer":"distinct-count"},{"field":"run-attempt-identity","as":"aic-runs","reducer":"distinct-count","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"aic-total","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}}]}},{"name":"workflow-aic-totals","subject":"Summarize observed AI Credit usage by declared workflow.","objective":"Expose retained AI Credit consumption per workflow for bounded cost review alongside observed execution.","acceptance":"Sum only positive recorded aic-total by organization, repository, and workflow; exclude zero and missing costs rather than treating them as free execution.","description":"Observed AI Credit totals for each declared workflow.","from":"workflow-aic-run-totals","filter":{"predicates":[{"field":"aic-runs","gte":1}]},"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"aic"},{"field":"aic-runs"}]},{"name":"mcp-tool-workflow-totals","subject":"Summarize observed MCP calls by tool and workflow before the tool inventory is materialized.","objective":"Keep MCP inventory intermediates bounded without dropping calls or changing byte totals.","acceptance":"Count retained observation identities and sum request and response bytes per server, tool, and workflow; retain safe-output-server classification for downstream exclusion.","from":"mcp-calls","compute":[{"as":"safe-output-server","function":"equals-any","args":[{"field":"mcp-server"},{"value":"safe_outputs"},{"value":"safeoutputs"}]},{"as":"mcp-tool-label","function":"concat","args":[{"field":"mcp-server"},{"value":"/"},{"field":"mcp-tool"}]},{"as":"workflow-key","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}],"aggregate":{"by":["safe-output-server","mcp-tool-label","mcp-server","mcp-tool","workflow-key"],"values":[{"field":"mcp-observation","as":"calls","reducer":"count"},{"field":"request-bytes","as":"request-bytes","reducer":"sum"},{"field":"response-bytes","as":"response-bytes","reducer":"sum"}]}},{"name":"mcp-tool-calls","subject":"Prepare MCP tool calls for aggregation with safe-output-server calls identified for downstream exclusion.","objective":"Identify retained MCP call labels and safe-output-server classification for downstream tool-use investigation.","acceptance":"Preserve each retained call with its workflow key and tool label and mark safe-output-server calls explicitly; downstream exclusion must not be mistaken for absence of those calls or complete tool telemetry.","description":"Observed MCP tool calls labeled with whether they belong to the internal safe outputs server.","from":"mcp-calls","compute":[{"as":"safe-output-server","function":"equals-any","args":[{"field":"mcp-server"},{"value":"safe_outputs"},{"value":"safeoutputs"}]},{"as":"mcp-tool-label","function":"concat","args":[{"field":"mcp-server"},{"value":"/"},{"field":"mcp-tool"}]},{"as":"workflow-key","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}]},{"name":"issue-safe-outputs","subject":"List retained GitHub issue safe outputs.","objective":"Inspect retained issue safe outputs and their observed closure state before deciding which items need follow-up.","acceptance":"Include only safe_output.result issue records, not pull requests; preserve issue and run links, timestamps, state, and status detail. Unknown or unobserved closure state must not be presented as closed.","description":"Issue-only projection of retained safe-output items.","from":"issues","filter":{"predicates":[{"field":"event-type","equals":"safe_output.result"},{"field":"is-pull-request","equals":false}]},"joins":[{"source":"runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"run-link","as":"linked-run"}]}],"compute":[{"as":"_issue-state-open","function":"equals-any","args":[{"field":"issue-state"},{"value":"OPEN"}]},{"as":"_issue-state-closed","function":"equals-any","args":[{"field":"issue-state"},{"value":"CLOSED"}]},{"as":"_issue-open-status","function":"if","args":[{"field":"_issue-state-open"},{"value":"Open"},{"value":"Unknown"}]},{"as":"issue-status","function":"if","args":[{"field":"_issue-state-closed"},{"value":"Closed"},{"field":"_issue-open-status"}]},{"as":"_issue-closing-reason","function":"coalesce","args":[{"field":"issue-state-reason"},{"value":"unknown"}]},{"as":"_issue-closing-reason-normalized","function":"lower","args":[{"field":"_issue-closing-reason"}]},{"as":"issue-closing-status","function":"title-case","args":[{"field":"_issue-closing-reason-normalized"}]},{"as":"_issue-closed-status-detail","function":"concat","args":[{"value":"Closed: "},{"field":"issue-closing-status"}]},{"as":"issue-status-detail","function":"if","args":[{"field":"_issue-state-closed"},{"field":"_issue-closed-status-detail"},{"field":"issue-status"}]}],"select":[{"field":"event-timestamp","as":"observed-at"},{"field":"github-entity-type"},{"field":"is-pull-request"},{"field":"safe-output-type"},{"field":"issue-state"},{"field":"issue-closed"},{"field":"issue-state-reason"},{"field":"issue-status"},{"field":"issue-closing-status"},{"field":"issue-status-detail"},{"field":"issue-closed-at"},{"field":"issue-status-observed-at"},{"field":"event-summary"},{"field":"correlation-id","as":"entity-url"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"linked-run","as":"run-link"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"entity-url","direction":"asc"}]},{"name":"issue-safe-output-label-options","subject":"List observed safe-output badges for the issue list Labels filter.","objective":"Choose retained safe-output types without scanning or filtering presented cards.","acceptance":"Return distinct observed badge values in ascending order; missing evidence is not an empty label inventory.","from":"issue-safe-outputs","aggregate":{"by":["safe-output-type"],"values":[{"field":"entity-url","as":"items","reducer":"count"}]},"order-by":[{"field":"safe-output-type","direction":"asc"}]},{"name":"issue-status-label-options","subject":"List observed status badges for the issue list Status filter.","objective":"Choose retained issue states and closing reasons without inferring resolution.","acceptance":"Return distinct observed status details in ascending order; Unknown remains distinct from Open and Closed.","from":"issue-safe-outputs","aggregate":{"by":["issue-status-detail"],"values":[{"field":"entity-url","as":"items","reducer":"count"}]},"order-by":[{"field":"issue-status-detail","direction":"asc"}]},{"name":"issue-repository-totals","subject":"Rank the ten repositories with the most retained GitHub issue safe outputs.","objective":"Locate repositories with the largest observed issue-safe-output volume for a bounded review of linked records.","acceptance":"Return at most ten repository coordinates ordered by retained issue-record count; ties or missing issue evidence must not imply a complete fleet ranking or unique issue count.","description":"Top repositories by retained issue safe-output count.","from":"issue-safe-outputs","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]}],"aggregate":{"by":["repository-coordinate"],"values":[{"field":"entity-url","as":"issues","reducer":"count"}]},"order-by":[{"field":"issues","direction":"desc"},{"field":"repository-coordinate","direction":"asc"}],"limit":10},{"name":"campaign-import-audit-count","subject":"Count retained audit identities for campaign inventory source quality.","objective":"Retain audit provenance without reconstructing run coverage.","acceptance":"Count canonical audit IDs; missing evidence stays unavailable and the count is not displayed as import coverage.","from":"audits","aggregate":{"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"campaign-import-domain-count","subject":"Count retained domain identities for campaign inventory source quality.","objective":"Retain domain provenance without reconstructing run coverage.","acceptance":"Count canonical domain IDs; missing evidence stays unavailable and the count is not displayed as import coverage.","from":"domains","aggregate":{"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"campaign-import-tool-count","subject":"Count retained tool identities for campaign inventory source quality.","objective":"Retain tool provenance without reconstructing run coverage.","acceptance":"Count canonical tool IDs; missing evidence stays unavailable and the count is not displayed as import coverage.","from":"tools","aggregate":{"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"campaign-import-issue-count","subject":"Count retained issue identities for campaign inventory source quality.","objective":"Retain issue provenance without reconstructing run coverage.","acceptance":"Count canonical issue IDs; missing evidence stays unavailable and the count is not displayed as import coverage.","from":"issues","aggregate":{"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"campaign-workflow-import-evidence","subject":"Compose retained import-source quality for campaign workflow execution totals.","objective":"Preserve all four import dependencies without counting unused per-run or per-workflow coverage.","acceptance":"Compose audit, domain, tool, and issue availability, freshness, and completeness exactly as event-runs. The retained-record count carries source quality only; it is not displayed or used as horizon-specific import coverage, executions, or outcomes. Run and AI Credit totals retain their selected horizon.","from":"campaign-import-audit-count","union":["campaign-import-domain-count","campaign-import-tool-count","campaign-import-issue-count"],"time":{"range":"all"},"compute":[{"as":"import-scope","function":"literal","args":[{"value":"retained"}]}],"aggregate":{"by":["import-scope"],"values":[{"field":"records","as":"events","reducer":"sum"}]}},{"name":"campaign-workflow-execution-base","subject":"Summarize retained run attempts and AI Credits before campaign workflow enrichment.","objective":"Read run identity and recorded AI Credits together instead of enriching every run with import status.","acceptance":"Count distinct run-attempt identities and sum aic-total per organization, repository, and workflow; missing retained evidence is not proof of no execution or cost.","from":"runs","compute":[{"as":"import-scope","function":"literal","args":[{"value":"retained"}]},{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["organization","repository","workflow","import-scope"],"values":[{"field":"run-attempt-identity","as":"runs","reducer":"distinct-count"},{"field":"aic-total","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}}]}},{"name":"campaign-workflow-execution-totals","subject":"Attach retained import-evidence quality to compact workflow execution totals.","objective":"Preserve the public inventory's run and import availability composition after aggregating run evidence.","acceptance":"Keep runs and AI Credits unchanged; unavailable run evidence fails closed and optional import evidence degrades quality exactly as in run-import-status.","description":"Only source quality is consumed from import evidence. Join its compact retained-source summary after run aggregation; do not build unused run-level import coverage or change horizon-specific execution totals.","from":"campaign-workflow-execution-base","joins":[{"source":"campaign-workflow-import-evidence","type":"left","on":[{"left":"import-scope","right":"import-scope"}],"fields":[{"field":"events","as":"imported-events"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"runs"},{"field":"aic"}]},{"name":"campaign-workflow-declarations","subject":"Project reusable campaign workflow declarations without execution evidence.","objective":"Share declaration display fields between structural topology and execution inventory without joining runs or import evidence.","acceptance":"Preserve raw organization, repository, workflow and declaration fields for joins. Select orchestrator and worker roles once, retaining inactive and unknown declarations; only list consumers select active entries. Display defaults and repository links do not establish execution, enrollment or authority.","from":"workflows","filter":{"predicates":[{"field":"workflow-role","in":["orchestrator","worker"]}]},"compute":[{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"declared-mode","function":"coalesce","args":[{"field":"rollout-mode"},{"value":"unknown"}]},{"as":"declared-registration","function":"coalesce","args":[{"field":"workflow-active"},{"value":"unknown"}]},{"as":"campaign-title","function":"title-case","args":[{"field":"campaign"}]},{"as":"campaign-display-name","function":"coalesce","args":[{"field":"campaign-name"},{"field":"campaign-title"},{"value":"Repository-owned"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-slug"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-slug"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-slug"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"campaign"},{"field":"campaign-name"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"rollout-mode"},{"field":"workflow-active"},{"field":"repository-link"},{"field":"workflow-link"},{"field":"repository-slug"},{"field":"declared-mode"},{"field":"declared-registration"},{"field":"campaign-display-name"},{"field":"workflow-display-name"},{"field":"repository-dashboard-link"}]},{"name":"campaign-workflow-inventory","subject":"Project declared campaign workflows with lean execution and configuration evidence.","objective":"Provide campaign totals and lists from shared declarations with separate execution and import-quality evidence.","acceptance":"Keep all declared orchestrators and workers, including inactive and unobserved entries; preserve inventory ordering, configuration defaults, execution totals, and import-evidence quality.","description":"Lean campaign inventory with execution totals that retain the public workflow inventory's evidence-quality dependencies.","from":"campaign-workflow-declarations","joins":[{"source":"campaign-workflow-execution-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"aic","as":"observed-aic"}]}],"compute":[{"as":"total-runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"total-aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"organization"},{"field":"repository-slug","as":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"declared-registration","as":"workflow-active"},{"field":"total-runs","as":"runs"},{"field":"total-aic","as":"aic"},{"field":"repository-link"},{"field":"workflow-link"},{"field":"campaign-display-name"},{"field":"workflow-display-name"},{"field":"repository-dashboard-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"workflow-inventory","subject":"List declared workflows with their campaign, repository, configuration, and observed execution totals.","objective":"Compare declared workflow configuration with retained run, import-coverage, and AI Credit evidence to select a workflow for closer inspection.","acceptance":"Keep one row per declared workflow with identity, role, mode, registration, links, observed totals, and ingestion indicator; zero joined totals and missing evidence must not be treated as proof of no execution or complete ingestion.","description":"Central campaign and repository-owned workflow inventory with observed execution totals.","from":"workflows","joins":[{"source":"workflow-run-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"successful-runs","as":"observed-successful-runs"},{"field":"failed-runs","as":"observed-failed-runs"},{"field":"imported-runs","as":"observed-imported-runs"}]},{"source":"workflow-aic-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"aic","as":"observed-aic"},{"field":"aic-runs","as":"observed-aic-runs"}]}],"compute":[{"as":"campaign-title","function":"title-case","args":[{"field":"campaign"}]},{"as":"campaign-display-name","function":"coalesce","args":[{"field":"campaign-name"},{"field":"campaign-title"},{"value":"Repository-owned"}]},{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"declared-role","function":"coalesce","args":[{"field":"workflow-role"},{"value":"standalone"}]},{"as":"declared-mode","function":"coalesce","args":[{"field":"rollout-mode"},{"value":"unknown"}]},{"as":"declared-registration","function":"coalesce","args":[{"field":"workflow-active"},{"value":"unknown"}]},{"as":"total-runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"total-successful-runs","function":"coalesce","args":[{"field":"observed-successful-runs"},{"value":0}]},{"as":"has-observed-runs","function":"greater-than","args":[{"field":"total-runs"},{"value":0}]},{"as":"total-failed-runs","function":"coalesce","args":[{"field":"observed-failed-runs"},{"value":0}]},{"as":"total-aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]},{"as":"aic-per-run","function":"quotient","args":[{"field":"total-aic"},{"field":"observed-aic-runs"}]},{"as":"total-imported-runs","function":"coalesce","args":[{"field":"observed-imported-runs"},{"value":0}]},{"as":"ingestion-rate","function":"quotient","args":[{"field":"total-imported-runs"},{"field":"total-runs"}]},{"as":"ingestion","function":"format-percent","args":[{"field":"ingestion-rate"}]},{"as":"encoded-campaign","function":"url-encode","args":[{"field":"campaign"}]},{"as":"campaign-dashboard-href","function":"concat","args":[{"value":"#page-campaign-insights?campaign="},{"field":"encoded-campaign"}]},{"as":"campaign-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"campaign-display-name"},{"value":" campaign dashboard"}]},{"as":"campaign-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"campaign-dashboard-href"},{"field":"campaign-dashboard-label"},{"field":"campaign"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-slug"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-slug"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-slug"}]},{"as":"workflow-identity","function":"concat","args":[{"field":"repository-slug"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-identity"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-display-name"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-identity"}]}],"select":[{"field":"campaign"},{"field":"campaign-display-name","as":"campaign-name"},{"field":"organization"},{"field":"repository-slug","as":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-identity","as":"workflow-label"},{"field":"declared-role","as":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"declared-registration","as":"workflow-active"},{"field":"total-aic","as":"aic"},{"field":"total-runs","as":"runs"},{"field":"total-successful-runs","as":"successful-runs"},{"field":"total-failed-runs","as":"failed-runs"},{"field":"aic-per-run"},{"field":"has-observed-runs"},{"field":"ingestion"},{"field":"campaign-dashboard-link","as":"campaign-link"},{"field":"repository-dashboard-link","as":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"repository-run-statistics","subject":"Reduce run counts, conclusions, and positive AI Credits before repository enrichment.","objective":"Share one row-local run aggregate between repository execution and cost summaries.","acceptance":"Keep organization/repository grain, distinct run IDs, existing failure and approval counts, and positive recorded AIC. Reduce before joins; missing evidence is not zero activity or free execution.","from":"runs","compute":[{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["organization","repository"],"values":[{"field":"run","as":"runs","reducer":"distinct-count"},{"field":"run-conclusion","as":"failed","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","timed-out"]}]}},{"field":"run-conclusion","as":"action-required","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","equals":"action-required"}]}},{"field":"run","as":"aic-runs","reducer":"count","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"aic-total","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}}]}},{"name":"repository-aic-totals","subject":"Summarize observed AI Credit usage by repository.","objective":"Provide repository-level retained AI Credit totals for comparing observed usage with run activity.","acceptance":"Sum only positive recorded aic-total by organization and repository; exclude zero and missing costs rather than treating them as free execution.","description":"Observed AI Credit totals for each repository.","from":"repository-run-statistics","filter":{"predicates":[{"field":"aic-runs","gte":1}]},"select":[{"field":"organization"},{"field":"repository"},{"field":"aic"}]},{"name":"maintenance-campaign-packages","subject":"Installed campaign packages with retained source coordinates and update evidence.","objective":"Show installed/current source revisions and gate update actions on exact retained provenance.","acceptance":"Return every package. Set campaign-update-action-visible only for update-available rows with a non-empty source; missing provenance stays visible and non-actionable.","from":"campaigns","compute":[{"as":"campaign-source-unavailable","function":"equals-any","args":[{"field":"campaign-source"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"campaign-action-state","function":"if","args":[{"field":"campaign-source-unavailable"},{"value":"unknown"},{"field":"campaign-update-state"}]},{"as":"campaign-update-action-visible","function":"equals-any","args":[{"field":"campaign-action-state"},{"value":"update-available"}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"campaign-description"},{"field":"campaign-icon"},{"field":"campaign-source"},{"field":"campaign-version"},{"field":"campaign-current-version"},{"field":"campaign-update-state"},{"field":"campaign-registration"},{"field":"campaign-update-action-visible"}],"order-by":[{"field":"campaign-name","direction":"asc"}]},{"name":"maintenance-standalone-workflows","subject":"Standalone workflows with retained upstream provenance and update evidence.","objective":"Represent source-managed and local workflows without synthetic campaign membership.","acceptance":"Retain exact coordinates and revisions for source-managed rows; keep local or incomplete rows visible and non-actionable with an explicit reason.","from":"workflows","filter":{"predicates":[{"field":"workflow-role","equals":"standalone"},{"field":"workflow-source-kind","in":["source-managed","local"]}]},"compute":[{"as":"workflow-source-installed-unavailable","function":"equals-any","args":[{"field":"workflow-source-version"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"workflow-source-latest-unavailable","function":"equals-any","args":[{"field":"workflow-source-current-version"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"workflow-is-local","function":"equals-any","args":[{"field":"workflow-source-kind"},{"value":"local"}]},{"as":"workflow-source-state","function":"if","args":[{"field":"workflow-is-local"},{"value":"local"},{"field":"workflow-source-update-state"}]},{"as":"workflow-source-update-available","function":"equals-any","args":[{"field":"workflow-source-state"},{"value":"update-available"}]},{"as":"workflow-source-update-unknown","function":"equals-any","args":[{"field":"workflow-source-state"},{"value":"unknown"}]},{"as":"workflow-update-state-known","function":"if","args":[{"field":"workflow-source-update-available"},{"value":"Update available"},{"value":"Current"}]},{"as":"workflow-update-state-with-unknown","function":"if","args":[{"field":"workflow-source-update-unknown"},{"value":"Update status unavailable"},{"field":"workflow-update-state-known"}]},{"as":"workflow-update-state","function":"if","args":[{"field":"workflow-is-local"},{"value":"Local workflow"},{"field":"workflow-update-state-with-unknown"}]},{"as":"workflow-update-reason-installed","function":"if","args":[{"field":"workflow-source-installed-unavailable"},{"value":"Installed source revision unavailable."},{"value":"Installed and upstream source revisions are available."}]},{"as":"workflow-update-reason-latest","function":"if","args":[{"field":"workflow-source-latest-unavailable"},{"value":"Latest upstream source revision unavailable."},{"field":"workflow-update-reason-installed"}]},{"as":"workflow-update-status-reason","function":"if","args":[{"field":"workflow-is-local"},{"value":"No upstream source coordinate was retained; update manually."},{"field":"workflow-update-reason-latest"}]},{"as":"workflow-update-action-visible","function":"equals-any","args":[{"field":"workflow-source-state"},{"value":"update-available"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-source-kind"},{"field":"workflow-source"},{"field":"workflow-source-version"},{"field":"workflow-source-current-version"},{"field":"workflow-source-update-state"},{"field":"workflow-update-state"},{"field":"workflow-update-status-reason"},{"field":"workflow-update-action-visible"}],"order-by":[{"field":"workflow-update-action-visible","direction":"desc"},{"field":"workflow-name","direction":"asc"}]},{"name":"maintenance-repository-versions","subject":"Group installed and current gh-aw compiler versions and upgrade evidence by repository.","objective":"Identify repositories with declared Markdown workflows whose retained compiler-version evidence warrants upgrade review.","acceptance":"Group Markdown workflow declarations by repository coordinate and return distinct known installed/current version lists, distinct counts, upgrade-required evidence, and separate missing-installed/missing-latest flags. Never infer unavailable versions.","from":"workflows","filter":{"predicates":[{"field":"workflow","includes":".md"}]},"compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"installed-version-unavailable","function":"equals-any","args":[{"field":"gh-aw-version"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"current-version-unavailable","function":"equals-any","args":[{"field":"gh-aw-current-version"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"known-installed-version","function":"if","args":[{"field":"installed-version-unavailable"},{"value":null},{"field":"gh-aw-version"}]},{"as":"known-current-version","function":"if","args":[{"field":"current-version-unavailable"},{"value":null},{"field":"gh-aw-current-version"}]},{"as":"installed-version-unavailable-value","function":"if","args":[{"field":"installed-version-unavailable"},{"value":1},{"value":0}]},{"as":"current-version-unavailable-value","function":"if","args":[{"field":"current-version-unavailable"},{"value":1},{"value":0}]},{"as":"compiler-versions-match","function":"equals-any","args":[{"field":"gh-aw-version"},{"field":"gh-aw-current-version"}]},{"as":"upgrade-candidate-value","function":"if","args":[{"field":"compiler-versions-match"},{"value":0},{"value":1}]},{"as":"upgrade-with-current-evidence","function":"if","args":[{"field":"current-version-unavailable"},{"value":0},{"field":"upgrade-candidate-value"}]},{"as":"upgrade-required-value","function":"if","args":[{"field":"installed-version-unavailable"},{"value":0},{"field":"upgrade-with-current-evidence"}]}],"aggregate":{"by":["repository-coordinate"],"values":[{"field":"known-installed-version","as":"gh-aw-version","reducer":"distinct-list"},{"field":"known-current-version","as":"gh-aw-current-version","reducer":"distinct-list"},{"field":"known-installed-version","as":"installed-version-count","reducer":"distinct-count"},{"field":"known-current-version","as":"current-version-count","reducer":"distinct-count"},{"field":"upgrade-required-value","as":"upgrade-required","reducer":"max"},{"field":"installed-version-unavailable-value","as":"installed-version-unavailable","reducer":"max"},{"field":"current-version-unavailable-value","as":"current-version-unavailable","reducer":"max"}]}},{"name":"maintenance-repositories","subject":"List each repository with recorded compiler versions and computed upgrade state.","objective":"Expose recorded compiler versions, computed upgrade state, and a concise evidence diagnostic per repository, with its GitHub home URL for inspection.","acceptance":"Return repository, repository-url, known version lists, upgrade-required, upgrade-state, upgrade-status-reason, and upgrade-action-visible. Show Upgrade only when known evidence establishes an outdated compiler; missing or conflicting evidence stays visible and non-actionable.","from":"maintenance-repository-versions","compute":[{"as":"repository-url","function":"concat","args":[{"value":"https://github.com/"},{"field":"repository-coordinate"}]},{"as":"should-upgrade","function":"equals-any","args":[{"field":"upgrade-required"},{"value":1}]},{"as":"installed-version-mixed","function":"greater-than","args":[{"field":"installed-version-count"},{"value":1}]},{"as":"current-version-conflicting","function":"greater-than","args":[{"field":"current-version-count"},{"value":1}]},{"as":"installed-version-missing","function":"equals-any","args":[{"field":"installed-version-unavailable"},{"value":1}]},{"as":"current-version-missing","function":"equals-any","args":[{"field":"current-version-unavailable"},{"value":1}]},{"as":"latest-version-evidence-unavailable","function":"if","args":[{"field":"current-version-missing"},{"value":true},{"field":"current-version-conflicting"}]},{"as":"upgrade-status-unavailable","function":"if","args":[{"field":"installed-version-missing"},{"value":true},{"field":"latest-version-evidence-unavailable"}]},{"as":"current-or-unavailable","function":"if","args":[{"field":"should-upgrade"},{"value":true},{"field":"upgrade-status-unavailable"}]},{"as":"upgrade-state-known","function":"if","args":[{"field":"should-upgrade"},{"value":"Upgrade recommended"},{"value":"Current"}]},{"as":"upgrade-state","function":"if","args":[{"field":"upgrade-status-unavailable"},{"value":"Upgrade status unavailable"},{"field":"upgrade-state-known"}]},{"as":"upgrade-reason-known","function":"if","args":[{"field":"should-upgrade"},{"value":"At least one retained workflow uses an older gh-aw compiler version."},{"value":"All retained workflow compiler versions match the latest stable gh-aw release."}]},{"as":"upgrade-reason-mixed","function":"if","args":[{"field":"installed-version-mixed"},{"value":"Mixed installed gh-aw compiler versions were retained; at least one upgrade is recommended."},{"field":"upgrade-reason-known"}]},{"as":"upgrade-reason-installed","function":"if","args":[{"field":"installed-version-missing"},{"value":"Installed gh-aw compiler version unavailable for one or more workflows."},{"field":"upgrade-reason-mixed"}]},{"as":"upgrade-reason-current","function":"if","args":[{"field":"current-version-missing"},{"value":"Latest stable gh-aw release unavailable."},{"field":"upgrade-reason-installed"}]},{"as":"both-compiler-versions-missing","function":"if","args":[{"field":"installed-version-missing"},{"field":"current-version-missing"},{"value":false}]},{"as":"upgrade-reason-both","function":"if","args":[{"field":"both-compiler-versions-missing"},{"value":"Installed compiler version and latest stable gh-aw release are unavailable."},{"field":"upgrade-reason-current"}]},{"as":"upgrade-status-reason","function":"if","args":[{"field":"current-version-conflicting"},{"value":"Conflicting latest gh-aw release evidence was retained."},{"field":"upgrade-reason-both"}]},{"as":"upgrade-action-visible","function":"if","args":[{"field":"upgrade-status-unavailable"},{"value":false},{"field":"should-upgrade"}]},{"as":"installed-version-available","function":"greater-than","args":[{"field":"installed-version-count"},{"value":0}]},{"as":"current-version-available","function":"greater-than","args":[{"field":"current-version-count"},{"value":0}]},{"as":"gh-aw-version-label","function":"if","args":[{"field":"installed-version-available"},{"field":"gh-aw-version"},{"value":"unknown"}]},{"as":"gh-aw-current-version-label","function":"if","args":[{"field":"current-version-available"},{"field":"gh-aw-current-version"},{"value":"unknown"}]}],"select":[{"field":"repository-coordinate","as":"repository"},{"field":"repository-url"},{"field":"gh-aw-version-label","as":"gh-aw-version"},{"field":"gh-aw-current-version-label","as":"gh-aw-current-version"},{"field":"upgrade-required"},{"field":"upgrade-action-visible"},{"field":"upgrade-state"},{"field":"upgrade-status-reason"}],"order-by":[{"field":"repository","direction":"asc"}]},{"name":"maintenance-campaign-updates","subject":"Expose at most one CAO package update row for the Updates navigation indicator.","objective":"Determine whether retained campaign metadata contains an update-available signal for the Updates indicator.","acceptance":"Return zero or one campaign-update-state row only when it equals update-available; an empty result means no matching retained signal, not that every campaign is current.","from":"maintenance-campaign-packages","filter":{"predicates":[{"field":"campaign-update-action-visible","equals":true}]},"select":[{"field":"campaign-update-action-visible"}],"limit":1},{"name":"maintenance-standalone-updates","subject":"Expose at most one standalone workflow source update row for the Updates navigation indicator.","objective":"Determine whether retained source-managed standalone workflow metadata contains an actionable update signal for the Updates indicator.","acceptance":"Return zero or one workflow-update-action-visible row only when it is true; unmanaged local workflows and incomplete source evidence do not activate the indicator.","from":"maintenance-standalone-workflows","filter":{"predicates":[{"field":"workflow-update-action-visible","equals":true}]},"select":[{"field":"workflow-update-action-visible"}],"limit":1},{"name":"maintenance-repository-upgrades","subject":"Expose at most one gh-aw compiler upgrade row for the Updates navigation indicator.","objective":"Determine whether repository compiler metadata contains an upgrade-required signal for the Updates indicator.","acceptance":"Return zero or one upgrade-action-visible row only when known retained evidence establishes an outdated compiler; missing evidence remains non-actionable and does not activate the indicator.","from":"maintenance-repositories","filter":{"predicates":[{"field":"upgrade-action-visible","equals":true}]},"select":[{"field":"upgrade-action-visible"}],"limit":1},{"name":"run-incomplete-outcomes","subject":"Project retained report-incomplete terminal outcomes as concise run diagnoses.","objective":"Find recorded report_incomplete terminal outcomes that can explain a specific run's incomplete reporting.","acceptance":"Include only runs with a recorded report_incomplete terminal outcome, preserving run-attempt identity, outcome kind, and recorded diagnosis; absence is not proof that reporting completed.","description":"One retained incomplete-evidence diagnosis per workflow Run when the agent explicitly reported that required evidence or access was unavailable.","from":"runs","filter":{"predicates":[{"field":"terminal-outcome","equals":"report_incomplete"}]},"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"terminal-outcome","as":"outcome-kind"},{"field":"terminal-outcome-detail","as":"outcome-diagnosis"}]},{"name":"campaign-runs","subject":"Project workflow runs with campaign attribution and retained failure evidence.","objective":"Connect retained run status and failure details to declared campaign/workflow identity for run-level diagnosis.","acceptance":"Expose run and attempt identity, declared attribution, runtime and target repositories, status, failure and incomplete-outcome evidence, timestamps, and drill-down links; do not infer an outcome from runtime success or missing details.","description":"Canonical workflow runs joined to their declared campaign and workflow identity.","from":"runs","joins":[{"source":"workflows","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"declared-campaign"},{"field":"campaign-name","as":"declared-campaign-name"},{"field":"workflow-name","as":"declared-workflow-name"},{"field":"workflow-role","as":"declared-workflow-role"},{"field":"workflow-link","as":"declared-workflow-link"}]},{"source":"run-incomplete-outcomes","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"outcome-kind","as":"outcome-kind"},{"field":"outcome-diagnosis","as":"outcome-diagnosis"}]}],"compute":[{"as":"status","function":"coalesce","args":[{"field":"run-conclusion"},{"field":"run-status"},{"value":"unknown"}]},{"as":"effective-outcome-kind","function":"coalesce","args":[{"field":"outcome-kind"},{"field":"terminal-outcome"},{"value":""}]},{"as":"is-incomplete-outcome","function":"equals-any","args":[{"field":"effective-outcome-kind"},{"value":"report_incomplete"}]},{"as":"diagnosis-kind","function":"if","args":[{"field":"is-incomplete-outcome"},{"value":"incomplete_evidence"},{"value":""}]},{"as":"error-signature","function":"coalesce","args":[{"field":"diagnosis-kind"},{"field":"failure-kind"},{"field":"classification"},{"field":"status"}]},{"as":"_error-signature-default-label","function":"title-case","args":[{"field":"error-signature"}]},{"as":"_is-driver-exit","function":"equals-any","args":[{"field":"error-signature"},{"value":"driver_exit"},{"value":"driver-exit"}]},{"as":"error-signature-label","function":"if","args":[{"field":"_is-driver-exit"},{"value":"Agent process exited unexpectedly"},{"field":"_error-signature-default-label"}]},{"as":"status-detail","function":"coalesce","args":[{"field":"outcome-diagnosis"},{"field":"terminal-outcome-detail"},{"field":"failure-detail"},{"field":"failure-message"},{"field":"failure-step"},{"field":"admission-reason"},{"value":""}]},{"as":"runtime-repository","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"is-worker","function":"equals-any","args":[{"field":"declared-workflow-role"},{"value":"worker"}]},{"as":"is-orchestrator","function":"equals-any","args":[{"field":"declared-workflow-role"},{"value":"orchestrator"}]},{"as":"root-dispatch-type","function":"if","args":[{"field":"is-orchestrator"},{"value":"Campaign orchestrator"},{"value":"Standalone workflow"}]},{"as":"dispatch-type","function":"if","args":[{"field":"is-worker"},{"value":"Campaign worker"},{"field":"root-dispatch-type"}]},{"as":"campaign-display-name","function":"coalesce","args":[{"field":"declared-campaign-name"},{"field":"declared-campaign"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"declared-workflow-name"},{"field":"workflow"}]},{"as":"encoded-campaign","function":"url-encode","args":[{"field":"declared-campaign"}]},{"as":"campaign-dashboard-href","function":"concat","args":[{"value":"#page-campaign-insights?campaign="},{"field":"encoded-campaign"}]},{"as":"campaign-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"campaign-display-name"},{"value":" campaign dashboard"}]},{"as":"campaign-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"campaign-dashboard-href"},{"field":"campaign-dashboard-label"},{"field":"declared-campaign"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"runtime-repository"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"runtime-repository"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"runtime-repository"}]},{"as":"workflow-identity","function":"concat","args":[{"field":"runtime-repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-identity"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-display-name"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-identity"}]}],"select":[{"field":"started-at"},{"field":"dispatch-type"},{"field":"declared-campaign","as":"campaign"},{"field":"declared-campaign-name","as":"campaign-name"},{"field":"declared-workflow-name","as":"workflow-name"},{"field":"run"},{"field":"run-attempt"},{"field":"run-title"},{"field":"event"},{"field":"runtime-repository"},{"field":"target-repository"},{"field":"rollout-mode"},{"field":"status"},{"field":"run-status"},{"field":"error-signature"},{"field":"error-signature-label"},{"field":"status-detail"},{"field":"outcome-kind"},{"field":"outcome-diagnosis"},{"field":"declared-workflow-role","as":"workflow-role"},{"field":"failure-job"},{"field":"failure-message"},{"field":"failure-step"},{"field":"failure-log"},{"field":"engine"},{"field":"engine-version"},{"field":"gh-aw-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"aic-total"},{"field":"safe-items-count"},{"field":"resource-reset-at","as":"status-detail-at"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"declared-workflow-link","as":"workflow-source-link"},{"field":"run-link"},{"field":"campaign-dashboard-link","as":"campaign-link"},{"field":"repository-dashboard-link","as":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"}],"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"campaign-runtime-health-runs","subject":"Project only the run and workflow fields required to classify current campaign runtime health.","objective":"Provide the retained run identity, timing, role, dispatch type, repository, and status needed to assess campaign runtime-health groups.","acceptance":"Project the selected fields from overview-runs without converting missing statuses or unattributed workflows into failures; unavailable run history leaves health assessment incomplete.","description":"A bounded runtime-health input that excludes audit outcomes and presentation-only campaign run fields.","from":"overview-runs","compute":[{"as":"status","function":"coalesce","args":[{"field":"run-conclusion"},{"field":"run-status"},{"value":"unknown"}]},{"as":"runtime-repository","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"is-worker","function":"equals-any","args":[{"field":"workflow-role"},{"value":"worker"}]},{"as":"is-orchestrator","function":"equals-any","args":[{"field":"workflow-role"},{"value":"orchestrator"}]},{"as":"root-dispatch-type","function":"if","args":[{"field":"is-orchestrator"},{"value":"Campaign orchestrator"},{"value":"Standalone workflow"}]},{"as":"dispatch-type","function":"if","args":[{"field":"is-worker"},{"value":"Campaign worker"},{"field":"root-dispatch-type"}]}],"select":[{"field":"started-at"},{"field":"campaign"},{"field":"campaign-name"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"dispatch-type"},{"field":"runtime-repository"},{"field":"run"},{"field":"run-status"},{"field":"status"}]},{"name":"campaign-runtime-health-groups","subject":"Compute each campaign workflow and runtime repository's latest consecutive failure streak in the selected horizon.","objective":"Locate campaign workflow/runtime-repository groups whose most recent retained completed runs have consecutive runtime failures.","acceptance":"Group completed runs by campaign, workflow, role, dispatch type, and runtime repository; failure-count is the latest retained failure streak, not a rate or a claim about runs outside the available horizon.","description":"Current retained failure streaks grouped by campaign workflow and runtime repository, considering only concluded Runs so an in-flight retry cannot mask an active failure streak.","from":"campaign-runtime-health-runs","filter":{"predicates":[{"field":"run-status","equals":"completed"}]},"compute":[{"as":"is-runtime-failure","function":"equals-any","args":[{"field":"status"},{"value":"failure"},{"value":"startup-failure"},{"value":"stale"},{"value":"timed-out"}]},{"as":"runtime-failure-streak-point","function":"failure-streak-point","args":[{"field":"started-at"},{"field":"run"},{"field":"is-runtime-failure"}]}],"aggregate":{"by":["campaign","campaign-name","workflow","workflow-name","workflow-role","dispatch-type","runtime-repository"],"values":[{"field":"runtime-failure-streak-point","as":"failure-count","reducer":"latest-failure-streak"}]}},{"name":"workflow-run-observation-counts","subject":"Count retained Runs for each workflow identity in the selected horizon.","objective":"Measure retained run presence by workflow identity to compare with active orchestrator declarations.","acceptance":"Count overview-runs by organization, repository, and workflow; a missing group indicates no retained matching run in the available horizon, not proof of no executions.","description":"One row per organization, repository, and workflow with retained Run counts, safe to join without row multiplication.","from":"overview-runs","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run","as":"observed-run-count","reducer":"count"}]}},{"name":"campaign-active-orchestrator-run-presence","subject":"Count retained Runs for each active campaign orchestrator in the selected horizon.","objective":"Compare active orchestrator declarations with retained run observations to identify missing visibility.","acceptance":"Keep only workflows declared active with orchestrator role and expose their identity, runtime repository, and observed-run-count; a zero joined count means no retained match, not necessarily a stopped schedule.","description":"Active campaign orchestrators annotated with retained Run presence.","from":"workflows","joins":[{"source":"workflow-run-observation-counts","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"observed-run-count","as":"joined-observed-run-count"}]}],"filter":{"predicates":[{"field":"workflow-role","equals":"orchestrator"},{"field":"workflow-active","equals":"true"}]},"compute":[{"as":"runtime-repository","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"observed-run-count","function":"coalesce","args":[{"field":"joined-observed-run-count"},{"value":0}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"runtime-repository"},{"field":"observed-run-count"}]},{"name":"campaign-unobserved-orchestrator-candidates","subject":"Mark active campaign orchestrators with no retained Runs in the selected horizon.","objective":"Mark active orchestrators lacking retained run evidence for bounded telemetry or schedule review.","acceptance":"Preserve active orchestrator identity and observed-run-count; is-unobserved marks zero retained matches and must not be interpreted as a runtime failure or evidence that dispatch was expected.","description":"Active orchestrators annotated with whether runtime evidence is absent.","from":"campaign-active-orchestrator-run-presence","compute":[{"as":"is-unobserved","function":"equals-any","args":[{"field":"observed-run-count"},{"value":0}]},{"as":"failure-count","function":"sum","args":[{"value":0},{"value":0}]},{"as":"dispatch-type","function":"coalesce","args":[{"value":"Campaign orchestrator"},{"value":"Campaign orchestrator"}]},{"as":"problem-kind","function":"coalesce","args":[{"value":"not-observed"},{"value":"not-observed"}]}]},{"name":"campaign-unobserved-orchestrators","subject":"Show active campaign orchestrators with no retained Runs in the selected horizon.","objective":"List active orchestrator declarations with no retained run observations for follow-up on evidence availability.","acceptance":"Return only is-unobserved candidates with their workflow and repository identity; an empty result does not certify run completeness or scheduler health.","description":"Active campaign orchestrators whose runtime state cannot be established from retained evidence.","from":"campaign-unobserved-orchestrator-candidates","filter":{"predicates":[{"field":"is-unobserved","equals":true}]}},{"name":"dispatches","subject":"Select workflow-dispatch runs from campaign-attributed workflow run evidence.","objective":"Inspect retained workflow_dispatch runs attributed to campaigns before comparing campaign dispatch activity.","acceptance":"Include only campaign-runs with event workflow_dispatch and preserve run, attempt, attribution, status, and time; absence does not establish that no dispatch occurred beyond retained evidence.","description":"Canonical workflow runs whose authoritative trigger is workflow_dispatch.","from":"campaign-runs","filter":{"predicates":[{"field":"event","equals":"workflow_dispatch"}]},"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"campaign-dispatch-inventory","subject":"Project retained dispatch identity and campaign attribution before campaign counting.","objective":"Count dispatches without materializing run diagnoses and presentation links.","acceptance":"Keep workflow_dispatch runs in timestamp order with declared campaign attribution; preserve workflow and incomplete-outcome join quality and duplicate-key failure behavior.","description":"Lean dispatch-count input; the incomplete-outcome join preserves the full campaign run source's evidence quality and fail-closed validation.","from":"runs","joins":[{"source":"workflows","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"declared-campaign"}]},{"source":"run-incomplete-outcomes","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"outcome-kind","as":"outcome-kind"}]}],"filter":{"predicates":[{"field":"event","equals":"workflow_dispatch"}]},"select":[{"field":"declared-campaign","as":"campaign"},{"field":"run"},{"field":"started-at"}],"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"campaign-dispatch-totals","subject":"Summarize observed workflow dispatches for each centrally managed campaign.","objective":"Compare retained workflow_dispatch run counts across attributed campaigns.","acceptance":"Count distinct run identifiers per campaign from dispatches; do not treat missing campaign attribution or unretained dispatches as zero actual activity.","description":"Observed workflow-dispatch run totals grouped by campaign.","from":"campaign-dispatch-inventory","aggregate":{"by":["campaign"],"values":[{"field":"run","as":"dispatches","reducer":"distinct-count"}]}},{"name":"campaign-workflow-totals","subject":"Summarize observed workflow and execution totals for each centrally managed campaign.","objective":"Compare declared orchestrator/worker composition, rollout registration, observed runs, and AI Credit usage by campaign.","acceptance":"Group only orchestrator and worker workflow-inventory rows by campaign; retain workflow count, distinct roles/modes/registration and summed observed runs and AIC, without inferring successful outcomes.","description":"Observed workflow, rollout, run, and AI Credit totals grouped by campaign.","from":"campaign-workflow-inventory","aggregate":{"by":["campaign"],"values":[{"field":"workflow","as":"workflows","reducer":"count"},{"field":"workflow-role","as":"roles","reducer":"distinct-list"},{"field":"rollout-mode","as":"modes","reducer":"distinct-list"},{"field":"workflow-active","as":"registration","reducer":"distinct-list"},{"field":"runs","as":"runs","reducer":"sum"},{"field":"aic","as":"aic","reducer":"sum"}]}},{"name":"campaign-repository-coverage","subject":"Count distinct registered target repositories reached by successful worker dispatches for each campaign.","objective":"Estimate observed campaign target reach from successful worker workflow_dispatch runs joined to registered repositories.","acceptance":"Count distinct matched target-repository values per campaign only for successful worker dispatches; this is observed reach, not verified target outcomes or complete fleet coverage.","description":"Campaign repository coverage derived from successful worker dispatch runs in the selected horizon.","from":"runs","joins":[{"source":"workflows","type":"inner","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"campaign"},{"field":"workflow-role","as":"workflow-role"}]},{"source":"repositories","type":"inner","on":[{"left":"target-repository","right":"repository-coordinate"}],"fields":[{"field":"repository-coordinate","as":"registered-target-repository"}]}],"filter":{"predicates":[{"field":"event","equals":"workflow_dispatch"},{"field":"run-conclusion","equals":"success"},{"field":"workflow-role","equals":"worker"}]},"aggregate":{"by":["campaign"],"values":[{"field":"target-repository","as":"covered-repositories","reducer":"distinct-count"}]}},{"name":"campaign-inventory-preview","subject":"Show declared campaigns before execution evidence is evaluated.","objective":"Expose campaign identities and navigation links while observed totals remain pending.","acceptance":"Preserve every declared campaign and its dashboard link without reporting missing execution totals as zero.","from":"campaigns","compute":[{"as":"encoded-campaign","function":"url-encode","args":[{"field":"campaign"}]},{"as":"campaign-dashboard-href","function":"concat","args":[{"value":"#page-campaign-insights?campaign="},{"field":"encoded-campaign"}]},{"as":"campaign-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"campaign-name"},{"value":" campaign dashboard"}]},{"as":"campaign-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"campaign-dashboard-href"},{"field":"campaign-dashboard-label"},{"field":"campaign"}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"campaign-dashboard-link"}],"order-by":[{"field":"campaign-name","direction":"asc"}]},{"name":"campaign-inventory","subject":"List centrally managed campaigns with their observed workflow and execution totals.","objective":"Compare declared campaigns with retained workflow composition, dispatches, target reach, runs, and AIC to choose an evidence-backed drill-down.","acceptance":"Keep declared campaigns with campaign identity and link plus joined totals; defaulted zero values mean no matching retained evidence and cannot certify no activity, complete coverage, or successful outcomes.","description":"Canonical campaign inventory enriched with observed workflow, rollout, run, repository coverage, and AI Credit totals.","from":"campaigns","joins":[{"source":"campaign-workflow-totals","type":"left","on":[{"left":"campaign","right":"campaign"}],"fields":[{"field":"workflows","as":"observed-workflows"},{"field":"roles","as":"observed-roles"},{"field":"modes","as":"observed-modes"},{"field":"registration","as":"observed-registration"},{"field":"runs","as":"observed-runs"},{"field":"aic","as":"observed-aic"}]},{"source":"campaign-dispatch-totals","type":"left","on":[{"left":"campaign","right":"campaign"}],"fields":[{"field":"dispatches","as":"observed-dispatches"}]},{"source":"campaign-repository-coverage","type":"left","on":[{"left":"campaign","right":"campaign"}],"fields":[{"field":"covered-repositories","as":"observed-covered-repositories"}]}],"compute":[{"as":"workflows","function":"coalesce","args":[{"field":"observed-workflows"},{"value":0}]},{"as":"roles","function":"coalesce","args":[{"field":"observed-roles"},{"value":""}]},{"as":"modes","function":"coalesce","args":[{"field":"observed-modes"},{"field":"campaign-mode"}]},{"as":"registration","function":"coalesce","args":[{"field":"observed-registration"},{"field":"campaign-registration"}]},{"as":"runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"dispatches","function":"coalesce","args":[{"field":"observed-dispatches"},{"value":0}]},{"as":"covered-repositories","function":"coalesce","args":[{"field":"observed-covered-repositories"},{"value":0}]},{"as":"aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]},{"as":"encoded-campaign","function":"url-encode","args":[{"field":"campaign"}]},{"as":"campaign-dashboard-href","function":"concat","args":[{"value":"#page-campaign-insights?campaign="},{"field":"encoded-campaign"}]},{"as":"campaign-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"campaign-name"},{"value":" campaign dashboard"}]},{"as":"campaign-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"campaign-dashboard-href"},{"field":"campaign-dashboard-label"},{"field":"campaign"}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"campaign-dashboard-link"},{"field":"workflows"},{"field":"roles"},{"field":"modes"},{"field":"registration"},{"field":"runs"},{"field":"dispatches"},{"field":"covered-repositories"},{"field":"aic"}],"order-by":[{"field":"campaign-name","direction":"asc"}]},{"name":"firewall-domain-totals","subject":"Show each observed firewall domain with the number of runs and total accepted and blocked requests.","objective":"Identify domains with observed denied requests for a closer review of firewall evidence.","acceptance":"Report distinct observed runs and native accepted and blocked request totals by domain; a denied request alone does not justify allowing egress, and no row does not prove no requests occurred.","description":"Distinct runs and accepted and blocked request totals by firewall domain.","from":"firewall-observations","filter":{"predicates":[{"field":"decision","in":["allowed","denied"]}]},"aggregate":{"by":["domain"],"values":[{"field":"run","as":"run","reducer":"distinct-count"},{"field":"request-count","as":"accepted","reducer":"sum","filter":{"predicates":[{"field":"decision","equals":"allowed"}]}},{"field":"request-count","as":"blocked","reducer":"sum","filter":{"predicates":[{"field":"decision","equals":"denied"}]}}]},"order-by":[{"field":"blocked","direction":"desc"},{"field":"accepted","direction":"desc"},{"field":"domain","direction":"asc"}]},{"name":"firewall-most-blocked-domains","subject":"Highlight the domains with the most blocked firewall requests.","objective":"Prioritize up to ten observed domains by blocked request total for investigation.","acceptance":"Rank by observed blocked totals and inspect underlying domain/workflow evidence before deciding whether a block needs attention; the ranking is not a policy authorization or an incidence rate.","description":"The ten domains with the highest observed blocked request totals.","from":"firewall-domain-totals","order-by":[{"field":"blocked","direction":"desc"},{"field":"domain","direction":"asc"}],"limit":10},{"name":"firewall-domain-workflows","subject":"Show workflows that allowed or blocked requests to each observed firewall domain.","objective":"Locate which observed workflows contributed accepted or denied requests for a domain.","acceptance":"Preserve workflow scope, source link, distinct runs, and native accepted and blocked totals; investigate the run and egress context rather than assuming a denied request is a failure or grounds for wider access.","description":"Workflow-level accepted and blocked request totals by firewall domain.","from":"firewall-observations","filter":{"predicates":[{"field":"decision","in":["allowed","denied"]}]},"compute":[{"as":"workflow-source-url","function":"link-href","args":[{"field":"workflow-link"}]}],"aggregate":{"by":["domain","organization","repository","workflow","workflow-source-url"],"values":[{"field":"run","as":"runs","reducer":"distinct-count"},{"field":"request-count","as":"accepted","reducer":"sum","filter":{"predicates":[{"field":"decision","equals":"allowed"}]}},{"field":"request-count","as":"blocked","reducer":"sum","filter":{"predicates":[{"field":"decision","equals":"denied"}]}}]},"order-by":[{"field":"blocked","direction":"desc"},{"field":"accepted","direction":"desc"},{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"mcp-tool-totals","subject":"Group observed MCP activity by tool and count calls and calling workflows, excluding the internal safe outputs server.","objective":"Expose tool-level call, workflow, and byte totals to investigate observed MCP usage.","acceptance":"Group only observed non-safe-output-server calls by server and tool, preserving counts and byte totals; lack of calls does not establish no access, and call volume does not establish value or permission.","description":"Observed MCP tool-call totals grouped by MCP server and tool, with the number of distinct calling workflows.","from":"mcp-tool-workflow-totals","filter":{"predicates":[{"field":"safe-output-server","equals":false}]},"aggregate":{"by":["mcp-tool-label","mcp-server","mcp-tool"],"values":[{"field":"calls","as":"calls","reducer":"sum"},{"field":"workflow-key","as":"workflows","reducer":"distinct-count"},{"field":"request-bytes","as":"request-bytes","reducer":"sum"},{"field":"response-bytes","as":"response-bytes","reducer":"sum"}]},"select":[{"field":"mcp-tool-label"},{"field":"mcp-tool"},{"field":"mcp-server"},{"field":"calls"},{"field":"workflows"},{"field":"request-bytes"},{"field":"response-bytes"}],"order-by":[{"field":"calls","direction":"desc"},{"field":"mcp-tool-label","direction":"asc"}]},{"name":"mcp-top-tools","subject":"Show the ten most frequently called MCP tools.","objective":"Identify up to ten tools with the highest observed non-safe-output-server call counts for inspection.","acceptance":"Rank observed calls by tool label and inspect grouped tool evidence before drawing conclusions; do not treat popularity as effectiveness or authority to add tools.","description":"The ten MCP tools with the most observed calls, excluding the internal safe outputs server.","from":"mcp-tool-totals","order-by":[{"field":"calls","direction":"desc"},{"field":"mcp-tool-label","direction":"asc"}],"limit":10},{"name":"steering-events","subject":"Prepare observed gateway steering warnings for aggregation by steering type and workflow.","objective":"Expose warning identity, run context, type, and timestamp for downstream steering diagnostics.","acceptance":"Project recorded gateway steering events with workflow and run attribution where available; a warning is not a completed budget overrun, failure, or reason to increase limits.","description":"Gateway steering warnings emitted when a run approaches its AI Credit budget, time limit, or another declared limit, labelled with a readable steering type.","from":"audits","filter":{"predicates":[{"field":"event-type","equals":"firewall.steering"}]},"joins":[{"source":"workflows","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"campaign"},{"field":"workflow-name","as":"workflow-name"}]}],"compute":[{"as":"steering-code","function":"coalesce","args":[{"field":"code"},{"field":"event-status"},{"value":"unknown"}]},{"as":"_token-steering","function":"equals-any","args":[{"field":"steering-code"},{"value":"token_steering"}]},{"as":"_timeout-steering","function":"equals-any","args":[{"field":"steering-code"},{"value":"timeout_steering"}]},{"as":"_turn-steering","function":"equals-any","args":[{"field":"steering-code"},{"value":"turn_steering"},{"value":"max_turns_steering"}]},{"as":"_turn-steering-type","function":"if","args":[{"field":"_turn-steering"},{"value":"Running out of turns"},{"field":"steering-code"}]},{"as":"_timeout-steering-type","function":"if","args":[{"field":"_timeout-steering"},{"value":"Running out of time"},{"field":"_turn-steering-type"}]},{"as":"steering-type","function":"if","args":[{"field":"_token-steering"},{"value":"Running out of tokens"},{"field":"_timeout-steering-type"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"workflow-label","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow-coordinate"}]}],"select":[{"field":"id"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-coordinate"},{"field":"workflow-label"},{"field":"campaign"},{"field":"run"},{"field":"run-link"},{"field":"steering-code"},{"field":"steering-type"},{"field":"event-summary"},{"field":"observed-at"}]},{"name":"steering-type-totals","subject":"Show how often each kind of steering warning occurred.","objective":"Identify steering warning categories to inspect in their run context.","acceptance":"Report observed event totals and distinct runs and workflows by type; confirm underlying warnings before interpreting frequency, and do not infer actual limit breaches.","description":"Observed gateway steering warnings grouped by steering type with the number of affected runs and workflows.","from":"steering-events","aggregate":{"by":["steering-type","steering-code"],"values":[{"field":"id","as":"events","reducer":"count"},{"field":"run","as":"runs","reducer":"distinct-count"},{"field":"workflow-coordinate","as":"workflows","reducer":"distinct-count"}]},"select":[{"field":"steering-type"},{"field":"steering-code"},{"field":"events"},{"field":"runs"},{"field":"workflows"}],"order-by":[{"field":"events","direction":"desc"},{"field":"steering-type","direction":"asc"}]},{"name":"steering-workflow-totals","subject":"Count steering warnings for each workflow.","objective":"Expose workflow-level warning totals and token/time warning breakdowns for downstream review.","acceptance":"Count recorded events and distinct runs by workflow, retaining the declared token/time categories; other types remain in total events and no warning alone establishes a failure.","description":"Gateway steering warnings grouped by workflow, split into token-budget and time-limit warnings.","from":"steering-events","aggregate":{"by":["workflow-coordinate","organization","repository","workflow","workflow-label","campaign"],"values":[{"field":"id","as":"events","reducer":"count"},{"field":"run","as":"runs","reducer":"distinct-count"},{"field":"id","as":"token-events","reducer":"count","filter":{"predicates":[{"field":"steering-code","equals":"token_steering"}]}},{"field":"id","as":"time-events","reducer":"count","filter":{"predicates":[{"field":"steering-code","equals":"timeout_steering"}]}},{"field":"steering-type","as":"steering-types","reducer":"distinct-count"}]},"order-by":[{"field":"events","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}]},{"name":"steering-workflows","subject":"Present workflow steering totals with a link to each workflow dashboard.","objective":"Show observed workflow steering totals with navigation to the affected run context.","acceptance":"Keep workflow identity, link, events, runs, and warning breakdowns tied to their grouped evidence; use drill-through before recommending changes, not warning counts as a basis to widen budgets.","description":"Workflow steering totals labelled with a link to the workflow runtime page.","from":"steering-workflow-totals","compute":[{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-label"}]}],"select":[{"field":"workflow-coordinate"},{"field":"workflow-label"},{"field":"workflow-dashboard-link"},{"field":"organization"},{"field":"repository"},{"field":"campaign"},{"field":"events"},{"field":"runs"},{"field":"token-events"},{"field":"time-events"},{"field":"steering-types"}],"order-by":[{"field":"events","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}]},{"name":"steering-top-workflows","subject":"Highlight the workflows with the most steering warnings.","objective":"Prioritize up to ten workflows by observed warning count for investigation.","acceptance":"Rank recorded warning totals with workflow context, checking underlying events and telemetry coverage; a high rank neither proves overrun nor justifies a limit change.","description":"The ten workflows with the highest observed gateway steering warning totals.","from":"steering-workflows","order-by":[{"field":"events","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}],"limit":10},{"name":"entity-workflow-run-totals","subject":"Summarize run outcomes and AI Credit consumption for reusable workflow cards.","objective":"Compare retained run-attempt activity, recorded conclusions, and AI Credit usage per workflow card.","acceptance":"Group by organization, repository, and workflow; expose distinct run-attempt count, success/failure conclusion counts, and sum of recorded AIC, without treating missing run history as zero actual activity.","from":"runs","compute":[{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run-attempt-identity","as":"runs","reducer":"distinct-count"},{"field":"run-attempt-identity","as":"aic-runs","reducer":"distinct-count","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"run-conclusion","as":"successful-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","equals":"success"}]}},{"field":"run-conclusion","as":"failed-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","stale","timed-out"]}]}},{"field":"aic-total","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}}]}},{"name":"entity-workflows","subject":"Project workflow entities for reusable workflow cards and repository drill-down.","objective":"Relate declared workflows to observed run and AIC totals for workflow-level drill-down.","acceptance":"Keep declared workflow identity, role, registration, campaign, link, and joined totals; a missing run match defaults to displayed zeros but does not establish no executions or outcomes.","from":"workflows","joins":[{"source":"entity-workflow-run-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"successful-runs","as":"observed-successful-runs"},{"field":"failed-runs","as":"observed-failed-runs"},{"field":"aic","as":"observed-aic"},{"field":"aic-runs","as":"observed-aic-runs"}]}],"compute":[{"as":"runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"successful-runs","function":"coalesce","args":[{"field":"observed-successful-runs"},{"value":0}]},{"as":"failed-runs","function":"coalesce","args":[{"field":"observed-failed-runs"},{"value":0}]},{"as":"aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]},{"as":"aic-per-run","function":"quotient","args":[{"field":"aic"},{"field":"observed-aic-runs"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"workflow-active"},{"field":"campaign-name"},{"field":"observed-at"},{"field":"runs"},{"field":"successful-runs"},{"field":"failed-runs"},{"field":"aic-per-run"},{"field":"workflow-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"repository-runs","subject":"Project canonical runs into repository-addressable run evidence.","objective":"Expose retained run chronology and status for a selected repository's drill-down.","acceptance":"Retain repository coordinate, workflow, run identity, title, event, start time, conclusion, mode, AIC, and run link; absent details or runs do not establish a healthy or idle repository.","description":"Workflow runs with a stable repository route key.","from":"runs","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]}],"select":[{"field":"repository-coordinate"},{"field":"workflow"},{"field":"run"},{"field":"run-title"},{"field":"event"},{"field":"started-at"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"rollout-mode"},{"field":"aic-total"},{"field":"run-link"}],"order-by":[{"field":"started-at","direction":"desc"},{"field":"run","direction":"desc"}]},{"name":"repository-workflow-totals","subject":"Summarize declared and disabled workflow counts by repository.","objective":"Compare declared and disabled workflow counts for each repository in the retained workflow inventory.","acceptance":"Count declared workflows and workflow-active=false entries by organization and repository; missing declarations must not be interpreted as a complete zero-workflow inventory.","description":"Declared and disabled workflow totals for each repository.","from":"workflows","aggregate":{"by":["organization","repository"],"values":[{"field":"workflow","as":"workflows","reducer":"count"},{"field":"workflow","as":"disabled","reducer":"count","filter":{"predicates":[{"field":"workflow-active","equals":"false"}]}}]}},{"name":"repository-report-totals","subject":"Summarize published outcome report counts by repository.","objective":"Show retained outcome-report volume per repository for comparison with observed execution.","acceptance":"Count retained outcome rows by organization and repository; a missing aggregate does not prove no reports were published or that reported outcomes succeeded.","description":"Published report totals for each repository.","from":"outcomes","aggregate":{"by":["organization","repository"],"values":[{"field":"repository","as":"reports","reducer":"count"}]}},{"name":"repository-run-identities","subject":"Project the run-attempt identities needed to match imported evidence.","objective":"Keep import-coverage joins narrow without carrying run details, links, or costs.","acceptance":"Preserve each selected run attempt and its organization, repository, workflow, run, and attempt keys. Do not deduplicate attempts or change selected-horizon semantics.","from":"runs","select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"}]},{"name":"repository-import-totals","subject":"Count selected run attempts with matching retained imported records.","objective":"Join compact run identities to already reduced event evidence, then reduce import coverage by repository.","acceptance":"Match all five run-attempt keys and count each selected run row once when events are positive. Preserve optional-evidence quality and horizon filters; records for unselected runs do not establish coverage.","from":"repository-run-identities","joins":[{"source":"event-runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"events","as":"imported-events"}]}],"compute":[{"as":"imported","function":"greater-than","args":[{"field":"imported-events"},{"value":0}]}],"aggregate":{"by":["organization","repository"],"values":[{"field":"imported","as":"imported-runs","reducer":"sum"}]}},{"name":"repository-run-totals","subject":"Summarize distinct runs, failures, and approval-required runs by repository.","objective":"Join already reduced run statistics and import coverage at repository grain.","acceptance":"Group by organization and repository; preserve distinct run IDs, configured failure/action-required conclusion counts, and imported-run sums. Missing enrichment or run history must not be treated as complete coverage.","description":"Distinct run and conclusion totals for each repository.","from":"repository-run-statistics","joins":[{"source":"repository-import-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"imported-runs","as":"imported-runs"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"runs"},{"field":"failed"},{"field":"action-required"},{"field":"imported-runs"}]},{"name":"repository-activity-preview","subject":"List repository identities before execution metrics are computed.","objective":"Show retained repository identities and drill links while activity metrics are pending.","acceptance":"List repositories by organization with repository drill links; this preview does not establish activity totals or outcomes.","description":"Fast repository inventory with drill links; activity fields remain pending.","from":"repositories","compute":[{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-slug"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-slug"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-slug"}]}],"select":[{"field":"organization"},{"field":"repository-slug","as":"repository"},{"field":"repository-dashboard-link","as":"repository-link"}],"order-by":[{"field":"repository","direction":"asc"}]},{"name":"repository-activity-core","subject":"Join each repository with its workflow, report, and run totals.","objective":"Attach retained workflow, report, and run aggregates to each repository for bounded inventory review.","acceptance":"Preserve each repository and the available joined aggregates by organization and repository; unmatched metrics remain missing evidence, not confirmed zero activity or evaluated outcomes.","description":"Repository inventory joined with workflow, report, evaluation, and run totals.","from":"repositories","joins":[{"source":"repository-workflow-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"workflows","as":"observed-workflows"},{"field":"disabled","as":"observed-disabled"}]},{"source":"repository-report-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"reports","as":"observed-reports"}]},{"source":"repository-run-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"failed","as":"observed-failed"},{"field":"action-required","as":"observed-action-required"},{"field":"imported-runs","as":"observed-imported-runs"}]}]},{"name":"repository-activity","subject":"Show repository-level execution health, outcome activity, and AI Credit usage in an actionable inventory.","objective":"Prioritize repository drill-down using declared workflows, observed runs, reports, failures, import coverage, and AIC.","acceptance":"Return repository identity and link with retained counts, ingestion indicator, failure summary, AIC, and computed status; statuses describe retained evidence only, and an empty or unavailable preview cannot verify health, outcomes, or zero activity.","description":"Repository-local execution health and attributed outcome totals.","from":"repository-activity-core","joins":[{"source":"repository-aic-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"aic","as":"observed-aic"}]}],"compute":[{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflows","function":"coalesce","args":[{"field":"observed-workflows"},{"value":0}]},{"as":"disabled","function":"coalesce","args":[{"field":"observed-disabled"},{"value":0}]},{"as":"runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"failed","function":"coalesce","args":[{"field":"observed-failed"},{"value":0}]},{"as":"imported-runs","function":"coalesce","args":[{"field":"observed-imported-runs"},{"value":0}]},{"as":"ingestion-rate","function":"quotient","args":[{"field":"imported-runs"},{"field":"runs"}]},{"as":"ingestion","function":"format-percent","args":[{"field":"ingestion-rate"}]},{"as":"action-required","function":"coalesce","args":[{"field":"observed-action-required"},{"value":0}]},{"as":"aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]},{"as":"has-failures","function":"greater-than","args":[{"field":"failed"},{"value":0}]},{"as":"has-action-required","function":"greater-than","args":[{"field":"action-required"},{"value":0}]},{"as":"has-runs","function":"greater-than","args":[{"field":"runs"},{"value":0}]},{"as":"has-disabled","function":"greater-than","args":[{"field":"disabled"},{"value":0}]},{"as":"outcomes-observed","function":"coalesce","args":[{"field":"observed-reports"},{"value":0}]},{"as":"has-outcomes","function":"greater-than","args":[{"field":"outcomes-observed"},{"value":0}]},{"as":"failure-rate","function":"quotient","args":[{"field":"failed"},{"field":"runs"}]},{"as":"failure-percent","function":"format-percent","args":[{"field":"failure-rate"}]},{"as":"failure-count","function":"format-count","args":[{"field":"failed"}]},{"as":"observed-failure-summary","function":"concat","args":[{"field":"failure-percent"},{"value":" · "},{"field":"failure-count"},{"value":" failed"}]},{"as":"failure-summary","function":"if","args":[{"field":"has-runs"},{"field":"observed-failure-summary"},{"value":"—"}]},{"as":"outcome-status","function":"if","args":[{"field":"has-outcomes"},{"value":"Outcomes observed"},{"value":"No recent activity"}]},{"as":"disabled-status","function":"if","args":[{"field":"has-disabled"},{"value":"Disabled workflows"},{"field":"outcome-status"}]},{"as":"run-status","function":"if","args":[{"field":"has-runs"},{"value":"No failures observed"},{"field":"disabled-status"}]},{"as":"action-status","function":"if","args":[{"field":"has-action-required"},{"value":"Approval required"},{"field":"run-status"}]},{"as":"status","function":"if","args":[{"field":"has-failures"},{"value":"Needs attention"},{"field":"action-status"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-slug"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-slug"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-slug"}]}],"select":[{"field":"organization"},{"field":"repository","as":"repository-name"},{"field":"repository-slug","as":"repository"},{"field":"workflows"},{"field":"observed-reports","as":"reports"},{"field":"runs"},{"field":"ingestion"},{"field":"failure-summary"},{"field":"aic"},{"field":"status"},{"field":"repository-dashboard-link","as":"repository-link"},{"field":"failed"}],"order-by":[{"field":"failed","direction":"desc"},{"field":"runs","direction":"desc"},{"field":"repository","direction":"asc"}]},{"name":"repository-daily-run-buckets","subject":"Select repository run counts by whole UTC start-day buckets.","objective":"Keep count selection independent of retained Run detail.","acceptance":"Use UTC midnight and request bounds, matching the Runs daily chart; do not fabricate sub-day totals or missing days.","from":"daily-run-counts","compute":[{"as":"day-midnight","function":"concat","args":[{"field":"day"},{"value":"T00:00:00Z"}]},{"as":"day-ms","function":"timestamp","args":[{"field":"day-midnight"}]},{"as":"start-ms","function":"timestamp","args":[{"context":"time-start"}]},{"as":"end-ms","function":"timestamp","args":[{"context":"time-end"}]},{"as":"before-start","function":"greater-than","args":[{"field":"start-ms"},{"field":"day-ms"}]},{"as":"before-end","function":"greater-than","args":[{"field":"end-ms"},{"field":"day-ms"}]}]},{"name":"repository-observed-run-counts","subject":"Count observed logical Runs by repository from persistent daily buckets.","objective":"Supply the run-volume chart without computing activity health, ingestion coverage, or workflow costs.","acceptance":"Sum daily totals, not attempts or retained detail. Select whole UTC start-day buckets by midnight and preserve partial or unavailable coverage.","from":"repository-daily-run-buckets","filter":{"predicates":[{"field":"before-start","in":[false,null]},{"field":"before-end","in":[true,null]}]},"compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]}],"aggregate":{"by":["organization","repository-coordinate"],"values":[{"field":"total","as":"runs","reducer":"sum"}]}},{"name":"repository-run-inventory","subject":"Registered repositories and observed daily logical Run counts.","objective":"Compare repository execution volume and choose repositories for drill-down.","acceptance":"Keep top 100 identities and drill links with stable count and repository ordering. Zero means no admitted dated Runs in selected UTC buckets, not inactivity. Preserve partial coverage; unavailable daily evidence must not produce zeros. Table keeps full inventory.","from":"repository-activity-preview","joins":[{"source":"repository-observed-run-counts","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository-coordinate"}],"fields":[{"field":"runs","as":"observed-runs"}]}],"compute":[{"as":"runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"runs"},{"field":"repository-link"}],"order-by":[{"field":"runs","direction":"desc"},{"field":"repository","direction":"asc"}],"limit":100},{"name":"workflow-route-record","subject":"Project the selected workflow's identity and registration for its route shell.","objective":"Identify the workflow and its recorded campaign registration before inspecting route-specific evidence.","acceptance":"Preserve organization, repository, workflow identity, recorded role, activation, campaign, rollout mode, and source link; absent registration is not inferred from runs, and displayed activation does not grant execution authority.","from":"workflows","select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"workflow-active"},{"field":"campaign"},{"field":"campaign-name"},{"field":"rollout-mode"},{"field":"workflow-link"}]},{"name":"workflow-runtime-health-summary","subject":"Sum daily runtime conclusion counts for the selected workflow.","objective":"Inspect observed dated runs independently of retained detail.","acceptance":"Sum by organization/repository/workflow without adding detail; successful, failed, approval, pending, and other sum to total. Dates use UTC run start; undated evidence is incomplete and missing projection is unavailable. Pending is last-observed state, success is not a verified outcome, and sub-day filters are unsupported.","from":"daily-run-counts","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"total","as":"total","reducer":"sum"},{"field":"successful","as":"successful","reducer":"sum"},{"field":"failed","as":"failed","reducer":"sum"},{"field":"approval","as":"approval","reducer":"sum"},{"field":"pending","as":"pending","reducer":"sum"},{"field":"other","as":"other","reducer":"sum"}]}},{"name":"workflow-runtime-usage-summary","subject":"Sum retained AI Credits and count telemetry rows for the selected workflow without transferring runs.","objective":"Inspect a workflow's observed AI Credit consumption together with the amount of retained usage telemetry.","acceptance":"AI Credits sum the retained aic values within each organization, repository, and workflow, and telemetry-count counts its usage records; absent telemetry does not establish zero cost or complete run coverage.","from":"usage","compute":[{"as":"positive-aic","function":"greater-than","args":[{"field":"aic"},{"value":0}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"aic","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"run","as":"telemetry-count","reducer":"count"}]}},{"name":"outcome-route-record","subject":"Project the selected safe-output record for the outcome route and its sections.","objective":"Inspect a retained safe output's recorded disposition and follow its durable evidence links.","acceptance":"Preserve safe-output and run identity, title, category, disposition, summary, timestamps, rollout mode, workflow context, and retained links; missing fields stay unknown and a recorded disposition is not independently verified operational impact.","from":"outcomes","select":[{"field":"safe-output"},{"field":"run"},{"field":"outcome-title"},{"field":"outcome-number"},{"field":"outcome-category"},{"field":"outcome-status"},{"field":"outcome-state"},{"field":"outcome-summary"},{"field":"published-at"},{"field":"observed-at"},{"field":"rollout-mode"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-link"},{"field":"external-link"},{"field":"issue-link"},{"field":"pull-request-link"},{"field":"run-link"}]},{"name":"entity-runs","subject":"Project run entities for reusable run cards and workflow drill-down.","objective":"Expose retained run-attempt identity, execution timing, conclusion, and link for a bounded workflow-run inspection.","acceptance":"Keep organization, repository, workflow, run and attempt with status, conclusion, event, branch, duration, timestamps, and run link; missing timing or conclusion remains unknown rather than inferred success.","from":"runs","select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"target-repository"},{"field":"run"},{"field":"run-attempt"},{"field":"run-title"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"event"},{"field":"branch"},{"field":"duration"},{"field":"started-at"},{"field":"ended-at"},{"field":"run-link"}],"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"workflow-runs","subject":"Project canonical runs into route-addressable workflow run evidence.","objective":"Trace retained runs and recorded failure evidence for a selected workflow route.","acceptance":"Preserve workflow route, run identity, start/end, status, conclusion, failure fields, mode, engine/model metadata, and run link; missing failure details do not prove success or rule out incomplete import.","description":"Workflow runs with a stable repository and workflow route key.","from":"runs","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-route","function":"concat","args":[{"field":"repository-coordinate"},{"value":":"},{"field":"workflow"}]}],"select":[{"field":"workflow-route"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-title"},{"field":"event"},{"field":"started-at"},{"field":"ended-at"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"failure-job"},{"field":"failure-message"},{"field":"failure-step"},{"field":"failure-log"},{"field":"rollout-mode"},{"field":"engine"},{"field":"engine-version"},{"field":"gh-aw-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"run-link"}],"order-by":[{"field":"started-at","direction":"desc"},{"field":"run","direction":"desc"}]},{"name":"workflow-failure-trend","subject":"Show recent failure counts and their change for each workflow.","objective":"Spot a change in observed workflow failure activity without treating unknown conclusions as failures.","acceptance":"Each observed failure counts once within its own workflow; the first change is undefined and the seven-observation window is not a seven-day calendar interval.","from":"workflow-runs","compute":[{"as":"is-failure","function":"equals-any","args":[{"field":"run-conclusion"},{"value":"failure"},{"value":"timed_out"}]},{"as":"failure-count","function":"if","args":[{"field":"is-failure"},{"value":1},{"value":0}]}],"window":[{"operation":"rolling","field":"failure-count","as":"recent-failure-count","frame":7,"reducer":"sum","order-by":[{"field":"started-at","direction":"asc"},{"field":"run","direction":"asc"}],"groupby":["workflow-route"]},{"operation":"change","field":"recent-failure-count","as":"failure-count-change","mode":"absolute","order-by":[{"field":"started-at","direction":"asc"},{"field":"run","direction":"asc"}],"groupby":["workflow-route"]}]},{"name":"workflow-reports","subject":"Project retained outcomes into route-addressable workflow reports.","objective":"Review retained workflow outcome reports separately from execution status before interpreting operational results.","acceptance":"Keep route, safe output, report title and summary, recorded status, category, observation time, metadata, and external link; missing reports or status do not imply success or no work.","description":"Workflow outcome reports with stable route keys and disposition fields.","from":"outcomes","compute":[{"as":"report-repository","function":"coalesce","args":[{"field":"runtime-repository"},{"field":"repository"}]},{"as":"workflow-route","function":"concat","args":[{"field":"report-repository"},{"value":":"},{"field":"workflow"}]},{"as":"report-status","function":"coalesce","args":[{"field":"outcome-status"},{"field":"outcome-state"},{"value":"unknown"}]}],"select":[{"field":"workflow-route"},{"field":"safe-output"},{"field":"outcome-title"},{"field":"outcome-summary"},{"field":"report-status","as":"outcome-status"},{"field":"rollout-mode"},{"field":"engine"},{"field":"engine-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"outcome-category"},{"field":"observed-at"},{"field":"external-link"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"outcome-title","direction":"asc"}]},{"name":"value-measurement-facts","subject":"Original native primary and diagnostic observations from reviewed batch evaluators.","objective":"Keep periods, native units, evaluator identity and missingness inspectable without inventing delivery events.","acceptance":"Null is unavailable, not zero. Interval measurements are not snapshots or cumulative accepted contributions.","from":"workflow-value-measurements","time":{"range":"all"},"compute":[{"as":"measurement-marker","function":"literal","args":[{"value":1}]},{"as":"measurement-missing","function":"equals-any","args":[{"field":"value"},{"value":null}]},{"as":"known-measurement","function":"concat","args":[{"field":"value"},{"value":" "},{"field":"metric-unit"}]},{"as":"measurement-label","function":"if","args":[{"field":"measurement-missing"},{"value":"Not measured"},{"field":"known-measurement"}]},{"as":"measurement-context","function":"concat","args":[{"field":"repository"},{"value":" · "},{"field":"workflow-name"}]}]},{"name":"value-measurement-order","subject":"Latest assessment of each workflow measure, including unavailable assessments.","objective":"Do not let an older numeric value hide a newer incomplete period.","acceptance":"Choose latest cutoff and assessment before considering value or coverage; preserve evaluator digest.","from":"value-measurement-facts","window":[{"operation":"change","field":"measurement-marker","as":"older-measurement","mode":"absolute","groupby":["repository","workflow-route","workflow-slug","campaign","value-id"],"order-by":[{"field":"window-end","direction":"desc"},{"field":"observed-at","direction":"desc"}]}]},{"name":"value-current-measurements","subject":"Latest native primary measurements, separately from event-ledger reports.","objective":"Expose ordinary reviewed batch results on the same Value surface.","acceptance":"Do not infer healthy outcomes, accepted implementations or complete coverage from a non-null value.","from":"value-measurement-order","filter":{"predicates":[{"field":"older-measurement","equals":"unknown"},{"field":"metric-role","equals":"primary"}]}},{"name":"value-evidence-facts","subject":"Published original evidence for frozen workflow value contracts.","objective":"Keep report identity, target repository, workflow and capture together.","acceptance":"Read canonical evidence only. No GitHub acquisition, HTML loading or fabricated evidence on navigation.","from":"operational-value-evidence","time":{"range":"all"}},{"name":"value-contracts","subject":"One retained contract per repository, workflow and versioned native measure.","objective":"Compute each report independently before selecting current workflow results.","acceptance":"Preserve separate versions and exact report identity. Latest-version selection belongs to the workflow result query.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"contract"}]},"compute":[{"as":"report-marker","function":"literal","args":[{"value":1}]}]},{"name":"value-measurement-captures","subject":"Accepted complete native batch assessments, separately from collection decisions.","objective":"Expose actual retained capture clocks without advancing them on failure or partial data.","acceptance":"Only mature complete non-null primary assessments establish an accepted capture; zero remains valid.","from":"value-measurement-facts","filter":{"predicates":[{"field":"metric-role","equals":"primary"},{"field":"measurement-missing","equals":false},{"field":"coverage-status","equals":"complete"},{"field":"maturity-status","equals":"matured"}]},"compute":[{"as":"report-marker","function":"literal","args":[{"value":1}]}],"select":[{"field":"workflow-route"},{"field":"observed-at"},{"field":"window-end"},{"field":"id","as":"capture-id"},{"field":"report-marker"}]},{"name":"value-contract-captures","subject":"Original capture clocks from accepted rich evidence packets.","objective":"Align capture metadata without merging measured populations.","acceptance":"This union is capture metadata only, never combined metric totals.","from":"value-contracts","select":[{"field":"workflow-route"},{"field":"observed-at"},{"field":"window-end"},{"field":"report-id","as":"capture-id"},{"field":"report-marker"}]},{"name":"value-capture-order","subject":"Actual captures across the retained measures of each workflow.","objective":"Expose the last accepted capture independently of collection decisions.","acceptance":"Select by original capture time. A deferred or failed check cannot advance evidence clocks.","from":"value-contract-captures","union":["value-measurement-captures"],"window":[{"operation":"change","field":"report-marker","as":"later-capture","mode":"absolute","groupby":["workflow-route"],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"capture-id","direction":"desc"}]}]},{"name":"value-latest-capture","subject":"One last accepted capture per workflow, not a freshness claim.","objective":"Join capture and cutoff without multiplying collection registrations.","acceptance":"Missing packets remain unavailable, never zero or an inferred successful collection.","from":"value-capture-order","filter":{"predicates":[{"field":"later-capture","equals":"unknown"}]}},{"name":"value-collection-health","subject":"Reviewed registration and authoritative collection decisions, with independently retained evidence.","objective":"Explain disabled, unconfigured, deferred, failed and not-yet-captured workflows.","acceptance":"Use published collector facts, not missing result cards. Preserve decision, attempt, capture and cutoff as distinct clocks.","from":"workflow-value-collections","time":{"range":"all"},"joins":[{"source":"value-latest-capture","type":"left","on":[{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"observed-at","as":"captured-at"},{"field":"window-end","as":"evidence-cutoff"}]}],"compute":[{"as":"workflow-context","function":"concat","args":[{"field":"workflow"},{"value":" · "},{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"capture-missing","function":"equals-any","args":[{"field":"captured-at"},{"value":null}]},{"as":"evidence-state","function":"if","args":[{"field":"capture-missing"},{"value":"No retained capture"},{"value":"Retained evidence available"}]}],"order-by":[{"field":"organization","direction":"asc"},{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"value-registered-collections","subject":"Reviewed Value registrations, including explicit disables and registrations with no report.","objective":"Make collection health visible before the first accepted packet.","acceptance":"Registration is independent of measured outcomes. No enrollment or acquisition follows from navigation.","from":"value-collection-health","filter":{"predicates":[{"field":"registration","in":["enabled","disabled"]}]},"limit":1000},{"name":"value-snapshots","subject":"Independent repository-state observations and exact item drill-downs.","objective":"Keep everyone's changes separate from workflow-linked delivery.","acceptance":"Retain observed native values, dates and immutable references. Do not invent intermediate observations.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"snapshot"}]},"compute":[{"as":"snapshot-marker","function":"literal","args":[{"value":1}]},{"as":"encoded-snapshot","function":"url-encode","args":[{"field":"snapshot-route"}]},{"as":"snapshot-href","function":"concat","args":[{"value":"#page-value-snapshot?snapshot="},{"field":"encoded-snapshot"}]}],"order-by":[{"field":"at","direction":"asc"},{"field":"fact-id","direction":"asc"}]},{"name":"value-first-snapshot-order","subject":"First independently observed repository state.","objective":"Name the actual first-snapshot reference rather than an invented baseline.","acceptance":"Strictly use retained snapshot time. A post-adoption snapshot is not a pre-adoption baseline.","from":"value-snapshots","window":[{"operation":"change","field":"snapshot-marker","as":"earlier-snapshot","mode":"absolute","groupby":["report-id","workflow-route"],"order-by":[{"field":"at","direction":"asc"}]}]},{"name":"value-first-snapshot","subject":"First retained snapshot per report.","objective":"Provide the explicit reference value and date.","acceptance":"No retained reference means no comparison.","from":"value-first-snapshot-order","filter":{"predicates":[{"field":"earlier-snapshot","equals":"unknown"}]}},{"name":"value-last-snapshot-order","subject":"Latest independently observed repository state.","objective":"Show the actual last measurement rather than an extrapolation.","acceptance":"Preserve the latest retained snapshot even if unchanged.","from":"value-snapshots","window":[{"operation":"change","field":"snapshot-marker","as":"later-snapshot","mode":"absolute","groupby":["report-id","workflow-route"],"order-by":[{"field":"at","direction":"desc"}]}]},{"name":"value-last-snapshot","subject":"Last retained snapshot per report.","objective":"Provide the current native observation.","acceptance":"One snapshot establishes state, not movement.","from":"value-last-snapshot-order","filter":{"predicates":[{"field":"later-snapshot","equals":"unknown"}]}},{"name":"value-output-counts","subject":"Retained safe outputs and applied creation receipts.","objective":"Describe output activity without treating it as accepted value.","acceptance":"Count distinct validated output facts. Tracking corroboration is not an applied receipt.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"output"}]},"aggregate":{"by":["report-id","workflow-route"],"values":[{"field":"fact-id","as":"retained-outputs","reducer":"count"},{"field":"fact-id","as":"receipt-outputs","reducer":"count","filter":{"predicates":[{"field":"origin","equals":"receipt-verified"}]}}]}},{"name":"value-implementation-counts","subject":"Distinct accepted implementations and their measured native effects.","objective":"Count each accepted implementation once, including zero and negative effects.","acceptance":"Validated implementation identities are unique; many-to-many output edges must not multiply value. Complete coverage is checked separately.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"implementation"}]},"compute":[{"as":"accepted-ms","function":"timestamp","args":[{"field":"at"}]},{"as":"cutoff-ms","function":"timestamp","args":[{"field":"window-end"}]},{"as":"current-start","function":"difference","args":[{"field":"cutoff-ms"},{"value":2419200000}]},{"as":"previous-start","function":"difference","args":[{"field":"cutoff-ms"},{"value":4838400000}]},{"as":"before-current","function":"greater-than","args":[{"field":"current-start"},{"field":"accepted-ms"}]},{"as":"before-previous","function":"greater-than","args":[{"field":"previous-start"},{"field":"accepted-ms"}]},{"as":"current-effect","function":"if","args":[{"field":"before-current"},{"value":0},{"field":"value"}]},{"as":"previous-candidate","function":"if","args":[{"field":"before-previous"},{"value":0},{"field":"value"}]},{"as":"previous-effect","function":"if","args":[{"field":"before-current"},{"field":"previous-candidate"},{"value":0}]}],"aggregate":{"by":["report-id","workflow-route"],"values":[{"field":"fact-id","as":"accepted-implementations","reducer":"count"},{"field":"value","as":"known-result","reducer":"sum"},{"field":"current-effect","as":"known-recent","reducer":"sum"},{"field":"previous-effect","as":"known-previous","reducer":"sum"}]}},{"name":"value-covered-durations","subject":"Explicit complete evidence durations in the report and adjacent 28-day delivery periods.","objective":"Distinguish known zero from gaps or incomplete evidence.","acceptance":"The producer validates non-overlapping bounded coverage. Count only complete intervals, clipped to each exact half-open period.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"coverage"},{"field":"coverage-status","equals":"complete"}]},"compute":[{"as":"left-ms","function":"timestamp","args":[{"field":"at"}]},{"as":"right-ms","function":"timestamp","args":[{"field":"end-at"}]},{"as":"cutoff-ms","function":"timestamp","args":[{"field":"window-end"}]},{"as":"current-start","function":"difference","args":[{"field":"cutoff-ms"},{"value":2419200000}]},{"as":"previous-start","function":"difference","args":[{"field":"cutoff-ms"},{"value":4838400000}]},{"as":"after-current","function":"greater-than","args":[{"field":"left-ms"},{"field":"current-start"}]},{"as":"after-previous","function":"greater-than","args":[{"field":"left-ms"},{"field":"previous-start"}]},{"as":"before-current-end","function":"greater-than","args":[{"field":"current-start"},{"field":"right-ms"}]},{"as":"current-left","function":"if","args":[{"field":"after-current"},{"field":"left-ms"},{"field":"current-start"}]},{"as":"previous-left","function":"if","args":[{"field":"after-previous"},{"field":"left-ms"},{"field":"previous-start"}]},{"as":"previous-right","function":"if","args":[{"field":"before-current-end"},{"field":"right-ms"},{"field":"current-start"}]},{"as":"duration","function":"difference","args":[{"field":"right-ms"},{"field":"left-ms"}]},{"as":"current-duration","function":"difference","args":[{"field":"right-ms"},{"field":"current-left"}]},{"as":"previous-duration","function":"difference","args":[{"field":"previous-right"},{"field":"previous-left"}]},{"as":"positive-current","function":"greater-than","args":[{"field":"current-duration"},{"value":0}]},{"as":"positive-previous","function":"greater-than","args":[{"field":"previous-duration"},{"value":0}]},{"as":"covered-current","function":"if","args":[{"field":"positive-current"},{"field":"current-duration"},{"value":0}]},{"as":"covered-previous","function":"if","args":[{"field":"positive-previous"},{"field":"previous-duration"},{"value":0}]}],"aggregate":{"by":["report-id","workflow-route"],"values":[{"field":"duration","as":"covered-duration","reducer":"sum"},{"field":"covered-current","as":"covered-current","reducer":"sum"},{"field":"covered-previous","as":"covered-previous","reducer":"sum"}]}},{"name":"value-report-delivery","subject":"Evidence-qualified output and accepted-contribution totals.","objective":"Keep populations and native units separate without an implied conversion rate.","acceptance":"Absent output context is unknown. Missing coverage withholds complete totals and recent zero, retaining labelled known subtotals.","from":"value-contracts","joins":[{"source":"value-output-counts","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"retained-outputs","as":"retained-outputs"},{"field":"receipt-outputs","as":"retained-receipts"}]},{"source":"value-implementation-counts","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"accepted-implementations","as":"retained-implementations"},{"field":"known-result","as":"known-result"},{"field":"known-recent","as":"known-recent"},{"field":"known-previous","as":"known-previous"}]},{"source":"value-covered-durations","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"covered-duration","as":"covered-duration"},{"field":"covered-current","as":"covered-current"},{"field":"covered-previous","as":"covered-previous"}]}],"compute":[{"as":"start-ms","function":"timestamp","args":[{"field":"window-start"}]},{"as":"end-ms","function":"timestamp","args":[{"field":"window-end"}]},{"as":"report-duration","function":"difference","args":[{"field":"end-ms"},{"field":"start-ms"}]},{"as":"complete-report","function":"equals-any","args":[{"field":"covered-duration"},{"field":"report-duration"}]},{"as":"complete-current","function":"equals-any","args":[{"field":"covered-current"},{"value":2419200000}]},{"as":"complete-previous","function":"equals-any","args":[{"field":"covered-previous"},{"value":2419200000}]},{"as":"show-workflow-trail","function":"equals-any","args":[{"field":"measurement-basis"},{"value":"workflow-contribution"}]},{"as":"known-output-count","function":"coalesce","args":[{"field":"retained-outputs"},{"value":0}]},{"as":"known-receipt-count","function":"coalesce","args":[{"field":"retained-receipts"},{"value":0}]},{"as":"receipt-outputs","function":"if","args":[{"field":"outputs-available"},{"field":"known-receipt-count"},{"value":null}]},{"as":"accepted-implementations","function":"coalesce","args":[{"field":"retained-implementations"},{"value":0}]},{"as":"output-count","function":"if","args":[{"field":"outputs-available"},{"field":"known-output-count"},{"value":null}]},{"as":"native-result","function":"coalesce","args":[{"field":"known-result"},{"value":0}]},{"as":"current-subtotal","function":"coalesce","args":[{"field":"known-recent"},{"value":0}]},{"as":"previous-subtotal","function":"coalesce","args":[{"field":"known-previous"},{"value":0}]},{"as":"recent-result","function":"if","args":[{"field":"complete-current"},{"field":"current-subtotal"},{"value":null}]},{"as":"previous-result","function":"if","args":[{"field":"complete-previous"},{"field":"previous-subtotal"},{"value":null}]}]},{"name":"value-report-summary","subject":"Shared native card and report comparison against the first retained snapshot.","objective":"Show signed repository-wide movement, the goal direction and the exact comparison dates.","acceptance":"This first/last snapshot comparison is not the adjacent-period alert policy, a pre-adoption baseline or causal workflow credit. One snapshot is not zero change.","from":"value-report-delivery","joins":[{"source":"value-first-snapshot","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"value","as":"reference-value"},{"field":"at","as":"reference-at"}]},{"source":"value-last-snapshot","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"value","as":"current-value"},{"field":"at","as":"current-at"},{"field":"snapshot-href","as":"current-snapshot-href"}]}],"compute":[{"as":"same-snapshot","function":"equals-any","args":[{"field":"reference-at"},{"field":"current-at"}]},{"as":"raw-change","function":"difference","args":[{"field":"current-value"},{"field":"reference-value"}]},{"as":"native-change","function":"if","args":[{"field":"same-snapshot"},{"value":null},{"field":"raw-change"}]},{"as":"change-missing","function":"equals-any","args":[{"field":"native-change"},{"value":null}]},{"as":"rising","function":"greater-than","args":[{"field":"native-change"},{"value":0}]},{"as":"falling","function":"greater-than","args":[{"value":0},{"field":"native-change"}]},{"as":"unchanged","function":"equals-any","args":[{"field":"native-change"},{"value":0}]},{"as":"decrease-goal","function":"equals-any","args":[{"field":"snapshot-direction"},{"value":"decrease"}]},{"as":"increase-goal","function":"equals-any","args":[{"field":"snapshot-direction"},{"value":"increase"}]},{"as":"increase-movement","function":"if","args":[{"field":"rising"},{"value":"Better"},{"value":"Worse"}]},{"as":"decrease-movement","function":"if","args":[{"field":"falling"},{"value":"Better"},{"value":"Worse"}]},{"as":"directed-movement","function":"if","args":[{"field":"decrease-goal"},{"field":"decrease-movement"},{"field":"increase-movement"}]},{"as":"known-movement","function":"if","args":[{"field":"unchanged"},{"value":"Unchanged"},{"field":"directed-movement"}]},{"as":"movement","function":"if","args":[{"field":"change-missing"},{"value":"Comparison unavailable"},{"field":"known-movement"}]},{"as":"increase-direction-label","function":"if","args":[{"field":"increase-goal"},{"value":"↑ Higher is better"},{"value":"Direction not retained"}]},{"as":"direction-label","function":"if","args":[{"field":"decrease-goal"},{"value":"↓ Lower is better"},{"field":"increase-direction-label"}]},{"as":"change-arrow","function":"if","args":[{"field":"rising"},{"value":"↑ +"},{"value":"↓ "}]},{"as":"change-number","function":"format-count","args":[{"field":"native-change"}]},{"as":"directional-delta","function":"concat","args":[{"field":"change-arrow"},{"field":"change-number"},{"value":" "},{"field":"snapshot-unit"}]},{"as":"known-delta","function":"if","args":[{"field":"unchanged"},{"value":"Unchanged"},{"field":"directional-delta"}]},{"as":"delta-label","function":"if","args":[{"field":"change-missing"},{"value":"Comparison unavailable"},{"field":"known-delta"}]},{"as":"signed-change","function":"concat","args":[{"field":"change-arrow"},{"field":"change-number"},{"value":" "},{"field":"snapshot-unit"},{"value":" · "},{"field":"movement"}]},{"as":"unchanged-change","function":"if","args":[{"field":"unchanged"},{"value":"Unchanged"},{"field":"signed-change"}]},{"as":"change-label","function":"if","args":[{"field":"change-missing"},{"value":"Comparison unavailable"},{"field":"unchanged-change"}]},{"as":"reference-day","function":"date-day","args":[{"field":"reference-at"}]},{"as":"known-comparison-label","function":"concat","args":[{"value":"Since "},{"field":"reference-day"},{"value":" · Everyone's work"}]},{"as":"comparison-label","function":"if","args":[{"field":"change-missing"},{"value":"No earlier snapshot for comparison"},{"field":"known-comparison-label"}]},{"as":"workflow-label","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"workflow-context","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":" · "},{"field":"workflow-label"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-route"}]},{"as":"workflow-value-href","function":"concat","args":[{"value":"#page-workflow-value?workflow="},{"field":"encoded-workflow"}]},{"as":"encoded-report","function":"url-encode","args":[{"field":"report-id"}]},{"as":"report-href","function":"concat","args":[{"value":"#page-value-report?report="},{"field":"encoded-report"}]}]},{"name":"value-workflow-result-order","subject":"Version ordering after independently computing each report.","objective":"Keep exact report queries partition-local without changing latest-version selection.","acceptance":"Rank cutoffs then captures within each workflow and measure. Explicit report links do not need other report facts.","from":"value-report-summary","window":[{"operation":"change","field":"report-marker","as":"older-report","mode":"absolute","groupby":["organization","repository","workflow","workflow-route","metric-id"],"order-by":[{"field":"window-end","direction":"desc"},{"field":"observed-at","direction":"desc"},{"field":"report-id","direction":"desc"}]}]},{"name":"value-workflow-results","subject":"Current published report results per native measure.","objective":"Expose the latest coherent packet on the workflow Value tab.","acceptance":"Never replace missing facts with an older measured version. Explicit report links retain their own version.","from":"value-workflow-result-order","filter":{"predicates":[{"field":"older-report","equals":"unknown"}]}},{"name":"value-workflow-headline-order","subject":"Most recent current report across the measures of each workflow.","objective":"Give each workflow and repository one headline result; other measures stay on the workflow page.","acceptance":"Select by cutoff then capture. Never replace a missing result with an older or zero value.","from":"value-workflow-results","window":[{"operation":"change","field":"report-marker","as":"older-headline","mode":"absolute","groupby":["workflow-route"],"order-by":[{"field":"window-end","direction":"desc"},{"field":"observed-at","direction":"desc"},{"field":"report-id","direction":"desc"}]}]},{"name":"value-workflow-headlines","subject":"One headline result per workflow and repository.","objective":"Join cleanly to collection health without multiplying rows.","acceptance":"Exactly one row per workflow route.","from":"value-workflow-headline-order","filter":{"predicates":[{"field":"older-headline","equals":"unknown"}]}},{"name":"value-workflow-reported-overview","subject":"Workflows with a retained headline result, with any published collection state.","objective":"Show a report even when no collection fact was published for its workflow.","acceptance":"A missing collection fact stays unknown, never an inferred registration.","from":"value-workflow-headlines","joins":[{"source":"value-collection-health","type":"left","on":[{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"collection-state","as":"overview-state"},{"field":"reason","as":"overview-reason"}]}],"compute":[{"as":"overview-title","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":" · "},{"field":"workflow-label"}]},{"as":"overview-evidence","function":"literal","args":[{"value":"Retained evidence available"}]}],"select":[{"field":"workflow-route"},{"field":"overview-title"},{"field":"overview-state"},{"field":"overview-reason"},{"field":"overview-evidence"},{"field":"observed-at","as":"overview-captured"},{"field":"window-end","as":"overview-cutoff"},{"field":"change-label","as":"trend-label"},{"field":"movement","as":"trend-movement"},{"field":"snapshot-name","as":"trend-measure"},{"field":"report-href","as":"overview-href"}]},{"name":"value-workflow-registered-reports","subject":"Registered workflows marked with whether a headline result exists.","objective":"Separate registration from retained outcomes before selecting unreported workflows.","acceptance":"Join on workflow route only; one row per registration.","from":"value-registered-collections","joins":[{"source":"value-workflow-headlines","type":"left","on":[{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"report-id","as":"headline-report"}]}],"compute":[{"as":"has-report","function":"equals-any","args":[{"field":"headline-report"},{"value":null}]}]},{"name":"value-workflow-unreported-overview","subject":"Registered workflows that have no retained headline result.","objective":"Keep collection health visible before the first accepted packet.","acceptance":"No result is not zero value or a healthy outcome.","from":"value-workflow-registered-reports","filter":{"predicates":[{"field":"has-report","equals":true}]},"compute":[{"as":"overview-title","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":" · "},{"field":"workflow"}]},{"as":"trend-label","function":"literal","args":[{"value":"No retained result"}]},{"as":"trend-movement","function":"literal","args":[{"value":"No result to compare"}]},{"as":"trend-measure","function":"literal","args":[{"value":"Not available"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-route"}]},{"as":"overview-href","function":"concat","args":[{"value":"#page-workflow-value?workflow="},{"field":"encoded-workflow"}]}],"select":[{"field":"workflow-route"},{"field":"overview-title"},{"field":"collection-state","as":"overview-state"},{"field":"reason","as":"overview-reason"},{"field":"evidence-state","as":"overview-evidence"},{"field":"captured-at","as":"overview-captured"},{"field":"evidence-cutoff","as":"overview-cutoff"},{"field":"trend-label"},{"field":"trend-movement"},{"field":"trend-measure"},{"field":"overview-href"}]},{"name":"value-workflow-overview","subject":"One row per workflow and repository: collection health plus its headline result trend.","objective":"Show the first-to-last trend and collection state in a single card.","acceptance":"Missing reports remain unavailable, never zero. Registration and outcome stay independent facts.","from":"value-workflow-reported-overview","union":["value-workflow-unreported-overview"],"order-by":[{"field":"overview-title","direction":"asc"}],"limit":1000},{"name":"value-intent-sources","subject":"Immutable extracted workflow intent sources.","objective":"Let readers inspect the original goal and requirements.","acceptance":"Only retained HTTPS evidence is linked; workflow text remains untrusted.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"intent-source"}]}},{"name":"value-requirements","subject":"Original full acceptance requirements.","objective":"Distinguish the measured structural facet from all workflow safeguards.","acceptance":"Requirements are source text, not proof they passed.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"requirement"}]}},{"name":"value-outputs","subject":"Retained safe-output lifecycle facts.","objective":"Show receipts, current-at-cutoff state and originating evidence.","acceptance":"A closed output is not automatically an accepted implementation; absence of a link is unknown.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"output"}]},"order-by":[{"field":"at","direction":"desc"},{"field":"fact-id","direction":"asc"}]},{"name":"value-output-origin-evidence","subject":"Retained producer and applied safe-output evidence.","objective":"Let readers distinguish receipt-confirmed creation from corroborated tracking.","acceptance":"Tracking identities locate outputs but do not establish accepted value. Keep unavailable producer evidence explicit.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"output-evidence"}]},"joins":[{"source":"value-outputs","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"parent-id","right":"fact-id"}],"fields":[{"field":"label","as":"output-label"},{"field":"url","as":"output-url"}]}]},{"name":"value-implementations","subject":"Accepted implementations and native before/after effects.","objective":"Expose delivery time and immutable acceptance evidence.","acceptance":"Do not equate acceptance with full quality verification or omit negative effects.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"implementation"}]},"order-by":[{"field":"at","direction":"desc"},{"field":"fact-id","direction":"asc"}]},{"name":"value-output-trails","subject":"Explicit output-to-implementation edges.","objective":"Make the trail from a proposal to an accepted measured change inspectable.","acceptance":"Use retained dated edges only. Many-to-many links do not duplicate headline counts or values.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"output-implementation"}]},"joins":[{"source":"value-outputs","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"parent-id","right":"fact-id"}],"fields":[{"field":"label","as":"output-label"},{"field":"url","as":"output-url"}]},{"source":"value-implementations","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"related-id","right":"fact-id"}],"fields":[{"field":"label","as":"implementation-label"},{"field":"url","as":"implementation-url"},{"field":"value","as":"implementation-value"},{"field":"at","as":"trail-accepted-at"}]}]},{"name":"value-implementation-files","subject":"Measured implementation files and retained lineage sources.","objective":"Link to exact Git facts rather than only a repository tree.","acceptance":"No URL is reconstructed from an unrelated revision. Preserve before, after and replacement file evidence.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","in":["implementation-evidence","implementation-lineage"]}]},"joins":[{"source":"value-implementations","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"parent-id","right":"fact-id"}],"fields":[{"field":"label","as":"implementation-label"},{"field":"url","as":"implementation-url"}]}]},{"name":"value-quality-checks","subject":"Explicit independent verification checks.","objective":"Keep unverified behavior, tests and other safeguards visible.","acceptance":"Missing or not-verified is not a passing check.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"quality-check"}]}},{"name":"value-limitations","subject":"Retained evidence and attribution limitations.","objective":"Qualify claims without inventing completeness.","acceptance":"Treat source limitations as untrusted text and never suppress them.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"limitation"}]}},{"name":"value-snapshot-items","subject":"Actual counted items at an independent immutable snapshot.","objective":"Open exact per-item evidence from the plotted observation.","acceptance":"Only retained items are shown. Missing item evidence must not look like an empty measured population.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"snapshot-item"}]},"joins":[{"source":"value-snapshots","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"parent-id","right":"fact-id"},{"left":"snapshot-route","right":"snapshot-route"}],"fields":[{"field":"at","as":"snapshot-at"}]}]},{"name":"audit-event-summary-buckets","subject":"Aggregate high- and medium-severity audit events with the same severity and summary by workflow.","objective":"Select recurring high- or medium-severity audit summaries for run-level investigation.","acceptance":"Each bucket's event count is traceable to retained audit or tool observations with the same campaign, severity, workflow, and summary; missing workflow attribution stays unknown, and a count alone does not verify impact.","description":"High- and medium-severity audit event counts grouped by severity, workflow, and shared summary.","from":"audits","union":["tools"],"filter":{"predicates":[{"field":"event-type","in":["audit.finding","audit.observability","audit.recommendation","audit.missing_tool","audit.missing_data","audit.noop","audit.mcp_failure","skill.invoked"]},{"field":"event-status","in":["high","medium"]}]},"joins":[{"source":"workflows","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"campaign"}]}],"aggregate":{"by":["campaign","event-status","workflow","event-summary"],"values":[{"field":"event","as":"events","reducer":"count"}]},"select":[{"field":"campaign"},{"field":"event-status"},{"field":"workflow"},{"field":"event-summary"},{"field":"events"}],"order-by":[{"field":"event-status","direction":"asc"},{"field":"events","direction":"desc"},{"field":"workflow","direction":"asc"},{"field":"event-summary","direction":"asc"}]},{"name":"campaign-workflows","subject":"List campaign-owned orchestrator and worker workflows with database-backed execution totals.","objective":"Choose an active campaign workflow whose observed execution warrants inspection.","acceptance":"Listed workflows match active declared orchestrator or worker inventory entries; runs and AI Credits agree with the selected-horizon inventory, and absence is not evidence of disabled authority or no executions. Rollout mode is context, not permission to change policy.","description":"Campaign workflows projected from lean canonical inventory, with shared declaration names and active-only workflow drill-down links.","from":"campaign-workflow-inventory","filter":{"predicates":[{"field":"workflow-active","equals":"true"}]},"compute":[{"as":"workflow-identity","function":"concat","args":[{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-identity"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-display-name"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-identity"}]}],"select":[{"field":"campaign"},{"field":"campaign-display-name","as":"campaign-name"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-role"},{"field":"rollout-mode"},{"field":"workflow-active"},{"field":"runs"},{"field":"aic"},{"field":"repository-dashboard-link","as":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"}],"order-by":[{"field":"campaign-name","direction":"asc"},{"field":"workflow-role","direction":"asc"},{"field":"workflow-name","direction":"asc"}]},{"name":"campaign-repository-declarations","subject":"List active declared campaign workflows and their owning repositories without execution evidence.","objective":"Inspect campaign repository topology without computing unused run totals or import coverage.","acceptance":"Preserve active orchestrator and worker identities, display names, rollout context, links, and ordering. Declaration counts are not target enrollment, dispatch coverage, or execution totals. Empty inventory and unavailable workflow evidence remain distinct.","description":"Declaration-only repository topology. Run totals and import-evidence quality belong to execution views, not this inventory.","from":"campaign-workflow-declarations","filter":{"predicates":[{"field":"workflow-active","equals":"true"}]},"select":[{"field":"campaign"},{"field":"campaign-display-name","as":"campaign-name"},{"field":"organization"},{"field":"repository-slug","as":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"workflow-active"},{"field":"repository-dashboard-link","as":"repository-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"campaign-repository-inventory","subject":"Present declared campaign repository topology in workflow display order.","objective":"Filter and search projected repository coordinates and workflow names without time-filtering structural declarations.","acceptance":"Preserve the campaign workflow list's stable ordering and declaration-only evidence quality; runtime horizons must not remove declared workflows.","from":"campaign-repository-declarations","order-by":[{"field":"campaign-name","direction":"asc"},{"field":"workflow-role","direction":"asc"},{"field":"workflow-name","direction":"asc"}]},{"name":"campaign-reports","subject":"Project retained outcomes into campaign-addressable report evidence.","objective":"Identify a campaign report whose durable outcome record needs follow-up.","acceptance":"Each report's campaign, title, source link, observation time, and disposition match its retained outcome; missing status is labeled unknown rather than accepted or resolved, and report production is not verified impact.","description":"Campaign outcome reports with database-backed disposition fields.","from":"outcomes","compute":[{"as":"report-status","function":"coalesce","args":[{"field":"outcome-status"},{"field":"outcome-state"},{"value":"unknown"}]}],"select":[{"field":"campaign"},{"field":"safe-output"},{"field":"outcome-title"},{"field":"outcome-summary"},{"field":"report-status","as":"outcome-status"},{"field":"rollout-mode"},{"field":"engine"},{"field":"engine-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"outcome-category"},{"field":"observed-at"},{"field":"external-link"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"outcome-title","direction":"asc"}]},{"name":"campaign-worker-issues","subject":"Project issue outcomes created by campaign worker workflows.","objective":"Choose a campaign worker issue whose current recorded disposition needs review.","acceptance":"Include only issues whose producing run joins declared worker inventory on organization, repository, and workflow, even when the issue lands elsewhere. Preserve campaign and role across Activity imports. Retain run and status evidence; missing closure details stay unknown and closure is not proof of resolution.","description":"Campaign-addressable issue outcomes restricted to declared worker workflows.","from":"outcomes","joins":[{"source":"workflows","type":"inner","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"workflow-role","as":"declared-workflow-role"}]}],"filter":{"predicates":[{"field":"outcome-category","equals":"issue"},{"field":"declared-workflow-role","equals":"worker"}]},"select":[{"field":"campaign"},{"field":"organization"},{"field":"repository"},{"field":"safe-output"},{"field":"outcome-number"},{"field":"outcome-title","as":"event-summary"},{"field":"outcome-title"},{"field":"outcome-summary"},{"field":"outcome-status"},{"field":"outcome-state"},{"field":"issue-state"},{"field":"issue-closed"},{"field":"issue-state-reason"},{"field":"issue-status"},{"field":"issue-closing-status"},{"field":"issue-status-detail"},{"field":"issue-closed-at"},{"field":"issue-status-observed-at"},{"field":"outcome-category","as":"safe-output-type"},{"field":"workflow"},{"field":"workflow-name"},{"field":"run"},{"field":"observed-at"},{"field":"issue-link"},{"field":"external-link"},{"field":"run-link"}],"order-by":[{"field":"observed-at","direction":"desc"}]},{"name":"campaign-issue-tab-counts","subject":"Count the retained worker issues available for each campaign Reports tab.","objective":"Decide whether a campaign has retained worker issue reports to inspect.","acceptance":"For each returned campaign, items equals the number of rows in campaign-worker-issues for that campaign in the same horizon; missing campaigns are not treated as zero issues or verified resolution.","description":"One campaign row with the number of retained issue outcomes produced by campaign workers.","from":"campaign-worker-issues","aggregate":{"by":["campaign"],"values":[{"field":"campaign","as":"items","reducer":"count"}]}},{"name":"campaign-readme-orchestrators","subject":"Resolve one repository link for each campaign README from its declared orchestrator workflow.","objective":"Locate the declared orchestrator repository to contextualize a campaign README.","acceptance":"Each returned campaign and repository link traces to a declared orchestrator workflow; missing or multiple declarations are reported as uncertain rather than inventing a canonical repository.","from":"workflows","filter":{"predicates":[{"field":"workflow-role","equals":"orchestrator"}]},"select":[{"field":"campaign"},{"field":"repository-link"}]},{"name":"campaign-readme-details","subject":"Present retained campaign README content with its repository-relative link context.","objective":"Open the campaign's retained README in its declared repository context before relying on its guidance.","acceptance":"The README text and path match the campaign record and any repository link resolves through a declared orchestrator; absent content or repository linkage remains unavailable, not inferred.","from":"campaigns","joins":[{"source":"campaign-readme-orchestrators","type":"left","on":[{"left":"campaign","right":"campaign"}],"fields":[{"field":"repository-link","as":"repository-link"}]}],"select":[{"field":"campaign"},{"field":"campaign-readme"},{"field":"campaign-readme-path"},{"field":"repository-link"}]},{"name":"campaign-memory-campaigns","subject":"Provide the registered campaigns whose repository memory can be browsed together.","objective":"Choose a registered campaign for repository-memory inspection.","acceptance":"Each campaign identity and display name matches the retained campaign registry in the selected scope; listing a campaign does not establish that memory observations exist or are complete.","description":"Registered campaigns ordered for the all-campaign repository-memory browser.","from":"campaigns","select":[{"field":"campaign"},{"field":"campaign-name"}],"order-by":[{"field":"campaign-name","direction":"asc"}]},{"name":"campaign-performance-baseline-totals","subject":"Establish a selected-horizon campaign baseline from concluded run attempts while keeping reliability, unverified production, and efficiency as separate facts.","objective":"Select campaigns whose retained run reliability, output production, or AI Credit efficiency merits closer examination.","acceptance":"Concluded and successful attempts, outputs, and mean AI Credits reconcile to filtered retained runs; absent denominators or costs stay unknown. Produced outputs are unverified, not operational value.","description":"Canonical campaign run attempts aggregated into bounded selected-horizon baseline totals without treating runtime success or produced outputs as operational value.","from":"campaign-runs","compute":[{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["campaign"],"values":[{"field":"run-attempt-identity","as":"concluded-runs","reducer":"count","filter":{"predicates":[{"field":"status","in":["success","failure","cancelled","timed-out","action-required","neutral","skipped","stale","startup-failure"]}]}},{"field":"run-attempt-identity","as":"successful-runs","reducer":"count","filter":{"predicates":[{"field":"status","equals":"success"}]}},{"field":"safe-items-count","as":"runs-with-output-evidence","reducer":"count","filter":{"predicates":[{"field":"status","equals":"success"}]}},{"field":"safe-items-count","as":"produced-outputs","reducer":"sum","filter":{"predicates":[{"field":"status","equals":"success"}]}},{"field":"aic-total","as":"aic-per-successful-run","reducer":"mean","filter":{"predicates":[{"field":"status","equals":"success"},{"field":"positive-aic","equals":true}]}}]}},{"name":"campaign-performance-baseline","subject":"Turn each campaign's selected-horizon baseline totals into deterministic reliability and production signals with an explicit successful-run efficiency fact.","objective":"Decide which campaign baseline signal needs run- or output-level verification next.","acceptance":"Success-rate and signal labels follow the retained totals and their explicit denominators; no concluded attempts or output evidence is distinguished from zero verified impact, and AI Credits per successful run remain a separate cost fact rather than a value score.","description":"A bounded, explainable baseline that distinguishes runtime reliability, unverified output production, and AI Credit efficiency.","from":"campaign-performance-baseline-totals","compute":[{"as":"success-rate","function":"quotient","args":[{"field":"successful-runs"},{"field":"concluded-runs"}]},{"as":"success-rate-display","function":"format-percent","args":[{"field":"success-rate"}]},{"as":"success-rate-percent","function":"product","args":[{"field":"success-rate"},{"value":100}]},{"as":"has-concluded-runs","function":"greater-than","args":[{"field":"concluded-runs"},{"value":0}]},{"as":"has-unsuccessful-runs","function":"greater-than","args":[{"field":"concluded-runs"},{"field":"successful-runs"}]},{"as":"observed-reliability-signal","function":"if","args":[{"field":"has-unsuccessful-runs"},{"value":"Unsuccessful runs observed"},{"value":"No unsuccessful runs observed"}]},{"as":"reliability-signal","function":"if","args":[{"field":"has-concluded-runs"},{"field":"observed-reliability-signal"},{"value":"No concluded runs observed"}]},{"as":"has-output-evidence","function":"greater-than","args":[{"field":"runs-with-output-evidence"},{"value":0}]},{"as":"has-produced-outputs","function":"greater-than","args":[{"field":"produced-outputs"},{"value":0}]},{"as":"observed-production-signal","function":"if","args":[{"field":"has-produced-outputs"},{"value":"Outputs produced; acceptance unverified"},{"value":"No outputs observed"}]},{"as":"production-signal","function":"if","args":[{"field":"has-output-evidence"},{"field":"observed-production-signal"},{"value":"Output evidence unavailable"}]}],"select":[{"field":"campaign"},{"field":"concluded-runs"},{"field":"successful-runs"},{"field":"success-rate"},{"field":"success-rate-display"},{"field":"success-rate-percent"},{"field":"reliability-signal"},{"field":"produced-outputs"},{"field":"production-signal"},{"field":"aic-per-successful-run"}]},{"name":"campaign-problem-runs","subject":"List retained failed runs for campaign problem investigation.","objective":"Choose a recent failed campaign run to investigate with its diagnostic evidence.","acceptance":"Each row corresponds to a retained campaign run with a declared failure, startup-failure, stale, or timed-out status; campaign-problem-run-evidence orders matching rows newest first. Absence is not proof of healthy execution or complete ingestion.","description":"Private failed-run input with retained diagnostic metadata; the evidence consumer orders only runs matching current runtime problems.","from":"campaign-runs","filter":{"predicates":[{"field":"status","in":["failure","startup-failure","stale","timed-out"]}]}},{"name":"campaign-problem-runtime-failures","subject":"Select current failing runtime partitions without presentation ordering.","objective":"Retain the exact current-failure eligibility needed by the problem evidence join.","acceptance":"A latest failure streak is a nonnegative integer, so failure-count at least one is equivalent to has-current-failure; missing or incomplete runtime evidence remains unknown.","description":"Private unsorted failure partitions for problem evidence; ordering is supplied by the retained failed runs.","from":"campaign-runtime-health-groups","filter":{"predicates":[{"field":"failure-count","gte":1}]},"compute":[{"as":"problem-kind","function":"coalesce","args":[{"value":"failure"},{"value":"failure"}]}]},{"name":"campaign-problem-runtime-partitions","subject":"Project current runtime problem keys and diagnoses for the failed-run evidence join.","objective":"Avoid sorting and retaining unused runtime problem presentation fields.","acceptance":"Retain both current failures and unobserved orchestrators, including their metadata and duplicate-key failure semantics; this projection does not establish health or root cause.","description":"Private compact equivalent of campaign-runtime-problems for equality enrichment, not presentation.","from":"campaign-problem-runtime-failures","union":["campaign-unobserved-orchestrators"],"select":[{"field":"campaign"},{"field":"workflow"},{"field":"runtime-repository"},{"field":"failure-count"},{"field":"problem-kind"}]},{"name":"campaign-problem-run-evidence","subject":"Attach the current campaign runtime problem summary to each retained failed Run for that partition.","objective":"Inspect the failure count and problem kind alongside a failed run without inferring its root cause.","acceptance":"Each returned row joins a retained failed run to a runtime problem on campaign, workflow, and runtime repository; the inner join drops unmatched runs, so compare with campaign-problem-runs before interpreting absence as no problem.","description":"Failed campaign runs annotated with the failure-count and problem-kind of their active runtime problem, one row per retained failed Run.","from":"campaign-problem-runs","joins":[{"source":"campaign-problem-runtime-partitions","type":"inner","on":[{"left":"campaign","right":"campaign"},{"left":"workflow","right":"workflow"},{"left":"runtime-repository","right":"runtime-repository"}],"fields":[{"field":"failure-count","as":"failure-count"},{"field":"problem-kind","as":"problem-kind"}]}],"order-by":[{"field":"started-at","direction":"desc"},{"field":"run","direction":"desc"}]},{"name":"campaign-problem-latest-target-runs","subject":"Identify the most recent retained failed Run for each campaign workflow target repository.","objective":"Select the latest retained failed run identity for each campaign workflow and target partition.","acceptance":"For every returned campaign, workflow, runtime repository, and target repository, latest-target-run agrees with the maximum retained failed run identity in that partition; a missing partition is not a healthy target.","description":"One row per campaign workflow and target repository with its most recent retained failed Run identity.","from":"campaign-problem-run-evidence","aggregate":{"by":["campaign","workflow","runtime-repository","target-repository"],"values":[{"field":"run","as":"latest-target-run","reducer":"max"}]}},{"name":"campaign-problem-error-groups","subject":"Cluster retained failed Run evidence by workflow, runtime repository, target repository, and error signature so repeated identical failures for one target collapse into one diagnosable group.","objective":"Rank repeated target-specific error signatures for investigation without merging unrelated failures.","acceptance":"Occurrence-count and latest-run match retained failed runs grouped by campaign, workflow, repositories, problem kind, and signature; unknown signatures may group together. Counts do not prove a root cause.","description":"One row per distinct target repository and error signature within a campaign runtime problem partition, with an occurrence count and the most recent matching Run identity for follow-up.","from":"campaign-problem-run-evidence","aggregate":{"by":["campaign","campaign-name","workflow","workflow-name","workflow-role","runtime-repository","target-repository","rollout-mode","failure-count","problem-kind","error-signature","error-signature-label"],"values":[{"field":"run","as":"occurrence-count","reducer":"count"},{"field":"run","as":"latest-run","reducer":"max"}]}},{"name":"campaign-current-problem-error-groups","subject":"Keep only the newest error signature for each campaign workflow target repository.","objective":"Focus investigation on the signature associated with the latest retained failed run per target.","acceptance":"Each returned group joins campaign-problem-latest-target-runs on campaign, workflow, runtime repository, and latest run ID; target repository is not a join key, so verify target identity against underlying runs before claiming one current signature per target.","description":"Current target-specific error groups whose representative Run is the target repository's most recent retained failed Run.","from":"campaign-problem-error-groups","joins":[{"source":"campaign-problem-latest-target-runs","type":"inner","on":[{"left":"campaign","right":"campaign"},{"left":"workflow","right":"workflow"},{"left":"runtime-repository","right":"runtime-repository"},{"left":"latest-run","right":"latest-target-run"}],"fields":[{"field":"latest-target-run","as":"current-target-run"}]}]},{"name":"campaign-problem-items","subject":"Attach the most recent representative Run evidence to each distinct campaign runtime problem error signature.","objective":"Open the representative failed run and target for each current campaign problem group.","acceptance":"Check joined run-link, run ID, campaign, workflow, and runtime repository; verify target against run evidence (not a join key). Unobserved orchestrators need inventory review. Missing evidence remains unknown; rollout mode does not authorize policy changes.","description":"Current campaign runtime problems represented by the newest error signature for each target repository, with its effective rollout mode, an occurrence count, the most recent matching failed Run, and a repair prompt.","from":"campaign-current-problem-error-groups","joins":[{"source":"campaign-problem-run-evidence","type":"inner","on":[{"left":"campaign","right":"campaign"},{"left":"workflow","right":"workflow"},{"left":"runtime-repository","right":"runtime-repository"},{"left":"latest-run","right":"run"}],"fields":[{"field":"started-at","as":"started-at"},{"field":"run","as":"run"},{"field":"status","as":"status"},{"field":"status-detail","as":"status-detail"},{"field":"failure-job","as":"failure-job"},{"field":"failure-message","as":"failure-message"},{"field":"failure-step","as":"failure-step"},{"field":"failure-log","as":"failure-log"},{"field":"gh-aw-version","as":"gh-aw-version"},{"field":"engine","as":"engine"},{"field":"engine-version","as":"engine-version"},{"field":"requested-model","as":"requested-model"},{"field":"resolved-model","as":"resolved-model"},{"field":"run-link","as":"run-link"},{"field":"repository-link","as":"repository-link"},{"field":"workflow-link","as":"workflow-link"},{"field":"workflow-source-link","as":"workflow-source-link"}]}],"union":["campaign-unobserved-orchestrators"],"compute":[{"as":"problem-title","function":"coalesce","args":[{"field":"failure-message"},{"field":"status-detail"},{"field":"error-signature-label"},{"field":"workflow-name"}]},{"as":"_runtime-repository-encoded","function":"url-encode","args":[{"field":"runtime-repository"}]},{"as":"_runtime-repository-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"_runtime-repository-encoded"}]},{"as":"runtime-repository-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"_runtime-repository-href"},{"field":"runtime-repository"},{"field":"runtime-repository"}]},{"as":"_target-repository-encoded","function":"url-encode","args":[{"field":"target-repository"}]},{"as":"_target-repository-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"_target-repository-encoded"}]},{"as":"target-repository-link","function":"dashboard-link","args":[{"field":"target-repository"},{"field":"_target-repository-href"},{"field":"target-repository"}]}],"order-by":[{"field":"workflow-name","direction":"asc"},{"field":"runtime-repository","direction":"asc"},{"field":"occurrence-count","direction":"desc"},{"field":"started-at","direction":"desc"}]},{"name":"campaign-problem-tab-counts","subject":"Count the current runtime problem items available for each campaign Problems tab.","objective":"Determine whether the campaign has current retained failure groups requiring review.","acceptance":"For every returned campaign, items equals the number of campaign-problem-items rows in the same horizon; a missing count does not establish zero failures or healthy execution.","description":"One campaign row with the number of current runtime problem groups.","from":"campaign-problem-items","aggregate":{"by":["campaign"],"values":[{"field":"campaign","as":"items","reducer":"count"}]}},{"name":"campaign-baseline-successful-runs","subject":"Project successful concluded attempts from the selected-horizon campaign baseline.","objective":"Show the successful share of concluded runs without implying verified impact.","acceptance":"Counts reconcile to campaign-performance-baseline-totals; missing campaigns do not imply zero runs.","from":"campaign-performance-baseline-totals","compute":[{"as":"outcome","function":"concat","args":[{"value":"Successful attempts"},{"value":""}]}],"select":[{"field":"campaign"},{"field":"outcome"},{"field":"successful-runs","as":"runs"}]},{"name":"campaign-baseline-other-runs","subject":"Project non-successful concluded attempts from the selected-horizon campaign baseline.","objective":"Show the remaining concluded runs for reliability review.","acceptance":"Runs equal concluded-runs minus successful-runs; the category includes every other concluded status, not just failures.","from":"campaign-performance-baseline-totals","compute":[{"as":"outcome","function":"concat","args":[{"value":"Other concluded attempts"},{"value":""}]},{"as":"other-runs","function":"difference","args":[{"field":"concluded-runs"},{"field":"successful-runs"}]}],"select":[{"field":"campaign"},{"field":"outcome"},{"field":"other-runs","as":"runs"}]},{"name":"campaign-baseline-outcome-distribution","subject":"Compare successful and other concluded attempts in the selected horizon.","objective":"Spot campaign run reliability that needs inspection.","acceptance":"Successful and other counts sum to concluded attempts; neither runtime result nor output production establishes operational value.","from":"campaign-baseline-successful-runs","union":["campaign-baseline-other-runs"]},{"name":"campaign-audit-summary-plot-inventory","subject":"Describe the rendered audit-summary chart using the shared campaign Insights plot contract.","objective":"Find campaigns with retained high- or medium-severity audit summaries worth reviewing.","acceptance":"Each campaign's bucket count equals its retained audit-event-summary-buckets rows; the count describes displayed groups, not distinct incidents or confirmed harm, and missing buckets are not proof of safety.","description":"One plot-inventory row per campaign when its high- and medium-severity audit summary chart has data.","from":"audit-event-summary-buckets","aggregate":{"by":["campaign"],"values":[{"field":"event-summary","as":"buckets","reducer":"count"}]}},{"name":"campaign-insight-plot-inventory","subject":"Inventory every plot rendered on each campaign Insights page through one reusable plot contract.","objective":"Choose an available campaign Insights plot to inspect its underlying evidence.","acceptance":"Each plot entry is supplied by the audit summary plot inventory for the same campaign; experimental operational-value evidence is excluded, no plot count is treated as outcome quality, and unavailable evidence is not synthesized into a plot.","description":"One campaign row per rendered Insights plot, independent of the plot's data source or renderer.","from":"campaign-audit-summary-plot-inventory"},{"name":"campaign-insight-tab-counts","subject":"Count the plots declared by the shared campaign Insights plot inventory.","objective":"Determine whether a campaign has evidence-backed Insights plots to inspect.","acceptance":"For every returned campaign, items equals its rows in campaign-insight-plot-inventory for the same horizon; absent rows do not establish absent value, and plot counts do not measure impact.","description":"One campaign row with the number of rendered Insights plots, independent of plot type.","from":"campaign-insight-plot-inventory","aggregate":{"by":["campaign"],"values":[{"field":"campaign","as":"items","reducer":"count"}]}},{"name":"workflow-ordered-runs","subject":"Order retained run attempts within each workflow by their observed start time.","objective":"Identify each workflow's latest execution without importing event coverage or outcome totals.","acceptance":"The first chronological attempt in each workflow partition has no preceding run delta; break timestamp ties by run ID and attempt, and use creation time for queued runs.","from":"runs","compute":[{"as":"latest-run-at","function":"coalesce","args":[{"field":"started-at"},{"field":"created-at"}]}],"window":[{"operation":"change","field":"run","as":"preceding-run-delta","mode":"absolute","groupby":["organization","repository","workflow"],"order-by":[{"field":"latest-run-at","direction":"desc"},{"field":"run","direction":"desc"},{"field":"run-attempt","direction":"desc"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"latest-run-at"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"preceding-run-delta"},{"field":"run-link"}]},{"name":"workflow-latest-runs","subject":"Project the latest retained run attempt for each workflow.","objective":"Expose each workflow's latest observed execution state without implying aggregate outcomes.","acceptance":"Select only the first chronologically ordered attempt per workflow; preserve queued and in-progress states instead of treating unknown conclusions as failures.","from":"workflow-ordered-runs","filter":{"predicates":[{"field":"preceding-run-delta","equals":"unknown"}]},"compute":[{"as":"observed-conclusion","function":"coalesce","args":[{"field":"run-conclusion"},{"value":"unknown"}]},{"as":"completed","function":"equals-any","args":[{"field":"run-status"},{"value":"completed"}]},{"as":"latest-run-status","function":"if","args":[{"field":"completed"},{"field":"observed-conclusion"},{"field":"run-status"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"latest-run-at"},{"field":"latest-run-status"},{"field":"run-link"}]},{"name":"workflow-list-preview","subject":"Show workflow declarations while latest-run evidence is still loading.","objective":"Make workflow identities and drill links available before retained runs are evaluated.","acceptance":"Preserve every declared workflow and its drill link; leave latest-run fields absent until the complete projection arrives.","from":"workflows","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-label","function":"concat","args":[{"field":"repository-coordinate"},{"value":":"},{"field":"workflow"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"declared-role","function":"coalesce","args":[{"field":"workflow-role"},{"value":"standalone"}]},{"as":"declared-mode","function":"coalesce","args":[{"field":"rollout-mode"},{"value":"unknown"}]},{"as":"declared-registration","function":"coalesce","args":[{"field":"workflow-active"},{"value":"unknown"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-label"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-display-name"},{"field":"workflow-label"}]}],"select":[{"field":"organization"},{"field":"repository-coordinate","as":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-label"},{"field":"campaign-name"},{"field":"declared-role","as":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"declared-registration","as":"workflow-active"},{"field":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"workflow-list","subject":"List declared workflows in latest observed run order.","objective":"Open a dedicated workflow page from a lightweight inventory with its latest execution status.","acceptance":"Preserve textual run identities and keep unobserved workflows last with an explicit missing-run state; use only workflow declarations and retained runs, not event coverage or aggregate success/failure counters.","from":"workflows","joins":[{"source":"workflow-latest-runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"run","as":"latest-run"},{"field":"latest-run-at","as":"latest-run-at"},{"field":"latest-run-status","as":"observed-run-status"},{"field":"run-link","as":"run-link"}]}],"compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-label","function":"concat","args":[{"field":"repository-coordinate"},{"value":":"},{"field":"workflow"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"declared-role","function":"coalesce","args":[{"field":"workflow-role"},{"value":"standalone"}]},{"as":"declared-mode","function":"coalesce","args":[{"field":"rollout-mode"},{"value":"unknown"}]},{"as":"declared-registration","function":"coalesce","args":[{"field":"workflow-active"},{"value":"unknown"}]},{"as":"observed-run-id","function":"coalesce","args":[{"field":"latest-run"},{"value":"0"}]},{"as":"has-observed-run","function":"greater-than","args":[{"field":"observed-run-id"},{"value":0}]},{"as":"latest-run-status","function":"coalesce","args":[{"field":"observed-run-status"},{"value":"No observed run"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-label"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-display-name"},{"field":"workflow-label"}]}],"select":[{"field":"organization"},{"field":"repository-coordinate","as":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-label"},{"field":"campaign-name"},{"field":"declared-role","as":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"declared-registration","as":"workflow-active"},{"field":"latest-run"},{"field":"latest-run-at"},{"field":"latest-run-status"},{"field":"has-observed-run"},{"field":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"},{"field":"run-link"}],"order-by":[{"field":"has-observed-run","direction":"desc"},{"field":"latest-run-at","direction":"desc"},{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"runs-daily-health-buckets","subject":"Select whole UTC start-day buckets against the requested time bounds.","objective":"Expose UTC bucket boundaries for declarative daily time selection.","acceptance":"Compute bounds from observed execution-start days only; missing request bounds remain unset and no sub-day totals or missing days are fabricated.","from":"daily-run-counts","compute":[{"as":"day-midnight","function":"concat","args":[{"field":"day"},{"value":"T00:00:00Z"}]},{"as":"day-ms","function":"timestamp","args":[{"field":"day-midnight"}]},{"as":"start-ms","function":"timestamp","args":[{"context":"time-start"}]},{"as":"end-ms","function":"timestamp","args":[{"context":"time-end"}]},{"as":"before-start","function":"greater-than","args":[{"field":"start-ms"},{"field":"day-ms"}]},{"as":"before-end","function":"greater-than","args":[{"field":"end-ms"},{"field":"day-ms"}]}]},{"name":"runs-daily-health-totals","subject":"Sum observed daily run health across the selected scope.","objective":"Keep daily activity counts independent of detail retention.","acceptance":"Sum only daily counts, never retained Runs. UTC start-day buckets are selected by midnight; sub-day totals are unsupported. Missing or undated evidence remains unavailable or partial.","from":"runs-daily-health-buckets","filter":{"predicates":[{"field":"before-start","in":[false,null]},{"field":"before-end","in":[true,null]}]},"aggregate":{"by":["day"],"values":[{"field":"successful","as":"successful","reducer":"sum"},{"field":"failed","as":"failed","reducer":"sum"},{"field":"approval","as":"approval","reducer":"sum"},{"field":"pending","as":"pending","reducer":"sum"},{"field":"other","as":"other","reducer":"sum"}]}},{"name":"runs-daily-successful","subject":"Observed daily successful run counts.","objective":"Expose the successful class for the daily runtime-health chart.","acceptance":"Project successful counts from scoped daily totals without re-reading detail; runtime success does not imply accepted outcomes.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Successful"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"successful","as":"runs"}]},{"name":"runs-daily-failed","subject":"Observed daily failed run counts.","objective":"Expose the failed class for the daily runtime-health chart.","acceptance":"Project failed counts from scoped daily totals, preserving zero counts and aggregate coverage without deriving incidents.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Failed"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"failed","as":"runs"}]},{"name":"runs-daily-approval","subject":"Observed daily approval-required run counts.","objective":"Expose approval-required observations in the daily runtime-health chart.","acceptance":"Project approval counts from scoped daily totals without treating approval-required observations as successes or failures.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Approval required"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"approval","as":"runs"}]},{"name":"runs-daily-pending","subject":"Observed daily pending run counts.","objective":"Expose last-observed pending state in the daily runtime-health chart.","acceptance":"Project pending counts from scoped daily totals; counts describe last-observed evidence, not a live execution census.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Pending"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"pending","as":"runs"}]},{"name":"runs-daily-other","subject":"Observed daily unclassified terminal or missing-status run counts.","objective":"Expose the remaining runtime-health class without implying success.","acceptance":"Project other counts from scoped daily totals; preserve zeros and coverage without interpreting skipped, cancelled, or unknown evidence as success.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Other"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"other","as":"runs"}]},{"name":"runs-daily-conclusions","subject":"Daily observed runtime health classes for the Runs chart.","objective":"Investigate daily activity independently of retained run detail.","acceptance":"Classes sum to observed dated Runs, not attempts or verified outcomes. Pending is last-observed state; Other is not success. Select whole UTC start-day buckets by midnight, not sub-day totals. Preserve partial or unavailable coverage.","from":"runs-daily-successful","union":["runs-daily-failed","runs-daily-approval","runs-daily-pending","runs-daily-other"],"order-by":[{"field":"day","direction":"asc"},{"field":"runtime-health","direction":"asc"}]},{"name":"entity-events","subject":"Project all run-owned records for reusable cards and run drill-down.","objective":"Expose run-owned event identity, status, provenance, timestamp, and available navigation links for inspection.","acceptance":"Projected event fields and fallback URL trace to the source record; a missing link or event is not proof of no output, and event status alone does not verify downstream impact.","from":"event-base","compute":[{"as":"event-url","function":"coalesce","args":[{"field":"safe-output-url"},{"field":"correlation-id"},{"field":"implementation-pull-request-url"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"event"},{"field":"event-source"},{"field":"event-type"},{"field":"event-summary"},{"field":"event-status"},{"field":"github-entity-type"},{"field":"safe-output-type"},{"field":"event-url"},{"field":"event-timestamp","as":"observed-at"},{"field":"run-link"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"event","direction":"asc"}]},{"name":"runs-table","subject":"Show observed workflow runs in a table with execution, repository, workflow, engine, model, and navigation details.","objective":"Locate observed runs whose recorded status or conclusion needs closer inspection.","acceptance":"Show recorded run identity, status, conclusion, scope, execution metadata, and source links in newest-first order; absent runs require a freshness and coverage check, and a successful run is not proof of accepted outcomes.","description":"Observed workflow runs ordered from newest to oldest.","from":"runs","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]}],"select":[{"field":"run"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"repository-coordinate"},{"field":"workflow"},{"field":"rollout-mode"},{"field":"engine"},{"field":"engine-version"},{"field":"gh-aw-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"started-at"},{"field":"repository-link"},{"field":"workflow-link"},{"field":"run-link"}],"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"workflow-aic-per-run","subject":"List declared workflows with recorded positive AI Credit costs and their average cost per run.","objective":"Identify workflows with observed run AIC averages worth investigating alongside run evidence.","acceptance":"Include only declared workflows with at least one run attempt reporting positive AIC; exclude zero and missing telemetry from the average and ranking, without interpreting missing telemetry as free execution.","description":"Workflow AI Credit averages limited to run attempts with recorded positive AIC.","from":"workflows","joins":[{"source":"workflow-aic-run-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"aic-runs","as":"observed-aic-runs"},{"field":"aic","as":"observed-aic"}]}],"compute":[{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"workflow-identity","function":"concat","args":[{"field":"repository-slug"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-identity"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-display-name"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-identity"}]},{"as":"aic-per-run","function":"quotient","args":[{"field":"observed-aic"},{"field":"observed-aic-runs"}]}],"filter":{"predicates":[{"field":"observed-aic-runs","gte":1}]},"select":[{"field":"workflow-identity","as":"workflow-label"},{"field":"workflow-dashboard-link","as":"workflow-link"},{"field":"aic-per-run"}],"order-by":[{"field":"aic-per-run","direction":"desc"}],"limit":10},{"name":"dashboard-ingestion-health","subject":"Expose the current collection state for the global ingestion indicator.","objective":"Distinguish reported ingestion failure or recovery from the age of retained workflow evidence.","acceptance":"Use the authorized server collection-health classification, not cumulative failures or browser refresh time. Missing or unauthorized health remains unknown and static dashboards do not request this source.","from":"collection-health","select":[{"field":"configured"},{"field":"health"}],"limit":1},{"name":"dashboard-data-freshness","subject":"Find the newest workflow activity timestamp in retained canonical data.","objective":"Warn globally when the ingested workflow evidence has not advanced for 24 hours.","acceptance":"Use upstream updated-at, falling back to created-at, never browser import or refresh time. Missing or invalid timestamps remain unknown; inactivity alone does not prove an ingestion failure.","from":"runs","compute":[{"as":"data-at","function":"coalesce","args":[{"field":"updated-at"},{"field":"created-at"}]},{"as":"data-at-ms","function":"timestamp","args":[{"field":"data-at"}]}],"aggregate":{"values":[{"field":"data-at-ms","as":"latest-data-at","reducer":"max"}]}},{"name":"indexing-shards","subject":"List retained Activity shard import receipts.","objective":"Inspect which shards were ingested, when, and how many records they committed.","acceptance":"Show shard scope, phase, import status, import timestamp, counts and payload identity from retained receipts. Import time is not upstream freshness and missing receipts do not prove complete coverage.","from":"transactions","filter":{"predicates":[{"field":"kind","in":["ingest-normalized-jsonl","ingest-jsonl","ingest-jsonl-failed","runs","records"]}]},"select":[{"field":"id"},{"field":"payloadScope","as":"shard"},{"field":"kind"},{"field":"activity-status","as":"status"},{"field":"createdAt","as":"ingested-at"},{"field":"committedRecords","as":"committed-records"},{"field":"rawRuns","as":"workflow-runs"},{"field":"payloadHash","as":"payload-hash"}],"order-by":[{"field":"ingested-at","direction":"desc"}]},{"name":"ingestion-queued","subject":"Label the shared collection task queue depth for the administrator queue chart.","objective":"Identify total ready and scheduled collection work, including backfill tasks.","acceptance":"Show the observed shared queue depth only when collection is configured; missing or unauthorized health data is not zero pending work.","from":"collection-health","filter":{"predicates":[{"field":"configured","equals":true}]},"compute":[{"as":"queue","function":"coalesce","args":[{"value":"Ready and scheduled"},{"value":"Ready and scheduled"}]}],"select":[{"field":"queue"},{"field":"queue-depth","as":"tasks"}]},{"name":"ingestion-inflight","subject":"Label current in-flight collection tasks for the administrator queue chart.","objective":"Distinguish leased collection tasks from work awaiting collection.","acceptance":"Show the observed pending task count only when collection is configured; do not infer a count from an unavailable source.","from":"collection-health","filter":{"predicates":[{"field":"configured","equals":true}]},"compute":[{"as":"queue","function":"coalesce","args":[{"value":"In flight"},{"value":"In flight"}]}],"select":[{"field":"queue"},{"field":"pending-tasks","as":"tasks"}]},{"name":"ingestion-backfill","subject":"Label cumulative backfill run admissions for the administrator ingestion chart.","objective":"Compare historically admitted run tasks with current outstanding work without treating admissions as a live backlog.","acceptance":"Show the cumulative run task admissions only when collection is configured; this value does not decrease as tasks complete and missing health data does not imply completed backfill.","from":"collection-health","filter":{"predicates":[{"field":"configured","equals":true}]},"compute":[{"as":"queue","function":"coalesce","args":[{"value":"Backfill admitted (total)"},{"value":"Backfill admitted (total)"}]}],"select":[{"field":"queue"},{"field":"backfill-queued-run-tasks","as":"tasks"}]},{"name":"ingestion-queue-sizes","subject":"Compare current shared queue pressure, in-flight tasks, and cumulative historical backfill admissions from the administrator-only server snapshot.","objective":"Spot a growing backlog without treating past backfill admissions as outstanding work.","acceptance":"Current queue sizes and cumulative admissions come only from an authorized collection-health snapshot; unavailable state is not zero.","from":"ingestion-queued","union":["ingestion-inflight","ingestion-backfill"],"select":[{"field":"queue"},{"field":"tasks"}]},{"name":"ingestion-webhook-status","subject":"Inspect live webhook delivery counters for the current server process.","objective":"Distinguish signature validation, acknowledgements, rejections and failures without polling GitHub.","acceptance":"Show only authorized process-local counters, including in-flight requests, duplicate acknowledgements and signed pings. Counters reset on restart, are not replica totals, and do not establish GitHub-side webhook registration or completed collection. Refresh the active subscription even without canonical data changes.","from":"webhook-status","compute":[{"as":"configuration","function":"if","args":[{"field":"configured"},{"value":"Configured"},{"value":"Not configured"}]}],"limit":1},{"name":"ingestion-health","subject":"Show the current Redis-backed webhook and collection health snapshot.","objective":"Determine whether the reported collection, webhook, queue, and backfill state warrants inspecting ingestion diagnostics.","acceptance":"Report the observed health, queue, failure, success, and projection timestamps together; verify freshness and configuration before calling collection healthy, and treat missing state as unknown rather than zero.","from":"collection-health","select":[{"field":"configured"},{"field":"health"},{"field":"queue-depth"},{"field":"pending-tasks"},{"field":"dead-letters"},{"field":"oldest-pending-age"},{"field":"backfill"},{"field":"backfill-failures"},{"field":"backfill-queued-run-tasks"},{"field":"webhook-load"},{"field":"collection-load"},{"field":"failure-load"},{"field":"last-projected"},{"field":"last-webhook-at"},{"field":"last-failure-at"},{"field":"last-failure-code"},{"field":"last-success-at"},{"field":"webhook-received"},{"field":"webhook-duplicate"},{"field":"webhook-admission-failed"},{"field":"task-queued"},{"field":"task-coalesced"},{"field":"collection-succeeded"},{"field":"collection-failed"},{"field":"collection-retried"},{"field":"collection-dead-lettered"}]},{"name":"github-api-usage","subject":"Show retained GitHub API quota usage per bucket and in aggregate over the last 24 hours.","objective":"Determine whether any GitHub App installation or the CAO fleet as a whole is approaching its GitHub API rate limit.","acceptance":"Report peak usage percentages with their limits, used, and reserved counts; treat a slot without observations as unknown rather than idle, and never infer credentials from bucket identity.","from":"github-quota-usage","select":[{"field":"observed-at"},{"field":"scope"},{"field":"bucket"},{"field":"app"},{"field":"installation"},{"field":"resource"},{"field":"buckets"},{"field":"limit"},{"field":"used"},{"field":"reserved"},{"field":"usage-percent"}]},{"name":"marketplace-directory","subject":"Browse packages from configured marketplace registries.","objective":"Present a stable alphabetical directory that can be loaded in bounded pages.","acceptance":"Preserve resolver-produced provenance and package metadata. Order by package name and immutable source so continuation pages neither skip nor duplicate entries; discovery grants no installation authority.","from":"marketplace-packages","order-by":[{"field":"package-name","direction":"asc"},{"field":"package-source","direction":"asc"}]},{"name":"marketplace-package-detail","subject":"Expose normalized marketplace package records for source-coordinate lookup by the detail view.","objective":"Locate the resolver-produced package record for a source coordinate supplied by the consuming view.","acceptance":"Use the returned package-source, registry, ref, and resolved-commit fields when inspecting a matching record; the query itself does not filter by coordinate, and an absent match is not proof of package nonexistence or approval.","from":"marketplace-packages"},{"name":"friction-by-workflow","subject":"Rank workflows by observed gh-aw audit friction AI Credit totals for investigation.","objective":"Identify which repository and workflow combinations have the largest measured friction totals in retained observations.","acceptance":"Compare friction-aic and distinct runs with the underlying measurement states and attribution evidence; do not equate a ranking with avoidable cost or a validated saving.","description":"Total gh-aw audit friction cost grouped by repository and workflow.","from":"friction","compute":[{"as":"positive-aic","function":"greater-than","args":[{"field":"aic"},{"value":0}]},{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}],"aggregate":{"by":["workflow-coordinate","repository-coordinate","workflow"],"values":[{"field":"aic","as":"friction-aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"run","as":"runs","reducer":"distinct-count"}]},"order-by":[{"field":"friction-aic","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}]},{"name":"friction-observations","subject":"List retained gh-aw audit friction measurements with their run context and attribution totals.","objective":"Trace each reported friction measurement to a run and distinguish counted, suppressed, and unattributed occurrences.","acceptance":"Preserve native AIC, total-run AIC, measurement state, timestamps, links, and occurrence counts; missing or unattributed evidence remains uncertain, not a verified opportunity for savings.","description":"Newest friction measurements first, preserving the native audit values and uncertainty state.","from":"friction","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"friction-percent","function":"format-percent","args":[{"field":"friction-ratio"}]}],"select":[{"field":"event-timestamp","as":"observed-at"},{"field":"repository-coordinate"},{"field":"workflow"},{"field":"run"},{"field":"run-link"},{"field":"measurement-state"},{"field":"aic"},{"field":"total-run-aic"},{"field":"friction-percent"},{"field":"counted-occurrences"},{"field":"suppressed-occurrences"},{"field":"unattributed-occurrences"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"run","direction":"desc"}]},{"name":"indexing-shard-dates","subject":"Read the activity date encoded in each retained transaction's shard filename.","objective":"Separate source shard dates from ingestion timestamps.","acceptance":"Keep every transaction and leave absent, invalid, or structural shard dates unknown; never substitute import time.","from":"transactions","compute":[{"as":"shard-day","function":"activity-shard-day","args":[{"field":"payloadScope"}]},{"as":"missing-shard-day","function":"equals-any","args":[{"field":"shard-day"},{"value":null}]}]},{"name":"indexing-ingestion-runs","subject":"Show retained ingestion transactions at the activity date encoded in their shard filename.","objective":"Compare reported run counts by source shard activity date, independently of import time.","acceptance":"Preserve every dated transaction, including coincident dates, all kinds, and zero counts, without grouping, limits, or page filters. Omit missing or invalid shard dates; never substitute import time. Missing counts use labeled zero-position placeholders, not measured zeroes.","from":"indexing-shard-dates","filter":{"predicates":[{"field":"missing-shard-day","equals":false}]},"compute":[{"as":"workflow-runs","function":"coalesce","args":[{"field":"rawRuns"},{"value":0}]},{"as":"missing-run-count","function":"equals-any","args":[{"field":"rawRuns"},{"value":null}]},{"as":"run-count-status","function":"if","args":[{"field":"missing-run-count"},{"value":"Run count unavailable (shown at 0)"},{"value":"Reported run count"}]}],"select":[{"field":"id"},{"field":"kind"},{"field":"createdAt"},{"field":"shard-day"},{"field":"rawRuns"},{"field":"workflow-runs"},{"field":"run-count-status"}],"order-by":[{"field":"shard-day","direction":"asc"},{"field":"id","direction":"asc"}]},{"name":"indexing-daily-run-counts","subject":"Inspect admitted daily logical Run counts independently of retained detail and shard receipts.","objective":"Make the daily run-count projection visible as an ingestion diagnostic.","acceptance":"Sum daily buckets by observed UTC execution-start day across repositories and workflows, without page filters, detail fallback, fabricated days or zero populations. Preserve aggregate coverage and partial or unavailable evidence; counts do not prove upstream completeness.","from":"daily-run-counts","aggregate":{"by":["day"],"values":[{"field":"total","as":"runs","reducer":"sum"}]},"select":[{"field":"day","as":"date"},{"field":"runs"}],"order-by":[{"field":"date","direction":"asc"}]},{"name":"indexing-campaigns-table-count","subject":"Count retained campaigns rows in the dashboard database.","objective":"Provide the retained campaigns row count for the table-count diagnostic.","acceptance":"Label the result campaigns and count campaign rows in the current database; absence or zero does not establish completeness or expected campaign coverage.","from":"campaigns","compute":[{"as":"table","function":"literal","args":[{"value":"campaigns"}]}],"aggregate":{"by":["table"],"values":[{"field":"campaign","as":"records","reducer":"count"}]}},{"name":"indexing-repositories-table-count","subject":"Count retained repositories rows in the dashboard database.","objective":"Provide the retained repositories row count for the table-count diagnostic.","acceptance":"Label the result repositories and count repository rows in the current database; absence or zero does not establish completeness or expected repository coverage.","from":"repositories","compute":[{"as":"table","function":"literal","args":[{"value":"repositories"}]}],"aggregate":{"by":["table"],"values":[{"field":"repository","as":"records","reducer":"count"}]}},{"name":"indexing-workflows-table-count","subject":"Count retained workflows rows in the dashboard database.","objective":"Provide the retained workflows row count for the table-count diagnostic.","acceptance":"Label the result workflows and count workflow rows in the current database; absence or zero does not establish completeness or expected workflow coverage.","from":"workflows","compute":[{"as":"table","function":"literal","args":[{"value":"workflows"}]}],"aggregate":{"by":["table"],"values":[{"field":"workflow","as":"records","reducer":"count"}]}},{"name":"indexing-runs-table-count","subject":"Count retained workflow runs rows in the dashboard database.","objective":"Provide the retained workflow runs row count for the table-count diagnostic.","acceptance":"Label the result workflow runs and count run rows in the current database; absence or zero does not establish completeness or expected execution volume.","from":"runs","compute":[{"as":"table","function":"literal","args":[{"value":"runs"}]}],"aggregate":{"by":["table"],"values":[{"field":"run","as":"records","reducer":"count"}]}},{"name":"indexing-domains-table-count","subject":"Count retained network domains rows in the dashboard database.","objective":"Provide the retained network domains row count for the table-count diagnostic.","acceptance":"Label the result network domains and count domain event rows in the current database; absence or zero does not prove no network activity.","from":"domains","compute":[{"as":"table","function":"literal","args":[{"value":"domains"}]}],"aggregate":{"by":["table"],"values":[{"field":"event","as":"records","reducer":"count"}]}},{"name":"indexing-tools-table-count","subject":"Count retained tool events rows in the dashboard database.","objective":"Provide the retained tool events row count for the table-count diagnostic.","acceptance":"Label the result tool events and count tool event rows in the current database; absence or zero does not prove no tool use.","from":"tools","compute":[{"as":"table","function":"literal","args":[{"value":"tools"}]}],"aggregate":{"by":["table"],"values":[{"field":"table","as":"records","reducer":"count"}]}},{"name":"indexing-audits-table-count","subject":"Count retained audit events rows in the dashboard database.","objective":"Provide the retained audit events row count for the table-count diagnostic.","acceptance":"Label the result audit events and count audit event rows in the current database; absence or zero does not prove no audit findings.","from":"audits","compute":[{"as":"table","function":"literal","args":[{"value":"audits"}]}],"aggregate":{"by":["table"],"values":[{"field":"event","as":"records","reducer":"count"}]}},{"name":"indexing-issues-table-count","subject":"Count retained issue events rows in the dashboard database.","objective":"Provide the retained issue events row count for the table-count diagnostic.","acceptance":"Label the result issue events and count issue event rows in the current database; absence or zero does not prove no issues exist.","from":"issues","compute":[{"as":"table","function":"literal","args":[{"value":"issues"}]}],"aggregate":{"by":["table"],"values":[{"field":"event","as":"records","reducer":"count"}]}},{"name":"indexing-operational-values-table-count","subject":"Count retained operational values rows in the dashboard database.","objective":"Provide the retained operational values row count for the table-count diagnostic.","acceptance":"Label the result operational values and count operational-value rows in the current database; absence or zero does not imply zero value or an evaluated outcome.","from":"operational-values","compute":[{"as":"table","function":"literal","args":[{"value":"operationalValues"}]}],"aggregate":{"by":["table"],"values":[{"field":"operational-value","as":"records","reducer":"count"}]}},{"name":"indexing-transactions-table-count","subject":"Count retained ingestion transactions rows in the dashboard database.","objective":"Provide the retained ingestion transactions row count for the table-count diagnostic.","acceptance":"Label the result ingestion transactions and count transaction IDs in the current database; absence or zero does not establish whether upstream ingestion ran.","from":"transactions","compute":[{"as":"table","function":"literal","args":[{"value":"transactions"}]}],"aggregate":{"by":["table"],"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"indexing-database-table-counts","subject":"Count retained canonical dashboard database rows by table.","objective":"Compare the retained table row counts to identify tables needing further ingestion or coverage investigation.","acceptance":"Union the named table-count projections and report their table labels and counts; check source availability, retention, and separate transaction evidence before interpreting an empty or small table as an ingestion defect.","from":"indexing-campaigns-table-count","union":["indexing-repositories-table-count","indexing-workflows-table-count","indexing-runs-table-count","indexing-domains-table-count","indexing-tools-table-count","indexing-audits-table-count","indexing-issues-table-count","indexing-operational-values-table-count","indexing-transactions-table-count"],"order-by":[{"field":"records","direction":"desc"},{"field":"table","direction":"asc"}]},{"name":"indexing-transactions","subject":"Prepare retained ingestion transactions for card presentation.","objective":"Expose transaction identity, kind, timestamp, committed-record count, and payload hash for ingestion traceability.","acceptance":"Projected fields match retained transactions without implying successful upstream coverage from a committed count or hash alone; missing transactions require a freshness and availability check.","from":"transactions","select":[{"field":"id"},{"field":"kind"},{"field":"createdAt","as":"created-at"},{"field":"committedRecords","as":"committed-records"},{"field":"payloadHash","as":"payload-hash"}]},{"name":"engines-models-sample-distribution","subject":"Describe agent and model combinations in the seven-day statistical run sample.","objective":"Find sampled combinations to investigate without scanning the full retained run history.","acceptance":"Count unweighted selected Runs after frame selection. Keep statistical-frame-id in grouped rows and frame metadata on empty results. Zero-allocation strata are not population zeros. Preserve unknown identifiers; failure reserves can alter composition. Never mix sample counts with exact usage or infer population shares.","description":"Unweighted composition of the seven-day statistical sample; not a population estimate. Failure outcomes may be oversampled.","from":"statistical-runs","compute":[{"as":"summary","function":"concat","args":[{"field":"agent-id"},{"value":" / "},{"field":"model-id"}]}],"aggregate":{"by":["summary","statistical-frame-id"],"values":[{"field":"run","as":"sampled-runs","reducer":"count"}]},"order-by":[{"field":"sampled-runs","direction":"desc"},{"field":"summary","direction":"asc"}]},{"name":"engines-models-usage","subject":"Summarize run-level AIC and token usage by agent and model identifiers without treating unavailable telemetry as zero.","objective":"Locate agent and model combinations whose observed per-run AIC or token usage merits checking against individual runs.","acceptance":"Report run counts and native minimum, mean, and maximum values only for reported metrics; inspect underlying runs for per-metric telemetry coverage and context before comparing combinations, and infer neither efficiency nor outcome value from usage alone.","description":"Observed workflow runs grouped by agent ID and model ID. AIC statistics use only positive-AIC runs; token statistics use runs that reported each token metric.","from":"runs","compute":[{"as":"summary","function":"concat","args":[{"field":"agent-id"},{"value":" / "},{"field":"model-id"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["summary"],"values":[{"field":"run","as":"runs","reducer":"count"},{"field":"aic-total","as":"minimum-aic-per-run","reducer":"min","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"aic-total","as":"average-aic-per-run","reducer":"mean","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"aic-total","as":"maximum-aic-per-run","reducer":"max","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"input-tokens","as":"minimum-input-tokens-per-run","reducer":"min"},{"field":"input-tokens","as":"average-input-tokens-per-run","reducer":"mean"},{"field":"input-tokens","as":"maximum-input-tokens-per-run","reducer":"max"},{"field":"output-tokens","as":"minimum-output-tokens-per-run","reducer":"min"},{"field":"output-tokens","as":"average-output-tokens-per-run","reducer":"mean"},{"field":"output-tokens","as":"maximum-output-tokens-per-run","reducer":"max"},{"field":"cache-read-tokens","as":"minimum-cache-read-tokens-per-run","reducer":"min"},{"field":"cache-read-tokens","as":"average-cache-read-tokens-per-run","reducer":"mean"},{"field":"cache-read-tokens","as":"maximum-cache-read-tokens-per-run","reducer":"max"},{"field":"cache-write-tokens","as":"minimum-cache-write-tokens-per-run","reducer":"min"},{"field":"cache-write-tokens","as":"average-cache-write-tokens-per-run","reducer":"mean"},{"field":"cache-write-tokens","as":"maximum-cache-write-tokens-per-run","reducer":"max"},{"field":"reasoning-tokens","as":"minimum-reasoning-tokens-per-run","reducer":"min"},{"field":"reasoning-tokens","as":"average-reasoning-tokens-per-run","reducer":"mean"},{"field":"reasoning-tokens","as":"maximum-reasoning-tokens-per-run","reducer":"max"}]},"select":[{"field":"summary"},{"field":"runs"},{"field":"average-aic-per-run"},{"field":"minimum-aic-per-run"},{"field":"maximum-aic-per-run"},{"field":"minimum-input-tokens-per-run"},{"field":"average-input-tokens-per-run"},{"field":"maximum-input-tokens-per-run"},{"field":"minimum-output-tokens-per-run"},{"field":"average-output-tokens-per-run"},{"field":"maximum-output-tokens-per-run"},{"field":"minimum-cache-read-tokens-per-run"},{"field":"average-cache-read-tokens-per-run"},{"field":"maximum-cache-read-tokens-per-run"},{"field":"minimum-cache-write-tokens-per-run"},{"field":"average-cache-write-tokens-per-run"},{"field":"maximum-cache-write-tokens-per-run"},{"field":"minimum-reasoning-tokens-per-run"},{"field":"average-reasoning-tokens-per-run"},{"field":"maximum-reasoning-tokens-per-run"}],"order-by":[{"field":"runs","direction":"desc"},{"field":"summary","direction":"asc"}]},{"name":"skill-invocations","subject":"Select observed skill invocations for skill usage analytics.","objective":"Expose skill event identity, scope, invocation counts, and failed counts for downstream usage analysis.","acceptance":"Keep each observed event and its repository/workflow attribution with native counts; missing records or failed counts alone do not establish whether a skill was useful or available.","from":"skills","select":[{"field":"event","as":"id"},{"field":"name","as":"skill"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"invocation-count"},{"field":"failed-count"}]},{"name":"skill-invocations-by-skill","subject":"Rank skills by their observed invocation count.","objective":"Identify skills with the highest observed invocation totals for follow-up inspection.","acceptance":"Sum observed invocation counts by skill and retain the rank as a usage description; do not equate popularity with effectiveness or infer unobserved invocations.","from":"skill-invocations","aggregate":{"by":["skill"],"values":[{"field":"invocation-count","as":"invocations","reducer":"sum"}]},"order-by":[{"field":"invocations","direction":"desc"},{"field":"skill","direction":"asc"}]},{"name":"skill-invocations-by-workflow-totals","subject":"Rank workflows by their observed skill invocation count.","objective":"Produce repository-scoped workflow invocation totals for downstream skill-usage comparison.","acceptance":"Sum observed invocation counts by organization, repository, and workflow; totals describe recorded usage only, not success or expected adoption.","from":"skill-invocations","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"invocation-count","as":"invocations","reducer":"sum"}]}},{"name":"skill-invocations-by-workflow","subject":"Present workflow skill invocation totals with drill-through navigation to the workflow dashboard.","objective":"Expose observed workflow skill invocation totals with a link to inspect each workflow.","acceptance":"Each projected workflow coordinate, link, and invocation total traces to the grouped source; using a link to investigate does not establish that usage caused an outcome.","from":"skill-invocations-by-workflow-totals","compute":[{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-coordinate"}]}],"select":[{"field":"workflow-coordinate"},{"field":"workflow-link"},{"field":"invocations"}],"order-by":[{"field":"invocations","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}]},{"name":"skill-workflow-totals","subject":"Count observed invocations for each skill and workflow.","objective":"Produce skill-by-workflow invocation totals for the downstream inventory.","acceptance":"Sum observed invocation counts by skill, organization, repository, and workflow; missing combinations are not evidence that a skill could not run.","from":"skill-invocations","aggregate":{"by":["skill","organization","repository","workflow"],"values":[{"field":"invocation-count","as":"invocations","reducer":"sum"}]}},{"name":"skill-workflow-inventory","subject":"List observed skills by workflow with drill-through navigation to the workflow dashboard.","objective":"Identify observed skill/workflow combinations and provide a workflow link for inspecting their runs.","acceptance":"Show the repository, workflow, skill, link, and observed invocation total from the grouped evidence; an absent row does not prove non-use, and a high count does not prove effectiveness.","from":"skill-workflow-totals","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-coordinate"}]}],"select":[{"field":"skill"},{"field":"repository-coordinate"},{"field":"workflow"},{"field":"workflow-link"},{"field":"invocations"}],"order-by":[{"field":"invocations","direction":"desc"},{"field":"skill","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"experiment-assignment-coverage","subject":"Count observed run assignments for each experiment and workflow without inferring a completion target.","objective":"Expose assignment counts by experiment and workflow for investigating observed experiment coverage.","acceptance":"Count retained assignment rows in each experiment/workflow group, not distinct runs; do not invent a target, infer missing assignments from absent groups, or treat assignments as eval or grader outcomes.","from":"experiment-assignments","compute":[{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}],"aggregate":{"by":["workflow-coordinate","experiment"],"values":[{"field":"run","as":"assignments","reducer":"count"}]}},{"name":"eval-status-ledger","subject":"Inspect every explicitly classified eval answer, including UNKNOWN.","objective":"Expose retained eval observations with their workflow, run evidence and observation time.","acceptance":"Keep recorded YES, NO and UNKNOWN answers distinct; unknown or absent evidence must not imply success or failure, and historical answers are not current verdicts or validated operational outcomes.","from":"eval-observations","compute":[{"as":"_recorded-run-href","function":"link-href","args":[{"field":"evidence-link"}]},{"as":"_eval-run-href","function":"coalesce","args":[{"field":"_recorded-run-href"},{"field":"evidence-link"}]},{"as":"run-link","function":"link","args":[{"field":"_eval-run-href"},{"field":"run"}]}],"filter":{"predicates":[{"field":"eval-result","in":["YES","NO","UNKNOWN"]}]}},{"name":"eval-answer-counts","subject":"Count recorded YES, NO and UNKNOWN answers for each workflow-scoped eval.","objective":"Provide complete answer denominators before expanding each eval into three bars.","acceptance":"Keep canonical eval identities separate and count only explicitly classified observations. Select at most 33 complete eval groups, never truncate an answer group.","from":"eval-status-ledger","aggregate":{"by":["organization","repository","workflow","eval"],"values":[{"field":"eval-result","as":"answers","reducer":"count"},{"field":"eval-result","as":"yes","reducer":"count","filter":{"predicates":[{"field":"eval-result","equals":"YES"}]}},{"field":"eval-result","as":"no","reducer":"count","filter":{"predicates":[{"field":"eval-result","equals":"NO"}]}},{"field":"eval-result","as":"unknown","reducer":"count","filter":{"predicates":[{"field":"eval-result","equals":"UNKNOWN"}]}}]},"order-by":[{"field":"eval","direction":"asc"},{"field":"organization","direction":"asc"},{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}],"limit":33},{"name":"eval-yes-shares","subject":"Compute the YES share of each eval's recorded answers.","objective":"Expose recorded YES proportions for comparing answer categories without inferring verified operational outcomes.","acceptance":"Emit one YES row per retained canonical eval group, including zero YES counts; answer-share is yes / answers across recorded YES, NO and UNKNOWN observations. Do not count absent observations.","from":"eval-answer-counts","compute":[{"as":"eval-result","function":"literal","args":[{"value":"YES"}]},{"as":"answer-order","function":"literal","args":[{"value":0}]},{"as":"answer-share","function":"quotient","args":[{"field":"yes"},{"field":"answers"}]}]},{"name":"eval-no-shares","subject":"Compute the NO share of each eval's recorded answers.","objective":"Expose recorded NO proportions for comparing answer categories without treating historical answers as current verdicts.","acceptance":"Emit one NO row per retained canonical eval group, including zero NO counts; answer-share is no / answers across recorded YES, NO and UNKNOWN observations. Do not count absent observations.","from":"eval-answer-counts","compute":[{"as":"eval-result","function":"literal","args":[{"value":"NO"}]},{"as":"answer-order","function":"literal","args":[{"value":1}]},{"as":"answer-share","function":"quotient","args":[{"field":"no"},{"field":"answers"}]}]},{"name":"eval-unknown-shares","subject":"Compute the explicit UNKNOWN share of each eval's recorded answers.","objective":"Expose explicitly recorded UNKNOWN proportions without conflating absent observations with classified uncertainty.","acceptance":"Emit one UNKNOWN row per retained canonical eval group, including zero UNKNOWN counts; answer-share is unknown / answers across recorded YES, NO and UNKNOWN observations. Missing observations are not UNKNOWN answers.","from":"eval-answer-counts","compute":[{"as":"eval-result","function":"literal","args":[{"value":"UNKNOWN"}]},{"as":"answer-order","function":"literal","args":[{"value":2}]},{"as":"answer-share","function":"quotient","args":[{"field":"unknown"},{"field":"answers"}]}]},{"name":"eval-answer-distribution","subject":"Compare YES, NO and UNKNOWN percentages within each eval.","objective":"Show three horizontal bars per eval that together account for all recorded answers.","acceptance":"Emit all three answer categories, including zero shares; percentages sum to 100 per canonical eval. Missing observations are not UNKNOWN answers. Preserve workflow and repository attribution.","from":"eval-yes-shares","union":["eval-no-shares","eval-unknown-shares"],"compute":[{"as":"answer-percent","function":"product","args":[{"field":"answer-share"},{"value":100}]},{"as":"eval-label","function":"concat","args":[{"field":"eval"},{"value":" | "},{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}],"order-by":[{"field":"eval-label","direction":"asc"},{"field":"answer-order","direction":"asc"}]},{"name":"grader-observed-maxima","subject":"Find each workflow-scoped grader's maximum retained value in the selected data.","objective":"Provide an observed normalization denominator without mixing grader identities or claiming a theoretical maximum.","acceptance":"Group by canonical grader identity, not display name; ignore missing values and preserve zero or negative maxima without substituting a denominator.","from":"grader-observations","aggregate":{"by":["grader-id"],"values":[{"field":"value","as":"max-grader-value","reducer":"max"}]}},{"name":"grader-normalized-observations","subject":"Normalize each grader observation by that grader's observed maximum.","objective":"Compare relative grader values over time while preserving native measurements and run provenance.","acceptance":"Compute value / max-grader-value without clamping or inverting lower-is-better measures; zero or missing denominators produce null, never a fabricated zero or infinity.","from":"grader-observations","joins":[{"source":"grader-observed-maxima","type":"left","on":[{"left":"grader-id","right":"grader-id"}],"fields":[{"field":"max-grader-value","as":"max-grader-value"}]}],"compute":[{"as":"normalized-value","function":"quotient","args":[{"field":"value"},{"field":"max-grader-value"}]},{"as":"_observation-time","function":"timestamp","args":[{"field":"observed-at"}]},{"as":"_unplottable-value","function":"equals-any","args":[{"field":"normalized-value"},{"value":null}]},{"as":"_unplottable-time","function":"equals-any","args":[{"field":"_observation-time"},{"value":null}]},{"as":"grader-series","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":" / "},{"field":"workflow"},{"value":" / "},{"field":"grader"}]}]},{"name":"grader-value-scatter","subject":"Plot timed grader observations with a defined value-to-observed-maximum ratio.","objective":"Show relative grader measurements at their recorded observation times.","acceptance":"Keep each eligible observation and its run link; omit missing ratios or observation times from the plot while retaining those records in the native-value ledger. Ratios are not eval answers or evidence of improvement.","from":"grader-normalized-observations","filter":{"predicates":[{"field":"_unplottable-value","equals":false},{"field":"_unplottable-time","equals":false}]},"order-by":[{"field":"observed-at","direction":"asc"}]},{"name":"grader-status-ledger","subject":"Report grader measurements, units and explicit statuses without confusing them with binary eval answers.","objective":"Preserve numeric grader evidence and distinguish explicit per-observation pass and fail verdicts from unknown statuses.","acceptance":"Retain native grader values, units and statuses. Map only pass/passed to YES and fail/failed to NO in the auxiliary verdict field, leaving all other statuses unknown; never infer an eval answer, current success, causation or policy authority from a grader score.","from":"grader-observations","compute":[{"as":"is-pass","function":"equals-any","args":[{"field":"status"},{"value":"pass"},{"value":"passed"}]},{"as":"is-fail","function":"equals-any","args":[{"field":"status"},{"value":"fail"},{"value":"failed"}]},{"as":"non-pass-verdict","function":"if","args":[{"field":"is-fail"},{"value":"NO"},{"value":"unknown"}]},{"as":"verdict","function":"if","args":[{"field":"is-pass"},{"value":"YES"},{"field":"non-pass-verdict"}]}]},{"name":"routing-session-observations","subject":"Read metadata-only unified-session routing evidence.","objective":"Keep routing analytics independent of native logs and inferred run totals.","acceptance":"Only recognized session events contribute; event clocks remain absent when unrecorded.","from":"audits","filter":{"predicates":[{"field":"event-type","in":["session.format","workflow.info","workflow.job_result","agent.execution","firewall.model_routing","firewall.token_usage","usage.report","firewall.steering","firewall.upstream_error","model.config","model.baseline_estimate","model.resolution","model_routing.outcome","model_endpoint.mismatch","session.collection","session.collection_warning","subagent.request","subagent.started","subagent.configured","subagent.completed","subagent.failed","subagent.model_unavailable"]}]},"compute":[{"as":"record-clock","function":"timestamp","args":[{"field":"event-timestamp"}]},{"as":"event-clock","function":"coalesce","args":[{"field":"routing-session-clock"},{"field":"record-clock"}]},{"as":"routing-run-key","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"run"}]},{"as":"agent-phase","function":"equals-any","args":[{"field":"phase"},{"value":"agent"}]},{"as":"proxy-selection","function":"equals-any","args":[{"field":"routing-stage"},{"value":"selection"}]},{"as":"proxy-failure","function":"equals-any","args":[{"field":"routing-stage"},{"value":"failure"}]},{"as":"has-agent-name","function":"greater-than","args":[{"field":"routing-agent-name"},{"value":""}]}]},{"name":"routing-session-attempts","from":"routing-session-observations","subject":"Identify available session files and their earliest recorded clocks.","objective":"Keep rerun attempts from multiplying routing denominators.","acceptance":"Attempt order is only a tie-breaker after the recorded session clock.","aggregate":{"by":["routing-run-key","run-attempt"],"values":[{"field":"event-clock","as":"session-clock","reducer":"min"}]}},{"name":"routing-session-order","from":"routing-session-attempts","subject":"Order duplicate run sessions by run time and attempt.","objective":"Keep the latest file for each repository/run identity.","acceptance":"Only one attempt contributes to routing facts.","window":[{"operation":"row-number","field":"run-attempt","as":"session-position","groupby":["routing-run-key"],"order-by":[{"field":"session-clock","direction":"desc"},{"field":"run-attempt","direction":"desc"}]}]},{"name":"routing-latest-sessions","from":"routing-session-order","subject":"Retain one authoritative session attempt per run.","objective":"Avoid mixing picks or accounting from reruns.","acceptance":"Duplicate attempts remain available in session coverage.","filter":{"predicates":[{"field":"session-position","equals":1}]}},{"name":"routing-session-events","from":"routing-session-observations","subject":"Read routing metadata from the latest session file per run.","objective":"Deduplicate rerun attempts before any metric.","acceptance":"Earlier attempts never add cost or change the selected pick.","joins":[{"source":"routing-latest-sessions","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"session-clock","as":"session-clock"}]}]},{"name":"routing-run-facts","subject":"Collect per-session source facts without interpreting absence as success.","objective":"Resolve routing states and coverage from runner and proxy evidence.","acceptance":"Agent-phase proxy selection wins over failure and harness status; untimed observations keep unknown time.","from":"routing-session-events","aggregate":{"by":["routing-run-key","organization","repository","workflow","run"],"values":[{"field":"event-clock","as":"run-clock","reducer":"min"},{"field":"run-link","as":"run-link","reducer":"unique"},{"field":"engine","as":"engine","reducer":"unique"},{"field":"event","as":"workflow-info-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"},{"field":"required","equals":true}]}},{"field":"event-status","as":"session-format","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"session.format"}]}},{"field":"event","as":"selection-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"selection"},{"field":"phase","equals":"agent"}]}},{"field":"event","as":"failure-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"failure"},{"field":"phase","equals":"agent"}]}},{"field":"event","as":"local-effort-failures","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"failure"},{"field":"code","equals":"unsupported_reasoning_effort"}]}},{"field":"event","as":"proxy-record-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"phase","equals":"agent"}]}},{"field":"event","as":"agent-accounting-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.token_usage"},{"field":"phase","equals":"agent"}]}},{"field":"event","as":"subagent-count","reducer":"count","filter":{"predicates":[{"field":"event-type","in":["subagent.started","subagent.request","subagent.configured","subagent.completed","subagent.failed","subagent.model_unavailable"]}]}},{"field":"routing-status","as":"harness-status","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-enabled","as":"configured-enabled","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"model.config"}]}},{"field":"routing-selected-model","as":"harness-model","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"telemetry-model","as":"workflow-model","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-selected-effort","as":"harness-effort","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-mode","as":"harness-mode","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-awf-version","as":"session-awf-version","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-goal","as":"configured-goal","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"model.config"}]}},{"field":"routing-configured-mode","as":"configured-routing-mode","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"model.config"}]}},{"field":"routing-max-credits","as":"configured-max-credits","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"model.config"}]}},{"field":"event-status","as":"agent-result","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.job_result"},{"field":"name","equals":"agent"},{"field":"event-status","in":["success","failure","cancelled","skipped"]}]}},{"field":"event","as":"warnings","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"session.collection_warning"}]}}]}},{"name":"routing-ordered-selections","subject":"Order proxy selections within each session.","objective":"Use the last selection by normalized clock and file order.","acceptance":"Harness and advisory picks never override proxy selections.","from":"routing-session-events","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"selection"},{"field":"phase","equals":"agent"}]},"window":[{"operation":"row-number","field":"source-sequence","as":"selection-position","groupby":["routing-run-key"],"order-by":[{"field":"event-timestamp","direction":"desc"},{"field":"source-sequence","direction":"desc"}]}]},{"name":"routing-selections","subject":"Retain one authoritative proxy pick per run.","objective":"Avoid multiplying requests or run counts after re-selection.","acceptance":"One row per identified run uses the final proxy selection.","from":"routing-ordered-selections","filter":{"predicates":[{"field":"selection-position","equals":1}]}},{"name":"routing-resolved-runs","subject":"Resolve routing state, pick and label cells from unified sessions.","objective":"Distinguish selected, failed, harness-only, configured, inferred and unknown evidence.","acceptance":"Proxy evidence wins; configuration conflicts are visible; missing picks and time remain unknown.","from":"routing-run-facts","joins":[{"source":"routing-selections","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"routing-selected-model","as":"proxy-model"},{"field":"routing-selected-effort","as":"proxy-effort"},{"field":"routing-goal","as":"proxy-goal"},{"field":"routing-mode","as":"proxy-mode"},{"field":"routing-configured-mode","as":"proxy-configured-mode"},{"field":"routing-task-type","as":"routing-task-type"},{"field":"routing-scope","as":"routing-scope"},{"field":"routing-complexity","as":"routing-complexity"},{"field":"routing-latency-ms","as":"routing-latency-ms"},{"field":"routing-degraded","as":"routing-degraded"},{"field":"routing-classifier-attempts","as":"routing-classifier-attempts"},{"field":"routing-classifier-model","as":"routing-classifier-model"},{"field":"routing-classifier-effort","as":"routing-classifier-effort"},{"field":"routing-schema","as":"routing-schema"},{"field":"routing-awf-version","as":"proxy-awf-version"},{"field":"routing-router-version","as":"routing-router-version"}]}],"compute":[{"as":"observed-at","function":"iso-timestamp","args":[{"field":"run-clock"}]},{"as":"routing-awf-version","function":"coalesce","args":[{"field":"session-awf-version"},{"field":"proxy-awf-version"}]},{"as":"routing-mode","function":"coalesce","args":[{"field":"proxy-mode"},{"field":"harness-mode"}]},{"as":"routing-goal","function":"coalesce","args":[{"field":"proxy-goal"},{"field":"configured-goal"}]},{"as":"routing-configured-mode","function":"coalesce","args":[{"field":"proxy-configured-mode"},{"field":"configured-routing-mode"}]},{"as":"has-selection","function":"greater-than","args":[{"field":"selection-count"},{"value":0}]},{"as":"has-failure","function":"greater-than","args":[{"field":"failure-count"},{"value":0}]},{"as":"has-harness","function":"equals-any","args":[{"field":"harness-status"},{"value":null}]},{"as":"has-usage","function":"greater-than","args":[{"field":"agent-accounting-count"},{"value":0}]},{"as":"no-proxy","function":"equals-any","args":[{"field":"proxy-record-count"},{"value":0}]},{"as":"usage-state","function":"if","args":[{"field":"has-usage"},{"value":"unrouted_inferred"},{"value":"unknown"}]},{"as":"inferred-state","function":"if","args":[{"field":"no-proxy"},{"field":"usage-state"},{"value":"unknown"}]},{"as":"enabled","function":"equals-any","args":[{"field":"configured-enabled"},{"value":true}]},{"as":"disabled","function":"equals-any","args":[{"field":"configured-enabled"},{"value":false}]},{"as":"enabled-state","function":"if","args":[{"field":"enabled"},{"value":"configured_unrecorded"},{"field":"inferred-state"}]},{"as":"configured-state","function":"if","args":[{"field":"disabled"},{"value":"unrouted"},{"field":"enabled-state"}]},{"as":"reported-state","function":"if","args":[{"field":"has-harness"},{"field":"configured-state"},{"value":"harness_reported"}]},{"as":"failure-state","function":"if","args":[{"field":"has-failure"},{"value":"selection_failed"},{"field":"reported-state"}]},{"as":"routing-state","function":"if","args":[{"field":"has-selection"},{"value":"selected"},{"field":"failure-state"}]},{"as":"observed-pick-model","function":"if","args":[{"field":"has-selection"},{"field":"proxy-model"},{"field":"harness-model"}]},{"as":"observed-pick-effort","function":"if","args":[{"field":"has-selection"},{"field":"proxy-effort"},{"field":"harness-effort"}]},{"as":"pick-model","function":"coalesce","args":[{"field":"observed-pick-model"},{"value":"unknown"}]},{"as":"pick-effort","function":"coalesce","args":[{"field":"observed-pick-effort"},{"value":"unknown"}]},{"as":"pick","function":"concat","args":[{"field":"pick-model"},{"value":" / "},{"field":"pick-effort"}]},{"as":"has-proxy-decision","function":"if","args":[{"field":"has-selection"},{"value":true},{"field":"has-failure"}]},{"as":"has-decision","function":"if","args":[{"field":"has-harness"},{"field":"has-proxy-decision"},{"value":true}]},{"as":"configuration-conflict","function":"if","args":[{"field":"disabled"},{"field":"has-decision"},{"value":false}]},{"as":"unknown-pick-model","function":"equals-any","args":[{"field":"pick-model"},{"value":"unknown"}]},{"as":"unknown-pick-effort","function":"equals-any","args":[{"field":"pick-effort"},{"value":"unknown"}]},{"as":"unknown-pick","function":"if","args":[{"field":"unknown-pick-model"},{"value":true},{"field":"unknown-pick-effort"}]},{"as":"routing-key-encoded","function":"url-encode","args":[{"field":"routing-run-key"}]},{"as":"routing-href","function":"concat","args":[{"value":"#page-routing-run?routing-run="},{"field":"routing-key-encoded"}]},{"as":"routing-dashboard-link","function":"dashboard-link","args":[{"field":"run-link"},{"field":"routing-href"},{"field":"run"}]}],"filter":{"predicates":[{"field":"workflow-info-count","gte":1}]}},{"name":"routing-filter-candidates","from":"routing-aggregates","subject":"Apply one run-level scope before every routing metric and event join.","objective":"Filter complete sessions, never fragments of their evidence.","acceptance":"Unknown run time is excluded from a bounded range; blank filters retain all known values.","parameters":[{"name":"routing-filter-workflow","type":"string"},{"name":"routing-filter-repository","type":"string"},{"name":"routing-filter-engine","type":"string"},{"name":"routing-filter-state","type":"string"},{"name":"routing-filter-goal","type":"string"},{"name":"routing-filter-mode","type":"string"},{"name":"routing-filter-awf","type":"string"},{"name":"routing-filter-start","type":"string"},{"name":"routing-filter-end","type":"string"}],"compute":[{"as":"full-repository","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"all-workflows","function":"equals-any","args":[{"parameter":"routing-filter-workflow"},{"value":""}]},{"as":"same-workflow","function":"equals-any","args":[{"field":"workflow"},{"parameter":"routing-filter-workflow"}]},{"as":"include-workflow","function":"if","args":[{"field":"all-workflows"},{"value":true},{"field":"same-workflow"}]},{"as":"all-repositories","function":"equals-any","args":[{"parameter":"routing-filter-repository"},{"value":""}]},{"as":"same-repository","function":"equals-any","args":[{"field":"full-repository"},{"parameter":"routing-filter-repository"}]},{"as":"include-repository","function":"if","args":[{"field":"all-repositories"},{"value":true},{"field":"same-repository"}]},{"as":"all-engines","function":"equals-any","args":[{"parameter":"routing-filter-engine"},{"value":""}]},{"as":"same-engine","function":"equals-any","args":[{"field":"engine"},{"parameter":"routing-filter-engine"}]},{"as":"include-engine","function":"if","args":[{"field":"all-engines"},{"value":true},{"field":"same-engine"}]},{"as":"all-states","function":"equals-any","args":[{"parameter":"routing-filter-state"},{"value":""}]},{"as":"same-state","function":"equals-any","args":[{"field":"routing-state"},{"parameter":"routing-filter-state"}]},{"as":"include-state","function":"if","args":[{"field":"all-states"},{"value":true},{"field":"same-state"}]},{"as":"all-goals","function":"equals-any","args":[{"parameter":"routing-filter-goal"},{"value":""}]},{"as":"same-goal","function":"equals-any","args":[{"field":"routing-goal"},{"parameter":"routing-filter-goal"}]},{"as":"include-goal","function":"if","args":[{"field":"all-goals"},{"value":true},{"field":"same-goal"}]},{"as":"all-modes","function":"equals-any","args":[{"parameter":"routing-filter-mode"},{"value":""}]},{"as":"same-mode","function":"equals-any","args":[{"field":"routing-mode"},{"parameter":"routing-filter-mode"}]},{"as":"include-mode","function":"if","args":[{"field":"all-modes"},{"value":true},{"field":"same-mode"}]},{"as":"all-awf","function":"equals-any","args":[{"parameter":"routing-filter-awf"},{"value":""}]},{"as":"same-awf","function":"equals-any","args":[{"field":"routing-awf-version"},{"parameter":"routing-filter-awf"}]},{"as":"include-awf","function":"if","args":[{"field":"all-awf"},{"value":true},{"field":"same-awf"}]},{"as":"all-starts","function":"equals-any","args":[{"parameter":"routing-filter-start"},{"value":""}]},{"as":"start-clock","function":"timestamp","args":[{"parameter":"routing-filter-start"}]},{"as":"start-before","function":"difference","args":[{"field":"start-clock"},{"value":1}]},{"as":"after-start","function":"greater-than","args":[{"field":"run-clock"},{"field":"start-before"}]},{"as":"include-start","function":"if","args":[{"field":"all-starts"},{"value":true},{"field":"after-start"}]},{"as":"all-ends","function":"equals-any","args":[{"parameter":"routing-filter-end"},{"value":""}]},{"as":"end-clock","function":"timestamp","args":[{"parameter":"routing-filter-end"}]},{"as":"before-end","function":"greater-than","args":[{"field":"end-clock"},{"field":"run-clock"}]},{"as":"include-end","function":"if","args":[{"field":"all-ends"},{"value":true},{"field":"before-end"}]}]},{"name":"routing-runs","from":"routing-filter-candidates","subject":"Retain identified runs matching every selected routing filter.","objective":"Use the same population for adoption, accounting and outcomes.","acceptance":"A time bound excludes untimed runs and does not remove individual events from retained sessions.","filter":{"predicates":[{"field":"include-workflow","equals":true},{"field":"include-repository","equals":true},{"field":"include-engine","equals":true},{"field":"include-state","equals":true},{"field":"include-goal","equals":true},{"field":"include-mode","equals":true},{"field":"include-awf","equals":true},{"field":"include-start","equals":true},{"field":"include-end","equals":true}]}},{"name":"routing-events","from":"routing-session-events","subject":"Retain all evidence belonging to scoped identified runs.","objective":"Filter event metrics by the resolved run rather than by individual event clocks.","acceptance":"State, pick and accounting are computed before the scope is applied.","joins":[{"source":"routing-runs","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"routing-state","as":"run-routing-state"}]}]},{"name":"routing-phase-sources","subject":"Choose one nonoverlapping accounting source per run and phase.","objective":"Prefer proxy token usage over usage reports.","acceptance":"Snapshot totals and cumulative totalAic never enter additive cost.","from":"routing-events","aggregate":{"by":["routing-run-key","phase"],"values":[{"field":"event","as":"proxy-usage-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.token_usage"}]}},{"field":"event","as":"report-usage-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"usage.report"}]}},{"field":"event","as":"proxy-source-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"session.collection"},{"field":"name","equals":"token-usage.jsonl"},{"field":"event-status","equals":"collected"}]}},{"field":"event","as":"report-source-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"session.collection"},{"field":"name","in":["agent_usage.json","usage.json","usage.jsonl","usage-report.jsonl"]},{"field":"event-status","equals":"collected"}]}}]}},{"name":"routing-accounting-candidates","subject":"Read nonoverlapping per-response accounting records.","objective":"Expose recorded credits and token classes without repricing unknown usage.","acceptance":"Each phase uses proxy accounting when present and usage.report otherwise; absent AIC is counted.","from":"routing-events","joins":[{"source":"routing-phase-sources","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"}],"fields":[{"field":"proxy-usage-count","as":"proxy-usage-count"}]}],"compute":[{"as":"has-proxy-accounting","function":"greater-than","args":[{"field":"proxy-usage-count"},{"value":0}]},{"as":"accounting-identity","function":"coalesce","args":[{"field":"correlation-id"},{"field":"event"}]},{"as":"accounting-source","function":"if","args":[{"field":"has-proxy-accounting"},{"value":"firewall.token_usage"},{"value":"usage.report"}]},{"as":"selected-accounting","function":"equals-any","args":[{"field":"event-type"},{"field":"accounting-source"}]},{"as":"unknown-aic","function":"equals-any","args":[{"field":"aic"},{"value":null}]},{"as":"unknown-aic-count","function":"if","args":[{"field":"unknown-aic"},{"value":1},{"value":0}]}],"window":[{"operation":"row-number","field":"source-sequence","as":"accounting-position","groupby":["routing-run-key","phase","event-type","accounting-identity"],"order-by":[{"field":"event-timestamp","direction":"desc"},{"field":"source-sequence","direction":"desc"}]}]},{"name":"routing-accounting","subject":"Select the authoritative accounting source for each phase.","objective":"Exclude overlapping usage reports and snapshots.","acceptance":"Every accounting row contributes at most once.","from":"routing-accounting-candidates","filter":{"predicates":[{"field":"selected-accounting","equals":true},{"field":"accounting-position","equals":1},{"field":"phase","in":["agent","detection","evals"]}]}},{"name":"routing-request-candidates","subject":"Keep per-request routing decisions separate from accounting.","objective":"Join routed outcomes by run, phase and request ID.","acceptance":"Rejected requests establish local zero cost; other unmatched requests retain unknown cost.","from":"routing-events","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"request"}]},"compute":[{"as":"request-identity","function":"coalesce","args":[{"field":"correlation-id"},{"field":"event"}]}],"window":[{"operation":"row-number","field":"source-sequence","as":"request-position","groupby":["routing-run-key","phase","request-identity"],"order-by":[{"field":"event-timestamp","direction":"desc"},{"field":"source-sequence","direction":"desc"}]}]},{"name":"routing-request-records","from":"routing-request-candidates","subject":"Retain the latest record for each request identity.","objective":"Avoid duplicate request joins and overlapping totals.","acceptance":"Requests without IDs remain independent, not falsely correlated.","filter":{"predicates":[{"field":"request-position","equals":1}]}},{"name":"routing-subagent-candidates","subject":"Read engine-reported sub-agent request ownership.","objective":"Use exact request-ID ownership before falling back to unsplit traffic.","acceptance":"Only request identities can assign exact ownership; advisory outcomes never assign credits.","from":"routing-events","filter":{"predicates":[{"field":"event-type","equals":"subagent.request"}]},"compute":[{"as":"subagent-identity","function":"coalesce","args":[{"field":"correlation-id"},{"field":"event"}]}],"window":[{"operation":"row-number","field":"source-sequence","as":"subagent-position","groupby":["routing-run-key","phase","subagent-identity"],"order-by":[{"field":"event-timestamp","direction":"desc"},{"field":"source-sequence","direction":"desc"}]}]},{"name":"routing-subagent-requests","from":"routing-subagent-candidates","subject":"Retain one sub-agent observation per request identity.","objective":"Keep exact ownership joins unique.","acceptance":"Missing identities do not match unrelated requests.","filter":{"predicates":[{"field":"subagent-position","equals":1}]}},{"name":"routing-exact-accounting","subject":"Attribute each accounting record to exactly one traffic bucket.","objective":"Keep detection, evals, classifier, exact sub-agent, main, unsplit and unattributed credits distinct.","acceptance":"Detection and evals use phase, missing purpose is never agent by default, and snapshot credits are excluded.","from":"routing-accounting","joins":[{"source":"routing-request-records","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"},{"left":"correlation-id","right":"correlation-id"}],"fields":[{"field":"event","as":"request-event"},{"field":"routing-routed","as":"request-routed"},{"field":"routing-deviations","as":"request-deviations"},{"field":"routing-outcome","as":"request-outcome"},{"field":"routing-requested-model","as":"request-model"},{"field":"routing-requested-effort","as":"request-effort"}]},{"source":"routing-subagent-requests","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"},{"left":"correlation-id","right":"correlation-id"}],"fields":[{"field":"routing-agent-name","as":"exact-agent-name"}]},{"source":"routing-run-facts","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"subagent-count","as":"subagent-count"}]}],"compute":[{"as":"exact-owner","function":"coalesce","args":[{"field":"routing-agent-name"},{"field":"exact-agent-name"}]},{"as":"no-exact-owner","function":"equals-any","args":[{"field":"exact-owner"},{"value":null}]}]},{"name":"routing-correlation-usage-candidates","from":"routing-exact-accounting","subject":"Find accounting records without exact sub-agent ownership.","objective":"Correlate only fully recorded token quartets in file order.","acceptance":"Missing token classes never match by model alone.","filter":{"predicates":[{"field":"phase","equals":"agent"},{"field":"no-exact-owner","equals":true}]},"compute":[{"as":"token-quartet","function":"sum","args":[{"field":"input-tokens"},{"field":"output-tokens"},{"field":"cache-read-tokens"},{"field":"cache-write-tokens"}]},{"as":"is-classifier","function":"equals-any","args":[{"field":"routing-purpose"},{"value":"routing_classification"}]}]},{"name":"routing-correlation-usage","from":"routing-correlation-usage-candidates","subject":"Order unmatched accounting within model and token quartet.","objective":"Match each engine-reported request at most once.","acceptance":"Classifier, incomplete and already-exact requests are excluded.","filter":{"predicates":[{"field":"token-quartet","gte":0},{"field":"is-classifier","equals":false}]},"window":[{"operation":"row-number","field":"source-sequence","as":"correlation-position","groupby":["routing-run-key","telemetry-model","input-tokens","output-tokens","cache-read-tokens","cache-write-tokens"],"order-by":[{"field":"source-sequence","direction":"asc"}]}]},{"name":"routing-correlation-subagent-candidates","from":"routing-subagent-requests","subject":"Exclude engine requests already matched by proxy request ID.","objective":"Prevent exact and correlated ownership from claiming the same request.","acceptance":"Only engine requests with a complete quartet and a definition name can correlate.","joins":[{"source":"routing-accounting","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"},{"left":"correlation-id","right":"correlation-id"}],"fields":[{"field":"event","as":"exact-accounting-event"}]}],"compute":[{"as":"token-quartet","function":"sum","args":[{"field":"input-tokens"},{"field":"output-tokens"},{"field":"cache-read-tokens"},{"field":"cache-write-tokens"}]}]},{"name":"routing-correlation-subagents","from":"routing-correlation-subagent-candidates","subject":"Order unmatched engine requests within each model/token quartet.","objective":"Produce deterministic one-to-one correlated ownership.","acceptance":"Correlation is labelled separately from exact evidence.","filter":{"predicates":[{"field":"exact-accounting-event","equals":null},{"field":"token-quartet","gte":0},{"field":"phase","equals":"agent"}]},"window":[{"operation":"row-number","field":"source-sequence","as":"correlation-position","groupby":["routing-run-key","telemetry-model","input-tokens","output-tokens","cache-read-tokens","cache-write-tokens"],"order-by":[{"field":"source-sequence","direction":"asc"}]}]},{"name":"routing-correlated-accounting","from":"routing-correlation-usage","subject":"Join proxy usage with unmatched engine requests by model, quartet and occurrence.","objective":"Use the spec's correlated sub-agent attribution without duplicating credits.","acceptance":"Each engine request and accounting record participates at most once.","joins":[{"source":"routing-correlation-subagents","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"telemetry-model","right":"telemetry-model"},{"left":"input-tokens","right":"input-tokens"},{"left":"output-tokens","right":"output-tokens"},{"left":"cache-read-tokens","right":"cache-read-tokens"},{"left":"cache-write-tokens","right":"cache-write-tokens"},{"left":"correlation-position","right":"correlation-position"}],"fields":[{"field":"routing-agent-name","as":"correlated-owner"}]}],"select":[{"field":"routing-run-key"},{"field":"event"},{"field":"correlated-owner"}]},{"name":"routing-attributed-accounting","from":"routing-exact-accounting","subject":"Assign every accounting record to exactly one exclusive bucket.","objective":"Keep exact and correlated sub-agent ownership distinct.","acceptance":"Phase wins over purpose; missing ownership remains unsplit or unattributed.","joins":[{"source":"routing-correlated-accounting","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"event","right":"event"}],"fields":[{"field":"correlated-owner","as":"correlated-owner"}]}],"compute":[{"as":"agent-name","function":"coalesce","args":[{"field":"exact-owner"},{"field":"correlated-owner"}]},{"as":"unknown-agent","function":"equals-any","args":[{"field":"agent-name"},{"value":null}]},{"as":"unknown-request","function":"equals-any","args":[{"field":"request-event"},{"value":null}]},{"as":"has-subagents","function":"greater-than","args":[{"field":"subagent-count"},{"value":0}]},{"as":"is-subagent-purpose","function":"equals-any","args":[{"field":"routing-purpose"},{"value":"subagent"}]},{"as":"is-agent-purpose","function":"equals-any","args":[{"field":"routing-purpose"},{"value":"agent"}]},{"as":"matched-bucket","function":"if","args":[{"field":"has-subagents"},{"value":"agent_unsplit"},{"value":"main_agent"}]},{"as":"request-bucket","function":"if","args":[{"field":"unknown-request"},{"value":"unattributed"},{"field":"matched-bucket"}]},{"as":"subagent-bucket","function":"if","args":[{"field":"is-subagent-purpose"},{"value":"agent_unsplit"},{"field":"request-bucket"}]},{"as":"purpose-bucket","function":"if","args":[{"field":"is-agent-purpose"},{"value":"main_agent"},{"field":"subagent-bucket"}]},{"as":"subagent-attribution","function":"if","args":[{"field":"no-exact-owner"},{"value":"subagent_correlated"},{"value":"subagent_exact"}]},{"as":"ownership-bucket","function":"if","args":[{"field":"unknown-agent"},{"field":"purpose-bucket"},{"field":"subagent-attribution"}]},{"as":"classifier","function":"equals-any","args":[{"field":"routing-purpose"},{"value":"routing_classification"}]},{"as":"classifier-bucket","function":"if","args":[{"field":"classifier"},{"value":"classifier"},{"field":"ownership-bucket"}]},{"as":"evals","function":"equals-any","args":[{"field":"phase"},{"value":"evals"}]},{"as":"phase-bucket","function":"if","args":[{"field":"evals"},{"value":"evals"},{"field":"classifier-bucket"}]},{"as":"detection","function":"equals-any","args":[{"field":"phase"},{"value":"detection"}]},{"as":"bucket","function":"if","args":[{"field":"detection"},{"value":"detection"},{"field":"phase-bucket"}]}]},{"name":"routing-joined-requests","subject":"Inspect per-request deviations and outcomes against proxy picks.","objective":"Keep requests without accounting visible and never invent a deviation cause.","acceptance":"Unmatched requests have unknown cost; each request retains its own requested and selected model.","from":"routing-request-records","joins":[{"source":"routing-accounting","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"},{"left":"correlation-id","right":"correlation-id"}],"fields":[{"field":"aic","as":"accounted-aic"},{"field":"event","as":"accounting-event"}]}],"compute":[{"as":"missing-accounting","function":"equals-any","args":[{"field":"accounting-event"},{"value":null}]},{"as":"failed-request","function":"equals-any","args":[{"field":"routing-outcome"},{"value":"failed"}]},{"as":"failed-unaccounted","function":"if","args":[{"field":"missing-accounting"},{"field":"failed-request"},{"value":false}]}],"order-by":[{"field":"event-timestamp","direction":"desc"}]},{"name":"routing-unaccounted-failures","from":"routing-joined-requests","subject":"Count failed requests lacking accounting per run.","objective":"Recognize only unambiguous AWF-local effort failures.","acceptance":"A run-level effort failure cannot assign zero to multiple failed requests.","aggregate":{"by":["routing-run-key"],"values":[{"field":"event","as":"failed-unaccounted-count","reducer":"count","filter":{"predicates":[{"field":"failed-unaccounted","equals":true}]}}]}},{"name":"routing-deviations","from":"routing-joined-requests","subject":"Resolve explicit local zero costs and preserve all other unknown request costs.","objective":"Avoid partial-cost comparisons based on missing accounting.","acceptance":"Only guard rejection or an unambiguous local effort failure establishes zero AIC.","joins":[{"source":"routing-unaccounted-failures","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"failed-unaccounted-count","as":"failed-unaccounted-count"}]},{"source":"routing-run-facts","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"local-effort-failures","as":"local-effort-failures"}]}],"compute":[{"as":"only-unaccounted-failure","function":"equals-any","args":[{"field":"failed-unaccounted-count"},{"value":1}]},{"as":"has-local-failure","function":"greater-than","args":[{"field":"local-effort-failures"},{"value":0}]},{"as":"unambiguous-local-failure","function":"if","args":[{"field":"only-unaccounted-failure"},{"field":"has-local-failure"},{"value":false}]},{"as":"local-code","function":"equals-any","args":[{"field":"code"},{"value":"unsupported_reasoning_effort"}]},{"as":"local-evidence","function":"if","args":[{"field":"local-code"},{"value":true},{"field":"unambiguous-local-failure"}]},{"as":"local-failure","function":"if","args":[{"field":"failed-request"},{"field":"local-evidence"},{"value":false}]},{"as":"guard-rejection","function":"equals-any","args":[{"field":"routing-outcome"},{"value":"rejected"}]},{"as":"zero-local-cost","function":"if","args":[{"field":"guard-rejection"},{"value":true},{"field":"local-failure"}]},{"as":"local-cost","function":"if","args":[{"field":"zero-local-cost"},{"value":0},{"value":null}]},{"as":"request-aic","function":"coalesce","args":[{"field":"accounted-aic"},{"field":"local-cost"}]},{"as":"unknown-request-cost","function":"equals-any","args":[{"field":"request-aic"},{"value":null}]},{"as":"unknown-request-count","function":"if","args":[{"field":"unknown-request-cost"},{"value":1},{"value":0}]}]},{"name":"routing-phase-usage","from":"routing-accounting","subject":"Sum nonoverlapping accounting per run and phase.","objective":"Establish complete costs only with known response values.","acceptance":"Unknown response costs remain counted.","aggregate":{"by":["routing-run-key","phase"],"values":[{"field":"aic","as":"recorded-aic","reducer":"sum"},{"field":"aic","as":"known-responses","reducer":"count"},{"field":"unknown-aic-count","as":"unknown-responses","reducer":"sum"}]}},{"name":"routing-request-coverage","from":"routing-deviations","subject":"Count requests whose cost remains unknown.","objective":"Exclude incomplete runs from distribution comparisons.","acceptance":"Unmatched nonlocal requests cannot be treated as free.","aggregate":{"by":["routing-run-key","phase"],"values":[{"field":"unknown-request-count","as":"unknown-requests","reducer":"sum"}]}},{"name":"routing-phase-costs","from":"routing-phase-sources","subject":"Evaluate accounting completeness using collected source receipts and request joins.","objective":"Exclude partial costs from medians and comparisons.","acceptance":"A complete phase has its selected accounting source, no missing AIC and no unaccounted nonlocal requests.","joins":[{"source":"routing-phase-usage","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"}],"fields":[{"field":"recorded-aic","as":"recorded-aic"},{"field":"unknown-responses","as":"unknown-responses"},{"field":"known-responses","as":"known-responses"}]},{"source":"routing-request-coverage","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"}],"fields":[{"field":"unknown-requests","as":"unknown-requests"}]}],"compute":[{"as":"has-proxy","function":"greater-than","args":[{"field":"proxy-usage-count"},{"value":0}]},{"as":"has-report","function":"greater-than","args":[{"field":"report-usage-count"},{"value":0}]},{"as":"any-source-count","function":"sum","args":[{"field":"proxy-source-count"},{"field":"report-source-count"}]},{"as":"report-or-empty-source","function":"if","args":[{"field":"has-report"},{"field":"report-source-count"},{"field":"any-source-count"}]},{"as":"accounting-source-count","function":"if","args":[{"field":"has-proxy"},{"field":"proxy-source-count"},{"field":"report-or-empty-source"}]},{"as":"source-present","function":"greater-than","args":[{"field":"accounting-source-count"},{"value":0}]},{"as":"missing-responses","function":"coalesce","args":[{"field":"unknown-responses"},{"value":0}]},{"as":"missing-requests","function":"coalesce","args":[{"field":"unknown-requests"},{"value":0}]},{"as":"missing-count","function":"sum","args":[{"field":"missing-responses"},{"field":"missing-requests"}]},{"as":"all-values-known","function":"equals-any","args":[{"field":"missing-count"},{"value":0}]},{"as":"complete","function":"if","args":[{"field":"source-present"},{"field":"all-values-known"},{"value":false}]},{"as":"known-sum","function":"coalesce","args":[{"field":"recorded-aic"},{"value":0}]},{"as":"complete-aic","function":"if","args":[{"field":"complete"},{"field":"known-sum"},{"value":null}]}]},{"name":"routing-agent-costs","from":"routing-phase-costs","subject":"Select complete or explicitly partial agent-phase costs.","objective":"Keep detection and evals out of agent-phase comparisons.","acceptance":"Classifier remains part of agent-phase cost.","filter":{"predicates":[{"field":"phase","equals":"agent"}]}},{"name":"routing-detection-costs","from":"routing-phase-costs","subject":"Retain detection-phase cost completeness separately.","objective":"Do not count detection as classifier or agent traffic.","acceptance":"Missing detection evidence remains unknown, not zero.","filter":{"predicates":[{"field":"phase","equals":"detection"}]}},{"name":"routing-cost-runs","from":"routing-resolved-runs","subject":"Attach accounting completeness to identified routing runs.","objective":"Provide comparable costs only for complete runs.","acceptance":"An absent cost stays unknown and never inherits aggregate run AIC.","joins":[{"source":"routing-runs","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"main-aic","as":"main-aic"},{"field":"baseline-model","as":"baseline-model"},{"field":"baseline-aic","as":"baseline-aic"},{"field":"baseline-complete","as":"baseline-complete"}]},{"source":"routing-agent-costs","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"complete-aic","as":"complete-aic"},{"field":"complete","as":"cost-complete"},{"field":"missing-count","as":"missing-cost-records"}]},{"source":"routing-detection-costs","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"complete-aic","as":"detection-aic"},{"field":"complete","as":"detection-complete"}]}],"compute":[{"as":"run-cost-complete","function":"if","args":[{"field":"cost-complete"},{"field":"detection-complete"},{"value":false}]},{"as":"run-aic","function":"sum","args":[{"field":"complete-aic"},{"field":"detection-aic"}]},{"as":"budget-use","function":"quotient","args":[{"field":"run-aic"},{"field":"configured-max-credits"}]}]},{"name":"routing-run-summary","from":"routing-runs","subject":"Keep the selected Run's compact routing and baseline evidence visible.","objective":"Preserve the comparison when shorter-lived Audit detail expires.","acceptance":"Retained aggregate costs and baseline evidence survive Audit expiry; absent phase details stay unknown.","joins":[{"source":"routing-cost-runs","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"cost-complete","as":"cost-complete"},{"field":"missing-cost-records","as":"missing-cost-records"},{"field":"detection-aic","as":"detection-aic"},{"field":"run-aic","as":"run-aic"},{"field":"budget-use","as":"budget-use"}]}]},{"name":"routing-weekly-cost-totals","from":"routing-runs","subject":"Summarize complete agent-phase costs by UTC ISO week and routing state.","objective":"Expose trends without including partial costs.","acceptance":"Untimed runs cannot enter time buckets.","filter":{"predicates":[{"field":"run-clock","gte":0}]},"compute":[{"as":"week","function":"date-bucket","args":[{"field":"observed-at"},{"value":"week"}]}],"aggregate":{"by":["week","routing-state"],"values":[{"field":"run","as":"runs","reducer":"count"},{"field":"complete-aic","as":"complete-runs","reducer":"count"},{"field":"complete-aic","as":"observed-median","reducer":"median"}]}},{"name":"routing-weekly-accounting-cost","from":"routing-weekly-cost-totals","subject":"Gate weekly medians by complete sample size.","objective":"Keep sparse weeks from implying meaningful cost trends.","acceptance":"Weeks below the configurable minimum display insufficient data.","parameters":[{"name":"minimum-sample","type":"number"}],"compute":[{"as":"cost-series","function":"concat","args":[{"value":"Agent-phase accounting: "},{"field":"routing-state"}]},{"as":"sample-floor","function":"difference","args":[{"parameter":"minimum-sample"},{"value":1}]},{"as":"enough-samples","function":"greater-than","args":[{"field":"complete-runs"},{"field":"sample-floor"}]},{"as":"median-aic","function":"if","args":[{"field":"enough-samples"},{"field":"observed-median"},{"value":null}]},{"as":"sample-status","function":"if","args":[{"field":"enough-samples"},{"value":"observational"},{"value":"insufficient data"}]}],"order-by":[{"field":"week","direction":"asc"}]},{"name":"routing-resolutions","from":"routing-session-events","subject":"Read runner-written configured-model resolutions for scoped routing runs.","objective":"Explain what each workflow role's configured model resolved to before the engine launched.","acceptance":"Only model.resolution facts from latest scoped attempts contribute; missing or unsafe values and failed null resolutions remain unknown.","joins":[{"source":"routing-runs","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"run-clock","as":"run-clock"},{"field":"observed-at","as":"run-observed-at"},{"field":"full-repository","as":"full-repository"},{"field":"routing-dashboard-link","as":"routing-dashboard-link"},{"field":"routing-state","as":"run-routing-state"}]}],"filter":{"predicates":[{"field":"event-type","equals":"model.resolution"}]},"compute":[{"as":"resolution-engine","function":"coalesce","args":[{"field":"telemetry-engine"},{"value":"unknown"}]},{"as":"resolution-role-label","function":"coalesce","args":[{"field":"resolution-role"},{"value":"unknown"}]},{"as":"configured-model","function":"coalesce","args":[{"field":"resolution-configured-model"},{"value":"unknown"}]},{"as":"resolved-model-label","function":"coalesce","args":[{"field":"resolution-resolved-model"},{"value":"unknown"}]},{"as":"resolution-provider","function":"coalesce","args":[{"field":"provider"},{"value":"unknown"}]},{"as":"resolution-status","function":"coalesce","args":[{"field":"event-status"},{"value":"unknown"}]},{"as":"failed-resolution","function":"equals-any","args":[{"field":"event-status"},{"value":"failed"}]},{"as":"failure-cause","function":"coalesce","args":[{"field":"code"},{"value":"unknown"}]},{"as":"resolution-cause","function":"if","args":[{"field":"failed-resolution"},{"field":"failure-cause"},{"field":"code"}]},{"as":"unknown-resolved-model","function":"equals-any","args":[{"field":"resolution-resolved-model"},{"value":null}]},{"as":"untimed","function":"equals-any","args":[{"field":"run-clock"},{"value":null}]},{"as":"configured-to-resolved","function":"concat","args":[{"field":"configured-model"},{"value":" → "},{"field":"resolved-model-label"}]},{"as":"workflow-key","function":"concat","args":[{"field":"full-repository"},{"value":":"},{"field":"workflow"}]},{"as":"resolution-actor","function":"concat","args":[{"field":"resolution-engine"},{"value":"/"},{"field":"resolution-role-label"},{"value":"/"},{"field":"resolution-provider"}]},{"as":"resolution-series","function":"concat","args":[{"field":"workflow-key"},{"value":" | "},{"field":"resolution-actor"},{"value":" | "},{"field":"configured-model"}]}]},{"name":"routing-health-totals","from":"routing-runs","subject":"Count routed runs and their selection, failure, adherence, outcome and cost evidence per repository and workflow.","objective":"Answer whether routing is on and working from one row per routed workflow.","acceptance":"Only selected, selection_failed, harness_reported and configured_unrecorded runs contribute; runs without evidence stay out of each denominator.","filter":{"predicates":[{"field":"routing-state","in":["selected","selection_failed","harness_reported","configured_unrecorded"]}]},"compute":[{"as":"has-routing-failure","function":"greater-than","args":[{"field":"failure-count"},{"value":0}]},{"as":"failure-or-fallback","function":"if","args":[{"field":"has-routing-failure"},{"value":true},{"field":"routing-degraded"}]},{"as":"adherence-known","function":"greater-than","args":[{"field":"flagged-requests"},{"value":0}]},{"as":"no-deviation","function":"equals-any","args":[{"field":"deviated-requests"},{"value":0}]}],"aggregate":{"by":["full-repository","workflow","baseline-model"],"values":[{"field":"paired-main-aic","as":"paired-main-aic","reducer":"sum"},{"field":"paired-baseline-aic","as":"paired-baseline-aic","reducer":"sum"},{"field":"run","as":"routed-runs","reducer":"count"},{"field":"run","as":"selected-runs","reducer":"count","filter":{"predicates":[{"field":"routing-state","equals":"selected"}]}},{"field":"run","as":"failure-runs","reducer":"count","filter":{"predicates":[{"field":"failure-or-fallback","equals":true}]}},{"field":"run","as":"adherence-known-runs","reducer":"count","filter":{"predicates":[{"field":"adherence-known","equals":true}]}},{"field":"run","as":"followed-runs","reducer":"count","filter":{"predicates":[{"field":"adherence-known","equals":true},{"field":"no-deviation","equals":true}]}},{"field":"agent-result","as":"known-outcomes","reducer":"count"},{"field":"run","as":"successes","reducer":"count","filter":{"predicates":[{"field":"agent-result","equals":"success"}]}},{"field":"complete-aic","as":"complete-runs","reducer":"count"},{"field":"complete-aic","as":"median-aic","reducer":"median"}]}},{"name":"routing-health","subject":"Show routing health shares per repository and workflow.","objective":"Tell whether routing is on and working from selection, failure or fallback, pick adherence, known outcomes and complete cost.","acceptance":"A zero denominator or no complete cost is unknown, never zero; unknown job outcomes are excluded from the success rate.","from":"routing-health-totals","compute":[{"as":"estimated-cost-vs-baseline","function":"quotient","args":[{"field":"paired-main-aic"},{"field":"paired-baseline-aic"}]},{"as":"estimated-cost-percent","function":"format-percent","args":[{"field":"estimated-cost-vs-baseline"}]},{"as":"selected-share","function":"quotient","args":[{"field":"selected-runs"},{"field":"routed-runs"}]},{"as":"failure-share","function":"quotient","args":[{"field":"failure-runs"},{"field":"routed-runs"}]},{"as":"followed-share","function":"quotient","args":[{"field":"followed-runs"},{"field":"adherence-known-runs"}]},{"as":"success-rate","function":"quotient","args":[{"field":"successes"},{"field":"known-outcomes"}]},{"as":"selected-percent","function":"format-percent","args":[{"field":"selected-share"}]},{"as":"failure-percent","function":"format-percent","args":[{"field":"failure-share"}]},{"as":"followed-percent","function":"format-percent","args":[{"field":"followed-share"}]},{"as":"success-percent","function":"format-percent","args":[{"field":"success-rate"}]}],"order-by":[{"field":"routed-runs","direction":"desc"},{"field":"full-repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"routing-weekly-models","from":"routing-runs","subject":"Count proxy-selected runs by UTC ISO week and picked model.","objective":"Show what the router chooses over time.","acceptance":"Only selected runs with a known pick model and a recorded run clock contribute; an unrecorded effort does not exclude a run.","filter":{"predicates":[{"field":"routing-state","equals":"selected"},{"field":"unknown-pick-model","equals":false},{"field":"run-clock","gte":0}]},"compute":[{"as":"week","function":"date-bucket","args":[{"field":"observed-at"},{"value":"week"}]}],"aggregate":{"by":["week","pick-model"],"values":[{"field":"run","as":"runs","reducer":"count"}]},"order-by":[{"field":"week","direction":"asc"},{"field":"pick-model","direction":"asc"}]},{"name":"routing-weekly-paired-totals","from":"routing-runs","subject":"Weekly paired complete main-request costs by baseline model.","objective":"Compare routing cost trends with each named baseline using identical main-request populations.","acceptance":"Only timed runs with complete positive baseline estimates and matching known main-request costs contribute to both medians.","filter":{"predicates":[{"field":"paired","equals":true},{"field":"run-clock","gte":0}]},"compute":[{"as":"week","function":"date-bucket","args":[{"field":"observed-at"},{"value":"week"}]}],"aggregate":{"by":["week","baseline-model"],"values":[{"field":"run","as":"complete-runs","reducer":"count"},{"field":"paired-main-aic","as":"observed-main-median","reducer":"median"},{"field":"paired-baseline-aic","as":"baseline-estimate-median","reducer":"median"}]}},{"name":"routing-weekly-paired-cost","from":"routing-weekly-paired-totals","subject":"Paired main-request samples that meet the chosen evidence floor.","objective":"Avoid changing routing policy based on insufficient paired evidence.","acceptance":"Observed and estimated series share the same complete-run count and configurable minimum sample.","parameters":[{"name":"minimum-sample","type":"number"}],"compute":[{"as":"sample-floor","function":"difference","args":[{"parameter":"minimum-sample"},{"value":1}]},{"as":"enough-samples","function":"greater-than","args":[{"field":"complete-runs"},{"field":"sample-floor"}]}]},{"name":"routing-weekly-main-observed","from":"routing-weekly-paired-cost","subject":"Observed main-request AIC for the same eligible runs as each baseline.","objective":"Identify weeks when routed main-request costs exceed the matching baseline estimate.","acceptance":"Observed medians exclude classifier and sub-agent costs and remain unknown below the paired sample floor.","compute":[{"as":"cost-series","function":"concat","args":[{"value":"Main requests observed (baseline: "},{"field":"baseline-model"},{"value":")"}]},{"as":"median-aic","function":"if","args":[{"field":"enough-samples"},{"field":"observed-main-median"},{"value":null}]}]},{"name":"routing-weekly-baseline-estimate","from":"routing-weekly-paired-cost","subject":"Explicitly estimated baseline AIC for paired main-agent requests.","objective":"Show the named counterfactual against which owners can assess routing goal or mode.","acceptance":"The series is labelled estimated, separates baseline models and uses exactly the observed series' eligible runs.","compute":[{"as":"cost-series","function":"concat","args":[{"value":"Baseline estimate (estimated, main requests): "},{"field":"baseline-model"}]},{"as":"median-aic","function":"if","args":[{"field":"enough-samples"},{"field":"baseline-estimate-median"},{"value":null}]}]},{"name":"routing-weekly-cost","from":"routing-weekly-accounting-cost","union":["routing-weekly-main-observed","routing-weekly-baseline-estimate"],"subject":"Compare the same main-agent requests to an explicitly estimated baseline.","objective":"Change routing goal or mode when paired observed cost exceeds the named baseline.","acceptance":"Keep agent-phase accounting separate, baseline models distinct and sparse weeks as gaps.","order-by":[{"field":"week","direction":"asc"},{"field":"cost-series","direction":"asc"}]},{"name":"routing-failure-problems","from":"routing-runs","subject":"Runs whose routing failure codes require investigation.","objective":"Investigate routing configuration or execution failures before changing rollout.","acceptance":"Emit one row per run with recorded routing failure identifiers, excluding upstream errors handled by their own kind.","filter":{"predicates":[{"field":"routing-failure-codes","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"routing failure"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"routing-failure-codes"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-deviation-problems","from":"routing-runs","subject":"Runs whose requests deviated from the routing pick.","objective":"Investigate why requests did not follow the selected model or effort.","acceptance":"Emit one row per run with distinct recorded deviation causes, without inferring causes from model names.","filter":{"predicates":[{"field":"routing-deviation-codes","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"deviation"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"routing-deviation-codes"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-resolution-problems","from":"routing-runs","subject":"Runs whose configured models could not be resolved.","objective":"Correct model aliases or restore catalogue availability for failed resolutions.","acceptance":"Emit one row per run with recorded resolution failure causes, not absence of resolution evidence.","filter":{"predicates":[{"field":"routing-resolution-codes","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"resolution failure"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"routing-resolution-codes"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-upstream-problems","from":"routing-runs","subject":"Provider-rejected requests with distinct upstream error codes.","objective":"Correct model or effort settings rejected by the provider.","acceptance":"Emit one upstream-error row per run with distinct safe codes or unknown, never a duplicate generic routing failure.","filter":{"predicates":[{"field":"routing-upstream-codes","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"upstream error"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"routing-upstream-codes"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-candidate-problems","from":"routing-runs","subject":"Runs whose full eligible pool contains choices the router cannot rank.","objective":"Review allowed models when the router cannot rank the complete eligible pool.","acceptance":"Emit one row only when both pool counters are known and overlap is below eligibility, displaying the observed ratio.","filter":{"predicates":[{"field":"candidate-coverage","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"candidates not rankable"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"candidate-coverage"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-problems","from":"routing-failure-problems","union":["routing-deviation-problems","routing-resolution-problems","routing-upstream-problems","routing-candidate-problems"],"subject":"List routing failures, deviations and resolution failures with one row per run and kind.","objective":"Show what needs attention and link each problem to its run page.","acceptance":"Time is the run's recorded observation time and stays unknown without a run clock; untimed rows sort after timed rows.","joins":[{"source":"routing-runs","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"run","as":"run"},{"field":"full-repository","as":"full-repository"},{"field":"workflow","as":"workflow"},{"field":"run-clock","as":"run-clock"},{"field":"observed-at","as":"observed-at"},{"field":"routing-dashboard-link","as":"routing-dashboard-link"}]}],"compute":[{"as":"untimed","function":"equals-any","args":[{"field":"run-clock"},{"value":null}]}],"order-by":[{"field":"untimed","direction":"asc"},{"field":"run-clock","direction":"desc"},{"field":"run","direction":"desc"},{"field":"problem-kind","direction":"asc"}]},{"name":"simulator-database-inputs","subject":"Model daily run volume and 30-day retained detail from user-supplied scenario inputs.","objective":"Compare hypothetical workload choices without treating results as observed activity.","acceptance":"Each simulated day uses the selected inputs; skipped runs retain summaries and detailed records have a 30-day lifetime.","description":"Each simulated day includes all accumulated run summaries; tools and issues belong only to non-skipped runs and expire after 30 days.","from":"simulation-days","parameters":[{"name":"repositories","type":"number"},{"name":"runs-per-day","type":"number"},{"name":"tools-per-run","type":"number"},{"name":"issues-per-run","type":"number"},{"name":"skip-rate","type":"number"}],"compute":[{"as":"runs-daily","function":"product","args":[{"parameter":"repositories"},{"parameter":"runs-per-day"}]},{"as":"skip-fraction","function":"quotient","args":[{"parameter":"skip-rate"},{"value":100}]},{"as":"active-fraction","function":"difference","args":[{"value":1},{"field":"skip-fraction"}]},{"as":"summary-runs","function":"product","args":[{"field":"day"},{"field":"runs-daily"}]},{"as":"past-ttl","function":"greater-than","args":[{"field":"day"},{"value":30}]},{"as":"detail-days","function":"if","args":[{"field":"past-ttl"},{"value":30},{"field":"day"}]},{"as":"detail-runs","function":"product","args":[{"field":"detail-days"},{"field":"runs-daily"},{"field":"active-fraction"}]},{"as":"tools-per-run","function":"literal","args":[{"parameter":"tools-per-run"}]},{"as":"issues-per-run","function":"literal","args":[{"parameter":"issues-per-run"}]}]},{"name":"simulator-run-size","subject":"Estimate retained run-summary table size at 512 bytes per run.","objective":"Show modeled accumulation of run summaries.","acceptance":"Summary size includes every simulated run at 512 bytes and is not presented as measured storage.","from":"simulator-database-inputs","compute":[{"as":"table","function":"literal","args":[{"value":"Run summaries"}]},{"as":"bytes","function":"product","args":[{"field":"summary-runs"},{"value":512}]}],"select":[{"field":"day"},{"field":"table"},{"field":"bytes"}]},{"name":"simulator-tool-size","subject":"Estimate retained tool table size at 256 bytes per tool on non-skipped runs.","objective":"Show modeled tool-record growth under the selected workload.","acceptance":"Tool size uses only non-skipped simulated runs and 256 bytes per tool over the retained period.","from":"simulator-database-inputs","compute":[{"as":"table","function":"literal","args":[{"value":"Tools (30-day TTL)"}]},{"as":"bytes","function":"product","args":[{"field":"detail-runs"},{"field":"tools-per-run"},{"value":256}]}],"select":[{"field":"day"},{"field":"table"},{"field":"bytes"}]},{"name":"simulator-issue-size","subject":"Estimate retained issue table size at 512 bytes per issue on non-skipped runs.","objective":"Show modeled issue-record growth under the selected workload.","acceptance":"Issue size uses only non-skipped simulated runs and 512 bytes per issue over the retained period.","from":"simulator-database-inputs","compute":[{"as":"table","function":"literal","args":[{"value":"Issues (30-day TTL)"}]},{"as":"bytes","function":"product","args":[{"field":"detail-runs"},{"field":"issues-per-run"},{"value":512}]}],"select":[{"field":"day"},{"field":"table"},{"field":"bytes"}]},{"name":"simulator-database-size","subject":"Show modeled run-summary, tool, and issue table bytes after 30 days.","objective":"Compare hypothetical database table sizes at the end of the retention horizon.","acceptance":"The model presents separate summary, tool, and issue estimates after 30 simulated days, never observed storage.","description":"Run summaries accumulate; detailed records have a 30-day TTL.","from":"simulator-run-size","union":["simulator-tool-size","simulator-issue-size"],"filter":{"predicates":[{"field":"day","equals":30}]},"select":[{"field":"table"},{"field":"bytes"}]},{"name":"simulator-database-total","subject":"Sum the modeled table sizes after 30 days.","objective":"Show the final estimated size of the modeled database tables.","acceptance":"The final value is the sum of the three modeled table sizes after 30 days.","from":"simulator-database-size","compute":[{"as":"total-label","function":"literal","args":[{"value":"Total"}]}],"aggregate":{"by":["total-label"],"values":[{"field":"bytes","as":"bytes","reducer":"sum"}]},"select":[{"field":"total-label","as":"table"},{"field":"bytes"}]},{"name":"simulator-database-summary","subject":"List modeled table sizes and their final total after 30 days.","objective":"Present the 30-day estimate in a compact table.","acceptance":"Three modeled table sizes and their summed final value are shown without a growth chart.","from":"simulator-database-size","union":["simulator-database-total"]},{"name":"simulator-pr-inputs","subject":"Model company PR volume, AW fan-out and AI Credits from editable assumptions.","objective":"Compare hypothetical company sizes without launching workflows or claiming measured capacity.","acceptance":"Developers multiply PRs per developer per day, AW runs per PR and AIC per run; repositories divide averages only. Duration scales totals independently of the synthetic day source.","from":"simulation-days","parameters":[{"name":"repositories","type":"number"},{"name":"developers","type":"number"},{"name":"prs-per-developer-per-day","type":"number"},{"name":"aw-runs-per-pr","type":"number"},{"name":"days","type":"number"},{"name":"aic-per-run","type":"number"}],"filter":{"predicates":[{"field":"day","equals":1}]},"compute":[{"as":"daily-prs","function":"product","args":[{"parameter":"developers"},{"parameter":"prs-per-developer-per-day"}]},{"as":"daily-runs","function":"product","args":[{"field":"daily-prs"},{"parameter":"aw-runs-per-pr"}]},{"as":"daily-aic","function":"product","args":[{"field":"daily-runs"},{"parameter":"aic-per-run"}]},{"as":"total-prs","function":"product","args":[{"field":"daily-prs"},{"parameter":"days"}]},{"as":"total-runs","function":"product","args":[{"field":"daily-runs"},{"parameter":"days"}]},{"as":"total-aic","function":"product","args":[{"field":"daily-aic"},{"parameter":"days"}]},{"as":"prs-per-repo","function":"quotient","args":[{"field":"daily-prs"},{"parameter":"repositories"}]},{"as":"runs-per-repo","function":"quotient","args":[{"field":"daily-runs"},{"parameter":"repositories"}]},{"as":"runs-per-second","function":"quotient","args":[{"field":"daily-runs"},{"value":86400}]}]},{"name":"simulator-pr-counts","subject":"Show modeled daily and horizon pull request counts.","objective":"Separate developer activity from repository scope.","acceptance":"PR totals depend on developers and duration, not repository count.","from":"simulator-pr-inputs","compute":[{"as":"measure","function":"literal","args":[{"value":"Pull requests"}]}],"select":[{"field":"measure"},{"field":"daily-prs","as":"daily"},{"field":"total-prs","as":"total"}]},{"name":"simulator-pr-runs","subject":"Show modeled AW runs generated by pull requests.","objective":"Expose the selected AW fan-out.","acceptance":"Daily and horizon runs use the configured AW runs per PR.","from":"simulator-pr-inputs","compute":[{"as":"measure","function":"literal","args":[{"value":"AW runs"}]}],"select":[{"field":"measure"},{"field":"daily-runs","as":"daily"},{"field":"total-runs","as":"total"}]},{"name":"simulator-pr-aic","subject":"Show modeled AI Credits, not actual spending or currency.","objective":"Make the editable AIC-per-run assumption explicit.","acceptance":"AIC totals multiply modeled runs by AIC per AW run; no dollar conversion or budget enforcement is inferred.","from":"simulator-pr-inputs","compute":[{"as":"measure","function":"literal","args":[{"value":"AI Credits (AIC)"}]}],"select":[{"field":"measure"},{"field":"daily-aic","as":"daily"},{"field":"total-aic","as":"total"}]},{"name":"simulator-pr-summary","subject":"Compare daily and horizon PR, AW-run and AI Credit estimates.","objective":"Support side-effect-free company workload planning.","acceptance":"Exactly three modeled measures are shown and recompute from all six form inputs.","from":"simulator-pr-counts","union":["simulator-pr-runs","simulator-pr-aic"]},{"name":"overview-run-summary","subject":"Summarize successful, failed, and active runs with rollout-mode counts.","objective":"Expose observed success, failure, and active run counts, including active live and review modes, for the selected horizon.","acceptance":"Each count follows its declared conclusion, status, and rollout-mode filters; run success is not treated as a verified outcome, and incomplete or stale evidence is identified.","from":"overview-runs","aggregate":{"values":[{"field":"run-conclusion","as":"successful-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","equals":"success"}]}},{"field":"run-conclusion","as":"failed-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","stale","timed-out"]}]}},{"field":"run-status","as":"active-runs","reducer":"count","filter":{"predicates":[{"field":"run-status","in":["queued","in-progress","in_progress"]}]}},{"field":"run-status","as":"active-live","reducer":"count","filter":{"predicates":[{"field":"run-status","in":["queued","in-progress","in_progress"]},{"field":"rollout-mode","equals":"live"}]}},{"field":"run-status","as":"active-review","reducer":"count","filter":{"predicates":[{"field":"run-status","in":["queued","in-progress","in_progress"]},{"field":"rollout-mode","equals":"review"}]}}]}},{"name":"overview-delivery-summary","subject":"Count distinct target repositories with successful worker dispatch runs in the selected horizon.","objective":"Measure observed reach among registered repositories with successful dispatched worker runs.","acceptance":"Distinct delivered-repositories is limited to registered targets and successful workflow_dispatch worker runs in the selected horizon; it does not establish accepted delivery or authorized coverage.","from":"overview-runs","joins":[{"source":"repositories","type":"inner","on":[{"left":"target-repository","right":"repository-coordinate"}],"fields":[{"field":"repository-coordinate","as":"registered-target-repository"}]}],"filter":{"predicates":[{"field":"event","equals":"workflow_dispatch"},{"field":"run-conclusion","equals":"success"},{"field":"workflow-role","equals":"worker"}]},"aggregate":{"values":[{"field":"target-repository","as":"delivered-repositories","reducer":"distinct-count"}]}},{"name":"overview-value-summary","subject":"Count all observed grader results.","objective":"Identify whether any grader observations are available to the Overview status presentation.","acceptance":"The value-gains field counts observed grader records only; inspect each result's native measure, unit, direction, maturity, and uncertainty before claiming an outcome or improvement.","from":"grader-observations","aggregate":{"values":[{"field":"grader","as":"value-gains","reducer":"count"}]}},{"name":"overview-issue-summary","subject":"Count retained issue and pull request safe-output records for Overview.","objective":"Restore the issue and pull request counter with a link to its evidence inventory.","acceptance":"The count includes retained canonical issue and pull request records, not inferred outcomes; unavailable evidence remains unavailable.","from":"issues","aggregate":{"values":[{"field":"id","as":"value","reducer":"count"}]},"limit":1},{"name":"overview-issue-station","subject":"Present the retained issue and pull request count for Overview.","objective":"Provide a presentation-ready count and accessible evidence description.","acceptance":"The value matches overview-issue-summary and describes retained safe outputs, not accepted outcomes.","from":"overview-issue-summary","compute":[{"as":"detail","function":"concat","args":[{"value":"Retained safe"},{"value":" outputs"}]},{"as":"description","function":"concat","args":[{"field":"value"},{"value":" retained issues and pull requests"}]}],"limit":1},{"name":"overview-value-station","subject":"Present the observed grader-result count as the legacy Value gains counter.","objective":"Restore the Value gains counter while making its observation-count semantics explicit.","acceptance":"The count matches overview-value-summary, including zero; grader presence is not proof of improvement and unavailable evidence is not zero.","from":"overview-value-summary","compute":[{"as":"detail","function":"concat","args":[{"value":"Observed grader"},{"value":" results"}]},{"as":"description","function":"concat","args":[{"field":"value-gains"},{"value":" observed grader results, not verified improvements"}]}],"select":[{"field":"value-gains","as":"value"},{"field":"detail"},{"field":"description"}],"limit":1},{"name":"overview-run-status-input","subject":"Prepare the compact run summary for declarative factory status classification.","objective":"Carry successful-runs, failed-runs, and active-runs into the status join without changing their meaning.","acceptance":"The projected counts retain the selected horizon and match overview-run-summary; the join key is only a presentation key, not additional evidence.","from":"overview-run-summary","compute":[{"as":"status-join-key","function":"concat","args":[{"value":"factory"},{"value":"-status"}]}],"select":[{"field":"status-join-key"},{"field":"successful-runs"},{"field":"failed-runs"},{"field":"active-runs"}]},{"name":"overview-value-status-input","subject":"Prepare the compact value summary for declarative factory status classification.","objective":"Carry the grader-observation count into the optional status join.","acceptance":"The projected value-gains count matches overview-value-summary; a zero count does not establish complete grader coverage, and a nonzero count is not proof of gain.","from":"overview-value-summary","compute":[{"as":"status-join-key","function":"concat","args":[{"value":"factory"},{"value":"-status"}]}],"select":[{"field":"status-join-key"},{"field":"value-gains"}]},{"name":"overview-factory-status","subject":"Classify the factory heading from compact run and optional value evidence.","objective":"Provide a bounded Overview heading based on observed run counts and optional grader-record presence.","acceptance":"The heading matches the declared run-count and optional grader-presence branches; grader presence is not verified value, and the heading does not authorize any policy change.","from":"overview-run-status-input","joins":[{"source":"overview-value-status-input","type":"left","on":[{"left":"status-join-key","right":"status-join-key"}],"fields":[{"field":"value-gains","as":"value-gains"}]}],"compute":[{"as":"has-successful-runs","function":"greater-than","args":[{"field":"successful-runs"},{"value":0}]},{"as":"has-failed-runs","function":"greater-than","args":[{"field":"failed-runs"},{"value":0}]},{"as":"failures-exceed-successes","function":"greater-than","args":[{"field":"failed-runs"},{"field":"successful-runs"}]},{"as":"has-active-runs","function":"greater-than","args":[{"field":"active-runs"},{"value":0}]},{"as":"has-value-gains","function":"greater-than","args":[{"field":"value-gains"},{"value":0}]},{"as":"successful-heading","function":"if","args":[{"field":"has-successful-runs"},{"value":"Your factory is humming."},{"value":"Your factory is idle."}]},{"as":"attention-heading","function":"if","args":[{"field":"has-failed-runs"},{"value":"Your factory needs attention."},{"field":"successful-heading"}]},{"as":"strain-heading","function":"if","args":[{"field":"failures-exceed-successes"},{"value":"Your factory is under strain."},{"field":"attention-heading"}]},{"as":"active-heading","function":"if","args":[{"field":"has-active-runs"},{"value":"Your factory is humming."},{"field":"strain-heading"}]},{"as":"factory-heading","function":"if","args":[{"field":"has-value-gains"},{"value":"Your factory is delivering value."},{"field":"active-heading"}]}],"select":[{"field":"factory-heading"}]},{"name":"overview-registered-repository-summary","subject":"Count canonical repository identities registered in the resolved control-plane scope.","objective":"Provide the registered-repository denominator for observed worker reach.","acceptance":"The count reflects canonical repository records in the resolved scope; it is not evidence of live enrollment, successful execution, or full inventory completeness.","from":"repositories","aggregate":{"values":[{"field":"repository","as":"registered-repositories","reducer":"count"}]}},{"name":"overview-delivery-coverage-input","subject":"Prepare successful delivery totals for the repository coverage summary.","objective":"Carry the distinct delivered-repositories count into the coverage join.","acceptance":"The projected count equals overview-delivery-summary for the selected horizon; the join key adds no repository observations.","from":"overview-delivery-summary","compute":[{"as":"coverage-key","function":"concat","args":[{"value":"repository-coverage"},{"value":""}]}],"select":[{"field":"delivered-repositories"},{"field":"coverage-key"}]},{"name":"overview-registered-repository-coverage-input","subject":"Prepare registered repository totals for the repository coverage summary.","objective":"Carry the registered-repositories count into the coverage denominator join.","acceptance":"The projected count equals overview-registered-repository-summary for the resolved scope; missing inventory is not treated as zero eligible targets.","from":"overview-registered-repository-summary","compute":[{"as":"coverage-key","function":"concat","args":[{"value":"repository-coverage"},{"value":""}]}],"select":[{"field":"registered-repositories"},{"field":"coverage-key"}]},{"name":"overview-rhythm","subject":"Compare all workflow runs by weekday, layering this week over last week.","objective":"Show the observed weekday pattern across both calendar weeks, regardless of status or conclusion.","acceptance":"Verify weekday order, counts including unsuccessful and in-flight runs, and reached-day flags. Missing rhythm is unavailable, not zero activity; do not attribute changes to workflow improvements.","from":"overview-runs","time":{"range":"15d"},"compute":[{"as":"rhythm-point","function":"calendar-week-point","args":[{"field":"started-at"},{"context":"time-end"},{"value":true}]}],"aggregate":{"values":[{"field":"rhythm-point","as":"rhythm","reducer":"calendar-week-rhythm"}]}},{"name":"overview-repository-coverage-summary","subject":"Aggregate reached and total repositories across the resolved organization scope.","objective":"Pair observed reached-repositories and registered-repositories-total for a comparable coverage denominator.","acceptance":"Both totals come from their named input queries and share the resolved scope; verify the left-joined inventory source independently before interpreting a zero total, since a missing join can aggregate to zero.","from":"overview-delivery-coverage-input","joins":[{"source":"overview-registered-repository-coverage-input","type":"left","on":[{"left":"coverage-key","right":"coverage-key"}],"fields":[{"field":"registered-repositories","as":"registered-repositories-total"}]}],"aggregate":{"values":[{"field":"delivered-repositories","as":"reached-repositories","reducer":"sum"},{"field":"registered-repositories-total","as":"registered-repositories-total","reducer":"sum"}]}},{"name":"overview-repository-coverage","subject":"Measure registered repository reach from successful worker execution.","objective":"Present observed successful-worker repository reach as a ratio alongside numerator and denominator.","acceptance":"repository-coverage is reached-repositories divided by registered-repositories-total when available; preserve the counts and undefined denominator, and do not call reach successful outcomes.","from":"overview-repository-coverage-summary","compute":[{"as":"repository-coverage","function":"quotient","args":[{"field":"reached-repositories"},{"field":"registered-repositories-total"}]}],"select":[{"field":"repository-coverage"},{"field":"reached-repositories"},{"field":"registered-repositories-total"}]},{"name":"overview-workflow-health-groups","subject":"Assess current runtime failures for every workflow across CAO and targeted repositories.","objective":"Compute the latest consecutive completed-run failure streak for each repository-scoped workflow without requiring campaign membership.","acceptance":"Group by organization, repository, and workflow; in-flight retries do not clear failures, and later non-failing completed runs reset the streak within the selected horizon.","from":"overview-runs","filter":{"predicates":[{"field":"run-status","equals":"completed"}]},"compute":[{"as":"is-runtime-failure","function":"equals-any","args":[{"field":"run-conclusion"},{"value":"failure"},{"value":"startup-failure"},{"value":"stale"},{"value":"timed-out"}]},{"as":"runtime-failure-streak-point","function":"failure-streak-point","args":[{"field":"started-at"},{"field":"run"},{"field":"is-runtime-failure"}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"runtime-failure-streak-point","as":"failure-count","reducer":"latest-failure-streak"}]}},{"name":"overview-workflow-health-summary","subject":"Count all registered workflows and those without current observed runtime failures.","objective":"Provide Factory health numerator and denominator across CAO and targeted repositories, including standalone and campaign workflows.","acceptance":"Each repository-scoped workflow counts once regardless of campaign or role; no retained failure is not proof of successful execution, missing inventory remains unavailable, and missing run evidence marks the result incomplete.","from":"workflows","joins":[{"source":"overview-workflow-health-groups","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"failure-count","as":"observed-failures"}]}],"compute":[{"as":"normalized-failures","function":"coalesce","args":[{"field":"observed-failures"},{"value":0}]},{"as":"problem-present","function":"greater-than","args":[{"field":"normalized-failures"},{"value":0}]}],"aggregate":{"values":[{"field":"workflow","as":"workflows","reducer":"count"},{"field":"workflow","as":"healthy-workflows","reducer":"count","filter":{"predicates":[{"field":"problem-present","equals":false}]}}]}},{"name":"overview-workflow-health-presentation-input","subject":"Prepare all-workflow health counts for Overview presentation.","objective":"Carry Factory health counts into the header and station presentation.","acceptance":"Both counts match overview-workflow-health-summary and preserve missing evidence metadata.","from":"overview-workflow-health-summary","compute":[{"as":"overview-presentation-key","function":"concat","args":[{"value":"overview"},{"value":"-presentation"}]}],"select":[{"field":"overview-presentation-key"},{"field":"workflows"},{"field":"healthy-workflows"}]},{"name":"overview-factory-health-presentation","subject":"Produce presentation-ready Factory health values for the Overview header and floor.","objective":"Display the ratio of workflows without current observed runtime failures to all registered workflows with both underlying counts.","acceptance":"The percentage and detail agree with healthy-workflows and workflows; a missing or zero denominator remains unavailable, and the ratio is not proof of impact.","from":"overview-workflow-health-presentation-input","compute":[{"as":"factory-health","function":"quotient","args":[{"field":"healthy-workflows"},{"field":"workflows"}]},{"as":"factory-health-display","function":"format-percent","args":[{"field":"factory-health"}]},{"as":"healthy-workflows-display","function":"format-count","args":[{"field":"healthy-workflows"}]},{"as":"workflows-display","function":"format-count","args":[{"field":"workflows"}]},{"as":"factory-health-detail","function":"concat","args":[{"field":"healthy-workflows-display"},{"value":"/"},{"field":"workflows-display"},{"value":" healthy workflows"}]},{"as":"factory-health-description","function":"concat","args":[{"field":"factory-health-display"},{"value":" factory health"}]}],"select":[{"field":"overview-presentation-key"},{"field":"factory-health"},{"field":"factory-health-display"},{"field":"factory-health-detail"},{"field":"factory-health-description"}]},{"name":"overview-header-status-presentation-input","subject":"Prepare the factory status heading for the declarative Overview header.","objective":"Carry the factory heading into the Overview header join unchanged.","acceptance":"The heading matches overview-factory-status; the presentation key does not imply additional evidence or a policy recommendation.","from":"overview-factory-status","compute":[{"as":"overview-presentation-key","function":"concat","args":[{"value":"overview"},{"value":"-presentation"}]}],"select":[{"field":"overview-presentation-key"},{"field":"factory-heading"}]},{"name":"overview-header-presentation","subject":"Resolve the Overview heading from declarative status and factory-health evidence.","objective":"Display the configured heading corresponding to observed run status and factory health.","acceptance":"The selected heading follows the declared presentation branches; numeric branch boundaries are UI classification only, not operational targets or rollout thresholds.","from":"overview-header-status-presentation-input","joins":[{"source":"overview-factory-health-presentation","type":"left","on":[{"left":"overview-presentation-key","right":"overview-presentation-key"}],"fields":[{"field":"factory-health","as":"factory-health"}]}],"compute":[{"as":"factory-health-positive","function":"greater-than","args":[{"field":"factory-health"},{"value":0}]},{"as":"factory-health-below-threshold","function":"greater-than","args":[{"value":0.66},{"field":"factory-health"}]},{"as":"positive-factory-health-heading","function":"if","args":[{"field":"factory-health-below-threshold"},{"value":"Your factory needs attention."},{"field":"factory-heading"}]},{"as":"heading","function":"if","args":[{"field":"factory-health-positive"},{"field":"positive-factory-health-heading"},{"field":"factory-heading"}]}],"select":[{"field":"heading"}]},{"name":"overview-run-motion-presentation-input","subject":"Prepare active run state for Overview station presentation.","objective":"Expose whether at least one queued or in-progress run was observed for station display.","acceptance":"active reflects overview-run-summary's active-runs count; no observed active run does not prove the fleet is idle when the snapshot is incomplete.","from":"overview-run-summary","compute":[{"as":"overview-presentation-key","function":"concat","args":[{"value":"overview"},{"value":"-presentation"}]},{"as":"active","function":"greater-than","args":[{"field":"active-runs"},{"value":0}]}],"select":[{"field":"overview-presentation-key"},{"field":"active"}]},{"name":"overview-factory-station","subject":"Provide the presentation-ready Factory health station for Overview.","objective":"Show the all-workflow runtime health ratio, supporting counts, and observed run motion together.","acceptance":"Station value, display, detail, description, and active flag match their input queries; neither absence of failures nor run motion is verified workflow effectiveness.","from":"overview-factory-health-presentation","joins":[{"source":"overview-run-motion-presentation-input","type":"left","on":[{"left":"overview-presentation-key","right":"overview-presentation-key"}],"fields":[{"field":"active","as":"active"}]}],"select":[{"field":"factory-health","as":"value"},{"field":"factory-health-display","as":"display-value"},{"field":"factory-health-detail","as":"detail"},{"field":"factory-health-description","as":"description"},{"field":"active"}]},{"name":"overview-repository-station-presentation-input","subject":"Prepare repository coverage for the presentation-ready Overview station.","objective":"Format repository reach with its reached and registered counts for the station.","acceptance":"The percentage and detail preserve overview-repository-coverage's numerator and denominator; unavailable coverage remains unavailable, not zero or complete reach.","from":"overview-repository-coverage","compute":[{"as":"overview-presentation-key","function":"concat","args":[{"value":"overview"},{"value":"-presentation"}]},{"as":"display-value","function":"format-percent","args":[{"field":"repository-coverage"}]},{"as":"reached-repositories-display","function":"format-count","args":[{"field":"reached-repositories"}]},{"as":"registered-repositories-display","function":"format-count","args":[{"field":"registered-repositories-total"}]},{"as":"detail","function":"concat","args":[{"field":"reached-repositories-display"},{"value":"/"},{"field":"registered-repositories-display"},{"value":" repositories reached"}]},{"as":"description","function":"concat","args":[{"field":"display-value"},{"value":" average repository coverage"}]}],"select":[{"field":"overview-presentation-key"},{"field":"repository-coverage","as":"value"},{"field":"display-value"},{"field":"detail"},{"field":"description"}]},{"name":"overview-repository-station","subject":"Provide the presentation-ready repository coverage station for Overview.","objective":"Show observed registered-repository worker reach and run motion in one station.","acceptance":"Value and formatted evidence match the coverage presentation input, and active matches run motion; neither changes policy or establishes accepted outcomes.","from":"overview-repository-station-presentation-input","joins":[{"source":"overview-run-motion-presentation-input","type":"left","on":[{"left":"overview-presentation-key","right":"overview-presentation-key"}],"fields":[{"field":"active","as":"active"}]}],"select":[{"field":"value"},{"field":"display-value"},{"field":"detail"},{"field":"description"},{"field":"active"}]},{"name":"cost-by-repository","subject":"Present observed AI Credit cost grouped by repository.","objective":"Locate repositories with higher observed AI Credit totals for evidence-led investigation.","acceptance":"Each repository coordinate and native aic total agrees with repository-aic-totals; confirm the selected horizon and underlying runs before attributing cost or proposing a change.","from":"repository-aic-totals","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-coordinate"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-coordinate"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-coordinate"}]}],"select":[{"field":"repository-coordinate"},{"field":"repository-dashboard-link"},{"field":"aic"}],"order-by":[{"field":"aic","direction":"desc"}]},{"name":"cost-by-workflow","subject":"Present observed AI Credit cost grouped by repository-owned workflow.","objective":"Locate repository workflows with higher observed AI Credit totals and open their workflow evidence.","acceptance":"Workflow identity, link, and native aic total match workflow-aic-totals in descending order; cost alone does not establish waste, quality, or value.","from":"workflow-aic-totals","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-coordinate"}]}],"select":[{"field":"repository-coordinate"},{"field":"workflow"},{"field":"workflow-coordinate"},{"field":"workflow-dashboard-link"},{"field":"aic"}],"order-by":[{"field":"aic","direction":"desc"}]},{"name":"cost-per-workflow-run","subject":"Present the average observed AI Credit cost of a single run for each repository-owned workflow.","objective":"Compare observed AI Credit per run across repository workflows with each observed-runs denominator.","acceptance":"Include only workflows with positive-AIC run attempts, and use only those attempts in cost averages; observed-runs still counts all retained attempts.","description":"Observed AI Credit totals divided by positive-AIC run attempts for each declared workflow.","from":"workflow-aic-run-totals","filter":{"predicates":[{"field":"aic-runs","gte":1}]},"compute":[{"as":"aic-per-run","function":"quotient","args":[{"field":"aic"},{"field":"aic-runs"}]},{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-coordinate"}]}],"select":[{"field":"repository-coordinate"},{"field":"workflow"},{"field":"workflow-coordinate"},{"field":"workflow-dashboard-link"},{"field":"runs","as":"observed-runs"},{"field":"aic-per-run"}],"order-by":[{"field":"aic-per-run","direction":"desc"}]},{"name":"failure-run-base","subject":"Select retained runs with failure, startup-failure, stale, or timed-out conclusions for the failed-run ledger and streak inputs.","objective":"Provide one consistent failure-conclusion evidence set to downstream Overview queries.","acceptance":"Each selected run has one of the four declared conclusions within the selected horizon; other conclusions remain outside this set, and missing run coverage is not interpreted as no failures.","from":"runs","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","stale","timed-out"]}]}},{"name":"failed-runs","subject":"List failed workflow runs that need operator attention.","objective":"Give operators the most recent observed failed runs to inspect in GitHub.","acceptance":"Unprojected run rows retain available conclusion, started-at, and run evidence fields in descending started-at order; inspect source logs and missing links before attributing a cause or declaring resolution.","from":"failure-run-base","order-by":[{"field":"started-at","direction":"desc"}]},{"name":"overview-failing-runs","subject":"Identify failed runs in the selected snapshot horizon so subsequent streak logic can use the same declarative failure definition.","objective":"Project distinct failure-run counts by organization, repository, workflow, and run for streak joins.","acceptance":"Each grouped run identity has a failing-runs count derived from failure-run-base in the selected horizon; this stage does not assert a consecutive streak or require action.","from":"failure-run-base","aggregate":{"by":["organization","repository","workflow","run"],"values":[{"field":"run","as":"failing-runs","reducer":"distinct-count"}]}},{"name":"overview-failing-workflows","subject":"Identify only workflows that have at least one failed run in the selected snapshot horizon before computing streaks.","objective":"Provide workflow identities with observed failed runs for the streak computation.","acceptance":"Each organization/repository/workflow group has a distinct failing-runs count from overview-failing-runs; the count covers observed failures, not the latest consecutive streak.","from":"overview-failing-runs","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run","as":"failing-runs","reducer":"distinct-count"}]}},{"name":"overview-repeated-failure-groups","subject":"Group each workflow's latest consecutive failing run sequence in the selected snapshot horizon, resetting the group after any successful run.","objective":"Project the latest observed consecutive failure-count per workflow for downstream blocked-work matching.","acceptance":"failure-count follows run ordering and the declared latest-failure-streak reducer, with non-failing runs breaking the streak; missing earlier runs or incomplete snapshots limit the observed sequence.","from":"runs","joins":[{"source":"overview-failing-workflows","type":"inner","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"failing-runs","as":"failing-runs"}]},{"source":"overview-failing-runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"}],"fields":[{"field":"failing-runs","as":"run-failing-count"}]}],"compute":[{"as":"failure-streak-point","function":"failure-streak-point","args":[{"field":"started-at"},{"field":"run"},{"field":"run-failing-count"}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"failure-streak-point","as":"failure-count","reducer":"latest-failure-streak"}]}},{"name":"overview-repeated-failure-candidates","subject":"Attach selected-horizon failure counts to each workflow's latest canonical work item.","objective":"Pair blocked work items with observed workflow failure streaks and retained run evidence before attention filtering.","acceptance":"Candidates are filtered to blocked items with a matching organization/repository/workflow streak; is-repeated reflects failure-count greater than one, while selected evidence-link and run-link can be absent or refer to the work item rather than the latest failed run.","from":"work-items","joins":[{"source":"overview-repeated-failure-groups","type":"inner","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"failure-count","as":"failure-count"}]}],"filter":{"predicates":[{"field":"lifecycle-state","equals":"blocked"}]},"compute":[{"as":"is-repeated","function":"greater-than","args":[{"field":"failure-count"},{"value":1}]},{"as":"attention-signal-id","function":"concat","args":[{"value":"repeated-failure:"},{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"kind","function":"coalesce","args":[{"value":"Repeated workflow failures"},{"value":"Repeated workflow failures"}]},{"as":"title","function":"coalesce","args":[{"field":"workflow"},{"value":"Workflow"}]},{"as":"attention-reason","function":"concat","args":[{"field":"failure-count"},{"value":" failed runs in the selected horizon"}]},{"as":"action","function":"coalesce","args":[{"value":"Open latest failed run on GitHub"},{"value":"Open latest failed run on GitHub"}]},{"as":"icon","function":"coalesce","args":[{"value":"x-circle"},{"value":"x-circle"}]},{"as":"tone","function":"coalesce","args":[{"value":"critical"},{"value":"critical"}]},{"as":"priority","function":"number","args":[{"value":0}]}],"select":[{"field":"is-repeated"},{"field":"attention-signal-id"},{"field":"kind"},{"field":"title"},{"field":"scope"},{"field":"attention-reason","as":"reason"},{"field":"observed-at"},{"field":"action"},{"field":"evidence-link"},{"field":"run-link"},{"field":"icon"},{"field":"tone"},{"field":"priority"},{"field":"failure-count"}]},{"name":"overview-repeated-failure-attention","subject":"Keep only unresolved workflows with two or more failures in the selected horizon.","objective":"Surface blocked workflow items with observed repeated failures for bounded run investigation.","acceptance":"Every row inherits a blocked item with is-repeated true and projects evidence-link and run-link when available; verify run order, links, and current state before treating the failure as still unresolved.","from":"overview-repeated-failure-candidates","filter":{"predicates":[{"field":"is-repeated","equals":true}]},"select":[{"field":"attention-signal-id"},{"field":"kind"},{"field":"title"},{"field":"scope"},{"field":"reason"},{"field":"observed-at"},{"field":"action"},{"field":"evidence-link"},{"field":"run-link"},{"field":"icon"},{"field":"tone"},{"field":"priority"},{"field":"failure-count"}]},{"name":"overview-review-attention","subject":"Select only unresolved outputs explicitly awaiting human review with their retained GitHub evidence destination.","objective":"Present review-state work items and their retained GitHub destination to a human reviewer.","acceptance":"Rows are filtered to lifecycle-state review and project the work-item ID as attention-signal-id, plus reason, evidence-link, and run-link where present; reviewer disposition must be checked at source.","from":"work-items","filter":{"predicates":[{"field":"lifecycle-state","equals":"review"}]},"compute":[{"as":"kind","function":"coalesce","args":[{"value":"Human review required"},{"value":"Human review required"}]},{"as":"title","function":"coalesce","args":[{"field":"objective"},{"value":"Produced output"}]},{"as":"action","function":"coalesce","args":[{"value":"Open review item on GitHub"},{"value":"Open review item on GitHub"}]},{"as":"icon","function":"coalesce","args":[{"value":"eye"},{"value":"eye"}]},{"as":"tone","function":"coalesce","args":[{"value":"action"},{"value":"action"}]},{"as":"priority","function":"number","args":[{"value":1}]}],"select":[{"field":"work-item-id","as":"attention-signal-id"},{"field":"kind"},{"field":"title"},{"field":"scope"},{"field":"reason"},{"field":"observed-at"},{"field":"action"},{"field":"evidence-link"},{"field":"run-link"},{"field":"icon"},{"field":"tone"},{"field":"priority"}]},{"name":"overview-needs-attention","subject":"Combine grouped repeated failures and unresolved review outputs without introducing ordinary activity or duplicate work items.","objective":"Prioritize observed blocked repeated-failure work and review-state outputs for investigation.","acceptance":"Rows come only from the repeated-failure or review inputs and retain their source reasons, links, and ordering; confirm fresh source status before acting, and do not equate a missing row with resolved work.","from":"overview-repeated-failure-attention","union":["overview-review-attention"],"order-by":[{"field":"priority","direction":"asc"},{"field":"observed-at","direction":"desc"},{"field":"attention-signal-id","direction":"asc"}]},{"name":"domain-route-record","subject":"Project the selected domain header and one retained run link.","objective":"Identify the selected domain and open a retained run before investigating its traffic evidence.","acceptance":"The route header preserves the selected domain and a run link from its retained observations; missing observations or links remain unavailable, and a header does not establish access policy or traffic completeness.","from":"domains","select":[{"field":"domain"},{"field":"run-link"}]},{"name":"domain-run-records","subject":"Retained run-linked observations for the selected domain.","objective":"Find related runs without returning the unscoped domain collection alongside the paginated view.","acceptance":"Preserve every domain observation field, exact route scope, filtering, ordering, total count, provenance and related-run links; only the bounded view payload crosses the worker boundary.","from":"domains"},{"name":"tool-route-record","subject":"Project the selected MCP tool header and one retained run link.","objective":"Identify the selected MCP tool and open a retained run before investigating its call evidence.","acceptance":"The route header preserves the selected MCP tool label and a run link from its retained calls; absent calls or links remain unavailable and do not imply zero usage or tool effectiveness.","from":"mcp-tool-calls","select":[{"field":"mcp-tool-label"},{"field":"run-link"}]},{"name":"audit-route-record","subject":"Project the selected audit summary header and one retained run link.","objective":"Identify the selected audit summary and open a retained run before investigating its observations.","acceptance":"The route header preserves the selected event summary and a run link from its retained audit observations; absent evidence remains unavailable and neither the header nor its absence establishes incident severity or a clean audit.","from":"audits","select":[{"field":"event-summary"},{"field":"run-link"}]},{"name":"domain-entity-insights","subject":"Summarize one domain entity for its dedicated Insights view.","objective":"Identify domain decisions with request volume worth investigating before considering any egress change.","acceptance":"For the selected domain, request totals match the retained domain observations grouped by decision; missing data or blocked traffic does not establish a need for access, which requires underlying request and policy review.","from":"domains","aggregate":{"by":["domain","decision"],"values":[{"field":"request-count","as":"requests","reducer":"sum"}]},"order-by":[{"field":"requests","direction":"desc"},{"field":"decision","direction":"asc"}]},{"name":"tool-entity-insights","subject":"Summarize one tool entity for its dedicated Insights view.","objective":"Select a tool and status combination whose recorded call volume merits investigation.","acceptance":"For the selected tool, observation counts match retained MCP call observations grouped by server, tool, and status; missing calls are not zero usage and status counts do not establish effectiveness or cause.","from":"mcp-tool-calls","aggregate":{"by":["mcp-tool-label","mcp-server","mcp-tool","mcp-status"],"values":[{"field":"mcp-observation","as":"observations","reducer":"count"}]},"order-by":[{"field":"observations","direction":"desc"},{"field":"mcp-status","direction":"asc"}]},{"name":"audit-entity-insights","subject":"Summarize one audit event entity for its dedicated Insights view.","objective":"Select an audit summary and status requiring closer review of underlying observations.","acceptance":"For the selected summary, counts agree with retained audit observation IDs grouped by event status; repeated observations are not silently treated as distinct incidents, and absence does not prove no findings.","from":"audits","aggregate":{"by":["event-summary","event-status"],"values":[{"field":"id","as":"observations","reducer":"count"}]},"order-by":[{"field":"observations","direction":"desc"},{"field":"event-status","direction":"asc"}]}] diff --git a/dashboard/site/test/fixtures/pull-request-simulator-contract.json b/dashboard/site/test/fixtures/pull-request-simulator-contract.json new file mode 100644 index 0000000000..d913391f6d --- /dev/null +++ b/dashboard/site/test/fixtures/pull-request-simulator-contract.json @@ -0,0 +1,15 @@ +{ + "page": "simulator-pull-request", + "navigation": "simulators", + "view": "simulator-pr-totals", + "query": "simulator-pr-summary", + "fields": ["measure", "daily", "total"], + "defaults": { + "repositories": 10000, + "developers": 10000, + "prs-per-developer-per-day": 10, + "aw-runs-per-pr": 5, + "days": 1, + "aic-per-run": 100 + } +} diff --git a/dashboard/site/test/unit/pull-request-simulator.test.js b/dashboard/site/test/unit/pull-request-simulator.test.js new file mode 100644 index 0000000000..c7a725f2d2 --- /dev/null +++ b/dashboard/site/test/unit/pull-request-simulator.test.js @@ -0,0 +1,89 @@ +import 'fake-indexeddb/auto'; +import { describe, expect, it, vi } from 'vitest'; +import large from '../../../../tests/fixtures/company-stress/large.json' with { type: 'json' }; +import contract from '../fixtures/pull-request-simulator-contract.json' with { type: 'json' }; +import { authoritativeDashboard, authoritativeDashboardSource } from '../authoritative-dashboard.js'; +import { processDataRequest } from '../../src/data-worker.js'; +import { compileDashboardViewPayloadQueries, dashboardFormDefaultValues } from '../../src/data/queries/view-payload-compiler.js'; +import { validateDashboardDocument } from '../../src/validator.js'; + +const dashboard = authoritativeDashboard.dashboard; +const page = dashboard.pages.find((/** @type {{ id: string }} */ page) => page.id === contract.page); + +/** @param {Record} values @param {string} [viewId] */ +async function project(values, viewId = contract.view) { + const compiled = compileDashboardViewPayloadQueries(page, contract.page, { + viewId, queries: dashboard.queries, queryContext: { formValues: values } + }); + const response = /** @type {Record} */ ( + await processDataRequest({ + operation: 'load-dashboard-query-sources', sources: {}, + queries: compiled.queries, sourceNames: compiled.aliases + }) + ); + const source = response[compiled.aliases[0]]; + expect(source.metadata.availability).toBe('available'); + return source.rows; +} + +describe('Pull request simulator', () => { + it('declares a calculator tab, bounded controls and the view contract', () => { + expect(validateDashboardDocument(authoritativeDashboardSource)).toMatchObject({ ok: true, errors: [] }); + expect(page.route).toMatchObject({ + 'navigation-page': contract.navigation, + tab: 'pull-request', + tabs: [{ page: contract.navigation }, { label: 'Pull request', page: contract.page }] + }); + expect(page.views[0]).toMatchObject({ + id: contract.view, mark: 'table', data: { source: contract.query, 'query-context': false } + }); + expect(page.views[0].encoding.columns.map((/** @type {{ field: string }} */ column) => column.field)) + .toEqual(contract.fields); + expect(dashboardFormDefaultValues(page.form)).toEqual(contract.defaults); + expect(contract.defaults).toEqual({ + repositories: large.repositories, developers: large.developers, + 'prs-per-developer-per-day': large.prsPerDeveloperPerDay, + 'aw-runs-per-pr': large.awRunsPerPR, days: large.days, 'aic-per-run': large.aicPerRun + }); + }); + + it('executes large-company arithmetic through the real worker without database reads', async () => { + const open = vi.spyOn(indexedDB, 'open'); + try { + expect(await project({})).toEqual([ + { measure: 'Pull requests', daily: 100_000, total: 100_000 }, + { measure: 'AW runs', daily: 500_000, total: 500_000 }, + { measure: 'AI Credits (AIC)', daily: 50_000_000, total: 50_000_000 } + ]); + expect(open).not.toHaveBeenCalled(); + } finally { + open.mockRestore(); + } + }); + + it('recomputes all inputs and does not multiply volume by repository count', async () => { + const values = { + repositories: 7, developers: 3, 'prs-per-developer-per-day': 2, + 'aw-runs-per-pr': 4, days: 31, 'aic-per-run': 0.25 + }; + const rows = await project(values); + expect(rows).toEqual([ + { measure: 'Pull requests', daily: 6, total: 186 }, + { measure: 'AW runs', daily: 24, total: 744 }, + { measure: 'AI Credits (AIC)', daily: 6, total: 186 } + ]); + expect(await project({ ...values, repositories: 1 })).toEqual(rows); + const [averages] = await project(values, 'simulator-pr-averages'); + expect(averages['prs-per-repo']).toBeCloseTo(6 / 7); + expect(averages['runs-per-repo']).toBeCloseTo(24 / 7); + expect(averages['runs-per-second']).toBeCloseTo(24 / 86400); + }); + + it('supports zero PR, AW and AIC baselines without non-finite output', async () => { + for (const parameter of ['prs-per-developer-per-day', 'aw-runs-per-pr', 'aic-per-run']) { + const rows = await project({ [parameter]: 0 }); + expect(rows[2]).toEqual({ measure: 'AI Credits (AIC)', daily: 0, total: 0 }); + expect(rows.every((row) => Number.isFinite(row.daily) && Number.isFinite(row.total))).toBe(true); + } + }); +}); diff --git a/docs/dashboard-language.md b/docs/dashboard-language.md index 103693faf1..8fa3ba4e58 100644 --- a/docs/dashboard-language.md +++ b/docs/dashboard-language.md @@ -185,6 +185,24 @@ for continuously sampled feedback. The runtime aborts superseded page projections and only renders the newest complete result. Form components never filter or compute data themselves. +The built-in **Simulators > Pull request** page demonstrates a standalone company +calculator. Its six editable inputs are repositories, developers, PRs per +developer per day, AW runs per PR, duration, and AIC per AW run (default 100). +The default 10,000-developer scenario produces 100,000 PRs, 500,000 AW runs, +and 50 million modeled AIC each day. Repository count affects per-repository +averages, not the total number of PRs. + +Its queries use the intrinsic `simulation-days` synthetic source, restrict it to +one row, and multiply daily values by the selected duration. This does not extend +the source's fixed 30-row calendar or read observed activity. All arithmetic +remains in Dashboard Language. Outputs are estimates, not measured capacity, +actual spending, or authorization to execute workflows. + +For real ingestion/storage/query measurements from generated AW evidence, run +`npm run test:stress:company -- --preset large` with disposable local PostgreSQL; +see the [company stress runner](../server/README.md#configurable-company-ingestion-stress). +The calculator itself never starts that test. + ## Present the result Views turn query results into a small set of standard marks: diff --git a/package.json b/package.json index 2c7b1bab06..c3b561be44 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "test:stress:dashboard-backfill": "CAO_BACKFILL_STRESS=1 bash scripts/test-dashboard-backfill.sh", "test:stress:monthly-budget": "CAO_MONTHLY_BUDGET_STRESS=1 go -C server test ./internal/postgresx -run '^TestMonthlyBudgetStress$' -count=1 -timeout=40m -v", "test:stress:cao": "CAO_FLEET_STRESS=1 go -C server test ./internal/webhookgateway -run '^TestGitHubSimulatorFleetStress$' -count=1 -timeout=40m -v", + "test:stress:company": "node scripts/company-stress.mjs", "dashboard:server:spec": "npm --prefix server/spec run generate", "dashboard:server:spec:check": "npm --prefix server/spec run check", "dashboard:local:mobile": "DASHBOARD_DATA_URL=https://githubnext.github.io/gh-cao/cao/payload-hashes.json MOBILE_BROWSER=chromium MOBILE_DEVICE='Pixel 7' MOBILE_PROFILE=low-memory MOBILE_MEMORY_MB=256 playwright test --config=tests/playwright/configs/mobile.config.mjs", diff --git a/scripts/company-stress.mjs b/scripts/company-stress.mjs new file mode 100644 index 0000000000..6a2fcda0ab --- /dev/null +++ b/scripts/company-stress.mjs @@ -0,0 +1,87 @@ +import { spawnSync } from 'node:child_process'; +import { readFileSync, mkdirSync, writeFileSync } from 'node:fs'; +import { resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { parseArgs } from 'node:util'; + +const root = fileURLToPath(new URL('../', import.meta.url)); +const numeric = { + repositories: 'repositories', + developers: 'developers', + 'prs-per-developer-per-day': 'prsPerDeveloperPerDay', + 'aw-runs-per-pr': 'awRunsPerPR', + days: 'days', + 'aic-per-run': 'aicPerRun', + seed: 'seed' +}; + +function main() { + const { values } = parseArgs({ + options: Object.fromEntries([ + ...Object.keys(numeric).map((name) => [name, { type: 'string' }]), + ...['preset', 'scenario', 'distribution', 'report-dir', 'timeout'].map((name) => [name, { type: 'string' }]), + ['help', { type: 'boolean' }] + ]) + }); + if (values.help) { + console.log(`Usage: npm run test:stress:company -- [--preset small|medium|large | --scenario FILE] + --repositories N --developers N --prs-per-developer-per-day N + --aw-runs-per-pr N --days N --aic-per-run N --seed N + --distribution uniform|burst --timeout 40m --report-dir PATH +Requires POSTGRES_URL pointing to disposable local PostgreSQL. +Generates synthetic AW records; no agents, GitHub calls, or completion simulation.`); + return; + } + if (values.preset && values.scenario) throw new Error('Choose --preset or --scenario, not both'); + const preset = values.preset ?? 'small'; + if (!values.scenario && !['small', 'medium', 'large'].includes(preset)) throw new Error('Unknown company preset'); + const scenario = JSON.parse(readFileSync(values.scenario + ? resolve(values.scenario) + : resolve(root, 'tests/fixtures/company-stress', `${preset}.json`), 'utf8')); + for (const [option, field] of Object.entries(numeric)) { + if (values[option] === undefined) continue; + if (String(values[option]).trim() === '' || !Number.isFinite(Number(values[option]))) { + throw new Error(`--${option} must be a finite number`); + } + scenario[field] = Number(values[option]); + } + if (values.distribution) scenario.distribution = values.distribution; + const reportDir = resolve(values['report-dir'] ?? resolve(root, 'test-results/company-stress')); + mkdirSync(reportDir, { recursive: true }); + // Save configuration even when prerequisites or the Go test fail. + writeFileSync(resolve(reportDir, 'scenario.json'), `${JSON.stringify(scenario, null, 2)}\n`); + writeFileSync(resolve(reportDir, 'company-stress.json'), `${JSON.stringify({ + status: 'incomplete', stage: 'prerequisites', synthetic: true, scenario + }, null, 2)}\n`); + const endpoint = new URL(process.env.POSTGRES_URL ?? 'postgres://missing'); + if (!['postgres:', 'postgresql:'].includes(endpoint.protocol) || + !['127.0.0.1', '[::1]'].includes(endpoint.hostname)) { + throw new Error('POSTGRES_URL must point to disposable PostgreSQL on numeric loopback (127.0.0.1 or ::1)'); + } + const timeout = values.timeout ?? '40m'; + if (!/^[1-9]\d*(s|m|h)$/.test(timeout)) throw new Error('--timeout must be a positive Go duration, e.g. 40m'); + const result = spawnSync('go', [ + '-C', 'server', 'test', './internal/server', '-run', '^TestCompanyStress$', '-count=1', + `-timeout=${timeout}`, '-v' + ], { + cwd: root, + stdio: 'inherit', + env: { + ...process.env, + GH_TOKEN: '', GITHUB_TOKEN: '', GH_ENTERPRISE_TOKEN: '', + CAO_COMPANY_STRESS: '1', + CAO_COMPANY_SCENARIO: JSON.stringify(scenario), + CAO_COMPANY_REPORT_DIR: reportDir + } + }); + if (result.error) throw result.error; + if (result.signal) throw new Error(`Company stress interrupted by ${result.signal}; report may be incomplete`); + process.exitCode = result.status ?? 1; +} + +try { + main(); +} catch (error) { + console.error(error instanceof Error ? error.message : String(error)); + process.exitCode = 1; +} diff --git a/scripts/simulate-dashboard-pages.mjs b/scripts/simulate-dashboard-pages.mjs index 5c2b0e56e5..19e8e70fed 100644 --- a/scripts/simulate-dashboard-pages.mjs +++ b/scripts/simulate-dashboard-pages.mjs @@ -115,8 +115,8 @@ async function json(file, value) { await writeFile(file, `${JSON.stringify(value, null, 2)}\n`); } -async function writeFixture(directory, fixtureTime) { - const settings = { campaigns: {}, web: {}, scope: { "allowed-repositories": [fixtureRepository] } }; +async function writeFixture(directory, fixtureTime, experimental) { + const settings = { campaigns: {}, web: { experimental }, scope: { "allowed-repositories": [fixtureRepository] } }; const sources = buildInventoryDashboardSources({ inventory: { workflows: [{ id: "pages-fixture", name: "Synthetic Pages fixture", role: "standalone", @@ -266,11 +266,15 @@ export async function runPagesPreparationCommand(stage, args, { timeoutMs = PAGE export async function prepareDashboardPages({ activityDir, fixture = false, output = path.join(root, ".tmp/dashboard-pages"), fixtureNow = Date.now(), includeSqlite = true, + fixtureExperimental = false, } = {}) { if (Boolean(activityDir) === Boolean(fixture)) { throw new Error("Choose exactly one of --activity-dir DIR or --fixture; no implicit collection or fallback"); } if (typeof includeSqlite !== "boolean") throw new Error("includeSqlite must be a boolean"); + if (typeof fixtureExperimental !== "boolean" || fixtureExperimental && !fixture) { + throw new Error("fixtureExperimental must be a boolean and can only enable synthetic fixture views"); + } if (!includeSqlite && fixture) throw new Error("includeSqlite: false requires supplied normalized phased data, not a synthetic fixture"); const destination = await assertSafePagesOutput(output); const source = activityDir && path.resolve(activityDir); @@ -285,7 +289,7 @@ export async function prepareDashboardPages({ try { const fixtureTime = fixture ? new Date(fixtureNow).toISOString() : undefined; let hashes; - if (fixture) await writeFixture(activity, fixtureTime); + if (fixture) await writeFixture(activity, fixtureTime, fixtureExperimental); else hashes = await copySnapshot(source, activity, { includeSqlite }); const inventoryPath = path.join(activity, "inventory-sources.json"); const settings = await loadDashboardControlSettings(path.join(activity, "control-settings.json")); diff --git a/server/COMPANY-STRESS.md b/server/COMPANY-STRESS.md new file mode 100644 index 0000000000..505fd7286f --- /dev/null +++ b/server/COMPANY-STRESS.md @@ -0,0 +1,63 @@ +# Configurable company ingestion stress + +`npm run test:stress:company -- --preset large` generates synthetic AW evidence +and measures real hash-verified ingestion, PostgreSQL retention, and HTTP queries. +It skips agents, AW execution/completion, GitHub calls, webhooks, and collection +subprocesses. Synthetic completed-run records approximate the workload; this is +not an end-to-end execution or live GitHub throughput benchmark. + +Provide `POSTGRES_URL` for **disposable local PostgreSQL on numeric loopback**. +The test creates and removes its own schema, including operational tables; it +does not rebuild another namespace. Enterprise cases need adequate PostgreSQL +lock-table headroom: the manual workflow starts its disposable instance with +`postgres -c max_locks_per_transaction=1024`. This changes test infrastructure, +not CAO storage/query limits. No Redis or model credentials are needed. + +```sh +POSTGRES_URL='postgres://postgres@127.0.0.1:5432/cao_test?sslmode=disable' \ + npm run test:stress:company -- --preset large + +# Override any assumption; developer/repository counts need not divide evenly. +POSTGRES_URL='postgres://postgres@127.0.0.1:5432/cao_test?sslmode=disable' \ + npm run test:stress:company -- --preset small \ + --repositories 7 --developers 3 --prs-per-developer-per-day 2 \ + --aw-runs-per-pr 4 --days 2 --aic-per-run 0.25 \ + --seed 1 --distribution burst --timeout 5m +``` + +Presets in `tests/fixtures/company-stress/` cover small (10 repositories and +developers), medium (1,000 each), and large (10,000 each) companies. All default +to one day, 10 PRs/developer/day, five AW runs/PR, and **100 modeled AIC/run**. +The large preset produces **100,000 PRs, 500,000 AW records, and 50 million modeled +AIC per day**. Repository count distributes developer activity; it is not another +volume multiplier. PRs and developers are logical generator identities, not new +canonical entities. AIC is neither measured spending nor a currency conversion. + +Use `--scenario FILE` instead of `--preset` for a complete version-1 JSON scenario, +then apply the same overrides. Counts are integers; PR rate, AW fan-out, and AIC +may be zero. Repositories are bounded to 50,000, developers to 1 million, duration +to 31 days, PR rate/fan-out to 1,000 each, and total PRs/AW records to 5 million +each. Oversized scenarios fail explicitly rather than sampling. `uniform` and +`burst` describe fixture timestamps, not paced traffic or measured peak capacity. + +Evidence streams into a single snapshot using production bounded ingestion +batches; the generator does not allocate the complete corpus. The ordinary +200,000-row hot-detail ceiling and 30-day cutoff remain in effect. Reports +separate generated/ingested volume from retained and evicted/expired records and +compare retained AIC only to retained runs. Repeated identical ingestion must +preserve the revision. No production cap is raised to keep the whole fixture. + +`test-results/company-stress/company-stress.json` records configuration, modeled +totals, stage status, measured generation/ingestion durations and records/second, +three HTTP query timings/results, and the post-ingestion Go heap checkpoint (not +peak RSS or database memory). `--report-dir PATH` selects another directory. +Failure reports identify the incomplete stage; the command exits nonzero. A hard +timeout may leave only the launcher's incomplete report and test log. + +The existing Go CI runs the small service-backed smoke test; the full-size case +is opt-in through `.github/workflows/company-stress.yml`, which accepts a preset +or complete scenario JSON and uploads evidence even on failure. Existing fleet, +backfill, and monthly-budget tests retain their separate coverage. + +The dashboard's **Simulators > Pull request** tab is a side-effect-free calculator +for the same assumptions. It does not launch this runner. diff --git a/server/README.md b/server/README.md index ab152b6a65..bfd1e57df0 100644 --- a/server/README.md +++ b/server/README.md @@ -243,6 +243,13 @@ This is command/protocol coverage: image builds, job execution, PostgreSQL, managed identities, and hosted OAuth are simulated, not deployed or attested. The separate Azure-local harness exercises the real Functions host. +## Configurable company ingestion stress + +Run `npm run test:stress:company -- --preset large` with disposable local +PostgreSQL to measure ingestion and queries from generated AW evidence, without +running agents. See [Company stress testing](COMPANY-STRESS.md) for configurable +company workloads, reports, and the dashboard calculator. + ## Secret-free fleet stress simulation Run `npm run test:stress:cao` from the repository root. The dedicated diff --git a/server/internal/server/company_calculator_test.go b/server/internal/server/company_calculator_test.go new file mode 100644 index 0000000000..bd88c708c9 --- /dev/null +++ b/server/internal/server/company_calculator_test.go @@ -0,0 +1,75 @@ +package server + +import ( + "context" + "encoding/json" + "math" + "net/http" + "net/http/httptest" + "os" + "strings" + "testing" + + "github.com/githubnext/gh-cao/server/internal/query" + "github.com/githubnext/gh-cao/server/internal/simulator" +) + +func assertCompanyCalculator(t *testing.T, ctx context.Context, local *httptest.Server, company simulator.Company, totals simulator.CompanyTotals) { + t.Helper() + data, err := os.ReadFile("../../../dashboard/site/dashboard-fragments/simulators.json") + if err != nil { + t.Fatal(err) + } + var fragment struct { + Queries []query.Definition `json:"queries"` + } + if err := json.Unmarshal(data, &fragment); err != nil { + t.Fatal(err) + } + parameters := map[string]any{ + "repositories": company.Repositories, "developers": company.Developers, + "prs-per-developer-per-day": company.PRsPerDeveloperPerDay, "aw-runs-per-pr": company.AWRunsPerPR, + "days": company.Days, "aic-per-run": company.AICPerRun, + } + input := queryRequest{SourceNames: []string{"simulator-pr-summary"}} + for _, definition := range fragment.Queries { + if !strings.HasPrefix(definition.Name, "simulator-pr-") { + continue + } + for i := range definition.Compute { + for j, argument := range definition.Compute[i].Args { + if argument.Parameter == "" { + continue + } + value, exists := parameters[argument.Parameter] + if !exists { + t.Fatalf("unknown calculator parameter %s", argument.Parameter) + } + definition.Compute[i].Args[j] = query.Argument{Value: value} + } + } + input.Queries = append(input.Queries, definition) + } + body, err := json.Marshal(input) + if err != nil { + t.Fatal(err) + } + var result queryResponse + backfillRequest(t, ctx, local, http.MethodPost, "/api/v1/query", body, http.StatusOK, &result) + rows := result.Sources["simulator-pr-summary"].Rows + if len(rows) != 3 { + t.Fatalf("calculator did not resolve through Go runtime/query sources: %+v", result) + } + for index, expected := range [][2]float64{ + {float64(totals.DailyPRs), float64(totals.PRs)}, + {float64(totals.DailyRuns), float64(totals.Runs)}, + {totals.DailyAIC, totals.AIC}, + } { + for fieldIndex, field := range []string{"daily", "total"} { + value, ok := rows[index][field].(float64) + if !ok || math.Abs(value-expected[fieldIndex]) > max(1e-6, expected[fieldIndex]*1e-12) { + t.Fatalf("Go calculator row %d %s=%v want=%v", index, field, rows[index][field], expected[fieldIndex]) + } + } + } +} diff --git a/server/internal/server/company_stress_test.go b/server/internal/server/company_stress_test.go new file mode 100644 index 0000000000..cdef60c4f3 --- /dev/null +++ b/server/internal/server/company_stress_test.go @@ -0,0 +1,197 @@ +package server + +import ( + "context" + "encoding/json" + "fmt" + "math" + "net/http" + "net/http/httptest" + "os" + "path/filepath" + "runtime" + "testing" + "time" + + "github.com/githubnext/gh-cao/server/internal/ingest" + operationalpostgres "github.com/githubnext/gh-cao/server/internal/operational/postgres" + "github.com/githubnext/gh-cao/server/internal/postgresx" + "github.com/githubnext/gh-cao/server/internal/query" + "github.com/githubnext/gh-cao/server/internal/simulator" + "github.com/githubnext/gh-cao/server/internal/testutil" +) + +func TestCompanyIngestionSmoke(t *testing.T) { + runCompanyStress(t, false) +} + +func TestCompanyStress(t *testing.T) { + if os.Getenv("CAO_COMPANY_STRESS") != "1" { + t.Skip("run npm run test:stress:company -- --preset large for opt-in company stress") + } + runCompanyStress(t, true) +} + +func runCompanyStress(t *testing.T, explicit bool) { + t.Helper() + started := time.Now() + report := map[string]any{ + "status": "incomplete", "stage": "configuration", "synthetic": true, + "coverage": map[string]bool{ + "generation": true, "ingestion": true, "postgres": true, "httpQueries": true, + "awExecution": false, "awCompletion": false, "collection": false, "webhooks": false, "githubQuotas": false, + }, + "ingestionBatchRows": postgresx.BatchRows, + } + directory := os.Getenv("CAO_COMPANY_REPORT_DIR") + t.Cleanup(func() { + if t.Failed() { + report["status"] = "failed" + } + report["wallSeconds"] = time.Since(started).Seconds() + if directory != "" { + if err := os.MkdirAll(directory, 0o750); err != nil { // #nosec G703 -- operator-selected local test report directory. + t.Error(err) + return + } + data, err := json.MarshalIndent(report, "", " ") + if err != nil { + t.Error(err) + } else if err := os.WriteFile(filepath.Join(directory, "company-stress.json"), append(data, '\n'), 0o600); err != nil { // #nosec G703 -- fixed filename in operator-selected test directory. + t.Error(err) + } + } + t.Logf("company stress: status=%v generated=%v retained=%v wall=%s", + report["status"], report["generatedRuns"], report["retainedRuns"], time.Since(started)) + }) + input := []byte(os.Getenv("CAO_COMPANY_SCENARIO")) + if !explicit || len(input) == 0 { + var err error + input, err = os.ReadFile("../../../tests/fixtures/company-stress/small.json") + if err != nil { + t.Fatal(err) + } + } + company, err := simulator.LoadCompany(input) + if err != nil { + t.Fatal(err) + } + totals, err := company.Totals() + if err != nil { + t.Fatal(err) + } + report["scenario"], report["expected"] = company, totals + if os.Getenv("POSTGRES_URL") == "" && explicit { + t.Fatal("POSTGRES_URL must name a disposable local PostgreSQL database") + } + if os.Getenv("POSTGRES_URL") == "" { + t.Skip("set POSTGRES_URL for the company ingestion smoke test") + } + ctx := t.Context() + report["stage"] = "database" + data, connection := testutil.PostgresWithConfig(t, ctx, "POSTGRES_URL") + report["stage"] = "generation" + lake := t.TempDir() + start := time.Now().UTC().Truncate(24*time.Hour).AddDate(0, 0, -company.Days) + step := time.Now() + if _, err := company.WriteLake(ctx, lake, start); err != nil { + t.Fatal(err) + } + report["generationSeconds"], report["generatedRuns"] = time.Since(step).Seconds(), totals.Runs + report["stage"] = "ingestion" + step = time.Now() + options := ingest.Options{DatabaseQueriesPath: backfillDatabaseQueries} + state, err := ingest.Run(ctx, data, lake, options) + if err != nil { + t.Fatal(err) + } + seconds := time.Since(step).Seconds() + report["ingestionSeconds"], report["ingestedRuns"] = seconds, totals.Runs + report["ingestedRunsPerSecond"] = float64(totals.Runs) / seconds + report["counts"], report["revision"] = state.Counts, state.Revision + report["retainedRuns"] = state.Counts["$runs"] + report["evictedOrExpiredRuns"] = totals.Runs - int64(state.Counts["$runs"]) + // This fixture has no child records and fits below the logical-byte budget. + // The production 30-day cutoff and row ceiling remain unmodified. + want := min(totals.Runs, totals.DailyRuns*30, int64(query.MaxInputRows)) + if int64(state.Counts["$runs"]) != want || state.Counts["$repositories"] != company.Repositories || + state.Counts["$workflows"] != company.Repositories { + t.Fatalf("retention/inventory mismatch: counts=%v wantRuns=%d", state.Counts, want) + } + var heap runtime.MemStats + runtime.ReadMemStats(&heap) + report["postIngestionGoHeapBytes"] = heap.HeapAlloc + report["stage"] = "queries" + ops, err := operationalpostgres.New(ctx, connection.ConnString(), "company", operationalpostgres.Config{}) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = ops.Close() }) + app, err := New(ctx, ops, Config{ + Database: data, DatabaseQueriesPath: backfillDatabaseQueries, Listen: "127.0.0.1:0", + SiteDirectory: t.TempDir(), AccessToken: testAccessToken, QueryCache: QueryCacheConfig{Disabled: true}, + }) + if err != nil { + t.Fatal(err) + } + local := httptest.NewServer(app.Handler()) + defer local.Close() + inputQuery := queryRequest{ + Queries: []query.Definition{{ + Name: "company-retained", From: "$runs", + Aggregate: &query.Aggregate{Values: []query.AggregateValue{ + {Field: "id", As: "runs", Reducer: "count"}, + {Field: "id", As: "uniqueRuns", Reducer: "distinct-count"}, + {Field: "aicTotal", As: "aic", Reducer: "sum"}, + }}, + }}, + SourceNames: []string{"company-retained"}, + } + body, err := json.Marshal(inputQuery) + if err != nil { + t.Fatal(err) + } + var result queryResponse + latencies := make([]float64, 0, 3) + for range 3 { + step = time.Now() + backfillRequest(t, ctx, local, http.MethodPost, "/api/v1/query", body, http.StatusOK, &result) + latencies = append(latencies, float64(time.Since(step).Microseconds())/1000) + source := result.Sources["company-retained"] + if want == 0 && len(source.Rows) == 0 { + continue + } + if len(source.Rows) != 1 || fmt.Sprint(source.Rows[0]["runs"]) != fmt.Sprint(want) || + fmt.Sprint(source.Rows[0]["uniqueRuns"]) != fmt.Sprint(want) { + t.Fatalf("retained query mismatch: %+v", source) + } + aic, ok := source.Rows[0]["aic"].(float64) + expectedAIC := float64(want) * company.AICPerRun + if !ok || math.Abs(aic-expectedAIC) > max(1e-6, expectedAIC*1e-12) { + t.Fatalf("retained modeled AIC = %v, want %v", source.Rows[0]["aic"], expectedAIC) + } + if totals.Runs > want && source.Metadata["completeness"] != "partial" { + t.Fatalf("evicted detail claimed complete coverage: %v", source.Metadata) + } + } + report["queryLatencyMs"], report["queryResult"] = latencies, result.Sources + assertCompanyCalculator(t, ctx, local, company, totals) + report["dashboardCalculatorParity"] = true + report["stage"] = "idempotency" + again, err := ingest.Run(ctx, data, lake, options) + if err != nil || again.Revision != state.Revision { + t.Fatalf("identical fixture advanced revision: %+v %v", again, err) + } + report["idempotentReplay"] = true + report["stage"] = "cancellation" + canceled, cancel := context.WithCancel(ctx) + cancel() + if _, err := ingest.Run(canceled, data, lake, options); err == nil { + t.Fatal("canceled ingestion succeeded") + } + after, err := data.State(ctx) + if err != nil || after.Revision != state.Revision { + t.Fatal("canceled ingestion changed canonical state") + } + report["stage"], report["status"] = "complete", "complete" +} diff --git a/server/internal/simulator/company.go b/server/internal/simulator/company.go new file mode 100644 index 0000000000..fe5a05a8dd --- /dev/null +++ b/server/internal/simulator/company.go @@ -0,0 +1,144 @@ +package simulator + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "math" + "strings" + "time" + + "github.com/githubnext/gh-cao/server/internal/model" +) + +const maxCompanyRecords int64 = 5_000_000 + +// Company models PR-driven AW volume, not agent execution or measured spend. +type Company struct { + Version int `json:"version"` + Name string `json:"name"` + Repositories int `json:"repositories"` + Developers int64 `json:"developers"` + PRsPerDeveloperPerDay int64 `json:"prsPerDeveloperPerDay"` + AWRunsPerPR int64 `json:"awRunsPerPR"` + Days int `json:"days"` + AICPerRun float64 `json:"aicPerRun"` + Seed int64 `json:"seed"` + Distribution string `json:"distribution"` +} + +type CompanyTotals struct { + DailyPRs int64 `json:"dailyPRs"` + DailyRuns int64 `json:"dailyRuns"` + DailyAIC float64 `json:"dailyAIC"` + PRs int64 `json:"prs"` + Runs int64 `json:"runs"` + AIC float64 `json:"aic"` +} + +func LoadCompany(data []byte) (Company, error) { + var company Company + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + if err := decoder.Decode(&company); err != nil { + return Company{}, fmt.Errorf("decode company scenario: %w", err) + } + if err := decoder.Decode(new(any)); err != io.EOF { + return Company{}, errors.New("company scenario must contain exactly one JSON object") + } + _, err := company.Totals() + return company, err +} + +// Totals validates bounds before multiplication, allocation, or file creation. +func (c Company) Totals() (CompanyTotals, error) { + if c.Version != 1 || strings.TrimSpace(c.Name) == "" { + return CompanyTotals{}, errors.New("company scenario requires version 1 and a name") + } + if c.Repositories < 1 || c.Repositories > maxRepositories || c.Developers < 1 || c.Developers > 1_000_000 || + c.Days < 1 || c.Days > 31 || c.PRsPerDeveloperPerDay < 0 || c.PRsPerDeveloperPerDay > 1000 || + c.AWRunsPerPR < 0 || c.AWRunsPerPR > 1000 { + return CompanyTotals{}, errors.New("company scenario requires 1-50000 repositories, 1-1000000 developers, 1-31 days, and 0-1000 PRs/developer/day and AW runs/PR") + } + if c.Seed < 0 || c.Distribution != "uniform" && c.Distribution != "burst" { + return CompanyTotals{}, errors.New("company scenario requires a nonnegative seed and uniform or burst distribution") + } + if c.AICPerRun < 0 || math.IsNaN(c.AICPerRun) || math.IsInf(c.AICPerRun, 0) { + return CompanyTotals{}, errors.New("company AIC/run must be finite and nonnegative") + } + dailyPRs := c.Developers * c.PRsPerDeveloperPerDay + prs := dailyPRs * int64(c.Days) + if prs > maxCompanyRecords || prs > 0 && c.AWRunsPerPR > maxCompanyRecords/prs { + return CompanyTotals{}, errors.New("company scenario exceeds 5000000 PRs or AW records; reduce the explicit inputs") + } + dailyRuns := dailyPRs * c.AWRunsPerPR + runs := dailyRuns * int64(c.Days) + aic := float64(runs) * c.AICPerRun + if math.IsInf(aic, 0) { + return CompanyTotals{}, errors.New("company modeled AIC total overflows") + } + return CompanyTotals{DailyPRs: dailyPRs, DailyRuns: dailyRuns, DailyAIC: float64(dailyRuns) * c.AICPerRun, + PRs: prs, Runs: runs, AIC: aic}, nil +} + +// WriteLake emits completed-run-shaped evidence directly, without GitHub calls, +// workflow execution, completion callbacks, or a collection subprocess. +func (c Company) WriteLake(ctx context.Context, directory string, start time.Time) (CompanyTotals, error) { + totals, err := c.Totals() + if err != nil { + return CompanyTotals{}, err + } + if start.IsZero() { + return CompanyTotals{}, errors.New("company scenario requires a nonzero start time") + } + err = writeSyntheticLake(ctx, directory, int64(c.Repositories)*2+totals.Runs, func(record func(string, model.Row) error) error { + for repo := range c.Repositories { + name := repositoryName(repo) + repository, workflow := companyParentIDs(repo) + if err := record("repositories", model.Row{ + "id": repository, "owner": "simulator", "name": strings.TrimPrefix(name, "simulator/"), + "visibility": "private", "observedAt": start.Format(time.RFC3339), + }); err != nil { + return err + } + if err := record("workflows", model.Row{ + "id": workflow, "repositoryId": repository, "path": ".github/workflows/synthetic.md", + "name": "Synthetic PR workload", "state": "active", "role": "worker", + "observedAt": start.Format(time.RFC3339), + }); err != nil { + return err + } + } + for ordinal := int64(0); ordinal < totals.Runs; ordinal++ { + pr := ordinal / c.AWRunsPerPR + repo := int((pr + c.Seed%int64(c.Repositories)) % int64(c.Repositories)) + repository, workflow := companyParentIDs(repo) + day, slot := pr/totals.DailyPRs, pr%totals.DailyPRs + second := slot * 86400 / totals.DailyPRs + if c.Distribution == "burst" && (slot+c.Seed%10)%10 == 0 { + second = 10 * 3600 + } + at := start.AddDate(0, 0, int(day)).Add(time.Duration(second) * time.Second).Format(time.RFC3339) + if err := record("runs", model.Row{ + "id": fmt.Sprintf("run:%d", ordinal+1), "repositoryId": repository, "workflowId": workflow, + "owner": "simulator", "repository": strings.TrimPrefix(repositoryName(repo), "simulator/"), + "workflowPath": ".github/workflows/synthetic.md", "githubRunId": fmt.Sprint(ordinal + 1), + "attempt": 1, "status": "completed", "conclusion": "success", + "createdAt": at, "startedAt": at, "completedAt": at, "updatedAt": at, "observedAt": at, + "aicTotal": c.AICPerRun, + }); err != nil { + return err + } + } + return nil + }) + return totals, err +} + +func companyParentIDs(repository int) (string, string) { + name := repositoryName(repository) + return "repository:" + name, "workflow:" + name + ":synthetic" +} diff --git a/server/internal/simulator/company_test.go b/server/internal/simulator/company_test.go new file mode 100644 index 0000000000..09c0d46b99 --- /dev/null +++ b/server/internal/simulator/company_test.go @@ -0,0 +1,166 @@ +package simulator + +import ( + "bufio" + "context" + "encoding/json" + "os" + "path/filepath" + "reflect" + "strings" + "testing" + "time" +) + +func companyFixture(t *testing.T, name string) Company { + t.Helper() + data, err := os.ReadFile("../../../tests/fixtures/company-stress/" + name + ".json") + if err != nil { + t.Fatal(err) + } + company, err := LoadCompany(data) + if err != nil { + t.Fatal(err) + } + return company +} + +func TestCompanyPresets(t *testing.T) { + for _, name := range []string{"small", "medium", "large"} { + company := companyFixture(t, name) + totals, err := company.Totals() + if err != nil || totals.DailyPRs != company.Developers*10 || totals.DailyRuns != totals.DailyPRs*5 || + totals.AIC != float64(totals.Runs)*100 { + t.Fatalf("%s: %+v %v", name, totals, err) + } + if name == "large" && totals != (CompanyTotals{100_000, 500_000, 50_000_000, 100_000, 500_000, 50_000_000}) { + t.Fatalf("large preset changed: %+v", totals) + } + } +} + +func TestCompanyValidation(t *testing.T) { + company := companyFixture(t, "small") + data, err := json.Marshal(company) + if err != nil { + t.Fatal(err) + } + for _, input := range []string{ + "null", "{}", string(data) + " {}", strings.Replace(string(data), `"version":1`, `"version":2`, 1), + strings.Replace(string(data), `"days":1`, `"days":1.5`, 1), + strings.Replace(string(data), `"seed":42`, `"unknown":42`, 1), + strings.Replace(string(data), `"developers":10`, `"developers":9223372036854775808`, 1), + } { + if _, err := LoadCompany([]byte(input)); err == nil { + t.Fatalf("accepted invalid company %s", input) + } + } + for _, change := range []func(*Company){ + func(c *Company) { c.Repositories = 0 }, + func(c *Company) { c.Developers = -1 }, + func(c *Company) { c.Days = 32 }, + func(c *Company) { c.AICPerRun = -1 }, + func(c *Company) { c.Distribution = "unknown" }, + func(c *Company) { c.Seed = -1 }, + func(c *Company) { c.Developers, c.PRsPerDeveloperPerDay, c.AWRunsPerPR = 1_000_000, 1000, 1000 }, + } { + invalid := company + change(&invalid) + directory := t.TempDir() + if _, err := invalid.WriteLake(t.Context(), directory, time.Now()); err == nil { + t.Fatal("invalid configuration generated evidence") + } + files, err := os.ReadDir(directory) + if err != nil || len(files) != 0 { + t.Fatal("invalid configuration touched disk") + } + } +} + +func TestCompanyEvidence(t *testing.T) { + company := companyFixture(t, "small") + company.Repositories, company.Developers, company.Days = 7, 3, 2 + start := time.Date(2026, 10, 1, 0, 0, 0, 0, time.UTC) + for _, distribution := range []string{"uniform", "burst"} { + company.Distribution = distribution + var previous []byte + for range 2 { + directory := t.TempDir() + totals, err := company.WriteLake(t.Context(), directory, start) + if err != nil || totals.PRs != 60 || totals.Runs != 300 || totals.AIC != 30_000 { + t.Fatalf("totals: %+v %v", totals, err) + } + data, err := os.ReadFile(filepath.Join(directory, "gh-aw-logs-runs/synthetic.jsonl")) + if err != nil { + t.Fatal(err) + } + if previous != nil && string(previous) != string(data) { + t.Fatal("company evidence is nondeterministic") + } + previous = data + counts := map[string]int{} + repos := map[string]bool{} + runs := map[string]bool{} + var previousRun map[string]any + scanner := bufio.NewScanner(strings.NewReader(string(data))) + for scanner.Scan() { + var record struct { + Collection string `json:"collection"` + Record map[string]any `json:"record"` + } + if err := json.Unmarshal(scanner.Bytes(), &record); err != nil { + t.Fatal(err) + } + if record.Collection == "" { + continue + } + counts[record.Collection]++ + if record.Collection == "runs" { + id := record.Record["id"].(string) + if runs[id] { + t.Fatal("duplicate synthetic run identity") + } + runs[id] = true + repos[record.Record["repositoryId"].(string)] = true + if record.Record["aicTotal"] != float64(100) { + t.Fatal("lost synthetic AIC") + } + if (counts["runs"]-1)%int(company.AWRunsPerPR) != 0 && + (record.Record["repositoryId"] != previousRun["repositoryId"] || + record.Record["createdAt"] != previousRun["createdAt"]) { + t.Fatal("PR fan-out changed repository or timestamp") + } + previousRun = record.Record + } + } + if err := scanner.Err(); err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(counts, map[string]int{"repositories": 7, "workflows": 7, "runs": 300}) || len(repos) != 7 { + t.Fatalf("evidence counts: %v repos=%d", counts, len(repos)) + } + } + } +} + +func TestCompanyZeroVolumeAndCancellation(t *testing.T) { + for _, zero := range []string{"prs", "runs", "aic"} { + company := companyFixture(t, "small") + switch zero { + case "prs": + company.PRsPerDeveloperPerDay = 0 + case "runs": + company.AWRunsPerPR = 0 + case "aic": + company.AICPerRun = 0 + } + if totals, err := company.WriteLake(t.Context(), t.TempDir(), time.Now()); err != nil || totals.AIC != 0 { + t.Fatalf("%s: %+v %v", zero, totals, err) + } + } + ctx, cancel := context.WithCancel(t.Context()) + cancel() + if _, err := companyFixture(t, "small").WriteLake(ctx, t.TempDir(), time.Now()); err != context.Canceled { + t.Fatalf("canceled generation: %v", err) + } +} diff --git a/server/internal/simulator/lake.go b/server/internal/simulator/lake.go index 65a8bf027b..d1dbbf3898 100644 --- a/server/internal/simulator/lake.go +++ b/server/internal/simulator/lake.go @@ -66,82 +66,101 @@ func (s Scenario) WriteLake(ctx context.Context, directory string, horizonDays i return LakeResult{}, errors.New("synthetic lake requires history, a covered horizon, and an absolute directory") } lakeLog.Printf("synthetic lake starting repositories=%d horizonDays=%d", s.Repositories, horizonDays) + result := LakeResult{Repositories: s.Repositories, Runs: s.Repositories * horizonDays * s.History.RunsPerDay} + err := writeSyntheticLake(ctx, directory, int64(result.Repositories*2+result.Runs), func(record func(string, model.Row) error) error { + for index := 0; index < s.Repositories; index++ { + name := repositoryName(index) + repositoryID := "repository:" + name + workflowID := "workflow:" + name + ":synthetic" + if err := record("repositories", model.Row{ + "id": repositoryID, "owner": "simulator", "name": fmt.Sprintf("repo-%05d", index+1), + "visibility": "public", "observedAt": s.History.AsOf, + }); err != nil { + return err + } + if err := record("workflows", model.Row{ + "id": workflowID, "repositoryId": repositoryID, "path": ".github/workflows/synthetic.md", + "name": "Synthetic workflow", "state": "active", "role": "worker", "observedAt": s.History.AsOf, + }); err != nil { + return err + } + for offset := 0; offset < horizonDays*s.History.RunsPerDay; offset++ { + run := s.History.Run(index, offset) + created := run.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + if err := record("runs", model.Row{ + "id": fmt.Sprintf("run:%d", run.ID), "repositoryId": repositoryID, "workflowId": workflowID, + "owner": "simulator", "repository": fmt.Sprintf("repo-%05d", index+1), + "workflowPath": ".github/workflows/synthetic.md", "githubRunId": fmt.Sprint(run.ID), + "attempt": run.Attempt, "status": run.Status, "conclusion": run.Conclusion, + "createdAt": created, "startedAt": created, "completedAt": created, "updatedAt": created, + "observedAt": created, + }); err != nil { + return err + } + } + } + return nil + }) + if err != nil { + return LakeResult{}, err + } + lakeLog.Printf("synthetic lake completed repositories=%d runs=%d", result.Repositories, result.Runs) + return result, nil +} + +func writeSyntheticLake(ctx context.Context, directory string, records int64, emit func(func(string, model.Row) error) error) error { + if !filepath.IsAbs(directory) { + return errors.New("synthetic lake requires an absolute directory") + } + if err := ctx.Err(); err != nil { + return err + } shards := filepath.Join(directory, "gh-aw-logs-runs") if err := os.MkdirAll(shards, 0o750); err != nil { - return LakeResult{}, err + return err } path := filepath.Join(shards, "synthetic.jsonl") // #nosec G304,G703 -- operator-selected local simulation output, never a GitHub API path. file, err := os.OpenFile(path, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0o600) if err != nil { - return LakeResult{}, err + return err } defer func() { _ = file.Close() }() hash := sha256.New() buffer := bufio.NewWriterSize(io.MultiWriter(file, hash), 256*1024) encoder := json.NewEncoder(buffer) - result := LakeResult{Repositories: s.Repositories, Runs: s.Repositories * horizonDays * s.History.RunsPerDay} if err := encoder.Encode(map[string]any{ "kind": "metadata", "schemaVersion": model.SchemaVersion, "ingestionVersion": 3, - "phase": "runs", "records": result.Repositories*2 + result.Runs, + "phase": "runs", "records": records, }); err != nil { - return LakeResult{}, err + return err } record := func(collection string, row model.Row) error { - return encoder.Encode(map[string]any{"kind": "record", "collection": collection, "record": row}) - } - for index := 0; index < s.Repositories; index++ { if err := ctx.Err(); err != nil { - return LakeResult{}, err - } - name := repositoryName(index) - repositoryID := "repository:" + name - workflowID := "workflow:" + name + ":synthetic" - if err := record("repositories", model.Row{ - "id": repositoryID, "owner": "simulator", "name": fmt.Sprintf("repo-%05d", index+1), - "visibility": "public", "observedAt": s.History.AsOf, - }); err != nil { - return LakeResult{}, err - } - if err := record("workflows", model.Row{ - "id": workflowID, "repositoryId": repositoryID, "path": ".github/workflows/synthetic.md", - "name": "Synthetic workflow", "state": "active", "role": "worker", "observedAt": s.History.AsOf, - }); err != nil { - return LakeResult{}, err - } - for offset := 0; offset < horizonDays*s.History.RunsPerDay; offset++ { - run := s.History.Run(index, offset) - created := run.CreatedAt.Format("2006-01-02T15:04:05Z07:00") - if err := record("runs", model.Row{ - "id": fmt.Sprintf("run:%d", run.ID), "repositoryId": repositoryID, "workflowId": workflowID, - "owner": "simulator", "repository": fmt.Sprintf("repo-%05d", index+1), - "workflowPath": ".github/workflows/synthetic.md", "githubRunId": fmt.Sprint(run.ID), - "attempt": run.Attempt, "status": run.Status, "conclusion": run.Conclusion, - "createdAt": created, "startedAt": created, "completedAt": created, "updatedAt": created, - "observedAt": created, - }); err != nil { - return LakeResult{}, err - } + return err } + return encoder.Encode(map[string]any{"kind": "record", "collection": collection, "record": row}) + } + if err := emit(record); err != nil { + return err } if err := buffer.Flush(); err != nil { - return LakeResult{}, err + return err } if err := file.Close(); err != nil { - return LakeResult{}, err + return err } manifest, err := json.Marshal(map[string]string{"gh-aw-logs-runs/synthetic.jsonl": hex.EncodeToString(hash.Sum(nil))}) if err != nil { - return LakeResult{}, err + return err } // #nosec G703 -- fixed output names under the operator-selected simulation directory. if err := os.WriteFile(filepath.Join(directory, "payload-hashes.json"), manifest, 0o600); err != nil { - return LakeResult{}, err + return err } // #nosec G703 -- fixed local simulation inventory, never remote input. if err := os.WriteFile(filepath.Join(directory, "inventory-sources.json"), []byte("{}\n"), 0o600); err != nil { - return LakeResult{}, err + return err } - lakeLog.Printf("synthetic lake completed repositories=%d runs=%d", result.Repositories, result.Runs) - return result, nil + return nil } diff --git a/server/internal/testutil/postgres.go b/server/internal/testutil/postgres.go index ff00a26667..d925d49616 100644 --- a/server/internal/testutil/postgres.go +++ b/server/internal/testutil/postgres.go @@ -16,6 +16,14 @@ import ( // Postgres creates a private schema, including when initialization fails. // Service-backed tests never replace another test's or the operator's data. func Postgres(t testing.TB, parent context.Context, environment ...string) *postgresx.Store { + t.Helper() + store, _ := PostgresWithConfig(t, parent, environment...) + return store +} + +// PostgresWithConfig also exposes the isolated schema connection for operational +// adapters that need their own tables in the same disposable database. +func PostgresWithConfig(t testing.TB, parent context.Context, environment ...string) (*postgresx.Store, *pgx.ConnConfig) { t.Helper() endpoint := "" for _, name := range environment { @@ -86,5 +94,5 @@ func Postgres(t testing.TB, parent context.Context, environment ...string) *post t.Fatal("initialize isolated Postgres test schema") } t.Cleanup(func() { _ = store.Close() }) - return store + return store, config } diff --git a/tests/e2e/dashboard-pages.spec.mjs b/tests/e2e/dashboard-pages.spec.mjs index ac5b90d327..4589801620 100644 --- a/tests/e2e/dashboard-pages.spec.mjs +++ b/tests/e2e/dashboard-pages.spec.mjs @@ -5,12 +5,41 @@ let preview; test.beforeAll(async () => { test.setTimeout(240_000); - preview = await startDashboardPagesPreview({ fixture: true }); + preview = await startDashboardPagesPreview({ fixture: true, fixtureExperimental: true }); }); test.afterAll(async () => { await preview?.close(); }); for (const width of [1440, 390]) { + test(`Pull request simulator recomputes company estimates at ${width}px`, async ({ page }, testInfo) => { + await page.setViewportSize({ width, height: 900 }); + await page.goto(`${preview.url}/?debug-eager-ingest=1#page-simulators`, { waitUntil: "domcontentloaded" }); + await expect(page.locator("#page-title")).toHaveText("Simulators"); + await expect(page.locator(".first-load-overlay")).toHaveCount(0, { timeout: 90_000 }); + await page.locator('[data-page-id="simulators"]').getByRole("link", { name: "Pull request", exact: true }).click(); + const simulator = page.locator('[data-page-id="simulator-pull-request"]'); + await expect(simulator.getByRole("link", { name: "Pull request", exact: true })).toHaveAttribute("aria-current", "page"); + const table = simulator.locator('[data-view-id="simulator-pr-totals"]').getByRole("table"); + await expect(table.getByRole("row", { name: "AW runs 500000 500000", exact: true })).toBeVisible(); + await expect(table.getByRole("row", { name: "AI Credits (AIC) 50000000 50000000", exact: true })).toBeVisible(); + const screenshot = testInfo.outputPath(`pull-request-simulator-${width}.png`); + await page.screenshot({ path: screenshot, fullPage: true }); + await testInfo.attach(`Pull request simulator ${width}px`, { path: screenshot, contentType: "image/png" }); + await simulator.getByRole("slider", { name: "Duration (days)", exact: true }).fill("2"); + await expect(table.getByRole("row", { name: "AW runs 500000 1000000", exact: true })).toBeVisible(); + const developerInput = simulator.getByRole("slider", { name: "Developers", exact: true }); + await developerInput.focus(); + await developerInput.fill("3"); + await expect(table.getByRole("row", { name: "AW runs 150 300", exact: true })).toBeVisible(); + await expect(developerInput).toBeFocused(); + await simulator.getByRole("slider", { name: "Repositories", exact: true }).fill("7"); + await expect(table.getByRole("row", { name: "AW runs 150 300", exact: true })).toBeVisible(); + await simulator.getByRole("slider", { name: "AIC per AW run", exact: true }).fill("0"); + await expect(table.getByRole("row", { name: "AI Credits (AIC) 0 0", exact: true })).toBeVisible(); + await simulator.getByRole("link", { name: "Database size", exact: true }).click(); + await expect(page.locator('[data-page-id="simulators"]').getByRole("slider")).toHaveCount(5); + }); + test(`Go Pages deployment uses populated IndexedDB at ${width}px`, async ({ page }, testInfo) => { await page.setViewportSize({ width, height: 900 }); const hostedRequests = []; diff --git a/tests/fixtures/company-stress/large.json b/tests/fixtures/company-stress/large.json new file mode 100644 index 0000000000..c5c971ac8b --- /dev/null +++ b/tests/fixtures/company-stress/large.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "name": "large", + "repositories": 10000, + "developers": 10000, + "prsPerDeveloperPerDay": 10, + "awRunsPerPR": 5, + "days": 1, + "aicPerRun": 100, + "seed": 42, + "distribution": "uniform" +} diff --git a/tests/fixtures/company-stress/medium.json b/tests/fixtures/company-stress/medium.json new file mode 100644 index 0000000000..8d33762904 --- /dev/null +++ b/tests/fixtures/company-stress/medium.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "name": "medium", + "repositories": 1000, + "developers": 1000, + "prsPerDeveloperPerDay": 10, + "awRunsPerPR": 5, + "days": 1, + "aicPerRun": 100, + "seed": 42, + "distribution": "uniform" +} diff --git a/tests/fixtures/company-stress/small.json b/tests/fixtures/company-stress/small.json new file mode 100644 index 0000000000..8ec3d39e3c --- /dev/null +++ b/tests/fixtures/company-stress/small.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "name": "small", + "repositories": 10, + "developers": 10, + "prsPerDeveloperPerDay": 10, + "awRunsPerPR": 5, + "days": 1, + "aicPerRun": 100, + "seed": 42, + "distribution": "uniform" +} diff --git a/tests/helpers/dashboard-pages-preview.mjs b/tests/helpers/dashboard-pages-preview.mjs index 3b125e0477..f0b1962287 100644 --- a/tests/helpers/dashboard-pages-preview.mjs +++ b/tests/helpers/dashboard-pages-preview.mjs @@ -11,7 +11,7 @@ import { prepareDashboardPages } from "../../scripts/simulate-dashboard-pages.mj const root = fileURLToPath(new URL("../../", import.meta.url)); const execute = promisify(execFile); -export async function startDashboardPagesPreview({ downloadData, basePath = "/gh-cao/", fixture = false } = {}) { +export async function startDashboardPagesPreview({ downloadData, basePath = "/gh-cao/", fixture = false, fixtureExperimental = false } = {}) { const scratch = join(root, ".tmp"); await mkdir(scratch, { recursive: true }); const directory = await mkdtemp(join(scratch, "pages-preview-")); @@ -51,7 +51,7 @@ export async function startDashboardPagesPreview({ downloadData, basePath = "/gh await writeFile(join(activityDir, "payload-hashes.json"), JSON.stringify(hashes)); await prepareDashboardPages({ activityDir, output: site, includeSqlite: false }); } else { - await prepareDashboardPages({ fixture, output: site }); + await prepareDashboardPages({ fixture, fixtureExperimental, output: site }); } await execute("go", ["-C", "server", "build", "-o", executable, "./cmd/cao-dashboard"], { cwd: root, timeout: 180_000, maxBuffer: 1024 * 1024, diff --git a/tests/unit/company-stress.test.mjs b/tests/unit/company-stress.test.mjs new file mode 100644 index 0000000000..c9439a8067 --- /dev/null +++ b/tests/unit/company-stress.test.mjs @@ -0,0 +1,73 @@ +import assert from "node:assert/strict"; +import { execFile } from "node:child_process"; +import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises"; +import { tmpdir } from "node:os"; +import { join, resolve } from "node:path"; +import { promisify } from "node:util"; +import test from "node:test"; + +const execute = promisify(execFile); +const launcher = resolve("scripts/company-stress.mjs"); + +test("company stress is opt-in and preserves the existing fleet command", async () => { + const workflow = await readFile(".github/workflows/company-stress.yml", "utf8"); + assert.match(workflow, /workflow_dispatch:/); + assert.match(workflow, /workflow_call:/); + assert.doesNotMatch(workflow, /schedule:|pull_request:|secrets\.|gh aw run/); + assert.match(workflow, /max_locks_per_transaction=1024/); + assert.match(workflow, /if: always\(\)/); + const pkg = JSON.parse(await readFile("package.json", "utf8")); + assert.equal(pkg.scripts["test:stress:company"], "node scripts/company-stress.mjs"); + assert.match(pkg.scripts["test:stress:cao"], /TestGitHubSimulatorFleetStress/); +}); + +test("company launcher overrides every input and isolates credential environment", async () => { + const directory = await mkdtemp(join(tmpdir(), "company-stress-")); + try { + await writeFile(join(directory, "go"), `#!/usr/bin/env node +import { writeFileSync } from 'node:fs'; +if (process.env.GH_TOKEN || process.env.GITHUB_TOKEN || process.env.GH_ENTERPRISE_TOKEN) process.exit(2); +writeFileSync(process.env.HARNESS_TRACE, JSON.stringify({ + scenario: JSON.parse(process.env.CAO_COMPANY_SCENARIO), + args: process.argv.slice(2), + report: process.env.CAO_COMPANY_REPORT_DIR +})); +`, { mode: 0o700 }); + const trace = join(directory, "trace.json"); + await execute(process.execPath, [ + launcher, "--preset", "large", "--repositories", "7", "--developers", "3", + "--prs-per-developer-per-day", "2", "--aw-runs-per-pr", "4", "--days", "2", + "--aic-per-run", "0.25", "--seed", "1", "--distribution", "burst", + "--timeout", "2m", "--report-dir", directory, + ], { env: { + ...process.env, PATH: `${directory}:${process.env.PATH}`, HARNESS_TRACE: trace, + POSTGRES_URL: "postgres://127.0.0.1:5432/company", + GH_TOKEN: "synthetic-fixture", GITHUB_TOKEN: "synthetic-fixture", GH_ENTERPRISE_TOKEN: "synthetic-fixture", + } }); + const result = JSON.parse(await readFile(trace, "utf8")); + assert.deepEqual(result.scenario, { + version: 1, name: "large", repositories: 7, developers: 3, prsPerDeveloperPerDay: 2, + awRunsPerPR: 4, days: 2, aicPerRun: 0.25, seed: 1, distribution: "burst", + }); + assert.ok(result.args.includes("-timeout=2m")); + assert.equal(result.report, directory); + } finally { + await rm(directory, { recursive: true, force: true }); + } +}); + +test("company launcher rejects remote PostgreSQL and leaves an incomplete report", async () => { + const directory = await mkdtemp(join(tmpdir(), "company-stress-")); + try { + await assert.rejects(execute(process.execPath, [launcher, "--report-dir", directory], { + env: { ...process.env, POSTGRES_URL: "postgres://example.invalid/company" }, + }), /numeric loopback/); + const report = JSON.parse(await readFile(join(directory, "company-stress.json"), "utf8")); + assert.equal(report.status, "incomplete"); + await assert.rejects(execute(process.execPath, [ + launcher, "--report-dir", directory, "--developers", "NaN", + ]), /finite number/); + } finally { + await rm(directory, { recursive: true, force: true }); + } +}); diff --git a/tests/unit/dashboard-pages-simulation.test.mjs b/tests/unit/dashboard-pages-simulation.test.mjs index 3b59053a21..c3ea048f7f 100644 --- a/tests/unit/dashboard-pages-simulation.test.mjs +++ b/tests/unit/dashboard-pages-simulation.test.mjs @@ -85,6 +85,8 @@ test("Pages output refuses repository paths, unowned data, and symlink ancestors await assert.rejects(prepareDashboardPages({ output: path.join(directory, "output") }), /exactly one/); await assert.rejects(prepareDashboardPages({ fixture: true, includeSqlite: false }), /not a synthetic fixture/); await assert.rejects(prepareDashboardPages({ fixture: true, includeSqlite: null }), /must be a boolean/); + await assert.rejects(prepareDashboardPages({ fixture: true, fixtureExperimental: null }), /fixtureExperimental/); + await assert.rejects(prepareDashboardPages({ activityDir: directory, fixtureExperimental: true }), /fixtureExperimental/); }); test("offline pipeline publishes real build assets, canonical SQLite, and verified phased payloads", { timeout: 120_000 }, async (t) => { @@ -97,6 +99,8 @@ test("offline pipeline publishes real build assets, canonical SQLite, and verifi assert.equal(marker.synthetic, true); assert.equal(marker.includeSqlite, true); assert.equal(marker.retention, "all"); + const dashboard = JSON.parse(await readFile(path.join(output, "dashboard.json"), "utf8")); + assert.ok(!dashboard.dashboard.pages.some(({ id }) => id === "simulator-pull-request")); const names = await readdir(output); for (const name of ["index.html", "dashboard.json", "service-worker.js", "payload-hashes.json", "gh-aw-logs.sqlite", "inventory-sources.json", "agent-summary.json", "llms.txt"]) { diff --git a/tests/unit/dashboard-site-build.test.mjs b/tests/unit/dashboard-site-build.test.mjs index d4c177a55d..915ec64525 100644 --- a/tests/unit/dashboard-site-build.test.mjs +++ b/tests/unit/dashboard-site-build.test.mjs @@ -28,7 +28,11 @@ test("dashboard site filters experimental views unless explicitly enabled", () = const document = { "language-version": "0.1.0", dashboard: { - pages: [{ id: "stable" }, { id: "preview" }], + pages: [ + { id: "stable" }, + { id: "preview" }, + { id: "preview-tab", experimental: true, route: { "navigation-page": "preview" } }, + ], navigation: [ { label: "Main", pages: ["stable"] }, { label: "Preview", experimental: true, pages: ["preview"] }, @@ -36,6 +40,7 @@ test("dashboard site filters experimental views unless explicitly enabled", () = callouts: [ { id: "stable-callout", "navigation-page": "stable" }, { id: "preview-callout", "navigation-page": "preview" }, + { id: "preview-tab-callout", "navigation-page": "preview-tab" }, ], }, }; From 9fec76af231bf1dbc03e486f2a7775060e2152cd Mon Sep 17 00:00:00 2001 From: Peli de Halleux <4175913+pelikhan@users.noreply.github.com> Date: Fri, 30 Oct 2026 06:44:50 -0700 Subject: [PATCH 2/5] Run large company stress scenario in daily validation Reuse the existing main-only daily schedule and include company stress results in the aggregate report while preserving manual scenario configuration. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/ci-daily.yml | 6 ++++++ server/COMPANY-STRESS.md | 8 +++++--- tests/unit/cao-ci-tiers.test.mjs | 5 +++-- tests/unit/company-stress.test.mjs | 9 ++++++++- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-daily.yml b/.github/workflows/ci-daily.yml index 4f04f65461..6ea5f99d94 100644 --- a/.github/workflows/ci-daily.yml +++ b/.github/workflows/ci-daily.yml @@ -100,6 +100,11 @@ jobs: fleet-stress: needs: revision uses: ./.github/workflows/cao-fleet-stress.yml # zizmor: ignore[self-repository] - Local reusable workflows use syntax supported by Actions and actionlint. + company-stress: + needs: revision + uses: ./.github/workflows/company-stress.yml # zizmor: ignore[self-repository] - Local reusable workflows use syntax supported by Actions and actionlint. + with: + preset: large backfill-stress: needs: revision uses: ./.github/workflows/backfill-stress.yml # zizmor: ignore[self-repository] - Local reusable workflows use syntax supported by Actions and actionlint. @@ -162,6 +167,7 @@ jobs: - deployed - dashboard-stress - fleet-stress + - company-stress - backfill-stress - worker-memory runs-on: ubuntu-latest diff --git a/server/COMPANY-STRESS.md b/server/COMPANY-STRESS.md index 505fd7286f..3ba392707d 100644 --- a/server/COMPANY-STRESS.md +++ b/server/COMPANY-STRESS.md @@ -54,9 +54,11 @@ peak RSS or database memory). `--report-dir PATH` selects another directory. Failure reports identify the incomplete stage; the command exits nonzero. A hard timeout may leave only the launcher's incomplete report and test log. -The existing Go CI runs the small service-backed smoke test; the full-size case -is opt-in through `.github/workflows/company-stress.yml`, which accepts a preset -or complete scenario JSON and uploads evidence even on failure. Existing fleet, +The existing Go CI runs the small service-backed smoke test. Daily full validation +(`.github/workflows/ci-daily.yml`) runs the large preset on `main` at 06:37 UTC +and includes its outcome in the aggregate daily report. The reusable +`.github/workflows/company-stress.yml` also accepts manual preset or complete +scenario JSON inputs and uploads evidence even on failure. Existing fleet, backfill, and monthly-budget tests retain their separate coverage. The dashboard's **Simulators > Pull request** tab is a side-effect-free calculator diff --git a/tests/unit/cao-ci-tiers.test.mjs b/tests/unit/cao-ci-tiers.test.mjs index 65432af7c1..eac149c20d 100644 --- a/tests/unit/cao-ci-tiers.test.mjs +++ b/tests/unit/cao-ci-tiers.test.mjs @@ -44,7 +44,7 @@ test("daily calls every suite at the same revision and reports even on failure", assert.equal(daily.on.schedule.length, 1); assert.equal(daily.concurrency["cancel-in-progress"], false); const suites = Object.entries(daily.jobs).filter(([, job]) => job.uses); - assert.equal(suites.length, 16); + assert.equal(suites.length, 17); for (const [id, job] of suites) { assert.match(job.uses, /^\.\/\.github\/workflows\/[^/]+\.yml$/); assert.equal(job.needs, "revision"); @@ -62,12 +62,13 @@ test("daily calls every suite at the same revision and reports even on failure", } assert.equal(daily.jobs.report.if, "always()"); assert.deepEqual(daily.jobs.deployed.with, { full: true }); + assert.deepEqual(daily.jobs["company-stress"].with, { preset: "large" }); assert.equal(daily.jobs["worker-memory"].needs, "revision"); const memorySteps = daily.jobs["worker-memory"].steps; assert.ok(memorySteps.some((step) => step.uses?.startsWith("actions/setup-go@"))); assert.ok(memorySteps.some((step) => step.run?.includes("npm --prefix dashboard/site ci"))); for (const name of ["actions.yml", "dashboard-views.yml", "cao-bootstrap.yml", - "cao-fleet-stress.yml", "backfill-stress.yml", "dashboard-massive-scale.yml"]) { + "cao-fleet-stress.yml", "company-stress.yml", "backfill-stress.yml", "dashboard-massive-scale.yml"]) { assert.equal(load(name).on.schedule, undefined, `${name} must not duplicate the daily schedule`); } }); diff --git a/tests/unit/company-stress.test.mjs b/tests/unit/company-stress.test.mjs index c9439a8067..89df029511 100644 --- a/tests/unit/company-stress.test.mjs +++ b/tests/unit/company-stress.test.mjs @@ -5,17 +5,24 @@ import { tmpdir } from "node:os"; import { join, resolve } from "node:path"; import { promisify } from "node:util"; import test from "node:test"; +import { parse } from "yaml"; const execute = promisify(execFile); const launcher = resolve("scripts/company-stress.mjs"); -test("company stress is opt-in and preserves the existing fleet command", async () => { +test("company stress runs the large preset daily and preserves manual configuration", async () => { const workflow = await readFile(".github/workflows/company-stress.yml", "utf8"); assert.match(workflow, /workflow_dispatch:/); assert.match(workflow, /workflow_call:/); assert.doesNotMatch(workflow, /schedule:|pull_request:|secrets\.|gh aw run/); assert.match(workflow, /max_locks_per_transaction=1024/); assert.match(workflow, /if: always\(\)/); + const daily = parse(await readFile(".github/workflows/ci-daily.yml", "utf8")); + assert.deepEqual(daily.on.schedule, [{ cron: "37 6 * * *" }]); + assert.equal(daily.jobs["company-stress"].needs, "revision"); + assert.equal(daily.jobs["company-stress"].uses, "./.github/workflows/company-stress.yml"); + assert.deepEqual(daily.jobs["company-stress"].with, { preset: "large" }); + assert.ok(daily.jobs.report.needs.includes("company-stress")); const pkg = JSON.parse(await readFile("package.json", "utf8")); assert.equal(pkg.scripts["test:stress:company"], "node scripts/company-stress.mjs"); assert.match(pkg.scripts["test:stress:cao"], /TestGitHubSimulatorFleetStress/); From a0d0b8a86604ec3610dd7fffa448c9fb05796109 Mon Sep 17 00:00:00 2001 From: Peli de Halleux <4175913+pelikhan@users.noreply.github.com> Date: Fri, 30 Oct 2026 06:46:06 -0700 Subject: [PATCH 3/5] Fix company stress readiness loop ShellCheck warning Use a Bash arithmetic loop so the retry counter is consumed while preserving the 60-attempt readiness bound. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/company-stress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/company-stress.yml b/.github/workflows/company-stress.yml index 2cddc67c96..8524049316 100644 --- a/.github/workflows/company-stress.yml +++ b/.github/workflows/company-stress.yml @@ -59,7 +59,7 @@ jobs: --publish 127.0.0.1::5432 postgres:16-alpine \ postgres -c max_locks_per_transaction=1024 ready=false - for attempt in $(seq 1 60); do + for ((attempt = 1; attempt <= 60; attempt++)); do if docker exec cao-company-stress-postgres pg_isready -U postgres -d cao_company; then ready=true break From 3fd1e0e5cb19e6d4e9929430d701b88ade0715b7 Mon Sep 17 00:00:00 2001 From: Peli de Halleux <4175913+pelikhan@users.noreply.github.com> Date: Fri, 30 Oct 2026 06:59:36 -0700 Subject: [PATCH 4/5] Fix company stress contract partition and simulator parameters Assign the company stress contracts to tooling so fail-closed area selection can run. Separate company repository inputs from database simulator defaults, regenerate the agent catalog, and cover both default bindings. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../site/dashboard-fragments/simulators.json | 8 ++-- .../site/src/agent/catalog.generated.json | 40 +++++++++---------- .../site/src/agent/queries.generated.json | 2 +- .../pull-request-simulator-contract.json | 2 +- .../test/unit/pull-request-simulator.test.js | 6 +-- scripts/run-unit-area.mjs | 2 +- .../server/company_calculator_test.go | 2 +- .../unit/dashboard-benchmark-queries.test.mjs | 4 ++ tests/unit/unit-area-selection.test.mjs | 1 + 9 files changed, 36 insertions(+), 31 deletions(-) diff --git a/dashboard/site/dashboard-fragments/simulators.json b/dashboard/site/dashboard-fragments/simulators.json index 33fdc805fe..95999ba644 100644 --- a/dashboard/site/dashboard-fragments/simulators.json +++ b/dashboard/site/dashboard-fragments/simulators.json @@ -98,7 +98,7 @@ "acceptance": "Developers multiply PRs per developer per day, AW runs per PR and AIC per run; repositories divide averages only. Duration scales totals independently of the synthetic day source.", "from": "simulation-days", "parameters": [ - { "name": "repositories", "type": "number" }, + { "name": "company-repositories", "type": "number" }, { "name": "developers", "type": "number" }, { "name": "prs-per-developer-per-day", "type": "number" }, { "name": "aw-runs-per-pr", "type": "number" }, @@ -113,8 +113,8 @@ { "as": "total-prs", "function": "product", "args": [{ "field": "daily-prs" }, { "parameter": "days" }] }, { "as": "total-runs", "function": "product", "args": [{ "field": "daily-runs" }, { "parameter": "days" }] }, { "as": "total-aic", "function": "product", "args": [{ "field": "daily-aic" }, { "parameter": "days" }] }, - { "as": "prs-per-repo", "function": "quotient", "args": [{ "field": "daily-prs" }, { "parameter": "repositories" }] }, - { "as": "runs-per-repo", "function": "quotient", "args": [{ "field": "daily-runs" }, { "parameter": "repositories" }] }, + { "as": "prs-per-repo", "function": "quotient", "args": [{ "field": "daily-prs" }, { "parameter": "company-repositories" }] }, + { "as": "runs-per-repo", "function": "quotient", "args": [{ "field": "daily-runs" }, { "parameter": "company-repositories" }] }, { "as": "runs-per-second", "function": "quotient", "args": [{ "field": "daily-runs" }, { "value": 86400 }] } ] }, @@ -240,7 +240,7 @@ "description": "PRs are per developer per day, not per repository. Duration counts calendar days. The CLI stress runner independently bounds generated records to five million.", "fields": [ { - "id": "repositories", + "id": "company-repositories", "label": "Repositories", "control": "slider", "min": 1, diff --git a/dashboard/site/src/agent/catalog.generated.json b/dashboard/site/src/agent/catalog.generated.json index 6ceae9b70c..a6d2331b19 100644 --- a/dashboard/site/src/agent/catalog.generated.json +++ b/dashboard/site/src/agent/catalog.generated.json @@ -12113,22 +12113,22 @@ "required": true }, { - "name": "days", + "name": "company-repositories", "type": "number", "required": true }, { - "name": "developers", + "name": "days", "type": "number", "required": true }, { - "name": "prs-per-developer-per-day", + "name": "developers", "type": "number", "required": true }, { - "name": "repositories", + "name": "prs-per-developer-per-day", "type": "number", "required": true } @@ -12163,22 +12163,22 @@ "required": true }, { - "name": "days", + "name": "company-repositories", "type": "number", "required": true }, { - "name": "developers", + "name": "days", "type": "number", "required": true }, { - "name": "prs-per-developer-per-day", + "name": "developers", "type": "number", "required": true }, { - "name": "repositories", + "name": "prs-per-developer-per-day", "type": "number", "required": true } @@ -12213,22 +12213,22 @@ "required": true }, { - "name": "days", + "name": "company-repositories", "type": "number", "required": true }, { - "name": "developers", + "name": "days", "type": "number", "required": true }, { - "name": "prs-per-developer-per-day", + "name": "developers", "type": "number", "required": true }, { - "name": "repositories", + "name": "prs-per-developer-per-day", "type": "number", "required": true } @@ -12263,22 +12263,22 @@ "required": true }, { - "name": "days", + "name": "company-repositories", "type": "number", "required": true }, { - "name": "developers", + "name": "days", "type": "number", "required": true }, { - "name": "prs-per-developer-per-day", + "name": "developers", "type": "number", "required": true }, { - "name": "repositories", + "name": "prs-per-developer-per-day", "type": "number", "required": true } @@ -12313,22 +12313,22 @@ "required": true }, { - "name": "days", + "name": "company-repositories", "type": "number", "required": true }, { - "name": "developers", + "name": "days", "type": "number", "required": true }, { - "name": "prs-per-developer-per-day", + "name": "developers", "type": "number", "required": true }, { - "name": "repositories", + "name": "prs-per-developer-per-day", "type": "number", "required": true } diff --git a/dashboard/site/src/agent/queries.generated.json b/dashboard/site/src/agent/queries.generated.json index 8fc453f9ef..6126a0c252 100644 --- a/dashboard/site/src/agent/queries.generated.json +++ b/dashboard/site/src/agent/queries.generated.json @@ -1 +1 @@ -[{"name":"command-queue","subject":"Show the durable local CLI command queue.","objective":"Inspect command lifecycle and reconnect to output without rerunning work.","acceptance":"Preserve persistent command IDs and all six server states; closing output never cancels execution. Unavailable local authority is not an empty queue.","from":"cli-commands","compute":[{"as":"command-action","function":"coalesce","args":[{"field":"actionId"},{"value":""}]},{"as":"command-title","function":"coalesce","args":[{"field":"command"},{"field":"actionId"}]},{"as":"command-target","function":"coalesce","args":[{"field":"repository"},{"field":"campaign"},{"field":"package-source"},{"value":"Local control repository"}]},{"as":"command-created-at","function":"coalesce","args":[{"field":"createdAt"},{"value":null}]},{"as":"command-href","function":"concat","args":[{"value":"#page-command?command="},{"field":"id"}]},{"as":"command-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"command-href"},{"field":"command-title"},{"field":"id"}]}]},{"name":"event-base","subject":"Project shared event fields before combining run-owned records.","objective":"Provide the narrow retained event evidence needed for inspection and run import-coverage analysis.","acceptance":"The result unions retained audit, domain, tool, and issue records with their available run identity; an empty or unavailable preview cannot establish zero source activity or complete import coverage.","from":"audits","union":["domains","tools","issues"],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"event"},{"field":"event-source"},{"field":"event-type"},{"field":"event-summary"},{"field":"event-status"},{"field":"github-entity-type"},{"field":"safe-output-type"},{"field":"safe-output-url"},{"field":"correlation-id"},{"field":"implementation-pull-request-url"},{"field":"event-timestamp"},{"field":"run-link"}]},{"name":"audit-event-runs","subject":"Count imported audit records per run before combining event sources.","objective":"Bound audit evidence for run import-coverage analysis.","acceptance":"Count only retained audit records with event identity by run attempt; missing evidence does not establish zero activity.","from":"audits","aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"event","as":"events","reducer":"count"}]}},{"name":"domain-event-runs","subject":"Count imported domain records per run before combining event sources.","objective":"Bound domain evidence for run import-coverage analysis.","acceptance":"Count only retained domain records with event identity by run attempt; missing evidence does not establish zero activity.","from":"domains","aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"event","as":"events","reducer":"count"}]}},{"name":"tool-event-runs","subject":"Count imported tool records per run before combining event sources.","objective":"Bound tool evidence for run import-coverage analysis.","acceptance":"Count only retained tool records with event identity by run attempt; missing evidence does not establish zero activity.","from":"tools","aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"event","as":"events","reducer":"count"}]}},{"name":"issue-event-runs","subject":"Count imported issue records per run before combining event sources.","objective":"Bound issue evidence for run import-coverage analysis.","acceptance":"Count only retained issue records with event identity by run attempt; missing evidence does not establish zero activity.","from":"issues","aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"event","as":"events","reducer":"count"}]}},{"name":"event-runs","subject":"Identify each workflow run that has one or more imported run-owned records.","objective":"Identify run attempts with retained imported records so their presence can be compared with observed runs.","acceptance":"One row per organization, repository, workflow, run, and attempt contains events, the count of matching retained records; no row in an available result does not prove that no event was produced.","description":"Distinct workflow runs represented by imported domain, tool, audit, or issue records.","from":"audit-event-runs","union":["domain-event-runs","tool-event-runs","issue-event-runs"],"aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"events","as":"events","reducer":"sum"}]}},{"name":"run-import-status","subject":"Identify observed runs that have one or more imported run-owned records.","objective":"Compare observed run attempts with retained run-owned event evidence to locate import-coverage gaps for investigation.","acceptance":"Keep each observed run and its run-attempt identity; imported-event-count is zero and imported is false without a matching retained event, but missing events alone do not establish an ingestion failure.","description":"Observed runs enriched with imported-record status.","from":"runs","joins":[{"source":"event-runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"events","as":"imported-events"}]}],"compute":[{"as":"imported-event-count","function":"coalesce","args":[{"field":"imported-events"},{"value":0}]},{"as":"imported","function":"greater-than","args":[{"field":"imported-event-count"},{"value":0}]}]},{"name":"workflow-run-totals","subject":"Summarize observed run counts and imported runs by declared workflow.","objective":"Compare observed run attempts, conclusions, and imported-record coverage for each workflow.","acceptance":"Group by organization, repository, and workflow; report distinct run-attempt totals, successful and failed conclusion counts, and imported-run totals only from retained evidence. Missing run records cannot establish zero execution.","description":"Observed run and imported-run totals for each declared workflow.","from":"run-import-status","compute":[{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run-attempt-identity","as":"runs","reducer":"distinct-count"},{"field":"run-conclusion","as":"successful-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","equals":"success"}]}},{"field":"run-conclusion","as":"failed-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","stale","timed-out"]}]}},{"field":"imported","as":"imported-runs","reducer":"sum"}]}},{"name":"workflow-aic-run-totals","subject":"Summarize observed run attempts and AI Credits for workflow cost comparison.","objective":"Count retained run attempts and recorded AI Credits without loading imported-event coverage.","acceptance":"Count all distinct retained run attempts, but include only positive recorded AIC in cost totals and cost denominators; zero and missing telemetry cannot skew cost averages.","from":"runs","compute":[{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run-attempt-identity","as":"runs","reducer":"distinct-count"},{"field":"run-attempt-identity","as":"aic-runs","reducer":"distinct-count","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"aic-total","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}}]}},{"name":"workflow-aic-totals","subject":"Summarize observed AI Credit usage by declared workflow.","objective":"Expose retained AI Credit consumption per workflow for bounded cost review alongside observed execution.","acceptance":"Sum only positive recorded aic-total by organization, repository, and workflow; exclude zero and missing costs rather than treating them as free execution.","description":"Observed AI Credit totals for each declared workflow.","from":"workflow-aic-run-totals","filter":{"predicates":[{"field":"aic-runs","gte":1}]},"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"aic"},{"field":"aic-runs"}]},{"name":"mcp-tool-workflow-totals","subject":"Summarize observed MCP calls by tool and workflow before the tool inventory is materialized.","objective":"Keep MCP inventory intermediates bounded without dropping calls or changing byte totals.","acceptance":"Count retained observation identities and sum request and response bytes per server, tool, and workflow; retain safe-output-server classification for downstream exclusion.","from":"mcp-calls","compute":[{"as":"safe-output-server","function":"equals-any","args":[{"field":"mcp-server"},{"value":"safe_outputs"},{"value":"safeoutputs"}]},{"as":"mcp-tool-label","function":"concat","args":[{"field":"mcp-server"},{"value":"/"},{"field":"mcp-tool"}]},{"as":"workflow-key","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}],"aggregate":{"by":["safe-output-server","mcp-tool-label","mcp-server","mcp-tool","workflow-key"],"values":[{"field":"mcp-observation","as":"calls","reducer":"count"},{"field":"request-bytes","as":"request-bytes","reducer":"sum"},{"field":"response-bytes","as":"response-bytes","reducer":"sum"}]}},{"name":"mcp-tool-calls","subject":"Prepare MCP tool calls for aggregation with safe-output-server calls identified for downstream exclusion.","objective":"Identify retained MCP call labels and safe-output-server classification for downstream tool-use investigation.","acceptance":"Preserve each retained call with its workflow key and tool label and mark safe-output-server calls explicitly; downstream exclusion must not be mistaken for absence of those calls or complete tool telemetry.","description":"Observed MCP tool calls labeled with whether they belong to the internal safe outputs server.","from":"mcp-calls","compute":[{"as":"safe-output-server","function":"equals-any","args":[{"field":"mcp-server"},{"value":"safe_outputs"},{"value":"safeoutputs"}]},{"as":"mcp-tool-label","function":"concat","args":[{"field":"mcp-server"},{"value":"/"},{"field":"mcp-tool"}]},{"as":"workflow-key","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}]},{"name":"issue-safe-outputs","subject":"List retained GitHub issue safe outputs.","objective":"Inspect retained issue safe outputs and their observed closure state before deciding which items need follow-up.","acceptance":"Include only safe_output.result issue records, not pull requests; preserve issue and run links, timestamps, state, and status detail. Unknown or unobserved closure state must not be presented as closed.","description":"Issue-only projection of retained safe-output items.","from":"issues","filter":{"predicates":[{"field":"event-type","equals":"safe_output.result"},{"field":"is-pull-request","equals":false}]},"joins":[{"source":"runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"run-link","as":"linked-run"}]}],"compute":[{"as":"_issue-state-open","function":"equals-any","args":[{"field":"issue-state"},{"value":"OPEN"}]},{"as":"_issue-state-closed","function":"equals-any","args":[{"field":"issue-state"},{"value":"CLOSED"}]},{"as":"_issue-open-status","function":"if","args":[{"field":"_issue-state-open"},{"value":"Open"},{"value":"Unknown"}]},{"as":"issue-status","function":"if","args":[{"field":"_issue-state-closed"},{"value":"Closed"},{"field":"_issue-open-status"}]},{"as":"_issue-closing-reason","function":"coalesce","args":[{"field":"issue-state-reason"},{"value":"unknown"}]},{"as":"_issue-closing-reason-normalized","function":"lower","args":[{"field":"_issue-closing-reason"}]},{"as":"issue-closing-status","function":"title-case","args":[{"field":"_issue-closing-reason-normalized"}]},{"as":"_issue-closed-status-detail","function":"concat","args":[{"value":"Closed: "},{"field":"issue-closing-status"}]},{"as":"issue-status-detail","function":"if","args":[{"field":"_issue-state-closed"},{"field":"_issue-closed-status-detail"},{"field":"issue-status"}]}],"select":[{"field":"event-timestamp","as":"observed-at"},{"field":"github-entity-type"},{"field":"is-pull-request"},{"field":"safe-output-type"},{"field":"issue-state"},{"field":"issue-closed"},{"field":"issue-state-reason"},{"field":"issue-status"},{"field":"issue-closing-status"},{"field":"issue-status-detail"},{"field":"issue-closed-at"},{"field":"issue-status-observed-at"},{"field":"event-summary"},{"field":"correlation-id","as":"entity-url"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"linked-run","as":"run-link"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"entity-url","direction":"asc"}]},{"name":"issue-safe-output-label-options","subject":"List observed safe-output badges for the issue list Labels filter.","objective":"Choose retained safe-output types without scanning or filtering presented cards.","acceptance":"Return distinct observed badge values in ascending order; missing evidence is not an empty label inventory.","from":"issue-safe-outputs","aggregate":{"by":["safe-output-type"],"values":[{"field":"entity-url","as":"items","reducer":"count"}]},"order-by":[{"field":"safe-output-type","direction":"asc"}]},{"name":"issue-status-label-options","subject":"List observed status badges for the issue list Status filter.","objective":"Choose retained issue states and closing reasons without inferring resolution.","acceptance":"Return distinct observed status details in ascending order; Unknown remains distinct from Open and Closed.","from":"issue-safe-outputs","aggregate":{"by":["issue-status-detail"],"values":[{"field":"entity-url","as":"items","reducer":"count"}]},"order-by":[{"field":"issue-status-detail","direction":"asc"}]},{"name":"issue-repository-totals","subject":"Rank the ten repositories with the most retained GitHub issue safe outputs.","objective":"Locate repositories with the largest observed issue-safe-output volume for a bounded review of linked records.","acceptance":"Return at most ten repository coordinates ordered by retained issue-record count; ties or missing issue evidence must not imply a complete fleet ranking or unique issue count.","description":"Top repositories by retained issue safe-output count.","from":"issue-safe-outputs","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]}],"aggregate":{"by":["repository-coordinate"],"values":[{"field":"entity-url","as":"issues","reducer":"count"}]},"order-by":[{"field":"issues","direction":"desc"},{"field":"repository-coordinate","direction":"asc"}],"limit":10},{"name":"campaign-import-audit-count","subject":"Count retained audit identities for campaign inventory source quality.","objective":"Retain audit provenance without reconstructing run coverage.","acceptance":"Count canonical audit IDs; missing evidence stays unavailable and the count is not displayed as import coverage.","from":"audits","aggregate":{"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"campaign-import-domain-count","subject":"Count retained domain identities for campaign inventory source quality.","objective":"Retain domain provenance without reconstructing run coverage.","acceptance":"Count canonical domain IDs; missing evidence stays unavailable and the count is not displayed as import coverage.","from":"domains","aggregate":{"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"campaign-import-tool-count","subject":"Count retained tool identities for campaign inventory source quality.","objective":"Retain tool provenance without reconstructing run coverage.","acceptance":"Count canonical tool IDs; missing evidence stays unavailable and the count is not displayed as import coverage.","from":"tools","aggregate":{"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"campaign-import-issue-count","subject":"Count retained issue identities for campaign inventory source quality.","objective":"Retain issue provenance without reconstructing run coverage.","acceptance":"Count canonical issue IDs; missing evidence stays unavailable and the count is not displayed as import coverage.","from":"issues","aggregate":{"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"campaign-workflow-import-evidence","subject":"Compose retained import-source quality for campaign workflow execution totals.","objective":"Preserve all four import dependencies without counting unused per-run or per-workflow coverage.","acceptance":"Compose audit, domain, tool, and issue availability, freshness, and completeness exactly as event-runs. The retained-record count carries source quality only; it is not displayed or used as horizon-specific import coverage, executions, or outcomes. Run and AI Credit totals retain their selected horizon.","from":"campaign-import-audit-count","union":["campaign-import-domain-count","campaign-import-tool-count","campaign-import-issue-count"],"time":{"range":"all"},"compute":[{"as":"import-scope","function":"literal","args":[{"value":"retained"}]}],"aggregate":{"by":["import-scope"],"values":[{"field":"records","as":"events","reducer":"sum"}]}},{"name":"campaign-workflow-execution-base","subject":"Summarize retained run attempts and AI Credits before campaign workflow enrichment.","objective":"Read run identity and recorded AI Credits together instead of enriching every run with import status.","acceptance":"Count distinct run-attempt identities and sum aic-total per organization, repository, and workflow; missing retained evidence is not proof of no execution or cost.","from":"runs","compute":[{"as":"import-scope","function":"literal","args":[{"value":"retained"}]},{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["organization","repository","workflow","import-scope"],"values":[{"field":"run-attempt-identity","as":"runs","reducer":"distinct-count"},{"field":"aic-total","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}}]}},{"name":"campaign-workflow-execution-totals","subject":"Attach retained import-evidence quality to compact workflow execution totals.","objective":"Preserve the public inventory's run and import availability composition after aggregating run evidence.","acceptance":"Keep runs and AI Credits unchanged; unavailable run evidence fails closed and optional import evidence degrades quality exactly as in run-import-status.","description":"Only source quality is consumed from import evidence. Join its compact retained-source summary after run aggregation; do not build unused run-level import coverage or change horizon-specific execution totals.","from":"campaign-workflow-execution-base","joins":[{"source":"campaign-workflow-import-evidence","type":"left","on":[{"left":"import-scope","right":"import-scope"}],"fields":[{"field":"events","as":"imported-events"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"runs"},{"field":"aic"}]},{"name":"campaign-workflow-declarations","subject":"Project reusable campaign workflow declarations without execution evidence.","objective":"Share declaration display fields between structural topology and execution inventory without joining runs or import evidence.","acceptance":"Preserve raw organization, repository, workflow and declaration fields for joins. Select orchestrator and worker roles once, retaining inactive and unknown declarations; only list consumers select active entries. Display defaults and repository links do not establish execution, enrollment or authority.","from":"workflows","filter":{"predicates":[{"field":"workflow-role","in":["orchestrator","worker"]}]},"compute":[{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"declared-mode","function":"coalesce","args":[{"field":"rollout-mode"},{"value":"unknown"}]},{"as":"declared-registration","function":"coalesce","args":[{"field":"workflow-active"},{"value":"unknown"}]},{"as":"campaign-title","function":"title-case","args":[{"field":"campaign"}]},{"as":"campaign-display-name","function":"coalesce","args":[{"field":"campaign-name"},{"field":"campaign-title"},{"value":"Repository-owned"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-slug"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-slug"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-slug"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"campaign"},{"field":"campaign-name"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"rollout-mode"},{"field":"workflow-active"},{"field":"repository-link"},{"field":"workflow-link"},{"field":"repository-slug"},{"field":"declared-mode"},{"field":"declared-registration"},{"field":"campaign-display-name"},{"field":"workflow-display-name"},{"field":"repository-dashboard-link"}]},{"name":"campaign-workflow-inventory","subject":"Project declared campaign workflows with lean execution and configuration evidence.","objective":"Provide campaign totals and lists from shared declarations with separate execution and import-quality evidence.","acceptance":"Keep all declared orchestrators and workers, including inactive and unobserved entries; preserve inventory ordering, configuration defaults, execution totals, and import-evidence quality.","description":"Lean campaign inventory with execution totals that retain the public workflow inventory's evidence-quality dependencies.","from":"campaign-workflow-declarations","joins":[{"source":"campaign-workflow-execution-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"aic","as":"observed-aic"}]}],"compute":[{"as":"total-runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"total-aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"organization"},{"field":"repository-slug","as":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"declared-registration","as":"workflow-active"},{"field":"total-runs","as":"runs"},{"field":"total-aic","as":"aic"},{"field":"repository-link"},{"field":"workflow-link"},{"field":"campaign-display-name"},{"field":"workflow-display-name"},{"field":"repository-dashboard-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"workflow-inventory","subject":"List declared workflows with their campaign, repository, configuration, and observed execution totals.","objective":"Compare declared workflow configuration with retained run, import-coverage, and AI Credit evidence to select a workflow for closer inspection.","acceptance":"Keep one row per declared workflow with identity, role, mode, registration, links, observed totals, and ingestion indicator; zero joined totals and missing evidence must not be treated as proof of no execution or complete ingestion.","description":"Central campaign and repository-owned workflow inventory with observed execution totals.","from":"workflows","joins":[{"source":"workflow-run-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"successful-runs","as":"observed-successful-runs"},{"field":"failed-runs","as":"observed-failed-runs"},{"field":"imported-runs","as":"observed-imported-runs"}]},{"source":"workflow-aic-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"aic","as":"observed-aic"},{"field":"aic-runs","as":"observed-aic-runs"}]}],"compute":[{"as":"campaign-title","function":"title-case","args":[{"field":"campaign"}]},{"as":"campaign-display-name","function":"coalesce","args":[{"field":"campaign-name"},{"field":"campaign-title"},{"value":"Repository-owned"}]},{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"declared-role","function":"coalesce","args":[{"field":"workflow-role"},{"value":"standalone"}]},{"as":"declared-mode","function":"coalesce","args":[{"field":"rollout-mode"},{"value":"unknown"}]},{"as":"declared-registration","function":"coalesce","args":[{"field":"workflow-active"},{"value":"unknown"}]},{"as":"total-runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"total-successful-runs","function":"coalesce","args":[{"field":"observed-successful-runs"},{"value":0}]},{"as":"has-observed-runs","function":"greater-than","args":[{"field":"total-runs"},{"value":0}]},{"as":"total-failed-runs","function":"coalesce","args":[{"field":"observed-failed-runs"},{"value":0}]},{"as":"total-aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]},{"as":"aic-per-run","function":"quotient","args":[{"field":"total-aic"},{"field":"observed-aic-runs"}]},{"as":"total-imported-runs","function":"coalesce","args":[{"field":"observed-imported-runs"},{"value":0}]},{"as":"ingestion-rate","function":"quotient","args":[{"field":"total-imported-runs"},{"field":"total-runs"}]},{"as":"ingestion","function":"format-percent","args":[{"field":"ingestion-rate"}]},{"as":"encoded-campaign","function":"url-encode","args":[{"field":"campaign"}]},{"as":"campaign-dashboard-href","function":"concat","args":[{"value":"#page-campaign-insights?campaign="},{"field":"encoded-campaign"}]},{"as":"campaign-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"campaign-display-name"},{"value":" campaign dashboard"}]},{"as":"campaign-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"campaign-dashboard-href"},{"field":"campaign-dashboard-label"},{"field":"campaign"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-slug"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-slug"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-slug"}]},{"as":"workflow-identity","function":"concat","args":[{"field":"repository-slug"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-identity"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-display-name"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-identity"}]}],"select":[{"field":"campaign"},{"field":"campaign-display-name","as":"campaign-name"},{"field":"organization"},{"field":"repository-slug","as":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-identity","as":"workflow-label"},{"field":"declared-role","as":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"declared-registration","as":"workflow-active"},{"field":"total-aic","as":"aic"},{"field":"total-runs","as":"runs"},{"field":"total-successful-runs","as":"successful-runs"},{"field":"total-failed-runs","as":"failed-runs"},{"field":"aic-per-run"},{"field":"has-observed-runs"},{"field":"ingestion"},{"field":"campaign-dashboard-link","as":"campaign-link"},{"field":"repository-dashboard-link","as":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"repository-run-statistics","subject":"Reduce run counts, conclusions, and positive AI Credits before repository enrichment.","objective":"Share one row-local run aggregate between repository execution and cost summaries.","acceptance":"Keep organization/repository grain, distinct run IDs, existing failure and approval counts, and positive recorded AIC. Reduce before joins; missing evidence is not zero activity or free execution.","from":"runs","compute":[{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["organization","repository"],"values":[{"field":"run","as":"runs","reducer":"distinct-count"},{"field":"run-conclusion","as":"failed","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","timed-out"]}]}},{"field":"run-conclusion","as":"action-required","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","equals":"action-required"}]}},{"field":"run","as":"aic-runs","reducer":"count","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"aic-total","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}}]}},{"name":"repository-aic-totals","subject":"Summarize observed AI Credit usage by repository.","objective":"Provide repository-level retained AI Credit totals for comparing observed usage with run activity.","acceptance":"Sum only positive recorded aic-total by organization and repository; exclude zero and missing costs rather than treating them as free execution.","description":"Observed AI Credit totals for each repository.","from":"repository-run-statistics","filter":{"predicates":[{"field":"aic-runs","gte":1}]},"select":[{"field":"organization"},{"field":"repository"},{"field":"aic"}]},{"name":"maintenance-campaign-packages","subject":"Installed campaign packages with retained source coordinates and update evidence.","objective":"Show installed/current source revisions and gate update actions on exact retained provenance.","acceptance":"Return every package. Set campaign-update-action-visible only for update-available rows with a non-empty source; missing provenance stays visible and non-actionable.","from":"campaigns","compute":[{"as":"campaign-source-unavailable","function":"equals-any","args":[{"field":"campaign-source"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"campaign-action-state","function":"if","args":[{"field":"campaign-source-unavailable"},{"value":"unknown"},{"field":"campaign-update-state"}]},{"as":"campaign-update-action-visible","function":"equals-any","args":[{"field":"campaign-action-state"},{"value":"update-available"}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"campaign-description"},{"field":"campaign-icon"},{"field":"campaign-source"},{"field":"campaign-version"},{"field":"campaign-current-version"},{"field":"campaign-update-state"},{"field":"campaign-registration"},{"field":"campaign-update-action-visible"}],"order-by":[{"field":"campaign-name","direction":"asc"}]},{"name":"maintenance-standalone-workflows","subject":"Standalone workflows with retained upstream provenance and update evidence.","objective":"Represent source-managed and local workflows without synthetic campaign membership.","acceptance":"Retain exact coordinates and revisions for source-managed rows; keep local or incomplete rows visible and non-actionable with an explicit reason.","from":"workflows","filter":{"predicates":[{"field":"workflow-role","equals":"standalone"},{"field":"workflow-source-kind","in":["source-managed","local"]}]},"compute":[{"as":"workflow-source-installed-unavailable","function":"equals-any","args":[{"field":"workflow-source-version"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"workflow-source-latest-unavailable","function":"equals-any","args":[{"field":"workflow-source-current-version"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"workflow-is-local","function":"equals-any","args":[{"field":"workflow-source-kind"},{"value":"local"}]},{"as":"workflow-source-state","function":"if","args":[{"field":"workflow-is-local"},{"value":"local"},{"field":"workflow-source-update-state"}]},{"as":"workflow-source-update-available","function":"equals-any","args":[{"field":"workflow-source-state"},{"value":"update-available"}]},{"as":"workflow-source-update-unknown","function":"equals-any","args":[{"field":"workflow-source-state"},{"value":"unknown"}]},{"as":"workflow-update-state-known","function":"if","args":[{"field":"workflow-source-update-available"},{"value":"Update available"},{"value":"Current"}]},{"as":"workflow-update-state-with-unknown","function":"if","args":[{"field":"workflow-source-update-unknown"},{"value":"Update status unavailable"},{"field":"workflow-update-state-known"}]},{"as":"workflow-update-state","function":"if","args":[{"field":"workflow-is-local"},{"value":"Local workflow"},{"field":"workflow-update-state-with-unknown"}]},{"as":"workflow-update-reason-installed","function":"if","args":[{"field":"workflow-source-installed-unavailable"},{"value":"Installed source revision unavailable."},{"value":"Installed and upstream source revisions are available."}]},{"as":"workflow-update-reason-latest","function":"if","args":[{"field":"workflow-source-latest-unavailable"},{"value":"Latest upstream source revision unavailable."},{"field":"workflow-update-reason-installed"}]},{"as":"workflow-update-status-reason","function":"if","args":[{"field":"workflow-is-local"},{"value":"No upstream source coordinate was retained; update manually."},{"field":"workflow-update-reason-latest"}]},{"as":"workflow-update-action-visible","function":"equals-any","args":[{"field":"workflow-source-state"},{"value":"update-available"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-source-kind"},{"field":"workflow-source"},{"field":"workflow-source-version"},{"field":"workflow-source-current-version"},{"field":"workflow-source-update-state"},{"field":"workflow-update-state"},{"field":"workflow-update-status-reason"},{"field":"workflow-update-action-visible"}],"order-by":[{"field":"workflow-update-action-visible","direction":"desc"},{"field":"workflow-name","direction":"asc"}]},{"name":"maintenance-repository-versions","subject":"Group installed and current gh-aw compiler versions and upgrade evidence by repository.","objective":"Identify repositories with declared Markdown workflows whose retained compiler-version evidence warrants upgrade review.","acceptance":"Group Markdown workflow declarations by repository coordinate and return distinct known installed/current version lists, distinct counts, upgrade-required evidence, and separate missing-installed/missing-latest flags. Never infer unavailable versions.","from":"workflows","filter":{"predicates":[{"field":"workflow","includes":".md"}]},"compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"installed-version-unavailable","function":"equals-any","args":[{"field":"gh-aw-version"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"current-version-unavailable","function":"equals-any","args":[{"field":"gh-aw-current-version"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"known-installed-version","function":"if","args":[{"field":"installed-version-unavailable"},{"value":null},{"field":"gh-aw-version"}]},{"as":"known-current-version","function":"if","args":[{"field":"current-version-unavailable"},{"value":null},{"field":"gh-aw-current-version"}]},{"as":"installed-version-unavailable-value","function":"if","args":[{"field":"installed-version-unavailable"},{"value":1},{"value":0}]},{"as":"current-version-unavailable-value","function":"if","args":[{"field":"current-version-unavailable"},{"value":1},{"value":0}]},{"as":"compiler-versions-match","function":"equals-any","args":[{"field":"gh-aw-version"},{"field":"gh-aw-current-version"}]},{"as":"upgrade-candidate-value","function":"if","args":[{"field":"compiler-versions-match"},{"value":0},{"value":1}]},{"as":"upgrade-with-current-evidence","function":"if","args":[{"field":"current-version-unavailable"},{"value":0},{"field":"upgrade-candidate-value"}]},{"as":"upgrade-required-value","function":"if","args":[{"field":"installed-version-unavailable"},{"value":0},{"field":"upgrade-with-current-evidence"}]}],"aggregate":{"by":["repository-coordinate"],"values":[{"field":"known-installed-version","as":"gh-aw-version","reducer":"distinct-list"},{"field":"known-current-version","as":"gh-aw-current-version","reducer":"distinct-list"},{"field":"known-installed-version","as":"installed-version-count","reducer":"distinct-count"},{"field":"known-current-version","as":"current-version-count","reducer":"distinct-count"},{"field":"upgrade-required-value","as":"upgrade-required","reducer":"max"},{"field":"installed-version-unavailable-value","as":"installed-version-unavailable","reducer":"max"},{"field":"current-version-unavailable-value","as":"current-version-unavailable","reducer":"max"}]}},{"name":"maintenance-repositories","subject":"List each repository with recorded compiler versions and computed upgrade state.","objective":"Expose recorded compiler versions, computed upgrade state, and a concise evidence diagnostic per repository, with its GitHub home URL for inspection.","acceptance":"Return repository, repository-url, known version lists, upgrade-required, upgrade-state, upgrade-status-reason, and upgrade-action-visible. Show Upgrade only when known evidence establishes an outdated compiler; missing or conflicting evidence stays visible and non-actionable.","from":"maintenance-repository-versions","compute":[{"as":"repository-url","function":"concat","args":[{"value":"https://github.com/"},{"field":"repository-coordinate"}]},{"as":"should-upgrade","function":"equals-any","args":[{"field":"upgrade-required"},{"value":1}]},{"as":"installed-version-mixed","function":"greater-than","args":[{"field":"installed-version-count"},{"value":1}]},{"as":"current-version-conflicting","function":"greater-than","args":[{"field":"current-version-count"},{"value":1}]},{"as":"installed-version-missing","function":"equals-any","args":[{"field":"installed-version-unavailable"},{"value":1}]},{"as":"current-version-missing","function":"equals-any","args":[{"field":"current-version-unavailable"},{"value":1}]},{"as":"latest-version-evidence-unavailable","function":"if","args":[{"field":"current-version-missing"},{"value":true},{"field":"current-version-conflicting"}]},{"as":"upgrade-status-unavailable","function":"if","args":[{"field":"installed-version-missing"},{"value":true},{"field":"latest-version-evidence-unavailable"}]},{"as":"current-or-unavailable","function":"if","args":[{"field":"should-upgrade"},{"value":true},{"field":"upgrade-status-unavailable"}]},{"as":"upgrade-state-known","function":"if","args":[{"field":"should-upgrade"},{"value":"Upgrade recommended"},{"value":"Current"}]},{"as":"upgrade-state","function":"if","args":[{"field":"upgrade-status-unavailable"},{"value":"Upgrade status unavailable"},{"field":"upgrade-state-known"}]},{"as":"upgrade-reason-known","function":"if","args":[{"field":"should-upgrade"},{"value":"At least one retained workflow uses an older gh-aw compiler version."},{"value":"All retained workflow compiler versions match the latest stable gh-aw release."}]},{"as":"upgrade-reason-mixed","function":"if","args":[{"field":"installed-version-mixed"},{"value":"Mixed installed gh-aw compiler versions were retained; at least one upgrade is recommended."},{"field":"upgrade-reason-known"}]},{"as":"upgrade-reason-installed","function":"if","args":[{"field":"installed-version-missing"},{"value":"Installed gh-aw compiler version unavailable for one or more workflows."},{"field":"upgrade-reason-mixed"}]},{"as":"upgrade-reason-current","function":"if","args":[{"field":"current-version-missing"},{"value":"Latest stable gh-aw release unavailable."},{"field":"upgrade-reason-installed"}]},{"as":"both-compiler-versions-missing","function":"if","args":[{"field":"installed-version-missing"},{"field":"current-version-missing"},{"value":false}]},{"as":"upgrade-reason-both","function":"if","args":[{"field":"both-compiler-versions-missing"},{"value":"Installed compiler version and latest stable gh-aw release are unavailable."},{"field":"upgrade-reason-current"}]},{"as":"upgrade-status-reason","function":"if","args":[{"field":"current-version-conflicting"},{"value":"Conflicting latest gh-aw release evidence was retained."},{"field":"upgrade-reason-both"}]},{"as":"upgrade-action-visible","function":"if","args":[{"field":"upgrade-status-unavailable"},{"value":false},{"field":"should-upgrade"}]},{"as":"installed-version-available","function":"greater-than","args":[{"field":"installed-version-count"},{"value":0}]},{"as":"current-version-available","function":"greater-than","args":[{"field":"current-version-count"},{"value":0}]},{"as":"gh-aw-version-label","function":"if","args":[{"field":"installed-version-available"},{"field":"gh-aw-version"},{"value":"unknown"}]},{"as":"gh-aw-current-version-label","function":"if","args":[{"field":"current-version-available"},{"field":"gh-aw-current-version"},{"value":"unknown"}]}],"select":[{"field":"repository-coordinate","as":"repository"},{"field":"repository-url"},{"field":"gh-aw-version-label","as":"gh-aw-version"},{"field":"gh-aw-current-version-label","as":"gh-aw-current-version"},{"field":"upgrade-required"},{"field":"upgrade-action-visible"},{"field":"upgrade-state"},{"field":"upgrade-status-reason"}],"order-by":[{"field":"repository","direction":"asc"}]},{"name":"maintenance-campaign-updates","subject":"Expose at most one CAO package update row for the Updates navigation indicator.","objective":"Determine whether retained campaign metadata contains an update-available signal for the Updates indicator.","acceptance":"Return zero or one campaign-update-state row only when it equals update-available; an empty result means no matching retained signal, not that every campaign is current.","from":"maintenance-campaign-packages","filter":{"predicates":[{"field":"campaign-update-action-visible","equals":true}]},"select":[{"field":"campaign-update-action-visible"}],"limit":1},{"name":"maintenance-standalone-updates","subject":"Expose at most one standalone workflow source update row for the Updates navigation indicator.","objective":"Determine whether retained source-managed standalone workflow metadata contains an actionable update signal for the Updates indicator.","acceptance":"Return zero or one workflow-update-action-visible row only when it is true; unmanaged local workflows and incomplete source evidence do not activate the indicator.","from":"maintenance-standalone-workflows","filter":{"predicates":[{"field":"workflow-update-action-visible","equals":true}]},"select":[{"field":"workflow-update-action-visible"}],"limit":1},{"name":"maintenance-repository-upgrades","subject":"Expose at most one gh-aw compiler upgrade row for the Updates navigation indicator.","objective":"Determine whether repository compiler metadata contains an upgrade-required signal for the Updates indicator.","acceptance":"Return zero or one upgrade-action-visible row only when known retained evidence establishes an outdated compiler; missing evidence remains non-actionable and does not activate the indicator.","from":"maintenance-repositories","filter":{"predicates":[{"field":"upgrade-action-visible","equals":true}]},"select":[{"field":"upgrade-action-visible"}],"limit":1},{"name":"run-incomplete-outcomes","subject":"Project retained report-incomplete terminal outcomes as concise run diagnoses.","objective":"Find recorded report_incomplete terminal outcomes that can explain a specific run's incomplete reporting.","acceptance":"Include only runs with a recorded report_incomplete terminal outcome, preserving run-attempt identity, outcome kind, and recorded diagnosis; absence is not proof that reporting completed.","description":"One retained incomplete-evidence diagnosis per workflow Run when the agent explicitly reported that required evidence or access was unavailable.","from":"runs","filter":{"predicates":[{"field":"terminal-outcome","equals":"report_incomplete"}]},"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"terminal-outcome","as":"outcome-kind"},{"field":"terminal-outcome-detail","as":"outcome-diagnosis"}]},{"name":"campaign-runs","subject":"Project workflow runs with campaign attribution and retained failure evidence.","objective":"Connect retained run status and failure details to declared campaign/workflow identity for run-level diagnosis.","acceptance":"Expose run and attempt identity, declared attribution, runtime and target repositories, status, failure and incomplete-outcome evidence, timestamps, and drill-down links; do not infer an outcome from runtime success or missing details.","description":"Canonical workflow runs joined to their declared campaign and workflow identity.","from":"runs","joins":[{"source":"workflows","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"declared-campaign"},{"field":"campaign-name","as":"declared-campaign-name"},{"field":"workflow-name","as":"declared-workflow-name"},{"field":"workflow-role","as":"declared-workflow-role"},{"field":"workflow-link","as":"declared-workflow-link"}]},{"source":"run-incomplete-outcomes","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"outcome-kind","as":"outcome-kind"},{"field":"outcome-diagnosis","as":"outcome-diagnosis"}]}],"compute":[{"as":"status","function":"coalesce","args":[{"field":"run-conclusion"},{"field":"run-status"},{"value":"unknown"}]},{"as":"effective-outcome-kind","function":"coalesce","args":[{"field":"outcome-kind"},{"field":"terminal-outcome"},{"value":""}]},{"as":"is-incomplete-outcome","function":"equals-any","args":[{"field":"effective-outcome-kind"},{"value":"report_incomplete"}]},{"as":"diagnosis-kind","function":"if","args":[{"field":"is-incomplete-outcome"},{"value":"incomplete_evidence"},{"value":""}]},{"as":"error-signature","function":"coalesce","args":[{"field":"diagnosis-kind"},{"field":"failure-kind"},{"field":"classification"},{"field":"status"}]},{"as":"_error-signature-default-label","function":"title-case","args":[{"field":"error-signature"}]},{"as":"_is-driver-exit","function":"equals-any","args":[{"field":"error-signature"},{"value":"driver_exit"},{"value":"driver-exit"}]},{"as":"error-signature-label","function":"if","args":[{"field":"_is-driver-exit"},{"value":"Agent process exited unexpectedly"},{"field":"_error-signature-default-label"}]},{"as":"status-detail","function":"coalesce","args":[{"field":"outcome-diagnosis"},{"field":"terminal-outcome-detail"},{"field":"failure-detail"},{"field":"failure-message"},{"field":"failure-step"},{"field":"admission-reason"},{"value":""}]},{"as":"runtime-repository","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"is-worker","function":"equals-any","args":[{"field":"declared-workflow-role"},{"value":"worker"}]},{"as":"is-orchestrator","function":"equals-any","args":[{"field":"declared-workflow-role"},{"value":"orchestrator"}]},{"as":"root-dispatch-type","function":"if","args":[{"field":"is-orchestrator"},{"value":"Campaign orchestrator"},{"value":"Standalone workflow"}]},{"as":"dispatch-type","function":"if","args":[{"field":"is-worker"},{"value":"Campaign worker"},{"field":"root-dispatch-type"}]},{"as":"campaign-display-name","function":"coalesce","args":[{"field":"declared-campaign-name"},{"field":"declared-campaign"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"declared-workflow-name"},{"field":"workflow"}]},{"as":"encoded-campaign","function":"url-encode","args":[{"field":"declared-campaign"}]},{"as":"campaign-dashboard-href","function":"concat","args":[{"value":"#page-campaign-insights?campaign="},{"field":"encoded-campaign"}]},{"as":"campaign-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"campaign-display-name"},{"value":" campaign dashboard"}]},{"as":"campaign-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"campaign-dashboard-href"},{"field":"campaign-dashboard-label"},{"field":"declared-campaign"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"runtime-repository"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"runtime-repository"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"runtime-repository"}]},{"as":"workflow-identity","function":"concat","args":[{"field":"runtime-repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-identity"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-display-name"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-identity"}]}],"select":[{"field":"started-at"},{"field":"dispatch-type"},{"field":"declared-campaign","as":"campaign"},{"field":"declared-campaign-name","as":"campaign-name"},{"field":"declared-workflow-name","as":"workflow-name"},{"field":"run"},{"field":"run-attempt"},{"field":"run-title"},{"field":"event"},{"field":"runtime-repository"},{"field":"target-repository"},{"field":"rollout-mode"},{"field":"status"},{"field":"run-status"},{"field":"error-signature"},{"field":"error-signature-label"},{"field":"status-detail"},{"field":"outcome-kind"},{"field":"outcome-diagnosis"},{"field":"declared-workflow-role","as":"workflow-role"},{"field":"failure-job"},{"field":"failure-message"},{"field":"failure-step"},{"field":"failure-log"},{"field":"engine"},{"field":"engine-version"},{"field":"gh-aw-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"aic-total"},{"field":"safe-items-count"},{"field":"resource-reset-at","as":"status-detail-at"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"declared-workflow-link","as":"workflow-source-link"},{"field":"run-link"},{"field":"campaign-dashboard-link","as":"campaign-link"},{"field":"repository-dashboard-link","as":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"}],"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"campaign-runtime-health-runs","subject":"Project only the run and workflow fields required to classify current campaign runtime health.","objective":"Provide the retained run identity, timing, role, dispatch type, repository, and status needed to assess campaign runtime-health groups.","acceptance":"Project the selected fields from overview-runs without converting missing statuses or unattributed workflows into failures; unavailable run history leaves health assessment incomplete.","description":"A bounded runtime-health input that excludes audit outcomes and presentation-only campaign run fields.","from":"overview-runs","compute":[{"as":"status","function":"coalesce","args":[{"field":"run-conclusion"},{"field":"run-status"},{"value":"unknown"}]},{"as":"runtime-repository","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"is-worker","function":"equals-any","args":[{"field":"workflow-role"},{"value":"worker"}]},{"as":"is-orchestrator","function":"equals-any","args":[{"field":"workflow-role"},{"value":"orchestrator"}]},{"as":"root-dispatch-type","function":"if","args":[{"field":"is-orchestrator"},{"value":"Campaign orchestrator"},{"value":"Standalone workflow"}]},{"as":"dispatch-type","function":"if","args":[{"field":"is-worker"},{"value":"Campaign worker"},{"field":"root-dispatch-type"}]}],"select":[{"field":"started-at"},{"field":"campaign"},{"field":"campaign-name"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"dispatch-type"},{"field":"runtime-repository"},{"field":"run"},{"field":"run-status"},{"field":"status"}]},{"name":"campaign-runtime-health-groups","subject":"Compute each campaign workflow and runtime repository's latest consecutive failure streak in the selected horizon.","objective":"Locate campaign workflow/runtime-repository groups whose most recent retained completed runs have consecutive runtime failures.","acceptance":"Group completed runs by campaign, workflow, role, dispatch type, and runtime repository; failure-count is the latest retained failure streak, not a rate or a claim about runs outside the available horizon.","description":"Current retained failure streaks grouped by campaign workflow and runtime repository, considering only concluded Runs so an in-flight retry cannot mask an active failure streak.","from":"campaign-runtime-health-runs","filter":{"predicates":[{"field":"run-status","equals":"completed"}]},"compute":[{"as":"is-runtime-failure","function":"equals-any","args":[{"field":"status"},{"value":"failure"},{"value":"startup-failure"},{"value":"stale"},{"value":"timed-out"}]},{"as":"runtime-failure-streak-point","function":"failure-streak-point","args":[{"field":"started-at"},{"field":"run"},{"field":"is-runtime-failure"}]}],"aggregate":{"by":["campaign","campaign-name","workflow","workflow-name","workflow-role","dispatch-type","runtime-repository"],"values":[{"field":"runtime-failure-streak-point","as":"failure-count","reducer":"latest-failure-streak"}]}},{"name":"workflow-run-observation-counts","subject":"Count retained Runs for each workflow identity in the selected horizon.","objective":"Measure retained run presence by workflow identity to compare with active orchestrator declarations.","acceptance":"Count overview-runs by organization, repository, and workflow; a missing group indicates no retained matching run in the available horizon, not proof of no executions.","description":"One row per organization, repository, and workflow with retained Run counts, safe to join without row multiplication.","from":"overview-runs","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run","as":"observed-run-count","reducer":"count"}]}},{"name":"campaign-active-orchestrator-run-presence","subject":"Count retained Runs for each active campaign orchestrator in the selected horizon.","objective":"Compare active orchestrator declarations with retained run observations to identify missing visibility.","acceptance":"Keep only workflows declared active with orchestrator role and expose their identity, runtime repository, and observed-run-count; a zero joined count means no retained match, not necessarily a stopped schedule.","description":"Active campaign orchestrators annotated with retained Run presence.","from":"workflows","joins":[{"source":"workflow-run-observation-counts","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"observed-run-count","as":"joined-observed-run-count"}]}],"filter":{"predicates":[{"field":"workflow-role","equals":"orchestrator"},{"field":"workflow-active","equals":"true"}]},"compute":[{"as":"runtime-repository","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"observed-run-count","function":"coalesce","args":[{"field":"joined-observed-run-count"},{"value":0}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"runtime-repository"},{"field":"observed-run-count"}]},{"name":"campaign-unobserved-orchestrator-candidates","subject":"Mark active campaign orchestrators with no retained Runs in the selected horizon.","objective":"Mark active orchestrators lacking retained run evidence for bounded telemetry or schedule review.","acceptance":"Preserve active orchestrator identity and observed-run-count; is-unobserved marks zero retained matches and must not be interpreted as a runtime failure or evidence that dispatch was expected.","description":"Active orchestrators annotated with whether runtime evidence is absent.","from":"campaign-active-orchestrator-run-presence","compute":[{"as":"is-unobserved","function":"equals-any","args":[{"field":"observed-run-count"},{"value":0}]},{"as":"failure-count","function":"sum","args":[{"value":0},{"value":0}]},{"as":"dispatch-type","function":"coalesce","args":[{"value":"Campaign orchestrator"},{"value":"Campaign orchestrator"}]},{"as":"problem-kind","function":"coalesce","args":[{"value":"not-observed"},{"value":"not-observed"}]}]},{"name":"campaign-unobserved-orchestrators","subject":"Show active campaign orchestrators with no retained Runs in the selected horizon.","objective":"List active orchestrator declarations with no retained run observations for follow-up on evidence availability.","acceptance":"Return only is-unobserved candidates with their workflow and repository identity; an empty result does not certify run completeness or scheduler health.","description":"Active campaign orchestrators whose runtime state cannot be established from retained evidence.","from":"campaign-unobserved-orchestrator-candidates","filter":{"predicates":[{"field":"is-unobserved","equals":true}]}},{"name":"dispatches","subject":"Select workflow-dispatch runs from campaign-attributed workflow run evidence.","objective":"Inspect retained workflow_dispatch runs attributed to campaigns before comparing campaign dispatch activity.","acceptance":"Include only campaign-runs with event workflow_dispatch and preserve run, attempt, attribution, status, and time; absence does not establish that no dispatch occurred beyond retained evidence.","description":"Canonical workflow runs whose authoritative trigger is workflow_dispatch.","from":"campaign-runs","filter":{"predicates":[{"field":"event","equals":"workflow_dispatch"}]},"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"campaign-dispatch-inventory","subject":"Project retained dispatch identity and campaign attribution before campaign counting.","objective":"Count dispatches without materializing run diagnoses and presentation links.","acceptance":"Keep workflow_dispatch runs in timestamp order with declared campaign attribution; preserve workflow and incomplete-outcome join quality and duplicate-key failure behavior.","description":"Lean dispatch-count input; the incomplete-outcome join preserves the full campaign run source's evidence quality and fail-closed validation.","from":"runs","joins":[{"source":"workflows","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"declared-campaign"}]},{"source":"run-incomplete-outcomes","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"outcome-kind","as":"outcome-kind"}]}],"filter":{"predicates":[{"field":"event","equals":"workflow_dispatch"}]},"select":[{"field":"declared-campaign","as":"campaign"},{"field":"run"},{"field":"started-at"}],"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"campaign-dispatch-totals","subject":"Summarize observed workflow dispatches for each centrally managed campaign.","objective":"Compare retained workflow_dispatch run counts across attributed campaigns.","acceptance":"Count distinct run identifiers per campaign from dispatches; do not treat missing campaign attribution or unretained dispatches as zero actual activity.","description":"Observed workflow-dispatch run totals grouped by campaign.","from":"campaign-dispatch-inventory","aggregate":{"by":["campaign"],"values":[{"field":"run","as":"dispatches","reducer":"distinct-count"}]}},{"name":"campaign-workflow-totals","subject":"Summarize observed workflow and execution totals for each centrally managed campaign.","objective":"Compare declared orchestrator/worker composition, rollout registration, observed runs, and AI Credit usage by campaign.","acceptance":"Group only orchestrator and worker workflow-inventory rows by campaign; retain workflow count, distinct roles/modes/registration and summed observed runs and AIC, without inferring successful outcomes.","description":"Observed workflow, rollout, run, and AI Credit totals grouped by campaign.","from":"campaign-workflow-inventory","aggregate":{"by":["campaign"],"values":[{"field":"workflow","as":"workflows","reducer":"count"},{"field":"workflow-role","as":"roles","reducer":"distinct-list"},{"field":"rollout-mode","as":"modes","reducer":"distinct-list"},{"field":"workflow-active","as":"registration","reducer":"distinct-list"},{"field":"runs","as":"runs","reducer":"sum"},{"field":"aic","as":"aic","reducer":"sum"}]}},{"name":"campaign-repository-coverage","subject":"Count distinct registered target repositories reached by successful worker dispatches for each campaign.","objective":"Estimate observed campaign target reach from successful worker workflow_dispatch runs joined to registered repositories.","acceptance":"Count distinct matched target-repository values per campaign only for successful worker dispatches; this is observed reach, not verified target outcomes or complete fleet coverage.","description":"Campaign repository coverage derived from successful worker dispatch runs in the selected horizon.","from":"runs","joins":[{"source":"workflows","type":"inner","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"campaign"},{"field":"workflow-role","as":"workflow-role"}]},{"source":"repositories","type":"inner","on":[{"left":"target-repository","right":"repository-coordinate"}],"fields":[{"field":"repository-coordinate","as":"registered-target-repository"}]}],"filter":{"predicates":[{"field":"event","equals":"workflow_dispatch"},{"field":"run-conclusion","equals":"success"},{"field":"workflow-role","equals":"worker"}]},"aggregate":{"by":["campaign"],"values":[{"field":"target-repository","as":"covered-repositories","reducer":"distinct-count"}]}},{"name":"campaign-inventory-preview","subject":"Show declared campaigns before execution evidence is evaluated.","objective":"Expose campaign identities and navigation links while observed totals remain pending.","acceptance":"Preserve every declared campaign and its dashboard link without reporting missing execution totals as zero.","from":"campaigns","compute":[{"as":"encoded-campaign","function":"url-encode","args":[{"field":"campaign"}]},{"as":"campaign-dashboard-href","function":"concat","args":[{"value":"#page-campaign-insights?campaign="},{"field":"encoded-campaign"}]},{"as":"campaign-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"campaign-name"},{"value":" campaign dashboard"}]},{"as":"campaign-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"campaign-dashboard-href"},{"field":"campaign-dashboard-label"},{"field":"campaign"}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"campaign-dashboard-link"}],"order-by":[{"field":"campaign-name","direction":"asc"}]},{"name":"campaign-inventory","subject":"List centrally managed campaigns with their observed workflow and execution totals.","objective":"Compare declared campaigns with retained workflow composition, dispatches, target reach, runs, and AIC to choose an evidence-backed drill-down.","acceptance":"Keep declared campaigns with campaign identity and link plus joined totals; defaulted zero values mean no matching retained evidence and cannot certify no activity, complete coverage, or successful outcomes.","description":"Canonical campaign inventory enriched with observed workflow, rollout, run, repository coverage, and AI Credit totals.","from":"campaigns","joins":[{"source":"campaign-workflow-totals","type":"left","on":[{"left":"campaign","right":"campaign"}],"fields":[{"field":"workflows","as":"observed-workflows"},{"field":"roles","as":"observed-roles"},{"field":"modes","as":"observed-modes"},{"field":"registration","as":"observed-registration"},{"field":"runs","as":"observed-runs"},{"field":"aic","as":"observed-aic"}]},{"source":"campaign-dispatch-totals","type":"left","on":[{"left":"campaign","right":"campaign"}],"fields":[{"field":"dispatches","as":"observed-dispatches"}]},{"source":"campaign-repository-coverage","type":"left","on":[{"left":"campaign","right":"campaign"}],"fields":[{"field":"covered-repositories","as":"observed-covered-repositories"}]}],"compute":[{"as":"workflows","function":"coalesce","args":[{"field":"observed-workflows"},{"value":0}]},{"as":"roles","function":"coalesce","args":[{"field":"observed-roles"},{"value":""}]},{"as":"modes","function":"coalesce","args":[{"field":"observed-modes"},{"field":"campaign-mode"}]},{"as":"registration","function":"coalesce","args":[{"field":"observed-registration"},{"field":"campaign-registration"}]},{"as":"runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"dispatches","function":"coalesce","args":[{"field":"observed-dispatches"},{"value":0}]},{"as":"covered-repositories","function":"coalesce","args":[{"field":"observed-covered-repositories"},{"value":0}]},{"as":"aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]},{"as":"encoded-campaign","function":"url-encode","args":[{"field":"campaign"}]},{"as":"campaign-dashboard-href","function":"concat","args":[{"value":"#page-campaign-insights?campaign="},{"field":"encoded-campaign"}]},{"as":"campaign-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"campaign-name"},{"value":" campaign dashboard"}]},{"as":"campaign-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"campaign-dashboard-href"},{"field":"campaign-dashboard-label"},{"field":"campaign"}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"campaign-dashboard-link"},{"field":"workflows"},{"field":"roles"},{"field":"modes"},{"field":"registration"},{"field":"runs"},{"field":"dispatches"},{"field":"covered-repositories"},{"field":"aic"}],"order-by":[{"field":"campaign-name","direction":"asc"}]},{"name":"firewall-domain-totals","subject":"Show each observed firewall domain with the number of runs and total accepted and blocked requests.","objective":"Identify domains with observed denied requests for a closer review of firewall evidence.","acceptance":"Report distinct observed runs and native accepted and blocked request totals by domain; a denied request alone does not justify allowing egress, and no row does not prove no requests occurred.","description":"Distinct runs and accepted and blocked request totals by firewall domain.","from":"firewall-observations","filter":{"predicates":[{"field":"decision","in":["allowed","denied"]}]},"aggregate":{"by":["domain"],"values":[{"field":"run","as":"run","reducer":"distinct-count"},{"field":"request-count","as":"accepted","reducer":"sum","filter":{"predicates":[{"field":"decision","equals":"allowed"}]}},{"field":"request-count","as":"blocked","reducer":"sum","filter":{"predicates":[{"field":"decision","equals":"denied"}]}}]},"order-by":[{"field":"blocked","direction":"desc"},{"field":"accepted","direction":"desc"},{"field":"domain","direction":"asc"}]},{"name":"firewall-most-blocked-domains","subject":"Highlight the domains with the most blocked firewall requests.","objective":"Prioritize up to ten observed domains by blocked request total for investigation.","acceptance":"Rank by observed blocked totals and inspect underlying domain/workflow evidence before deciding whether a block needs attention; the ranking is not a policy authorization or an incidence rate.","description":"The ten domains with the highest observed blocked request totals.","from":"firewall-domain-totals","order-by":[{"field":"blocked","direction":"desc"},{"field":"domain","direction":"asc"}],"limit":10},{"name":"firewall-domain-workflows","subject":"Show workflows that allowed or blocked requests to each observed firewall domain.","objective":"Locate which observed workflows contributed accepted or denied requests for a domain.","acceptance":"Preserve workflow scope, source link, distinct runs, and native accepted and blocked totals; investigate the run and egress context rather than assuming a denied request is a failure or grounds for wider access.","description":"Workflow-level accepted and blocked request totals by firewall domain.","from":"firewall-observations","filter":{"predicates":[{"field":"decision","in":["allowed","denied"]}]},"compute":[{"as":"workflow-source-url","function":"link-href","args":[{"field":"workflow-link"}]}],"aggregate":{"by":["domain","organization","repository","workflow","workflow-source-url"],"values":[{"field":"run","as":"runs","reducer":"distinct-count"},{"field":"request-count","as":"accepted","reducer":"sum","filter":{"predicates":[{"field":"decision","equals":"allowed"}]}},{"field":"request-count","as":"blocked","reducer":"sum","filter":{"predicates":[{"field":"decision","equals":"denied"}]}}]},"order-by":[{"field":"blocked","direction":"desc"},{"field":"accepted","direction":"desc"},{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"mcp-tool-totals","subject":"Group observed MCP activity by tool and count calls and calling workflows, excluding the internal safe outputs server.","objective":"Expose tool-level call, workflow, and byte totals to investigate observed MCP usage.","acceptance":"Group only observed non-safe-output-server calls by server and tool, preserving counts and byte totals; lack of calls does not establish no access, and call volume does not establish value or permission.","description":"Observed MCP tool-call totals grouped by MCP server and tool, with the number of distinct calling workflows.","from":"mcp-tool-workflow-totals","filter":{"predicates":[{"field":"safe-output-server","equals":false}]},"aggregate":{"by":["mcp-tool-label","mcp-server","mcp-tool"],"values":[{"field":"calls","as":"calls","reducer":"sum"},{"field":"workflow-key","as":"workflows","reducer":"distinct-count"},{"field":"request-bytes","as":"request-bytes","reducer":"sum"},{"field":"response-bytes","as":"response-bytes","reducer":"sum"}]},"select":[{"field":"mcp-tool-label"},{"field":"mcp-tool"},{"field":"mcp-server"},{"field":"calls"},{"field":"workflows"},{"field":"request-bytes"},{"field":"response-bytes"}],"order-by":[{"field":"calls","direction":"desc"},{"field":"mcp-tool-label","direction":"asc"}]},{"name":"mcp-top-tools","subject":"Show the ten most frequently called MCP tools.","objective":"Identify up to ten tools with the highest observed non-safe-output-server call counts for inspection.","acceptance":"Rank observed calls by tool label and inspect grouped tool evidence before drawing conclusions; do not treat popularity as effectiveness or authority to add tools.","description":"The ten MCP tools with the most observed calls, excluding the internal safe outputs server.","from":"mcp-tool-totals","order-by":[{"field":"calls","direction":"desc"},{"field":"mcp-tool-label","direction":"asc"}],"limit":10},{"name":"steering-events","subject":"Prepare observed gateway steering warnings for aggregation by steering type and workflow.","objective":"Expose warning identity, run context, type, and timestamp for downstream steering diagnostics.","acceptance":"Project recorded gateway steering events with workflow and run attribution where available; a warning is not a completed budget overrun, failure, or reason to increase limits.","description":"Gateway steering warnings emitted when a run approaches its AI Credit budget, time limit, or another declared limit, labelled with a readable steering type.","from":"audits","filter":{"predicates":[{"field":"event-type","equals":"firewall.steering"}]},"joins":[{"source":"workflows","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"campaign"},{"field":"workflow-name","as":"workflow-name"}]}],"compute":[{"as":"steering-code","function":"coalesce","args":[{"field":"code"},{"field":"event-status"},{"value":"unknown"}]},{"as":"_token-steering","function":"equals-any","args":[{"field":"steering-code"},{"value":"token_steering"}]},{"as":"_timeout-steering","function":"equals-any","args":[{"field":"steering-code"},{"value":"timeout_steering"}]},{"as":"_turn-steering","function":"equals-any","args":[{"field":"steering-code"},{"value":"turn_steering"},{"value":"max_turns_steering"}]},{"as":"_turn-steering-type","function":"if","args":[{"field":"_turn-steering"},{"value":"Running out of turns"},{"field":"steering-code"}]},{"as":"_timeout-steering-type","function":"if","args":[{"field":"_timeout-steering"},{"value":"Running out of time"},{"field":"_turn-steering-type"}]},{"as":"steering-type","function":"if","args":[{"field":"_token-steering"},{"value":"Running out of tokens"},{"field":"_timeout-steering-type"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"workflow-label","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow-coordinate"}]}],"select":[{"field":"id"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-coordinate"},{"field":"workflow-label"},{"field":"campaign"},{"field":"run"},{"field":"run-link"},{"field":"steering-code"},{"field":"steering-type"},{"field":"event-summary"},{"field":"observed-at"}]},{"name":"steering-type-totals","subject":"Show how often each kind of steering warning occurred.","objective":"Identify steering warning categories to inspect in their run context.","acceptance":"Report observed event totals and distinct runs and workflows by type; confirm underlying warnings before interpreting frequency, and do not infer actual limit breaches.","description":"Observed gateway steering warnings grouped by steering type with the number of affected runs and workflows.","from":"steering-events","aggregate":{"by":["steering-type","steering-code"],"values":[{"field":"id","as":"events","reducer":"count"},{"field":"run","as":"runs","reducer":"distinct-count"},{"field":"workflow-coordinate","as":"workflows","reducer":"distinct-count"}]},"select":[{"field":"steering-type"},{"field":"steering-code"},{"field":"events"},{"field":"runs"},{"field":"workflows"}],"order-by":[{"field":"events","direction":"desc"},{"field":"steering-type","direction":"asc"}]},{"name":"steering-workflow-totals","subject":"Count steering warnings for each workflow.","objective":"Expose workflow-level warning totals and token/time warning breakdowns for downstream review.","acceptance":"Count recorded events and distinct runs by workflow, retaining the declared token/time categories; other types remain in total events and no warning alone establishes a failure.","description":"Gateway steering warnings grouped by workflow, split into token-budget and time-limit warnings.","from":"steering-events","aggregate":{"by":["workflow-coordinate","organization","repository","workflow","workflow-label","campaign"],"values":[{"field":"id","as":"events","reducer":"count"},{"field":"run","as":"runs","reducer":"distinct-count"},{"field":"id","as":"token-events","reducer":"count","filter":{"predicates":[{"field":"steering-code","equals":"token_steering"}]}},{"field":"id","as":"time-events","reducer":"count","filter":{"predicates":[{"field":"steering-code","equals":"timeout_steering"}]}},{"field":"steering-type","as":"steering-types","reducer":"distinct-count"}]},"order-by":[{"field":"events","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}]},{"name":"steering-workflows","subject":"Present workflow steering totals with a link to each workflow dashboard.","objective":"Show observed workflow steering totals with navigation to the affected run context.","acceptance":"Keep workflow identity, link, events, runs, and warning breakdowns tied to their grouped evidence; use drill-through before recommending changes, not warning counts as a basis to widen budgets.","description":"Workflow steering totals labelled with a link to the workflow runtime page.","from":"steering-workflow-totals","compute":[{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-label"}]}],"select":[{"field":"workflow-coordinate"},{"field":"workflow-label"},{"field":"workflow-dashboard-link"},{"field":"organization"},{"field":"repository"},{"field":"campaign"},{"field":"events"},{"field":"runs"},{"field":"token-events"},{"field":"time-events"},{"field":"steering-types"}],"order-by":[{"field":"events","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}]},{"name":"steering-top-workflows","subject":"Highlight the workflows with the most steering warnings.","objective":"Prioritize up to ten workflows by observed warning count for investigation.","acceptance":"Rank recorded warning totals with workflow context, checking underlying events and telemetry coverage; a high rank neither proves overrun nor justifies a limit change.","description":"The ten workflows with the highest observed gateway steering warning totals.","from":"steering-workflows","order-by":[{"field":"events","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}],"limit":10},{"name":"entity-workflow-run-totals","subject":"Summarize run outcomes and AI Credit consumption for reusable workflow cards.","objective":"Compare retained run-attempt activity, recorded conclusions, and AI Credit usage per workflow card.","acceptance":"Group by organization, repository, and workflow; expose distinct run-attempt count, success/failure conclusion counts, and sum of recorded AIC, without treating missing run history as zero actual activity.","from":"runs","compute":[{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run-attempt-identity","as":"runs","reducer":"distinct-count"},{"field":"run-attempt-identity","as":"aic-runs","reducer":"distinct-count","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"run-conclusion","as":"successful-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","equals":"success"}]}},{"field":"run-conclusion","as":"failed-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","stale","timed-out"]}]}},{"field":"aic-total","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}}]}},{"name":"entity-workflows","subject":"Project workflow entities for reusable workflow cards and repository drill-down.","objective":"Relate declared workflows to observed run and AIC totals for workflow-level drill-down.","acceptance":"Keep declared workflow identity, role, registration, campaign, link, and joined totals; a missing run match defaults to displayed zeros but does not establish no executions or outcomes.","from":"workflows","joins":[{"source":"entity-workflow-run-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"successful-runs","as":"observed-successful-runs"},{"field":"failed-runs","as":"observed-failed-runs"},{"field":"aic","as":"observed-aic"},{"field":"aic-runs","as":"observed-aic-runs"}]}],"compute":[{"as":"runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"successful-runs","function":"coalesce","args":[{"field":"observed-successful-runs"},{"value":0}]},{"as":"failed-runs","function":"coalesce","args":[{"field":"observed-failed-runs"},{"value":0}]},{"as":"aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]},{"as":"aic-per-run","function":"quotient","args":[{"field":"aic"},{"field":"observed-aic-runs"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"workflow-active"},{"field":"campaign-name"},{"field":"observed-at"},{"field":"runs"},{"field":"successful-runs"},{"field":"failed-runs"},{"field":"aic-per-run"},{"field":"workflow-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"repository-runs","subject":"Project canonical runs into repository-addressable run evidence.","objective":"Expose retained run chronology and status for a selected repository's drill-down.","acceptance":"Retain repository coordinate, workflow, run identity, title, event, start time, conclusion, mode, AIC, and run link; absent details or runs do not establish a healthy or idle repository.","description":"Workflow runs with a stable repository route key.","from":"runs","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]}],"select":[{"field":"repository-coordinate"},{"field":"workflow"},{"field":"run"},{"field":"run-title"},{"field":"event"},{"field":"started-at"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"rollout-mode"},{"field":"aic-total"},{"field":"run-link"}],"order-by":[{"field":"started-at","direction":"desc"},{"field":"run","direction":"desc"}]},{"name":"repository-workflow-totals","subject":"Summarize declared and disabled workflow counts by repository.","objective":"Compare declared and disabled workflow counts for each repository in the retained workflow inventory.","acceptance":"Count declared workflows and workflow-active=false entries by organization and repository; missing declarations must not be interpreted as a complete zero-workflow inventory.","description":"Declared and disabled workflow totals for each repository.","from":"workflows","aggregate":{"by":["organization","repository"],"values":[{"field":"workflow","as":"workflows","reducer":"count"},{"field":"workflow","as":"disabled","reducer":"count","filter":{"predicates":[{"field":"workflow-active","equals":"false"}]}}]}},{"name":"repository-report-totals","subject":"Summarize published outcome report counts by repository.","objective":"Show retained outcome-report volume per repository for comparison with observed execution.","acceptance":"Count retained outcome rows by organization and repository; a missing aggregate does not prove no reports were published or that reported outcomes succeeded.","description":"Published report totals for each repository.","from":"outcomes","aggregate":{"by":["organization","repository"],"values":[{"field":"repository","as":"reports","reducer":"count"}]}},{"name":"repository-run-identities","subject":"Project the run-attempt identities needed to match imported evidence.","objective":"Keep import-coverage joins narrow without carrying run details, links, or costs.","acceptance":"Preserve each selected run attempt and its organization, repository, workflow, run, and attempt keys. Do not deduplicate attempts or change selected-horizon semantics.","from":"runs","select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"}]},{"name":"repository-import-totals","subject":"Count selected run attempts with matching retained imported records.","objective":"Join compact run identities to already reduced event evidence, then reduce import coverage by repository.","acceptance":"Match all five run-attempt keys and count each selected run row once when events are positive. Preserve optional-evidence quality and horizon filters; records for unselected runs do not establish coverage.","from":"repository-run-identities","joins":[{"source":"event-runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"events","as":"imported-events"}]}],"compute":[{"as":"imported","function":"greater-than","args":[{"field":"imported-events"},{"value":0}]}],"aggregate":{"by":["organization","repository"],"values":[{"field":"imported","as":"imported-runs","reducer":"sum"}]}},{"name":"repository-run-totals","subject":"Summarize distinct runs, failures, and approval-required runs by repository.","objective":"Join already reduced run statistics and import coverage at repository grain.","acceptance":"Group by organization and repository; preserve distinct run IDs, configured failure/action-required conclusion counts, and imported-run sums. Missing enrichment or run history must not be treated as complete coverage.","description":"Distinct run and conclusion totals for each repository.","from":"repository-run-statistics","joins":[{"source":"repository-import-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"imported-runs","as":"imported-runs"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"runs"},{"field":"failed"},{"field":"action-required"},{"field":"imported-runs"}]},{"name":"repository-activity-preview","subject":"List repository identities before execution metrics are computed.","objective":"Show retained repository identities and drill links while activity metrics are pending.","acceptance":"List repositories by organization with repository drill links; this preview does not establish activity totals or outcomes.","description":"Fast repository inventory with drill links; activity fields remain pending.","from":"repositories","compute":[{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-slug"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-slug"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-slug"}]}],"select":[{"field":"organization"},{"field":"repository-slug","as":"repository"},{"field":"repository-dashboard-link","as":"repository-link"}],"order-by":[{"field":"repository","direction":"asc"}]},{"name":"repository-activity-core","subject":"Join each repository with its workflow, report, and run totals.","objective":"Attach retained workflow, report, and run aggregates to each repository for bounded inventory review.","acceptance":"Preserve each repository and the available joined aggregates by organization and repository; unmatched metrics remain missing evidence, not confirmed zero activity or evaluated outcomes.","description":"Repository inventory joined with workflow, report, evaluation, and run totals.","from":"repositories","joins":[{"source":"repository-workflow-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"workflows","as":"observed-workflows"},{"field":"disabled","as":"observed-disabled"}]},{"source":"repository-report-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"reports","as":"observed-reports"}]},{"source":"repository-run-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"failed","as":"observed-failed"},{"field":"action-required","as":"observed-action-required"},{"field":"imported-runs","as":"observed-imported-runs"}]}]},{"name":"repository-activity","subject":"Show repository-level execution health, outcome activity, and AI Credit usage in an actionable inventory.","objective":"Prioritize repository drill-down using declared workflows, observed runs, reports, failures, import coverage, and AIC.","acceptance":"Return repository identity and link with retained counts, ingestion indicator, failure summary, AIC, and computed status; statuses describe retained evidence only, and an empty or unavailable preview cannot verify health, outcomes, or zero activity.","description":"Repository-local execution health and attributed outcome totals.","from":"repository-activity-core","joins":[{"source":"repository-aic-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"aic","as":"observed-aic"}]}],"compute":[{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflows","function":"coalesce","args":[{"field":"observed-workflows"},{"value":0}]},{"as":"disabled","function":"coalesce","args":[{"field":"observed-disabled"},{"value":0}]},{"as":"runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"failed","function":"coalesce","args":[{"field":"observed-failed"},{"value":0}]},{"as":"imported-runs","function":"coalesce","args":[{"field":"observed-imported-runs"},{"value":0}]},{"as":"ingestion-rate","function":"quotient","args":[{"field":"imported-runs"},{"field":"runs"}]},{"as":"ingestion","function":"format-percent","args":[{"field":"ingestion-rate"}]},{"as":"action-required","function":"coalesce","args":[{"field":"observed-action-required"},{"value":0}]},{"as":"aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]},{"as":"has-failures","function":"greater-than","args":[{"field":"failed"},{"value":0}]},{"as":"has-action-required","function":"greater-than","args":[{"field":"action-required"},{"value":0}]},{"as":"has-runs","function":"greater-than","args":[{"field":"runs"},{"value":0}]},{"as":"has-disabled","function":"greater-than","args":[{"field":"disabled"},{"value":0}]},{"as":"outcomes-observed","function":"coalesce","args":[{"field":"observed-reports"},{"value":0}]},{"as":"has-outcomes","function":"greater-than","args":[{"field":"outcomes-observed"},{"value":0}]},{"as":"failure-rate","function":"quotient","args":[{"field":"failed"},{"field":"runs"}]},{"as":"failure-percent","function":"format-percent","args":[{"field":"failure-rate"}]},{"as":"failure-count","function":"format-count","args":[{"field":"failed"}]},{"as":"observed-failure-summary","function":"concat","args":[{"field":"failure-percent"},{"value":" · "},{"field":"failure-count"},{"value":" failed"}]},{"as":"failure-summary","function":"if","args":[{"field":"has-runs"},{"field":"observed-failure-summary"},{"value":"—"}]},{"as":"outcome-status","function":"if","args":[{"field":"has-outcomes"},{"value":"Outcomes observed"},{"value":"No recent activity"}]},{"as":"disabled-status","function":"if","args":[{"field":"has-disabled"},{"value":"Disabled workflows"},{"field":"outcome-status"}]},{"as":"run-status","function":"if","args":[{"field":"has-runs"},{"value":"No failures observed"},{"field":"disabled-status"}]},{"as":"action-status","function":"if","args":[{"field":"has-action-required"},{"value":"Approval required"},{"field":"run-status"}]},{"as":"status","function":"if","args":[{"field":"has-failures"},{"value":"Needs attention"},{"field":"action-status"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-slug"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-slug"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-slug"}]}],"select":[{"field":"organization"},{"field":"repository","as":"repository-name"},{"field":"repository-slug","as":"repository"},{"field":"workflows"},{"field":"observed-reports","as":"reports"},{"field":"runs"},{"field":"ingestion"},{"field":"failure-summary"},{"field":"aic"},{"field":"status"},{"field":"repository-dashboard-link","as":"repository-link"},{"field":"failed"}],"order-by":[{"field":"failed","direction":"desc"},{"field":"runs","direction":"desc"},{"field":"repository","direction":"asc"}]},{"name":"repository-daily-run-buckets","subject":"Select repository run counts by whole UTC start-day buckets.","objective":"Keep count selection independent of retained Run detail.","acceptance":"Use UTC midnight and request bounds, matching the Runs daily chart; do not fabricate sub-day totals or missing days.","from":"daily-run-counts","compute":[{"as":"day-midnight","function":"concat","args":[{"field":"day"},{"value":"T00:00:00Z"}]},{"as":"day-ms","function":"timestamp","args":[{"field":"day-midnight"}]},{"as":"start-ms","function":"timestamp","args":[{"context":"time-start"}]},{"as":"end-ms","function":"timestamp","args":[{"context":"time-end"}]},{"as":"before-start","function":"greater-than","args":[{"field":"start-ms"},{"field":"day-ms"}]},{"as":"before-end","function":"greater-than","args":[{"field":"end-ms"},{"field":"day-ms"}]}]},{"name":"repository-observed-run-counts","subject":"Count observed logical Runs by repository from persistent daily buckets.","objective":"Supply the run-volume chart without computing activity health, ingestion coverage, or workflow costs.","acceptance":"Sum daily totals, not attempts or retained detail. Select whole UTC start-day buckets by midnight and preserve partial or unavailable coverage.","from":"repository-daily-run-buckets","filter":{"predicates":[{"field":"before-start","in":[false,null]},{"field":"before-end","in":[true,null]}]},"compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]}],"aggregate":{"by":["organization","repository-coordinate"],"values":[{"field":"total","as":"runs","reducer":"sum"}]}},{"name":"repository-run-inventory","subject":"Registered repositories and observed daily logical Run counts.","objective":"Compare repository execution volume and choose repositories for drill-down.","acceptance":"Keep top 100 identities and drill links with stable count and repository ordering. Zero means no admitted dated Runs in selected UTC buckets, not inactivity. Preserve partial coverage; unavailable daily evidence must not produce zeros. Table keeps full inventory.","from":"repository-activity-preview","joins":[{"source":"repository-observed-run-counts","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository-coordinate"}],"fields":[{"field":"runs","as":"observed-runs"}]}],"compute":[{"as":"runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"runs"},{"field":"repository-link"}],"order-by":[{"field":"runs","direction":"desc"},{"field":"repository","direction":"asc"}],"limit":100},{"name":"workflow-route-record","subject":"Project the selected workflow's identity and registration for its route shell.","objective":"Identify the workflow and its recorded campaign registration before inspecting route-specific evidence.","acceptance":"Preserve organization, repository, workflow identity, recorded role, activation, campaign, rollout mode, and source link; absent registration is not inferred from runs, and displayed activation does not grant execution authority.","from":"workflows","select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"workflow-active"},{"field":"campaign"},{"field":"campaign-name"},{"field":"rollout-mode"},{"field":"workflow-link"}]},{"name":"workflow-runtime-health-summary","subject":"Sum daily runtime conclusion counts for the selected workflow.","objective":"Inspect observed dated runs independently of retained detail.","acceptance":"Sum by organization/repository/workflow without adding detail; successful, failed, approval, pending, and other sum to total. Dates use UTC run start; undated evidence is incomplete and missing projection is unavailable. Pending is last-observed state, success is not a verified outcome, and sub-day filters are unsupported.","from":"daily-run-counts","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"total","as":"total","reducer":"sum"},{"field":"successful","as":"successful","reducer":"sum"},{"field":"failed","as":"failed","reducer":"sum"},{"field":"approval","as":"approval","reducer":"sum"},{"field":"pending","as":"pending","reducer":"sum"},{"field":"other","as":"other","reducer":"sum"}]}},{"name":"workflow-runtime-usage-summary","subject":"Sum retained AI Credits and count telemetry rows for the selected workflow without transferring runs.","objective":"Inspect a workflow's observed AI Credit consumption together with the amount of retained usage telemetry.","acceptance":"AI Credits sum the retained aic values within each organization, repository, and workflow, and telemetry-count counts its usage records; absent telemetry does not establish zero cost or complete run coverage.","from":"usage","compute":[{"as":"positive-aic","function":"greater-than","args":[{"field":"aic"},{"value":0}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"aic","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"run","as":"telemetry-count","reducer":"count"}]}},{"name":"outcome-route-record","subject":"Project the selected safe-output record for the outcome route and its sections.","objective":"Inspect a retained safe output's recorded disposition and follow its durable evidence links.","acceptance":"Preserve safe-output and run identity, title, category, disposition, summary, timestamps, rollout mode, workflow context, and retained links; missing fields stay unknown and a recorded disposition is not independently verified operational impact.","from":"outcomes","select":[{"field":"safe-output"},{"field":"run"},{"field":"outcome-title"},{"field":"outcome-number"},{"field":"outcome-category"},{"field":"outcome-status"},{"field":"outcome-state"},{"field":"outcome-summary"},{"field":"published-at"},{"field":"observed-at"},{"field":"rollout-mode"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-link"},{"field":"external-link"},{"field":"issue-link"},{"field":"pull-request-link"},{"field":"run-link"}]},{"name":"entity-runs","subject":"Project run entities for reusable run cards and workflow drill-down.","objective":"Expose retained run-attempt identity, execution timing, conclusion, and link for a bounded workflow-run inspection.","acceptance":"Keep organization, repository, workflow, run and attempt with status, conclusion, event, branch, duration, timestamps, and run link; missing timing or conclusion remains unknown rather than inferred success.","from":"runs","select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"target-repository"},{"field":"run"},{"field":"run-attempt"},{"field":"run-title"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"event"},{"field":"branch"},{"field":"duration"},{"field":"started-at"},{"field":"ended-at"},{"field":"run-link"}],"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"workflow-runs","subject":"Project canonical runs into route-addressable workflow run evidence.","objective":"Trace retained runs and recorded failure evidence for a selected workflow route.","acceptance":"Preserve workflow route, run identity, start/end, status, conclusion, failure fields, mode, engine/model metadata, and run link; missing failure details do not prove success or rule out incomplete import.","description":"Workflow runs with a stable repository and workflow route key.","from":"runs","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-route","function":"concat","args":[{"field":"repository-coordinate"},{"value":":"},{"field":"workflow"}]}],"select":[{"field":"workflow-route"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-title"},{"field":"event"},{"field":"started-at"},{"field":"ended-at"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"failure-job"},{"field":"failure-message"},{"field":"failure-step"},{"field":"failure-log"},{"field":"rollout-mode"},{"field":"engine"},{"field":"engine-version"},{"field":"gh-aw-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"run-link"}],"order-by":[{"field":"started-at","direction":"desc"},{"field":"run","direction":"desc"}]},{"name":"workflow-failure-trend","subject":"Show recent failure counts and their change for each workflow.","objective":"Spot a change in observed workflow failure activity without treating unknown conclusions as failures.","acceptance":"Each observed failure counts once within its own workflow; the first change is undefined and the seven-observation window is not a seven-day calendar interval.","from":"workflow-runs","compute":[{"as":"is-failure","function":"equals-any","args":[{"field":"run-conclusion"},{"value":"failure"},{"value":"timed_out"}]},{"as":"failure-count","function":"if","args":[{"field":"is-failure"},{"value":1},{"value":0}]}],"window":[{"operation":"rolling","field":"failure-count","as":"recent-failure-count","frame":7,"reducer":"sum","order-by":[{"field":"started-at","direction":"asc"},{"field":"run","direction":"asc"}],"groupby":["workflow-route"]},{"operation":"change","field":"recent-failure-count","as":"failure-count-change","mode":"absolute","order-by":[{"field":"started-at","direction":"asc"},{"field":"run","direction":"asc"}],"groupby":["workflow-route"]}]},{"name":"workflow-reports","subject":"Project retained outcomes into route-addressable workflow reports.","objective":"Review retained workflow outcome reports separately from execution status before interpreting operational results.","acceptance":"Keep route, safe output, report title and summary, recorded status, category, observation time, metadata, and external link; missing reports or status do not imply success or no work.","description":"Workflow outcome reports with stable route keys and disposition fields.","from":"outcomes","compute":[{"as":"report-repository","function":"coalesce","args":[{"field":"runtime-repository"},{"field":"repository"}]},{"as":"workflow-route","function":"concat","args":[{"field":"report-repository"},{"value":":"},{"field":"workflow"}]},{"as":"report-status","function":"coalesce","args":[{"field":"outcome-status"},{"field":"outcome-state"},{"value":"unknown"}]}],"select":[{"field":"workflow-route"},{"field":"safe-output"},{"field":"outcome-title"},{"field":"outcome-summary"},{"field":"report-status","as":"outcome-status"},{"field":"rollout-mode"},{"field":"engine"},{"field":"engine-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"outcome-category"},{"field":"observed-at"},{"field":"external-link"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"outcome-title","direction":"asc"}]},{"name":"value-measurement-facts","subject":"Original native primary and diagnostic observations from reviewed batch evaluators.","objective":"Keep periods, native units, evaluator identity and missingness inspectable without inventing delivery events.","acceptance":"Null is unavailable, not zero. Interval measurements are not snapshots or cumulative accepted contributions.","from":"workflow-value-measurements","time":{"range":"all"},"compute":[{"as":"measurement-marker","function":"literal","args":[{"value":1}]},{"as":"measurement-missing","function":"equals-any","args":[{"field":"value"},{"value":null}]},{"as":"known-measurement","function":"concat","args":[{"field":"value"},{"value":" "},{"field":"metric-unit"}]},{"as":"measurement-label","function":"if","args":[{"field":"measurement-missing"},{"value":"Not measured"},{"field":"known-measurement"}]},{"as":"measurement-context","function":"concat","args":[{"field":"repository"},{"value":" · "},{"field":"workflow-name"}]}]},{"name":"value-measurement-order","subject":"Latest assessment of each workflow measure, including unavailable assessments.","objective":"Do not let an older numeric value hide a newer incomplete period.","acceptance":"Choose latest cutoff and assessment before considering value or coverage; preserve evaluator digest.","from":"value-measurement-facts","window":[{"operation":"change","field":"measurement-marker","as":"older-measurement","mode":"absolute","groupby":["repository","workflow-route","workflow-slug","campaign","value-id"],"order-by":[{"field":"window-end","direction":"desc"},{"field":"observed-at","direction":"desc"}]}]},{"name":"value-current-measurements","subject":"Latest native primary measurements, separately from event-ledger reports.","objective":"Expose ordinary reviewed batch results on the same Value surface.","acceptance":"Do not infer healthy outcomes, accepted implementations or complete coverage from a non-null value.","from":"value-measurement-order","filter":{"predicates":[{"field":"older-measurement","equals":"unknown"},{"field":"metric-role","equals":"primary"}]}},{"name":"value-evidence-facts","subject":"Published original evidence for frozen workflow value contracts.","objective":"Keep report identity, target repository, workflow and capture together.","acceptance":"Read canonical evidence only. No GitHub acquisition, HTML loading or fabricated evidence on navigation.","from":"operational-value-evidence","time":{"range":"all"}},{"name":"value-contracts","subject":"One retained contract per repository, workflow and versioned native measure.","objective":"Compute each report independently before selecting current workflow results.","acceptance":"Preserve separate versions and exact report identity. Latest-version selection belongs to the workflow result query.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"contract"}]},"compute":[{"as":"report-marker","function":"literal","args":[{"value":1}]}]},{"name":"value-measurement-captures","subject":"Accepted complete native batch assessments, separately from collection decisions.","objective":"Expose actual retained capture clocks without advancing them on failure or partial data.","acceptance":"Only mature complete non-null primary assessments establish an accepted capture; zero remains valid.","from":"value-measurement-facts","filter":{"predicates":[{"field":"metric-role","equals":"primary"},{"field":"measurement-missing","equals":false},{"field":"coverage-status","equals":"complete"},{"field":"maturity-status","equals":"matured"}]},"compute":[{"as":"report-marker","function":"literal","args":[{"value":1}]}],"select":[{"field":"workflow-route"},{"field":"observed-at"},{"field":"window-end"},{"field":"id","as":"capture-id"},{"field":"report-marker"}]},{"name":"value-contract-captures","subject":"Original capture clocks from accepted rich evidence packets.","objective":"Align capture metadata without merging measured populations.","acceptance":"This union is capture metadata only, never combined metric totals.","from":"value-contracts","select":[{"field":"workflow-route"},{"field":"observed-at"},{"field":"window-end"},{"field":"report-id","as":"capture-id"},{"field":"report-marker"}]},{"name":"value-capture-order","subject":"Actual captures across the retained measures of each workflow.","objective":"Expose the last accepted capture independently of collection decisions.","acceptance":"Select by original capture time. A deferred or failed check cannot advance evidence clocks.","from":"value-contract-captures","union":["value-measurement-captures"],"window":[{"operation":"change","field":"report-marker","as":"later-capture","mode":"absolute","groupby":["workflow-route"],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"capture-id","direction":"desc"}]}]},{"name":"value-latest-capture","subject":"One last accepted capture per workflow, not a freshness claim.","objective":"Join capture and cutoff without multiplying collection registrations.","acceptance":"Missing packets remain unavailable, never zero or an inferred successful collection.","from":"value-capture-order","filter":{"predicates":[{"field":"later-capture","equals":"unknown"}]}},{"name":"value-collection-health","subject":"Reviewed registration and authoritative collection decisions, with independently retained evidence.","objective":"Explain disabled, unconfigured, deferred, failed and not-yet-captured workflows.","acceptance":"Use published collector facts, not missing result cards. Preserve decision, attempt, capture and cutoff as distinct clocks.","from":"workflow-value-collections","time":{"range":"all"},"joins":[{"source":"value-latest-capture","type":"left","on":[{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"observed-at","as":"captured-at"},{"field":"window-end","as":"evidence-cutoff"}]}],"compute":[{"as":"workflow-context","function":"concat","args":[{"field":"workflow"},{"value":" · "},{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"capture-missing","function":"equals-any","args":[{"field":"captured-at"},{"value":null}]},{"as":"evidence-state","function":"if","args":[{"field":"capture-missing"},{"value":"No retained capture"},{"value":"Retained evidence available"}]}],"order-by":[{"field":"organization","direction":"asc"},{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"value-registered-collections","subject":"Reviewed Value registrations, including explicit disables and registrations with no report.","objective":"Make collection health visible before the first accepted packet.","acceptance":"Registration is independent of measured outcomes. No enrollment or acquisition follows from navigation.","from":"value-collection-health","filter":{"predicates":[{"field":"registration","in":["enabled","disabled"]}]},"limit":1000},{"name":"value-snapshots","subject":"Independent repository-state observations and exact item drill-downs.","objective":"Keep everyone's changes separate from workflow-linked delivery.","acceptance":"Retain observed native values, dates and immutable references. Do not invent intermediate observations.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"snapshot"}]},"compute":[{"as":"snapshot-marker","function":"literal","args":[{"value":1}]},{"as":"encoded-snapshot","function":"url-encode","args":[{"field":"snapshot-route"}]},{"as":"snapshot-href","function":"concat","args":[{"value":"#page-value-snapshot?snapshot="},{"field":"encoded-snapshot"}]}],"order-by":[{"field":"at","direction":"asc"},{"field":"fact-id","direction":"asc"}]},{"name":"value-first-snapshot-order","subject":"First independently observed repository state.","objective":"Name the actual first-snapshot reference rather than an invented baseline.","acceptance":"Strictly use retained snapshot time. A post-adoption snapshot is not a pre-adoption baseline.","from":"value-snapshots","window":[{"operation":"change","field":"snapshot-marker","as":"earlier-snapshot","mode":"absolute","groupby":["report-id","workflow-route"],"order-by":[{"field":"at","direction":"asc"}]}]},{"name":"value-first-snapshot","subject":"First retained snapshot per report.","objective":"Provide the explicit reference value and date.","acceptance":"No retained reference means no comparison.","from":"value-first-snapshot-order","filter":{"predicates":[{"field":"earlier-snapshot","equals":"unknown"}]}},{"name":"value-last-snapshot-order","subject":"Latest independently observed repository state.","objective":"Show the actual last measurement rather than an extrapolation.","acceptance":"Preserve the latest retained snapshot even if unchanged.","from":"value-snapshots","window":[{"operation":"change","field":"snapshot-marker","as":"later-snapshot","mode":"absolute","groupby":["report-id","workflow-route"],"order-by":[{"field":"at","direction":"desc"}]}]},{"name":"value-last-snapshot","subject":"Last retained snapshot per report.","objective":"Provide the current native observation.","acceptance":"One snapshot establishes state, not movement.","from":"value-last-snapshot-order","filter":{"predicates":[{"field":"later-snapshot","equals":"unknown"}]}},{"name":"value-output-counts","subject":"Retained safe outputs and applied creation receipts.","objective":"Describe output activity without treating it as accepted value.","acceptance":"Count distinct validated output facts. Tracking corroboration is not an applied receipt.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"output"}]},"aggregate":{"by":["report-id","workflow-route"],"values":[{"field":"fact-id","as":"retained-outputs","reducer":"count"},{"field":"fact-id","as":"receipt-outputs","reducer":"count","filter":{"predicates":[{"field":"origin","equals":"receipt-verified"}]}}]}},{"name":"value-implementation-counts","subject":"Distinct accepted implementations and their measured native effects.","objective":"Count each accepted implementation once, including zero and negative effects.","acceptance":"Validated implementation identities are unique; many-to-many output edges must not multiply value. Complete coverage is checked separately.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"implementation"}]},"compute":[{"as":"accepted-ms","function":"timestamp","args":[{"field":"at"}]},{"as":"cutoff-ms","function":"timestamp","args":[{"field":"window-end"}]},{"as":"current-start","function":"difference","args":[{"field":"cutoff-ms"},{"value":2419200000}]},{"as":"previous-start","function":"difference","args":[{"field":"cutoff-ms"},{"value":4838400000}]},{"as":"before-current","function":"greater-than","args":[{"field":"current-start"},{"field":"accepted-ms"}]},{"as":"before-previous","function":"greater-than","args":[{"field":"previous-start"},{"field":"accepted-ms"}]},{"as":"current-effect","function":"if","args":[{"field":"before-current"},{"value":0},{"field":"value"}]},{"as":"previous-candidate","function":"if","args":[{"field":"before-previous"},{"value":0},{"field":"value"}]},{"as":"previous-effect","function":"if","args":[{"field":"before-current"},{"field":"previous-candidate"},{"value":0}]}],"aggregate":{"by":["report-id","workflow-route"],"values":[{"field":"fact-id","as":"accepted-implementations","reducer":"count"},{"field":"value","as":"known-result","reducer":"sum"},{"field":"current-effect","as":"known-recent","reducer":"sum"},{"field":"previous-effect","as":"known-previous","reducer":"sum"}]}},{"name":"value-covered-durations","subject":"Explicit complete evidence durations in the report and adjacent 28-day delivery periods.","objective":"Distinguish known zero from gaps or incomplete evidence.","acceptance":"The producer validates non-overlapping bounded coverage. Count only complete intervals, clipped to each exact half-open period.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"coverage"},{"field":"coverage-status","equals":"complete"}]},"compute":[{"as":"left-ms","function":"timestamp","args":[{"field":"at"}]},{"as":"right-ms","function":"timestamp","args":[{"field":"end-at"}]},{"as":"cutoff-ms","function":"timestamp","args":[{"field":"window-end"}]},{"as":"current-start","function":"difference","args":[{"field":"cutoff-ms"},{"value":2419200000}]},{"as":"previous-start","function":"difference","args":[{"field":"cutoff-ms"},{"value":4838400000}]},{"as":"after-current","function":"greater-than","args":[{"field":"left-ms"},{"field":"current-start"}]},{"as":"after-previous","function":"greater-than","args":[{"field":"left-ms"},{"field":"previous-start"}]},{"as":"before-current-end","function":"greater-than","args":[{"field":"current-start"},{"field":"right-ms"}]},{"as":"current-left","function":"if","args":[{"field":"after-current"},{"field":"left-ms"},{"field":"current-start"}]},{"as":"previous-left","function":"if","args":[{"field":"after-previous"},{"field":"left-ms"},{"field":"previous-start"}]},{"as":"previous-right","function":"if","args":[{"field":"before-current-end"},{"field":"right-ms"},{"field":"current-start"}]},{"as":"duration","function":"difference","args":[{"field":"right-ms"},{"field":"left-ms"}]},{"as":"current-duration","function":"difference","args":[{"field":"right-ms"},{"field":"current-left"}]},{"as":"previous-duration","function":"difference","args":[{"field":"previous-right"},{"field":"previous-left"}]},{"as":"positive-current","function":"greater-than","args":[{"field":"current-duration"},{"value":0}]},{"as":"positive-previous","function":"greater-than","args":[{"field":"previous-duration"},{"value":0}]},{"as":"covered-current","function":"if","args":[{"field":"positive-current"},{"field":"current-duration"},{"value":0}]},{"as":"covered-previous","function":"if","args":[{"field":"positive-previous"},{"field":"previous-duration"},{"value":0}]}],"aggregate":{"by":["report-id","workflow-route"],"values":[{"field":"duration","as":"covered-duration","reducer":"sum"},{"field":"covered-current","as":"covered-current","reducer":"sum"},{"field":"covered-previous","as":"covered-previous","reducer":"sum"}]}},{"name":"value-report-delivery","subject":"Evidence-qualified output and accepted-contribution totals.","objective":"Keep populations and native units separate without an implied conversion rate.","acceptance":"Absent output context is unknown. Missing coverage withholds complete totals and recent zero, retaining labelled known subtotals.","from":"value-contracts","joins":[{"source":"value-output-counts","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"retained-outputs","as":"retained-outputs"},{"field":"receipt-outputs","as":"retained-receipts"}]},{"source":"value-implementation-counts","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"accepted-implementations","as":"retained-implementations"},{"field":"known-result","as":"known-result"},{"field":"known-recent","as":"known-recent"},{"field":"known-previous","as":"known-previous"}]},{"source":"value-covered-durations","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"covered-duration","as":"covered-duration"},{"field":"covered-current","as":"covered-current"},{"field":"covered-previous","as":"covered-previous"}]}],"compute":[{"as":"start-ms","function":"timestamp","args":[{"field":"window-start"}]},{"as":"end-ms","function":"timestamp","args":[{"field":"window-end"}]},{"as":"report-duration","function":"difference","args":[{"field":"end-ms"},{"field":"start-ms"}]},{"as":"complete-report","function":"equals-any","args":[{"field":"covered-duration"},{"field":"report-duration"}]},{"as":"complete-current","function":"equals-any","args":[{"field":"covered-current"},{"value":2419200000}]},{"as":"complete-previous","function":"equals-any","args":[{"field":"covered-previous"},{"value":2419200000}]},{"as":"show-workflow-trail","function":"equals-any","args":[{"field":"measurement-basis"},{"value":"workflow-contribution"}]},{"as":"known-output-count","function":"coalesce","args":[{"field":"retained-outputs"},{"value":0}]},{"as":"known-receipt-count","function":"coalesce","args":[{"field":"retained-receipts"},{"value":0}]},{"as":"receipt-outputs","function":"if","args":[{"field":"outputs-available"},{"field":"known-receipt-count"},{"value":null}]},{"as":"accepted-implementations","function":"coalesce","args":[{"field":"retained-implementations"},{"value":0}]},{"as":"output-count","function":"if","args":[{"field":"outputs-available"},{"field":"known-output-count"},{"value":null}]},{"as":"native-result","function":"coalesce","args":[{"field":"known-result"},{"value":0}]},{"as":"current-subtotal","function":"coalesce","args":[{"field":"known-recent"},{"value":0}]},{"as":"previous-subtotal","function":"coalesce","args":[{"field":"known-previous"},{"value":0}]},{"as":"recent-result","function":"if","args":[{"field":"complete-current"},{"field":"current-subtotal"},{"value":null}]},{"as":"previous-result","function":"if","args":[{"field":"complete-previous"},{"field":"previous-subtotal"},{"value":null}]}]},{"name":"value-report-summary","subject":"Shared native card and report comparison against the first retained snapshot.","objective":"Show signed repository-wide movement, the goal direction and the exact comparison dates.","acceptance":"This first/last snapshot comparison is not the adjacent-period alert policy, a pre-adoption baseline or causal workflow credit. One snapshot is not zero change.","from":"value-report-delivery","joins":[{"source":"value-first-snapshot","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"value","as":"reference-value"},{"field":"at","as":"reference-at"}]},{"source":"value-last-snapshot","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"value","as":"current-value"},{"field":"at","as":"current-at"},{"field":"snapshot-href","as":"current-snapshot-href"}]}],"compute":[{"as":"same-snapshot","function":"equals-any","args":[{"field":"reference-at"},{"field":"current-at"}]},{"as":"raw-change","function":"difference","args":[{"field":"current-value"},{"field":"reference-value"}]},{"as":"native-change","function":"if","args":[{"field":"same-snapshot"},{"value":null},{"field":"raw-change"}]},{"as":"change-missing","function":"equals-any","args":[{"field":"native-change"},{"value":null}]},{"as":"rising","function":"greater-than","args":[{"field":"native-change"},{"value":0}]},{"as":"falling","function":"greater-than","args":[{"value":0},{"field":"native-change"}]},{"as":"unchanged","function":"equals-any","args":[{"field":"native-change"},{"value":0}]},{"as":"decrease-goal","function":"equals-any","args":[{"field":"snapshot-direction"},{"value":"decrease"}]},{"as":"increase-goal","function":"equals-any","args":[{"field":"snapshot-direction"},{"value":"increase"}]},{"as":"increase-movement","function":"if","args":[{"field":"rising"},{"value":"Better"},{"value":"Worse"}]},{"as":"decrease-movement","function":"if","args":[{"field":"falling"},{"value":"Better"},{"value":"Worse"}]},{"as":"directed-movement","function":"if","args":[{"field":"decrease-goal"},{"field":"decrease-movement"},{"field":"increase-movement"}]},{"as":"known-movement","function":"if","args":[{"field":"unchanged"},{"value":"Unchanged"},{"field":"directed-movement"}]},{"as":"movement","function":"if","args":[{"field":"change-missing"},{"value":"Comparison unavailable"},{"field":"known-movement"}]},{"as":"increase-direction-label","function":"if","args":[{"field":"increase-goal"},{"value":"↑ Higher is better"},{"value":"Direction not retained"}]},{"as":"direction-label","function":"if","args":[{"field":"decrease-goal"},{"value":"↓ Lower is better"},{"field":"increase-direction-label"}]},{"as":"change-arrow","function":"if","args":[{"field":"rising"},{"value":"↑ +"},{"value":"↓ "}]},{"as":"change-number","function":"format-count","args":[{"field":"native-change"}]},{"as":"directional-delta","function":"concat","args":[{"field":"change-arrow"},{"field":"change-number"},{"value":" "},{"field":"snapshot-unit"}]},{"as":"known-delta","function":"if","args":[{"field":"unchanged"},{"value":"Unchanged"},{"field":"directional-delta"}]},{"as":"delta-label","function":"if","args":[{"field":"change-missing"},{"value":"Comparison unavailable"},{"field":"known-delta"}]},{"as":"signed-change","function":"concat","args":[{"field":"change-arrow"},{"field":"change-number"},{"value":" "},{"field":"snapshot-unit"},{"value":" · "},{"field":"movement"}]},{"as":"unchanged-change","function":"if","args":[{"field":"unchanged"},{"value":"Unchanged"},{"field":"signed-change"}]},{"as":"change-label","function":"if","args":[{"field":"change-missing"},{"value":"Comparison unavailable"},{"field":"unchanged-change"}]},{"as":"reference-day","function":"date-day","args":[{"field":"reference-at"}]},{"as":"known-comparison-label","function":"concat","args":[{"value":"Since "},{"field":"reference-day"},{"value":" · Everyone's work"}]},{"as":"comparison-label","function":"if","args":[{"field":"change-missing"},{"value":"No earlier snapshot for comparison"},{"field":"known-comparison-label"}]},{"as":"workflow-label","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"workflow-context","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":" · "},{"field":"workflow-label"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-route"}]},{"as":"workflow-value-href","function":"concat","args":[{"value":"#page-workflow-value?workflow="},{"field":"encoded-workflow"}]},{"as":"encoded-report","function":"url-encode","args":[{"field":"report-id"}]},{"as":"report-href","function":"concat","args":[{"value":"#page-value-report?report="},{"field":"encoded-report"}]}]},{"name":"value-workflow-result-order","subject":"Version ordering after independently computing each report.","objective":"Keep exact report queries partition-local without changing latest-version selection.","acceptance":"Rank cutoffs then captures within each workflow and measure. Explicit report links do not need other report facts.","from":"value-report-summary","window":[{"operation":"change","field":"report-marker","as":"older-report","mode":"absolute","groupby":["organization","repository","workflow","workflow-route","metric-id"],"order-by":[{"field":"window-end","direction":"desc"},{"field":"observed-at","direction":"desc"},{"field":"report-id","direction":"desc"}]}]},{"name":"value-workflow-results","subject":"Current published report results per native measure.","objective":"Expose the latest coherent packet on the workflow Value tab.","acceptance":"Never replace missing facts with an older measured version. Explicit report links retain their own version.","from":"value-workflow-result-order","filter":{"predicates":[{"field":"older-report","equals":"unknown"}]}},{"name":"value-workflow-headline-order","subject":"Most recent current report across the measures of each workflow.","objective":"Give each workflow and repository one headline result; other measures stay on the workflow page.","acceptance":"Select by cutoff then capture. Never replace a missing result with an older or zero value.","from":"value-workflow-results","window":[{"operation":"change","field":"report-marker","as":"older-headline","mode":"absolute","groupby":["workflow-route"],"order-by":[{"field":"window-end","direction":"desc"},{"field":"observed-at","direction":"desc"},{"field":"report-id","direction":"desc"}]}]},{"name":"value-workflow-headlines","subject":"One headline result per workflow and repository.","objective":"Join cleanly to collection health without multiplying rows.","acceptance":"Exactly one row per workflow route.","from":"value-workflow-headline-order","filter":{"predicates":[{"field":"older-headline","equals":"unknown"}]}},{"name":"value-workflow-reported-overview","subject":"Workflows with a retained headline result, with any published collection state.","objective":"Show a report even when no collection fact was published for its workflow.","acceptance":"A missing collection fact stays unknown, never an inferred registration.","from":"value-workflow-headlines","joins":[{"source":"value-collection-health","type":"left","on":[{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"collection-state","as":"overview-state"},{"field":"reason","as":"overview-reason"}]}],"compute":[{"as":"overview-title","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":" · "},{"field":"workflow-label"}]},{"as":"overview-evidence","function":"literal","args":[{"value":"Retained evidence available"}]}],"select":[{"field":"workflow-route"},{"field":"overview-title"},{"field":"overview-state"},{"field":"overview-reason"},{"field":"overview-evidence"},{"field":"observed-at","as":"overview-captured"},{"field":"window-end","as":"overview-cutoff"},{"field":"change-label","as":"trend-label"},{"field":"movement","as":"trend-movement"},{"field":"snapshot-name","as":"trend-measure"},{"field":"report-href","as":"overview-href"}]},{"name":"value-workflow-registered-reports","subject":"Registered workflows marked with whether a headline result exists.","objective":"Separate registration from retained outcomes before selecting unreported workflows.","acceptance":"Join on workflow route only; one row per registration.","from":"value-registered-collections","joins":[{"source":"value-workflow-headlines","type":"left","on":[{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"report-id","as":"headline-report"}]}],"compute":[{"as":"has-report","function":"equals-any","args":[{"field":"headline-report"},{"value":null}]}]},{"name":"value-workflow-unreported-overview","subject":"Registered workflows that have no retained headline result.","objective":"Keep collection health visible before the first accepted packet.","acceptance":"No result is not zero value or a healthy outcome.","from":"value-workflow-registered-reports","filter":{"predicates":[{"field":"has-report","equals":true}]},"compute":[{"as":"overview-title","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":" · "},{"field":"workflow"}]},{"as":"trend-label","function":"literal","args":[{"value":"No retained result"}]},{"as":"trend-movement","function":"literal","args":[{"value":"No result to compare"}]},{"as":"trend-measure","function":"literal","args":[{"value":"Not available"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-route"}]},{"as":"overview-href","function":"concat","args":[{"value":"#page-workflow-value?workflow="},{"field":"encoded-workflow"}]}],"select":[{"field":"workflow-route"},{"field":"overview-title"},{"field":"collection-state","as":"overview-state"},{"field":"reason","as":"overview-reason"},{"field":"evidence-state","as":"overview-evidence"},{"field":"captured-at","as":"overview-captured"},{"field":"evidence-cutoff","as":"overview-cutoff"},{"field":"trend-label"},{"field":"trend-movement"},{"field":"trend-measure"},{"field":"overview-href"}]},{"name":"value-workflow-overview","subject":"One row per workflow and repository: collection health plus its headline result trend.","objective":"Show the first-to-last trend and collection state in a single card.","acceptance":"Missing reports remain unavailable, never zero. Registration and outcome stay independent facts.","from":"value-workflow-reported-overview","union":["value-workflow-unreported-overview"],"order-by":[{"field":"overview-title","direction":"asc"}],"limit":1000},{"name":"value-intent-sources","subject":"Immutable extracted workflow intent sources.","objective":"Let readers inspect the original goal and requirements.","acceptance":"Only retained HTTPS evidence is linked; workflow text remains untrusted.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"intent-source"}]}},{"name":"value-requirements","subject":"Original full acceptance requirements.","objective":"Distinguish the measured structural facet from all workflow safeguards.","acceptance":"Requirements are source text, not proof they passed.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"requirement"}]}},{"name":"value-outputs","subject":"Retained safe-output lifecycle facts.","objective":"Show receipts, current-at-cutoff state and originating evidence.","acceptance":"A closed output is not automatically an accepted implementation; absence of a link is unknown.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"output"}]},"order-by":[{"field":"at","direction":"desc"},{"field":"fact-id","direction":"asc"}]},{"name":"value-output-origin-evidence","subject":"Retained producer and applied safe-output evidence.","objective":"Let readers distinguish receipt-confirmed creation from corroborated tracking.","acceptance":"Tracking identities locate outputs but do not establish accepted value. Keep unavailable producer evidence explicit.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"output-evidence"}]},"joins":[{"source":"value-outputs","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"parent-id","right":"fact-id"}],"fields":[{"field":"label","as":"output-label"},{"field":"url","as":"output-url"}]}]},{"name":"value-implementations","subject":"Accepted implementations and native before/after effects.","objective":"Expose delivery time and immutable acceptance evidence.","acceptance":"Do not equate acceptance with full quality verification or omit negative effects.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"implementation"}]},"order-by":[{"field":"at","direction":"desc"},{"field":"fact-id","direction":"asc"}]},{"name":"value-output-trails","subject":"Explicit output-to-implementation edges.","objective":"Make the trail from a proposal to an accepted measured change inspectable.","acceptance":"Use retained dated edges only. Many-to-many links do not duplicate headline counts or values.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"output-implementation"}]},"joins":[{"source":"value-outputs","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"parent-id","right":"fact-id"}],"fields":[{"field":"label","as":"output-label"},{"field":"url","as":"output-url"}]},{"source":"value-implementations","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"related-id","right":"fact-id"}],"fields":[{"field":"label","as":"implementation-label"},{"field":"url","as":"implementation-url"},{"field":"value","as":"implementation-value"},{"field":"at","as":"trail-accepted-at"}]}]},{"name":"value-implementation-files","subject":"Measured implementation files and retained lineage sources.","objective":"Link to exact Git facts rather than only a repository tree.","acceptance":"No URL is reconstructed from an unrelated revision. Preserve before, after and replacement file evidence.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","in":["implementation-evidence","implementation-lineage"]}]},"joins":[{"source":"value-implementations","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"parent-id","right":"fact-id"}],"fields":[{"field":"label","as":"implementation-label"},{"field":"url","as":"implementation-url"}]}]},{"name":"value-quality-checks","subject":"Explicit independent verification checks.","objective":"Keep unverified behavior, tests and other safeguards visible.","acceptance":"Missing or not-verified is not a passing check.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"quality-check"}]}},{"name":"value-limitations","subject":"Retained evidence and attribution limitations.","objective":"Qualify claims without inventing completeness.","acceptance":"Treat source limitations as untrusted text and never suppress them.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"limitation"}]}},{"name":"value-snapshot-items","subject":"Actual counted items at an independent immutable snapshot.","objective":"Open exact per-item evidence from the plotted observation.","acceptance":"Only retained items are shown. Missing item evidence must not look like an empty measured population.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"snapshot-item"}]},"joins":[{"source":"value-snapshots","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"parent-id","right":"fact-id"},{"left":"snapshot-route","right":"snapshot-route"}],"fields":[{"field":"at","as":"snapshot-at"}]}]},{"name":"audit-event-summary-buckets","subject":"Aggregate high- and medium-severity audit events with the same severity and summary by workflow.","objective":"Select recurring high- or medium-severity audit summaries for run-level investigation.","acceptance":"Each bucket's event count is traceable to retained audit or tool observations with the same campaign, severity, workflow, and summary; missing workflow attribution stays unknown, and a count alone does not verify impact.","description":"High- and medium-severity audit event counts grouped by severity, workflow, and shared summary.","from":"audits","union":["tools"],"filter":{"predicates":[{"field":"event-type","in":["audit.finding","audit.observability","audit.recommendation","audit.missing_tool","audit.missing_data","audit.noop","audit.mcp_failure","skill.invoked"]},{"field":"event-status","in":["high","medium"]}]},"joins":[{"source":"workflows","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"campaign"}]}],"aggregate":{"by":["campaign","event-status","workflow","event-summary"],"values":[{"field":"event","as":"events","reducer":"count"}]},"select":[{"field":"campaign"},{"field":"event-status"},{"field":"workflow"},{"field":"event-summary"},{"field":"events"}],"order-by":[{"field":"event-status","direction":"asc"},{"field":"events","direction":"desc"},{"field":"workflow","direction":"asc"},{"field":"event-summary","direction":"asc"}]},{"name":"campaign-workflows","subject":"List campaign-owned orchestrator and worker workflows with database-backed execution totals.","objective":"Choose an active campaign workflow whose observed execution warrants inspection.","acceptance":"Listed workflows match active declared orchestrator or worker inventory entries; runs and AI Credits agree with the selected-horizon inventory, and absence is not evidence of disabled authority or no executions. Rollout mode is context, not permission to change policy.","description":"Campaign workflows projected from lean canonical inventory, with shared declaration names and active-only workflow drill-down links.","from":"campaign-workflow-inventory","filter":{"predicates":[{"field":"workflow-active","equals":"true"}]},"compute":[{"as":"workflow-identity","function":"concat","args":[{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-identity"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-display-name"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-identity"}]}],"select":[{"field":"campaign"},{"field":"campaign-display-name","as":"campaign-name"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-role"},{"field":"rollout-mode"},{"field":"workflow-active"},{"field":"runs"},{"field":"aic"},{"field":"repository-dashboard-link","as":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"}],"order-by":[{"field":"campaign-name","direction":"asc"},{"field":"workflow-role","direction":"asc"},{"field":"workflow-name","direction":"asc"}]},{"name":"campaign-repository-declarations","subject":"List active declared campaign workflows and their owning repositories without execution evidence.","objective":"Inspect campaign repository topology without computing unused run totals or import coverage.","acceptance":"Preserve active orchestrator and worker identities, display names, rollout context, links, and ordering. Declaration counts are not target enrollment, dispatch coverage, or execution totals. Empty inventory and unavailable workflow evidence remain distinct.","description":"Declaration-only repository topology. Run totals and import-evidence quality belong to execution views, not this inventory.","from":"campaign-workflow-declarations","filter":{"predicates":[{"field":"workflow-active","equals":"true"}]},"select":[{"field":"campaign"},{"field":"campaign-display-name","as":"campaign-name"},{"field":"organization"},{"field":"repository-slug","as":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"workflow-active"},{"field":"repository-dashboard-link","as":"repository-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"campaign-repository-inventory","subject":"Present declared campaign repository topology in workflow display order.","objective":"Filter and search projected repository coordinates and workflow names without time-filtering structural declarations.","acceptance":"Preserve the campaign workflow list's stable ordering and declaration-only evidence quality; runtime horizons must not remove declared workflows.","from":"campaign-repository-declarations","order-by":[{"field":"campaign-name","direction":"asc"},{"field":"workflow-role","direction":"asc"},{"field":"workflow-name","direction":"asc"}]},{"name":"campaign-reports","subject":"Project retained outcomes into campaign-addressable report evidence.","objective":"Identify a campaign report whose durable outcome record needs follow-up.","acceptance":"Each report's campaign, title, source link, observation time, and disposition match its retained outcome; missing status is labeled unknown rather than accepted or resolved, and report production is not verified impact.","description":"Campaign outcome reports with database-backed disposition fields.","from":"outcomes","compute":[{"as":"report-status","function":"coalesce","args":[{"field":"outcome-status"},{"field":"outcome-state"},{"value":"unknown"}]}],"select":[{"field":"campaign"},{"field":"safe-output"},{"field":"outcome-title"},{"field":"outcome-summary"},{"field":"report-status","as":"outcome-status"},{"field":"rollout-mode"},{"field":"engine"},{"field":"engine-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"outcome-category"},{"field":"observed-at"},{"field":"external-link"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"outcome-title","direction":"asc"}]},{"name":"campaign-worker-issues","subject":"Project issue outcomes created by campaign worker workflows.","objective":"Choose a campaign worker issue whose current recorded disposition needs review.","acceptance":"Include only issues whose producing run joins declared worker inventory on organization, repository, and workflow, even when the issue lands elsewhere. Preserve campaign and role across Activity imports. Retain run and status evidence; missing closure details stay unknown and closure is not proof of resolution.","description":"Campaign-addressable issue outcomes restricted to declared worker workflows.","from":"outcomes","joins":[{"source":"workflows","type":"inner","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"workflow-role","as":"declared-workflow-role"}]}],"filter":{"predicates":[{"field":"outcome-category","equals":"issue"},{"field":"declared-workflow-role","equals":"worker"}]},"select":[{"field":"campaign"},{"field":"organization"},{"field":"repository"},{"field":"safe-output"},{"field":"outcome-number"},{"field":"outcome-title","as":"event-summary"},{"field":"outcome-title"},{"field":"outcome-summary"},{"field":"outcome-status"},{"field":"outcome-state"},{"field":"issue-state"},{"field":"issue-closed"},{"field":"issue-state-reason"},{"field":"issue-status"},{"field":"issue-closing-status"},{"field":"issue-status-detail"},{"field":"issue-closed-at"},{"field":"issue-status-observed-at"},{"field":"outcome-category","as":"safe-output-type"},{"field":"workflow"},{"field":"workflow-name"},{"field":"run"},{"field":"observed-at"},{"field":"issue-link"},{"field":"external-link"},{"field":"run-link"}],"order-by":[{"field":"observed-at","direction":"desc"}]},{"name":"campaign-issue-tab-counts","subject":"Count the retained worker issues available for each campaign Reports tab.","objective":"Decide whether a campaign has retained worker issue reports to inspect.","acceptance":"For each returned campaign, items equals the number of rows in campaign-worker-issues for that campaign in the same horizon; missing campaigns are not treated as zero issues or verified resolution.","description":"One campaign row with the number of retained issue outcomes produced by campaign workers.","from":"campaign-worker-issues","aggregate":{"by":["campaign"],"values":[{"field":"campaign","as":"items","reducer":"count"}]}},{"name":"campaign-readme-orchestrators","subject":"Resolve one repository link for each campaign README from its declared orchestrator workflow.","objective":"Locate the declared orchestrator repository to contextualize a campaign README.","acceptance":"Each returned campaign and repository link traces to a declared orchestrator workflow; missing or multiple declarations are reported as uncertain rather than inventing a canonical repository.","from":"workflows","filter":{"predicates":[{"field":"workflow-role","equals":"orchestrator"}]},"select":[{"field":"campaign"},{"field":"repository-link"}]},{"name":"campaign-readme-details","subject":"Present retained campaign README content with its repository-relative link context.","objective":"Open the campaign's retained README in its declared repository context before relying on its guidance.","acceptance":"The README text and path match the campaign record and any repository link resolves through a declared orchestrator; absent content or repository linkage remains unavailable, not inferred.","from":"campaigns","joins":[{"source":"campaign-readme-orchestrators","type":"left","on":[{"left":"campaign","right":"campaign"}],"fields":[{"field":"repository-link","as":"repository-link"}]}],"select":[{"field":"campaign"},{"field":"campaign-readme"},{"field":"campaign-readme-path"},{"field":"repository-link"}]},{"name":"campaign-memory-campaigns","subject":"Provide the registered campaigns whose repository memory can be browsed together.","objective":"Choose a registered campaign for repository-memory inspection.","acceptance":"Each campaign identity and display name matches the retained campaign registry in the selected scope; listing a campaign does not establish that memory observations exist or are complete.","description":"Registered campaigns ordered for the all-campaign repository-memory browser.","from":"campaigns","select":[{"field":"campaign"},{"field":"campaign-name"}],"order-by":[{"field":"campaign-name","direction":"asc"}]},{"name":"campaign-performance-baseline-totals","subject":"Establish a selected-horizon campaign baseline from concluded run attempts while keeping reliability, unverified production, and efficiency as separate facts.","objective":"Select campaigns whose retained run reliability, output production, or AI Credit efficiency merits closer examination.","acceptance":"Concluded and successful attempts, outputs, and mean AI Credits reconcile to filtered retained runs; absent denominators or costs stay unknown. Produced outputs are unverified, not operational value.","description":"Canonical campaign run attempts aggregated into bounded selected-horizon baseline totals without treating runtime success or produced outputs as operational value.","from":"campaign-runs","compute":[{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["campaign"],"values":[{"field":"run-attempt-identity","as":"concluded-runs","reducer":"count","filter":{"predicates":[{"field":"status","in":["success","failure","cancelled","timed-out","action-required","neutral","skipped","stale","startup-failure"]}]}},{"field":"run-attempt-identity","as":"successful-runs","reducer":"count","filter":{"predicates":[{"field":"status","equals":"success"}]}},{"field":"safe-items-count","as":"runs-with-output-evidence","reducer":"count","filter":{"predicates":[{"field":"status","equals":"success"}]}},{"field":"safe-items-count","as":"produced-outputs","reducer":"sum","filter":{"predicates":[{"field":"status","equals":"success"}]}},{"field":"aic-total","as":"aic-per-successful-run","reducer":"mean","filter":{"predicates":[{"field":"status","equals":"success"},{"field":"positive-aic","equals":true}]}}]}},{"name":"campaign-performance-baseline","subject":"Turn each campaign's selected-horizon baseline totals into deterministic reliability and production signals with an explicit successful-run efficiency fact.","objective":"Decide which campaign baseline signal needs run- or output-level verification next.","acceptance":"Success-rate and signal labels follow the retained totals and their explicit denominators; no concluded attempts or output evidence is distinguished from zero verified impact, and AI Credits per successful run remain a separate cost fact rather than a value score.","description":"A bounded, explainable baseline that distinguishes runtime reliability, unverified output production, and AI Credit efficiency.","from":"campaign-performance-baseline-totals","compute":[{"as":"success-rate","function":"quotient","args":[{"field":"successful-runs"},{"field":"concluded-runs"}]},{"as":"success-rate-display","function":"format-percent","args":[{"field":"success-rate"}]},{"as":"success-rate-percent","function":"product","args":[{"field":"success-rate"},{"value":100}]},{"as":"has-concluded-runs","function":"greater-than","args":[{"field":"concluded-runs"},{"value":0}]},{"as":"has-unsuccessful-runs","function":"greater-than","args":[{"field":"concluded-runs"},{"field":"successful-runs"}]},{"as":"observed-reliability-signal","function":"if","args":[{"field":"has-unsuccessful-runs"},{"value":"Unsuccessful runs observed"},{"value":"No unsuccessful runs observed"}]},{"as":"reliability-signal","function":"if","args":[{"field":"has-concluded-runs"},{"field":"observed-reliability-signal"},{"value":"No concluded runs observed"}]},{"as":"has-output-evidence","function":"greater-than","args":[{"field":"runs-with-output-evidence"},{"value":0}]},{"as":"has-produced-outputs","function":"greater-than","args":[{"field":"produced-outputs"},{"value":0}]},{"as":"observed-production-signal","function":"if","args":[{"field":"has-produced-outputs"},{"value":"Outputs produced; acceptance unverified"},{"value":"No outputs observed"}]},{"as":"production-signal","function":"if","args":[{"field":"has-output-evidence"},{"field":"observed-production-signal"},{"value":"Output evidence unavailable"}]}],"select":[{"field":"campaign"},{"field":"concluded-runs"},{"field":"successful-runs"},{"field":"success-rate"},{"field":"success-rate-display"},{"field":"success-rate-percent"},{"field":"reliability-signal"},{"field":"produced-outputs"},{"field":"production-signal"},{"field":"aic-per-successful-run"}]},{"name":"campaign-problem-runs","subject":"List retained failed runs for campaign problem investigation.","objective":"Choose a recent failed campaign run to investigate with its diagnostic evidence.","acceptance":"Each row corresponds to a retained campaign run with a declared failure, startup-failure, stale, or timed-out status; campaign-problem-run-evidence orders matching rows newest first. Absence is not proof of healthy execution or complete ingestion.","description":"Private failed-run input with retained diagnostic metadata; the evidence consumer orders only runs matching current runtime problems.","from":"campaign-runs","filter":{"predicates":[{"field":"status","in":["failure","startup-failure","stale","timed-out"]}]}},{"name":"campaign-problem-runtime-failures","subject":"Select current failing runtime partitions without presentation ordering.","objective":"Retain the exact current-failure eligibility needed by the problem evidence join.","acceptance":"A latest failure streak is a nonnegative integer, so failure-count at least one is equivalent to has-current-failure; missing or incomplete runtime evidence remains unknown.","description":"Private unsorted failure partitions for problem evidence; ordering is supplied by the retained failed runs.","from":"campaign-runtime-health-groups","filter":{"predicates":[{"field":"failure-count","gte":1}]},"compute":[{"as":"problem-kind","function":"coalesce","args":[{"value":"failure"},{"value":"failure"}]}]},{"name":"campaign-problem-runtime-partitions","subject":"Project current runtime problem keys and diagnoses for the failed-run evidence join.","objective":"Avoid sorting and retaining unused runtime problem presentation fields.","acceptance":"Retain both current failures and unobserved orchestrators, including their metadata and duplicate-key failure semantics; this projection does not establish health or root cause.","description":"Private compact equivalent of campaign-runtime-problems for equality enrichment, not presentation.","from":"campaign-problem-runtime-failures","union":["campaign-unobserved-orchestrators"],"select":[{"field":"campaign"},{"field":"workflow"},{"field":"runtime-repository"},{"field":"failure-count"},{"field":"problem-kind"}]},{"name":"campaign-problem-run-evidence","subject":"Attach the current campaign runtime problem summary to each retained failed Run for that partition.","objective":"Inspect the failure count and problem kind alongside a failed run without inferring its root cause.","acceptance":"Each returned row joins a retained failed run to a runtime problem on campaign, workflow, and runtime repository; the inner join drops unmatched runs, so compare with campaign-problem-runs before interpreting absence as no problem.","description":"Failed campaign runs annotated with the failure-count and problem-kind of their active runtime problem, one row per retained failed Run.","from":"campaign-problem-runs","joins":[{"source":"campaign-problem-runtime-partitions","type":"inner","on":[{"left":"campaign","right":"campaign"},{"left":"workflow","right":"workflow"},{"left":"runtime-repository","right":"runtime-repository"}],"fields":[{"field":"failure-count","as":"failure-count"},{"field":"problem-kind","as":"problem-kind"}]}],"order-by":[{"field":"started-at","direction":"desc"},{"field":"run","direction":"desc"}]},{"name":"campaign-problem-latest-target-runs","subject":"Identify the most recent retained failed Run for each campaign workflow target repository.","objective":"Select the latest retained failed run identity for each campaign workflow and target partition.","acceptance":"For every returned campaign, workflow, runtime repository, and target repository, latest-target-run agrees with the maximum retained failed run identity in that partition; a missing partition is not a healthy target.","description":"One row per campaign workflow and target repository with its most recent retained failed Run identity.","from":"campaign-problem-run-evidence","aggregate":{"by":["campaign","workflow","runtime-repository","target-repository"],"values":[{"field":"run","as":"latest-target-run","reducer":"max"}]}},{"name":"campaign-problem-error-groups","subject":"Cluster retained failed Run evidence by workflow, runtime repository, target repository, and error signature so repeated identical failures for one target collapse into one diagnosable group.","objective":"Rank repeated target-specific error signatures for investigation without merging unrelated failures.","acceptance":"Occurrence-count and latest-run match retained failed runs grouped by campaign, workflow, repositories, problem kind, and signature; unknown signatures may group together. Counts do not prove a root cause.","description":"One row per distinct target repository and error signature within a campaign runtime problem partition, with an occurrence count and the most recent matching Run identity for follow-up.","from":"campaign-problem-run-evidence","aggregate":{"by":["campaign","campaign-name","workflow","workflow-name","workflow-role","runtime-repository","target-repository","rollout-mode","failure-count","problem-kind","error-signature","error-signature-label"],"values":[{"field":"run","as":"occurrence-count","reducer":"count"},{"field":"run","as":"latest-run","reducer":"max"}]}},{"name":"campaign-current-problem-error-groups","subject":"Keep only the newest error signature for each campaign workflow target repository.","objective":"Focus investigation on the signature associated with the latest retained failed run per target.","acceptance":"Each returned group joins campaign-problem-latest-target-runs on campaign, workflow, runtime repository, and latest run ID; target repository is not a join key, so verify target identity against underlying runs before claiming one current signature per target.","description":"Current target-specific error groups whose representative Run is the target repository's most recent retained failed Run.","from":"campaign-problem-error-groups","joins":[{"source":"campaign-problem-latest-target-runs","type":"inner","on":[{"left":"campaign","right":"campaign"},{"left":"workflow","right":"workflow"},{"left":"runtime-repository","right":"runtime-repository"},{"left":"latest-run","right":"latest-target-run"}],"fields":[{"field":"latest-target-run","as":"current-target-run"}]}]},{"name":"campaign-problem-items","subject":"Attach the most recent representative Run evidence to each distinct campaign runtime problem error signature.","objective":"Open the representative failed run and target for each current campaign problem group.","acceptance":"Check joined run-link, run ID, campaign, workflow, and runtime repository; verify target against run evidence (not a join key). Unobserved orchestrators need inventory review. Missing evidence remains unknown; rollout mode does not authorize policy changes.","description":"Current campaign runtime problems represented by the newest error signature for each target repository, with its effective rollout mode, an occurrence count, the most recent matching failed Run, and a repair prompt.","from":"campaign-current-problem-error-groups","joins":[{"source":"campaign-problem-run-evidence","type":"inner","on":[{"left":"campaign","right":"campaign"},{"left":"workflow","right":"workflow"},{"left":"runtime-repository","right":"runtime-repository"},{"left":"latest-run","right":"run"}],"fields":[{"field":"started-at","as":"started-at"},{"field":"run","as":"run"},{"field":"status","as":"status"},{"field":"status-detail","as":"status-detail"},{"field":"failure-job","as":"failure-job"},{"field":"failure-message","as":"failure-message"},{"field":"failure-step","as":"failure-step"},{"field":"failure-log","as":"failure-log"},{"field":"gh-aw-version","as":"gh-aw-version"},{"field":"engine","as":"engine"},{"field":"engine-version","as":"engine-version"},{"field":"requested-model","as":"requested-model"},{"field":"resolved-model","as":"resolved-model"},{"field":"run-link","as":"run-link"},{"field":"repository-link","as":"repository-link"},{"field":"workflow-link","as":"workflow-link"},{"field":"workflow-source-link","as":"workflow-source-link"}]}],"union":["campaign-unobserved-orchestrators"],"compute":[{"as":"problem-title","function":"coalesce","args":[{"field":"failure-message"},{"field":"status-detail"},{"field":"error-signature-label"},{"field":"workflow-name"}]},{"as":"_runtime-repository-encoded","function":"url-encode","args":[{"field":"runtime-repository"}]},{"as":"_runtime-repository-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"_runtime-repository-encoded"}]},{"as":"runtime-repository-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"_runtime-repository-href"},{"field":"runtime-repository"},{"field":"runtime-repository"}]},{"as":"_target-repository-encoded","function":"url-encode","args":[{"field":"target-repository"}]},{"as":"_target-repository-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"_target-repository-encoded"}]},{"as":"target-repository-link","function":"dashboard-link","args":[{"field":"target-repository"},{"field":"_target-repository-href"},{"field":"target-repository"}]}],"order-by":[{"field":"workflow-name","direction":"asc"},{"field":"runtime-repository","direction":"asc"},{"field":"occurrence-count","direction":"desc"},{"field":"started-at","direction":"desc"}]},{"name":"campaign-problem-tab-counts","subject":"Count the current runtime problem items available for each campaign Problems tab.","objective":"Determine whether the campaign has current retained failure groups requiring review.","acceptance":"For every returned campaign, items equals the number of campaign-problem-items rows in the same horizon; a missing count does not establish zero failures or healthy execution.","description":"One campaign row with the number of current runtime problem groups.","from":"campaign-problem-items","aggregate":{"by":["campaign"],"values":[{"field":"campaign","as":"items","reducer":"count"}]}},{"name":"campaign-baseline-successful-runs","subject":"Project successful concluded attempts from the selected-horizon campaign baseline.","objective":"Show the successful share of concluded runs without implying verified impact.","acceptance":"Counts reconcile to campaign-performance-baseline-totals; missing campaigns do not imply zero runs.","from":"campaign-performance-baseline-totals","compute":[{"as":"outcome","function":"concat","args":[{"value":"Successful attempts"},{"value":""}]}],"select":[{"field":"campaign"},{"field":"outcome"},{"field":"successful-runs","as":"runs"}]},{"name":"campaign-baseline-other-runs","subject":"Project non-successful concluded attempts from the selected-horizon campaign baseline.","objective":"Show the remaining concluded runs for reliability review.","acceptance":"Runs equal concluded-runs minus successful-runs; the category includes every other concluded status, not just failures.","from":"campaign-performance-baseline-totals","compute":[{"as":"outcome","function":"concat","args":[{"value":"Other concluded attempts"},{"value":""}]},{"as":"other-runs","function":"difference","args":[{"field":"concluded-runs"},{"field":"successful-runs"}]}],"select":[{"field":"campaign"},{"field":"outcome"},{"field":"other-runs","as":"runs"}]},{"name":"campaign-baseline-outcome-distribution","subject":"Compare successful and other concluded attempts in the selected horizon.","objective":"Spot campaign run reliability that needs inspection.","acceptance":"Successful and other counts sum to concluded attempts; neither runtime result nor output production establishes operational value.","from":"campaign-baseline-successful-runs","union":["campaign-baseline-other-runs"]},{"name":"campaign-audit-summary-plot-inventory","subject":"Describe the rendered audit-summary chart using the shared campaign Insights plot contract.","objective":"Find campaigns with retained high- or medium-severity audit summaries worth reviewing.","acceptance":"Each campaign's bucket count equals its retained audit-event-summary-buckets rows; the count describes displayed groups, not distinct incidents or confirmed harm, and missing buckets are not proof of safety.","description":"One plot-inventory row per campaign when its high- and medium-severity audit summary chart has data.","from":"audit-event-summary-buckets","aggregate":{"by":["campaign"],"values":[{"field":"event-summary","as":"buckets","reducer":"count"}]}},{"name":"campaign-insight-plot-inventory","subject":"Inventory every plot rendered on each campaign Insights page through one reusable plot contract.","objective":"Choose an available campaign Insights plot to inspect its underlying evidence.","acceptance":"Each plot entry is supplied by the audit summary plot inventory for the same campaign; experimental operational-value evidence is excluded, no plot count is treated as outcome quality, and unavailable evidence is not synthesized into a plot.","description":"One campaign row per rendered Insights plot, independent of the plot's data source or renderer.","from":"campaign-audit-summary-plot-inventory"},{"name":"campaign-insight-tab-counts","subject":"Count the plots declared by the shared campaign Insights plot inventory.","objective":"Determine whether a campaign has evidence-backed Insights plots to inspect.","acceptance":"For every returned campaign, items equals its rows in campaign-insight-plot-inventory for the same horizon; absent rows do not establish absent value, and plot counts do not measure impact.","description":"One campaign row with the number of rendered Insights plots, independent of plot type.","from":"campaign-insight-plot-inventory","aggregate":{"by":["campaign"],"values":[{"field":"campaign","as":"items","reducer":"count"}]}},{"name":"workflow-ordered-runs","subject":"Order retained run attempts within each workflow by their observed start time.","objective":"Identify each workflow's latest execution without importing event coverage or outcome totals.","acceptance":"The first chronological attempt in each workflow partition has no preceding run delta; break timestamp ties by run ID and attempt, and use creation time for queued runs.","from":"runs","compute":[{"as":"latest-run-at","function":"coalesce","args":[{"field":"started-at"},{"field":"created-at"}]}],"window":[{"operation":"change","field":"run","as":"preceding-run-delta","mode":"absolute","groupby":["organization","repository","workflow"],"order-by":[{"field":"latest-run-at","direction":"desc"},{"field":"run","direction":"desc"},{"field":"run-attempt","direction":"desc"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"latest-run-at"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"preceding-run-delta"},{"field":"run-link"}]},{"name":"workflow-latest-runs","subject":"Project the latest retained run attempt for each workflow.","objective":"Expose each workflow's latest observed execution state without implying aggregate outcomes.","acceptance":"Select only the first chronologically ordered attempt per workflow; preserve queued and in-progress states instead of treating unknown conclusions as failures.","from":"workflow-ordered-runs","filter":{"predicates":[{"field":"preceding-run-delta","equals":"unknown"}]},"compute":[{"as":"observed-conclusion","function":"coalesce","args":[{"field":"run-conclusion"},{"value":"unknown"}]},{"as":"completed","function":"equals-any","args":[{"field":"run-status"},{"value":"completed"}]},{"as":"latest-run-status","function":"if","args":[{"field":"completed"},{"field":"observed-conclusion"},{"field":"run-status"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"latest-run-at"},{"field":"latest-run-status"},{"field":"run-link"}]},{"name":"workflow-list-preview","subject":"Show workflow declarations while latest-run evidence is still loading.","objective":"Make workflow identities and drill links available before retained runs are evaluated.","acceptance":"Preserve every declared workflow and its drill link; leave latest-run fields absent until the complete projection arrives.","from":"workflows","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-label","function":"concat","args":[{"field":"repository-coordinate"},{"value":":"},{"field":"workflow"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"declared-role","function":"coalesce","args":[{"field":"workflow-role"},{"value":"standalone"}]},{"as":"declared-mode","function":"coalesce","args":[{"field":"rollout-mode"},{"value":"unknown"}]},{"as":"declared-registration","function":"coalesce","args":[{"field":"workflow-active"},{"value":"unknown"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-label"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-display-name"},{"field":"workflow-label"}]}],"select":[{"field":"organization"},{"field":"repository-coordinate","as":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-label"},{"field":"campaign-name"},{"field":"declared-role","as":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"declared-registration","as":"workflow-active"},{"field":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"workflow-list","subject":"List declared workflows in latest observed run order.","objective":"Open a dedicated workflow page from a lightweight inventory with its latest execution status.","acceptance":"Preserve textual run identities and keep unobserved workflows last with an explicit missing-run state; use only workflow declarations and retained runs, not event coverage or aggregate success/failure counters.","from":"workflows","joins":[{"source":"workflow-latest-runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"run","as":"latest-run"},{"field":"latest-run-at","as":"latest-run-at"},{"field":"latest-run-status","as":"observed-run-status"},{"field":"run-link","as":"run-link"}]}],"compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-label","function":"concat","args":[{"field":"repository-coordinate"},{"value":":"},{"field":"workflow"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"declared-role","function":"coalesce","args":[{"field":"workflow-role"},{"value":"standalone"}]},{"as":"declared-mode","function":"coalesce","args":[{"field":"rollout-mode"},{"value":"unknown"}]},{"as":"declared-registration","function":"coalesce","args":[{"field":"workflow-active"},{"value":"unknown"}]},{"as":"observed-run-id","function":"coalesce","args":[{"field":"latest-run"},{"value":"0"}]},{"as":"has-observed-run","function":"greater-than","args":[{"field":"observed-run-id"},{"value":0}]},{"as":"latest-run-status","function":"coalesce","args":[{"field":"observed-run-status"},{"value":"No observed run"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-label"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-display-name"},{"field":"workflow-label"}]}],"select":[{"field":"organization"},{"field":"repository-coordinate","as":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-label"},{"field":"campaign-name"},{"field":"declared-role","as":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"declared-registration","as":"workflow-active"},{"field":"latest-run"},{"field":"latest-run-at"},{"field":"latest-run-status"},{"field":"has-observed-run"},{"field":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"},{"field":"run-link"}],"order-by":[{"field":"has-observed-run","direction":"desc"},{"field":"latest-run-at","direction":"desc"},{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"runs-daily-health-buckets","subject":"Select whole UTC start-day buckets against the requested time bounds.","objective":"Expose UTC bucket boundaries for declarative daily time selection.","acceptance":"Compute bounds from observed execution-start days only; missing request bounds remain unset and no sub-day totals or missing days are fabricated.","from":"daily-run-counts","compute":[{"as":"day-midnight","function":"concat","args":[{"field":"day"},{"value":"T00:00:00Z"}]},{"as":"day-ms","function":"timestamp","args":[{"field":"day-midnight"}]},{"as":"start-ms","function":"timestamp","args":[{"context":"time-start"}]},{"as":"end-ms","function":"timestamp","args":[{"context":"time-end"}]},{"as":"before-start","function":"greater-than","args":[{"field":"start-ms"},{"field":"day-ms"}]},{"as":"before-end","function":"greater-than","args":[{"field":"end-ms"},{"field":"day-ms"}]}]},{"name":"runs-daily-health-totals","subject":"Sum observed daily run health across the selected scope.","objective":"Keep daily activity counts independent of detail retention.","acceptance":"Sum only daily counts, never retained Runs. UTC start-day buckets are selected by midnight; sub-day totals are unsupported. Missing or undated evidence remains unavailable or partial.","from":"runs-daily-health-buckets","filter":{"predicates":[{"field":"before-start","in":[false,null]},{"field":"before-end","in":[true,null]}]},"aggregate":{"by":["day"],"values":[{"field":"successful","as":"successful","reducer":"sum"},{"field":"failed","as":"failed","reducer":"sum"},{"field":"approval","as":"approval","reducer":"sum"},{"field":"pending","as":"pending","reducer":"sum"},{"field":"other","as":"other","reducer":"sum"}]}},{"name":"runs-daily-successful","subject":"Observed daily successful run counts.","objective":"Expose the successful class for the daily runtime-health chart.","acceptance":"Project successful counts from scoped daily totals without re-reading detail; runtime success does not imply accepted outcomes.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Successful"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"successful","as":"runs"}]},{"name":"runs-daily-failed","subject":"Observed daily failed run counts.","objective":"Expose the failed class for the daily runtime-health chart.","acceptance":"Project failed counts from scoped daily totals, preserving zero counts and aggregate coverage without deriving incidents.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Failed"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"failed","as":"runs"}]},{"name":"runs-daily-approval","subject":"Observed daily approval-required run counts.","objective":"Expose approval-required observations in the daily runtime-health chart.","acceptance":"Project approval counts from scoped daily totals without treating approval-required observations as successes or failures.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Approval required"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"approval","as":"runs"}]},{"name":"runs-daily-pending","subject":"Observed daily pending run counts.","objective":"Expose last-observed pending state in the daily runtime-health chart.","acceptance":"Project pending counts from scoped daily totals; counts describe last-observed evidence, not a live execution census.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Pending"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"pending","as":"runs"}]},{"name":"runs-daily-other","subject":"Observed daily unclassified terminal or missing-status run counts.","objective":"Expose the remaining runtime-health class without implying success.","acceptance":"Project other counts from scoped daily totals; preserve zeros and coverage without interpreting skipped, cancelled, or unknown evidence as success.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Other"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"other","as":"runs"}]},{"name":"runs-daily-conclusions","subject":"Daily observed runtime health classes for the Runs chart.","objective":"Investigate daily activity independently of retained run detail.","acceptance":"Classes sum to observed dated Runs, not attempts or verified outcomes. Pending is last-observed state; Other is not success. Select whole UTC start-day buckets by midnight, not sub-day totals. Preserve partial or unavailable coverage.","from":"runs-daily-successful","union":["runs-daily-failed","runs-daily-approval","runs-daily-pending","runs-daily-other"],"order-by":[{"field":"day","direction":"asc"},{"field":"runtime-health","direction":"asc"}]},{"name":"entity-events","subject":"Project all run-owned records for reusable cards and run drill-down.","objective":"Expose run-owned event identity, status, provenance, timestamp, and available navigation links for inspection.","acceptance":"Projected event fields and fallback URL trace to the source record; a missing link or event is not proof of no output, and event status alone does not verify downstream impact.","from":"event-base","compute":[{"as":"event-url","function":"coalesce","args":[{"field":"safe-output-url"},{"field":"correlation-id"},{"field":"implementation-pull-request-url"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"event"},{"field":"event-source"},{"field":"event-type"},{"field":"event-summary"},{"field":"event-status"},{"field":"github-entity-type"},{"field":"safe-output-type"},{"field":"event-url"},{"field":"event-timestamp","as":"observed-at"},{"field":"run-link"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"event","direction":"asc"}]},{"name":"runs-table","subject":"Show observed workflow runs in a table with execution, repository, workflow, engine, model, and navigation details.","objective":"Locate observed runs whose recorded status or conclusion needs closer inspection.","acceptance":"Show recorded run identity, status, conclusion, scope, execution metadata, and source links in newest-first order; absent runs require a freshness and coverage check, and a successful run is not proof of accepted outcomes.","description":"Observed workflow runs ordered from newest to oldest.","from":"runs","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]}],"select":[{"field":"run"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"repository-coordinate"},{"field":"workflow"},{"field":"rollout-mode"},{"field":"engine"},{"field":"engine-version"},{"field":"gh-aw-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"started-at"},{"field":"repository-link"},{"field":"workflow-link"},{"field":"run-link"}],"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"workflow-aic-per-run","subject":"List declared workflows with recorded positive AI Credit costs and their average cost per run.","objective":"Identify workflows with observed run AIC averages worth investigating alongside run evidence.","acceptance":"Include only declared workflows with at least one run attempt reporting positive AIC; exclude zero and missing telemetry from the average and ranking, without interpreting missing telemetry as free execution.","description":"Workflow AI Credit averages limited to run attempts with recorded positive AIC.","from":"workflows","joins":[{"source":"workflow-aic-run-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"aic-runs","as":"observed-aic-runs"},{"field":"aic","as":"observed-aic"}]}],"compute":[{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"workflow-identity","function":"concat","args":[{"field":"repository-slug"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-identity"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-display-name"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-identity"}]},{"as":"aic-per-run","function":"quotient","args":[{"field":"observed-aic"},{"field":"observed-aic-runs"}]}],"filter":{"predicates":[{"field":"observed-aic-runs","gte":1}]},"select":[{"field":"workflow-identity","as":"workflow-label"},{"field":"workflow-dashboard-link","as":"workflow-link"},{"field":"aic-per-run"}],"order-by":[{"field":"aic-per-run","direction":"desc"}],"limit":10},{"name":"dashboard-ingestion-health","subject":"Expose the current collection state for the global ingestion indicator.","objective":"Distinguish reported ingestion failure or recovery from the age of retained workflow evidence.","acceptance":"Use the authorized server collection-health classification, not cumulative failures or browser refresh time. Missing or unauthorized health remains unknown and static dashboards do not request this source.","from":"collection-health","select":[{"field":"configured"},{"field":"health"}],"limit":1},{"name":"dashboard-data-freshness","subject":"Find the newest workflow activity timestamp in retained canonical data.","objective":"Warn globally when the ingested workflow evidence has not advanced for 24 hours.","acceptance":"Use upstream updated-at, falling back to created-at, never browser import or refresh time. Missing or invalid timestamps remain unknown; inactivity alone does not prove an ingestion failure.","from":"runs","compute":[{"as":"data-at","function":"coalesce","args":[{"field":"updated-at"},{"field":"created-at"}]},{"as":"data-at-ms","function":"timestamp","args":[{"field":"data-at"}]}],"aggregate":{"values":[{"field":"data-at-ms","as":"latest-data-at","reducer":"max"}]}},{"name":"indexing-shards","subject":"List retained Activity shard import receipts.","objective":"Inspect which shards were ingested, when, and how many records they committed.","acceptance":"Show shard scope, phase, import status, import timestamp, counts and payload identity from retained receipts. Import time is not upstream freshness and missing receipts do not prove complete coverage.","from":"transactions","filter":{"predicates":[{"field":"kind","in":["ingest-normalized-jsonl","ingest-jsonl","ingest-jsonl-failed","runs","records"]}]},"select":[{"field":"id"},{"field":"payloadScope","as":"shard"},{"field":"kind"},{"field":"activity-status","as":"status"},{"field":"createdAt","as":"ingested-at"},{"field":"committedRecords","as":"committed-records"},{"field":"rawRuns","as":"workflow-runs"},{"field":"payloadHash","as":"payload-hash"}],"order-by":[{"field":"ingested-at","direction":"desc"}]},{"name":"ingestion-queued","subject":"Label the shared collection task queue depth for the administrator queue chart.","objective":"Identify total ready and scheduled collection work, including backfill tasks.","acceptance":"Show the observed shared queue depth only when collection is configured; missing or unauthorized health data is not zero pending work.","from":"collection-health","filter":{"predicates":[{"field":"configured","equals":true}]},"compute":[{"as":"queue","function":"coalesce","args":[{"value":"Ready and scheduled"},{"value":"Ready and scheduled"}]}],"select":[{"field":"queue"},{"field":"queue-depth","as":"tasks"}]},{"name":"ingestion-inflight","subject":"Label current in-flight collection tasks for the administrator queue chart.","objective":"Distinguish leased collection tasks from work awaiting collection.","acceptance":"Show the observed pending task count only when collection is configured; do not infer a count from an unavailable source.","from":"collection-health","filter":{"predicates":[{"field":"configured","equals":true}]},"compute":[{"as":"queue","function":"coalesce","args":[{"value":"In flight"},{"value":"In flight"}]}],"select":[{"field":"queue"},{"field":"pending-tasks","as":"tasks"}]},{"name":"ingestion-backfill","subject":"Label cumulative backfill run admissions for the administrator ingestion chart.","objective":"Compare historically admitted run tasks with current outstanding work without treating admissions as a live backlog.","acceptance":"Show the cumulative run task admissions only when collection is configured; this value does not decrease as tasks complete and missing health data does not imply completed backfill.","from":"collection-health","filter":{"predicates":[{"field":"configured","equals":true}]},"compute":[{"as":"queue","function":"coalesce","args":[{"value":"Backfill admitted (total)"},{"value":"Backfill admitted (total)"}]}],"select":[{"field":"queue"},{"field":"backfill-queued-run-tasks","as":"tasks"}]},{"name":"ingestion-queue-sizes","subject":"Compare current shared queue pressure, in-flight tasks, and cumulative historical backfill admissions from the administrator-only server snapshot.","objective":"Spot a growing backlog without treating past backfill admissions as outstanding work.","acceptance":"Current queue sizes and cumulative admissions come only from an authorized collection-health snapshot; unavailable state is not zero.","from":"ingestion-queued","union":["ingestion-inflight","ingestion-backfill"],"select":[{"field":"queue"},{"field":"tasks"}]},{"name":"ingestion-webhook-status","subject":"Inspect live webhook delivery counters for the current server process.","objective":"Distinguish signature validation, acknowledgements, rejections and failures without polling GitHub.","acceptance":"Show only authorized process-local counters, including in-flight requests, duplicate acknowledgements and signed pings. Counters reset on restart, are not replica totals, and do not establish GitHub-side webhook registration or completed collection. Refresh the active subscription even without canonical data changes.","from":"webhook-status","compute":[{"as":"configuration","function":"if","args":[{"field":"configured"},{"value":"Configured"},{"value":"Not configured"}]}],"limit":1},{"name":"ingestion-health","subject":"Show the current Redis-backed webhook and collection health snapshot.","objective":"Determine whether the reported collection, webhook, queue, and backfill state warrants inspecting ingestion diagnostics.","acceptance":"Report the observed health, queue, failure, success, and projection timestamps together; verify freshness and configuration before calling collection healthy, and treat missing state as unknown rather than zero.","from":"collection-health","select":[{"field":"configured"},{"field":"health"},{"field":"queue-depth"},{"field":"pending-tasks"},{"field":"dead-letters"},{"field":"oldest-pending-age"},{"field":"backfill"},{"field":"backfill-failures"},{"field":"backfill-queued-run-tasks"},{"field":"webhook-load"},{"field":"collection-load"},{"field":"failure-load"},{"field":"last-projected"},{"field":"last-webhook-at"},{"field":"last-failure-at"},{"field":"last-failure-code"},{"field":"last-success-at"},{"field":"webhook-received"},{"field":"webhook-duplicate"},{"field":"webhook-admission-failed"},{"field":"task-queued"},{"field":"task-coalesced"},{"field":"collection-succeeded"},{"field":"collection-failed"},{"field":"collection-retried"},{"field":"collection-dead-lettered"}]},{"name":"github-api-usage","subject":"Show retained GitHub API quota usage per bucket and in aggregate over the last 24 hours.","objective":"Determine whether any GitHub App installation or the CAO fleet as a whole is approaching its GitHub API rate limit.","acceptance":"Report peak usage percentages with their limits, used, and reserved counts; treat a slot without observations as unknown rather than idle, and never infer credentials from bucket identity.","from":"github-quota-usage","select":[{"field":"observed-at"},{"field":"scope"},{"field":"bucket"},{"field":"app"},{"field":"installation"},{"field":"resource"},{"field":"buckets"},{"field":"limit"},{"field":"used"},{"field":"reserved"},{"field":"usage-percent"}]},{"name":"marketplace-directory","subject":"Browse packages from configured marketplace registries.","objective":"Present a stable alphabetical directory that can be loaded in bounded pages.","acceptance":"Preserve resolver-produced provenance and package metadata. Order by package name and immutable source so continuation pages neither skip nor duplicate entries; discovery grants no installation authority.","from":"marketplace-packages","order-by":[{"field":"package-name","direction":"asc"},{"field":"package-source","direction":"asc"}]},{"name":"marketplace-package-detail","subject":"Expose normalized marketplace package records for source-coordinate lookup by the detail view.","objective":"Locate the resolver-produced package record for a source coordinate supplied by the consuming view.","acceptance":"Use the returned package-source, registry, ref, and resolved-commit fields when inspecting a matching record; the query itself does not filter by coordinate, and an absent match is not proof of package nonexistence or approval.","from":"marketplace-packages"},{"name":"friction-by-workflow","subject":"Rank workflows by observed gh-aw audit friction AI Credit totals for investigation.","objective":"Identify which repository and workflow combinations have the largest measured friction totals in retained observations.","acceptance":"Compare friction-aic and distinct runs with the underlying measurement states and attribution evidence; do not equate a ranking with avoidable cost or a validated saving.","description":"Total gh-aw audit friction cost grouped by repository and workflow.","from":"friction","compute":[{"as":"positive-aic","function":"greater-than","args":[{"field":"aic"},{"value":0}]},{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}],"aggregate":{"by":["workflow-coordinate","repository-coordinate","workflow"],"values":[{"field":"aic","as":"friction-aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"run","as":"runs","reducer":"distinct-count"}]},"order-by":[{"field":"friction-aic","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}]},{"name":"friction-observations","subject":"List retained gh-aw audit friction measurements with their run context and attribution totals.","objective":"Trace each reported friction measurement to a run and distinguish counted, suppressed, and unattributed occurrences.","acceptance":"Preserve native AIC, total-run AIC, measurement state, timestamps, links, and occurrence counts; missing or unattributed evidence remains uncertain, not a verified opportunity for savings.","description":"Newest friction measurements first, preserving the native audit values and uncertainty state.","from":"friction","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"friction-percent","function":"format-percent","args":[{"field":"friction-ratio"}]}],"select":[{"field":"event-timestamp","as":"observed-at"},{"field":"repository-coordinate"},{"field":"workflow"},{"field":"run"},{"field":"run-link"},{"field":"measurement-state"},{"field":"aic"},{"field":"total-run-aic"},{"field":"friction-percent"},{"field":"counted-occurrences"},{"field":"suppressed-occurrences"},{"field":"unattributed-occurrences"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"run","direction":"desc"}]},{"name":"indexing-shard-dates","subject":"Read the activity date encoded in each retained transaction's shard filename.","objective":"Separate source shard dates from ingestion timestamps.","acceptance":"Keep every transaction and leave absent, invalid, or structural shard dates unknown; never substitute import time.","from":"transactions","compute":[{"as":"shard-day","function":"activity-shard-day","args":[{"field":"payloadScope"}]},{"as":"missing-shard-day","function":"equals-any","args":[{"field":"shard-day"},{"value":null}]}]},{"name":"indexing-ingestion-runs","subject":"Show retained ingestion transactions at the activity date encoded in their shard filename.","objective":"Compare reported run counts by source shard activity date, independently of import time.","acceptance":"Preserve every dated transaction, including coincident dates, all kinds, and zero counts, without grouping, limits, or page filters. Omit missing or invalid shard dates; never substitute import time. Missing counts use labeled zero-position placeholders, not measured zeroes.","from":"indexing-shard-dates","filter":{"predicates":[{"field":"missing-shard-day","equals":false}]},"compute":[{"as":"workflow-runs","function":"coalesce","args":[{"field":"rawRuns"},{"value":0}]},{"as":"missing-run-count","function":"equals-any","args":[{"field":"rawRuns"},{"value":null}]},{"as":"run-count-status","function":"if","args":[{"field":"missing-run-count"},{"value":"Run count unavailable (shown at 0)"},{"value":"Reported run count"}]}],"select":[{"field":"id"},{"field":"kind"},{"field":"createdAt"},{"field":"shard-day"},{"field":"rawRuns"},{"field":"workflow-runs"},{"field":"run-count-status"}],"order-by":[{"field":"shard-day","direction":"asc"},{"field":"id","direction":"asc"}]},{"name":"indexing-daily-run-counts","subject":"Inspect admitted daily logical Run counts independently of retained detail and shard receipts.","objective":"Make the daily run-count projection visible as an ingestion diagnostic.","acceptance":"Sum daily buckets by observed UTC execution-start day across repositories and workflows, without page filters, detail fallback, fabricated days or zero populations. Preserve aggregate coverage and partial or unavailable evidence; counts do not prove upstream completeness.","from":"daily-run-counts","aggregate":{"by":["day"],"values":[{"field":"total","as":"runs","reducer":"sum"}]},"select":[{"field":"day","as":"date"},{"field":"runs"}],"order-by":[{"field":"date","direction":"asc"}]},{"name":"indexing-campaigns-table-count","subject":"Count retained campaigns rows in the dashboard database.","objective":"Provide the retained campaigns row count for the table-count diagnostic.","acceptance":"Label the result campaigns and count campaign rows in the current database; absence or zero does not establish completeness or expected campaign coverage.","from":"campaigns","compute":[{"as":"table","function":"literal","args":[{"value":"campaigns"}]}],"aggregate":{"by":["table"],"values":[{"field":"campaign","as":"records","reducer":"count"}]}},{"name":"indexing-repositories-table-count","subject":"Count retained repositories rows in the dashboard database.","objective":"Provide the retained repositories row count for the table-count diagnostic.","acceptance":"Label the result repositories and count repository rows in the current database; absence or zero does not establish completeness or expected repository coverage.","from":"repositories","compute":[{"as":"table","function":"literal","args":[{"value":"repositories"}]}],"aggregate":{"by":["table"],"values":[{"field":"repository","as":"records","reducer":"count"}]}},{"name":"indexing-workflows-table-count","subject":"Count retained workflows rows in the dashboard database.","objective":"Provide the retained workflows row count for the table-count diagnostic.","acceptance":"Label the result workflows and count workflow rows in the current database; absence or zero does not establish completeness or expected workflow coverage.","from":"workflows","compute":[{"as":"table","function":"literal","args":[{"value":"workflows"}]}],"aggregate":{"by":["table"],"values":[{"field":"workflow","as":"records","reducer":"count"}]}},{"name":"indexing-runs-table-count","subject":"Count retained workflow runs rows in the dashboard database.","objective":"Provide the retained workflow runs row count for the table-count diagnostic.","acceptance":"Label the result workflow runs and count run rows in the current database; absence or zero does not establish completeness or expected execution volume.","from":"runs","compute":[{"as":"table","function":"literal","args":[{"value":"runs"}]}],"aggregate":{"by":["table"],"values":[{"field":"run","as":"records","reducer":"count"}]}},{"name":"indexing-domains-table-count","subject":"Count retained network domains rows in the dashboard database.","objective":"Provide the retained network domains row count for the table-count diagnostic.","acceptance":"Label the result network domains and count domain event rows in the current database; absence or zero does not prove no network activity.","from":"domains","compute":[{"as":"table","function":"literal","args":[{"value":"domains"}]}],"aggregate":{"by":["table"],"values":[{"field":"event","as":"records","reducer":"count"}]}},{"name":"indexing-tools-table-count","subject":"Count retained tool events rows in the dashboard database.","objective":"Provide the retained tool events row count for the table-count diagnostic.","acceptance":"Label the result tool events and count tool event rows in the current database; absence or zero does not prove no tool use.","from":"tools","compute":[{"as":"table","function":"literal","args":[{"value":"tools"}]}],"aggregate":{"by":["table"],"values":[{"field":"table","as":"records","reducer":"count"}]}},{"name":"indexing-audits-table-count","subject":"Count retained audit events rows in the dashboard database.","objective":"Provide the retained audit events row count for the table-count diagnostic.","acceptance":"Label the result audit events and count audit event rows in the current database; absence or zero does not prove no audit findings.","from":"audits","compute":[{"as":"table","function":"literal","args":[{"value":"audits"}]}],"aggregate":{"by":["table"],"values":[{"field":"event","as":"records","reducer":"count"}]}},{"name":"indexing-issues-table-count","subject":"Count retained issue events rows in the dashboard database.","objective":"Provide the retained issue events row count for the table-count diagnostic.","acceptance":"Label the result issue events and count issue event rows in the current database; absence or zero does not prove no issues exist.","from":"issues","compute":[{"as":"table","function":"literal","args":[{"value":"issues"}]}],"aggregate":{"by":["table"],"values":[{"field":"event","as":"records","reducer":"count"}]}},{"name":"indexing-operational-values-table-count","subject":"Count retained operational values rows in the dashboard database.","objective":"Provide the retained operational values row count for the table-count diagnostic.","acceptance":"Label the result operational values and count operational-value rows in the current database; absence or zero does not imply zero value or an evaluated outcome.","from":"operational-values","compute":[{"as":"table","function":"literal","args":[{"value":"operationalValues"}]}],"aggregate":{"by":["table"],"values":[{"field":"operational-value","as":"records","reducer":"count"}]}},{"name":"indexing-transactions-table-count","subject":"Count retained ingestion transactions rows in the dashboard database.","objective":"Provide the retained ingestion transactions row count for the table-count diagnostic.","acceptance":"Label the result ingestion transactions and count transaction IDs in the current database; absence or zero does not establish whether upstream ingestion ran.","from":"transactions","compute":[{"as":"table","function":"literal","args":[{"value":"transactions"}]}],"aggregate":{"by":["table"],"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"indexing-database-table-counts","subject":"Count retained canonical dashboard database rows by table.","objective":"Compare the retained table row counts to identify tables needing further ingestion or coverage investigation.","acceptance":"Union the named table-count projections and report their table labels and counts; check source availability, retention, and separate transaction evidence before interpreting an empty or small table as an ingestion defect.","from":"indexing-campaigns-table-count","union":["indexing-repositories-table-count","indexing-workflows-table-count","indexing-runs-table-count","indexing-domains-table-count","indexing-tools-table-count","indexing-audits-table-count","indexing-issues-table-count","indexing-operational-values-table-count","indexing-transactions-table-count"],"order-by":[{"field":"records","direction":"desc"},{"field":"table","direction":"asc"}]},{"name":"indexing-transactions","subject":"Prepare retained ingestion transactions for card presentation.","objective":"Expose transaction identity, kind, timestamp, committed-record count, and payload hash for ingestion traceability.","acceptance":"Projected fields match retained transactions without implying successful upstream coverage from a committed count or hash alone; missing transactions require a freshness and availability check.","from":"transactions","select":[{"field":"id"},{"field":"kind"},{"field":"createdAt","as":"created-at"},{"field":"committedRecords","as":"committed-records"},{"field":"payloadHash","as":"payload-hash"}]},{"name":"engines-models-sample-distribution","subject":"Describe agent and model combinations in the seven-day statistical run sample.","objective":"Find sampled combinations to investigate without scanning the full retained run history.","acceptance":"Count unweighted selected Runs after frame selection. Keep statistical-frame-id in grouped rows and frame metadata on empty results. Zero-allocation strata are not population zeros. Preserve unknown identifiers; failure reserves can alter composition. Never mix sample counts with exact usage or infer population shares.","description":"Unweighted composition of the seven-day statistical sample; not a population estimate. Failure outcomes may be oversampled.","from":"statistical-runs","compute":[{"as":"summary","function":"concat","args":[{"field":"agent-id"},{"value":" / "},{"field":"model-id"}]}],"aggregate":{"by":["summary","statistical-frame-id"],"values":[{"field":"run","as":"sampled-runs","reducer":"count"}]},"order-by":[{"field":"sampled-runs","direction":"desc"},{"field":"summary","direction":"asc"}]},{"name":"engines-models-usage","subject":"Summarize run-level AIC and token usage by agent and model identifiers without treating unavailable telemetry as zero.","objective":"Locate agent and model combinations whose observed per-run AIC or token usage merits checking against individual runs.","acceptance":"Report run counts and native minimum, mean, and maximum values only for reported metrics; inspect underlying runs for per-metric telemetry coverage and context before comparing combinations, and infer neither efficiency nor outcome value from usage alone.","description":"Observed workflow runs grouped by agent ID and model ID. AIC statistics use only positive-AIC runs; token statistics use runs that reported each token metric.","from":"runs","compute":[{"as":"summary","function":"concat","args":[{"field":"agent-id"},{"value":" / "},{"field":"model-id"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["summary"],"values":[{"field":"run","as":"runs","reducer":"count"},{"field":"aic-total","as":"minimum-aic-per-run","reducer":"min","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"aic-total","as":"average-aic-per-run","reducer":"mean","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"aic-total","as":"maximum-aic-per-run","reducer":"max","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"input-tokens","as":"minimum-input-tokens-per-run","reducer":"min"},{"field":"input-tokens","as":"average-input-tokens-per-run","reducer":"mean"},{"field":"input-tokens","as":"maximum-input-tokens-per-run","reducer":"max"},{"field":"output-tokens","as":"minimum-output-tokens-per-run","reducer":"min"},{"field":"output-tokens","as":"average-output-tokens-per-run","reducer":"mean"},{"field":"output-tokens","as":"maximum-output-tokens-per-run","reducer":"max"},{"field":"cache-read-tokens","as":"minimum-cache-read-tokens-per-run","reducer":"min"},{"field":"cache-read-tokens","as":"average-cache-read-tokens-per-run","reducer":"mean"},{"field":"cache-read-tokens","as":"maximum-cache-read-tokens-per-run","reducer":"max"},{"field":"cache-write-tokens","as":"minimum-cache-write-tokens-per-run","reducer":"min"},{"field":"cache-write-tokens","as":"average-cache-write-tokens-per-run","reducer":"mean"},{"field":"cache-write-tokens","as":"maximum-cache-write-tokens-per-run","reducer":"max"},{"field":"reasoning-tokens","as":"minimum-reasoning-tokens-per-run","reducer":"min"},{"field":"reasoning-tokens","as":"average-reasoning-tokens-per-run","reducer":"mean"},{"field":"reasoning-tokens","as":"maximum-reasoning-tokens-per-run","reducer":"max"}]},"select":[{"field":"summary"},{"field":"runs"},{"field":"average-aic-per-run"},{"field":"minimum-aic-per-run"},{"field":"maximum-aic-per-run"},{"field":"minimum-input-tokens-per-run"},{"field":"average-input-tokens-per-run"},{"field":"maximum-input-tokens-per-run"},{"field":"minimum-output-tokens-per-run"},{"field":"average-output-tokens-per-run"},{"field":"maximum-output-tokens-per-run"},{"field":"minimum-cache-read-tokens-per-run"},{"field":"average-cache-read-tokens-per-run"},{"field":"maximum-cache-read-tokens-per-run"},{"field":"minimum-cache-write-tokens-per-run"},{"field":"average-cache-write-tokens-per-run"},{"field":"maximum-cache-write-tokens-per-run"},{"field":"minimum-reasoning-tokens-per-run"},{"field":"average-reasoning-tokens-per-run"},{"field":"maximum-reasoning-tokens-per-run"}],"order-by":[{"field":"runs","direction":"desc"},{"field":"summary","direction":"asc"}]},{"name":"skill-invocations","subject":"Select observed skill invocations for skill usage analytics.","objective":"Expose skill event identity, scope, invocation counts, and failed counts for downstream usage analysis.","acceptance":"Keep each observed event and its repository/workflow attribution with native counts; missing records or failed counts alone do not establish whether a skill was useful or available.","from":"skills","select":[{"field":"event","as":"id"},{"field":"name","as":"skill"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"invocation-count"},{"field":"failed-count"}]},{"name":"skill-invocations-by-skill","subject":"Rank skills by their observed invocation count.","objective":"Identify skills with the highest observed invocation totals for follow-up inspection.","acceptance":"Sum observed invocation counts by skill and retain the rank as a usage description; do not equate popularity with effectiveness or infer unobserved invocations.","from":"skill-invocations","aggregate":{"by":["skill"],"values":[{"field":"invocation-count","as":"invocations","reducer":"sum"}]},"order-by":[{"field":"invocations","direction":"desc"},{"field":"skill","direction":"asc"}]},{"name":"skill-invocations-by-workflow-totals","subject":"Rank workflows by their observed skill invocation count.","objective":"Produce repository-scoped workflow invocation totals for downstream skill-usage comparison.","acceptance":"Sum observed invocation counts by organization, repository, and workflow; totals describe recorded usage only, not success or expected adoption.","from":"skill-invocations","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"invocation-count","as":"invocations","reducer":"sum"}]}},{"name":"skill-invocations-by-workflow","subject":"Present workflow skill invocation totals with drill-through navigation to the workflow dashboard.","objective":"Expose observed workflow skill invocation totals with a link to inspect each workflow.","acceptance":"Each projected workflow coordinate, link, and invocation total traces to the grouped source; using a link to investigate does not establish that usage caused an outcome.","from":"skill-invocations-by-workflow-totals","compute":[{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-coordinate"}]}],"select":[{"field":"workflow-coordinate"},{"field":"workflow-link"},{"field":"invocations"}],"order-by":[{"field":"invocations","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}]},{"name":"skill-workflow-totals","subject":"Count observed invocations for each skill and workflow.","objective":"Produce skill-by-workflow invocation totals for the downstream inventory.","acceptance":"Sum observed invocation counts by skill, organization, repository, and workflow; missing combinations are not evidence that a skill could not run.","from":"skill-invocations","aggregate":{"by":["skill","organization","repository","workflow"],"values":[{"field":"invocation-count","as":"invocations","reducer":"sum"}]}},{"name":"skill-workflow-inventory","subject":"List observed skills by workflow with drill-through navigation to the workflow dashboard.","objective":"Identify observed skill/workflow combinations and provide a workflow link for inspecting their runs.","acceptance":"Show the repository, workflow, skill, link, and observed invocation total from the grouped evidence; an absent row does not prove non-use, and a high count does not prove effectiveness.","from":"skill-workflow-totals","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-coordinate"}]}],"select":[{"field":"skill"},{"field":"repository-coordinate"},{"field":"workflow"},{"field":"workflow-link"},{"field":"invocations"}],"order-by":[{"field":"invocations","direction":"desc"},{"field":"skill","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"experiment-assignment-coverage","subject":"Count observed run assignments for each experiment and workflow without inferring a completion target.","objective":"Expose assignment counts by experiment and workflow for investigating observed experiment coverage.","acceptance":"Count retained assignment rows in each experiment/workflow group, not distinct runs; do not invent a target, infer missing assignments from absent groups, or treat assignments as eval or grader outcomes.","from":"experiment-assignments","compute":[{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}],"aggregate":{"by":["workflow-coordinate","experiment"],"values":[{"field":"run","as":"assignments","reducer":"count"}]}},{"name":"eval-status-ledger","subject":"Inspect every explicitly classified eval answer, including UNKNOWN.","objective":"Expose retained eval observations with their workflow, run evidence and observation time.","acceptance":"Keep recorded YES, NO and UNKNOWN answers distinct; unknown or absent evidence must not imply success or failure, and historical answers are not current verdicts or validated operational outcomes.","from":"eval-observations","compute":[{"as":"_recorded-run-href","function":"link-href","args":[{"field":"evidence-link"}]},{"as":"_eval-run-href","function":"coalesce","args":[{"field":"_recorded-run-href"},{"field":"evidence-link"}]},{"as":"run-link","function":"link","args":[{"field":"_eval-run-href"},{"field":"run"}]}],"filter":{"predicates":[{"field":"eval-result","in":["YES","NO","UNKNOWN"]}]}},{"name":"eval-answer-counts","subject":"Count recorded YES, NO and UNKNOWN answers for each workflow-scoped eval.","objective":"Provide complete answer denominators before expanding each eval into three bars.","acceptance":"Keep canonical eval identities separate and count only explicitly classified observations. Select at most 33 complete eval groups, never truncate an answer group.","from":"eval-status-ledger","aggregate":{"by":["organization","repository","workflow","eval"],"values":[{"field":"eval-result","as":"answers","reducer":"count"},{"field":"eval-result","as":"yes","reducer":"count","filter":{"predicates":[{"field":"eval-result","equals":"YES"}]}},{"field":"eval-result","as":"no","reducer":"count","filter":{"predicates":[{"field":"eval-result","equals":"NO"}]}},{"field":"eval-result","as":"unknown","reducer":"count","filter":{"predicates":[{"field":"eval-result","equals":"UNKNOWN"}]}}]},"order-by":[{"field":"eval","direction":"asc"},{"field":"organization","direction":"asc"},{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}],"limit":33},{"name":"eval-yes-shares","subject":"Compute the YES share of each eval's recorded answers.","objective":"Expose recorded YES proportions for comparing answer categories without inferring verified operational outcomes.","acceptance":"Emit one YES row per retained canonical eval group, including zero YES counts; answer-share is yes / answers across recorded YES, NO and UNKNOWN observations. Do not count absent observations.","from":"eval-answer-counts","compute":[{"as":"eval-result","function":"literal","args":[{"value":"YES"}]},{"as":"answer-order","function":"literal","args":[{"value":0}]},{"as":"answer-share","function":"quotient","args":[{"field":"yes"},{"field":"answers"}]}]},{"name":"eval-no-shares","subject":"Compute the NO share of each eval's recorded answers.","objective":"Expose recorded NO proportions for comparing answer categories without treating historical answers as current verdicts.","acceptance":"Emit one NO row per retained canonical eval group, including zero NO counts; answer-share is no / answers across recorded YES, NO and UNKNOWN observations. Do not count absent observations.","from":"eval-answer-counts","compute":[{"as":"eval-result","function":"literal","args":[{"value":"NO"}]},{"as":"answer-order","function":"literal","args":[{"value":1}]},{"as":"answer-share","function":"quotient","args":[{"field":"no"},{"field":"answers"}]}]},{"name":"eval-unknown-shares","subject":"Compute the explicit UNKNOWN share of each eval's recorded answers.","objective":"Expose explicitly recorded UNKNOWN proportions without conflating absent observations with classified uncertainty.","acceptance":"Emit one UNKNOWN row per retained canonical eval group, including zero UNKNOWN counts; answer-share is unknown / answers across recorded YES, NO and UNKNOWN observations. Missing observations are not UNKNOWN answers.","from":"eval-answer-counts","compute":[{"as":"eval-result","function":"literal","args":[{"value":"UNKNOWN"}]},{"as":"answer-order","function":"literal","args":[{"value":2}]},{"as":"answer-share","function":"quotient","args":[{"field":"unknown"},{"field":"answers"}]}]},{"name":"eval-answer-distribution","subject":"Compare YES, NO and UNKNOWN percentages within each eval.","objective":"Show three horizontal bars per eval that together account for all recorded answers.","acceptance":"Emit all three answer categories, including zero shares; percentages sum to 100 per canonical eval. Missing observations are not UNKNOWN answers. Preserve workflow and repository attribution.","from":"eval-yes-shares","union":["eval-no-shares","eval-unknown-shares"],"compute":[{"as":"answer-percent","function":"product","args":[{"field":"answer-share"},{"value":100}]},{"as":"eval-label","function":"concat","args":[{"field":"eval"},{"value":" | "},{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}],"order-by":[{"field":"eval-label","direction":"asc"},{"field":"answer-order","direction":"asc"}]},{"name":"grader-observed-maxima","subject":"Find each workflow-scoped grader's maximum retained value in the selected data.","objective":"Provide an observed normalization denominator without mixing grader identities or claiming a theoretical maximum.","acceptance":"Group by canonical grader identity, not display name; ignore missing values and preserve zero or negative maxima without substituting a denominator.","from":"grader-observations","aggregate":{"by":["grader-id"],"values":[{"field":"value","as":"max-grader-value","reducer":"max"}]}},{"name":"grader-normalized-observations","subject":"Normalize each grader observation by that grader's observed maximum.","objective":"Compare relative grader values over time while preserving native measurements and run provenance.","acceptance":"Compute value / max-grader-value without clamping or inverting lower-is-better measures; zero or missing denominators produce null, never a fabricated zero or infinity.","from":"grader-observations","joins":[{"source":"grader-observed-maxima","type":"left","on":[{"left":"grader-id","right":"grader-id"}],"fields":[{"field":"max-grader-value","as":"max-grader-value"}]}],"compute":[{"as":"normalized-value","function":"quotient","args":[{"field":"value"},{"field":"max-grader-value"}]},{"as":"_observation-time","function":"timestamp","args":[{"field":"observed-at"}]},{"as":"_unplottable-value","function":"equals-any","args":[{"field":"normalized-value"},{"value":null}]},{"as":"_unplottable-time","function":"equals-any","args":[{"field":"_observation-time"},{"value":null}]},{"as":"grader-series","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":" / "},{"field":"workflow"},{"value":" / "},{"field":"grader"}]}]},{"name":"grader-value-scatter","subject":"Plot timed grader observations with a defined value-to-observed-maximum ratio.","objective":"Show relative grader measurements at their recorded observation times.","acceptance":"Keep each eligible observation and its run link; omit missing ratios or observation times from the plot while retaining those records in the native-value ledger. Ratios are not eval answers or evidence of improvement.","from":"grader-normalized-observations","filter":{"predicates":[{"field":"_unplottable-value","equals":false},{"field":"_unplottable-time","equals":false}]},"order-by":[{"field":"observed-at","direction":"asc"}]},{"name":"grader-status-ledger","subject":"Report grader measurements, units and explicit statuses without confusing them with binary eval answers.","objective":"Preserve numeric grader evidence and distinguish explicit per-observation pass and fail verdicts from unknown statuses.","acceptance":"Retain native grader values, units and statuses. Map only pass/passed to YES and fail/failed to NO in the auxiliary verdict field, leaving all other statuses unknown; never infer an eval answer, current success, causation or policy authority from a grader score.","from":"grader-observations","compute":[{"as":"is-pass","function":"equals-any","args":[{"field":"status"},{"value":"pass"},{"value":"passed"}]},{"as":"is-fail","function":"equals-any","args":[{"field":"status"},{"value":"fail"},{"value":"failed"}]},{"as":"non-pass-verdict","function":"if","args":[{"field":"is-fail"},{"value":"NO"},{"value":"unknown"}]},{"as":"verdict","function":"if","args":[{"field":"is-pass"},{"value":"YES"},{"field":"non-pass-verdict"}]}]},{"name":"routing-session-observations","subject":"Read metadata-only unified-session routing evidence.","objective":"Keep routing analytics independent of native logs and inferred run totals.","acceptance":"Only recognized session events contribute; event clocks remain absent when unrecorded.","from":"audits","filter":{"predicates":[{"field":"event-type","in":["session.format","workflow.info","workflow.job_result","agent.execution","firewall.model_routing","firewall.token_usage","usage.report","firewall.steering","firewall.upstream_error","model.config","model.baseline_estimate","model.resolution","model_routing.outcome","model_endpoint.mismatch","session.collection","session.collection_warning","subagent.request","subagent.started","subagent.configured","subagent.completed","subagent.failed","subagent.model_unavailable"]}]},"compute":[{"as":"record-clock","function":"timestamp","args":[{"field":"event-timestamp"}]},{"as":"event-clock","function":"coalesce","args":[{"field":"routing-session-clock"},{"field":"record-clock"}]},{"as":"routing-run-key","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"run"}]},{"as":"agent-phase","function":"equals-any","args":[{"field":"phase"},{"value":"agent"}]},{"as":"proxy-selection","function":"equals-any","args":[{"field":"routing-stage"},{"value":"selection"}]},{"as":"proxy-failure","function":"equals-any","args":[{"field":"routing-stage"},{"value":"failure"}]},{"as":"has-agent-name","function":"greater-than","args":[{"field":"routing-agent-name"},{"value":""}]}]},{"name":"routing-session-attempts","from":"routing-session-observations","subject":"Identify available session files and their earliest recorded clocks.","objective":"Keep rerun attempts from multiplying routing denominators.","acceptance":"Attempt order is only a tie-breaker after the recorded session clock.","aggregate":{"by":["routing-run-key","run-attempt"],"values":[{"field":"event-clock","as":"session-clock","reducer":"min"}]}},{"name":"routing-session-order","from":"routing-session-attempts","subject":"Order duplicate run sessions by run time and attempt.","objective":"Keep the latest file for each repository/run identity.","acceptance":"Only one attempt contributes to routing facts.","window":[{"operation":"row-number","field":"run-attempt","as":"session-position","groupby":["routing-run-key"],"order-by":[{"field":"session-clock","direction":"desc"},{"field":"run-attempt","direction":"desc"}]}]},{"name":"routing-latest-sessions","from":"routing-session-order","subject":"Retain one authoritative session attempt per run.","objective":"Avoid mixing picks or accounting from reruns.","acceptance":"Duplicate attempts remain available in session coverage.","filter":{"predicates":[{"field":"session-position","equals":1}]}},{"name":"routing-session-events","from":"routing-session-observations","subject":"Read routing metadata from the latest session file per run.","objective":"Deduplicate rerun attempts before any metric.","acceptance":"Earlier attempts never add cost or change the selected pick.","joins":[{"source":"routing-latest-sessions","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"session-clock","as":"session-clock"}]}]},{"name":"routing-run-facts","subject":"Collect per-session source facts without interpreting absence as success.","objective":"Resolve routing states and coverage from runner and proxy evidence.","acceptance":"Agent-phase proxy selection wins over failure and harness status; untimed observations keep unknown time.","from":"routing-session-events","aggregate":{"by":["routing-run-key","organization","repository","workflow","run"],"values":[{"field":"event-clock","as":"run-clock","reducer":"min"},{"field":"run-link","as":"run-link","reducer":"unique"},{"field":"engine","as":"engine","reducer":"unique"},{"field":"event","as":"workflow-info-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"},{"field":"required","equals":true}]}},{"field":"event-status","as":"session-format","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"session.format"}]}},{"field":"event","as":"selection-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"selection"},{"field":"phase","equals":"agent"}]}},{"field":"event","as":"failure-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"failure"},{"field":"phase","equals":"agent"}]}},{"field":"event","as":"local-effort-failures","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"failure"},{"field":"code","equals":"unsupported_reasoning_effort"}]}},{"field":"event","as":"proxy-record-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"phase","equals":"agent"}]}},{"field":"event","as":"agent-accounting-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.token_usage"},{"field":"phase","equals":"agent"}]}},{"field":"event","as":"subagent-count","reducer":"count","filter":{"predicates":[{"field":"event-type","in":["subagent.started","subagent.request","subagent.configured","subagent.completed","subagent.failed","subagent.model_unavailable"]}]}},{"field":"routing-status","as":"harness-status","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-enabled","as":"configured-enabled","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"model.config"}]}},{"field":"routing-selected-model","as":"harness-model","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"telemetry-model","as":"workflow-model","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-selected-effort","as":"harness-effort","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-mode","as":"harness-mode","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-awf-version","as":"session-awf-version","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-goal","as":"configured-goal","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"model.config"}]}},{"field":"routing-configured-mode","as":"configured-routing-mode","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"model.config"}]}},{"field":"routing-max-credits","as":"configured-max-credits","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"model.config"}]}},{"field":"event-status","as":"agent-result","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.job_result"},{"field":"name","equals":"agent"},{"field":"event-status","in":["success","failure","cancelled","skipped"]}]}},{"field":"event","as":"warnings","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"session.collection_warning"}]}}]}},{"name":"routing-ordered-selections","subject":"Order proxy selections within each session.","objective":"Use the last selection by normalized clock and file order.","acceptance":"Harness and advisory picks never override proxy selections.","from":"routing-session-events","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"selection"},{"field":"phase","equals":"agent"}]},"window":[{"operation":"row-number","field":"source-sequence","as":"selection-position","groupby":["routing-run-key"],"order-by":[{"field":"event-timestamp","direction":"desc"},{"field":"source-sequence","direction":"desc"}]}]},{"name":"routing-selections","subject":"Retain one authoritative proxy pick per run.","objective":"Avoid multiplying requests or run counts after re-selection.","acceptance":"One row per identified run uses the final proxy selection.","from":"routing-ordered-selections","filter":{"predicates":[{"field":"selection-position","equals":1}]}},{"name":"routing-resolved-runs","subject":"Resolve routing state, pick and label cells from unified sessions.","objective":"Distinguish selected, failed, harness-only, configured, inferred and unknown evidence.","acceptance":"Proxy evidence wins; configuration conflicts are visible; missing picks and time remain unknown.","from":"routing-run-facts","joins":[{"source":"routing-selections","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"routing-selected-model","as":"proxy-model"},{"field":"routing-selected-effort","as":"proxy-effort"},{"field":"routing-goal","as":"proxy-goal"},{"field":"routing-mode","as":"proxy-mode"},{"field":"routing-configured-mode","as":"proxy-configured-mode"},{"field":"routing-task-type","as":"routing-task-type"},{"field":"routing-scope","as":"routing-scope"},{"field":"routing-complexity","as":"routing-complexity"},{"field":"routing-latency-ms","as":"routing-latency-ms"},{"field":"routing-degraded","as":"routing-degraded"},{"field":"routing-classifier-attempts","as":"routing-classifier-attempts"},{"field":"routing-classifier-model","as":"routing-classifier-model"},{"field":"routing-classifier-effort","as":"routing-classifier-effort"},{"field":"routing-schema","as":"routing-schema"},{"field":"routing-awf-version","as":"proxy-awf-version"},{"field":"routing-router-version","as":"routing-router-version"}]}],"compute":[{"as":"observed-at","function":"iso-timestamp","args":[{"field":"run-clock"}]},{"as":"routing-awf-version","function":"coalesce","args":[{"field":"session-awf-version"},{"field":"proxy-awf-version"}]},{"as":"routing-mode","function":"coalesce","args":[{"field":"proxy-mode"},{"field":"harness-mode"}]},{"as":"routing-goal","function":"coalesce","args":[{"field":"proxy-goal"},{"field":"configured-goal"}]},{"as":"routing-configured-mode","function":"coalesce","args":[{"field":"proxy-configured-mode"},{"field":"configured-routing-mode"}]},{"as":"has-selection","function":"greater-than","args":[{"field":"selection-count"},{"value":0}]},{"as":"has-failure","function":"greater-than","args":[{"field":"failure-count"},{"value":0}]},{"as":"has-harness","function":"equals-any","args":[{"field":"harness-status"},{"value":null}]},{"as":"has-usage","function":"greater-than","args":[{"field":"agent-accounting-count"},{"value":0}]},{"as":"no-proxy","function":"equals-any","args":[{"field":"proxy-record-count"},{"value":0}]},{"as":"usage-state","function":"if","args":[{"field":"has-usage"},{"value":"unrouted_inferred"},{"value":"unknown"}]},{"as":"inferred-state","function":"if","args":[{"field":"no-proxy"},{"field":"usage-state"},{"value":"unknown"}]},{"as":"enabled","function":"equals-any","args":[{"field":"configured-enabled"},{"value":true}]},{"as":"disabled","function":"equals-any","args":[{"field":"configured-enabled"},{"value":false}]},{"as":"enabled-state","function":"if","args":[{"field":"enabled"},{"value":"configured_unrecorded"},{"field":"inferred-state"}]},{"as":"configured-state","function":"if","args":[{"field":"disabled"},{"value":"unrouted"},{"field":"enabled-state"}]},{"as":"reported-state","function":"if","args":[{"field":"has-harness"},{"field":"configured-state"},{"value":"harness_reported"}]},{"as":"failure-state","function":"if","args":[{"field":"has-failure"},{"value":"selection_failed"},{"field":"reported-state"}]},{"as":"routing-state","function":"if","args":[{"field":"has-selection"},{"value":"selected"},{"field":"failure-state"}]},{"as":"observed-pick-model","function":"if","args":[{"field":"has-selection"},{"field":"proxy-model"},{"field":"harness-model"}]},{"as":"observed-pick-effort","function":"if","args":[{"field":"has-selection"},{"field":"proxy-effort"},{"field":"harness-effort"}]},{"as":"pick-model","function":"coalesce","args":[{"field":"observed-pick-model"},{"value":"unknown"}]},{"as":"pick-effort","function":"coalesce","args":[{"field":"observed-pick-effort"},{"value":"unknown"}]},{"as":"pick","function":"concat","args":[{"field":"pick-model"},{"value":" / "},{"field":"pick-effort"}]},{"as":"has-proxy-decision","function":"if","args":[{"field":"has-selection"},{"value":true},{"field":"has-failure"}]},{"as":"has-decision","function":"if","args":[{"field":"has-harness"},{"field":"has-proxy-decision"},{"value":true}]},{"as":"configuration-conflict","function":"if","args":[{"field":"disabled"},{"field":"has-decision"},{"value":false}]},{"as":"unknown-pick-model","function":"equals-any","args":[{"field":"pick-model"},{"value":"unknown"}]},{"as":"unknown-pick-effort","function":"equals-any","args":[{"field":"pick-effort"},{"value":"unknown"}]},{"as":"unknown-pick","function":"if","args":[{"field":"unknown-pick-model"},{"value":true},{"field":"unknown-pick-effort"}]},{"as":"routing-key-encoded","function":"url-encode","args":[{"field":"routing-run-key"}]},{"as":"routing-href","function":"concat","args":[{"value":"#page-routing-run?routing-run="},{"field":"routing-key-encoded"}]},{"as":"routing-dashboard-link","function":"dashboard-link","args":[{"field":"run-link"},{"field":"routing-href"},{"field":"run"}]}],"filter":{"predicates":[{"field":"workflow-info-count","gte":1}]}},{"name":"routing-filter-candidates","from":"routing-aggregates","subject":"Apply one run-level scope before every routing metric and event join.","objective":"Filter complete sessions, never fragments of their evidence.","acceptance":"Unknown run time is excluded from a bounded range; blank filters retain all known values.","parameters":[{"name":"routing-filter-workflow","type":"string"},{"name":"routing-filter-repository","type":"string"},{"name":"routing-filter-engine","type":"string"},{"name":"routing-filter-state","type":"string"},{"name":"routing-filter-goal","type":"string"},{"name":"routing-filter-mode","type":"string"},{"name":"routing-filter-awf","type":"string"},{"name":"routing-filter-start","type":"string"},{"name":"routing-filter-end","type":"string"}],"compute":[{"as":"full-repository","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"all-workflows","function":"equals-any","args":[{"parameter":"routing-filter-workflow"},{"value":""}]},{"as":"same-workflow","function":"equals-any","args":[{"field":"workflow"},{"parameter":"routing-filter-workflow"}]},{"as":"include-workflow","function":"if","args":[{"field":"all-workflows"},{"value":true},{"field":"same-workflow"}]},{"as":"all-repositories","function":"equals-any","args":[{"parameter":"routing-filter-repository"},{"value":""}]},{"as":"same-repository","function":"equals-any","args":[{"field":"full-repository"},{"parameter":"routing-filter-repository"}]},{"as":"include-repository","function":"if","args":[{"field":"all-repositories"},{"value":true},{"field":"same-repository"}]},{"as":"all-engines","function":"equals-any","args":[{"parameter":"routing-filter-engine"},{"value":""}]},{"as":"same-engine","function":"equals-any","args":[{"field":"engine"},{"parameter":"routing-filter-engine"}]},{"as":"include-engine","function":"if","args":[{"field":"all-engines"},{"value":true},{"field":"same-engine"}]},{"as":"all-states","function":"equals-any","args":[{"parameter":"routing-filter-state"},{"value":""}]},{"as":"same-state","function":"equals-any","args":[{"field":"routing-state"},{"parameter":"routing-filter-state"}]},{"as":"include-state","function":"if","args":[{"field":"all-states"},{"value":true},{"field":"same-state"}]},{"as":"all-goals","function":"equals-any","args":[{"parameter":"routing-filter-goal"},{"value":""}]},{"as":"same-goal","function":"equals-any","args":[{"field":"routing-goal"},{"parameter":"routing-filter-goal"}]},{"as":"include-goal","function":"if","args":[{"field":"all-goals"},{"value":true},{"field":"same-goal"}]},{"as":"all-modes","function":"equals-any","args":[{"parameter":"routing-filter-mode"},{"value":""}]},{"as":"same-mode","function":"equals-any","args":[{"field":"routing-mode"},{"parameter":"routing-filter-mode"}]},{"as":"include-mode","function":"if","args":[{"field":"all-modes"},{"value":true},{"field":"same-mode"}]},{"as":"all-awf","function":"equals-any","args":[{"parameter":"routing-filter-awf"},{"value":""}]},{"as":"same-awf","function":"equals-any","args":[{"field":"routing-awf-version"},{"parameter":"routing-filter-awf"}]},{"as":"include-awf","function":"if","args":[{"field":"all-awf"},{"value":true},{"field":"same-awf"}]},{"as":"all-starts","function":"equals-any","args":[{"parameter":"routing-filter-start"},{"value":""}]},{"as":"start-clock","function":"timestamp","args":[{"parameter":"routing-filter-start"}]},{"as":"start-before","function":"difference","args":[{"field":"start-clock"},{"value":1}]},{"as":"after-start","function":"greater-than","args":[{"field":"run-clock"},{"field":"start-before"}]},{"as":"include-start","function":"if","args":[{"field":"all-starts"},{"value":true},{"field":"after-start"}]},{"as":"all-ends","function":"equals-any","args":[{"parameter":"routing-filter-end"},{"value":""}]},{"as":"end-clock","function":"timestamp","args":[{"parameter":"routing-filter-end"}]},{"as":"before-end","function":"greater-than","args":[{"field":"end-clock"},{"field":"run-clock"}]},{"as":"include-end","function":"if","args":[{"field":"all-ends"},{"value":true},{"field":"before-end"}]}]},{"name":"routing-runs","from":"routing-filter-candidates","subject":"Retain identified runs matching every selected routing filter.","objective":"Use the same population for adoption, accounting and outcomes.","acceptance":"A time bound excludes untimed runs and does not remove individual events from retained sessions.","filter":{"predicates":[{"field":"include-workflow","equals":true},{"field":"include-repository","equals":true},{"field":"include-engine","equals":true},{"field":"include-state","equals":true},{"field":"include-goal","equals":true},{"field":"include-mode","equals":true},{"field":"include-awf","equals":true},{"field":"include-start","equals":true},{"field":"include-end","equals":true}]}},{"name":"routing-events","from":"routing-session-events","subject":"Retain all evidence belonging to scoped identified runs.","objective":"Filter event metrics by the resolved run rather than by individual event clocks.","acceptance":"State, pick and accounting are computed before the scope is applied.","joins":[{"source":"routing-runs","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"routing-state","as":"run-routing-state"}]}]},{"name":"routing-phase-sources","subject":"Choose one nonoverlapping accounting source per run and phase.","objective":"Prefer proxy token usage over usage reports.","acceptance":"Snapshot totals and cumulative totalAic never enter additive cost.","from":"routing-events","aggregate":{"by":["routing-run-key","phase"],"values":[{"field":"event","as":"proxy-usage-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.token_usage"}]}},{"field":"event","as":"report-usage-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"usage.report"}]}},{"field":"event","as":"proxy-source-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"session.collection"},{"field":"name","equals":"token-usage.jsonl"},{"field":"event-status","equals":"collected"}]}},{"field":"event","as":"report-source-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"session.collection"},{"field":"name","in":["agent_usage.json","usage.json","usage.jsonl","usage-report.jsonl"]},{"field":"event-status","equals":"collected"}]}}]}},{"name":"routing-accounting-candidates","subject":"Read nonoverlapping per-response accounting records.","objective":"Expose recorded credits and token classes without repricing unknown usage.","acceptance":"Each phase uses proxy accounting when present and usage.report otherwise; absent AIC is counted.","from":"routing-events","joins":[{"source":"routing-phase-sources","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"}],"fields":[{"field":"proxy-usage-count","as":"proxy-usage-count"}]}],"compute":[{"as":"has-proxy-accounting","function":"greater-than","args":[{"field":"proxy-usage-count"},{"value":0}]},{"as":"accounting-identity","function":"coalesce","args":[{"field":"correlation-id"},{"field":"event"}]},{"as":"accounting-source","function":"if","args":[{"field":"has-proxy-accounting"},{"value":"firewall.token_usage"},{"value":"usage.report"}]},{"as":"selected-accounting","function":"equals-any","args":[{"field":"event-type"},{"field":"accounting-source"}]},{"as":"unknown-aic","function":"equals-any","args":[{"field":"aic"},{"value":null}]},{"as":"unknown-aic-count","function":"if","args":[{"field":"unknown-aic"},{"value":1},{"value":0}]}],"window":[{"operation":"row-number","field":"source-sequence","as":"accounting-position","groupby":["routing-run-key","phase","event-type","accounting-identity"],"order-by":[{"field":"event-timestamp","direction":"desc"},{"field":"source-sequence","direction":"desc"}]}]},{"name":"routing-accounting","subject":"Select the authoritative accounting source for each phase.","objective":"Exclude overlapping usage reports and snapshots.","acceptance":"Every accounting row contributes at most once.","from":"routing-accounting-candidates","filter":{"predicates":[{"field":"selected-accounting","equals":true},{"field":"accounting-position","equals":1},{"field":"phase","in":["agent","detection","evals"]}]}},{"name":"routing-request-candidates","subject":"Keep per-request routing decisions separate from accounting.","objective":"Join routed outcomes by run, phase and request ID.","acceptance":"Rejected requests establish local zero cost; other unmatched requests retain unknown cost.","from":"routing-events","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"request"}]},"compute":[{"as":"request-identity","function":"coalesce","args":[{"field":"correlation-id"},{"field":"event"}]}],"window":[{"operation":"row-number","field":"source-sequence","as":"request-position","groupby":["routing-run-key","phase","request-identity"],"order-by":[{"field":"event-timestamp","direction":"desc"},{"field":"source-sequence","direction":"desc"}]}]},{"name":"routing-request-records","from":"routing-request-candidates","subject":"Retain the latest record for each request identity.","objective":"Avoid duplicate request joins and overlapping totals.","acceptance":"Requests without IDs remain independent, not falsely correlated.","filter":{"predicates":[{"field":"request-position","equals":1}]}},{"name":"routing-subagent-candidates","subject":"Read engine-reported sub-agent request ownership.","objective":"Use exact request-ID ownership before falling back to unsplit traffic.","acceptance":"Only request identities can assign exact ownership; advisory outcomes never assign credits.","from":"routing-events","filter":{"predicates":[{"field":"event-type","equals":"subagent.request"}]},"compute":[{"as":"subagent-identity","function":"coalesce","args":[{"field":"correlation-id"},{"field":"event"}]}],"window":[{"operation":"row-number","field":"source-sequence","as":"subagent-position","groupby":["routing-run-key","phase","subagent-identity"],"order-by":[{"field":"event-timestamp","direction":"desc"},{"field":"source-sequence","direction":"desc"}]}]},{"name":"routing-subagent-requests","from":"routing-subagent-candidates","subject":"Retain one sub-agent observation per request identity.","objective":"Keep exact ownership joins unique.","acceptance":"Missing identities do not match unrelated requests.","filter":{"predicates":[{"field":"subagent-position","equals":1}]}},{"name":"routing-exact-accounting","subject":"Attribute each accounting record to exactly one traffic bucket.","objective":"Keep detection, evals, classifier, exact sub-agent, main, unsplit and unattributed credits distinct.","acceptance":"Detection and evals use phase, missing purpose is never agent by default, and snapshot credits are excluded.","from":"routing-accounting","joins":[{"source":"routing-request-records","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"},{"left":"correlation-id","right":"correlation-id"}],"fields":[{"field":"event","as":"request-event"},{"field":"routing-routed","as":"request-routed"},{"field":"routing-deviations","as":"request-deviations"},{"field":"routing-outcome","as":"request-outcome"},{"field":"routing-requested-model","as":"request-model"},{"field":"routing-requested-effort","as":"request-effort"}]},{"source":"routing-subagent-requests","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"},{"left":"correlation-id","right":"correlation-id"}],"fields":[{"field":"routing-agent-name","as":"exact-agent-name"}]},{"source":"routing-run-facts","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"subagent-count","as":"subagent-count"}]}],"compute":[{"as":"exact-owner","function":"coalesce","args":[{"field":"routing-agent-name"},{"field":"exact-agent-name"}]},{"as":"no-exact-owner","function":"equals-any","args":[{"field":"exact-owner"},{"value":null}]}]},{"name":"routing-correlation-usage-candidates","from":"routing-exact-accounting","subject":"Find accounting records without exact sub-agent ownership.","objective":"Correlate only fully recorded token quartets in file order.","acceptance":"Missing token classes never match by model alone.","filter":{"predicates":[{"field":"phase","equals":"agent"},{"field":"no-exact-owner","equals":true}]},"compute":[{"as":"token-quartet","function":"sum","args":[{"field":"input-tokens"},{"field":"output-tokens"},{"field":"cache-read-tokens"},{"field":"cache-write-tokens"}]},{"as":"is-classifier","function":"equals-any","args":[{"field":"routing-purpose"},{"value":"routing_classification"}]}]},{"name":"routing-correlation-usage","from":"routing-correlation-usage-candidates","subject":"Order unmatched accounting within model and token quartet.","objective":"Match each engine-reported request at most once.","acceptance":"Classifier, incomplete and already-exact requests are excluded.","filter":{"predicates":[{"field":"token-quartet","gte":0},{"field":"is-classifier","equals":false}]},"window":[{"operation":"row-number","field":"source-sequence","as":"correlation-position","groupby":["routing-run-key","telemetry-model","input-tokens","output-tokens","cache-read-tokens","cache-write-tokens"],"order-by":[{"field":"source-sequence","direction":"asc"}]}]},{"name":"routing-correlation-subagent-candidates","from":"routing-subagent-requests","subject":"Exclude engine requests already matched by proxy request ID.","objective":"Prevent exact and correlated ownership from claiming the same request.","acceptance":"Only engine requests with a complete quartet and a definition name can correlate.","joins":[{"source":"routing-accounting","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"},{"left":"correlation-id","right":"correlation-id"}],"fields":[{"field":"event","as":"exact-accounting-event"}]}],"compute":[{"as":"token-quartet","function":"sum","args":[{"field":"input-tokens"},{"field":"output-tokens"},{"field":"cache-read-tokens"},{"field":"cache-write-tokens"}]}]},{"name":"routing-correlation-subagents","from":"routing-correlation-subagent-candidates","subject":"Order unmatched engine requests within each model/token quartet.","objective":"Produce deterministic one-to-one correlated ownership.","acceptance":"Correlation is labelled separately from exact evidence.","filter":{"predicates":[{"field":"exact-accounting-event","equals":null},{"field":"token-quartet","gte":0},{"field":"phase","equals":"agent"}]},"window":[{"operation":"row-number","field":"source-sequence","as":"correlation-position","groupby":["routing-run-key","telemetry-model","input-tokens","output-tokens","cache-read-tokens","cache-write-tokens"],"order-by":[{"field":"source-sequence","direction":"asc"}]}]},{"name":"routing-correlated-accounting","from":"routing-correlation-usage","subject":"Join proxy usage with unmatched engine requests by model, quartet and occurrence.","objective":"Use the spec's correlated sub-agent attribution without duplicating credits.","acceptance":"Each engine request and accounting record participates at most once.","joins":[{"source":"routing-correlation-subagents","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"telemetry-model","right":"telemetry-model"},{"left":"input-tokens","right":"input-tokens"},{"left":"output-tokens","right":"output-tokens"},{"left":"cache-read-tokens","right":"cache-read-tokens"},{"left":"cache-write-tokens","right":"cache-write-tokens"},{"left":"correlation-position","right":"correlation-position"}],"fields":[{"field":"routing-agent-name","as":"correlated-owner"}]}],"select":[{"field":"routing-run-key"},{"field":"event"},{"field":"correlated-owner"}]},{"name":"routing-attributed-accounting","from":"routing-exact-accounting","subject":"Assign every accounting record to exactly one exclusive bucket.","objective":"Keep exact and correlated sub-agent ownership distinct.","acceptance":"Phase wins over purpose; missing ownership remains unsplit or unattributed.","joins":[{"source":"routing-correlated-accounting","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"event","right":"event"}],"fields":[{"field":"correlated-owner","as":"correlated-owner"}]}],"compute":[{"as":"agent-name","function":"coalesce","args":[{"field":"exact-owner"},{"field":"correlated-owner"}]},{"as":"unknown-agent","function":"equals-any","args":[{"field":"agent-name"},{"value":null}]},{"as":"unknown-request","function":"equals-any","args":[{"field":"request-event"},{"value":null}]},{"as":"has-subagents","function":"greater-than","args":[{"field":"subagent-count"},{"value":0}]},{"as":"is-subagent-purpose","function":"equals-any","args":[{"field":"routing-purpose"},{"value":"subagent"}]},{"as":"is-agent-purpose","function":"equals-any","args":[{"field":"routing-purpose"},{"value":"agent"}]},{"as":"matched-bucket","function":"if","args":[{"field":"has-subagents"},{"value":"agent_unsplit"},{"value":"main_agent"}]},{"as":"request-bucket","function":"if","args":[{"field":"unknown-request"},{"value":"unattributed"},{"field":"matched-bucket"}]},{"as":"subagent-bucket","function":"if","args":[{"field":"is-subagent-purpose"},{"value":"agent_unsplit"},{"field":"request-bucket"}]},{"as":"purpose-bucket","function":"if","args":[{"field":"is-agent-purpose"},{"value":"main_agent"},{"field":"subagent-bucket"}]},{"as":"subagent-attribution","function":"if","args":[{"field":"no-exact-owner"},{"value":"subagent_correlated"},{"value":"subagent_exact"}]},{"as":"ownership-bucket","function":"if","args":[{"field":"unknown-agent"},{"field":"purpose-bucket"},{"field":"subagent-attribution"}]},{"as":"classifier","function":"equals-any","args":[{"field":"routing-purpose"},{"value":"routing_classification"}]},{"as":"classifier-bucket","function":"if","args":[{"field":"classifier"},{"value":"classifier"},{"field":"ownership-bucket"}]},{"as":"evals","function":"equals-any","args":[{"field":"phase"},{"value":"evals"}]},{"as":"phase-bucket","function":"if","args":[{"field":"evals"},{"value":"evals"},{"field":"classifier-bucket"}]},{"as":"detection","function":"equals-any","args":[{"field":"phase"},{"value":"detection"}]},{"as":"bucket","function":"if","args":[{"field":"detection"},{"value":"detection"},{"field":"phase-bucket"}]}]},{"name":"routing-joined-requests","subject":"Inspect per-request deviations and outcomes against proxy picks.","objective":"Keep requests without accounting visible and never invent a deviation cause.","acceptance":"Unmatched requests have unknown cost; each request retains its own requested and selected model.","from":"routing-request-records","joins":[{"source":"routing-accounting","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"},{"left":"correlation-id","right":"correlation-id"}],"fields":[{"field":"aic","as":"accounted-aic"},{"field":"event","as":"accounting-event"}]}],"compute":[{"as":"missing-accounting","function":"equals-any","args":[{"field":"accounting-event"},{"value":null}]},{"as":"failed-request","function":"equals-any","args":[{"field":"routing-outcome"},{"value":"failed"}]},{"as":"failed-unaccounted","function":"if","args":[{"field":"missing-accounting"},{"field":"failed-request"},{"value":false}]}],"order-by":[{"field":"event-timestamp","direction":"desc"}]},{"name":"routing-unaccounted-failures","from":"routing-joined-requests","subject":"Count failed requests lacking accounting per run.","objective":"Recognize only unambiguous AWF-local effort failures.","acceptance":"A run-level effort failure cannot assign zero to multiple failed requests.","aggregate":{"by":["routing-run-key"],"values":[{"field":"event","as":"failed-unaccounted-count","reducer":"count","filter":{"predicates":[{"field":"failed-unaccounted","equals":true}]}}]}},{"name":"routing-deviations","from":"routing-joined-requests","subject":"Resolve explicit local zero costs and preserve all other unknown request costs.","objective":"Avoid partial-cost comparisons based on missing accounting.","acceptance":"Only guard rejection or an unambiguous local effort failure establishes zero AIC.","joins":[{"source":"routing-unaccounted-failures","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"failed-unaccounted-count","as":"failed-unaccounted-count"}]},{"source":"routing-run-facts","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"local-effort-failures","as":"local-effort-failures"}]}],"compute":[{"as":"only-unaccounted-failure","function":"equals-any","args":[{"field":"failed-unaccounted-count"},{"value":1}]},{"as":"has-local-failure","function":"greater-than","args":[{"field":"local-effort-failures"},{"value":0}]},{"as":"unambiguous-local-failure","function":"if","args":[{"field":"only-unaccounted-failure"},{"field":"has-local-failure"},{"value":false}]},{"as":"local-code","function":"equals-any","args":[{"field":"code"},{"value":"unsupported_reasoning_effort"}]},{"as":"local-evidence","function":"if","args":[{"field":"local-code"},{"value":true},{"field":"unambiguous-local-failure"}]},{"as":"local-failure","function":"if","args":[{"field":"failed-request"},{"field":"local-evidence"},{"value":false}]},{"as":"guard-rejection","function":"equals-any","args":[{"field":"routing-outcome"},{"value":"rejected"}]},{"as":"zero-local-cost","function":"if","args":[{"field":"guard-rejection"},{"value":true},{"field":"local-failure"}]},{"as":"local-cost","function":"if","args":[{"field":"zero-local-cost"},{"value":0},{"value":null}]},{"as":"request-aic","function":"coalesce","args":[{"field":"accounted-aic"},{"field":"local-cost"}]},{"as":"unknown-request-cost","function":"equals-any","args":[{"field":"request-aic"},{"value":null}]},{"as":"unknown-request-count","function":"if","args":[{"field":"unknown-request-cost"},{"value":1},{"value":0}]}]},{"name":"routing-phase-usage","from":"routing-accounting","subject":"Sum nonoverlapping accounting per run and phase.","objective":"Establish complete costs only with known response values.","acceptance":"Unknown response costs remain counted.","aggregate":{"by":["routing-run-key","phase"],"values":[{"field":"aic","as":"recorded-aic","reducer":"sum"},{"field":"aic","as":"known-responses","reducer":"count"},{"field":"unknown-aic-count","as":"unknown-responses","reducer":"sum"}]}},{"name":"routing-request-coverage","from":"routing-deviations","subject":"Count requests whose cost remains unknown.","objective":"Exclude incomplete runs from distribution comparisons.","acceptance":"Unmatched nonlocal requests cannot be treated as free.","aggregate":{"by":["routing-run-key","phase"],"values":[{"field":"unknown-request-count","as":"unknown-requests","reducer":"sum"}]}},{"name":"routing-phase-costs","from":"routing-phase-sources","subject":"Evaluate accounting completeness using collected source receipts and request joins.","objective":"Exclude partial costs from medians and comparisons.","acceptance":"A complete phase has its selected accounting source, no missing AIC and no unaccounted nonlocal requests.","joins":[{"source":"routing-phase-usage","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"}],"fields":[{"field":"recorded-aic","as":"recorded-aic"},{"field":"unknown-responses","as":"unknown-responses"},{"field":"known-responses","as":"known-responses"}]},{"source":"routing-request-coverage","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"}],"fields":[{"field":"unknown-requests","as":"unknown-requests"}]}],"compute":[{"as":"has-proxy","function":"greater-than","args":[{"field":"proxy-usage-count"},{"value":0}]},{"as":"has-report","function":"greater-than","args":[{"field":"report-usage-count"},{"value":0}]},{"as":"any-source-count","function":"sum","args":[{"field":"proxy-source-count"},{"field":"report-source-count"}]},{"as":"report-or-empty-source","function":"if","args":[{"field":"has-report"},{"field":"report-source-count"},{"field":"any-source-count"}]},{"as":"accounting-source-count","function":"if","args":[{"field":"has-proxy"},{"field":"proxy-source-count"},{"field":"report-or-empty-source"}]},{"as":"source-present","function":"greater-than","args":[{"field":"accounting-source-count"},{"value":0}]},{"as":"missing-responses","function":"coalesce","args":[{"field":"unknown-responses"},{"value":0}]},{"as":"missing-requests","function":"coalesce","args":[{"field":"unknown-requests"},{"value":0}]},{"as":"missing-count","function":"sum","args":[{"field":"missing-responses"},{"field":"missing-requests"}]},{"as":"all-values-known","function":"equals-any","args":[{"field":"missing-count"},{"value":0}]},{"as":"complete","function":"if","args":[{"field":"source-present"},{"field":"all-values-known"},{"value":false}]},{"as":"known-sum","function":"coalesce","args":[{"field":"recorded-aic"},{"value":0}]},{"as":"complete-aic","function":"if","args":[{"field":"complete"},{"field":"known-sum"},{"value":null}]}]},{"name":"routing-agent-costs","from":"routing-phase-costs","subject":"Select complete or explicitly partial agent-phase costs.","objective":"Keep detection and evals out of agent-phase comparisons.","acceptance":"Classifier remains part of agent-phase cost.","filter":{"predicates":[{"field":"phase","equals":"agent"}]}},{"name":"routing-detection-costs","from":"routing-phase-costs","subject":"Retain detection-phase cost completeness separately.","objective":"Do not count detection as classifier or agent traffic.","acceptance":"Missing detection evidence remains unknown, not zero.","filter":{"predicates":[{"field":"phase","equals":"detection"}]}},{"name":"routing-cost-runs","from":"routing-resolved-runs","subject":"Attach accounting completeness to identified routing runs.","objective":"Provide comparable costs only for complete runs.","acceptance":"An absent cost stays unknown and never inherits aggregate run AIC.","joins":[{"source":"routing-runs","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"main-aic","as":"main-aic"},{"field":"baseline-model","as":"baseline-model"},{"field":"baseline-aic","as":"baseline-aic"},{"field":"baseline-complete","as":"baseline-complete"}]},{"source":"routing-agent-costs","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"complete-aic","as":"complete-aic"},{"field":"complete","as":"cost-complete"},{"field":"missing-count","as":"missing-cost-records"}]},{"source":"routing-detection-costs","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"complete-aic","as":"detection-aic"},{"field":"complete","as":"detection-complete"}]}],"compute":[{"as":"run-cost-complete","function":"if","args":[{"field":"cost-complete"},{"field":"detection-complete"},{"value":false}]},{"as":"run-aic","function":"sum","args":[{"field":"complete-aic"},{"field":"detection-aic"}]},{"as":"budget-use","function":"quotient","args":[{"field":"run-aic"},{"field":"configured-max-credits"}]}]},{"name":"routing-run-summary","from":"routing-runs","subject":"Keep the selected Run's compact routing and baseline evidence visible.","objective":"Preserve the comparison when shorter-lived Audit detail expires.","acceptance":"Retained aggregate costs and baseline evidence survive Audit expiry; absent phase details stay unknown.","joins":[{"source":"routing-cost-runs","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"cost-complete","as":"cost-complete"},{"field":"missing-cost-records","as":"missing-cost-records"},{"field":"detection-aic","as":"detection-aic"},{"field":"run-aic","as":"run-aic"},{"field":"budget-use","as":"budget-use"}]}]},{"name":"routing-weekly-cost-totals","from":"routing-runs","subject":"Summarize complete agent-phase costs by UTC ISO week and routing state.","objective":"Expose trends without including partial costs.","acceptance":"Untimed runs cannot enter time buckets.","filter":{"predicates":[{"field":"run-clock","gte":0}]},"compute":[{"as":"week","function":"date-bucket","args":[{"field":"observed-at"},{"value":"week"}]}],"aggregate":{"by":["week","routing-state"],"values":[{"field":"run","as":"runs","reducer":"count"},{"field":"complete-aic","as":"complete-runs","reducer":"count"},{"field":"complete-aic","as":"observed-median","reducer":"median"}]}},{"name":"routing-weekly-accounting-cost","from":"routing-weekly-cost-totals","subject":"Gate weekly medians by complete sample size.","objective":"Keep sparse weeks from implying meaningful cost trends.","acceptance":"Weeks below the configurable minimum display insufficient data.","parameters":[{"name":"minimum-sample","type":"number"}],"compute":[{"as":"cost-series","function":"concat","args":[{"value":"Agent-phase accounting: "},{"field":"routing-state"}]},{"as":"sample-floor","function":"difference","args":[{"parameter":"minimum-sample"},{"value":1}]},{"as":"enough-samples","function":"greater-than","args":[{"field":"complete-runs"},{"field":"sample-floor"}]},{"as":"median-aic","function":"if","args":[{"field":"enough-samples"},{"field":"observed-median"},{"value":null}]},{"as":"sample-status","function":"if","args":[{"field":"enough-samples"},{"value":"observational"},{"value":"insufficient data"}]}],"order-by":[{"field":"week","direction":"asc"}]},{"name":"routing-resolutions","from":"routing-session-events","subject":"Read runner-written configured-model resolutions for scoped routing runs.","objective":"Explain what each workflow role's configured model resolved to before the engine launched.","acceptance":"Only model.resolution facts from latest scoped attempts contribute; missing or unsafe values and failed null resolutions remain unknown.","joins":[{"source":"routing-runs","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"run-clock","as":"run-clock"},{"field":"observed-at","as":"run-observed-at"},{"field":"full-repository","as":"full-repository"},{"field":"routing-dashboard-link","as":"routing-dashboard-link"},{"field":"routing-state","as":"run-routing-state"}]}],"filter":{"predicates":[{"field":"event-type","equals":"model.resolution"}]},"compute":[{"as":"resolution-engine","function":"coalesce","args":[{"field":"telemetry-engine"},{"value":"unknown"}]},{"as":"resolution-role-label","function":"coalesce","args":[{"field":"resolution-role"},{"value":"unknown"}]},{"as":"configured-model","function":"coalesce","args":[{"field":"resolution-configured-model"},{"value":"unknown"}]},{"as":"resolved-model-label","function":"coalesce","args":[{"field":"resolution-resolved-model"},{"value":"unknown"}]},{"as":"resolution-provider","function":"coalesce","args":[{"field":"provider"},{"value":"unknown"}]},{"as":"resolution-status","function":"coalesce","args":[{"field":"event-status"},{"value":"unknown"}]},{"as":"failed-resolution","function":"equals-any","args":[{"field":"event-status"},{"value":"failed"}]},{"as":"failure-cause","function":"coalesce","args":[{"field":"code"},{"value":"unknown"}]},{"as":"resolution-cause","function":"if","args":[{"field":"failed-resolution"},{"field":"failure-cause"},{"field":"code"}]},{"as":"unknown-resolved-model","function":"equals-any","args":[{"field":"resolution-resolved-model"},{"value":null}]},{"as":"untimed","function":"equals-any","args":[{"field":"run-clock"},{"value":null}]},{"as":"configured-to-resolved","function":"concat","args":[{"field":"configured-model"},{"value":" → "},{"field":"resolved-model-label"}]},{"as":"workflow-key","function":"concat","args":[{"field":"full-repository"},{"value":":"},{"field":"workflow"}]},{"as":"resolution-actor","function":"concat","args":[{"field":"resolution-engine"},{"value":"/"},{"field":"resolution-role-label"},{"value":"/"},{"field":"resolution-provider"}]},{"as":"resolution-series","function":"concat","args":[{"field":"workflow-key"},{"value":" | "},{"field":"resolution-actor"},{"value":" | "},{"field":"configured-model"}]}]},{"name":"routing-health-totals","from":"routing-runs","subject":"Count routed runs and their selection, failure, adherence, outcome and cost evidence per repository and workflow.","objective":"Answer whether routing is on and working from one row per routed workflow.","acceptance":"Only selected, selection_failed, harness_reported and configured_unrecorded runs contribute; runs without evidence stay out of each denominator.","filter":{"predicates":[{"field":"routing-state","in":["selected","selection_failed","harness_reported","configured_unrecorded"]}]},"compute":[{"as":"has-routing-failure","function":"greater-than","args":[{"field":"failure-count"},{"value":0}]},{"as":"failure-or-fallback","function":"if","args":[{"field":"has-routing-failure"},{"value":true},{"field":"routing-degraded"}]},{"as":"adherence-known","function":"greater-than","args":[{"field":"flagged-requests"},{"value":0}]},{"as":"no-deviation","function":"equals-any","args":[{"field":"deviated-requests"},{"value":0}]}],"aggregate":{"by":["full-repository","workflow","baseline-model"],"values":[{"field":"paired-main-aic","as":"paired-main-aic","reducer":"sum"},{"field":"paired-baseline-aic","as":"paired-baseline-aic","reducer":"sum"},{"field":"run","as":"routed-runs","reducer":"count"},{"field":"run","as":"selected-runs","reducer":"count","filter":{"predicates":[{"field":"routing-state","equals":"selected"}]}},{"field":"run","as":"failure-runs","reducer":"count","filter":{"predicates":[{"field":"failure-or-fallback","equals":true}]}},{"field":"run","as":"adherence-known-runs","reducer":"count","filter":{"predicates":[{"field":"adherence-known","equals":true}]}},{"field":"run","as":"followed-runs","reducer":"count","filter":{"predicates":[{"field":"adherence-known","equals":true},{"field":"no-deviation","equals":true}]}},{"field":"agent-result","as":"known-outcomes","reducer":"count"},{"field":"run","as":"successes","reducer":"count","filter":{"predicates":[{"field":"agent-result","equals":"success"}]}},{"field":"complete-aic","as":"complete-runs","reducer":"count"},{"field":"complete-aic","as":"median-aic","reducer":"median"}]}},{"name":"routing-health","subject":"Show routing health shares per repository and workflow.","objective":"Tell whether routing is on and working from selection, failure or fallback, pick adherence, known outcomes and complete cost.","acceptance":"A zero denominator or no complete cost is unknown, never zero; unknown job outcomes are excluded from the success rate.","from":"routing-health-totals","compute":[{"as":"estimated-cost-vs-baseline","function":"quotient","args":[{"field":"paired-main-aic"},{"field":"paired-baseline-aic"}]},{"as":"estimated-cost-percent","function":"format-percent","args":[{"field":"estimated-cost-vs-baseline"}]},{"as":"selected-share","function":"quotient","args":[{"field":"selected-runs"},{"field":"routed-runs"}]},{"as":"failure-share","function":"quotient","args":[{"field":"failure-runs"},{"field":"routed-runs"}]},{"as":"followed-share","function":"quotient","args":[{"field":"followed-runs"},{"field":"adherence-known-runs"}]},{"as":"success-rate","function":"quotient","args":[{"field":"successes"},{"field":"known-outcomes"}]},{"as":"selected-percent","function":"format-percent","args":[{"field":"selected-share"}]},{"as":"failure-percent","function":"format-percent","args":[{"field":"failure-share"}]},{"as":"followed-percent","function":"format-percent","args":[{"field":"followed-share"}]},{"as":"success-percent","function":"format-percent","args":[{"field":"success-rate"}]}],"order-by":[{"field":"routed-runs","direction":"desc"},{"field":"full-repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"routing-weekly-models","from":"routing-runs","subject":"Count proxy-selected runs by UTC ISO week and picked model.","objective":"Show what the router chooses over time.","acceptance":"Only selected runs with a known pick model and a recorded run clock contribute; an unrecorded effort does not exclude a run.","filter":{"predicates":[{"field":"routing-state","equals":"selected"},{"field":"unknown-pick-model","equals":false},{"field":"run-clock","gte":0}]},"compute":[{"as":"week","function":"date-bucket","args":[{"field":"observed-at"},{"value":"week"}]}],"aggregate":{"by":["week","pick-model"],"values":[{"field":"run","as":"runs","reducer":"count"}]},"order-by":[{"field":"week","direction":"asc"},{"field":"pick-model","direction":"asc"}]},{"name":"routing-weekly-paired-totals","from":"routing-runs","subject":"Weekly paired complete main-request costs by baseline model.","objective":"Compare routing cost trends with each named baseline using identical main-request populations.","acceptance":"Only timed runs with complete positive baseline estimates and matching known main-request costs contribute to both medians.","filter":{"predicates":[{"field":"paired","equals":true},{"field":"run-clock","gte":0}]},"compute":[{"as":"week","function":"date-bucket","args":[{"field":"observed-at"},{"value":"week"}]}],"aggregate":{"by":["week","baseline-model"],"values":[{"field":"run","as":"complete-runs","reducer":"count"},{"field":"paired-main-aic","as":"observed-main-median","reducer":"median"},{"field":"paired-baseline-aic","as":"baseline-estimate-median","reducer":"median"}]}},{"name":"routing-weekly-paired-cost","from":"routing-weekly-paired-totals","subject":"Paired main-request samples that meet the chosen evidence floor.","objective":"Avoid changing routing policy based on insufficient paired evidence.","acceptance":"Observed and estimated series share the same complete-run count and configurable minimum sample.","parameters":[{"name":"minimum-sample","type":"number"}],"compute":[{"as":"sample-floor","function":"difference","args":[{"parameter":"minimum-sample"},{"value":1}]},{"as":"enough-samples","function":"greater-than","args":[{"field":"complete-runs"},{"field":"sample-floor"}]}]},{"name":"routing-weekly-main-observed","from":"routing-weekly-paired-cost","subject":"Observed main-request AIC for the same eligible runs as each baseline.","objective":"Identify weeks when routed main-request costs exceed the matching baseline estimate.","acceptance":"Observed medians exclude classifier and sub-agent costs and remain unknown below the paired sample floor.","compute":[{"as":"cost-series","function":"concat","args":[{"value":"Main requests observed (baseline: "},{"field":"baseline-model"},{"value":")"}]},{"as":"median-aic","function":"if","args":[{"field":"enough-samples"},{"field":"observed-main-median"},{"value":null}]}]},{"name":"routing-weekly-baseline-estimate","from":"routing-weekly-paired-cost","subject":"Explicitly estimated baseline AIC for paired main-agent requests.","objective":"Show the named counterfactual against which owners can assess routing goal or mode.","acceptance":"The series is labelled estimated, separates baseline models and uses exactly the observed series' eligible runs.","compute":[{"as":"cost-series","function":"concat","args":[{"value":"Baseline estimate (estimated, main requests): "},{"field":"baseline-model"}]},{"as":"median-aic","function":"if","args":[{"field":"enough-samples"},{"field":"baseline-estimate-median"},{"value":null}]}]},{"name":"routing-weekly-cost","from":"routing-weekly-accounting-cost","union":["routing-weekly-main-observed","routing-weekly-baseline-estimate"],"subject":"Compare the same main-agent requests to an explicitly estimated baseline.","objective":"Change routing goal or mode when paired observed cost exceeds the named baseline.","acceptance":"Keep agent-phase accounting separate, baseline models distinct and sparse weeks as gaps.","order-by":[{"field":"week","direction":"asc"},{"field":"cost-series","direction":"asc"}]},{"name":"routing-failure-problems","from":"routing-runs","subject":"Runs whose routing failure codes require investigation.","objective":"Investigate routing configuration or execution failures before changing rollout.","acceptance":"Emit one row per run with recorded routing failure identifiers, excluding upstream errors handled by their own kind.","filter":{"predicates":[{"field":"routing-failure-codes","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"routing failure"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"routing-failure-codes"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-deviation-problems","from":"routing-runs","subject":"Runs whose requests deviated from the routing pick.","objective":"Investigate why requests did not follow the selected model or effort.","acceptance":"Emit one row per run with distinct recorded deviation causes, without inferring causes from model names.","filter":{"predicates":[{"field":"routing-deviation-codes","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"deviation"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"routing-deviation-codes"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-resolution-problems","from":"routing-runs","subject":"Runs whose configured models could not be resolved.","objective":"Correct model aliases or restore catalogue availability for failed resolutions.","acceptance":"Emit one row per run with recorded resolution failure causes, not absence of resolution evidence.","filter":{"predicates":[{"field":"routing-resolution-codes","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"resolution failure"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"routing-resolution-codes"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-upstream-problems","from":"routing-runs","subject":"Provider-rejected requests with distinct upstream error codes.","objective":"Correct model or effort settings rejected by the provider.","acceptance":"Emit one upstream-error row per run with distinct safe codes or unknown, never a duplicate generic routing failure.","filter":{"predicates":[{"field":"routing-upstream-codes","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"upstream error"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"routing-upstream-codes"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-candidate-problems","from":"routing-runs","subject":"Runs whose full eligible pool contains choices the router cannot rank.","objective":"Review allowed models when the router cannot rank the complete eligible pool.","acceptance":"Emit one row only when both pool counters are known and overlap is below eligibility, displaying the observed ratio.","filter":{"predicates":[{"field":"candidate-coverage","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"candidates not rankable"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"candidate-coverage"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-problems","from":"routing-failure-problems","union":["routing-deviation-problems","routing-resolution-problems","routing-upstream-problems","routing-candidate-problems"],"subject":"List routing failures, deviations and resolution failures with one row per run and kind.","objective":"Show what needs attention and link each problem to its run page.","acceptance":"Time is the run's recorded observation time and stays unknown without a run clock; untimed rows sort after timed rows.","joins":[{"source":"routing-runs","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"run","as":"run"},{"field":"full-repository","as":"full-repository"},{"field":"workflow","as":"workflow"},{"field":"run-clock","as":"run-clock"},{"field":"observed-at","as":"observed-at"},{"field":"routing-dashboard-link","as":"routing-dashboard-link"}]}],"compute":[{"as":"untimed","function":"equals-any","args":[{"field":"run-clock"},{"value":null}]}],"order-by":[{"field":"untimed","direction":"asc"},{"field":"run-clock","direction":"desc"},{"field":"run","direction":"desc"},{"field":"problem-kind","direction":"asc"}]},{"name":"simulator-database-inputs","subject":"Model daily run volume and 30-day retained detail from user-supplied scenario inputs.","objective":"Compare hypothetical workload choices without treating results as observed activity.","acceptance":"Each simulated day uses the selected inputs; skipped runs retain summaries and detailed records have a 30-day lifetime.","description":"Each simulated day includes all accumulated run summaries; tools and issues belong only to non-skipped runs and expire after 30 days.","from":"simulation-days","parameters":[{"name":"repositories","type":"number"},{"name":"runs-per-day","type":"number"},{"name":"tools-per-run","type":"number"},{"name":"issues-per-run","type":"number"},{"name":"skip-rate","type":"number"}],"compute":[{"as":"runs-daily","function":"product","args":[{"parameter":"repositories"},{"parameter":"runs-per-day"}]},{"as":"skip-fraction","function":"quotient","args":[{"parameter":"skip-rate"},{"value":100}]},{"as":"active-fraction","function":"difference","args":[{"value":1},{"field":"skip-fraction"}]},{"as":"summary-runs","function":"product","args":[{"field":"day"},{"field":"runs-daily"}]},{"as":"past-ttl","function":"greater-than","args":[{"field":"day"},{"value":30}]},{"as":"detail-days","function":"if","args":[{"field":"past-ttl"},{"value":30},{"field":"day"}]},{"as":"detail-runs","function":"product","args":[{"field":"detail-days"},{"field":"runs-daily"},{"field":"active-fraction"}]},{"as":"tools-per-run","function":"literal","args":[{"parameter":"tools-per-run"}]},{"as":"issues-per-run","function":"literal","args":[{"parameter":"issues-per-run"}]}]},{"name":"simulator-run-size","subject":"Estimate retained run-summary table size at 512 bytes per run.","objective":"Show modeled accumulation of run summaries.","acceptance":"Summary size includes every simulated run at 512 bytes and is not presented as measured storage.","from":"simulator-database-inputs","compute":[{"as":"table","function":"literal","args":[{"value":"Run summaries"}]},{"as":"bytes","function":"product","args":[{"field":"summary-runs"},{"value":512}]}],"select":[{"field":"day"},{"field":"table"},{"field":"bytes"}]},{"name":"simulator-tool-size","subject":"Estimate retained tool table size at 256 bytes per tool on non-skipped runs.","objective":"Show modeled tool-record growth under the selected workload.","acceptance":"Tool size uses only non-skipped simulated runs and 256 bytes per tool over the retained period.","from":"simulator-database-inputs","compute":[{"as":"table","function":"literal","args":[{"value":"Tools (30-day TTL)"}]},{"as":"bytes","function":"product","args":[{"field":"detail-runs"},{"field":"tools-per-run"},{"value":256}]}],"select":[{"field":"day"},{"field":"table"},{"field":"bytes"}]},{"name":"simulator-issue-size","subject":"Estimate retained issue table size at 512 bytes per issue on non-skipped runs.","objective":"Show modeled issue-record growth under the selected workload.","acceptance":"Issue size uses only non-skipped simulated runs and 512 bytes per issue over the retained period.","from":"simulator-database-inputs","compute":[{"as":"table","function":"literal","args":[{"value":"Issues (30-day TTL)"}]},{"as":"bytes","function":"product","args":[{"field":"detail-runs"},{"field":"issues-per-run"},{"value":512}]}],"select":[{"field":"day"},{"field":"table"},{"field":"bytes"}]},{"name":"simulator-database-size","subject":"Show modeled run-summary, tool, and issue table bytes after 30 days.","objective":"Compare hypothetical database table sizes at the end of the retention horizon.","acceptance":"The model presents separate summary, tool, and issue estimates after 30 simulated days, never observed storage.","description":"Run summaries accumulate; detailed records have a 30-day TTL.","from":"simulator-run-size","union":["simulator-tool-size","simulator-issue-size"],"filter":{"predicates":[{"field":"day","equals":30}]},"select":[{"field":"table"},{"field":"bytes"}]},{"name":"simulator-database-total","subject":"Sum the modeled table sizes after 30 days.","objective":"Show the final estimated size of the modeled database tables.","acceptance":"The final value is the sum of the three modeled table sizes after 30 days.","from":"simulator-database-size","compute":[{"as":"total-label","function":"literal","args":[{"value":"Total"}]}],"aggregate":{"by":["total-label"],"values":[{"field":"bytes","as":"bytes","reducer":"sum"}]},"select":[{"field":"total-label","as":"table"},{"field":"bytes"}]},{"name":"simulator-database-summary","subject":"List modeled table sizes and their final total after 30 days.","objective":"Present the 30-day estimate in a compact table.","acceptance":"Three modeled table sizes and their summed final value are shown without a growth chart.","from":"simulator-database-size","union":["simulator-database-total"]},{"name":"simulator-pr-inputs","subject":"Model company PR volume, AW fan-out and AI Credits from editable assumptions.","objective":"Compare hypothetical company sizes without launching workflows or claiming measured capacity.","acceptance":"Developers multiply PRs per developer per day, AW runs per PR and AIC per run; repositories divide averages only. Duration scales totals independently of the synthetic day source.","from":"simulation-days","parameters":[{"name":"repositories","type":"number"},{"name":"developers","type":"number"},{"name":"prs-per-developer-per-day","type":"number"},{"name":"aw-runs-per-pr","type":"number"},{"name":"days","type":"number"},{"name":"aic-per-run","type":"number"}],"filter":{"predicates":[{"field":"day","equals":1}]},"compute":[{"as":"daily-prs","function":"product","args":[{"parameter":"developers"},{"parameter":"prs-per-developer-per-day"}]},{"as":"daily-runs","function":"product","args":[{"field":"daily-prs"},{"parameter":"aw-runs-per-pr"}]},{"as":"daily-aic","function":"product","args":[{"field":"daily-runs"},{"parameter":"aic-per-run"}]},{"as":"total-prs","function":"product","args":[{"field":"daily-prs"},{"parameter":"days"}]},{"as":"total-runs","function":"product","args":[{"field":"daily-runs"},{"parameter":"days"}]},{"as":"total-aic","function":"product","args":[{"field":"daily-aic"},{"parameter":"days"}]},{"as":"prs-per-repo","function":"quotient","args":[{"field":"daily-prs"},{"parameter":"repositories"}]},{"as":"runs-per-repo","function":"quotient","args":[{"field":"daily-runs"},{"parameter":"repositories"}]},{"as":"runs-per-second","function":"quotient","args":[{"field":"daily-runs"},{"value":86400}]}]},{"name":"simulator-pr-counts","subject":"Show modeled daily and horizon pull request counts.","objective":"Separate developer activity from repository scope.","acceptance":"PR totals depend on developers and duration, not repository count.","from":"simulator-pr-inputs","compute":[{"as":"measure","function":"literal","args":[{"value":"Pull requests"}]}],"select":[{"field":"measure"},{"field":"daily-prs","as":"daily"},{"field":"total-prs","as":"total"}]},{"name":"simulator-pr-runs","subject":"Show modeled AW runs generated by pull requests.","objective":"Expose the selected AW fan-out.","acceptance":"Daily and horizon runs use the configured AW runs per PR.","from":"simulator-pr-inputs","compute":[{"as":"measure","function":"literal","args":[{"value":"AW runs"}]}],"select":[{"field":"measure"},{"field":"daily-runs","as":"daily"},{"field":"total-runs","as":"total"}]},{"name":"simulator-pr-aic","subject":"Show modeled AI Credits, not actual spending or currency.","objective":"Make the editable AIC-per-run assumption explicit.","acceptance":"AIC totals multiply modeled runs by AIC per AW run; no dollar conversion or budget enforcement is inferred.","from":"simulator-pr-inputs","compute":[{"as":"measure","function":"literal","args":[{"value":"AI Credits (AIC)"}]}],"select":[{"field":"measure"},{"field":"daily-aic","as":"daily"},{"field":"total-aic","as":"total"}]},{"name":"simulator-pr-summary","subject":"Compare daily and horizon PR, AW-run and AI Credit estimates.","objective":"Support side-effect-free company workload planning.","acceptance":"Exactly three modeled measures are shown and recompute from all six form inputs.","from":"simulator-pr-counts","union":["simulator-pr-runs","simulator-pr-aic"]},{"name":"overview-run-summary","subject":"Summarize successful, failed, and active runs with rollout-mode counts.","objective":"Expose observed success, failure, and active run counts, including active live and review modes, for the selected horizon.","acceptance":"Each count follows its declared conclusion, status, and rollout-mode filters; run success is not treated as a verified outcome, and incomplete or stale evidence is identified.","from":"overview-runs","aggregate":{"values":[{"field":"run-conclusion","as":"successful-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","equals":"success"}]}},{"field":"run-conclusion","as":"failed-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","stale","timed-out"]}]}},{"field":"run-status","as":"active-runs","reducer":"count","filter":{"predicates":[{"field":"run-status","in":["queued","in-progress","in_progress"]}]}},{"field":"run-status","as":"active-live","reducer":"count","filter":{"predicates":[{"field":"run-status","in":["queued","in-progress","in_progress"]},{"field":"rollout-mode","equals":"live"}]}},{"field":"run-status","as":"active-review","reducer":"count","filter":{"predicates":[{"field":"run-status","in":["queued","in-progress","in_progress"]},{"field":"rollout-mode","equals":"review"}]}}]}},{"name":"overview-delivery-summary","subject":"Count distinct target repositories with successful worker dispatch runs in the selected horizon.","objective":"Measure observed reach among registered repositories with successful dispatched worker runs.","acceptance":"Distinct delivered-repositories is limited to registered targets and successful workflow_dispatch worker runs in the selected horizon; it does not establish accepted delivery or authorized coverage.","from":"overview-runs","joins":[{"source":"repositories","type":"inner","on":[{"left":"target-repository","right":"repository-coordinate"}],"fields":[{"field":"repository-coordinate","as":"registered-target-repository"}]}],"filter":{"predicates":[{"field":"event","equals":"workflow_dispatch"},{"field":"run-conclusion","equals":"success"},{"field":"workflow-role","equals":"worker"}]},"aggregate":{"values":[{"field":"target-repository","as":"delivered-repositories","reducer":"distinct-count"}]}},{"name":"overview-value-summary","subject":"Count all observed grader results.","objective":"Identify whether any grader observations are available to the Overview status presentation.","acceptance":"The value-gains field counts observed grader records only; inspect each result's native measure, unit, direction, maturity, and uncertainty before claiming an outcome or improvement.","from":"grader-observations","aggregate":{"values":[{"field":"grader","as":"value-gains","reducer":"count"}]}},{"name":"overview-issue-summary","subject":"Count retained issue and pull request safe-output records for Overview.","objective":"Restore the issue and pull request counter with a link to its evidence inventory.","acceptance":"The count includes retained canonical issue and pull request records, not inferred outcomes; unavailable evidence remains unavailable.","from":"issues","aggregate":{"values":[{"field":"id","as":"value","reducer":"count"}]},"limit":1},{"name":"overview-issue-station","subject":"Present the retained issue and pull request count for Overview.","objective":"Provide a presentation-ready count and accessible evidence description.","acceptance":"The value matches overview-issue-summary and describes retained safe outputs, not accepted outcomes.","from":"overview-issue-summary","compute":[{"as":"detail","function":"concat","args":[{"value":"Retained safe"},{"value":" outputs"}]},{"as":"description","function":"concat","args":[{"field":"value"},{"value":" retained issues and pull requests"}]}],"limit":1},{"name":"overview-value-station","subject":"Present the observed grader-result count as the legacy Value gains counter.","objective":"Restore the Value gains counter while making its observation-count semantics explicit.","acceptance":"The count matches overview-value-summary, including zero; grader presence is not proof of improvement and unavailable evidence is not zero.","from":"overview-value-summary","compute":[{"as":"detail","function":"concat","args":[{"value":"Observed grader"},{"value":" results"}]},{"as":"description","function":"concat","args":[{"field":"value-gains"},{"value":" observed grader results, not verified improvements"}]}],"select":[{"field":"value-gains","as":"value"},{"field":"detail"},{"field":"description"}],"limit":1},{"name":"overview-run-status-input","subject":"Prepare the compact run summary for declarative factory status classification.","objective":"Carry successful-runs, failed-runs, and active-runs into the status join without changing their meaning.","acceptance":"The projected counts retain the selected horizon and match overview-run-summary; the join key is only a presentation key, not additional evidence.","from":"overview-run-summary","compute":[{"as":"status-join-key","function":"concat","args":[{"value":"factory"},{"value":"-status"}]}],"select":[{"field":"status-join-key"},{"field":"successful-runs"},{"field":"failed-runs"},{"field":"active-runs"}]},{"name":"overview-value-status-input","subject":"Prepare the compact value summary for declarative factory status classification.","objective":"Carry the grader-observation count into the optional status join.","acceptance":"The projected value-gains count matches overview-value-summary; a zero count does not establish complete grader coverage, and a nonzero count is not proof of gain.","from":"overview-value-summary","compute":[{"as":"status-join-key","function":"concat","args":[{"value":"factory"},{"value":"-status"}]}],"select":[{"field":"status-join-key"},{"field":"value-gains"}]},{"name":"overview-factory-status","subject":"Classify the factory heading from compact run and optional value evidence.","objective":"Provide a bounded Overview heading based on observed run counts and optional grader-record presence.","acceptance":"The heading matches the declared run-count and optional grader-presence branches; grader presence is not verified value, and the heading does not authorize any policy change.","from":"overview-run-status-input","joins":[{"source":"overview-value-status-input","type":"left","on":[{"left":"status-join-key","right":"status-join-key"}],"fields":[{"field":"value-gains","as":"value-gains"}]}],"compute":[{"as":"has-successful-runs","function":"greater-than","args":[{"field":"successful-runs"},{"value":0}]},{"as":"has-failed-runs","function":"greater-than","args":[{"field":"failed-runs"},{"value":0}]},{"as":"failures-exceed-successes","function":"greater-than","args":[{"field":"failed-runs"},{"field":"successful-runs"}]},{"as":"has-active-runs","function":"greater-than","args":[{"field":"active-runs"},{"value":0}]},{"as":"has-value-gains","function":"greater-than","args":[{"field":"value-gains"},{"value":0}]},{"as":"successful-heading","function":"if","args":[{"field":"has-successful-runs"},{"value":"Your factory is humming."},{"value":"Your factory is idle."}]},{"as":"attention-heading","function":"if","args":[{"field":"has-failed-runs"},{"value":"Your factory needs attention."},{"field":"successful-heading"}]},{"as":"strain-heading","function":"if","args":[{"field":"failures-exceed-successes"},{"value":"Your factory is under strain."},{"field":"attention-heading"}]},{"as":"active-heading","function":"if","args":[{"field":"has-active-runs"},{"value":"Your factory is humming."},{"field":"strain-heading"}]},{"as":"factory-heading","function":"if","args":[{"field":"has-value-gains"},{"value":"Your factory is delivering value."},{"field":"active-heading"}]}],"select":[{"field":"factory-heading"}]},{"name":"overview-registered-repository-summary","subject":"Count canonical repository identities registered in the resolved control-plane scope.","objective":"Provide the registered-repository denominator for observed worker reach.","acceptance":"The count reflects canonical repository records in the resolved scope; it is not evidence of live enrollment, successful execution, or full inventory completeness.","from":"repositories","aggregate":{"values":[{"field":"repository","as":"registered-repositories","reducer":"count"}]}},{"name":"overview-delivery-coverage-input","subject":"Prepare successful delivery totals for the repository coverage summary.","objective":"Carry the distinct delivered-repositories count into the coverage join.","acceptance":"The projected count equals overview-delivery-summary for the selected horizon; the join key adds no repository observations.","from":"overview-delivery-summary","compute":[{"as":"coverage-key","function":"concat","args":[{"value":"repository-coverage"},{"value":""}]}],"select":[{"field":"delivered-repositories"},{"field":"coverage-key"}]},{"name":"overview-registered-repository-coverage-input","subject":"Prepare registered repository totals for the repository coverage summary.","objective":"Carry the registered-repositories count into the coverage denominator join.","acceptance":"The projected count equals overview-registered-repository-summary for the resolved scope; missing inventory is not treated as zero eligible targets.","from":"overview-registered-repository-summary","compute":[{"as":"coverage-key","function":"concat","args":[{"value":"repository-coverage"},{"value":""}]}],"select":[{"field":"registered-repositories"},{"field":"coverage-key"}]},{"name":"overview-rhythm","subject":"Compare all workflow runs by weekday, layering this week over last week.","objective":"Show the observed weekday pattern across both calendar weeks, regardless of status or conclusion.","acceptance":"Verify weekday order, counts including unsuccessful and in-flight runs, and reached-day flags. Missing rhythm is unavailable, not zero activity; do not attribute changes to workflow improvements.","from":"overview-runs","time":{"range":"15d"},"compute":[{"as":"rhythm-point","function":"calendar-week-point","args":[{"field":"started-at"},{"context":"time-end"},{"value":true}]}],"aggregate":{"values":[{"field":"rhythm-point","as":"rhythm","reducer":"calendar-week-rhythm"}]}},{"name":"overview-repository-coverage-summary","subject":"Aggregate reached and total repositories across the resolved organization scope.","objective":"Pair observed reached-repositories and registered-repositories-total for a comparable coverage denominator.","acceptance":"Both totals come from their named input queries and share the resolved scope; verify the left-joined inventory source independently before interpreting a zero total, since a missing join can aggregate to zero.","from":"overview-delivery-coverage-input","joins":[{"source":"overview-registered-repository-coverage-input","type":"left","on":[{"left":"coverage-key","right":"coverage-key"}],"fields":[{"field":"registered-repositories","as":"registered-repositories-total"}]}],"aggregate":{"values":[{"field":"delivered-repositories","as":"reached-repositories","reducer":"sum"},{"field":"registered-repositories-total","as":"registered-repositories-total","reducer":"sum"}]}},{"name":"overview-repository-coverage","subject":"Measure registered repository reach from successful worker execution.","objective":"Present observed successful-worker repository reach as a ratio alongside numerator and denominator.","acceptance":"repository-coverage is reached-repositories divided by registered-repositories-total when available; preserve the counts and undefined denominator, and do not call reach successful outcomes.","from":"overview-repository-coverage-summary","compute":[{"as":"repository-coverage","function":"quotient","args":[{"field":"reached-repositories"},{"field":"registered-repositories-total"}]}],"select":[{"field":"repository-coverage"},{"field":"reached-repositories"},{"field":"registered-repositories-total"}]},{"name":"overview-workflow-health-groups","subject":"Assess current runtime failures for every workflow across CAO and targeted repositories.","objective":"Compute the latest consecutive completed-run failure streak for each repository-scoped workflow without requiring campaign membership.","acceptance":"Group by organization, repository, and workflow; in-flight retries do not clear failures, and later non-failing completed runs reset the streak within the selected horizon.","from":"overview-runs","filter":{"predicates":[{"field":"run-status","equals":"completed"}]},"compute":[{"as":"is-runtime-failure","function":"equals-any","args":[{"field":"run-conclusion"},{"value":"failure"},{"value":"startup-failure"},{"value":"stale"},{"value":"timed-out"}]},{"as":"runtime-failure-streak-point","function":"failure-streak-point","args":[{"field":"started-at"},{"field":"run"},{"field":"is-runtime-failure"}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"runtime-failure-streak-point","as":"failure-count","reducer":"latest-failure-streak"}]}},{"name":"overview-workflow-health-summary","subject":"Count all registered workflows and those without current observed runtime failures.","objective":"Provide Factory health numerator and denominator across CAO and targeted repositories, including standalone and campaign workflows.","acceptance":"Each repository-scoped workflow counts once regardless of campaign or role; no retained failure is not proof of successful execution, missing inventory remains unavailable, and missing run evidence marks the result incomplete.","from":"workflows","joins":[{"source":"overview-workflow-health-groups","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"failure-count","as":"observed-failures"}]}],"compute":[{"as":"normalized-failures","function":"coalesce","args":[{"field":"observed-failures"},{"value":0}]},{"as":"problem-present","function":"greater-than","args":[{"field":"normalized-failures"},{"value":0}]}],"aggregate":{"values":[{"field":"workflow","as":"workflows","reducer":"count"},{"field":"workflow","as":"healthy-workflows","reducer":"count","filter":{"predicates":[{"field":"problem-present","equals":false}]}}]}},{"name":"overview-workflow-health-presentation-input","subject":"Prepare all-workflow health counts for Overview presentation.","objective":"Carry Factory health counts into the header and station presentation.","acceptance":"Both counts match overview-workflow-health-summary and preserve missing evidence metadata.","from":"overview-workflow-health-summary","compute":[{"as":"overview-presentation-key","function":"concat","args":[{"value":"overview"},{"value":"-presentation"}]}],"select":[{"field":"overview-presentation-key"},{"field":"workflows"},{"field":"healthy-workflows"}]},{"name":"overview-factory-health-presentation","subject":"Produce presentation-ready Factory health values for the Overview header and floor.","objective":"Display the ratio of workflows without current observed runtime failures to all registered workflows with both underlying counts.","acceptance":"The percentage and detail agree with healthy-workflows and workflows; a missing or zero denominator remains unavailable, and the ratio is not proof of impact.","from":"overview-workflow-health-presentation-input","compute":[{"as":"factory-health","function":"quotient","args":[{"field":"healthy-workflows"},{"field":"workflows"}]},{"as":"factory-health-display","function":"format-percent","args":[{"field":"factory-health"}]},{"as":"healthy-workflows-display","function":"format-count","args":[{"field":"healthy-workflows"}]},{"as":"workflows-display","function":"format-count","args":[{"field":"workflows"}]},{"as":"factory-health-detail","function":"concat","args":[{"field":"healthy-workflows-display"},{"value":"/"},{"field":"workflows-display"},{"value":" healthy workflows"}]},{"as":"factory-health-description","function":"concat","args":[{"field":"factory-health-display"},{"value":" factory health"}]}],"select":[{"field":"overview-presentation-key"},{"field":"factory-health"},{"field":"factory-health-display"},{"field":"factory-health-detail"},{"field":"factory-health-description"}]},{"name":"overview-header-status-presentation-input","subject":"Prepare the factory status heading for the declarative Overview header.","objective":"Carry the factory heading into the Overview header join unchanged.","acceptance":"The heading matches overview-factory-status; the presentation key does not imply additional evidence or a policy recommendation.","from":"overview-factory-status","compute":[{"as":"overview-presentation-key","function":"concat","args":[{"value":"overview"},{"value":"-presentation"}]}],"select":[{"field":"overview-presentation-key"},{"field":"factory-heading"}]},{"name":"overview-header-presentation","subject":"Resolve the Overview heading from declarative status and factory-health evidence.","objective":"Display the configured heading corresponding to observed run status and factory health.","acceptance":"The selected heading follows the declared presentation branches; numeric branch boundaries are UI classification only, not operational targets or rollout thresholds.","from":"overview-header-status-presentation-input","joins":[{"source":"overview-factory-health-presentation","type":"left","on":[{"left":"overview-presentation-key","right":"overview-presentation-key"}],"fields":[{"field":"factory-health","as":"factory-health"}]}],"compute":[{"as":"factory-health-positive","function":"greater-than","args":[{"field":"factory-health"},{"value":0}]},{"as":"factory-health-below-threshold","function":"greater-than","args":[{"value":0.66},{"field":"factory-health"}]},{"as":"positive-factory-health-heading","function":"if","args":[{"field":"factory-health-below-threshold"},{"value":"Your factory needs attention."},{"field":"factory-heading"}]},{"as":"heading","function":"if","args":[{"field":"factory-health-positive"},{"field":"positive-factory-health-heading"},{"field":"factory-heading"}]}],"select":[{"field":"heading"}]},{"name":"overview-run-motion-presentation-input","subject":"Prepare active run state for Overview station presentation.","objective":"Expose whether at least one queued or in-progress run was observed for station display.","acceptance":"active reflects overview-run-summary's active-runs count; no observed active run does not prove the fleet is idle when the snapshot is incomplete.","from":"overview-run-summary","compute":[{"as":"overview-presentation-key","function":"concat","args":[{"value":"overview"},{"value":"-presentation"}]},{"as":"active","function":"greater-than","args":[{"field":"active-runs"},{"value":0}]}],"select":[{"field":"overview-presentation-key"},{"field":"active"}]},{"name":"overview-factory-station","subject":"Provide the presentation-ready Factory health station for Overview.","objective":"Show the all-workflow runtime health ratio, supporting counts, and observed run motion together.","acceptance":"Station value, display, detail, description, and active flag match their input queries; neither absence of failures nor run motion is verified workflow effectiveness.","from":"overview-factory-health-presentation","joins":[{"source":"overview-run-motion-presentation-input","type":"left","on":[{"left":"overview-presentation-key","right":"overview-presentation-key"}],"fields":[{"field":"active","as":"active"}]}],"select":[{"field":"factory-health","as":"value"},{"field":"factory-health-display","as":"display-value"},{"field":"factory-health-detail","as":"detail"},{"field":"factory-health-description","as":"description"},{"field":"active"}]},{"name":"overview-repository-station-presentation-input","subject":"Prepare repository coverage for the presentation-ready Overview station.","objective":"Format repository reach with its reached and registered counts for the station.","acceptance":"The percentage and detail preserve overview-repository-coverage's numerator and denominator; unavailable coverage remains unavailable, not zero or complete reach.","from":"overview-repository-coverage","compute":[{"as":"overview-presentation-key","function":"concat","args":[{"value":"overview"},{"value":"-presentation"}]},{"as":"display-value","function":"format-percent","args":[{"field":"repository-coverage"}]},{"as":"reached-repositories-display","function":"format-count","args":[{"field":"reached-repositories"}]},{"as":"registered-repositories-display","function":"format-count","args":[{"field":"registered-repositories-total"}]},{"as":"detail","function":"concat","args":[{"field":"reached-repositories-display"},{"value":"/"},{"field":"registered-repositories-display"},{"value":" repositories reached"}]},{"as":"description","function":"concat","args":[{"field":"display-value"},{"value":" average repository coverage"}]}],"select":[{"field":"overview-presentation-key"},{"field":"repository-coverage","as":"value"},{"field":"display-value"},{"field":"detail"},{"field":"description"}]},{"name":"overview-repository-station","subject":"Provide the presentation-ready repository coverage station for Overview.","objective":"Show observed registered-repository worker reach and run motion in one station.","acceptance":"Value and formatted evidence match the coverage presentation input, and active matches run motion; neither changes policy or establishes accepted outcomes.","from":"overview-repository-station-presentation-input","joins":[{"source":"overview-run-motion-presentation-input","type":"left","on":[{"left":"overview-presentation-key","right":"overview-presentation-key"}],"fields":[{"field":"active","as":"active"}]}],"select":[{"field":"value"},{"field":"display-value"},{"field":"detail"},{"field":"description"},{"field":"active"}]},{"name":"cost-by-repository","subject":"Present observed AI Credit cost grouped by repository.","objective":"Locate repositories with higher observed AI Credit totals for evidence-led investigation.","acceptance":"Each repository coordinate and native aic total agrees with repository-aic-totals; confirm the selected horizon and underlying runs before attributing cost or proposing a change.","from":"repository-aic-totals","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-coordinate"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-coordinate"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-coordinate"}]}],"select":[{"field":"repository-coordinate"},{"field":"repository-dashboard-link"},{"field":"aic"}],"order-by":[{"field":"aic","direction":"desc"}]},{"name":"cost-by-workflow","subject":"Present observed AI Credit cost grouped by repository-owned workflow.","objective":"Locate repository workflows with higher observed AI Credit totals and open their workflow evidence.","acceptance":"Workflow identity, link, and native aic total match workflow-aic-totals in descending order; cost alone does not establish waste, quality, or value.","from":"workflow-aic-totals","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-coordinate"}]}],"select":[{"field":"repository-coordinate"},{"field":"workflow"},{"field":"workflow-coordinate"},{"field":"workflow-dashboard-link"},{"field":"aic"}],"order-by":[{"field":"aic","direction":"desc"}]},{"name":"cost-per-workflow-run","subject":"Present the average observed AI Credit cost of a single run for each repository-owned workflow.","objective":"Compare observed AI Credit per run across repository workflows with each observed-runs denominator.","acceptance":"Include only workflows with positive-AIC run attempts, and use only those attempts in cost averages; observed-runs still counts all retained attempts.","description":"Observed AI Credit totals divided by positive-AIC run attempts for each declared workflow.","from":"workflow-aic-run-totals","filter":{"predicates":[{"field":"aic-runs","gte":1}]},"compute":[{"as":"aic-per-run","function":"quotient","args":[{"field":"aic"},{"field":"aic-runs"}]},{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-coordinate"}]}],"select":[{"field":"repository-coordinate"},{"field":"workflow"},{"field":"workflow-coordinate"},{"field":"workflow-dashboard-link"},{"field":"runs","as":"observed-runs"},{"field":"aic-per-run"}],"order-by":[{"field":"aic-per-run","direction":"desc"}]},{"name":"failure-run-base","subject":"Select retained runs with failure, startup-failure, stale, or timed-out conclusions for the failed-run ledger and streak inputs.","objective":"Provide one consistent failure-conclusion evidence set to downstream Overview queries.","acceptance":"Each selected run has one of the four declared conclusions within the selected horizon; other conclusions remain outside this set, and missing run coverage is not interpreted as no failures.","from":"runs","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","stale","timed-out"]}]}},{"name":"failed-runs","subject":"List failed workflow runs that need operator attention.","objective":"Give operators the most recent observed failed runs to inspect in GitHub.","acceptance":"Unprojected run rows retain available conclusion, started-at, and run evidence fields in descending started-at order; inspect source logs and missing links before attributing a cause or declaring resolution.","from":"failure-run-base","order-by":[{"field":"started-at","direction":"desc"}]},{"name":"overview-failing-runs","subject":"Identify failed runs in the selected snapshot horizon so subsequent streak logic can use the same declarative failure definition.","objective":"Project distinct failure-run counts by organization, repository, workflow, and run for streak joins.","acceptance":"Each grouped run identity has a failing-runs count derived from failure-run-base in the selected horizon; this stage does not assert a consecutive streak or require action.","from":"failure-run-base","aggregate":{"by":["organization","repository","workflow","run"],"values":[{"field":"run","as":"failing-runs","reducer":"distinct-count"}]}},{"name":"overview-failing-workflows","subject":"Identify only workflows that have at least one failed run in the selected snapshot horizon before computing streaks.","objective":"Provide workflow identities with observed failed runs for the streak computation.","acceptance":"Each organization/repository/workflow group has a distinct failing-runs count from overview-failing-runs; the count covers observed failures, not the latest consecutive streak.","from":"overview-failing-runs","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run","as":"failing-runs","reducer":"distinct-count"}]}},{"name":"overview-repeated-failure-groups","subject":"Group each workflow's latest consecutive failing run sequence in the selected snapshot horizon, resetting the group after any successful run.","objective":"Project the latest observed consecutive failure-count per workflow for downstream blocked-work matching.","acceptance":"failure-count follows run ordering and the declared latest-failure-streak reducer, with non-failing runs breaking the streak; missing earlier runs or incomplete snapshots limit the observed sequence.","from":"runs","joins":[{"source":"overview-failing-workflows","type":"inner","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"failing-runs","as":"failing-runs"}]},{"source":"overview-failing-runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"}],"fields":[{"field":"failing-runs","as":"run-failing-count"}]}],"compute":[{"as":"failure-streak-point","function":"failure-streak-point","args":[{"field":"started-at"},{"field":"run"},{"field":"run-failing-count"}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"failure-streak-point","as":"failure-count","reducer":"latest-failure-streak"}]}},{"name":"overview-repeated-failure-candidates","subject":"Attach selected-horizon failure counts to each workflow's latest canonical work item.","objective":"Pair blocked work items with observed workflow failure streaks and retained run evidence before attention filtering.","acceptance":"Candidates are filtered to blocked items with a matching organization/repository/workflow streak; is-repeated reflects failure-count greater than one, while selected evidence-link and run-link can be absent or refer to the work item rather than the latest failed run.","from":"work-items","joins":[{"source":"overview-repeated-failure-groups","type":"inner","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"failure-count","as":"failure-count"}]}],"filter":{"predicates":[{"field":"lifecycle-state","equals":"blocked"}]},"compute":[{"as":"is-repeated","function":"greater-than","args":[{"field":"failure-count"},{"value":1}]},{"as":"attention-signal-id","function":"concat","args":[{"value":"repeated-failure:"},{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"kind","function":"coalesce","args":[{"value":"Repeated workflow failures"},{"value":"Repeated workflow failures"}]},{"as":"title","function":"coalesce","args":[{"field":"workflow"},{"value":"Workflow"}]},{"as":"attention-reason","function":"concat","args":[{"field":"failure-count"},{"value":" failed runs in the selected horizon"}]},{"as":"action","function":"coalesce","args":[{"value":"Open latest failed run on GitHub"},{"value":"Open latest failed run on GitHub"}]},{"as":"icon","function":"coalesce","args":[{"value":"x-circle"},{"value":"x-circle"}]},{"as":"tone","function":"coalesce","args":[{"value":"critical"},{"value":"critical"}]},{"as":"priority","function":"number","args":[{"value":0}]}],"select":[{"field":"is-repeated"},{"field":"attention-signal-id"},{"field":"kind"},{"field":"title"},{"field":"scope"},{"field":"attention-reason","as":"reason"},{"field":"observed-at"},{"field":"action"},{"field":"evidence-link"},{"field":"run-link"},{"field":"icon"},{"field":"tone"},{"field":"priority"},{"field":"failure-count"}]},{"name":"overview-repeated-failure-attention","subject":"Keep only unresolved workflows with two or more failures in the selected horizon.","objective":"Surface blocked workflow items with observed repeated failures for bounded run investigation.","acceptance":"Every row inherits a blocked item with is-repeated true and projects evidence-link and run-link when available; verify run order, links, and current state before treating the failure as still unresolved.","from":"overview-repeated-failure-candidates","filter":{"predicates":[{"field":"is-repeated","equals":true}]},"select":[{"field":"attention-signal-id"},{"field":"kind"},{"field":"title"},{"field":"scope"},{"field":"reason"},{"field":"observed-at"},{"field":"action"},{"field":"evidence-link"},{"field":"run-link"},{"field":"icon"},{"field":"tone"},{"field":"priority"},{"field":"failure-count"}]},{"name":"overview-review-attention","subject":"Select only unresolved outputs explicitly awaiting human review with their retained GitHub evidence destination.","objective":"Present review-state work items and their retained GitHub destination to a human reviewer.","acceptance":"Rows are filtered to lifecycle-state review and project the work-item ID as attention-signal-id, plus reason, evidence-link, and run-link where present; reviewer disposition must be checked at source.","from":"work-items","filter":{"predicates":[{"field":"lifecycle-state","equals":"review"}]},"compute":[{"as":"kind","function":"coalesce","args":[{"value":"Human review required"},{"value":"Human review required"}]},{"as":"title","function":"coalesce","args":[{"field":"objective"},{"value":"Produced output"}]},{"as":"action","function":"coalesce","args":[{"value":"Open review item on GitHub"},{"value":"Open review item on GitHub"}]},{"as":"icon","function":"coalesce","args":[{"value":"eye"},{"value":"eye"}]},{"as":"tone","function":"coalesce","args":[{"value":"action"},{"value":"action"}]},{"as":"priority","function":"number","args":[{"value":1}]}],"select":[{"field":"work-item-id","as":"attention-signal-id"},{"field":"kind"},{"field":"title"},{"field":"scope"},{"field":"reason"},{"field":"observed-at"},{"field":"action"},{"field":"evidence-link"},{"field":"run-link"},{"field":"icon"},{"field":"tone"},{"field":"priority"}]},{"name":"overview-needs-attention","subject":"Combine grouped repeated failures and unresolved review outputs without introducing ordinary activity or duplicate work items.","objective":"Prioritize observed blocked repeated-failure work and review-state outputs for investigation.","acceptance":"Rows come only from the repeated-failure or review inputs and retain their source reasons, links, and ordering; confirm fresh source status before acting, and do not equate a missing row with resolved work.","from":"overview-repeated-failure-attention","union":["overview-review-attention"],"order-by":[{"field":"priority","direction":"asc"},{"field":"observed-at","direction":"desc"},{"field":"attention-signal-id","direction":"asc"}]},{"name":"domain-route-record","subject":"Project the selected domain header and one retained run link.","objective":"Identify the selected domain and open a retained run before investigating its traffic evidence.","acceptance":"The route header preserves the selected domain and a run link from its retained observations; missing observations or links remain unavailable, and a header does not establish access policy or traffic completeness.","from":"domains","select":[{"field":"domain"},{"field":"run-link"}]},{"name":"domain-run-records","subject":"Retained run-linked observations for the selected domain.","objective":"Find related runs without returning the unscoped domain collection alongside the paginated view.","acceptance":"Preserve every domain observation field, exact route scope, filtering, ordering, total count, provenance and related-run links; only the bounded view payload crosses the worker boundary.","from":"domains"},{"name":"tool-route-record","subject":"Project the selected MCP tool header and one retained run link.","objective":"Identify the selected MCP tool and open a retained run before investigating its call evidence.","acceptance":"The route header preserves the selected MCP tool label and a run link from its retained calls; absent calls or links remain unavailable and do not imply zero usage or tool effectiveness.","from":"mcp-tool-calls","select":[{"field":"mcp-tool-label"},{"field":"run-link"}]},{"name":"audit-route-record","subject":"Project the selected audit summary header and one retained run link.","objective":"Identify the selected audit summary and open a retained run before investigating its observations.","acceptance":"The route header preserves the selected event summary and a run link from its retained audit observations; absent evidence remains unavailable and neither the header nor its absence establishes incident severity or a clean audit.","from":"audits","select":[{"field":"event-summary"},{"field":"run-link"}]},{"name":"domain-entity-insights","subject":"Summarize one domain entity for its dedicated Insights view.","objective":"Identify domain decisions with request volume worth investigating before considering any egress change.","acceptance":"For the selected domain, request totals match the retained domain observations grouped by decision; missing data or blocked traffic does not establish a need for access, which requires underlying request and policy review.","from":"domains","aggregate":{"by":["domain","decision"],"values":[{"field":"request-count","as":"requests","reducer":"sum"}]},"order-by":[{"field":"requests","direction":"desc"},{"field":"decision","direction":"asc"}]},{"name":"tool-entity-insights","subject":"Summarize one tool entity for its dedicated Insights view.","objective":"Select a tool and status combination whose recorded call volume merits investigation.","acceptance":"For the selected tool, observation counts match retained MCP call observations grouped by server, tool, and status; missing calls are not zero usage and status counts do not establish effectiveness or cause.","from":"mcp-tool-calls","aggregate":{"by":["mcp-tool-label","mcp-server","mcp-tool","mcp-status"],"values":[{"field":"mcp-observation","as":"observations","reducer":"count"}]},"order-by":[{"field":"observations","direction":"desc"},{"field":"mcp-status","direction":"asc"}]},{"name":"audit-entity-insights","subject":"Summarize one audit event entity for its dedicated Insights view.","objective":"Select an audit summary and status requiring closer review of underlying observations.","acceptance":"For the selected summary, counts agree with retained audit observation IDs grouped by event status; repeated observations are not silently treated as distinct incidents, and absence does not prove no findings.","from":"audits","aggregate":{"by":["event-summary","event-status"],"values":[{"field":"id","as":"observations","reducer":"count"}]},"order-by":[{"field":"observations","direction":"desc"},{"field":"event-status","direction":"asc"}]}] +[{"name":"command-queue","subject":"Show the durable local CLI command queue.","objective":"Inspect command lifecycle and reconnect to output without rerunning work.","acceptance":"Preserve persistent command IDs and all six server states; closing output never cancels execution. Unavailable local authority is not an empty queue.","from":"cli-commands","compute":[{"as":"command-action","function":"coalesce","args":[{"field":"actionId"},{"value":""}]},{"as":"command-title","function":"coalesce","args":[{"field":"command"},{"field":"actionId"}]},{"as":"command-target","function":"coalesce","args":[{"field":"repository"},{"field":"campaign"},{"field":"package-source"},{"value":"Local control repository"}]},{"as":"command-created-at","function":"coalesce","args":[{"field":"createdAt"},{"value":null}]},{"as":"command-href","function":"concat","args":[{"value":"#page-command?command="},{"field":"id"}]},{"as":"command-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"command-href"},{"field":"command-title"},{"field":"id"}]}]},{"name":"event-base","subject":"Project shared event fields before combining run-owned records.","objective":"Provide the narrow retained event evidence needed for inspection and run import-coverage analysis.","acceptance":"The result unions retained audit, domain, tool, and issue records with their available run identity; an empty or unavailable preview cannot establish zero source activity or complete import coverage.","from":"audits","union":["domains","tools","issues"],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"event"},{"field":"event-source"},{"field":"event-type"},{"field":"event-summary"},{"field":"event-status"},{"field":"github-entity-type"},{"field":"safe-output-type"},{"field":"safe-output-url"},{"field":"correlation-id"},{"field":"implementation-pull-request-url"},{"field":"event-timestamp"},{"field":"run-link"}]},{"name":"audit-event-runs","subject":"Count imported audit records per run before combining event sources.","objective":"Bound audit evidence for run import-coverage analysis.","acceptance":"Count only retained audit records with event identity by run attempt; missing evidence does not establish zero activity.","from":"audits","aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"event","as":"events","reducer":"count"}]}},{"name":"domain-event-runs","subject":"Count imported domain records per run before combining event sources.","objective":"Bound domain evidence for run import-coverage analysis.","acceptance":"Count only retained domain records with event identity by run attempt; missing evidence does not establish zero activity.","from":"domains","aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"event","as":"events","reducer":"count"}]}},{"name":"tool-event-runs","subject":"Count imported tool records per run before combining event sources.","objective":"Bound tool evidence for run import-coverage analysis.","acceptance":"Count only retained tool records with event identity by run attempt; missing evidence does not establish zero activity.","from":"tools","aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"event","as":"events","reducer":"count"}]}},{"name":"issue-event-runs","subject":"Count imported issue records per run before combining event sources.","objective":"Bound issue evidence for run import-coverage analysis.","acceptance":"Count only retained issue records with event identity by run attempt; missing evidence does not establish zero activity.","from":"issues","aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"event","as":"events","reducer":"count"}]}},{"name":"event-runs","subject":"Identify each workflow run that has one or more imported run-owned records.","objective":"Identify run attempts with retained imported records so their presence can be compared with observed runs.","acceptance":"One row per organization, repository, workflow, run, and attempt contains events, the count of matching retained records; no row in an available result does not prove that no event was produced.","description":"Distinct workflow runs represented by imported domain, tool, audit, or issue records.","from":"audit-event-runs","union":["domain-event-runs","tool-event-runs","issue-event-runs"],"aggregate":{"by":["organization","repository","workflow","run","run-attempt"],"values":[{"field":"events","as":"events","reducer":"sum"}]}},{"name":"run-import-status","subject":"Identify observed runs that have one or more imported run-owned records.","objective":"Compare observed run attempts with retained run-owned event evidence to locate import-coverage gaps for investigation.","acceptance":"Keep each observed run and its run-attempt identity; imported-event-count is zero and imported is false without a matching retained event, but missing events alone do not establish an ingestion failure.","description":"Observed runs enriched with imported-record status.","from":"runs","joins":[{"source":"event-runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"events","as":"imported-events"}]}],"compute":[{"as":"imported-event-count","function":"coalesce","args":[{"field":"imported-events"},{"value":0}]},{"as":"imported","function":"greater-than","args":[{"field":"imported-event-count"},{"value":0}]}]},{"name":"workflow-run-totals","subject":"Summarize observed run counts and imported runs by declared workflow.","objective":"Compare observed run attempts, conclusions, and imported-record coverage for each workflow.","acceptance":"Group by organization, repository, and workflow; report distinct run-attempt totals, successful and failed conclusion counts, and imported-run totals only from retained evidence. Missing run records cannot establish zero execution.","description":"Observed run and imported-run totals for each declared workflow.","from":"run-import-status","compute":[{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run-attempt-identity","as":"runs","reducer":"distinct-count"},{"field":"run-conclusion","as":"successful-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","equals":"success"}]}},{"field":"run-conclusion","as":"failed-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","stale","timed-out"]}]}},{"field":"imported","as":"imported-runs","reducer":"sum"}]}},{"name":"workflow-aic-run-totals","subject":"Summarize observed run attempts and AI Credits for workflow cost comparison.","objective":"Count retained run attempts and recorded AI Credits without loading imported-event coverage.","acceptance":"Count all distinct retained run attempts, but include only positive recorded AIC in cost totals and cost denominators; zero and missing telemetry cannot skew cost averages.","from":"runs","compute":[{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run-attempt-identity","as":"runs","reducer":"distinct-count"},{"field":"run-attempt-identity","as":"aic-runs","reducer":"distinct-count","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"aic-total","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}}]}},{"name":"workflow-aic-totals","subject":"Summarize observed AI Credit usage by declared workflow.","objective":"Expose retained AI Credit consumption per workflow for bounded cost review alongside observed execution.","acceptance":"Sum only positive recorded aic-total by organization, repository, and workflow; exclude zero and missing costs rather than treating them as free execution.","description":"Observed AI Credit totals for each declared workflow.","from":"workflow-aic-run-totals","filter":{"predicates":[{"field":"aic-runs","gte":1}]},"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"aic"},{"field":"aic-runs"}]},{"name":"mcp-tool-workflow-totals","subject":"Summarize observed MCP calls by tool and workflow before the tool inventory is materialized.","objective":"Keep MCP inventory intermediates bounded without dropping calls or changing byte totals.","acceptance":"Count retained observation identities and sum request and response bytes per server, tool, and workflow; retain safe-output-server classification for downstream exclusion.","from":"mcp-calls","compute":[{"as":"safe-output-server","function":"equals-any","args":[{"field":"mcp-server"},{"value":"safe_outputs"},{"value":"safeoutputs"}]},{"as":"mcp-tool-label","function":"concat","args":[{"field":"mcp-server"},{"value":"/"},{"field":"mcp-tool"}]},{"as":"workflow-key","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}],"aggregate":{"by":["safe-output-server","mcp-tool-label","mcp-server","mcp-tool","workflow-key"],"values":[{"field":"mcp-observation","as":"calls","reducer":"count"},{"field":"request-bytes","as":"request-bytes","reducer":"sum"},{"field":"response-bytes","as":"response-bytes","reducer":"sum"}]}},{"name":"mcp-tool-calls","subject":"Prepare MCP tool calls for aggregation with safe-output-server calls identified for downstream exclusion.","objective":"Identify retained MCP call labels and safe-output-server classification for downstream tool-use investigation.","acceptance":"Preserve each retained call with its workflow key and tool label and mark safe-output-server calls explicitly; downstream exclusion must not be mistaken for absence of those calls or complete tool telemetry.","description":"Observed MCP tool calls labeled with whether they belong to the internal safe outputs server.","from":"mcp-calls","compute":[{"as":"safe-output-server","function":"equals-any","args":[{"field":"mcp-server"},{"value":"safe_outputs"},{"value":"safeoutputs"}]},{"as":"mcp-tool-label","function":"concat","args":[{"field":"mcp-server"},{"value":"/"},{"field":"mcp-tool"}]},{"as":"workflow-key","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}]},{"name":"issue-safe-outputs","subject":"List retained GitHub issue safe outputs.","objective":"Inspect retained issue safe outputs and their observed closure state before deciding which items need follow-up.","acceptance":"Include only safe_output.result issue records, not pull requests; preserve issue and run links, timestamps, state, and status detail. Unknown or unobserved closure state must not be presented as closed.","description":"Issue-only projection of retained safe-output items.","from":"issues","filter":{"predicates":[{"field":"event-type","equals":"safe_output.result"},{"field":"is-pull-request","equals":false}]},"joins":[{"source":"runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"run-link","as":"linked-run"}]}],"compute":[{"as":"_issue-state-open","function":"equals-any","args":[{"field":"issue-state"},{"value":"OPEN"}]},{"as":"_issue-state-closed","function":"equals-any","args":[{"field":"issue-state"},{"value":"CLOSED"}]},{"as":"_issue-open-status","function":"if","args":[{"field":"_issue-state-open"},{"value":"Open"},{"value":"Unknown"}]},{"as":"issue-status","function":"if","args":[{"field":"_issue-state-closed"},{"value":"Closed"},{"field":"_issue-open-status"}]},{"as":"_issue-closing-reason","function":"coalesce","args":[{"field":"issue-state-reason"},{"value":"unknown"}]},{"as":"_issue-closing-reason-normalized","function":"lower","args":[{"field":"_issue-closing-reason"}]},{"as":"issue-closing-status","function":"title-case","args":[{"field":"_issue-closing-reason-normalized"}]},{"as":"_issue-closed-status-detail","function":"concat","args":[{"value":"Closed: "},{"field":"issue-closing-status"}]},{"as":"issue-status-detail","function":"if","args":[{"field":"_issue-state-closed"},{"field":"_issue-closed-status-detail"},{"field":"issue-status"}]}],"select":[{"field":"event-timestamp","as":"observed-at"},{"field":"github-entity-type"},{"field":"is-pull-request"},{"field":"safe-output-type"},{"field":"issue-state"},{"field":"issue-closed"},{"field":"issue-state-reason"},{"field":"issue-status"},{"field":"issue-closing-status"},{"field":"issue-status-detail"},{"field":"issue-closed-at"},{"field":"issue-status-observed-at"},{"field":"event-summary"},{"field":"correlation-id","as":"entity-url"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"linked-run","as":"run-link"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"entity-url","direction":"asc"}]},{"name":"issue-safe-output-label-options","subject":"List observed safe-output badges for the issue list Labels filter.","objective":"Choose retained safe-output types without scanning or filtering presented cards.","acceptance":"Return distinct observed badge values in ascending order; missing evidence is not an empty label inventory.","from":"issue-safe-outputs","aggregate":{"by":["safe-output-type"],"values":[{"field":"entity-url","as":"items","reducer":"count"}]},"order-by":[{"field":"safe-output-type","direction":"asc"}]},{"name":"issue-status-label-options","subject":"List observed status badges for the issue list Status filter.","objective":"Choose retained issue states and closing reasons without inferring resolution.","acceptance":"Return distinct observed status details in ascending order; Unknown remains distinct from Open and Closed.","from":"issue-safe-outputs","aggregate":{"by":["issue-status-detail"],"values":[{"field":"entity-url","as":"items","reducer":"count"}]},"order-by":[{"field":"issue-status-detail","direction":"asc"}]},{"name":"issue-repository-totals","subject":"Rank the ten repositories with the most retained GitHub issue safe outputs.","objective":"Locate repositories with the largest observed issue-safe-output volume for a bounded review of linked records.","acceptance":"Return at most ten repository coordinates ordered by retained issue-record count; ties or missing issue evidence must not imply a complete fleet ranking or unique issue count.","description":"Top repositories by retained issue safe-output count.","from":"issue-safe-outputs","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]}],"aggregate":{"by":["repository-coordinate"],"values":[{"field":"entity-url","as":"issues","reducer":"count"}]},"order-by":[{"field":"issues","direction":"desc"},{"field":"repository-coordinate","direction":"asc"}],"limit":10},{"name":"campaign-import-audit-count","subject":"Count retained audit identities for campaign inventory source quality.","objective":"Retain audit provenance without reconstructing run coverage.","acceptance":"Count canonical audit IDs; missing evidence stays unavailable and the count is not displayed as import coverage.","from":"audits","aggregate":{"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"campaign-import-domain-count","subject":"Count retained domain identities for campaign inventory source quality.","objective":"Retain domain provenance without reconstructing run coverage.","acceptance":"Count canonical domain IDs; missing evidence stays unavailable and the count is not displayed as import coverage.","from":"domains","aggregate":{"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"campaign-import-tool-count","subject":"Count retained tool identities for campaign inventory source quality.","objective":"Retain tool provenance without reconstructing run coverage.","acceptance":"Count canonical tool IDs; missing evidence stays unavailable and the count is not displayed as import coverage.","from":"tools","aggregate":{"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"campaign-import-issue-count","subject":"Count retained issue identities for campaign inventory source quality.","objective":"Retain issue provenance without reconstructing run coverage.","acceptance":"Count canonical issue IDs; missing evidence stays unavailable and the count is not displayed as import coverage.","from":"issues","aggregate":{"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"campaign-workflow-import-evidence","subject":"Compose retained import-source quality for campaign workflow execution totals.","objective":"Preserve all four import dependencies without counting unused per-run or per-workflow coverage.","acceptance":"Compose audit, domain, tool, and issue availability, freshness, and completeness exactly as event-runs. The retained-record count carries source quality only; it is not displayed or used as horizon-specific import coverage, executions, or outcomes. Run and AI Credit totals retain their selected horizon.","from":"campaign-import-audit-count","union":["campaign-import-domain-count","campaign-import-tool-count","campaign-import-issue-count"],"time":{"range":"all"},"compute":[{"as":"import-scope","function":"literal","args":[{"value":"retained"}]}],"aggregate":{"by":["import-scope"],"values":[{"field":"records","as":"events","reducer":"sum"}]}},{"name":"campaign-workflow-execution-base","subject":"Summarize retained run attempts and AI Credits before campaign workflow enrichment.","objective":"Read run identity and recorded AI Credits together instead of enriching every run with import status.","acceptance":"Count distinct run-attempt identities and sum aic-total per organization, repository, and workflow; missing retained evidence is not proof of no execution or cost.","from":"runs","compute":[{"as":"import-scope","function":"literal","args":[{"value":"retained"}]},{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["organization","repository","workflow","import-scope"],"values":[{"field":"run-attempt-identity","as":"runs","reducer":"distinct-count"},{"field":"aic-total","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}}]}},{"name":"campaign-workflow-execution-totals","subject":"Attach retained import-evidence quality to compact workflow execution totals.","objective":"Preserve the public inventory's run and import availability composition after aggregating run evidence.","acceptance":"Keep runs and AI Credits unchanged; unavailable run evidence fails closed and optional import evidence degrades quality exactly as in run-import-status.","description":"Only source quality is consumed from import evidence. Join its compact retained-source summary after run aggregation; do not build unused run-level import coverage or change horizon-specific execution totals.","from":"campaign-workflow-execution-base","joins":[{"source":"campaign-workflow-import-evidence","type":"left","on":[{"left":"import-scope","right":"import-scope"}],"fields":[{"field":"events","as":"imported-events"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"runs"},{"field":"aic"}]},{"name":"campaign-workflow-declarations","subject":"Project reusable campaign workflow declarations without execution evidence.","objective":"Share declaration display fields between structural topology and execution inventory without joining runs or import evidence.","acceptance":"Preserve raw organization, repository, workflow and declaration fields for joins. Select orchestrator and worker roles once, retaining inactive and unknown declarations; only list consumers select active entries. Display defaults and repository links do not establish execution, enrollment or authority.","from":"workflows","filter":{"predicates":[{"field":"workflow-role","in":["orchestrator","worker"]}]},"compute":[{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"declared-mode","function":"coalesce","args":[{"field":"rollout-mode"},{"value":"unknown"}]},{"as":"declared-registration","function":"coalesce","args":[{"field":"workflow-active"},{"value":"unknown"}]},{"as":"campaign-title","function":"title-case","args":[{"field":"campaign"}]},{"as":"campaign-display-name","function":"coalesce","args":[{"field":"campaign-name"},{"field":"campaign-title"},{"value":"Repository-owned"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-slug"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-slug"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-slug"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"campaign"},{"field":"campaign-name"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"rollout-mode"},{"field":"workflow-active"},{"field":"repository-link"},{"field":"workflow-link"},{"field":"repository-slug"},{"field":"declared-mode"},{"field":"declared-registration"},{"field":"campaign-display-name"},{"field":"workflow-display-name"},{"field":"repository-dashboard-link"}]},{"name":"campaign-workflow-inventory","subject":"Project declared campaign workflows with lean execution and configuration evidence.","objective":"Provide campaign totals and lists from shared declarations with separate execution and import-quality evidence.","acceptance":"Keep all declared orchestrators and workers, including inactive and unobserved entries; preserve inventory ordering, configuration defaults, execution totals, and import-evidence quality.","description":"Lean campaign inventory with execution totals that retain the public workflow inventory's evidence-quality dependencies.","from":"campaign-workflow-declarations","joins":[{"source":"campaign-workflow-execution-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"aic","as":"observed-aic"}]}],"compute":[{"as":"total-runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"total-aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"organization"},{"field":"repository-slug","as":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"declared-registration","as":"workflow-active"},{"field":"total-runs","as":"runs"},{"field":"total-aic","as":"aic"},{"field":"repository-link"},{"field":"workflow-link"},{"field":"campaign-display-name"},{"field":"workflow-display-name"},{"field":"repository-dashboard-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"workflow-inventory","subject":"List declared workflows with their campaign, repository, configuration, and observed execution totals.","objective":"Compare declared workflow configuration with retained run, import-coverage, and AI Credit evidence to select a workflow for closer inspection.","acceptance":"Keep one row per declared workflow with identity, role, mode, registration, links, observed totals, and ingestion indicator; zero joined totals and missing evidence must not be treated as proof of no execution or complete ingestion.","description":"Central campaign and repository-owned workflow inventory with observed execution totals.","from":"workflows","joins":[{"source":"workflow-run-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"successful-runs","as":"observed-successful-runs"},{"field":"failed-runs","as":"observed-failed-runs"},{"field":"imported-runs","as":"observed-imported-runs"}]},{"source":"workflow-aic-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"aic","as":"observed-aic"},{"field":"aic-runs","as":"observed-aic-runs"}]}],"compute":[{"as":"campaign-title","function":"title-case","args":[{"field":"campaign"}]},{"as":"campaign-display-name","function":"coalesce","args":[{"field":"campaign-name"},{"field":"campaign-title"},{"value":"Repository-owned"}]},{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"declared-role","function":"coalesce","args":[{"field":"workflow-role"},{"value":"standalone"}]},{"as":"declared-mode","function":"coalesce","args":[{"field":"rollout-mode"},{"value":"unknown"}]},{"as":"declared-registration","function":"coalesce","args":[{"field":"workflow-active"},{"value":"unknown"}]},{"as":"total-runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"total-successful-runs","function":"coalesce","args":[{"field":"observed-successful-runs"},{"value":0}]},{"as":"has-observed-runs","function":"greater-than","args":[{"field":"total-runs"},{"value":0}]},{"as":"total-failed-runs","function":"coalesce","args":[{"field":"observed-failed-runs"},{"value":0}]},{"as":"total-aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]},{"as":"aic-per-run","function":"quotient","args":[{"field":"total-aic"},{"field":"observed-aic-runs"}]},{"as":"total-imported-runs","function":"coalesce","args":[{"field":"observed-imported-runs"},{"value":0}]},{"as":"ingestion-rate","function":"quotient","args":[{"field":"total-imported-runs"},{"field":"total-runs"}]},{"as":"ingestion","function":"format-percent","args":[{"field":"ingestion-rate"}]},{"as":"encoded-campaign","function":"url-encode","args":[{"field":"campaign"}]},{"as":"campaign-dashboard-href","function":"concat","args":[{"value":"#page-campaign-insights?campaign="},{"field":"encoded-campaign"}]},{"as":"campaign-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"campaign-display-name"},{"value":" campaign dashboard"}]},{"as":"campaign-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"campaign-dashboard-href"},{"field":"campaign-dashboard-label"},{"field":"campaign"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-slug"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-slug"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-slug"}]},{"as":"workflow-identity","function":"concat","args":[{"field":"repository-slug"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-identity"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-display-name"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-identity"}]}],"select":[{"field":"campaign"},{"field":"campaign-display-name","as":"campaign-name"},{"field":"organization"},{"field":"repository-slug","as":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-identity","as":"workflow-label"},{"field":"declared-role","as":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"declared-registration","as":"workflow-active"},{"field":"total-aic","as":"aic"},{"field":"total-runs","as":"runs"},{"field":"total-successful-runs","as":"successful-runs"},{"field":"total-failed-runs","as":"failed-runs"},{"field":"aic-per-run"},{"field":"has-observed-runs"},{"field":"ingestion"},{"field":"campaign-dashboard-link","as":"campaign-link"},{"field":"repository-dashboard-link","as":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"repository-run-statistics","subject":"Reduce run counts, conclusions, and positive AI Credits before repository enrichment.","objective":"Share one row-local run aggregate between repository execution and cost summaries.","acceptance":"Keep organization/repository grain, distinct run IDs, existing failure and approval counts, and positive recorded AIC. Reduce before joins; missing evidence is not zero activity or free execution.","from":"runs","compute":[{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["organization","repository"],"values":[{"field":"run","as":"runs","reducer":"distinct-count"},{"field":"run-conclusion","as":"failed","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","timed-out"]}]}},{"field":"run-conclusion","as":"action-required","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","equals":"action-required"}]}},{"field":"run","as":"aic-runs","reducer":"count","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"aic-total","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}}]}},{"name":"repository-aic-totals","subject":"Summarize observed AI Credit usage by repository.","objective":"Provide repository-level retained AI Credit totals for comparing observed usage with run activity.","acceptance":"Sum only positive recorded aic-total by organization and repository; exclude zero and missing costs rather than treating them as free execution.","description":"Observed AI Credit totals for each repository.","from":"repository-run-statistics","filter":{"predicates":[{"field":"aic-runs","gte":1}]},"select":[{"field":"organization"},{"field":"repository"},{"field":"aic"}]},{"name":"maintenance-campaign-packages","subject":"Installed campaign packages with retained source coordinates and update evidence.","objective":"Show installed/current source revisions and gate update actions on exact retained provenance.","acceptance":"Return every package. Set campaign-update-action-visible only for update-available rows with a non-empty source; missing provenance stays visible and non-actionable.","from":"campaigns","compute":[{"as":"campaign-source-unavailable","function":"equals-any","args":[{"field":"campaign-source"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"campaign-action-state","function":"if","args":[{"field":"campaign-source-unavailable"},{"value":"unknown"},{"field":"campaign-update-state"}]},{"as":"campaign-update-action-visible","function":"equals-any","args":[{"field":"campaign-action-state"},{"value":"update-available"}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"campaign-description"},{"field":"campaign-icon"},{"field":"campaign-source"},{"field":"campaign-version"},{"field":"campaign-current-version"},{"field":"campaign-update-state"},{"field":"campaign-registration"},{"field":"campaign-update-action-visible"}],"order-by":[{"field":"campaign-name","direction":"asc"}]},{"name":"maintenance-standalone-workflows","subject":"Standalone workflows with retained upstream provenance and update evidence.","objective":"Represent source-managed and local workflows without synthetic campaign membership.","acceptance":"Retain exact coordinates and revisions for source-managed rows; keep local or incomplete rows visible and non-actionable with an explicit reason.","from":"workflows","filter":{"predicates":[{"field":"workflow-role","equals":"standalone"},{"field":"workflow-source-kind","in":["source-managed","local"]}]},"compute":[{"as":"workflow-source-installed-unavailable","function":"equals-any","args":[{"field":"workflow-source-version"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"workflow-source-latest-unavailable","function":"equals-any","args":[{"field":"workflow-source-current-version"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"workflow-is-local","function":"equals-any","args":[{"field":"workflow-source-kind"},{"value":"local"}]},{"as":"workflow-source-state","function":"if","args":[{"field":"workflow-is-local"},{"value":"local"},{"field":"workflow-source-update-state"}]},{"as":"workflow-source-update-available","function":"equals-any","args":[{"field":"workflow-source-state"},{"value":"update-available"}]},{"as":"workflow-source-update-unknown","function":"equals-any","args":[{"field":"workflow-source-state"},{"value":"unknown"}]},{"as":"workflow-update-state-known","function":"if","args":[{"field":"workflow-source-update-available"},{"value":"Update available"},{"value":"Current"}]},{"as":"workflow-update-state-with-unknown","function":"if","args":[{"field":"workflow-source-update-unknown"},{"value":"Update status unavailable"},{"field":"workflow-update-state-known"}]},{"as":"workflow-update-state","function":"if","args":[{"field":"workflow-is-local"},{"value":"Local workflow"},{"field":"workflow-update-state-with-unknown"}]},{"as":"workflow-update-reason-installed","function":"if","args":[{"field":"workflow-source-installed-unavailable"},{"value":"Installed source revision unavailable."},{"value":"Installed and upstream source revisions are available."}]},{"as":"workflow-update-reason-latest","function":"if","args":[{"field":"workflow-source-latest-unavailable"},{"value":"Latest upstream source revision unavailable."},{"field":"workflow-update-reason-installed"}]},{"as":"workflow-update-status-reason","function":"if","args":[{"field":"workflow-is-local"},{"value":"No upstream source coordinate was retained; update manually."},{"field":"workflow-update-reason-latest"}]},{"as":"workflow-update-action-visible","function":"equals-any","args":[{"field":"workflow-source-state"},{"value":"update-available"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-source-kind"},{"field":"workflow-source"},{"field":"workflow-source-version"},{"field":"workflow-source-current-version"},{"field":"workflow-source-update-state"},{"field":"workflow-update-state"},{"field":"workflow-update-status-reason"},{"field":"workflow-update-action-visible"}],"order-by":[{"field":"workflow-update-action-visible","direction":"desc"},{"field":"workflow-name","direction":"asc"}]},{"name":"maintenance-repository-versions","subject":"Group installed and current gh-aw compiler versions and upgrade evidence by repository.","objective":"Identify repositories with declared Markdown workflows whose retained compiler-version evidence warrants upgrade review.","acceptance":"Group Markdown workflow declarations by repository coordinate and return distinct known installed/current version lists, distinct counts, upgrade-required evidence, and separate missing-installed/missing-latest flags. Never infer unavailable versions.","from":"workflows","filter":{"predicates":[{"field":"workflow","includes":".md"}]},"compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"installed-version-unavailable","function":"equals-any","args":[{"field":"gh-aw-version"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"current-version-unavailable","function":"equals-any","args":[{"field":"gh-aw-current-version"},{"value":""},{"value":"unknown"},{"value":null}]},{"as":"known-installed-version","function":"if","args":[{"field":"installed-version-unavailable"},{"value":null},{"field":"gh-aw-version"}]},{"as":"known-current-version","function":"if","args":[{"field":"current-version-unavailable"},{"value":null},{"field":"gh-aw-current-version"}]},{"as":"installed-version-unavailable-value","function":"if","args":[{"field":"installed-version-unavailable"},{"value":1},{"value":0}]},{"as":"current-version-unavailable-value","function":"if","args":[{"field":"current-version-unavailable"},{"value":1},{"value":0}]},{"as":"compiler-versions-match","function":"equals-any","args":[{"field":"gh-aw-version"},{"field":"gh-aw-current-version"}]},{"as":"upgrade-candidate-value","function":"if","args":[{"field":"compiler-versions-match"},{"value":0},{"value":1}]},{"as":"upgrade-with-current-evidence","function":"if","args":[{"field":"current-version-unavailable"},{"value":0},{"field":"upgrade-candidate-value"}]},{"as":"upgrade-required-value","function":"if","args":[{"field":"installed-version-unavailable"},{"value":0},{"field":"upgrade-with-current-evidence"}]}],"aggregate":{"by":["repository-coordinate"],"values":[{"field":"known-installed-version","as":"gh-aw-version","reducer":"distinct-list"},{"field":"known-current-version","as":"gh-aw-current-version","reducer":"distinct-list"},{"field":"known-installed-version","as":"installed-version-count","reducer":"distinct-count"},{"field":"known-current-version","as":"current-version-count","reducer":"distinct-count"},{"field":"upgrade-required-value","as":"upgrade-required","reducer":"max"},{"field":"installed-version-unavailable-value","as":"installed-version-unavailable","reducer":"max"},{"field":"current-version-unavailable-value","as":"current-version-unavailable","reducer":"max"}]}},{"name":"maintenance-repositories","subject":"List each repository with recorded compiler versions and computed upgrade state.","objective":"Expose recorded compiler versions, computed upgrade state, and a concise evidence diagnostic per repository, with its GitHub home URL for inspection.","acceptance":"Return repository, repository-url, known version lists, upgrade-required, upgrade-state, upgrade-status-reason, and upgrade-action-visible. Show Upgrade only when known evidence establishes an outdated compiler; missing or conflicting evidence stays visible and non-actionable.","from":"maintenance-repository-versions","compute":[{"as":"repository-url","function":"concat","args":[{"value":"https://github.com/"},{"field":"repository-coordinate"}]},{"as":"should-upgrade","function":"equals-any","args":[{"field":"upgrade-required"},{"value":1}]},{"as":"installed-version-mixed","function":"greater-than","args":[{"field":"installed-version-count"},{"value":1}]},{"as":"current-version-conflicting","function":"greater-than","args":[{"field":"current-version-count"},{"value":1}]},{"as":"installed-version-missing","function":"equals-any","args":[{"field":"installed-version-unavailable"},{"value":1}]},{"as":"current-version-missing","function":"equals-any","args":[{"field":"current-version-unavailable"},{"value":1}]},{"as":"latest-version-evidence-unavailable","function":"if","args":[{"field":"current-version-missing"},{"value":true},{"field":"current-version-conflicting"}]},{"as":"upgrade-status-unavailable","function":"if","args":[{"field":"installed-version-missing"},{"value":true},{"field":"latest-version-evidence-unavailable"}]},{"as":"current-or-unavailable","function":"if","args":[{"field":"should-upgrade"},{"value":true},{"field":"upgrade-status-unavailable"}]},{"as":"upgrade-state-known","function":"if","args":[{"field":"should-upgrade"},{"value":"Upgrade recommended"},{"value":"Current"}]},{"as":"upgrade-state","function":"if","args":[{"field":"upgrade-status-unavailable"},{"value":"Upgrade status unavailable"},{"field":"upgrade-state-known"}]},{"as":"upgrade-reason-known","function":"if","args":[{"field":"should-upgrade"},{"value":"At least one retained workflow uses an older gh-aw compiler version."},{"value":"All retained workflow compiler versions match the latest stable gh-aw release."}]},{"as":"upgrade-reason-mixed","function":"if","args":[{"field":"installed-version-mixed"},{"value":"Mixed installed gh-aw compiler versions were retained; at least one upgrade is recommended."},{"field":"upgrade-reason-known"}]},{"as":"upgrade-reason-installed","function":"if","args":[{"field":"installed-version-missing"},{"value":"Installed gh-aw compiler version unavailable for one or more workflows."},{"field":"upgrade-reason-mixed"}]},{"as":"upgrade-reason-current","function":"if","args":[{"field":"current-version-missing"},{"value":"Latest stable gh-aw release unavailable."},{"field":"upgrade-reason-installed"}]},{"as":"both-compiler-versions-missing","function":"if","args":[{"field":"installed-version-missing"},{"field":"current-version-missing"},{"value":false}]},{"as":"upgrade-reason-both","function":"if","args":[{"field":"both-compiler-versions-missing"},{"value":"Installed compiler version and latest stable gh-aw release are unavailable."},{"field":"upgrade-reason-current"}]},{"as":"upgrade-status-reason","function":"if","args":[{"field":"current-version-conflicting"},{"value":"Conflicting latest gh-aw release evidence was retained."},{"field":"upgrade-reason-both"}]},{"as":"upgrade-action-visible","function":"if","args":[{"field":"upgrade-status-unavailable"},{"value":false},{"field":"should-upgrade"}]},{"as":"installed-version-available","function":"greater-than","args":[{"field":"installed-version-count"},{"value":0}]},{"as":"current-version-available","function":"greater-than","args":[{"field":"current-version-count"},{"value":0}]},{"as":"gh-aw-version-label","function":"if","args":[{"field":"installed-version-available"},{"field":"gh-aw-version"},{"value":"unknown"}]},{"as":"gh-aw-current-version-label","function":"if","args":[{"field":"current-version-available"},{"field":"gh-aw-current-version"},{"value":"unknown"}]}],"select":[{"field":"repository-coordinate","as":"repository"},{"field":"repository-url"},{"field":"gh-aw-version-label","as":"gh-aw-version"},{"field":"gh-aw-current-version-label","as":"gh-aw-current-version"},{"field":"upgrade-required"},{"field":"upgrade-action-visible"},{"field":"upgrade-state"},{"field":"upgrade-status-reason"}],"order-by":[{"field":"repository","direction":"asc"}]},{"name":"maintenance-campaign-updates","subject":"Expose at most one CAO package update row for the Updates navigation indicator.","objective":"Determine whether retained campaign metadata contains an update-available signal for the Updates indicator.","acceptance":"Return zero or one campaign-update-state row only when it equals update-available; an empty result means no matching retained signal, not that every campaign is current.","from":"maintenance-campaign-packages","filter":{"predicates":[{"field":"campaign-update-action-visible","equals":true}]},"select":[{"field":"campaign-update-action-visible"}],"limit":1},{"name":"maintenance-standalone-updates","subject":"Expose at most one standalone workflow source update row for the Updates navigation indicator.","objective":"Determine whether retained source-managed standalone workflow metadata contains an actionable update signal for the Updates indicator.","acceptance":"Return zero or one workflow-update-action-visible row only when it is true; unmanaged local workflows and incomplete source evidence do not activate the indicator.","from":"maintenance-standalone-workflows","filter":{"predicates":[{"field":"workflow-update-action-visible","equals":true}]},"select":[{"field":"workflow-update-action-visible"}],"limit":1},{"name":"maintenance-repository-upgrades","subject":"Expose at most one gh-aw compiler upgrade row for the Updates navigation indicator.","objective":"Determine whether repository compiler metadata contains an upgrade-required signal for the Updates indicator.","acceptance":"Return zero or one upgrade-action-visible row only when known retained evidence establishes an outdated compiler; missing evidence remains non-actionable and does not activate the indicator.","from":"maintenance-repositories","filter":{"predicates":[{"field":"upgrade-action-visible","equals":true}]},"select":[{"field":"upgrade-action-visible"}],"limit":1},{"name":"run-incomplete-outcomes","subject":"Project retained report-incomplete terminal outcomes as concise run diagnoses.","objective":"Find recorded report_incomplete terminal outcomes that can explain a specific run's incomplete reporting.","acceptance":"Include only runs with a recorded report_incomplete terminal outcome, preserving run-attempt identity, outcome kind, and recorded diagnosis; absence is not proof that reporting completed.","description":"One retained incomplete-evidence diagnosis per workflow Run when the agent explicitly reported that required evidence or access was unavailable.","from":"runs","filter":{"predicates":[{"field":"terminal-outcome","equals":"report_incomplete"}]},"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"terminal-outcome","as":"outcome-kind"},{"field":"terminal-outcome-detail","as":"outcome-diagnosis"}]},{"name":"campaign-runs","subject":"Project workflow runs with campaign attribution and retained failure evidence.","objective":"Connect retained run status and failure details to declared campaign/workflow identity for run-level diagnosis.","acceptance":"Expose run and attempt identity, declared attribution, runtime and target repositories, status, failure and incomplete-outcome evidence, timestamps, and drill-down links; do not infer an outcome from runtime success or missing details.","description":"Canonical workflow runs joined to their declared campaign and workflow identity.","from":"runs","joins":[{"source":"workflows","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"declared-campaign"},{"field":"campaign-name","as":"declared-campaign-name"},{"field":"workflow-name","as":"declared-workflow-name"},{"field":"workflow-role","as":"declared-workflow-role"},{"field":"workflow-link","as":"declared-workflow-link"}]},{"source":"run-incomplete-outcomes","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"outcome-kind","as":"outcome-kind"},{"field":"outcome-diagnosis","as":"outcome-diagnosis"}]}],"compute":[{"as":"status","function":"coalesce","args":[{"field":"run-conclusion"},{"field":"run-status"},{"value":"unknown"}]},{"as":"effective-outcome-kind","function":"coalesce","args":[{"field":"outcome-kind"},{"field":"terminal-outcome"},{"value":""}]},{"as":"is-incomplete-outcome","function":"equals-any","args":[{"field":"effective-outcome-kind"},{"value":"report_incomplete"}]},{"as":"diagnosis-kind","function":"if","args":[{"field":"is-incomplete-outcome"},{"value":"incomplete_evidence"},{"value":""}]},{"as":"error-signature","function":"coalesce","args":[{"field":"diagnosis-kind"},{"field":"failure-kind"},{"field":"classification"},{"field":"status"}]},{"as":"_error-signature-default-label","function":"title-case","args":[{"field":"error-signature"}]},{"as":"_is-driver-exit","function":"equals-any","args":[{"field":"error-signature"},{"value":"driver_exit"},{"value":"driver-exit"}]},{"as":"error-signature-label","function":"if","args":[{"field":"_is-driver-exit"},{"value":"Agent process exited unexpectedly"},{"field":"_error-signature-default-label"}]},{"as":"status-detail","function":"coalesce","args":[{"field":"outcome-diagnosis"},{"field":"terminal-outcome-detail"},{"field":"failure-detail"},{"field":"failure-message"},{"field":"failure-step"},{"field":"admission-reason"},{"value":""}]},{"as":"runtime-repository","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"is-worker","function":"equals-any","args":[{"field":"declared-workflow-role"},{"value":"worker"}]},{"as":"is-orchestrator","function":"equals-any","args":[{"field":"declared-workflow-role"},{"value":"orchestrator"}]},{"as":"root-dispatch-type","function":"if","args":[{"field":"is-orchestrator"},{"value":"Campaign orchestrator"},{"value":"Standalone workflow"}]},{"as":"dispatch-type","function":"if","args":[{"field":"is-worker"},{"value":"Campaign worker"},{"field":"root-dispatch-type"}]},{"as":"campaign-display-name","function":"coalesce","args":[{"field":"declared-campaign-name"},{"field":"declared-campaign"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"declared-workflow-name"},{"field":"workflow"}]},{"as":"encoded-campaign","function":"url-encode","args":[{"field":"declared-campaign"}]},{"as":"campaign-dashboard-href","function":"concat","args":[{"value":"#page-campaign-insights?campaign="},{"field":"encoded-campaign"}]},{"as":"campaign-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"campaign-display-name"},{"value":" campaign dashboard"}]},{"as":"campaign-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"campaign-dashboard-href"},{"field":"campaign-dashboard-label"},{"field":"declared-campaign"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"runtime-repository"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"runtime-repository"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"runtime-repository"}]},{"as":"workflow-identity","function":"concat","args":[{"field":"runtime-repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-identity"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-display-name"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-identity"}]}],"select":[{"field":"started-at"},{"field":"dispatch-type"},{"field":"declared-campaign","as":"campaign"},{"field":"declared-campaign-name","as":"campaign-name"},{"field":"declared-workflow-name","as":"workflow-name"},{"field":"run"},{"field":"run-attempt"},{"field":"run-title"},{"field":"event"},{"field":"runtime-repository"},{"field":"target-repository"},{"field":"rollout-mode"},{"field":"status"},{"field":"run-status"},{"field":"error-signature"},{"field":"error-signature-label"},{"field":"status-detail"},{"field":"outcome-kind"},{"field":"outcome-diagnosis"},{"field":"declared-workflow-role","as":"workflow-role"},{"field":"failure-job"},{"field":"failure-message"},{"field":"failure-step"},{"field":"failure-log"},{"field":"engine"},{"field":"engine-version"},{"field":"gh-aw-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"aic-total"},{"field":"safe-items-count"},{"field":"resource-reset-at","as":"status-detail-at"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"declared-workflow-link","as":"workflow-source-link"},{"field":"run-link"},{"field":"campaign-dashboard-link","as":"campaign-link"},{"field":"repository-dashboard-link","as":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"}],"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"campaign-runtime-health-runs","subject":"Project only the run and workflow fields required to classify current campaign runtime health.","objective":"Provide the retained run identity, timing, role, dispatch type, repository, and status needed to assess campaign runtime-health groups.","acceptance":"Project the selected fields from overview-runs without converting missing statuses or unattributed workflows into failures; unavailable run history leaves health assessment incomplete.","description":"A bounded runtime-health input that excludes audit outcomes and presentation-only campaign run fields.","from":"overview-runs","compute":[{"as":"status","function":"coalesce","args":[{"field":"run-conclusion"},{"field":"run-status"},{"value":"unknown"}]},{"as":"runtime-repository","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"is-worker","function":"equals-any","args":[{"field":"workflow-role"},{"value":"worker"}]},{"as":"is-orchestrator","function":"equals-any","args":[{"field":"workflow-role"},{"value":"orchestrator"}]},{"as":"root-dispatch-type","function":"if","args":[{"field":"is-orchestrator"},{"value":"Campaign orchestrator"},{"value":"Standalone workflow"}]},{"as":"dispatch-type","function":"if","args":[{"field":"is-worker"},{"value":"Campaign worker"},{"field":"root-dispatch-type"}]}],"select":[{"field":"started-at"},{"field":"campaign"},{"field":"campaign-name"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"dispatch-type"},{"field":"runtime-repository"},{"field":"run"},{"field":"run-status"},{"field":"status"}]},{"name":"campaign-runtime-health-groups","subject":"Compute each campaign workflow and runtime repository's latest consecutive failure streak in the selected horizon.","objective":"Locate campaign workflow/runtime-repository groups whose most recent retained completed runs have consecutive runtime failures.","acceptance":"Group completed runs by campaign, workflow, role, dispatch type, and runtime repository; failure-count is the latest retained failure streak, not a rate or a claim about runs outside the available horizon.","description":"Current retained failure streaks grouped by campaign workflow and runtime repository, considering only concluded Runs so an in-flight retry cannot mask an active failure streak.","from":"campaign-runtime-health-runs","filter":{"predicates":[{"field":"run-status","equals":"completed"}]},"compute":[{"as":"is-runtime-failure","function":"equals-any","args":[{"field":"status"},{"value":"failure"},{"value":"startup-failure"},{"value":"stale"},{"value":"timed-out"}]},{"as":"runtime-failure-streak-point","function":"failure-streak-point","args":[{"field":"started-at"},{"field":"run"},{"field":"is-runtime-failure"}]}],"aggregate":{"by":["campaign","campaign-name","workflow","workflow-name","workflow-role","dispatch-type","runtime-repository"],"values":[{"field":"runtime-failure-streak-point","as":"failure-count","reducer":"latest-failure-streak"}]}},{"name":"workflow-run-observation-counts","subject":"Count retained Runs for each workflow identity in the selected horizon.","objective":"Measure retained run presence by workflow identity to compare with active orchestrator declarations.","acceptance":"Count overview-runs by organization, repository, and workflow; a missing group indicates no retained matching run in the available horizon, not proof of no executions.","description":"One row per organization, repository, and workflow with retained Run counts, safe to join without row multiplication.","from":"overview-runs","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run","as":"observed-run-count","reducer":"count"}]}},{"name":"campaign-active-orchestrator-run-presence","subject":"Count retained Runs for each active campaign orchestrator in the selected horizon.","objective":"Compare active orchestrator declarations with retained run observations to identify missing visibility.","acceptance":"Keep only workflows declared active with orchestrator role and expose their identity, runtime repository, and observed-run-count; a zero joined count means no retained match, not necessarily a stopped schedule.","description":"Active campaign orchestrators annotated with retained Run presence.","from":"workflows","joins":[{"source":"workflow-run-observation-counts","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"observed-run-count","as":"joined-observed-run-count"}]}],"filter":{"predicates":[{"field":"workflow-role","equals":"orchestrator"},{"field":"workflow-active","equals":"true"}]},"compute":[{"as":"runtime-repository","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"observed-run-count","function":"coalesce","args":[{"field":"joined-observed-run-count"},{"value":0}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"runtime-repository"},{"field":"observed-run-count"}]},{"name":"campaign-unobserved-orchestrator-candidates","subject":"Mark active campaign orchestrators with no retained Runs in the selected horizon.","objective":"Mark active orchestrators lacking retained run evidence for bounded telemetry or schedule review.","acceptance":"Preserve active orchestrator identity and observed-run-count; is-unobserved marks zero retained matches and must not be interpreted as a runtime failure or evidence that dispatch was expected.","description":"Active orchestrators annotated with whether runtime evidence is absent.","from":"campaign-active-orchestrator-run-presence","compute":[{"as":"is-unobserved","function":"equals-any","args":[{"field":"observed-run-count"},{"value":0}]},{"as":"failure-count","function":"sum","args":[{"value":0},{"value":0}]},{"as":"dispatch-type","function":"coalesce","args":[{"value":"Campaign orchestrator"},{"value":"Campaign orchestrator"}]},{"as":"problem-kind","function":"coalesce","args":[{"value":"not-observed"},{"value":"not-observed"}]}]},{"name":"campaign-unobserved-orchestrators","subject":"Show active campaign orchestrators with no retained Runs in the selected horizon.","objective":"List active orchestrator declarations with no retained run observations for follow-up on evidence availability.","acceptance":"Return only is-unobserved candidates with their workflow and repository identity; an empty result does not certify run completeness or scheduler health.","description":"Active campaign orchestrators whose runtime state cannot be established from retained evidence.","from":"campaign-unobserved-orchestrator-candidates","filter":{"predicates":[{"field":"is-unobserved","equals":true}]}},{"name":"dispatches","subject":"Select workflow-dispatch runs from campaign-attributed workflow run evidence.","objective":"Inspect retained workflow_dispatch runs attributed to campaigns before comparing campaign dispatch activity.","acceptance":"Include only campaign-runs with event workflow_dispatch and preserve run, attempt, attribution, status, and time; absence does not establish that no dispatch occurred beyond retained evidence.","description":"Canonical workflow runs whose authoritative trigger is workflow_dispatch.","from":"campaign-runs","filter":{"predicates":[{"field":"event","equals":"workflow_dispatch"}]},"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"campaign-dispatch-inventory","subject":"Project retained dispatch identity and campaign attribution before campaign counting.","objective":"Count dispatches without materializing run diagnoses and presentation links.","acceptance":"Keep workflow_dispatch runs in timestamp order with declared campaign attribution; preserve workflow and incomplete-outcome join quality and duplicate-key failure behavior.","description":"Lean dispatch-count input; the incomplete-outcome join preserves the full campaign run source's evidence quality and fail-closed validation.","from":"runs","joins":[{"source":"workflows","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"declared-campaign"}]},{"source":"run-incomplete-outcomes","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"outcome-kind","as":"outcome-kind"}]}],"filter":{"predicates":[{"field":"event","equals":"workflow_dispatch"}]},"select":[{"field":"declared-campaign","as":"campaign"},{"field":"run"},{"field":"started-at"}],"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"campaign-dispatch-totals","subject":"Summarize observed workflow dispatches for each centrally managed campaign.","objective":"Compare retained workflow_dispatch run counts across attributed campaigns.","acceptance":"Count distinct run identifiers per campaign from dispatches; do not treat missing campaign attribution or unretained dispatches as zero actual activity.","description":"Observed workflow-dispatch run totals grouped by campaign.","from":"campaign-dispatch-inventory","aggregate":{"by":["campaign"],"values":[{"field":"run","as":"dispatches","reducer":"distinct-count"}]}},{"name":"campaign-workflow-totals","subject":"Summarize observed workflow and execution totals for each centrally managed campaign.","objective":"Compare declared orchestrator/worker composition, rollout registration, observed runs, and AI Credit usage by campaign.","acceptance":"Group only orchestrator and worker workflow-inventory rows by campaign; retain workflow count, distinct roles/modes/registration and summed observed runs and AIC, without inferring successful outcomes.","description":"Observed workflow, rollout, run, and AI Credit totals grouped by campaign.","from":"campaign-workflow-inventory","aggregate":{"by":["campaign"],"values":[{"field":"workflow","as":"workflows","reducer":"count"},{"field":"workflow-role","as":"roles","reducer":"distinct-list"},{"field":"rollout-mode","as":"modes","reducer":"distinct-list"},{"field":"workflow-active","as":"registration","reducer":"distinct-list"},{"field":"runs","as":"runs","reducer":"sum"},{"field":"aic","as":"aic","reducer":"sum"}]}},{"name":"campaign-repository-coverage","subject":"Count distinct registered target repositories reached by successful worker dispatches for each campaign.","objective":"Estimate observed campaign target reach from successful worker workflow_dispatch runs joined to registered repositories.","acceptance":"Count distinct matched target-repository values per campaign only for successful worker dispatches; this is observed reach, not verified target outcomes or complete fleet coverage.","description":"Campaign repository coverage derived from successful worker dispatch runs in the selected horizon.","from":"runs","joins":[{"source":"workflows","type":"inner","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"campaign"},{"field":"workflow-role","as":"workflow-role"}]},{"source":"repositories","type":"inner","on":[{"left":"target-repository","right":"repository-coordinate"}],"fields":[{"field":"repository-coordinate","as":"registered-target-repository"}]}],"filter":{"predicates":[{"field":"event","equals":"workflow_dispatch"},{"field":"run-conclusion","equals":"success"},{"field":"workflow-role","equals":"worker"}]},"aggregate":{"by":["campaign"],"values":[{"field":"target-repository","as":"covered-repositories","reducer":"distinct-count"}]}},{"name":"campaign-inventory-preview","subject":"Show declared campaigns before execution evidence is evaluated.","objective":"Expose campaign identities and navigation links while observed totals remain pending.","acceptance":"Preserve every declared campaign and its dashboard link without reporting missing execution totals as zero.","from":"campaigns","compute":[{"as":"encoded-campaign","function":"url-encode","args":[{"field":"campaign"}]},{"as":"campaign-dashboard-href","function":"concat","args":[{"value":"#page-campaign-insights?campaign="},{"field":"encoded-campaign"}]},{"as":"campaign-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"campaign-name"},{"value":" campaign dashboard"}]},{"as":"campaign-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"campaign-dashboard-href"},{"field":"campaign-dashboard-label"},{"field":"campaign"}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"campaign-dashboard-link"}],"order-by":[{"field":"campaign-name","direction":"asc"}]},{"name":"campaign-inventory","subject":"List centrally managed campaigns with their observed workflow and execution totals.","objective":"Compare declared campaigns with retained workflow composition, dispatches, target reach, runs, and AIC to choose an evidence-backed drill-down.","acceptance":"Keep declared campaigns with campaign identity and link plus joined totals; defaulted zero values mean no matching retained evidence and cannot certify no activity, complete coverage, or successful outcomes.","description":"Canonical campaign inventory enriched with observed workflow, rollout, run, repository coverage, and AI Credit totals.","from":"campaigns","joins":[{"source":"campaign-workflow-totals","type":"left","on":[{"left":"campaign","right":"campaign"}],"fields":[{"field":"workflows","as":"observed-workflows"},{"field":"roles","as":"observed-roles"},{"field":"modes","as":"observed-modes"},{"field":"registration","as":"observed-registration"},{"field":"runs","as":"observed-runs"},{"field":"aic","as":"observed-aic"}]},{"source":"campaign-dispatch-totals","type":"left","on":[{"left":"campaign","right":"campaign"}],"fields":[{"field":"dispatches","as":"observed-dispatches"}]},{"source":"campaign-repository-coverage","type":"left","on":[{"left":"campaign","right":"campaign"}],"fields":[{"field":"covered-repositories","as":"observed-covered-repositories"}]}],"compute":[{"as":"workflows","function":"coalesce","args":[{"field":"observed-workflows"},{"value":0}]},{"as":"roles","function":"coalesce","args":[{"field":"observed-roles"},{"value":""}]},{"as":"modes","function":"coalesce","args":[{"field":"observed-modes"},{"field":"campaign-mode"}]},{"as":"registration","function":"coalesce","args":[{"field":"observed-registration"},{"field":"campaign-registration"}]},{"as":"runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"dispatches","function":"coalesce","args":[{"field":"observed-dispatches"},{"value":0}]},{"as":"covered-repositories","function":"coalesce","args":[{"field":"observed-covered-repositories"},{"value":0}]},{"as":"aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]},{"as":"encoded-campaign","function":"url-encode","args":[{"field":"campaign"}]},{"as":"campaign-dashboard-href","function":"concat","args":[{"value":"#page-campaign-insights?campaign="},{"field":"encoded-campaign"}]},{"as":"campaign-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"campaign-name"},{"value":" campaign dashboard"}]},{"as":"campaign-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"campaign-dashboard-href"},{"field":"campaign-dashboard-label"},{"field":"campaign"}]}],"select":[{"field":"campaign"},{"field":"campaign-name"},{"field":"campaign-dashboard-link"},{"field":"workflows"},{"field":"roles"},{"field":"modes"},{"field":"registration"},{"field":"runs"},{"field":"dispatches"},{"field":"covered-repositories"},{"field":"aic"}],"order-by":[{"field":"campaign-name","direction":"asc"}]},{"name":"firewall-domain-totals","subject":"Show each observed firewall domain with the number of runs and total accepted and blocked requests.","objective":"Identify domains with observed denied requests for a closer review of firewall evidence.","acceptance":"Report distinct observed runs and native accepted and blocked request totals by domain; a denied request alone does not justify allowing egress, and no row does not prove no requests occurred.","description":"Distinct runs and accepted and blocked request totals by firewall domain.","from":"firewall-observations","filter":{"predicates":[{"field":"decision","in":["allowed","denied"]}]},"aggregate":{"by":["domain"],"values":[{"field":"run","as":"run","reducer":"distinct-count"},{"field":"request-count","as":"accepted","reducer":"sum","filter":{"predicates":[{"field":"decision","equals":"allowed"}]}},{"field":"request-count","as":"blocked","reducer":"sum","filter":{"predicates":[{"field":"decision","equals":"denied"}]}}]},"order-by":[{"field":"blocked","direction":"desc"},{"field":"accepted","direction":"desc"},{"field":"domain","direction":"asc"}]},{"name":"firewall-most-blocked-domains","subject":"Highlight the domains with the most blocked firewall requests.","objective":"Prioritize up to ten observed domains by blocked request total for investigation.","acceptance":"Rank by observed blocked totals and inspect underlying domain/workflow evidence before deciding whether a block needs attention; the ranking is not a policy authorization or an incidence rate.","description":"The ten domains with the highest observed blocked request totals.","from":"firewall-domain-totals","order-by":[{"field":"blocked","direction":"desc"},{"field":"domain","direction":"asc"}],"limit":10},{"name":"firewall-domain-workflows","subject":"Show workflows that allowed or blocked requests to each observed firewall domain.","objective":"Locate which observed workflows contributed accepted or denied requests for a domain.","acceptance":"Preserve workflow scope, source link, distinct runs, and native accepted and blocked totals; investigate the run and egress context rather than assuming a denied request is a failure or grounds for wider access.","description":"Workflow-level accepted and blocked request totals by firewall domain.","from":"firewall-observations","filter":{"predicates":[{"field":"decision","in":["allowed","denied"]}]},"compute":[{"as":"workflow-source-url","function":"link-href","args":[{"field":"workflow-link"}]}],"aggregate":{"by":["domain","organization","repository","workflow","workflow-source-url"],"values":[{"field":"run","as":"runs","reducer":"distinct-count"},{"field":"request-count","as":"accepted","reducer":"sum","filter":{"predicates":[{"field":"decision","equals":"allowed"}]}},{"field":"request-count","as":"blocked","reducer":"sum","filter":{"predicates":[{"field":"decision","equals":"denied"}]}}]},"order-by":[{"field":"blocked","direction":"desc"},{"field":"accepted","direction":"desc"},{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"mcp-tool-totals","subject":"Group observed MCP activity by tool and count calls and calling workflows, excluding the internal safe outputs server.","objective":"Expose tool-level call, workflow, and byte totals to investigate observed MCP usage.","acceptance":"Group only observed non-safe-output-server calls by server and tool, preserving counts and byte totals; lack of calls does not establish no access, and call volume does not establish value or permission.","description":"Observed MCP tool-call totals grouped by MCP server and tool, with the number of distinct calling workflows.","from":"mcp-tool-workflow-totals","filter":{"predicates":[{"field":"safe-output-server","equals":false}]},"aggregate":{"by":["mcp-tool-label","mcp-server","mcp-tool"],"values":[{"field":"calls","as":"calls","reducer":"sum"},{"field":"workflow-key","as":"workflows","reducer":"distinct-count"},{"field":"request-bytes","as":"request-bytes","reducer":"sum"},{"field":"response-bytes","as":"response-bytes","reducer":"sum"}]},"select":[{"field":"mcp-tool-label"},{"field":"mcp-tool"},{"field":"mcp-server"},{"field":"calls"},{"field":"workflows"},{"field":"request-bytes"},{"field":"response-bytes"}],"order-by":[{"field":"calls","direction":"desc"},{"field":"mcp-tool-label","direction":"asc"}]},{"name":"mcp-top-tools","subject":"Show the ten most frequently called MCP tools.","objective":"Identify up to ten tools with the highest observed non-safe-output-server call counts for inspection.","acceptance":"Rank observed calls by tool label and inspect grouped tool evidence before drawing conclusions; do not treat popularity as effectiveness or authority to add tools.","description":"The ten MCP tools with the most observed calls, excluding the internal safe outputs server.","from":"mcp-tool-totals","order-by":[{"field":"calls","direction":"desc"},{"field":"mcp-tool-label","direction":"asc"}],"limit":10},{"name":"steering-events","subject":"Prepare observed gateway steering warnings for aggregation by steering type and workflow.","objective":"Expose warning identity, run context, type, and timestamp for downstream steering diagnostics.","acceptance":"Project recorded gateway steering events with workflow and run attribution where available; a warning is not a completed budget overrun, failure, or reason to increase limits.","description":"Gateway steering warnings emitted when a run approaches its AI Credit budget, time limit, or another declared limit, labelled with a readable steering type.","from":"audits","filter":{"predicates":[{"field":"event-type","equals":"firewall.steering"}]},"joins":[{"source":"workflows","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"campaign"},{"field":"workflow-name","as":"workflow-name"}]}],"compute":[{"as":"steering-code","function":"coalesce","args":[{"field":"code"},{"field":"event-status"},{"value":"unknown"}]},{"as":"_token-steering","function":"equals-any","args":[{"field":"steering-code"},{"value":"token_steering"}]},{"as":"_timeout-steering","function":"equals-any","args":[{"field":"steering-code"},{"value":"timeout_steering"}]},{"as":"_turn-steering","function":"equals-any","args":[{"field":"steering-code"},{"value":"turn_steering"},{"value":"max_turns_steering"}]},{"as":"_turn-steering-type","function":"if","args":[{"field":"_turn-steering"},{"value":"Running out of turns"},{"field":"steering-code"}]},{"as":"_timeout-steering-type","function":"if","args":[{"field":"_timeout-steering"},{"value":"Running out of time"},{"field":"_turn-steering-type"}]},{"as":"steering-type","function":"if","args":[{"field":"_token-steering"},{"value":"Running out of tokens"},{"field":"_timeout-steering-type"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"workflow-label","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow-coordinate"}]}],"select":[{"field":"id"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-coordinate"},{"field":"workflow-label"},{"field":"campaign"},{"field":"run"},{"field":"run-link"},{"field":"steering-code"},{"field":"steering-type"},{"field":"event-summary"},{"field":"observed-at"}]},{"name":"steering-type-totals","subject":"Show how often each kind of steering warning occurred.","objective":"Identify steering warning categories to inspect in their run context.","acceptance":"Report observed event totals and distinct runs and workflows by type; confirm underlying warnings before interpreting frequency, and do not infer actual limit breaches.","description":"Observed gateway steering warnings grouped by steering type with the number of affected runs and workflows.","from":"steering-events","aggregate":{"by":["steering-type","steering-code"],"values":[{"field":"id","as":"events","reducer":"count"},{"field":"run","as":"runs","reducer":"distinct-count"},{"field":"workflow-coordinate","as":"workflows","reducer":"distinct-count"}]},"select":[{"field":"steering-type"},{"field":"steering-code"},{"field":"events"},{"field":"runs"},{"field":"workflows"}],"order-by":[{"field":"events","direction":"desc"},{"field":"steering-type","direction":"asc"}]},{"name":"steering-workflow-totals","subject":"Count steering warnings for each workflow.","objective":"Expose workflow-level warning totals and token/time warning breakdowns for downstream review.","acceptance":"Count recorded events and distinct runs by workflow, retaining the declared token/time categories; other types remain in total events and no warning alone establishes a failure.","description":"Gateway steering warnings grouped by workflow, split into token-budget and time-limit warnings.","from":"steering-events","aggregate":{"by":["workflow-coordinate","organization","repository","workflow","workflow-label","campaign"],"values":[{"field":"id","as":"events","reducer":"count"},{"field":"run","as":"runs","reducer":"distinct-count"},{"field":"id","as":"token-events","reducer":"count","filter":{"predicates":[{"field":"steering-code","equals":"token_steering"}]}},{"field":"id","as":"time-events","reducer":"count","filter":{"predicates":[{"field":"steering-code","equals":"timeout_steering"}]}},{"field":"steering-type","as":"steering-types","reducer":"distinct-count"}]},"order-by":[{"field":"events","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}]},{"name":"steering-workflows","subject":"Present workflow steering totals with a link to each workflow dashboard.","objective":"Show observed workflow steering totals with navigation to the affected run context.","acceptance":"Keep workflow identity, link, events, runs, and warning breakdowns tied to their grouped evidence; use drill-through before recommending changes, not warning counts as a basis to widen budgets.","description":"Workflow steering totals labelled with a link to the workflow runtime page.","from":"steering-workflow-totals","compute":[{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-label"}]}],"select":[{"field":"workflow-coordinate"},{"field":"workflow-label"},{"field":"workflow-dashboard-link"},{"field":"organization"},{"field":"repository"},{"field":"campaign"},{"field":"events"},{"field":"runs"},{"field":"token-events"},{"field":"time-events"},{"field":"steering-types"}],"order-by":[{"field":"events","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}]},{"name":"steering-top-workflows","subject":"Highlight the workflows with the most steering warnings.","objective":"Prioritize up to ten workflows by observed warning count for investigation.","acceptance":"Rank recorded warning totals with workflow context, checking underlying events and telemetry coverage; a high rank neither proves overrun nor justifies a limit change.","description":"The ten workflows with the highest observed gateway steering warning totals.","from":"steering-workflows","order-by":[{"field":"events","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}],"limit":10},{"name":"entity-workflow-run-totals","subject":"Summarize run outcomes and AI Credit consumption for reusable workflow cards.","objective":"Compare retained run-attempt activity, recorded conclusions, and AI Credit usage per workflow card.","acceptance":"Group by organization, repository, and workflow; expose distinct run-attempt count, success/failure conclusion counts, and sum of recorded AIC, without treating missing run history as zero actual activity.","from":"runs","compute":[{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run-attempt-identity","as":"runs","reducer":"distinct-count"},{"field":"run-attempt-identity","as":"aic-runs","reducer":"distinct-count","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"run-conclusion","as":"successful-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","equals":"success"}]}},{"field":"run-conclusion","as":"failed-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","stale","timed-out"]}]}},{"field":"aic-total","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}}]}},{"name":"entity-workflows","subject":"Project workflow entities for reusable workflow cards and repository drill-down.","objective":"Relate declared workflows to observed run and AIC totals for workflow-level drill-down.","acceptance":"Keep declared workflow identity, role, registration, campaign, link, and joined totals; a missing run match defaults to displayed zeros but does not establish no executions or outcomes.","from":"workflows","joins":[{"source":"entity-workflow-run-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"successful-runs","as":"observed-successful-runs"},{"field":"failed-runs","as":"observed-failed-runs"},{"field":"aic","as":"observed-aic"},{"field":"aic-runs","as":"observed-aic-runs"}]}],"compute":[{"as":"runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"successful-runs","function":"coalesce","args":[{"field":"observed-successful-runs"},{"value":0}]},{"as":"failed-runs","function":"coalesce","args":[{"field":"observed-failed-runs"},{"value":0}]},{"as":"aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]},{"as":"aic-per-run","function":"quotient","args":[{"field":"aic"},{"field":"observed-aic-runs"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"workflow-active"},{"field":"campaign-name"},{"field":"observed-at"},{"field":"runs"},{"field":"successful-runs"},{"field":"failed-runs"},{"field":"aic-per-run"},{"field":"workflow-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"repository-runs","subject":"Project canonical runs into repository-addressable run evidence.","objective":"Expose retained run chronology and status for a selected repository's drill-down.","acceptance":"Retain repository coordinate, workflow, run identity, title, event, start time, conclusion, mode, AIC, and run link; absent details or runs do not establish a healthy or idle repository.","description":"Workflow runs with a stable repository route key.","from":"runs","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]}],"select":[{"field":"repository-coordinate"},{"field":"workflow"},{"field":"run"},{"field":"run-title"},{"field":"event"},{"field":"started-at"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"rollout-mode"},{"field":"aic-total"},{"field":"run-link"}],"order-by":[{"field":"started-at","direction":"desc"},{"field":"run","direction":"desc"}]},{"name":"repository-workflow-totals","subject":"Summarize declared and disabled workflow counts by repository.","objective":"Compare declared and disabled workflow counts for each repository in the retained workflow inventory.","acceptance":"Count declared workflows and workflow-active=false entries by organization and repository; missing declarations must not be interpreted as a complete zero-workflow inventory.","description":"Declared and disabled workflow totals for each repository.","from":"workflows","aggregate":{"by":["organization","repository"],"values":[{"field":"workflow","as":"workflows","reducer":"count"},{"field":"workflow","as":"disabled","reducer":"count","filter":{"predicates":[{"field":"workflow-active","equals":"false"}]}}]}},{"name":"repository-report-totals","subject":"Summarize published outcome report counts by repository.","objective":"Show retained outcome-report volume per repository for comparison with observed execution.","acceptance":"Count retained outcome rows by organization and repository; a missing aggregate does not prove no reports were published or that reported outcomes succeeded.","description":"Published report totals for each repository.","from":"outcomes","aggregate":{"by":["organization","repository"],"values":[{"field":"repository","as":"reports","reducer":"count"}]}},{"name":"repository-run-identities","subject":"Project the run-attempt identities needed to match imported evidence.","objective":"Keep import-coverage joins narrow without carrying run details, links, or costs.","acceptance":"Preserve each selected run attempt and its organization, repository, workflow, run, and attempt keys. Do not deduplicate attempts or change selected-horizon semantics.","from":"runs","select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"}]},{"name":"repository-import-totals","subject":"Count selected run attempts with matching retained imported records.","objective":"Join compact run identities to already reduced event evidence, then reduce import coverage by repository.","acceptance":"Match all five run-attempt keys and count each selected run row once when events are positive. Preserve optional-evidence quality and horizon filters; records for unselected runs do not establish coverage.","from":"repository-run-identities","joins":[{"source":"event-runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"events","as":"imported-events"}]}],"compute":[{"as":"imported","function":"greater-than","args":[{"field":"imported-events"},{"value":0}]}],"aggregate":{"by":["organization","repository"],"values":[{"field":"imported","as":"imported-runs","reducer":"sum"}]}},{"name":"repository-run-totals","subject":"Summarize distinct runs, failures, and approval-required runs by repository.","objective":"Join already reduced run statistics and import coverage at repository grain.","acceptance":"Group by organization and repository; preserve distinct run IDs, configured failure/action-required conclusion counts, and imported-run sums. Missing enrichment or run history must not be treated as complete coverage.","description":"Distinct run and conclusion totals for each repository.","from":"repository-run-statistics","joins":[{"source":"repository-import-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"imported-runs","as":"imported-runs"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"runs"},{"field":"failed"},{"field":"action-required"},{"field":"imported-runs"}]},{"name":"repository-activity-preview","subject":"List repository identities before execution metrics are computed.","objective":"Show retained repository identities and drill links while activity metrics are pending.","acceptance":"List repositories by organization with repository drill links; this preview does not establish activity totals or outcomes.","description":"Fast repository inventory with drill links; activity fields remain pending.","from":"repositories","compute":[{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-slug"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-slug"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-slug"}]}],"select":[{"field":"organization"},{"field":"repository-slug","as":"repository"},{"field":"repository-dashboard-link","as":"repository-link"}],"order-by":[{"field":"repository","direction":"asc"}]},{"name":"repository-activity-core","subject":"Join each repository with its workflow, report, and run totals.","objective":"Attach retained workflow, report, and run aggregates to each repository for bounded inventory review.","acceptance":"Preserve each repository and the available joined aggregates by organization and repository; unmatched metrics remain missing evidence, not confirmed zero activity or evaluated outcomes.","description":"Repository inventory joined with workflow, report, evaluation, and run totals.","from":"repositories","joins":[{"source":"repository-workflow-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"workflows","as":"observed-workflows"},{"field":"disabled","as":"observed-disabled"}]},{"source":"repository-report-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"reports","as":"observed-reports"}]},{"source":"repository-run-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"failed","as":"observed-failed"},{"field":"action-required","as":"observed-action-required"},{"field":"imported-runs","as":"observed-imported-runs"}]}]},{"name":"repository-activity","subject":"Show repository-level execution health, outcome activity, and AI Credit usage in an actionable inventory.","objective":"Prioritize repository drill-down using declared workflows, observed runs, reports, failures, import coverage, and AIC.","acceptance":"Return repository identity and link with retained counts, ingestion indicator, failure summary, AIC, and computed status; statuses describe retained evidence only, and an empty or unavailable preview cannot verify health, outcomes, or zero activity.","description":"Repository-local execution health and attributed outcome totals.","from":"repository-activity-core","joins":[{"source":"repository-aic-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"aic","as":"observed-aic"}]}],"compute":[{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflows","function":"coalesce","args":[{"field":"observed-workflows"},{"value":0}]},{"as":"disabled","function":"coalesce","args":[{"field":"observed-disabled"},{"value":0}]},{"as":"runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]},{"as":"failed","function":"coalesce","args":[{"field":"observed-failed"},{"value":0}]},{"as":"imported-runs","function":"coalesce","args":[{"field":"observed-imported-runs"},{"value":0}]},{"as":"ingestion-rate","function":"quotient","args":[{"field":"imported-runs"},{"field":"runs"}]},{"as":"ingestion","function":"format-percent","args":[{"field":"ingestion-rate"}]},{"as":"action-required","function":"coalesce","args":[{"field":"observed-action-required"},{"value":0}]},{"as":"aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]},{"as":"has-failures","function":"greater-than","args":[{"field":"failed"},{"value":0}]},{"as":"has-action-required","function":"greater-than","args":[{"field":"action-required"},{"value":0}]},{"as":"has-runs","function":"greater-than","args":[{"field":"runs"},{"value":0}]},{"as":"has-disabled","function":"greater-than","args":[{"field":"disabled"},{"value":0}]},{"as":"outcomes-observed","function":"coalesce","args":[{"field":"observed-reports"},{"value":0}]},{"as":"has-outcomes","function":"greater-than","args":[{"field":"outcomes-observed"},{"value":0}]},{"as":"failure-rate","function":"quotient","args":[{"field":"failed"},{"field":"runs"}]},{"as":"failure-percent","function":"format-percent","args":[{"field":"failure-rate"}]},{"as":"failure-count","function":"format-count","args":[{"field":"failed"}]},{"as":"observed-failure-summary","function":"concat","args":[{"field":"failure-percent"},{"value":" · "},{"field":"failure-count"},{"value":" failed"}]},{"as":"failure-summary","function":"if","args":[{"field":"has-runs"},{"field":"observed-failure-summary"},{"value":"—"}]},{"as":"outcome-status","function":"if","args":[{"field":"has-outcomes"},{"value":"Outcomes observed"},{"value":"No recent activity"}]},{"as":"disabled-status","function":"if","args":[{"field":"has-disabled"},{"value":"Disabled workflows"},{"field":"outcome-status"}]},{"as":"run-status","function":"if","args":[{"field":"has-runs"},{"value":"No failures observed"},{"field":"disabled-status"}]},{"as":"action-status","function":"if","args":[{"field":"has-action-required"},{"value":"Approval required"},{"field":"run-status"}]},{"as":"status","function":"if","args":[{"field":"has-failures"},{"value":"Needs attention"},{"field":"action-status"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-slug"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-slug"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-slug"}]}],"select":[{"field":"organization"},{"field":"repository","as":"repository-name"},{"field":"repository-slug","as":"repository"},{"field":"workflows"},{"field":"observed-reports","as":"reports"},{"field":"runs"},{"field":"ingestion"},{"field":"failure-summary"},{"field":"aic"},{"field":"status"},{"field":"repository-dashboard-link","as":"repository-link"},{"field":"failed"}],"order-by":[{"field":"failed","direction":"desc"},{"field":"runs","direction":"desc"},{"field":"repository","direction":"asc"}]},{"name":"repository-daily-run-buckets","subject":"Select repository run counts by whole UTC start-day buckets.","objective":"Keep count selection independent of retained Run detail.","acceptance":"Use UTC midnight and request bounds, matching the Runs daily chart; do not fabricate sub-day totals or missing days.","from":"daily-run-counts","compute":[{"as":"day-midnight","function":"concat","args":[{"field":"day"},{"value":"T00:00:00Z"}]},{"as":"day-ms","function":"timestamp","args":[{"field":"day-midnight"}]},{"as":"start-ms","function":"timestamp","args":[{"context":"time-start"}]},{"as":"end-ms","function":"timestamp","args":[{"context":"time-end"}]},{"as":"before-start","function":"greater-than","args":[{"field":"start-ms"},{"field":"day-ms"}]},{"as":"before-end","function":"greater-than","args":[{"field":"end-ms"},{"field":"day-ms"}]}]},{"name":"repository-observed-run-counts","subject":"Count observed logical Runs by repository from persistent daily buckets.","objective":"Supply the run-volume chart without computing activity health, ingestion coverage, or workflow costs.","acceptance":"Sum daily totals, not attempts or retained detail. Select whole UTC start-day buckets by midnight and preserve partial or unavailable coverage.","from":"repository-daily-run-buckets","filter":{"predicates":[{"field":"before-start","in":[false,null]},{"field":"before-end","in":[true,null]}]},"compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]}],"aggregate":{"by":["organization","repository-coordinate"],"values":[{"field":"total","as":"runs","reducer":"sum"}]}},{"name":"repository-run-inventory","subject":"Registered repositories and observed daily logical Run counts.","objective":"Compare repository execution volume and choose repositories for drill-down.","acceptance":"Keep top 100 identities and drill links with stable count and repository ordering. Zero means no admitted dated Runs in selected UTC buckets, not inactivity. Preserve partial coverage; unavailable daily evidence must not produce zeros. Table keeps full inventory.","from":"repository-activity-preview","joins":[{"source":"repository-observed-run-counts","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository-coordinate"}],"fields":[{"field":"runs","as":"observed-runs"}]}],"compute":[{"as":"runs","function":"coalesce","args":[{"field":"observed-runs"},{"value":0}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"runs"},{"field":"repository-link"}],"order-by":[{"field":"runs","direction":"desc"},{"field":"repository","direction":"asc"}],"limit":100},{"name":"workflow-route-record","subject":"Project the selected workflow's identity and registration for its route shell.","objective":"Identify the workflow and its recorded campaign registration before inspecting route-specific evidence.","acceptance":"Preserve organization, repository, workflow identity, recorded role, activation, campaign, rollout mode, and source link; absent registration is not inferred from runs, and displayed activation does not grant execution authority.","from":"workflows","select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-role"},{"field":"workflow-active"},{"field":"campaign"},{"field":"campaign-name"},{"field":"rollout-mode"},{"field":"workflow-link"}]},{"name":"workflow-runtime-health-summary","subject":"Sum daily runtime conclusion counts for the selected workflow.","objective":"Inspect observed dated runs independently of retained detail.","acceptance":"Sum by organization/repository/workflow without adding detail; successful, failed, approval, pending, and other sum to total. Dates use UTC run start; undated evidence is incomplete and missing projection is unavailable. Pending is last-observed state, success is not a verified outcome, and sub-day filters are unsupported.","from":"daily-run-counts","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"total","as":"total","reducer":"sum"},{"field":"successful","as":"successful","reducer":"sum"},{"field":"failed","as":"failed","reducer":"sum"},{"field":"approval","as":"approval","reducer":"sum"},{"field":"pending","as":"pending","reducer":"sum"},{"field":"other","as":"other","reducer":"sum"}]}},{"name":"workflow-runtime-usage-summary","subject":"Sum retained AI Credits and count telemetry rows for the selected workflow without transferring runs.","objective":"Inspect a workflow's observed AI Credit consumption together with the amount of retained usage telemetry.","acceptance":"AI Credits sum the retained aic values within each organization, repository, and workflow, and telemetry-count counts its usage records; absent telemetry does not establish zero cost or complete run coverage.","from":"usage","compute":[{"as":"positive-aic","function":"greater-than","args":[{"field":"aic"},{"value":0}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"aic","as":"aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"run","as":"telemetry-count","reducer":"count"}]}},{"name":"outcome-route-record","subject":"Project the selected safe-output record for the outcome route and its sections.","objective":"Inspect a retained safe output's recorded disposition and follow its durable evidence links.","acceptance":"Preserve safe-output and run identity, title, category, disposition, summary, timestamps, rollout mode, workflow context, and retained links; missing fields stay unknown and a recorded disposition is not independently verified operational impact.","from":"outcomes","select":[{"field":"safe-output"},{"field":"run"},{"field":"outcome-title"},{"field":"outcome-number"},{"field":"outcome-category"},{"field":"outcome-status"},{"field":"outcome-state"},{"field":"outcome-summary"},{"field":"published-at"},{"field":"observed-at"},{"field":"rollout-mode"},{"field":"workflow"},{"field":"workflow-name"},{"field":"workflow-link"},{"field":"external-link"},{"field":"issue-link"},{"field":"pull-request-link"},{"field":"run-link"}]},{"name":"entity-runs","subject":"Project run entities for reusable run cards and workflow drill-down.","objective":"Expose retained run-attempt identity, execution timing, conclusion, and link for a bounded workflow-run inspection.","acceptance":"Keep organization, repository, workflow, run and attempt with status, conclusion, event, branch, duration, timestamps, and run link; missing timing or conclusion remains unknown rather than inferred success.","from":"runs","select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"target-repository"},{"field":"run"},{"field":"run-attempt"},{"field":"run-title"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"event"},{"field":"branch"},{"field":"duration"},{"field":"started-at"},{"field":"ended-at"},{"field":"run-link"}],"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"workflow-runs","subject":"Project canonical runs into route-addressable workflow run evidence.","objective":"Trace retained runs and recorded failure evidence for a selected workflow route.","acceptance":"Preserve workflow route, run identity, start/end, status, conclusion, failure fields, mode, engine/model metadata, and run link; missing failure details do not prove success or rule out incomplete import.","description":"Workflow runs with a stable repository and workflow route key.","from":"runs","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-route","function":"concat","args":[{"field":"repository-coordinate"},{"value":":"},{"field":"workflow"}]}],"select":[{"field":"workflow-route"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-title"},{"field":"event"},{"field":"started-at"},{"field":"ended-at"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"failure-job"},{"field":"failure-message"},{"field":"failure-step"},{"field":"failure-log"},{"field":"rollout-mode"},{"field":"engine"},{"field":"engine-version"},{"field":"gh-aw-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"run-link"}],"order-by":[{"field":"started-at","direction":"desc"},{"field":"run","direction":"desc"}]},{"name":"workflow-failure-trend","subject":"Show recent failure counts and their change for each workflow.","objective":"Spot a change in observed workflow failure activity without treating unknown conclusions as failures.","acceptance":"Each observed failure counts once within its own workflow; the first change is undefined and the seven-observation window is not a seven-day calendar interval.","from":"workflow-runs","compute":[{"as":"is-failure","function":"equals-any","args":[{"field":"run-conclusion"},{"value":"failure"},{"value":"timed_out"}]},{"as":"failure-count","function":"if","args":[{"field":"is-failure"},{"value":1},{"value":0}]}],"window":[{"operation":"rolling","field":"failure-count","as":"recent-failure-count","frame":7,"reducer":"sum","order-by":[{"field":"started-at","direction":"asc"},{"field":"run","direction":"asc"}],"groupby":["workflow-route"]},{"operation":"change","field":"recent-failure-count","as":"failure-count-change","mode":"absolute","order-by":[{"field":"started-at","direction":"asc"},{"field":"run","direction":"asc"}],"groupby":["workflow-route"]}]},{"name":"workflow-reports","subject":"Project retained outcomes into route-addressable workflow reports.","objective":"Review retained workflow outcome reports separately from execution status before interpreting operational results.","acceptance":"Keep route, safe output, report title and summary, recorded status, category, observation time, metadata, and external link; missing reports or status do not imply success or no work.","description":"Workflow outcome reports with stable route keys and disposition fields.","from":"outcomes","compute":[{"as":"report-repository","function":"coalesce","args":[{"field":"runtime-repository"},{"field":"repository"}]},{"as":"workflow-route","function":"concat","args":[{"field":"report-repository"},{"value":":"},{"field":"workflow"}]},{"as":"report-status","function":"coalesce","args":[{"field":"outcome-status"},{"field":"outcome-state"},{"value":"unknown"}]}],"select":[{"field":"workflow-route"},{"field":"safe-output"},{"field":"outcome-title"},{"field":"outcome-summary"},{"field":"report-status","as":"outcome-status"},{"field":"rollout-mode"},{"field":"engine"},{"field":"engine-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"outcome-category"},{"field":"observed-at"},{"field":"external-link"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"outcome-title","direction":"asc"}]},{"name":"value-measurement-facts","subject":"Original native primary and diagnostic observations from reviewed batch evaluators.","objective":"Keep periods, native units, evaluator identity and missingness inspectable without inventing delivery events.","acceptance":"Null is unavailable, not zero. Interval measurements are not snapshots or cumulative accepted contributions.","from":"workflow-value-measurements","time":{"range":"all"},"compute":[{"as":"measurement-marker","function":"literal","args":[{"value":1}]},{"as":"measurement-missing","function":"equals-any","args":[{"field":"value"},{"value":null}]},{"as":"known-measurement","function":"concat","args":[{"field":"value"},{"value":" "},{"field":"metric-unit"}]},{"as":"measurement-label","function":"if","args":[{"field":"measurement-missing"},{"value":"Not measured"},{"field":"known-measurement"}]},{"as":"measurement-context","function":"concat","args":[{"field":"repository"},{"value":" · "},{"field":"workflow-name"}]}]},{"name":"value-measurement-order","subject":"Latest assessment of each workflow measure, including unavailable assessments.","objective":"Do not let an older numeric value hide a newer incomplete period.","acceptance":"Choose latest cutoff and assessment before considering value or coverage; preserve evaluator digest.","from":"value-measurement-facts","window":[{"operation":"change","field":"measurement-marker","as":"older-measurement","mode":"absolute","groupby":["repository","workflow-route","workflow-slug","campaign","value-id"],"order-by":[{"field":"window-end","direction":"desc"},{"field":"observed-at","direction":"desc"}]}]},{"name":"value-current-measurements","subject":"Latest native primary measurements, separately from event-ledger reports.","objective":"Expose ordinary reviewed batch results on the same Value surface.","acceptance":"Do not infer healthy outcomes, accepted implementations or complete coverage from a non-null value.","from":"value-measurement-order","filter":{"predicates":[{"field":"older-measurement","equals":"unknown"},{"field":"metric-role","equals":"primary"}]}},{"name":"value-evidence-facts","subject":"Published original evidence for frozen workflow value contracts.","objective":"Keep report identity, target repository, workflow and capture together.","acceptance":"Read canonical evidence only. No GitHub acquisition, HTML loading or fabricated evidence on navigation.","from":"operational-value-evidence","time":{"range":"all"}},{"name":"value-contracts","subject":"One retained contract per repository, workflow and versioned native measure.","objective":"Compute each report independently before selecting current workflow results.","acceptance":"Preserve separate versions and exact report identity. Latest-version selection belongs to the workflow result query.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"contract"}]},"compute":[{"as":"report-marker","function":"literal","args":[{"value":1}]}]},{"name":"value-measurement-captures","subject":"Accepted complete native batch assessments, separately from collection decisions.","objective":"Expose actual retained capture clocks without advancing them on failure or partial data.","acceptance":"Only mature complete non-null primary assessments establish an accepted capture; zero remains valid.","from":"value-measurement-facts","filter":{"predicates":[{"field":"metric-role","equals":"primary"},{"field":"measurement-missing","equals":false},{"field":"coverage-status","equals":"complete"},{"field":"maturity-status","equals":"matured"}]},"compute":[{"as":"report-marker","function":"literal","args":[{"value":1}]}],"select":[{"field":"workflow-route"},{"field":"observed-at"},{"field":"window-end"},{"field":"id","as":"capture-id"},{"field":"report-marker"}]},{"name":"value-contract-captures","subject":"Original capture clocks from accepted rich evidence packets.","objective":"Align capture metadata without merging measured populations.","acceptance":"This union is capture metadata only, never combined metric totals.","from":"value-contracts","select":[{"field":"workflow-route"},{"field":"observed-at"},{"field":"window-end"},{"field":"report-id","as":"capture-id"},{"field":"report-marker"}]},{"name":"value-capture-order","subject":"Actual captures across the retained measures of each workflow.","objective":"Expose the last accepted capture independently of collection decisions.","acceptance":"Select by original capture time. A deferred or failed check cannot advance evidence clocks.","from":"value-contract-captures","union":["value-measurement-captures"],"window":[{"operation":"change","field":"report-marker","as":"later-capture","mode":"absolute","groupby":["workflow-route"],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"capture-id","direction":"desc"}]}]},{"name":"value-latest-capture","subject":"One last accepted capture per workflow, not a freshness claim.","objective":"Join capture and cutoff without multiplying collection registrations.","acceptance":"Missing packets remain unavailable, never zero or an inferred successful collection.","from":"value-capture-order","filter":{"predicates":[{"field":"later-capture","equals":"unknown"}]}},{"name":"value-collection-health","subject":"Reviewed registration and authoritative collection decisions, with independently retained evidence.","objective":"Explain disabled, unconfigured, deferred, failed and not-yet-captured workflows.","acceptance":"Use published collector facts, not missing result cards. Preserve decision, attempt, capture and cutoff as distinct clocks.","from":"workflow-value-collections","time":{"range":"all"},"joins":[{"source":"value-latest-capture","type":"left","on":[{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"observed-at","as":"captured-at"},{"field":"window-end","as":"evidence-cutoff"}]}],"compute":[{"as":"workflow-context","function":"concat","args":[{"field":"workflow"},{"value":" · "},{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"capture-missing","function":"equals-any","args":[{"field":"captured-at"},{"value":null}]},{"as":"evidence-state","function":"if","args":[{"field":"capture-missing"},{"value":"No retained capture"},{"value":"Retained evidence available"}]}],"order-by":[{"field":"organization","direction":"asc"},{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"value-registered-collections","subject":"Reviewed Value registrations, including explicit disables and registrations with no report.","objective":"Make collection health visible before the first accepted packet.","acceptance":"Registration is independent of measured outcomes. No enrollment or acquisition follows from navigation.","from":"value-collection-health","filter":{"predicates":[{"field":"registration","in":["enabled","disabled"]}]},"limit":1000},{"name":"value-snapshots","subject":"Independent repository-state observations and exact item drill-downs.","objective":"Keep everyone's changes separate from workflow-linked delivery.","acceptance":"Retain observed native values, dates and immutable references. Do not invent intermediate observations.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"snapshot"}]},"compute":[{"as":"snapshot-marker","function":"literal","args":[{"value":1}]},{"as":"encoded-snapshot","function":"url-encode","args":[{"field":"snapshot-route"}]},{"as":"snapshot-href","function":"concat","args":[{"value":"#page-value-snapshot?snapshot="},{"field":"encoded-snapshot"}]}],"order-by":[{"field":"at","direction":"asc"},{"field":"fact-id","direction":"asc"}]},{"name":"value-first-snapshot-order","subject":"First independently observed repository state.","objective":"Name the actual first-snapshot reference rather than an invented baseline.","acceptance":"Strictly use retained snapshot time. A post-adoption snapshot is not a pre-adoption baseline.","from":"value-snapshots","window":[{"operation":"change","field":"snapshot-marker","as":"earlier-snapshot","mode":"absolute","groupby":["report-id","workflow-route"],"order-by":[{"field":"at","direction":"asc"}]}]},{"name":"value-first-snapshot","subject":"First retained snapshot per report.","objective":"Provide the explicit reference value and date.","acceptance":"No retained reference means no comparison.","from":"value-first-snapshot-order","filter":{"predicates":[{"field":"earlier-snapshot","equals":"unknown"}]}},{"name":"value-last-snapshot-order","subject":"Latest independently observed repository state.","objective":"Show the actual last measurement rather than an extrapolation.","acceptance":"Preserve the latest retained snapshot even if unchanged.","from":"value-snapshots","window":[{"operation":"change","field":"snapshot-marker","as":"later-snapshot","mode":"absolute","groupby":["report-id","workflow-route"],"order-by":[{"field":"at","direction":"desc"}]}]},{"name":"value-last-snapshot","subject":"Last retained snapshot per report.","objective":"Provide the current native observation.","acceptance":"One snapshot establishes state, not movement.","from":"value-last-snapshot-order","filter":{"predicates":[{"field":"later-snapshot","equals":"unknown"}]}},{"name":"value-output-counts","subject":"Retained safe outputs and applied creation receipts.","objective":"Describe output activity without treating it as accepted value.","acceptance":"Count distinct validated output facts. Tracking corroboration is not an applied receipt.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"output"}]},"aggregate":{"by":["report-id","workflow-route"],"values":[{"field":"fact-id","as":"retained-outputs","reducer":"count"},{"field":"fact-id","as":"receipt-outputs","reducer":"count","filter":{"predicates":[{"field":"origin","equals":"receipt-verified"}]}}]}},{"name":"value-implementation-counts","subject":"Distinct accepted implementations and their measured native effects.","objective":"Count each accepted implementation once, including zero and negative effects.","acceptance":"Validated implementation identities are unique; many-to-many output edges must not multiply value. Complete coverage is checked separately.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"implementation"}]},"compute":[{"as":"accepted-ms","function":"timestamp","args":[{"field":"at"}]},{"as":"cutoff-ms","function":"timestamp","args":[{"field":"window-end"}]},{"as":"current-start","function":"difference","args":[{"field":"cutoff-ms"},{"value":2419200000}]},{"as":"previous-start","function":"difference","args":[{"field":"cutoff-ms"},{"value":4838400000}]},{"as":"before-current","function":"greater-than","args":[{"field":"current-start"},{"field":"accepted-ms"}]},{"as":"before-previous","function":"greater-than","args":[{"field":"previous-start"},{"field":"accepted-ms"}]},{"as":"current-effect","function":"if","args":[{"field":"before-current"},{"value":0},{"field":"value"}]},{"as":"previous-candidate","function":"if","args":[{"field":"before-previous"},{"value":0},{"field":"value"}]},{"as":"previous-effect","function":"if","args":[{"field":"before-current"},{"field":"previous-candidate"},{"value":0}]}],"aggregate":{"by":["report-id","workflow-route"],"values":[{"field":"fact-id","as":"accepted-implementations","reducer":"count"},{"field":"value","as":"known-result","reducer":"sum"},{"field":"current-effect","as":"known-recent","reducer":"sum"},{"field":"previous-effect","as":"known-previous","reducer":"sum"}]}},{"name":"value-covered-durations","subject":"Explicit complete evidence durations in the report and adjacent 28-day delivery periods.","objective":"Distinguish known zero from gaps or incomplete evidence.","acceptance":"The producer validates non-overlapping bounded coverage. Count only complete intervals, clipped to each exact half-open period.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"coverage"},{"field":"coverage-status","equals":"complete"}]},"compute":[{"as":"left-ms","function":"timestamp","args":[{"field":"at"}]},{"as":"right-ms","function":"timestamp","args":[{"field":"end-at"}]},{"as":"cutoff-ms","function":"timestamp","args":[{"field":"window-end"}]},{"as":"current-start","function":"difference","args":[{"field":"cutoff-ms"},{"value":2419200000}]},{"as":"previous-start","function":"difference","args":[{"field":"cutoff-ms"},{"value":4838400000}]},{"as":"after-current","function":"greater-than","args":[{"field":"left-ms"},{"field":"current-start"}]},{"as":"after-previous","function":"greater-than","args":[{"field":"left-ms"},{"field":"previous-start"}]},{"as":"before-current-end","function":"greater-than","args":[{"field":"current-start"},{"field":"right-ms"}]},{"as":"current-left","function":"if","args":[{"field":"after-current"},{"field":"left-ms"},{"field":"current-start"}]},{"as":"previous-left","function":"if","args":[{"field":"after-previous"},{"field":"left-ms"},{"field":"previous-start"}]},{"as":"previous-right","function":"if","args":[{"field":"before-current-end"},{"field":"right-ms"},{"field":"current-start"}]},{"as":"duration","function":"difference","args":[{"field":"right-ms"},{"field":"left-ms"}]},{"as":"current-duration","function":"difference","args":[{"field":"right-ms"},{"field":"current-left"}]},{"as":"previous-duration","function":"difference","args":[{"field":"previous-right"},{"field":"previous-left"}]},{"as":"positive-current","function":"greater-than","args":[{"field":"current-duration"},{"value":0}]},{"as":"positive-previous","function":"greater-than","args":[{"field":"previous-duration"},{"value":0}]},{"as":"covered-current","function":"if","args":[{"field":"positive-current"},{"field":"current-duration"},{"value":0}]},{"as":"covered-previous","function":"if","args":[{"field":"positive-previous"},{"field":"previous-duration"},{"value":0}]}],"aggregate":{"by":["report-id","workflow-route"],"values":[{"field":"duration","as":"covered-duration","reducer":"sum"},{"field":"covered-current","as":"covered-current","reducer":"sum"},{"field":"covered-previous","as":"covered-previous","reducer":"sum"}]}},{"name":"value-report-delivery","subject":"Evidence-qualified output and accepted-contribution totals.","objective":"Keep populations and native units separate without an implied conversion rate.","acceptance":"Absent output context is unknown. Missing coverage withholds complete totals and recent zero, retaining labelled known subtotals.","from":"value-contracts","joins":[{"source":"value-output-counts","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"retained-outputs","as":"retained-outputs"},{"field":"receipt-outputs","as":"retained-receipts"}]},{"source":"value-implementation-counts","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"accepted-implementations","as":"retained-implementations"},{"field":"known-result","as":"known-result"},{"field":"known-recent","as":"known-recent"},{"field":"known-previous","as":"known-previous"}]},{"source":"value-covered-durations","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"covered-duration","as":"covered-duration"},{"field":"covered-current","as":"covered-current"},{"field":"covered-previous","as":"covered-previous"}]}],"compute":[{"as":"start-ms","function":"timestamp","args":[{"field":"window-start"}]},{"as":"end-ms","function":"timestamp","args":[{"field":"window-end"}]},{"as":"report-duration","function":"difference","args":[{"field":"end-ms"},{"field":"start-ms"}]},{"as":"complete-report","function":"equals-any","args":[{"field":"covered-duration"},{"field":"report-duration"}]},{"as":"complete-current","function":"equals-any","args":[{"field":"covered-current"},{"value":2419200000}]},{"as":"complete-previous","function":"equals-any","args":[{"field":"covered-previous"},{"value":2419200000}]},{"as":"show-workflow-trail","function":"equals-any","args":[{"field":"measurement-basis"},{"value":"workflow-contribution"}]},{"as":"known-output-count","function":"coalesce","args":[{"field":"retained-outputs"},{"value":0}]},{"as":"known-receipt-count","function":"coalesce","args":[{"field":"retained-receipts"},{"value":0}]},{"as":"receipt-outputs","function":"if","args":[{"field":"outputs-available"},{"field":"known-receipt-count"},{"value":null}]},{"as":"accepted-implementations","function":"coalesce","args":[{"field":"retained-implementations"},{"value":0}]},{"as":"output-count","function":"if","args":[{"field":"outputs-available"},{"field":"known-output-count"},{"value":null}]},{"as":"native-result","function":"coalesce","args":[{"field":"known-result"},{"value":0}]},{"as":"current-subtotal","function":"coalesce","args":[{"field":"known-recent"},{"value":0}]},{"as":"previous-subtotal","function":"coalesce","args":[{"field":"known-previous"},{"value":0}]},{"as":"recent-result","function":"if","args":[{"field":"complete-current"},{"field":"current-subtotal"},{"value":null}]},{"as":"previous-result","function":"if","args":[{"field":"complete-previous"},{"field":"previous-subtotal"},{"value":null}]}]},{"name":"value-report-summary","subject":"Shared native card and report comparison against the first retained snapshot.","objective":"Show signed repository-wide movement, the goal direction and the exact comparison dates.","acceptance":"This first/last snapshot comparison is not the adjacent-period alert policy, a pre-adoption baseline or causal workflow credit. One snapshot is not zero change.","from":"value-report-delivery","joins":[{"source":"value-first-snapshot","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"value","as":"reference-value"},{"field":"at","as":"reference-at"}]},{"source":"value-last-snapshot","type":"left","on":[{"left":"report-id","right":"report-id"},{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"value","as":"current-value"},{"field":"at","as":"current-at"},{"field":"snapshot-href","as":"current-snapshot-href"}]}],"compute":[{"as":"same-snapshot","function":"equals-any","args":[{"field":"reference-at"},{"field":"current-at"}]},{"as":"raw-change","function":"difference","args":[{"field":"current-value"},{"field":"reference-value"}]},{"as":"native-change","function":"if","args":[{"field":"same-snapshot"},{"value":null},{"field":"raw-change"}]},{"as":"change-missing","function":"equals-any","args":[{"field":"native-change"},{"value":null}]},{"as":"rising","function":"greater-than","args":[{"field":"native-change"},{"value":0}]},{"as":"falling","function":"greater-than","args":[{"value":0},{"field":"native-change"}]},{"as":"unchanged","function":"equals-any","args":[{"field":"native-change"},{"value":0}]},{"as":"decrease-goal","function":"equals-any","args":[{"field":"snapshot-direction"},{"value":"decrease"}]},{"as":"increase-goal","function":"equals-any","args":[{"field":"snapshot-direction"},{"value":"increase"}]},{"as":"increase-movement","function":"if","args":[{"field":"rising"},{"value":"Better"},{"value":"Worse"}]},{"as":"decrease-movement","function":"if","args":[{"field":"falling"},{"value":"Better"},{"value":"Worse"}]},{"as":"directed-movement","function":"if","args":[{"field":"decrease-goal"},{"field":"decrease-movement"},{"field":"increase-movement"}]},{"as":"known-movement","function":"if","args":[{"field":"unchanged"},{"value":"Unchanged"},{"field":"directed-movement"}]},{"as":"movement","function":"if","args":[{"field":"change-missing"},{"value":"Comparison unavailable"},{"field":"known-movement"}]},{"as":"increase-direction-label","function":"if","args":[{"field":"increase-goal"},{"value":"↑ Higher is better"},{"value":"Direction not retained"}]},{"as":"direction-label","function":"if","args":[{"field":"decrease-goal"},{"value":"↓ Lower is better"},{"field":"increase-direction-label"}]},{"as":"change-arrow","function":"if","args":[{"field":"rising"},{"value":"↑ +"},{"value":"↓ "}]},{"as":"change-number","function":"format-count","args":[{"field":"native-change"}]},{"as":"directional-delta","function":"concat","args":[{"field":"change-arrow"},{"field":"change-number"},{"value":" "},{"field":"snapshot-unit"}]},{"as":"known-delta","function":"if","args":[{"field":"unchanged"},{"value":"Unchanged"},{"field":"directional-delta"}]},{"as":"delta-label","function":"if","args":[{"field":"change-missing"},{"value":"Comparison unavailable"},{"field":"known-delta"}]},{"as":"signed-change","function":"concat","args":[{"field":"change-arrow"},{"field":"change-number"},{"value":" "},{"field":"snapshot-unit"},{"value":" · "},{"field":"movement"}]},{"as":"unchanged-change","function":"if","args":[{"field":"unchanged"},{"value":"Unchanged"},{"field":"signed-change"}]},{"as":"change-label","function":"if","args":[{"field":"change-missing"},{"value":"Comparison unavailable"},{"field":"unchanged-change"}]},{"as":"reference-day","function":"date-day","args":[{"field":"reference-at"}]},{"as":"known-comparison-label","function":"concat","args":[{"value":"Since "},{"field":"reference-day"},{"value":" · Everyone's work"}]},{"as":"comparison-label","function":"if","args":[{"field":"change-missing"},{"value":"No earlier snapshot for comparison"},{"field":"known-comparison-label"}]},{"as":"workflow-label","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"workflow-context","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":" · "},{"field":"workflow-label"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-route"}]},{"as":"workflow-value-href","function":"concat","args":[{"value":"#page-workflow-value?workflow="},{"field":"encoded-workflow"}]},{"as":"encoded-report","function":"url-encode","args":[{"field":"report-id"}]},{"as":"report-href","function":"concat","args":[{"value":"#page-value-report?report="},{"field":"encoded-report"}]}]},{"name":"value-workflow-result-order","subject":"Version ordering after independently computing each report.","objective":"Keep exact report queries partition-local without changing latest-version selection.","acceptance":"Rank cutoffs then captures within each workflow and measure. Explicit report links do not need other report facts.","from":"value-report-summary","window":[{"operation":"change","field":"report-marker","as":"older-report","mode":"absolute","groupby":["organization","repository","workflow","workflow-route","metric-id"],"order-by":[{"field":"window-end","direction":"desc"},{"field":"observed-at","direction":"desc"},{"field":"report-id","direction":"desc"}]}]},{"name":"value-workflow-results","subject":"Current published report results per native measure.","objective":"Expose the latest coherent packet on the workflow Value tab.","acceptance":"Never replace missing facts with an older measured version. Explicit report links retain their own version.","from":"value-workflow-result-order","filter":{"predicates":[{"field":"older-report","equals":"unknown"}]}},{"name":"value-workflow-headline-order","subject":"Most recent current report across the measures of each workflow.","objective":"Give each workflow and repository one headline result; other measures stay on the workflow page.","acceptance":"Select by cutoff then capture. Never replace a missing result with an older or zero value.","from":"value-workflow-results","window":[{"operation":"change","field":"report-marker","as":"older-headline","mode":"absolute","groupby":["workflow-route"],"order-by":[{"field":"window-end","direction":"desc"},{"field":"observed-at","direction":"desc"},{"field":"report-id","direction":"desc"}]}]},{"name":"value-workflow-headlines","subject":"One headline result per workflow and repository.","objective":"Join cleanly to collection health without multiplying rows.","acceptance":"Exactly one row per workflow route.","from":"value-workflow-headline-order","filter":{"predicates":[{"field":"older-headline","equals":"unknown"}]}},{"name":"value-workflow-reported-overview","subject":"Workflows with a retained headline result, with any published collection state.","objective":"Show a report even when no collection fact was published for its workflow.","acceptance":"A missing collection fact stays unknown, never an inferred registration.","from":"value-workflow-headlines","joins":[{"source":"value-collection-health","type":"left","on":[{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"collection-state","as":"overview-state"},{"field":"reason","as":"overview-reason"}]}],"compute":[{"as":"overview-title","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":" · "},{"field":"workflow-label"}]},{"as":"overview-evidence","function":"literal","args":[{"value":"Retained evidence available"}]}],"select":[{"field":"workflow-route"},{"field":"overview-title"},{"field":"overview-state"},{"field":"overview-reason"},{"field":"overview-evidence"},{"field":"observed-at","as":"overview-captured"},{"field":"window-end","as":"overview-cutoff"},{"field":"change-label","as":"trend-label"},{"field":"movement","as":"trend-movement"},{"field":"snapshot-name","as":"trend-measure"},{"field":"report-href","as":"overview-href"}]},{"name":"value-workflow-registered-reports","subject":"Registered workflows marked with whether a headline result exists.","objective":"Separate registration from retained outcomes before selecting unreported workflows.","acceptance":"Join on workflow route only; one row per registration.","from":"value-registered-collections","joins":[{"source":"value-workflow-headlines","type":"left","on":[{"left":"workflow-route","right":"workflow-route"}],"fields":[{"field":"report-id","as":"headline-report"}]}],"compute":[{"as":"has-report","function":"equals-any","args":[{"field":"headline-report"},{"value":null}]}]},{"name":"value-workflow-unreported-overview","subject":"Registered workflows that have no retained headline result.","objective":"Keep collection health visible before the first accepted packet.","acceptance":"No result is not zero value or a healthy outcome.","from":"value-workflow-registered-reports","filter":{"predicates":[{"field":"has-report","equals":true}]},"compute":[{"as":"overview-title","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":" · "},{"field":"workflow"}]},{"as":"trend-label","function":"literal","args":[{"value":"No retained result"}]},{"as":"trend-movement","function":"literal","args":[{"value":"No result to compare"}]},{"as":"trend-measure","function":"literal","args":[{"value":"Not available"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-route"}]},{"as":"overview-href","function":"concat","args":[{"value":"#page-workflow-value?workflow="},{"field":"encoded-workflow"}]}],"select":[{"field":"workflow-route"},{"field":"overview-title"},{"field":"collection-state","as":"overview-state"},{"field":"reason","as":"overview-reason"},{"field":"evidence-state","as":"overview-evidence"},{"field":"captured-at","as":"overview-captured"},{"field":"evidence-cutoff","as":"overview-cutoff"},{"field":"trend-label"},{"field":"trend-movement"},{"field":"trend-measure"},{"field":"overview-href"}]},{"name":"value-workflow-overview","subject":"One row per workflow and repository: collection health plus its headline result trend.","objective":"Show the first-to-last trend and collection state in a single card.","acceptance":"Missing reports remain unavailable, never zero. Registration and outcome stay independent facts.","from":"value-workflow-reported-overview","union":["value-workflow-unreported-overview"],"order-by":[{"field":"overview-title","direction":"asc"}],"limit":1000},{"name":"value-intent-sources","subject":"Immutable extracted workflow intent sources.","objective":"Let readers inspect the original goal and requirements.","acceptance":"Only retained HTTPS evidence is linked; workflow text remains untrusted.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"intent-source"}]}},{"name":"value-requirements","subject":"Original full acceptance requirements.","objective":"Distinguish the measured structural facet from all workflow safeguards.","acceptance":"Requirements are source text, not proof they passed.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"requirement"}]}},{"name":"value-outputs","subject":"Retained safe-output lifecycle facts.","objective":"Show receipts, current-at-cutoff state and originating evidence.","acceptance":"A closed output is not automatically an accepted implementation; absence of a link is unknown.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"output"}]},"order-by":[{"field":"at","direction":"desc"},{"field":"fact-id","direction":"asc"}]},{"name":"value-output-origin-evidence","subject":"Retained producer and applied safe-output evidence.","objective":"Let readers distinguish receipt-confirmed creation from corroborated tracking.","acceptance":"Tracking identities locate outputs but do not establish accepted value. Keep unavailable producer evidence explicit.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"output-evidence"}]},"joins":[{"source":"value-outputs","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"parent-id","right":"fact-id"}],"fields":[{"field":"label","as":"output-label"},{"field":"url","as":"output-url"}]}]},{"name":"value-implementations","subject":"Accepted implementations and native before/after effects.","objective":"Expose delivery time and immutable acceptance evidence.","acceptance":"Do not equate acceptance with full quality verification or omit negative effects.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"implementation"}]},"order-by":[{"field":"at","direction":"desc"},{"field":"fact-id","direction":"asc"}]},{"name":"value-output-trails","subject":"Explicit output-to-implementation edges.","objective":"Make the trail from a proposal to an accepted measured change inspectable.","acceptance":"Use retained dated edges only. Many-to-many links do not duplicate headline counts or values.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"output-implementation"}]},"joins":[{"source":"value-outputs","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"parent-id","right":"fact-id"}],"fields":[{"field":"label","as":"output-label"},{"field":"url","as":"output-url"}]},{"source":"value-implementations","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"related-id","right":"fact-id"}],"fields":[{"field":"label","as":"implementation-label"},{"field":"url","as":"implementation-url"},{"field":"value","as":"implementation-value"},{"field":"at","as":"trail-accepted-at"}]}]},{"name":"value-implementation-files","subject":"Measured implementation files and retained lineage sources.","objective":"Link to exact Git facts rather than only a repository tree.","acceptance":"No URL is reconstructed from an unrelated revision. Preserve before, after and replacement file evidence.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","in":["implementation-evidence","implementation-lineage"]}]},"joins":[{"source":"value-implementations","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"parent-id","right":"fact-id"}],"fields":[{"field":"label","as":"implementation-label"},{"field":"url","as":"implementation-url"}]}]},{"name":"value-quality-checks","subject":"Explicit independent verification checks.","objective":"Keep unverified behavior, tests and other safeguards visible.","acceptance":"Missing or not-verified is not a passing check.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"quality-check"}]}},{"name":"value-limitations","subject":"Retained evidence and attribution limitations.","objective":"Qualify claims without inventing completeness.","acceptance":"Treat source limitations as untrusted text and never suppress them.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"limitation"}]}},{"name":"value-snapshot-items","subject":"Actual counted items at an independent immutable snapshot.","objective":"Open exact per-item evidence from the plotted observation.","acceptance":"Only retained items are shown. Missing item evidence must not look like an empty measured population.","from":"value-evidence-facts","filter":{"predicates":[{"field":"fact-kind","equals":"snapshot-item"}]},"joins":[{"source":"value-snapshots","type":"inner","on":[{"left":"report-id","right":"report-id"},{"left":"parent-id","right":"fact-id"},{"left":"snapshot-route","right":"snapshot-route"}],"fields":[{"field":"at","as":"snapshot-at"}]}]},{"name":"audit-event-summary-buckets","subject":"Aggregate high- and medium-severity audit events with the same severity and summary by workflow.","objective":"Select recurring high- or medium-severity audit summaries for run-level investigation.","acceptance":"Each bucket's event count is traceable to retained audit or tool observations with the same campaign, severity, workflow, and summary; missing workflow attribution stays unknown, and a count alone does not verify impact.","description":"High- and medium-severity audit event counts grouped by severity, workflow, and shared summary.","from":"audits","union":["tools"],"filter":{"predicates":[{"field":"event-type","in":["audit.finding","audit.observability","audit.recommendation","audit.missing_tool","audit.missing_data","audit.noop","audit.mcp_failure","skill.invoked"]},{"field":"event-status","in":["high","medium"]}]},"joins":[{"source":"workflows","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"campaign","as":"campaign"}]}],"aggregate":{"by":["campaign","event-status","workflow","event-summary"],"values":[{"field":"event","as":"events","reducer":"count"}]},"select":[{"field":"campaign"},{"field":"event-status"},{"field":"workflow"},{"field":"event-summary"},{"field":"events"}],"order-by":[{"field":"event-status","direction":"asc"},{"field":"events","direction":"desc"},{"field":"workflow","direction":"asc"},{"field":"event-summary","direction":"asc"}]},{"name":"campaign-workflows","subject":"List campaign-owned orchestrator and worker workflows with database-backed execution totals.","objective":"Choose an active campaign workflow whose observed execution warrants inspection.","acceptance":"Listed workflows match active declared orchestrator or worker inventory entries; runs and AI Credits agree with the selected-horizon inventory, and absence is not evidence of disabled authority or no executions. Rollout mode is context, not permission to change policy.","description":"Campaign workflows projected from lean canonical inventory, with shared declaration names and active-only workflow drill-down links.","from":"campaign-workflow-inventory","filter":{"predicates":[{"field":"workflow-active","equals":"true"}]},"compute":[{"as":"workflow-identity","function":"concat","args":[{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-identity"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-display-name"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-identity"}]}],"select":[{"field":"campaign"},{"field":"campaign-display-name","as":"campaign-name"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-role"},{"field":"rollout-mode"},{"field":"workflow-active"},{"field":"runs"},{"field":"aic"},{"field":"repository-dashboard-link","as":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"}],"order-by":[{"field":"campaign-name","direction":"asc"},{"field":"workflow-role","direction":"asc"},{"field":"workflow-name","direction":"asc"}]},{"name":"campaign-repository-declarations","subject":"List active declared campaign workflows and their owning repositories without execution evidence.","objective":"Inspect campaign repository topology without computing unused run totals or import coverage.","acceptance":"Preserve active orchestrator and worker identities, display names, rollout context, links, and ordering. Declaration counts are not target enrollment, dispatch coverage, or execution totals. Empty inventory and unavailable workflow evidence remain distinct.","description":"Declaration-only repository topology. Run totals and import-evidence quality belong to execution views, not this inventory.","from":"campaign-workflow-declarations","filter":{"predicates":[{"field":"workflow-active","equals":"true"}]},"select":[{"field":"campaign"},{"field":"campaign-display-name","as":"campaign-name"},{"field":"organization"},{"field":"repository-slug","as":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"workflow-active"},{"field":"repository-dashboard-link","as":"repository-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"campaign-repository-inventory","subject":"Present declared campaign repository topology in workflow display order.","objective":"Filter and search projected repository coordinates and workflow names without time-filtering structural declarations.","acceptance":"Preserve the campaign workflow list's stable ordering and declaration-only evidence quality; runtime horizons must not remove declared workflows.","from":"campaign-repository-declarations","order-by":[{"field":"campaign-name","direction":"asc"},{"field":"workflow-role","direction":"asc"},{"field":"workflow-name","direction":"asc"}]},{"name":"campaign-reports","subject":"Project retained outcomes into campaign-addressable report evidence.","objective":"Identify a campaign report whose durable outcome record needs follow-up.","acceptance":"Each report's campaign, title, source link, observation time, and disposition match its retained outcome; missing status is labeled unknown rather than accepted or resolved, and report production is not verified impact.","description":"Campaign outcome reports with database-backed disposition fields.","from":"outcomes","compute":[{"as":"report-status","function":"coalesce","args":[{"field":"outcome-status"},{"field":"outcome-state"},{"value":"unknown"}]}],"select":[{"field":"campaign"},{"field":"safe-output"},{"field":"outcome-title"},{"field":"outcome-summary"},{"field":"report-status","as":"outcome-status"},{"field":"rollout-mode"},{"field":"engine"},{"field":"engine-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"outcome-category"},{"field":"observed-at"},{"field":"external-link"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"outcome-title","direction":"asc"}]},{"name":"campaign-worker-issues","subject":"Project issue outcomes created by campaign worker workflows.","objective":"Choose a campaign worker issue whose current recorded disposition needs review.","acceptance":"Include only issues whose producing run joins declared worker inventory on organization, repository, and workflow, even when the issue lands elsewhere. Preserve campaign and role across Activity imports. Retain run and status evidence; missing closure details stay unknown and closure is not proof of resolution.","description":"Campaign-addressable issue outcomes restricted to declared worker workflows.","from":"outcomes","joins":[{"source":"workflows","type":"inner","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"workflow-role","as":"declared-workflow-role"}]}],"filter":{"predicates":[{"field":"outcome-category","equals":"issue"},{"field":"declared-workflow-role","equals":"worker"}]},"select":[{"field":"campaign"},{"field":"organization"},{"field":"repository"},{"field":"safe-output"},{"field":"outcome-number"},{"field":"outcome-title","as":"event-summary"},{"field":"outcome-title"},{"field":"outcome-summary"},{"field":"outcome-status"},{"field":"outcome-state"},{"field":"issue-state"},{"field":"issue-closed"},{"field":"issue-state-reason"},{"field":"issue-status"},{"field":"issue-closing-status"},{"field":"issue-status-detail"},{"field":"issue-closed-at"},{"field":"issue-status-observed-at"},{"field":"outcome-category","as":"safe-output-type"},{"field":"workflow"},{"field":"workflow-name"},{"field":"run"},{"field":"observed-at"},{"field":"issue-link"},{"field":"external-link"},{"field":"run-link"}],"order-by":[{"field":"observed-at","direction":"desc"}]},{"name":"campaign-issue-tab-counts","subject":"Count the retained worker issues available for each campaign Reports tab.","objective":"Decide whether a campaign has retained worker issue reports to inspect.","acceptance":"For each returned campaign, items equals the number of rows in campaign-worker-issues for that campaign in the same horizon; missing campaigns are not treated as zero issues or verified resolution.","description":"One campaign row with the number of retained issue outcomes produced by campaign workers.","from":"campaign-worker-issues","aggregate":{"by":["campaign"],"values":[{"field":"campaign","as":"items","reducer":"count"}]}},{"name":"campaign-readme-orchestrators","subject":"Resolve one repository link for each campaign README from its declared orchestrator workflow.","objective":"Locate the declared orchestrator repository to contextualize a campaign README.","acceptance":"Each returned campaign and repository link traces to a declared orchestrator workflow; missing or multiple declarations are reported as uncertain rather than inventing a canonical repository.","from":"workflows","filter":{"predicates":[{"field":"workflow-role","equals":"orchestrator"}]},"select":[{"field":"campaign"},{"field":"repository-link"}]},{"name":"campaign-readme-details","subject":"Present retained campaign README content with its repository-relative link context.","objective":"Open the campaign's retained README in its declared repository context before relying on its guidance.","acceptance":"The README text and path match the campaign record and any repository link resolves through a declared orchestrator; absent content or repository linkage remains unavailable, not inferred.","from":"campaigns","joins":[{"source":"campaign-readme-orchestrators","type":"left","on":[{"left":"campaign","right":"campaign"}],"fields":[{"field":"repository-link","as":"repository-link"}]}],"select":[{"field":"campaign"},{"field":"campaign-readme"},{"field":"campaign-readme-path"},{"field":"repository-link"}]},{"name":"campaign-memory-campaigns","subject":"Provide the registered campaigns whose repository memory can be browsed together.","objective":"Choose a registered campaign for repository-memory inspection.","acceptance":"Each campaign identity and display name matches the retained campaign registry in the selected scope; listing a campaign does not establish that memory observations exist or are complete.","description":"Registered campaigns ordered for the all-campaign repository-memory browser.","from":"campaigns","select":[{"field":"campaign"},{"field":"campaign-name"}],"order-by":[{"field":"campaign-name","direction":"asc"}]},{"name":"campaign-performance-baseline-totals","subject":"Establish a selected-horizon campaign baseline from concluded run attempts while keeping reliability, unverified production, and efficiency as separate facts.","objective":"Select campaigns whose retained run reliability, output production, or AI Credit efficiency merits closer examination.","acceptance":"Concluded and successful attempts, outputs, and mean AI Credits reconcile to filtered retained runs; absent denominators or costs stay unknown. Produced outputs are unverified, not operational value.","description":"Canonical campaign run attempts aggregated into bounded selected-horizon baseline totals without treating runtime success or produced outputs as operational value.","from":"campaign-runs","compute":[{"as":"run-attempt-identity","function":"concat","args":[{"field":"run"},{"value":":"},{"field":"run-attempt"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["campaign"],"values":[{"field":"run-attempt-identity","as":"concluded-runs","reducer":"count","filter":{"predicates":[{"field":"status","in":["success","failure","cancelled","timed-out","action-required","neutral","skipped","stale","startup-failure"]}]}},{"field":"run-attempt-identity","as":"successful-runs","reducer":"count","filter":{"predicates":[{"field":"status","equals":"success"}]}},{"field":"safe-items-count","as":"runs-with-output-evidence","reducer":"count","filter":{"predicates":[{"field":"status","equals":"success"}]}},{"field":"safe-items-count","as":"produced-outputs","reducer":"sum","filter":{"predicates":[{"field":"status","equals":"success"}]}},{"field":"aic-total","as":"aic-per-successful-run","reducer":"mean","filter":{"predicates":[{"field":"status","equals":"success"},{"field":"positive-aic","equals":true}]}}]}},{"name":"campaign-performance-baseline","subject":"Turn each campaign's selected-horizon baseline totals into deterministic reliability and production signals with an explicit successful-run efficiency fact.","objective":"Decide which campaign baseline signal needs run- or output-level verification next.","acceptance":"Success-rate and signal labels follow the retained totals and their explicit denominators; no concluded attempts or output evidence is distinguished from zero verified impact, and AI Credits per successful run remain a separate cost fact rather than a value score.","description":"A bounded, explainable baseline that distinguishes runtime reliability, unverified output production, and AI Credit efficiency.","from":"campaign-performance-baseline-totals","compute":[{"as":"success-rate","function":"quotient","args":[{"field":"successful-runs"},{"field":"concluded-runs"}]},{"as":"success-rate-display","function":"format-percent","args":[{"field":"success-rate"}]},{"as":"success-rate-percent","function":"product","args":[{"field":"success-rate"},{"value":100}]},{"as":"has-concluded-runs","function":"greater-than","args":[{"field":"concluded-runs"},{"value":0}]},{"as":"has-unsuccessful-runs","function":"greater-than","args":[{"field":"concluded-runs"},{"field":"successful-runs"}]},{"as":"observed-reliability-signal","function":"if","args":[{"field":"has-unsuccessful-runs"},{"value":"Unsuccessful runs observed"},{"value":"No unsuccessful runs observed"}]},{"as":"reliability-signal","function":"if","args":[{"field":"has-concluded-runs"},{"field":"observed-reliability-signal"},{"value":"No concluded runs observed"}]},{"as":"has-output-evidence","function":"greater-than","args":[{"field":"runs-with-output-evidence"},{"value":0}]},{"as":"has-produced-outputs","function":"greater-than","args":[{"field":"produced-outputs"},{"value":0}]},{"as":"observed-production-signal","function":"if","args":[{"field":"has-produced-outputs"},{"value":"Outputs produced; acceptance unverified"},{"value":"No outputs observed"}]},{"as":"production-signal","function":"if","args":[{"field":"has-output-evidence"},{"field":"observed-production-signal"},{"value":"Output evidence unavailable"}]}],"select":[{"field":"campaign"},{"field":"concluded-runs"},{"field":"successful-runs"},{"field":"success-rate"},{"field":"success-rate-display"},{"field":"success-rate-percent"},{"field":"reliability-signal"},{"field":"produced-outputs"},{"field":"production-signal"},{"field":"aic-per-successful-run"}]},{"name":"campaign-problem-runs","subject":"List retained failed runs for campaign problem investigation.","objective":"Choose a recent failed campaign run to investigate with its diagnostic evidence.","acceptance":"Each row corresponds to a retained campaign run with a declared failure, startup-failure, stale, or timed-out status; campaign-problem-run-evidence orders matching rows newest first. Absence is not proof of healthy execution or complete ingestion.","description":"Private failed-run input with retained diagnostic metadata; the evidence consumer orders only runs matching current runtime problems.","from":"campaign-runs","filter":{"predicates":[{"field":"status","in":["failure","startup-failure","stale","timed-out"]}]}},{"name":"campaign-problem-runtime-failures","subject":"Select current failing runtime partitions without presentation ordering.","objective":"Retain the exact current-failure eligibility needed by the problem evidence join.","acceptance":"A latest failure streak is a nonnegative integer, so failure-count at least one is equivalent to has-current-failure; missing or incomplete runtime evidence remains unknown.","description":"Private unsorted failure partitions for problem evidence; ordering is supplied by the retained failed runs.","from":"campaign-runtime-health-groups","filter":{"predicates":[{"field":"failure-count","gte":1}]},"compute":[{"as":"problem-kind","function":"coalesce","args":[{"value":"failure"},{"value":"failure"}]}]},{"name":"campaign-problem-runtime-partitions","subject":"Project current runtime problem keys and diagnoses for the failed-run evidence join.","objective":"Avoid sorting and retaining unused runtime problem presentation fields.","acceptance":"Retain both current failures and unobserved orchestrators, including their metadata and duplicate-key failure semantics; this projection does not establish health or root cause.","description":"Private compact equivalent of campaign-runtime-problems for equality enrichment, not presentation.","from":"campaign-problem-runtime-failures","union":["campaign-unobserved-orchestrators"],"select":[{"field":"campaign"},{"field":"workflow"},{"field":"runtime-repository"},{"field":"failure-count"},{"field":"problem-kind"}]},{"name":"campaign-problem-run-evidence","subject":"Attach the current campaign runtime problem summary to each retained failed Run for that partition.","objective":"Inspect the failure count and problem kind alongside a failed run without inferring its root cause.","acceptance":"Each returned row joins a retained failed run to a runtime problem on campaign, workflow, and runtime repository; the inner join drops unmatched runs, so compare with campaign-problem-runs before interpreting absence as no problem.","description":"Failed campaign runs annotated with the failure-count and problem-kind of their active runtime problem, one row per retained failed Run.","from":"campaign-problem-runs","joins":[{"source":"campaign-problem-runtime-partitions","type":"inner","on":[{"left":"campaign","right":"campaign"},{"left":"workflow","right":"workflow"},{"left":"runtime-repository","right":"runtime-repository"}],"fields":[{"field":"failure-count","as":"failure-count"},{"field":"problem-kind","as":"problem-kind"}]}],"order-by":[{"field":"started-at","direction":"desc"},{"field":"run","direction":"desc"}]},{"name":"campaign-problem-latest-target-runs","subject":"Identify the most recent retained failed Run for each campaign workflow target repository.","objective":"Select the latest retained failed run identity for each campaign workflow and target partition.","acceptance":"For every returned campaign, workflow, runtime repository, and target repository, latest-target-run agrees with the maximum retained failed run identity in that partition; a missing partition is not a healthy target.","description":"One row per campaign workflow and target repository with its most recent retained failed Run identity.","from":"campaign-problem-run-evidence","aggregate":{"by":["campaign","workflow","runtime-repository","target-repository"],"values":[{"field":"run","as":"latest-target-run","reducer":"max"}]}},{"name":"campaign-problem-error-groups","subject":"Cluster retained failed Run evidence by workflow, runtime repository, target repository, and error signature so repeated identical failures for one target collapse into one diagnosable group.","objective":"Rank repeated target-specific error signatures for investigation without merging unrelated failures.","acceptance":"Occurrence-count and latest-run match retained failed runs grouped by campaign, workflow, repositories, problem kind, and signature; unknown signatures may group together. Counts do not prove a root cause.","description":"One row per distinct target repository and error signature within a campaign runtime problem partition, with an occurrence count and the most recent matching Run identity for follow-up.","from":"campaign-problem-run-evidence","aggregate":{"by":["campaign","campaign-name","workflow","workflow-name","workflow-role","runtime-repository","target-repository","rollout-mode","failure-count","problem-kind","error-signature","error-signature-label"],"values":[{"field":"run","as":"occurrence-count","reducer":"count"},{"field":"run","as":"latest-run","reducer":"max"}]}},{"name":"campaign-current-problem-error-groups","subject":"Keep only the newest error signature for each campaign workflow target repository.","objective":"Focus investigation on the signature associated with the latest retained failed run per target.","acceptance":"Each returned group joins campaign-problem-latest-target-runs on campaign, workflow, runtime repository, and latest run ID; target repository is not a join key, so verify target identity against underlying runs before claiming one current signature per target.","description":"Current target-specific error groups whose representative Run is the target repository's most recent retained failed Run.","from":"campaign-problem-error-groups","joins":[{"source":"campaign-problem-latest-target-runs","type":"inner","on":[{"left":"campaign","right":"campaign"},{"left":"workflow","right":"workflow"},{"left":"runtime-repository","right":"runtime-repository"},{"left":"latest-run","right":"latest-target-run"}],"fields":[{"field":"latest-target-run","as":"current-target-run"}]}]},{"name":"campaign-problem-items","subject":"Attach the most recent representative Run evidence to each distinct campaign runtime problem error signature.","objective":"Open the representative failed run and target for each current campaign problem group.","acceptance":"Check joined run-link, run ID, campaign, workflow, and runtime repository; verify target against run evidence (not a join key). Unobserved orchestrators need inventory review. Missing evidence remains unknown; rollout mode does not authorize policy changes.","description":"Current campaign runtime problems represented by the newest error signature for each target repository, with its effective rollout mode, an occurrence count, the most recent matching failed Run, and a repair prompt.","from":"campaign-current-problem-error-groups","joins":[{"source":"campaign-problem-run-evidence","type":"inner","on":[{"left":"campaign","right":"campaign"},{"left":"workflow","right":"workflow"},{"left":"runtime-repository","right":"runtime-repository"},{"left":"latest-run","right":"run"}],"fields":[{"field":"started-at","as":"started-at"},{"field":"run","as":"run"},{"field":"status","as":"status"},{"field":"status-detail","as":"status-detail"},{"field":"failure-job","as":"failure-job"},{"field":"failure-message","as":"failure-message"},{"field":"failure-step","as":"failure-step"},{"field":"failure-log","as":"failure-log"},{"field":"gh-aw-version","as":"gh-aw-version"},{"field":"engine","as":"engine"},{"field":"engine-version","as":"engine-version"},{"field":"requested-model","as":"requested-model"},{"field":"resolved-model","as":"resolved-model"},{"field":"run-link","as":"run-link"},{"field":"repository-link","as":"repository-link"},{"field":"workflow-link","as":"workflow-link"},{"field":"workflow-source-link","as":"workflow-source-link"}]}],"union":["campaign-unobserved-orchestrators"],"compute":[{"as":"problem-title","function":"coalesce","args":[{"field":"failure-message"},{"field":"status-detail"},{"field":"error-signature-label"},{"field":"workflow-name"}]},{"as":"_runtime-repository-encoded","function":"url-encode","args":[{"field":"runtime-repository"}]},{"as":"_runtime-repository-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"_runtime-repository-encoded"}]},{"as":"runtime-repository-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"_runtime-repository-href"},{"field":"runtime-repository"},{"field":"runtime-repository"}]},{"as":"_target-repository-encoded","function":"url-encode","args":[{"field":"target-repository"}]},{"as":"_target-repository-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"_target-repository-encoded"}]},{"as":"target-repository-link","function":"dashboard-link","args":[{"field":"target-repository"},{"field":"_target-repository-href"},{"field":"target-repository"}]}],"order-by":[{"field":"workflow-name","direction":"asc"},{"field":"runtime-repository","direction":"asc"},{"field":"occurrence-count","direction":"desc"},{"field":"started-at","direction":"desc"}]},{"name":"campaign-problem-tab-counts","subject":"Count the current runtime problem items available for each campaign Problems tab.","objective":"Determine whether the campaign has current retained failure groups requiring review.","acceptance":"For every returned campaign, items equals the number of campaign-problem-items rows in the same horizon; a missing count does not establish zero failures or healthy execution.","description":"One campaign row with the number of current runtime problem groups.","from":"campaign-problem-items","aggregate":{"by":["campaign"],"values":[{"field":"campaign","as":"items","reducer":"count"}]}},{"name":"campaign-baseline-successful-runs","subject":"Project successful concluded attempts from the selected-horizon campaign baseline.","objective":"Show the successful share of concluded runs without implying verified impact.","acceptance":"Counts reconcile to campaign-performance-baseline-totals; missing campaigns do not imply zero runs.","from":"campaign-performance-baseline-totals","compute":[{"as":"outcome","function":"concat","args":[{"value":"Successful attempts"},{"value":""}]}],"select":[{"field":"campaign"},{"field":"outcome"},{"field":"successful-runs","as":"runs"}]},{"name":"campaign-baseline-other-runs","subject":"Project non-successful concluded attempts from the selected-horizon campaign baseline.","objective":"Show the remaining concluded runs for reliability review.","acceptance":"Runs equal concluded-runs minus successful-runs; the category includes every other concluded status, not just failures.","from":"campaign-performance-baseline-totals","compute":[{"as":"outcome","function":"concat","args":[{"value":"Other concluded attempts"},{"value":""}]},{"as":"other-runs","function":"difference","args":[{"field":"concluded-runs"},{"field":"successful-runs"}]}],"select":[{"field":"campaign"},{"field":"outcome"},{"field":"other-runs","as":"runs"}]},{"name":"campaign-baseline-outcome-distribution","subject":"Compare successful and other concluded attempts in the selected horizon.","objective":"Spot campaign run reliability that needs inspection.","acceptance":"Successful and other counts sum to concluded attempts; neither runtime result nor output production establishes operational value.","from":"campaign-baseline-successful-runs","union":["campaign-baseline-other-runs"]},{"name":"campaign-audit-summary-plot-inventory","subject":"Describe the rendered audit-summary chart using the shared campaign Insights plot contract.","objective":"Find campaigns with retained high- or medium-severity audit summaries worth reviewing.","acceptance":"Each campaign's bucket count equals its retained audit-event-summary-buckets rows; the count describes displayed groups, not distinct incidents or confirmed harm, and missing buckets are not proof of safety.","description":"One plot-inventory row per campaign when its high- and medium-severity audit summary chart has data.","from":"audit-event-summary-buckets","aggregate":{"by":["campaign"],"values":[{"field":"event-summary","as":"buckets","reducer":"count"}]}},{"name":"campaign-insight-plot-inventory","subject":"Inventory every plot rendered on each campaign Insights page through one reusable plot contract.","objective":"Choose an available campaign Insights plot to inspect its underlying evidence.","acceptance":"Each plot entry is supplied by the audit summary plot inventory for the same campaign; experimental operational-value evidence is excluded, no plot count is treated as outcome quality, and unavailable evidence is not synthesized into a plot.","description":"One campaign row per rendered Insights plot, independent of the plot's data source or renderer.","from":"campaign-audit-summary-plot-inventory"},{"name":"campaign-insight-tab-counts","subject":"Count the plots declared by the shared campaign Insights plot inventory.","objective":"Determine whether a campaign has evidence-backed Insights plots to inspect.","acceptance":"For every returned campaign, items equals its rows in campaign-insight-plot-inventory for the same horizon; absent rows do not establish absent value, and plot counts do not measure impact.","description":"One campaign row with the number of rendered Insights plots, independent of plot type.","from":"campaign-insight-plot-inventory","aggregate":{"by":["campaign"],"values":[{"field":"campaign","as":"items","reducer":"count"}]}},{"name":"workflow-ordered-runs","subject":"Order retained run attempts within each workflow by their observed start time.","objective":"Identify each workflow's latest execution without importing event coverage or outcome totals.","acceptance":"The first chronological attempt in each workflow partition has no preceding run delta; break timestamp ties by run ID and attempt, and use creation time for queued runs.","from":"runs","compute":[{"as":"latest-run-at","function":"coalesce","args":[{"field":"started-at"},{"field":"created-at"}]}],"window":[{"operation":"change","field":"run","as":"preceding-run-delta","mode":"absolute","groupby":["organization","repository","workflow"],"order-by":[{"field":"latest-run-at","direction":"desc"},{"field":"run","direction":"desc"},{"field":"run-attempt","direction":"desc"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"latest-run-at"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"preceding-run-delta"},{"field":"run-link"}]},{"name":"workflow-latest-runs","subject":"Project the latest retained run attempt for each workflow.","objective":"Expose each workflow's latest observed execution state without implying aggregate outcomes.","acceptance":"Select only the first chronologically ordered attempt per workflow; preserve queued and in-progress states instead of treating unknown conclusions as failures.","from":"workflow-ordered-runs","filter":{"predicates":[{"field":"preceding-run-delta","equals":"unknown"}]},"compute":[{"as":"observed-conclusion","function":"coalesce","args":[{"field":"run-conclusion"},{"value":"unknown"}]},{"as":"completed","function":"equals-any","args":[{"field":"run-status"},{"value":"completed"}]},{"as":"latest-run-status","function":"if","args":[{"field":"completed"},{"field":"observed-conclusion"},{"field":"run-status"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"latest-run-at"},{"field":"latest-run-status"},{"field":"run-link"}]},{"name":"workflow-list-preview","subject":"Show workflow declarations while latest-run evidence is still loading.","objective":"Make workflow identities and drill links available before retained runs are evaluated.","acceptance":"Preserve every declared workflow and its drill link; leave latest-run fields absent until the complete projection arrives.","from":"workflows","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-label","function":"concat","args":[{"field":"repository-coordinate"},{"value":":"},{"field":"workflow"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"declared-role","function":"coalesce","args":[{"field":"workflow-role"},{"value":"standalone"}]},{"as":"declared-mode","function":"coalesce","args":[{"field":"rollout-mode"},{"value":"unknown"}]},{"as":"declared-registration","function":"coalesce","args":[{"field":"workflow-active"},{"value":"unknown"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-label"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-display-name"},{"field":"workflow-label"}]}],"select":[{"field":"organization"},{"field":"repository-coordinate","as":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-label"},{"field":"campaign-name"},{"field":"declared-role","as":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"declared-registration","as":"workflow-active"},{"field":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"}],"order-by":[{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"workflow-list","subject":"List declared workflows in latest observed run order.","objective":"Open a dedicated workflow page from a lightweight inventory with its latest execution status.","acceptance":"Preserve textual run identities and keep unobserved workflows last with an explicit missing-run state; use only workflow declarations and retained runs, not event coverage or aggregate success/failure counters.","from":"workflows","joins":[{"source":"workflow-latest-runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"run","as":"latest-run"},{"field":"latest-run-at","as":"latest-run-at"},{"field":"latest-run-status","as":"observed-run-status"},{"field":"run-link","as":"run-link"}]}],"compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-label","function":"concat","args":[{"field":"repository-coordinate"},{"value":":"},{"field":"workflow"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"declared-role","function":"coalesce","args":[{"field":"workflow-role"},{"value":"standalone"}]},{"as":"declared-mode","function":"coalesce","args":[{"field":"rollout-mode"},{"value":"unknown"}]},{"as":"declared-registration","function":"coalesce","args":[{"field":"workflow-active"},{"value":"unknown"}]},{"as":"observed-run-id","function":"coalesce","args":[{"field":"latest-run"},{"value":"0"}]},{"as":"has-observed-run","function":"greater-than","args":[{"field":"observed-run-id"},{"value":0}]},{"as":"latest-run-status","function":"coalesce","args":[{"field":"observed-run-status"},{"value":"No observed run"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-label"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-display-name"},{"field":"workflow-label"}]}],"select":[{"field":"organization"},{"field":"repository-coordinate","as":"repository"},{"field":"workflow"},{"field":"workflow-display-name","as":"workflow-name"},{"field":"workflow-label"},{"field":"campaign-name"},{"field":"declared-role","as":"workflow-role"},{"field":"declared-mode","as":"rollout-mode"},{"field":"declared-registration","as":"workflow-active"},{"field":"latest-run"},{"field":"latest-run-at"},{"field":"latest-run-status"},{"field":"has-observed-run"},{"field":"repository-link"},{"field":"workflow-dashboard-link","as":"workflow-link"},{"field":"run-link"}],"order-by":[{"field":"has-observed-run","direction":"desc"},{"field":"latest-run-at","direction":"desc"},{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"runs-daily-health-buckets","subject":"Select whole UTC start-day buckets against the requested time bounds.","objective":"Expose UTC bucket boundaries for declarative daily time selection.","acceptance":"Compute bounds from observed execution-start days only; missing request bounds remain unset and no sub-day totals or missing days are fabricated.","from":"daily-run-counts","compute":[{"as":"day-midnight","function":"concat","args":[{"field":"day"},{"value":"T00:00:00Z"}]},{"as":"day-ms","function":"timestamp","args":[{"field":"day-midnight"}]},{"as":"start-ms","function":"timestamp","args":[{"context":"time-start"}]},{"as":"end-ms","function":"timestamp","args":[{"context":"time-end"}]},{"as":"before-start","function":"greater-than","args":[{"field":"start-ms"},{"field":"day-ms"}]},{"as":"before-end","function":"greater-than","args":[{"field":"end-ms"},{"field":"day-ms"}]}]},{"name":"runs-daily-health-totals","subject":"Sum observed daily run health across the selected scope.","objective":"Keep daily activity counts independent of detail retention.","acceptance":"Sum only daily counts, never retained Runs. UTC start-day buckets are selected by midnight; sub-day totals are unsupported. Missing or undated evidence remains unavailable or partial.","from":"runs-daily-health-buckets","filter":{"predicates":[{"field":"before-start","in":[false,null]},{"field":"before-end","in":[true,null]}]},"aggregate":{"by":["day"],"values":[{"field":"successful","as":"successful","reducer":"sum"},{"field":"failed","as":"failed","reducer":"sum"},{"field":"approval","as":"approval","reducer":"sum"},{"field":"pending","as":"pending","reducer":"sum"},{"field":"other","as":"other","reducer":"sum"}]}},{"name":"runs-daily-successful","subject":"Observed daily successful run counts.","objective":"Expose the successful class for the daily runtime-health chart.","acceptance":"Project successful counts from scoped daily totals without re-reading detail; runtime success does not imply accepted outcomes.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Successful"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"successful","as":"runs"}]},{"name":"runs-daily-failed","subject":"Observed daily failed run counts.","objective":"Expose the failed class for the daily runtime-health chart.","acceptance":"Project failed counts from scoped daily totals, preserving zero counts and aggregate coverage without deriving incidents.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Failed"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"failed","as":"runs"}]},{"name":"runs-daily-approval","subject":"Observed daily approval-required run counts.","objective":"Expose approval-required observations in the daily runtime-health chart.","acceptance":"Project approval counts from scoped daily totals without treating approval-required observations as successes or failures.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Approval required"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"approval","as":"runs"}]},{"name":"runs-daily-pending","subject":"Observed daily pending run counts.","objective":"Expose last-observed pending state in the daily runtime-health chart.","acceptance":"Project pending counts from scoped daily totals; counts describe last-observed evidence, not a live execution census.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Pending"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"pending","as":"runs"}]},{"name":"runs-daily-other","subject":"Observed daily unclassified terminal or missing-status run counts.","objective":"Expose the remaining runtime-health class without implying success.","acceptance":"Project other counts from scoped daily totals; preserve zeros and coverage without interpreting skipped, cancelled, or unknown evidence as success.","from":"runs-daily-health-totals","compute":[{"as":"runtime-health","function":"literal","args":[{"value":"Other"}]}],"select":[{"field":"day"},{"field":"runtime-health"},{"field":"other","as":"runs"}]},{"name":"runs-daily-conclusions","subject":"Daily observed runtime health classes for the Runs chart.","objective":"Investigate daily activity independently of retained run detail.","acceptance":"Classes sum to observed dated Runs, not attempts or verified outcomes. Pending is last-observed state; Other is not success. Select whole UTC start-day buckets by midnight, not sub-day totals. Preserve partial or unavailable coverage.","from":"runs-daily-successful","union":["runs-daily-failed","runs-daily-approval","runs-daily-pending","runs-daily-other"],"order-by":[{"field":"day","direction":"asc"},{"field":"runtime-health","direction":"asc"}]},{"name":"entity-events","subject":"Project all run-owned records for reusable cards and run drill-down.","objective":"Expose run-owned event identity, status, provenance, timestamp, and available navigation links for inspection.","acceptance":"Projected event fields and fallback URL trace to the source record; a missing link or event is not proof of no output, and event status alone does not verify downstream impact.","from":"event-base","compute":[{"as":"event-url","function":"coalesce","args":[{"field":"safe-output-url"},{"field":"correlation-id"},{"field":"implementation-pull-request-url"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"run"},{"field":"run-attempt"},{"field":"event"},{"field":"event-source"},{"field":"event-type"},{"field":"event-summary"},{"field":"event-status"},{"field":"github-entity-type"},{"field":"safe-output-type"},{"field":"event-url"},{"field":"event-timestamp","as":"observed-at"},{"field":"run-link"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"event","direction":"asc"}]},{"name":"runs-table","subject":"Show observed workflow runs in a table with execution, repository, workflow, engine, model, and navigation details.","objective":"Locate observed runs whose recorded status or conclusion needs closer inspection.","acceptance":"Show recorded run identity, status, conclusion, scope, execution metadata, and source links in newest-first order; absent runs require a freshness and coverage check, and a successful run is not proof of accepted outcomes.","description":"Observed workflow runs ordered from newest to oldest.","from":"runs","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]}],"select":[{"field":"run"},{"field":"run-status"},{"field":"run-conclusion"},{"field":"repository-coordinate"},{"field":"workflow"},{"field":"rollout-mode"},{"field":"engine"},{"field":"engine-version"},{"field":"gh-aw-version"},{"field":"requested-model"},{"field":"resolved-model"},{"field":"started-at"},{"field":"repository-link"},{"field":"workflow-link"},{"field":"run-link"}],"order-by":[{"field":"started-at","direction":"desc"}]},{"name":"workflow-aic-per-run","subject":"List declared workflows with recorded positive AI Credit costs and their average cost per run.","objective":"Identify workflows with observed run AIC averages worth investigating alongside run evidence.","acceptance":"Include only declared workflows with at least one run attempt reporting positive AIC; exclude zero and missing telemetry from the average and ranking, without interpreting missing telemetry as free execution.","description":"Workflow AI Credit averages limited to run attempts with recorded positive AIC.","from":"workflows","joins":[{"source":"workflow-aic-run-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"runs","as":"observed-runs"},{"field":"aic-runs","as":"observed-aic-runs"},{"field":"aic","as":"observed-aic"}]}],"compute":[{"as":"repository-slug","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"workflow-identity","function":"concat","args":[{"field":"repository-slug"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-identity"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-display-name"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"field":"workflow-link"},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-identity"}]},{"as":"aic-per-run","function":"quotient","args":[{"field":"observed-aic"},{"field":"observed-aic-runs"}]}],"filter":{"predicates":[{"field":"observed-aic-runs","gte":1}]},"select":[{"field":"workflow-identity","as":"workflow-label"},{"field":"workflow-dashboard-link","as":"workflow-link"},{"field":"aic-per-run"}],"order-by":[{"field":"aic-per-run","direction":"desc"}],"limit":10},{"name":"dashboard-ingestion-health","subject":"Expose the current collection state for the global ingestion indicator.","objective":"Distinguish reported ingestion failure or recovery from the age of retained workflow evidence.","acceptance":"Use the authorized server collection-health classification, not cumulative failures or browser refresh time. Missing or unauthorized health remains unknown and static dashboards do not request this source.","from":"collection-health","select":[{"field":"configured"},{"field":"health"}],"limit":1},{"name":"dashboard-data-freshness","subject":"Find the newest workflow activity timestamp in retained canonical data.","objective":"Warn globally when the ingested workflow evidence has not advanced for 24 hours.","acceptance":"Use upstream updated-at, falling back to created-at, never browser import or refresh time. Missing or invalid timestamps remain unknown; inactivity alone does not prove an ingestion failure.","from":"runs","compute":[{"as":"data-at","function":"coalesce","args":[{"field":"updated-at"},{"field":"created-at"}]},{"as":"data-at-ms","function":"timestamp","args":[{"field":"data-at"}]}],"aggregate":{"values":[{"field":"data-at-ms","as":"latest-data-at","reducer":"max"}]}},{"name":"indexing-shards","subject":"List retained Activity shard import receipts.","objective":"Inspect which shards were ingested, when, and how many records they committed.","acceptance":"Show shard scope, phase, import status, import timestamp, counts and payload identity from retained receipts. Import time is not upstream freshness and missing receipts do not prove complete coverage.","from":"transactions","filter":{"predicates":[{"field":"kind","in":["ingest-normalized-jsonl","ingest-jsonl","ingest-jsonl-failed","runs","records"]}]},"select":[{"field":"id"},{"field":"payloadScope","as":"shard"},{"field":"kind"},{"field":"activity-status","as":"status"},{"field":"createdAt","as":"ingested-at"},{"field":"committedRecords","as":"committed-records"},{"field":"rawRuns","as":"workflow-runs"},{"field":"payloadHash","as":"payload-hash"}],"order-by":[{"field":"ingested-at","direction":"desc"}]},{"name":"ingestion-queued","subject":"Label the shared collection task queue depth for the administrator queue chart.","objective":"Identify total ready and scheduled collection work, including backfill tasks.","acceptance":"Show the observed shared queue depth only when collection is configured; missing or unauthorized health data is not zero pending work.","from":"collection-health","filter":{"predicates":[{"field":"configured","equals":true}]},"compute":[{"as":"queue","function":"coalesce","args":[{"value":"Ready and scheduled"},{"value":"Ready and scheduled"}]}],"select":[{"field":"queue"},{"field":"queue-depth","as":"tasks"}]},{"name":"ingestion-inflight","subject":"Label current in-flight collection tasks for the administrator queue chart.","objective":"Distinguish leased collection tasks from work awaiting collection.","acceptance":"Show the observed pending task count only when collection is configured; do not infer a count from an unavailable source.","from":"collection-health","filter":{"predicates":[{"field":"configured","equals":true}]},"compute":[{"as":"queue","function":"coalesce","args":[{"value":"In flight"},{"value":"In flight"}]}],"select":[{"field":"queue"},{"field":"pending-tasks","as":"tasks"}]},{"name":"ingestion-backfill","subject":"Label cumulative backfill run admissions for the administrator ingestion chart.","objective":"Compare historically admitted run tasks with current outstanding work without treating admissions as a live backlog.","acceptance":"Show the cumulative run task admissions only when collection is configured; this value does not decrease as tasks complete and missing health data does not imply completed backfill.","from":"collection-health","filter":{"predicates":[{"field":"configured","equals":true}]},"compute":[{"as":"queue","function":"coalesce","args":[{"value":"Backfill admitted (total)"},{"value":"Backfill admitted (total)"}]}],"select":[{"field":"queue"},{"field":"backfill-queued-run-tasks","as":"tasks"}]},{"name":"ingestion-queue-sizes","subject":"Compare current shared queue pressure, in-flight tasks, and cumulative historical backfill admissions from the administrator-only server snapshot.","objective":"Spot a growing backlog without treating past backfill admissions as outstanding work.","acceptance":"Current queue sizes and cumulative admissions come only from an authorized collection-health snapshot; unavailable state is not zero.","from":"ingestion-queued","union":["ingestion-inflight","ingestion-backfill"],"select":[{"field":"queue"},{"field":"tasks"}]},{"name":"ingestion-webhook-status","subject":"Inspect live webhook delivery counters for the current server process.","objective":"Distinguish signature validation, acknowledgements, rejections and failures without polling GitHub.","acceptance":"Show only authorized process-local counters, including in-flight requests, duplicate acknowledgements and signed pings. Counters reset on restart, are not replica totals, and do not establish GitHub-side webhook registration or completed collection. Refresh the active subscription even without canonical data changes.","from":"webhook-status","compute":[{"as":"configuration","function":"if","args":[{"field":"configured"},{"value":"Configured"},{"value":"Not configured"}]}],"limit":1},{"name":"ingestion-health","subject":"Show the current Redis-backed webhook and collection health snapshot.","objective":"Determine whether the reported collection, webhook, queue, and backfill state warrants inspecting ingestion diagnostics.","acceptance":"Report the observed health, queue, failure, success, and projection timestamps together; verify freshness and configuration before calling collection healthy, and treat missing state as unknown rather than zero.","from":"collection-health","select":[{"field":"configured"},{"field":"health"},{"field":"queue-depth"},{"field":"pending-tasks"},{"field":"dead-letters"},{"field":"oldest-pending-age"},{"field":"backfill"},{"field":"backfill-failures"},{"field":"backfill-queued-run-tasks"},{"field":"webhook-load"},{"field":"collection-load"},{"field":"failure-load"},{"field":"last-projected"},{"field":"last-webhook-at"},{"field":"last-failure-at"},{"field":"last-failure-code"},{"field":"last-success-at"},{"field":"webhook-received"},{"field":"webhook-duplicate"},{"field":"webhook-admission-failed"},{"field":"task-queued"},{"field":"task-coalesced"},{"field":"collection-succeeded"},{"field":"collection-failed"},{"field":"collection-retried"},{"field":"collection-dead-lettered"}]},{"name":"github-api-usage","subject":"Show retained GitHub API quota usage per bucket and in aggregate over the last 24 hours.","objective":"Determine whether any GitHub App installation or the CAO fleet as a whole is approaching its GitHub API rate limit.","acceptance":"Report peak usage percentages with their limits, used, and reserved counts; treat a slot without observations as unknown rather than idle, and never infer credentials from bucket identity.","from":"github-quota-usage","select":[{"field":"observed-at"},{"field":"scope"},{"field":"bucket"},{"field":"app"},{"field":"installation"},{"field":"resource"},{"field":"buckets"},{"field":"limit"},{"field":"used"},{"field":"reserved"},{"field":"usage-percent"}]},{"name":"marketplace-directory","subject":"Browse packages from configured marketplace registries.","objective":"Present a stable alphabetical directory that can be loaded in bounded pages.","acceptance":"Preserve resolver-produced provenance and package metadata. Order by package name and immutable source so continuation pages neither skip nor duplicate entries; discovery grants no installation authority.","from":"marketplace-packages","order-by":[{"field":"package-name","direction":"asc"},{"field":"package-source","direction":"asc"}]},{"name":"marketplace-package-detail","subject":"Expose normalized marketplace package records for source-coordinate lookup by the detail view.","objective":"Locate the resolver-produced package record for a source coordinate supplied by the consuming view.","acceptance":"Use the returned package-source, registry, ref, and resolved-commit fields when inspecting a matching record; the query itself does not filter by coordinate, and an absent match is not proof of package nonexistence or approval.","from":"marketplace-packages"},{"name":"friction-by-workflow","subject":"Rank workflows by observed gh-aw audit friction AI Credit totals for investigation.","objective":"Identify which repository and workflow combinations have the largest measured friction totals in retained observations.","acceptance":"Compare friction-aic and distinct runs with the underlying measurement states and attribution evidence; do not equate a ranking with avoidable cost or a validated saving.","description":"Total gh-aw audit friction cost grouped by repository and workflow.","from":"friction","compute":[{"as":"positive-aic","function":"greater-than","args":[{"field":"aic"},{"value":0}]},{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}],"aggregate":{"by":["workflow-coordinate","repository-coordinate","workflow"],"values":[{"field":"aic","as":"friction-aic","reducer":"sum","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"run","as":"runs","reducer":"distinct-count"}]},"order-by":[{"field":"friction-aic","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}]},{"name":"friction-observations","subject":"List retained gh-aw audit friction measurements with their run context and attribution totals.","objective":"Trace each reported friction measurement to a run and distinguish counted, suppressed, and unattributed occurrences.","acceptance":"Preserve native AIC, total-run AIC, measurement state, timestamps, links, and occurrence counts; missing or unattributed evidence remains uncertain, not a verified opportunity for savings.","description":"Newest friction measurements first, preserving the native audit values and uncertainty state.","from":"friction","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"friction-percent","function":"format-percent","args":[{"field":"friction-ratio"}]}],"select":[{"field":"event-timestamp","as":"observed-at"},{"field":"repository-coordinate"},{"field":"workflow"},{"field":"run"},{"field":"run-link"},{"field":"measurement-state"},{"field":"aic"},{"field":"total-run-aic"},{"field":"friction-percent"},{"field":"counted-occurrences"},{"field":"suppressed-occurrences"},{"field":"unattributed-occurrences"}],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"run","direction":"desc"}]},{"name":"indexing-shard-dates","subject":"Read the activity date encoded in each retained transaction's shard filename.","objective":"Separate source shard dates from ingestion timestamps.","acceptance":"Keep every transaction and leave absent, invalid, or structural shard dates unknown; never substitute import time.","from":"transactions","compute":[{"as":"shard-day","function":"activity-shard-day","args":[{"field":"payloadScope"}]},{"as":"missing-shard-day","function":"equals-any","args":[{"field":"shard-day"},{"value":null}]}]},{"name":"indexing-ingestion-runs","subject":"Show retained ingestion transactions at the activity date encoded in their shard filename.","objective":"Compare reported run counts by source shard activity date, independently of import time.","acceptance":"Preserve every dated transaction, including coincident dates, all kinds, and zero counts, without grouping, limits, or page filters. Omit missing or invalid shard dates; never substitute import time. Missing counts use labeled zero-position placeholders, not measured zeroes.","from":"indexing-shard-dates","filter":{"predicates":[{"field":"missing-shard-day","equals":false}]},"compute":[{"as":"workflow-runs","function":"coalesce","args":[{"field":"rawRuns"},{"value":0}]},{"as":"missing-run-count","function":"equals-any","args":[{"field":"rawRuns"},{"value":null}]},{"as":"run-count-status","function":"if","args":[{"field":"missing-run-count"},{"value":"Run count unavailable (shown at 0)"},{"value":"Reported run count"}]}],"select":[{"field":"id"},{"field":"kind"},{"field":"createdAt"},{"field":"shard-day"},{"field":"rawRuns"},{"field":"workflow-runs"},{"field":"run-count-status"}],"order-by":[{"field":"shard-day","direction":"asc"},{"field":"id","direction":"asc"}]},{"name":"indexing-daily-run-counts","subject":"Inspect admitted daily logical Run counts independently of retained detail and shard receipts.","objective":"Make the daily run-count projection visible as an ingestion diagnostic.","acceptance":"Sum daily buckets by observed UTC execution-start day across repositories and workflows, without page filters, detail fallback, fabricated days or zero populations. Preserve aggregate coverage and partial or unavailable evidence; counts do not prove upstream completeness.","from":"daily-run-counts","aggregate":{"by":["day"],"values":[{"field":"total","as":"runs","reducer":"sum"}]},"select":[{"field":"day","as":"date"},{"field":"runs"}],"order-by":[{"field":"date","direction":"asc"}]},{"name":"indexing-campaigns-table-count","subject":"Count retained campaigns rows in the dashboard database.","objective":"Provide the retained campaigns row count for the table-count diagnostic.","acceptance":"Label the result campaigns and count campaign rows in the current database; absence or zero does not establish completeness or expected campaign coverage.","from":"campaigns","compute":[{"as":"table","function":"literal","args":[{"value":"campaigns"}]}],"aggregate":{"by":["table"],"values":[{"field":"campaign","as":"records","reducer":"count"}]}},{"name":"indexing-repositories-table-count","subject":"Count retained repositories rows in the dashboard database.","objective":"Provide the retained repositories row count for the table-count diagnostic.","acceptance":"Label the result repositories and count repository rows in the current database; absence or zero does not establish completeness or expected repository coverage.","from":"repositories","compute":[{"as":"table","function":"literal","args":[{"value":"repositories"}]}],"aggregate":{"by":["table"],"values":[{"field":"repository","as":"records","reducer":"count"}]}},{"name":"indexing-workflows-table-count","subject":"Count retained workflows rows in the dashboard database.","objective":"Provide the retained workflows row count for the table-count diagnostic.","acceptance":"Label the result workflows and count workflow rows in the current database; absence or zero does not establish completeness or expected workflow coverage.","from":"workflows","compute":[{"as":"table","function":"literal","args":[{"value":"workflows"}]}],"aggregate":{"by":["table"],"values":[{"field":"workflow","as":"records","reducer":"count"}]}},{"name":"indexing-runs-table-count","subject":"Count retained workflow runs rows in the dashboard database.","objective":"Provide the retained workflow runs row count for the table-count diagnostic.","acceptance":"Label the result workflow runs and count run rows in the current database; absence or zero does not establish completeness or expected execution volume.","from":"runs","compute":[{"as":"table","function":"literal","args":[{"value":"runs"}]}],"aggregate":{"by":["table"],"values":[{"field":"run","as":"records","reducer":"count"}]}},{"name":"indexing-domains-table-count","subject":"Count retained network domains rows in the dashboard database.","objective":"Provide the retained network domains row count for the table-count diagnostic.","acceptance":"Label the result network domains and count domain event rows in the current database; absence or zero does not prove no network activity.","from":"domains","compute":[{"as":"table","function":"literal","args":[{"value":"domains"}]}],"aggregate":{"by":["table"],"values":[{"field":"event","as":"records","reducer":"count"}]}},{"name":"indexing-tools-table-count","subject":"Count retained tool events rows in the dashboard database.","objective":"Provide the retained tool events row count for the table-count diagnostic.","acceptance":"Label the result tool events and count tool event rows in the current database; absence or zero does not prove no tool use.","from":"tools","compute":[{"as":"table","function":"literal","args":[{"value":"tools"}]}],"aggregate":{"by":["table"],"values":[{"field":"table","as":"records","reducer":"count"}]}},{"name":"indexing-audits-table-count","subject":"Count retained audit events rows in the dashboard database.","objective":"Provide the retained audit events row count for the table-count diagnostic.","acceptance":"Label the result audit events and count audit event rows in the current database; absence or zero does not prove no audit findings.","from":"audits","compute":[{"as":"table","function":"literal","args":[{"value":"audits"}]}],"aggregate":{"by":["table"],"values":[{"field":"event","as":"records","reducer":"count"}]}},{"name":"indexing-issues-table-count","subject":"Count retained issue events rows in the dashboard database.","objective":"Provide the retained issue events row count for the table-count diagnostic.","acceptance":"Label the result issue events and count issue event rows in the current database; absence or zero does not prove no issues exist.","from":"issues","compute":[{"as":"table","function":"literal","args":[{"value":"issues"}]}],"aggregate":{"by":["table"],"values":[{"field":"event","as":"records","reducer":"count"}]}},{"name":"indexing-operational-values-table-count","subject":"Count retained operational values rows in the dashboard database.","objective":"Provide the retained operational values row count for the table-count diagnostic.","acceptance":"Label the result operational values and count operational-value rows in the current database; absence or zero does not imply zero value or an evaluated outcome.","from":"operational-values","compute":[{"as":"table","function":"literal","args":[{"value":"operationalValues"}]}],"aggregate":{"by":["table"],"values":[{"field":"operational-value","as":"records","reducer":"count"}]}},{"name":"indexing-transactions-table-count","subject":"Count retained ingestion transactions rows in the dashboard database.","objective":"Provide the retained ingestion transactions row count for the table-count diagnostic.","acceptance":"Label the result ingestion transactions and count transaction IDs in the current database; absence or zero does not establish whether upstream ingestion ran.","from":"transactions","compute":[{"as":"table","function":"literal","args":[{"value":"transactions"}]}],"aggregate":{"by":["table"],"values":[{"field":"id","as":"records","reducer":"count"}]}},{"name":"indexing-database-table-counts","subject":"Count retained canonical dashboard database rows by table.","objective":"Compare the retained table row counts to identify tables needing further ingestion or coverage investigation.","acceptance":"Union the named table-count projections and report their table labels and counts; check source availability, retention, and separate transaction evidence before interpreting an empty or small table as an ingestion defect.","from":"indexing-campaigns-table-count","union":["indexing-repositories-table-count","indexing-workflows-table-count","indexing-runs-table-count","indexing-domains-table-count","indexing-tools-table-count","indexing-audits-table-count","indexing-issues-table-count","indexing-operational-values-table-count","indexing-transactions-table-count"],"order-by":[{"field":"records","direction":"desc"},{"field":"table","direction":"asc"}]},{"name":"indexing-transactions","subject":"Prepare retained ingestion transactions for card presentation.","objective":"Expose transaction identity, kind, timestamp, committed-record count, and payload hash for ingestion traceability.","acceptance":"Projected fields match retained transactions without implying successful upstream coverage from a committed count or hash alone; missing transactions require a freshness and availability check.","from":"transactions","select":[{"field":"id"},{"field":"kind"},{"field":"createdAt","as":"created-at"},{"field":"committedRecords","as":"committed-records"},{"field":"payloadHash","as":"payload-hash"}]},{"name":"engines-models-sample-distribution","subject":"Describe agent and model combinations in the seven-day statistical run sample.","objective":"Find sampled combinations to investigate without scanning the full retained run history.","acceptance":"Count unweighted selected Runs after frame selection. Keep statistical-frame-id in grouped rows and frame metadata on empty results. Zero-allocation strata are not population zeros. Preserve unknown identifiers; failure reserves can alter composition. Never mix sample counts with exact usage or infer population shares.","description":"Unweighted composition of the seven-day statistical sample; not a population estimate. Failure outcomes may be oversampled.","from":"statistical-runs","compute":[{"as":"summary","function":"concat","args":[{"field":"agent-id"},{"value":" / "},{"field":"model-id"}]}],"aggregate":{"by":["summary","statistical-frame-id"],"values":[{"field":"run","as":"sampled-runs","reducer":"count"}]},"order-by":[{"field":"sampled-runs","direction":"desc"},{"field":"summary","direction":"asc"}]},{"name":"engines-models-usage","subject":"Summarize run-level AIC and token usage by agent and model identifiers without treating unavailable telemetry as zero.","objective":"Locate agent and model combinations whose observed per-run AIC or token usage merits checking against individual runs.","acceptance":"Report run counts and native minimum, mean, and maximum values only for reported metrics; inspect underlying runs for per-metric telemetry coverage and context before comparing combinations, and infer neither efficiency nor outcome value from usage alone.","description":"Observed workflow runs grouped by agent ID and model ID. AIC statistics use only positive-AIC runs; token statistics use runs that reported each token metric.","from":"runs","compute":[{"as":"summary","function":"concat","args":[{"field":"agent-id"},{"value":" / "},{"field":"model-id"}]},{"as":"positive-aic","function":"greater-than","args":[{"field":"aic-total"},{"value":0}]}],"aggregate":{"by":["summary"],"values":[{"field":"run","as":"runs","reducer":"count"},{"field":"aic-total","as":"minimum-aic-per-run","reducer":"min","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"aic-total","as":"average-aic-per-run","reducer":"mean","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"aic-total","as":"maximum-aic-per-run","reducer":"max","filter":{"predicates":[{"field":"positive-aic","equals":true}]}},{"field":"input-tokens","as":"minimum-input-tokens-per-run","reducer":"min"},{"field":"input-tokens","as":"average-input-tokens-per-run","reducer":"mean"},{"field":"input-tokens","as":"maximum-input-tokens-per-run","reducer":"max"},{"field":"output-tokens","as":"minimum-output-tokens-per-run","reducer":"min"},{"field":"output-tokens","as":"average-output-tokens-per-run","reducer":"mean"},{"field":"output-tokens","as":"maximum-output-tokens-per-run","reducer":"max"},{"field":"cache-read-tokens","as":"minimum-cache-read-tokens-per-run","reducer":"min"},{"field":"cache-read-tokens","as":"average-cache-read-tokens-per-run","reducer":"mean"},{"field":"cache-read-tokens","as":"maximum-cache-read-tokens-per-run","reducer":"max"},{"field":"cache-write-tokens","as":"minimum-cache-write-tokens-per-run","reducer":"min"},{"field":"cache-write-tokens","as":"average-cache-write-tokens-per-run","reducer":"mean"},{"field":"cache-write-tokens","as":"maximum-cache-write-tokens-per-run","reducer":"max"},{"field":"reasoning-tokens","as":"minimum-reasoning-tokens-per-run","reducer":"min"},{"field":"reasoning-tokens","as":"average-reasoning-tokens-per-run","reducer":"mean"},{"field":"reasoning-tokens","as":"maximum-reasoning-tokens-per-run","reducer":"max"}]},"select":[{"field":"summary"},{"field":"runs"},{"field":"average-aic-per-run"},{"field":"minimum-aic-per-run"},{"field":"maximum-aic-per-run"},{"field":"minimum-input-tokens-per-run"},{"field":"average-input-tokens-per-run"},{"field":"maximum-input-tokens-per-run"},{"field":"minimum-output-tokens-per-run"},{"field":"average-output-tokens-per-run"},{"field":"maximum-output-tokens-per-run"},{"field":"minimum-cache-read-tokens-per-run"},{"field":"average-cache-read-tokens-per-run"},{"field":"maximum-cache-read-tokens-per-run"},{"field":"minimum-cache-write-tokens-per-run"},{"field":"average-cache-write-tokens-per-run"},{"field":"maximum-cache-write-tokens-per-run"},{"field":"minimum-reasoning-tokens-per-run"},{"field":"average-reasoning-tokens-per-run"},{"field":"maximum-reasoning-tokens-per-run"}],"order-by":[{"field":"runs","direction":"desc"},{"field":"summary","direction":"asc"}]},{"name":"skill-invocations","subject":"Select observed skill invocations for skill usage analytics.","objective":"Expose skill event identity, scope, invocation counts, and failed counts for downstream usage analysis.","acceptance":"Keep each observed event and its repository/workflow attribution with native counts; missing records or failed counts alone do not establish whether a skill was useful or available.","from":"skills","select":[{"field":"event","as":"id"},{"field":"name","as":"skill"},{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"invocation-count"},{"field":"failed-count"}]},{"name":"skill-invocations-by-skill","subject":"Rank skills by their observed invocation count.","objective":"Identify skills with the highest observed invocation totals for follow-up inspection.","acceptance":"Sum observed invocation counts by skill and retain the rank as a usage description; do not equate popularity with effectiveness or infer unobserved invocations.","from":"skill-invocations","aggregate":{"by":["skill"],"values":[{"field":"invocation-count","as":"invocations","reducer":"sum"}]},"order-by":[{"field":"invocations","direction":"desc"},{"field":"skill","direction":"asc"}]},{"name":"skill-invocations-by-workflow-totals","subject":"Rank workflows by their observed skill invocation count.","objective":"Produce repository-scoped workflow invocation totals for downstream skill-usage comparison.","acceptance":"Sum observed invocation counts by organization, repository, and workflow; totals describe recorded usage only, not success or expected adoption.","from":"skill-invocations","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"invocation-count","as":"invocations","reducer":"sum"}]}},{"name":"skill-invocations-by-workflow","subject":"Present workflow skill invocation totals with drill-through navigation to the workflow dashboard.","objective":"Expose observed workflow skill invocation totals with a link to inspect each workflow.","acceptance":"Each projected workflow coordinate, link, and invocation total traces to the grouped source; using a link to investigate does not establish that usage caused an outcome.","from":"skill-invocations-by-workflow-totals","compute":[{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-coordinate"}]}],"select":[{"field":"workflow-coordinate"},{"field":"workflow-link"},{"field":"invocations"}],"order-by":[{"field":"invocations","direction":"desc"},{"field":"workflow-coordinate","direction":"asc"}]},{"name":"skill-workflow-totals","subject":"Count observed invocations for each skill and workflow.","objective":"Produce skill-by-workflow invocation totals for the downstream inventory.","acceptance":"Sum observed invocation counts by skill, organization, repository, and workflow; missing combinations are not evidence that a skill could not run.","from":"skill-invocations","aggregate":{"by":["skill","organization","repository","workflow"],"values":[{"field":"invocation-count","as":"invocations","reducer":"sum"}]}},{"name":"skill-workflow-inventory","subject":"List observed skills by workflow with drill-through navigation to the workflow dashboard.","objective":"Identify observed skill/workflow combinations and provide a workflow link for inspecting their runs.","acceptance":"Show the repository, workflow, skill, link, and observed invocation total from the grouped evidence; an absent row does not prove non-use, and a high count does not prove effectiveness.","from":"skill-workflow-totals","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-coordinate"}]}],"select":[{"field":"skill"},{"field":"repository-coordinate"},{"field":"workflow"},{"field":"workflow-link"},{"field":"invocations"}],"order-by":[{"field":"invocations","direction":"desc"},{"field":"skill","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"experiment-assignment-coverage","subject":"Count observed run assignments for each experiment and workflow without inferring a completion target.","objective":"Expose assignment counts by experiment and workflow for investigating observed experiment coverage.","acceptance":"Count retained assignment rows in each experiment/workflow group, not distinct runs; do not invent a target, infer missing assignments from absent groups, or treat assignments as eval or grader outcomes.","from":"experiment-assignments","compute":[{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}],"aggregate":{"by":["workflow-coordinate","experiment"],"values":[{"field":"run","as":"assignments","reducer":"count"}]}},{"name":"eval-status-ledger","subject":"Inspect every explicitly classified eval answer, including UNKNOWN.","objective":"Expose retained eval observations with their workflow, run evidence and observation time.","acceptance":"Keep recorded YES, NO and UNKNOWN answers distinct; unknown or absent evidence must not imply success or failure, and historical answers are not current verdicts or validated operational outcomes.","from":"eval-observations","compute":[{"as":"_recorded-run-href","function":"link-href","args":[{"field":"evidence-link"}]},{"as":"_eval-run-href","function":"coalesce","args":[{"field":"_recorded-run-href"},{"field":"evidence-link"}]},{"as":"run-link","function":"link","args":[{"field":"_eval-run-href"},{"field":"run"}]}],"filter":{"predicates":[{"field":"eval-result","in":["YES","NO","UNKNOWN"]}]}},{"name":"eval-answer-counts","subject":"Count recorded YES, NO and UNKNOWN answers for each workflow-scoped eval.","objective":"Provide complete answer denominators before expanding each eval into three bars.","acceptance":"Keep canonical eval identities separate and count only explicitly classified observations. Select at most 33 complete eval groups, never truncate an answer group.","from":"eval-status-ledger","aggregate":{"by":["organization","repository","workflow","eval"],"values":[{"field":"eval-result","as":"answers","reducer":"count"},{"field":"eval-result","as":"yes","reducer":"count","filter":{"predicates":[{"field":"eval-result","equals":"YES"}]}},{"field":"eval-result","as":"no","reducer":"count","filter":{"predicates":[{"field":"eval-result","equals":"NO"}]}},{"field":"eval-result","as":"unknown","reducer":"count","filter":{"predicates":[{"field":"eval-result","equals":"UNKNOWN"}]}}]},"order-by":[{"field":"eval","direction":"asc"},{"field":"organization","direction":"asc"},{"field":"repository","direction":"asc"},{"field":"workflow","direction":"asc"}],"limit":33},{"name":"eval-yes-shares","subject":"Compute the YES share of each eval's recorded answers.","objective":"Expose recorded YES proportions for comparing answer categories without inferring verified operational outcomes.","acceptance":"Emit one YES row per retained canonical eval group, including zero YES counts; answer-share is yes / answers across recorded YES, NO and UNKNOWN observations. Do not count absent observations.","from":"eval-answer-counts","compute":[{"as":"eval-result","function":"literal","args":[{"value":"YES"}]},{"as":"answer-order","function":"literal","args":[{"value":0}]},{"as":"answer-share","function":"quotient","args":[{"field":"yes"},{"field":"answers"}]}]},{"name":"eval-no-shares","subject":"Compute the NO share of each eval's recorded answers.","objective":"Expose recorded NO proportions for comparing answer categories without treating historical answers as current verdicts.","acceptance":"Emit one NO row per retained canonical eval group, including zero NO counts; answer-share is no / answers across recorded YES, NO and UNKNOWN observations. Do not count absent observations.","from":"eval-answer-counts","compute":[{"as":"eval-result","function":"literal","args":[{"value":"NO"}]},{"as":"answer-order","function":"literal","args":[{"value":1}]},{"as":"answer-share","function":"quotient","args":[{"field":"no"},{"field":"answers"}]}]},{"name":"eval-unknown-shares","subject":"Compute the explicit UNKNOWN share of each eval's recorded answers.","objective":"Expose explicitly recorded UNKNOWN proportions without conflating absent observations with classified uncertainty.","acceptance":"Emit one UNKNOWN row per retained canonical eval group, including zero UNKNOWN counts; answer-share is unknown / answers across recorded YES, NO and UNKNOWN observations. Missing observations are not UNKNOWN answers.","from":"eval-answer-counts","compute":[{"as":"eval-result","function":"literal","args":[{"value":"UNKNOWN"}]},{"as":"answer-order","function":"literal","args":[{"value":2}]},{"as":"answer-share","function":"quotient","args":[{"field":"unknown"},{"field":"answers"}]}]},{"name":"eval-answer-distribution","subject":"Compare YES, NO and UNKNOWN percentages within each eval.","objective":"Show three horizontal bars per eval that together account for all recorded answers.","acceptance":"Emit all three answer categories, including zero shares; percentages sum to 100 per canonical eval. Missing observations are not UNKNOWN answers. Preserve workflow and repository attribution.","from":"eval-yes-shares","union":["eval-no-shares","eval-unknown-shares"],"compute":[{"as":"answer-percent","function":"product","args":[{"field":"answer-share"},{"value":100}]},{"as":"eval-label","function":"concat","args":[{"field":"eval"},{"value":" | "},{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]}],"order-by":[{"field":"eval-label","direction":"asc"},{"field":"answer-order","direction":"asc"}]},{"name":"grader-observed-maxima","subject":"Find each workflow-scoped grader's maximum retained value in the selected data.","objective":"Provide an observed normalization denominator without mixing grader identities or claiming a theoretical maximum.","acceptance":"Group by canonical grader identity, not display name; ignore missing values and preserve zero or negative maxima without substituting a denominator.","from":"grader-observations","aggregate":{"by":["grader-id"],"values":[{"field":"value","as":"max-grader-value","reducer":"max"}]}},{"name":"grader-normalized-observations","subject":"Normalize each grader observation by that grader's observed maximum.","objective":"Compare relative grader values over time while preserving native measurements and run provenance.","acceptance":"Compute value / max-grader-value without clamping or inverting lower-is-better measures; zero or missing denominators produce null, never a fabricated zero or infinity.","from":"grader-observations","joins":[{"source":"grader-observed-maxima","type":"left","on":[{"left":"grader-id","right":"grader-id"}],"fields":[{"field":"max-grader-value","as":"max-grader-value"}]}],"compute":[{"as":"normalized-value","function":"quotient","args":[{"field":"value"},{"field":"max-grader-value"}]},{"as":"_observation-time","function":"timestamp","args":[{"field":"observed-at"}]},{"as":"_unplottable-value","function":"equals-any","args":[{"field":"normalized-value"},{"value":null}]},{"as":"_unplottable-time","function":"equals-any","args":[{"field":"_observation-time"},{"value":null}]},{"as":"grader-series","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":" / "},{"field":"workflow"},{"value":" / "},{"field":"grader"}]}]},{"name":"grader-value-scatter","subject":"Plot timed grader observations with a defined value-to-observed-maximum ratio.","objective":"Show relative grader measurements at their recorded observation times.","acceptance":"Keep each eligible observation and its run link; omit missing ratios or observation times from the plot while retaining those records in the native-value ledger. Ratios are not eval answers or evidence of improvement.","from":"grader-normalized-observations","filter":{"predicates":[{"field":"_unplottable-value","equals":false},{"field":"_unplottable-time","equals":false}]},"order-by":[{"field":"observed-at","direction":"asc"}]},{"name":"grader-status-ledger","subject":"Report grader measurements, units and explicit statuses without confusing them with binary eval answers.","objective":"Preserve numeric grader evidence and distinguish explicit per-observation pass and fail verdicts from unknown statuses.","acceptance":"Retain native grader values, units and statuses. Map only pass/passed to YES and fail/failed to NO in the auxiliary verdict field, leaving all other statuses unknown; never infer an eval answer, current success, causation or policy authority from a grader score.","from":"grader-observations","compute":[{"as":"is-pass","function":"equals-any","args":[{"field":"status"},{"value":"pass"},{"value":"passed"}]},{"as":"is-fail","function":"equals-any","args":[{"field":"status"},{"value":"fail"},{"value":"failed"}]},{"as":"non-pass-verdict","function":"if","args":[{"field":"is-fail"},{"value":"NO"},{"value":"unknown"}]},{"as":"verdict","function":"if","args":[{"field":"is-pass"},{"value":"YES"},{"field":"non-pass-verdict"}]}]},{"name":"routing-session-observations","subject":"Read metadata-only unified-session routing evidence.","objective":"Keep routing analytics independent of native logs and inferred run totals.","acceptance":"Only recognized session events contribute; event clocks remain absent when unrecorded.","from":"audits","filter":{"predicates":[{"field":"event-type","in":["session.format","workflow.info","workflow.job_result","agent.execution","firewall.model_routing","firewall.token_usage","usage.report","firewall.steering","firewall.upstream_error","model.config","model.baseline_estimate","model.resolution","model_routing.outcome","model_endpoint.mismatch","session.collection","session.collection_warning","subagent.request","subagent.started","subagent.configured","subagent.completed","subagent.failed","subagent.model_unavailable"]}]},"compute":[{"as":"record-clock","function":"timestamp","args":[{"field":"event-timestamp"}]},{"as":"event-clock","function":"coalesce","args":[{"field":"routing-session-clock"},{"field":"record-clock"}]},{"as":"routing-run-key","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"run"}]},{"as":"agent-phase","function":"equals-any","args":[{"field":"phase"},{"value":"agent"}]},{"as":"proxy-selection","function":"equals-any","args":[{"field":"routing-stage"},{"value":"selection"}]},{"as":"proxy-failure","function":"equals-any","args":[{"field":"routing-stage"},{"value":"failure"}]},{"as":"has-agent-name","function":"greater-than","args":[{"field":"routing-agent-name"},{"value":""}]}]},{"name":"routing-session-attempts","from":"routing-session-observations","subject":"Identify available session files and their earliest recorded clocks.","objective":"Keep rerun attempts from multiplying routing denominators.","acceptance":"Attempt order is only a tie-breaker after the recorded session clock.","aggregate":{"by":["routing-run-key","run-attempt"],"values":[{"field":"event-clock","as":"session-clock","reducer":"min"}]}},{"name":"routing-session-order","from":"routing-session-attempts","subject":"Order duplicate run sessions by run time and attempt.","objective":"Keep the latest file for each repository/run identity.","acceptance":"Only one attempt contributes to routing facts.","window":[{"operation":"row-number","field":"run-attempt","as":"session-position","groupby":["routing-run-key"],"order-by":[{"field":"session-clock","direction":"desc"},{"field":"run-attempt","direction":"desc"}]}]},{"name":"routing-latest-sessions","from":"routing-session-order","subject":"Retain one authoritative session attempt per run.","objective":"Avoid mixing picks or accounting from reruns.","acceptance":"Duplicate attempts remain available in session coverage.","filter":{"predicates":[{"field":"session-position","equals":1}]}},{"name":"routing-session-events","from":"routing-session-observations","subject":"Read routing metadata from the latest session file per run.","objective":"Deduplicate rerun attempts before any metric.","acceptance":"Earlier attempts never add cost or change the selected pick.","joins":[{"source":"routing-latest-sessions","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"run-attempt","right":"run-attempt"}],"fields":[{"field":"session-clock","as":"session-clock"}]}]},{"name":"routing-run-facts","subject":"Collect per-session source facts without interpreting absence as success.","objective":"Resolve routing states and coverage from runner and proxy evidence.","acceptance":"Agent-phase proxy selection wins over failure and harness status; untimed observations keep unknown time.","from":"routing-session-events","aggregate":{"by":["routing-run-key","organization","repository","workflow","run"],"values":[{"field":"event-clock","as":"run-clock","reducer":"min"},{"field":"run-link","as":"run-link","reducer":"unique"},{"field":"engine","as":"engine","reducer":"unique"},{"field":"event","as":"workflow-info-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"},{"field":"required","equals":true}]}},{"field":"event-status","as":"session-format","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"session.format"}]}},{"field":"event","as":"selection-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"selection"},{"field":"phase","equals":"agent"}]}},{"field":"event","as":"failure-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"failure"},{"field":"phase","equals":"agent"}]}},{"field":"event","as":"local-effort-failures","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"failure"},{"field":"code","equals":"unsupported_reasoning_effort"}]}},{"field":"event","as":"proxy-record-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"phase","equals":"agent"}]}},{"field":"event","as":"agent-accounting-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.token_usage"},{"field":"phase","equals":"agent"}]}},{"field":"event","as":"subagent-count","reducer":"count","filter":{"predicates":[{"field":"event-type","in":["subagent.started","subagent.request","subagent.configured","subagent.completed","subagent.failed","subagent.model_unavailable"]}]}},{"field":"routing-status","as":"harness-status","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-enabled","as":"configured-enabled","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"model.config"}]}},{"field":"routing-selected-model","as":"harness-model","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"telemetry-model","as":"workflow-model","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-selected-effort","as":"harness-effort","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-mode","as":"harness-mode","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-awf-version","as":"session-awf-version","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.info"}]}},{"field":"routing-goal","as":"configured-goal","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"model.config"}]}},{"field":"routing-configured-mode","as":"configured-routing-mode","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"model.config"}]}},{"field":"routing-max-credits","as":"configured-max-credits","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"model.config"}]}},{"field":"event-status","as":"agent-result","reducer":"unique","filter":{"predicates":[{"field":"event-type","equals":"workflow.job_result"},{"field":"name","equals":"agent"},{"field":"event-status","in":["success","failure","cancelled","skipped"]}]}},{"field":"event","as":"warnings","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"session.collection_warning"}]}}]}},{"name":"routing-ordered-selections","subject":"Order proxy selections within each session.","objective":"Use the last selection by normalized clock and file order.","acceptance":"Harness and advisory picks never override proxy selections.","from":"routing-session-events","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"selection"},{"field":"phase","equals":"agent"}]},"window":[{"operation":"row-number","field":"source-sequence","as":"selection-position","groupby":["routing-run-key"],"order-by":[{"field":"event-timestamp","direction":"desc"},{"field":"source-sequence","direction":"desc"}]}]},{"name":"routing-selections","subject":"Retain one authoritative proxy pick per run.","objective":"Avoid multiplying requests or run counts after re-selection.","acceptance":"One row per identified run uses the final proxy selection.","from":"routing-ordered-selections","filter":{"predicates":[{"field":"selection-position","equals":1}]}},{"name":"routing-resolved-runs","subject":"Resolve routing state, pick and label cells from unified sessions.","objective":"Distinguish selected, failed, harness-only, configured, inferred and unknown evidence.","acceptance":"Proxy evidence wins; configuration conflicts are visible; missing picks and time remain unknown.","from":"routing-run-facts","joins":[{"source":"routing-selections","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"routing-selected-model","as":"proxy-model"},{"field":"routing-selected-effort","as":"proxy-effort"},{"field":"routing-goal","as":"proxy-goal"},{"field":"routing-mode","as":"proxy-mode"},{"field":"routing-configured-mode","as":"proxy-configured-mode"},{"field":"routing-task-type","as":"routing-task-type"},{"field":"routing-scope","as":"routing-scope"},{"field":"routing-complexity","as":"routing-complexity"},{"field":"routing-latency-ms","as":"routing-latency-ms"},{"field":"routing-degraded","as":"routing-degraded"},{"field":"routing-classifier-attempts","as":"routing-classifier-attempts"},{"field":"routing-classifier-model","as":"routing-classifier-model"},{"field":"routing-classifier-effort","as":"routing-classifier-effort"},{"field":"routing-schema","as":"routing-schema"},{"field":"routing-awf-version","as":"proxy-awf-version"},{"field":"routing-router-version","as":"routing-router-version"}]}],"compute":[{"as":"observed-at","function":"iso-timestamp","args":[{"field":"run-clock"}]},{"as":"routing-awf-version","function":"coalesce","args":[{"field":"session-awf-version"},{"field":"proxy-awf-version"}]},{"as":"routing-mode","function":"coalesce","args":[{"field":"proxy-mode"},{"field":"harness-mode"}]},{"as":"routing-goal","function":"coalesce","args":[{"field":"proxy-goal"},{"field":"configured-goal"}]},{"as":"routing-configured-mode","function":"coalesce","args":[{"field":"proxy-configured-mode"},{"field":"configured-routing-mode"}]},{"as":"has-selection","function":"greater-than","args":[{"field":"selection-count"},{"value":0}]},{"as":"has-failure","function":"greater-than","args":[{"field":"failure-count"},{"value":0}]},{"as":"has-harness","function":"equals-any","args":[{"field":"harness-status"},{"value":null}]},{"as":"has-usage","function":"greater-than","args":[{"field":"agent-accounting-count"},{"value":0}]},{"as":"no-proxy","function":"equals-any","args":[{"field":"proxy-record-count"},{"value":0}]},{"as":"usage-state","function":"if","args":[{"field":"has-usage"},{"value":"unrouted_inferred"},{"value":"unknown"}]},{"as":"inferred-state","function":"if","args":[{"field":"no-proxy"},{"field":"usage-state"},{"value":"unknown"}]},{"as":"enabled","function":"equals-any","args":[{"field":"configured-enabled"},{"value":true}]},{"as":"disabled","function":"equals-any","args":[{"field":"configured-enabled"},{"value":false}]},{"as":"enabled-state","function":"if","args":[{"field":"enabled"},{"value":"configured_unrecorded"},{"field":"inferred-state"}]},{"as":"configured-state","function":"if","args":[{"field":"disabled"},{"value":"unrouted"},{"field":"enabled-state"}]},{"as":"reported-state","function":"if","args":[{"field":"has-harness"},{"field":"configured-state"},{"value":"harness_reported"}]},{"as":"failure-state","function":"if","args":[{"field":"has-failure"},{"value":"selection_failed"},{"field":"reported-state"}]},{"as":"routing-state","function":"if","args":[{"field":"has-selection"},{"value":"selected"},{"field":"failure-state"}]},{"as":"observed-pick-model","function":"if","args":[{"field":"has-selection"},{"field":"proxy-model"},{"field":"harness-model"}]},{"as":"observed-pick-effort","function":"if","args":[{"field":"has-selection"},{"field":"proxy-effort"},{"field":"harness-effort"}]},{"as":"pick-model","function":"coalesce","args":[{"field":"observed-pick-model"},{"value":"unknown"}]},{"as":"pick-effort","function":"coalesce","args":[{"field":"observed-pick-effort"},{"value":"unknown"}]},{"as":"pick","function":"concat","args":[{"field":"pick-model"},{"value":" / "},{"field":"pick-effort"}]},{"as":"has-proxy-decision","function":"if","args":[{"field":"has-selection"},{"value":true},{"field":"has-failure"}]},{"as":"has-decision","function":"if","args":[{"field":"has-harness"},{"field":"has-proxy-decision"},{"value":true}]},{"as":"configuration-conflict","function":"if","args":[{"field":"disabled"},{"field":"has-decision"},{"value":false}]},{"as":"unknown-pick-model","function":"equals-any","args":[{"field":"pick-model"},{"value":"unknown"}]},{"as":"unknown-pick-effort","function":"equals-any","args":[{"field":"pick-effort"},{"value":"unknown"}]},{"as":"unknown-pick","function":"if","args":[{"field":"unknown-pick-model"},{"value":true},{"field":"unknown-pick-effort"}]},{"as":"routing-key-encoded","function":"url-encode","args":[{"field":"routing-run-key"}]},{"as":"routing-href","function":"concat","args":[{"value":"#page-routing-run?routing-run="},{"field":"routing-key-encoded"}]},{"as":"routing-dashboard-link","function":"dashboard-link","args":[{"field":"run-link"},{"field":"routing-href"},{"field":"run"}]}],"filter":{"predicates":[{"field":"workflow-info-count","gte":1}]}},{"name":"routing-filter-candidates","from":"routing-aggregates","subject":"Apply one run-level scope before every routing metric and event join.","objective":"Filter complete sessions, never fragments of their evidence.","acceptance":"Unknown run time is excluded from a bounded range; blank filters retain all known values.","parameters":[{"name":"routing-filter-workflow","type":"string"},{"name":"routing-filter-repository","type":"string"},{"name":"routing-filter-engine","type":"string"},{"name":"routing-filter-state","type":"string"},{"name":"routing-filter-goal","type":"string"},{"name":"routing-filter-mode","type":"string"},{"name":"routing-filter-awf","type":"string"},{"name":"routing-filter-start","type":"string"},{"name":"routing-filter-end","type":"string"}],"compute":[{"as":"full-repository","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"all-workflows","function":"equals-any","args":[{"parameter":"routing-filter-workflow"},{"value":""}]},{"as":"same-workflow","function":"equals-any","args":[{"field":"workflow"},{"parameter":"routing-filter-workflow"}]},{"as":"include-workflow","function":"if","args":[{"field":"all-workflows"},{"value":true},{"field":"same-workflow"}]},{"as":"all-repositories","function":"equals-any","args":[{"parameter":"routing-filter-repository"},{"value":""}]},{"as":"same-repository","function":"equals-any","args":[{"field":"full-repository"},{"parameter":"routing-filter-repository"}]},{"as":"include-repository","function":"if","args":[{"field":"all-repositories"},{"value":true},{"field":"same-repository"}]},{"as":"all-engines","function":"equals-any","args":[{"parameter":"routing-filter-engine"},{"value":""}]},{"as":"same-engine","function":"equals-any","args":[{"field":"engine"},{"parameter":"routing-filter-engine"}]},{"as":"include-engine","function":"if","args":[{"field":"all-engines"},{"value":true},{"field":"same-engine"}]},{"as":"all-states","function":"equals-any","args":[{"parameter":"routing-filter-state"},{"value":""}]},{"as":"same-state","function":"equals-any","args":[{"field":"routing-state"},{"parameter":"routing-filter-state"}]},{"as":"include-state","function":"if","args":[{"field":"all-states"},{"value":true},{"field":"same-state"}]},{"as":"all-goals","function":"equals-any","args":[{"parameter":"routing-filter-goal"},{"value":""}]},{"as":"same-goal","function":"equals-any","args":[{"field":"routing-goal"},{"parameter":"routing-filter-goal"}]},{"as":"include-goal","function":"if","args":[{"field":"all-goals"},{"value":true},{"field":"same-goal"}]},{"as":"all-modes","function":"equals-any","args":[{"parameter":"routing-filter-mode"},{"value":""}]},{"as":"same-mode","function":"equals-any","args":[{"field":"routing-mode"},{"parameter":"routing-filter-mode"}]},{"as":"include-mode","function":"if","args":[{"field":"all-modes"},{"value":true},{"field":"same-mode"}]},{"as":"all-awf","function":"equals-any","args":[{"parameter":"routing-filter-awf"},{"value":""}]},{"as":"same-awf","function":"equals-any","args":[{"field":"routing-awf-version"},{"parameter":"routing-filter-awf"}]},{"as":"include-awf","function":"if","args":[{"field":"all-awf"},{"value":true},{"field":"same-awf"}]},{"as":"all-starts","function":"equals-any","args":[{"parameter":"routing-filter-start"},{"value":""}]},{"as":"start-clock","function":"timestamp","args":[{"parameter":"routing-filter-start"}]},{"as":"start-before","function":"difference","args":[{"field":"start-clock"},{"value":1}]},{"as":"after-start","function":"greater-than","args":[{"field":"run-clock"},{"field":"start-before"}]},{"as":"include-start","function":"if","args":[{"field":"all-starts"},{"value":true},{"field":"after-start"}]},{"as":"all-ends","function":"equals-any","args":[{"parameter":"routing-filter-end"},{"value":""}]},{"as":"end-clock","function":"timestamp","args":[{"parameter":"routing-filter-end"}]},{"as":"before-end","function":"greater-than","args":[{"field":"end-clock"},{"field":"run-clock"}]},{"as":"include-end","function":"if","args":[{"field":"all-ends"},{"value":true},{"field":"before-end"}]}]},{"name":"routing-runs","from":"routing-filter-candidates","subject":"Retain identified runs matching every selected routing filter.","objective":"Use the same population for adoption, accounting and outcomes.","acceptance":"A time bound excludes untimed runs and does not remove individual events from retained sessions.","filter":{"predicates":[{"field":"include-workflow","equals":true},{"field":"include-repository","equals":true},{"field":"include-engine","equals":true},{"field":"include-state","equals":true},{"field":"include-goal","equals":true},{"field":"include-mode","equals":true},{"field":"include-awf","equals":true},{"field":"include-start","equals":true},{"field":"include-end","equals":true}]}},{"name":"routing-events","from":"routing-session-events","subject":"Retain all evidence belonging to scoped identified runs.","objective":"Filter event metrics by the resolved run rather than by individual event clocks.","acceptance":"State, pick and accounting are computed before the scope is applied.","joins":[{"source":"routing-runs","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"routing-state","as":"run-routing-state"}]}]},{"name":"routing-phase-sources","subject":"Choose one nonoverlapping accounting source per run and phase.","objective":"Prefer proxy token usage over usage reports.","acceptance":"Snapshot totals and cumulative totalAic never enter additive cost.","from":"routing-events","aggregate":{"by":["routing-run-key","phase"],"values":[{"field":"event","as":"proxy-usage-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"firewall.token_usage"}]}},{"field":"event","as":"report-usage-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"usage.report"}]}},{"field":"event","as":"proxy-source-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"session.collection"},{"field":"name","equals":"token-usage.jsonl"},{"field":"event-status","equals":"collected"}]}},{"field":"event","as":"report-source-count","reducer":"count","filter":{"predicates":[{"field":"event-type","equals":"session.collection"},{"field":"name","in":["agent_usage.json","usage.json","usage.jsonl","usage-report.jsonl"]},{"field":"event-status","equals":"collected"}]}}]}},{"name":"routing-accounting-candidates","subject":"Read nonoverlapping per-response accounting records.","objective":"Expose recorded credits and token classes without repricing unknown usage.","acceptance":"Each phase uses proxy accounting when present and usage.report otherwise; absent AIC is counted.","from":"routing-events","joins":[{"source":"routing-phase-sources","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"}],"fields":[{"field":"proxy-usage-count","as":"proxy-usage-count"}]}],"compute":[{"as":"has-proxy-accounting","function":"greater-than","args":[{"field":"proxy-usage-count"},{"value":0}]},{"as":"accounting-identity","function":"coalesce","args":[{"field":"correlation-id"},{"field":"event"}]},{"as":"accounting-source","function":"if","args":[{"field":"has-proxy-accounting"},{"value":"firewall.token_usage"},{"value":"usage.report"}]},{"as":"selected-accounting","function":"equals-any","args":[{"field":"event-type"},{"field":"accounting-source"}]},{"as":"unknown-aic","function":"equals-any","args":[{"field":"aic"},{"value":null}]},{"as":"unknown-aic-count","function":"if","args":[{"field":"unknown-aic"},{"value":1},{"value":0}]}],"window":[{"operation":"row-number","field":"source-sequence","as":"accounting-position","groupby":["routing-run-key","phase","event-type","accounting-identity"],"order-by":[{"field":"event-timestamp","direction":"desc"},{"field":"source-sequence","direction":"desc"}]}]},{"name":"routing-accounting","subject":"Select the authoritative accounting source for each phase.","objective":"Exclude overlapping usage reports and snapshots.","acceptance":"Every accounting row contributes at most once.","from":"routing-accounting-candidates","filter":{"predicates":[{"field":"selected-accounting","equals":true},{"field":"accounting-position","equals":1},{"field":"phase","in":["agent","detection","evals"]}]}},{"name":"routing-request-candidates","subject":"Keep per-request routing decisions separate from accounting.","objective":"Join routed outcomes by run, phase and request ID.","acceptance":"Rejected requests establish local zero cost; other unmatched requests retain unknown cost.","from":"routing-events","filter":{"predicates":[{"field":"event-type","equals":"firewall.model_routing"},{"field":"routing-stage","equals":"request"}]},"compute":[{"as":"request-identity","function":"coalesce","args":[{"field":"correlation-id"},{"field":"event"}]}],"window":[{"operation":"row-number","field":"source-sequence","as":"request-position","groupby":["routing-run-key","phase","request-identity"],"order-by":[{"field":"event-timestamp","direction":"desc"},{"field":"source-sequence","direction":"desc"}]}]},{"name":"routing-request-records","from":"routing-request-candidates","subject":"Retain the latest record for each request identity.","objective":"Avoid duplicate request joins and overlapping totals.","acceptance":"Requests without IDs remain independent, not falsely correlated.","filter":{"predicates":[{"field":"request-position","equals":1}]}},{"name":"routing-subagent-candidates","subject":"Read engine-reported sub-agent request ownership.","objective":"Use exact request-ID ownership before falling back to unsplit traffic.","acceptance":"Only request identities can assign exact ownership; advisory outcomes never assign credits.","from":"routing-events","filter":{"predicates":[{"field":"event-type","equals":"subagent.request"}]},"compute":[{"as":"subagent-identity","function":"coalesce","args":[{"field":"correlation-id"},{"field":"event"}]}],"window":[{"operation":"row-number","field":"source-sequence","as":"subagent-position","groupby":["routing-run-key","phase","subagent-identity"],"order-by":[{"field":"event-timestamp","direction":"desc"},{"field":"source-sequence","direction":"desc"}]}]},{"name":"routing-subagent-requests","from":"routing-subagent-candidates","subject":"Retain one sub-agent observation per request identity.","objective":"Keep exact ownership joins unique.","acceptance":"Missing identities do not match unrelated requests.","filter":{"predicates":[{"field":"subagent-position","equals":1}]}},{"name":"routing-exact-accounting","subject":"Attribute each accounting record to exactly one traffic bucket.","objective":"Keep detection, evals, classifier, exact sub-agent, main, unsplit and unattributed credits distinct.","acceptance":"Detection and evals use phase, missing purpose is never agent by default, and snapshot credits are excluded.","from":"routing-accounting","joins":[{"source":"routing-request-records","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"},{"left":"correlation-id","right":"correlation-id"}],"fields":[{"field":"event","as":"request-event"},{"field":"routing-routed","as":"request-routed"},{"field":"routing-deviations","as":"request-deviations"},{"field":"routing-outcome","as":"request-outcome"},{"field":"routing-requested-model","as":"request-model"},{"field":"routing-requested-effort","as":"request-effort"}]},{"source":"routing-subagent-requests","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"},{"left":"correlation-id","right":"correlation-id"}],"fields":[{"field":"routing-agent-name","as":"exact-agent-name"}]},{"source":"routing-run-facts","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"subagent-count","as":"subagent-count"}]}],"compute":[{"as":"exact-owner","function":"coalesce","args":[{"field":"routing-agent-name"},{"field":"exact-agent-name"}]},{"as":"no-exact-owner","function":"equals-any","args":[{"field":"exact-owner"},{"value":null}]}]},{"name":"routing-correlation-usage-candidates","from":"routing-exact-accounting","subject":"Find accounting records without exact sub-agent ownership.","objective":"Correlate only fully recorded token quartets in file order.","acceptance":"Missing token classes never match by model alone.","filter":{"predicates":[{"field":"phase","equals":"agent"},{"field":"no-exact-owner","equals":true}]},"compute":[{"as":"token-quartet","function":"sum","args":[{"field":"input-tokens"},{"field":"output-tokens"},{"field":"cache-read-tokens"},{"field":"cache-write-tokens"}]},{"as":"is-classifier","function":"equals-any","args":[{"field":"routing-purpose"},{"value":"routing_classification"}]}]},{"name":"routing-correlation-usage","from":"routing-correlation-usage-candidates","subject":"Order unmatched accounting within model and token quartet.","objective":"Match each engine-reported request at most once.","acceptance":"Classifier, incomplete and already-exact requests are excluded.","filter":{"predicates":[{"field":"token-quartet","gte":0},{"field":"is-classifier","equals":false}]},"window":[{"operation":"row-number","field":"source-sequence","as":"correlation-position","groupby":["routing-run-key","telemetry-model","input-tokens","output-tokens","cache-read-tokens","cache-write-tokens"],"order-by":[{"field":"source-sequence","direction":"asc"}]}]},{"name":"routing-correlation-subagent-candidates","from":"routing-subagent-requests","subject":"Exclude engine requests already matched by proxy request ID.","objective":"Prevent exact and correlated ownership from claiming the same request.","acceptance":"Only engine requests with a complete quartet and a definition name can correlate.","joins":[{"source":"routing-accounting","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"},{"left":"correlation-id","right":"correlation-id"}],"fields":[{"field":"event","as":"exact-accounting-event"}]}],"compute":[{"as":"token-quartet","function":"sum","args":[{"field":"input-tokens"},{"field":"output-tokens"},{"field":"cache-read-tokens"},{"field":"cache-write-tokens"}]}]},{"name":"routing-correlation-subagents","from":"routing-correlation-subagent-candidates","subject":"Order unmatched engine requests within each model/token quartet.","objective":"Produce deterministic one-to-one correlated ownership.","acceptance":"Correlation is labelled separately from exact evidence.","filter":{"predicates":[{"field":"exact-accounting-event","equals":null},{"field":"token-quartet","gte":0},{"field":"phase","equals":"agent"}]},"window":[{"operation":"row-number","field":"source-sequence","as":"correlation-position","groupby":["routing-run-key","telemetry-model","input-tokens","output-tokens","cache-read-tokens","cache-write-tokens"],"order-by":[{"field":"source-sequence","direction":"asc"}]}]},{"name":"routing-correlated-accounting","from":"routing-correlation-usage","subject":"Join proxy usage with unmatched engine requests by model, quartet and occurrence.","objective":"Use the spec's correlated sub-agent attribution without duplicating credits.","acceptance":"Each engine request and accounting record participates at most once.","joins":[{"source":"routing-correlation-subagents","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"telemetry-model","right":"telemetry-model"},{"left":"input-tokens","right":"input-tokens"},{"left":"output-tokens","right":"output-tokens"},{"left":"cache-read-tokens","right":"cache-read-tokens"},{"left":"cache-write-tokens","right":"cache-write-tokens"},{"left":"correlation-position","right":"correlation-position"}],"fields":[{"field":"routing-agent-name","as":"correlated-owner"}]}],"select":[{"field":"routing-run-key"},{"field":"event"},{"field":"correlated-owner"}]},{"name":"routing-attributed-accounting","from":"routing-exact-accounting","subject":"Assign every accounting record to exactly one exclusive bucket.","objective":"Keep exact and correlated sub-agent ownership distinct.","acceptance":"Phase wins over purpose; missing ownership remains unsplit or unattributed.","joins":[{"source":"routing-correlated-accounting","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"event","right":"event"}],"fields":[{"field":"correlated-owner","as":"correlated-owner"}]}],"compute":[{"as":"agent-name","function":"coalesce","args":[{"field":"exact-owner"},{"field":"correlated-owner"}]},{"as":"unknown-agent","function":"equals-any","args":[{"field":"agent-name"},{"value":null}]},{"as":"unknown-request","function":"equals-any","args":[{"field":"request-event"},{"value":null}]},{"as":"has-subagents","function":"greater-than","args":[{"field":"subagent-count"},{"value":0}]},{"as":"is-subagent-purpose","function":"equals-any","args":[{"field":"routing-purpose"},{"value":"subagent"}]},{"as":"is-agent-purpose","function":"equals-any","args":[{"field":"routing-purpose"},{"value":"agent"}]},{"as":"matched-bucket","function":"if","args":[{"field":"has-subagents"},{"value":"agent_unsplit"},{"value":"main_agent"}]},{"as":"request-bucket","function":"if","args":[{"field":"unknown-request"},{"value":"unattributed"},{"field":"matched-bucket"}]},{"as":"subagent-bucket","function":"if","args":[{"field":"is-subagent-purpose"},{"value":"agent_unsplit"},{"field":"request-bucket"}]},{"as":"purpose-bucket","function":"if","args":[{"field":"is-agent-purpose"},{"value":"main_agent"},{"field":"subagent-bucket"}]},{"as":"subagent-attribution","function":"if","args":[{"field":"no-exact-owner"},{"value":"subagent_correlated"},{"value":"subagent_exact"}]},{"as":"ownership-bucket","function":"if","args":[{"field":"unknown-agent"},{"field":"purpose-bucket"},{"field":"subagent-attribution"}]},{"as":"classifier","function":"equals-any","args":[{"field":"routing-purpose"},{"value":"routing_classification"}]},{"as":"classifier-bucket","function":"if","args":[{"field":"classifier"},{"value":"classifier"},{"field":"ownership-bucket"}]},{"as":"evals","function":"equals-any","args":[{"field":"phase"},{"value":"evals"}]},{"as":"phase-bucket","function":"if","args":[{"field":"evals"},{"value":"evals"},{"field":"classifier-bucket"}]},{"as":"detection","function":"equals-any","args":[{"field":"phase"},{"value":"detection"}]},{"as":"bucket","function":"if","args":[{"field":"detection"},{"value":"detection"},{"field":"phase-bucket"}]}]},{"name":"routing-joined-requests","subject":"Inspect per-request deviations and outcomes against proxy picks.","objective":"Keep requests without accounting visible and never invent a deviation cause.","acceptance":"Unmatched requests have unknown cost; each request retains its own requested and selected model.","from":"routing-request-records","joins":[{"source":"routing-accounting","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"},{"left":"correlation-id","right":"correlation-id"}],"fields":[{"field":"aic","as":"accounted-aic"},{"field":"event","as":"accounting-event"}]}],"compute":[{"as":"missing-accounting","function":"equals-any","args":[{"field":"accounting-event"},{"value":null}]},{"as":"failed-request","function":"equals-any","args":[{"field":"routing-outcome"},{"value":"failed"}]},{"as":"failed-unaccounted","function":"if","args":[{"field":"missing-accounting"},{"field":"failed-request"},{"value":false}]}],"order-by":[{"field":"event-timestamp","direction":"desc"}]},{"name":"routing-unaccounted-failures","from":"routing-joined-requests","subject":"Count failed requests lacking accounting per run.","objective":"Recognize only unambiguous AWF-local effort failures.","acceptance":"A run-level effort failure cannot assign zero to multiple failed requests.","aggregate":{"by":["routing-run-key"],"values":[{"field":"event","as":"failed-unaccounted-count","reducer":"count","filter":{"predicates":[{"field":"failed-unaccounted","equals":true}]}}]}},{"name":"routing-deviations","from":"routing-joined-requests","subject":"Resolve explicit local zero costs and preserve all other unknown request costs.","objective":"Avoid partial-cost comparisons based on missing accounting.","acceptance":"Only guard rejection or an unambiguous local effort failure establishes zero AIC.","joins":[{"source":"routing-unaccounted-failures","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"failed-unaccounted-count","as":"failed-unaccounted-count"}]},{"source":"routing-run-facts","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"local-effort-failures","as":"local-effort-failures"}]}],"compute":[{"as":"only-unaccounted-failure","function":"equals-any","args":[{"field":"failed-unaccounted-count"},{"value":1}]},{"as":"has-local-failure","function":"greater-than","args":[{"field":"local-effort-failures"},{"value":0}]},{"as":"unambiguous-local-failure","function":"if","args":[{"field":"only-unaccounted-failure"},{"field":"has-local-failure"},{"value":false}]},{"as":"local-code","function":"equals-any","args":[{"field":"code"},{"value":"unsupported_reasoning_effort"}]},{"as":"local-evidence","function":"if","args":[{"field":"local-code"},{"value":true},{"field":"unambiguous-local-failure"}]},{"as":"local-failure","function":"if","args":[{"field":"failed-request"},{"field":"local-evidence"},{"value":false}]},{"as":"guard-rejection","function":"equals-any","args":[{"field":"routing-outcome"},{"value":"rejected"}]},{"as":"zero-local-cost","function":"if","args":[{"field":"guard-rejection"},{"value":true},{"field":"local-failure"}]},{"as":"local-cost","function":"if","args":[{"field":"zero-local-cost"},{"value":0},{"value":null}]},{"as":"request-aic","function":"coalesce","args":[{"field":"accounted-aic"},{"field":"local-cost"}]},{"as":"unknown-request-cost","function":"equals-any","args":[{"field":"request-aic"},{"value":null}]},{"as":"unknown-request-count","function":"if","args":[{"field":"unknown-request-cost"},{"value":1},{"value":0}]}]},{"name":"routing-phase-usage","from":"routing-accounting","subject":"Sum nonoverlapping accounting per run and phase.","objective":"Establish complete costs only with known response values.","acceptance":"Unknown response costs remain counted.","aggregate":{"by":["routing-run-key","phase"],"values":[{"field":"aic","as":"recorded-aic","reducer":"sum"},{"field":"aic","as":"known-responses","reducer":"count"},{"field":"unknown-aic-count","as":"unknown-responses","reducer":"sum"}]}},{"name":"routing-request-coverage","from":"routing-deviations","subject":"Count requests whose cost remains unknown.","objective":"Exclude incomplete runs from distribution comparisons.","acceptance":"Unmatched nonlocal requests cannot be treated as free.","aggregate":{"by":["routing-run-key","phase"],"values":[{"field":"unknown-request-count","as":"unknown-requests","reducer":"sum"}]}},{"name":"routing-phase-costs","from":"routing-phase-sources","subject":"Evaluate accounting completeness using collected source receipts and request joins.","objective":"Exclude partial costs from medians and comparisons.","acceptance":"A complete phase has its selected accounting source, no missing AIC and no unaccounted nonlocal requests.","joins":[{"source":"routing-phase-usage","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"}],"fields":[{"field":"recorded-aic","as":"recorded-aic"},{"field":"unknown-responses","as":"unknown-responses"},{"field":"known-responses","as":"known-responses"}]},{"source":"routing-request-coverage","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"},{"left":"phase","right":"phase"}],"fields":[{"field":"unknown-requests","as":"unknown-requests"}]}],"compute":[{"as":"has-proxy","function":"greater-than","args":[{"field":"proxy-usage-count"},{"value":0}]},{"as":"has-report","function":"greater-than","args":[{"field":"report-usage-count"},{"value":0}]},{"as":"any-source-count","function":"sum","args":[{"field":"proxy-source-count"},{"field":"report-source-count"}]},{"as":"report-or-empty-source","function":"if","args":[{"field":"has-report"},{"field":"report-source-count"},{"field":"any-source-count"}]},{"as":"accounting-source-count","function":"if","args":[{"field":"has-proxy"},{"field":"proxy-source-count"},{"field":"report-or-empty-source"}]},{"as":"source-present","function":"greater-than","args":[{"field":"accounting-source-count"},{"value":0}]},{"as":"missing-responses","function":"coalesce","args":[{"field":"unknown-responses"},{"value":0}]},{"as":"missing-requests","function":"coalesce","args":[{"field":"unknown-requests"},{"value":0}]},{"as":"missing-count","function":"sum","args":[{"field":"missing-responses"},{"field":"missing-requests"}]},{"as":"all-values-known","function":"equals-any","args":[{"field":"missing-count"},{"value":0}]},{"as":"complete","function":"if","args":[{"field":"source-present"},{"field":"all-values-known"},{"value":false}]},{"as":"known-sum","function":"coalesce","args":[{"field":"recorded-aic"},{"value":0}]},{"as":"complete-aic","function":"if","args":[{"field":"complete"},{"field":"known-sum"},{"value":null}]}]},{"name":"routing-agent-costs","from":"routing-phase-costs","subject":"Select complete or explicitly partial agent-phase costs.","objective":"Keep detection and evals out of agent-phase comparisons.","acceptance":"Classifier remains part of agent-phase cost.","filter":{"predicates":[{"field":"phase","equals":"agent"}]}},{"name":"routing-detection-costs","from":"routing-phase-costs","subject":"Retain detection-phase cost completeness separately.","objective":"Do not count detection as classifier or agent traffic.","acceptance":"Missing detection evidence remains unknown, not zero.","filter":{"predicates":[{"field":"phase","equals":"detection"}]}},{"name":"routing-cost-runs","from":"routing-resolved-runs","subject":"Attach accounting completeness to identified routing runs.","objective":"Provide comparable costs only for complete runs.","acceptance":"An absent cost stays unknown and never inherits aggregate run AIC.","joins":[{"source":"routing-runs","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"main-aic","as":"main-aic"},{"field":"baseline-model","as":"baseline-model"},{"field":"baseline-aic","as":"baseline-aic"},{"field":"baseline-complete","as":"baseline-complete"}]},{"source":"routing-agent-costs","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"complete-aic","as":"complete-aic"},{"field":"complete","as":"cost-complete"},{"field":"missing-count","as":"missing-cost-records"}]},{"source":"routing-detection-costs","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"complete-aic","as":"detection-aic"},{"field":"complete","as":"detection-complete"}]}],"compute":[{"as":"run-cost-complete","function":"if","args":[{"field":"cost-complete"},{"field":"detection-complete"},{"value":false}]},{"as":"run-aic","function":"sum","args":[{"field":"complete-aic"},{"field":"detection-aic"}]},{"as":"budget-use","function":"quotient","args":[{"field":"run-aic"},{"field":"configured-max-credits"}]}]},{"name":"routing-run-summary","from":"routing-runs","subject":"Keep the selected Run's compact routing and baseline evidence visible.","objective":"Preserve the comparison when shorter-lived Audit detail expires.","acceptance":"Retained aggregate costs and baseline evidence survive Audit expiry; absent phase details stay unknown.","joins":[{"source":"routing-cost-runs","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"cost-complete","as":"cost-complete"},{"field":"missing-cost-records","as":"missing-cost-records"},{"field":"detection-aic","as":"detection-aic"},{"field":"run-aic","as":"run-aic"},{"field":"budget-use","as":"budget-use"}]}]},{"name":"routing-weekly-cost-totals","from":"routing-runs","subject":"Summarize complete agent-phase costs by UTC ISO week and routing state.","objective":"Expose trends without including partial costs.","acceptance":"Untimed runs cannot enter time buckets.","filter":{"predicates":[{"field":"run-clock","gte":0}]},"compute":[{"as":"week","function":"date-bucket","args":[{"field":"observed-at"},{"value":"week"}]}],"aggregate":{"by":["week","routing-state"],"values":[{"field":"run","as":"runs","reducer":"count"},{"field":"complete-aic","as":"complete-runs","reducer":"count"},{"field":"complete-aic","as":"observed-median","reducer":"median"}]}},{"name":"routing-weekly-accounting-cost","from":"routing-weekly-cost-totals","subject":"Gate weekly medians by complete sample size.","objective":"Keep sparse weeks from implying meaningful cost trends.","acceptance":"Weeks below the configurable minimum display insufficient data.","parameters":[{"name":"minimum-sample","type":"number"}],"compute":[{"as":"cost-series","function":"concat","args":[{"value":"Agent-phase accounting: "},{"field":"routing-state"}]},{"as":"sample-floor","function":"difference","args":[{"parameter":"minimum-sample"},{"value":1}]},{"as":"enough-samples","function":"greater-than","args":[{"field":"complete-runs"},{"field":"sample-floor"}]},{"as":"median-aic","function":"if","args":[{"field":"enough-samples"},{"field":"observed-median"},{"value":null}]},{"as":"sample-status","function":"if","args":[{"field":"enough-samples"},{"value":"observational"},{"value":"insufficient data"}]}],"order-by":[{"field":"week","direction":"asc"}]},{"name":"routing-resolutions","from":"routing-session-events","subject":"Read runner-written configured-model resolutions for scoped routing runs.","objective":"Explain what each workflow role's configured model resolved to before the engine launched.","acceptance":"Only model.resolution facts from latest scoped attempts contribute; missing or unsafe values and failed null resolutions remain unknown.","joins":[{"source":"routing-runs","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"run-clock","as":"run-clock"},{"field":"observed-at","as":"run-observed-at"},{"field":"full-repository","as":"full-repository"},{"field":"routing-dashboard-link","as":"routing-dashboard-link"},{"field":"routing-state","as":"run-routing-state"}]}],"filter":{"predicates":[{"field":"event-type","equals":"model.resolution"}]},"compute":[{"as":"resolution-engine","function":"coalesce","args":[{"field":"telemetry-engine"},{"value":"unknown"}]},{"as":"resolution-role-label","function":"coalesce","args":[{"field":"resolution-role"},{"value":"unknown"}]},{"as":"configured-model","function":"coalesce","args":[{"field":"resolution-configured-model"},{"value":"unknown"}]},{"as":"resolved-model-label","function":"coalesce","args":[{"field":"resolution-resolved-model"},{"value":"unknown"}]},{"as":"resolution-provider","function":"coalesce","args":[{"field":"provider"},{"value":"unknown"}]},{"as":"resolution-status","function":"coalesce","args":[{"field":"event-status"},{"value":"unknown"}]},{"as":"failed-resolution","function":"equals-any","args":[{"field":"event-status"},{"value":"failed"}]},{"as":"failure-cause","function":"coalesce","args":[{"field":"code"},{"value":"unknown"}]},{"as":"resolution-cause","function":"if","args":[{"field":"failed-resolution"},{"field":"failure-cause"},{"field":"code"}]},{"as":"unknown-resolved-model","function":"equals-any","args":[{"field":"resolution-resolved-model"},{"value":null}]},{"as":"untimed","function":"equals-any","args":[{"field":"run-clock"},{"value":null}]},{"as":"configured-to-resolved","function":"concat","args":[{"field":"configured-model"},{"value":" → "},{"field":"resolved-model-label"}]},{"as":"workflow-key","function":"concat","args":[{"field":"full-repository"},{"value":":"},{"field":"workflow"}]},{"as":"resolution-actor","function":"concat","args":[{"field":"resolution-engine"},{"value":"/"},{"field":"resolution-role-label"},{"value":"/"},{"field":"resolution-provider"}]},{"as":"resolution-series","function":"concat","args":[{"field":"workflow-key"},{"value":" | "},{"field":"resolution-actor"},{"value":" | "},{"field":"configured-model"}]}]},{"name":"routing-health-totals","from":"routing-runs","subject":"Count routed runs and their selection, failure, adherence, outcome and cost evidence per repository and workflow.","objective":"Answer whether routing is on and working from one row per routed workflow.","acceptance":"Only selected, selection_failed, harness_reported and configured_unrecorded runs contribute; runs without evidence stay out of each denominator.","filter":{"predicates":[{"field":"routing-state","in":["selected","selection_failed","harness_reported","configured_unrecorded"]}]},"compute":[{"as":"has-routing-failure","function":"greater-than","args":[{"field":"failure-count"},{"value":0}]},{"as":"failure-or-fallback","function":"if","args":[{"field":"has-routing-failure"},{"value":true},{"field":"routing-degraded"}]},{"as":"adherence-known","function":"greater-than","args":[{"field":"flagged-requests"},{"value":0}]},{"as":"no-deviation","function":"equals-any","args":[{"field":"deviated-requests"},{"value":0}]}],"aggregate":{"by":["full-repository","workflow","baseline-model"],"values":[{"field":"paired-main-aic","as":"paired-main-aic","reducer":"sum"},{"field":"paired-baseline-aic","as":"paired-baseline-aic","reducer":"sum"},{"field":"run","as":"routed-runs","reducer":"count"},{"field":"run","as":"selected-runs","reducer":"count","filter":{"predicates":[{"field":"routing-state","equals":"selected"}]}},{"field":"run","as":"failure-runs","reducer":"count","filter":{"predicates":[{"field":"failure-or-fallback","equals":true}]}},{"field":"run","as":"adherence-known-runs","reducer":"count","filter":{"predicates":[{"field":"adherence-known","equals":true}]}},{"field":"run","as":"followed-runs","reducer":"count","filter":{"predicates":[{"field":"adherence-known","equals":true},{"field":"no-deviation","equals":true}]}},{"field":"agent-result","as":"known-outcomes","reducer":"count"},{"field":"run","as":"successes","reducer":"count","filter":{"predicates":[{"field":"agent-result","equals":"success"}]}},{"field":"complete-aic","as":"complete-runs","reducer":"count"},{"field":"complete-aic","as":"median-aic","reducer":"median"}]}},{"name":"routing-health","subject":"Show routing health shares per repository and workflow.","objective":"Tell whether routing is on and working from selection, failure or fallback, pick adherence, known outcomes and complete cost.","acceptance":"A zero denominator or no complete cost is unknown, never zero; unknown job outcomes are excluded from the success rate.","from":"routing-health-totals","compute":[{"as":"estimated-cost-vs-baseline","function":"quotient","args":[{"field":"paired-main-aic"},{"field":"paired-baseline-aic"}]},{"as":"estimated-cost-percent","function":"format-percent","args":[{"field":"estimated-cost-vs-baseline"}]},{"as":"selected-share","function":"quotient","args":[{"field":"selected-runs"},{"field":"routed-runs"}]},{"as":"failure-share","function":"quotient","args":[{"field":"failure-runs"},{"field":"routed-runs"}]},{"as":"followed-share","function":"quotient","args":[{"field":"followed-runs"},{"field":"adherence-known-runs"}]},{"as":"success-rate","function":"quotient","args":[{"field":"successes"},{"field":"known-outcomes"}]},{"as":"selected-percent","function":"format-percent","args":[{"field":"selected-share"}]},{"as":"failure-percent","function":"format-percent","args":[{"field":"failure-share"}]},{"as":"followed-percent","function":"format-percent","args":[{"field":"followed-share"}]},{"as":"success-percent","function":"format-percent","args":[{"field":"success-rate"}]}],"order-by":[{"field":"routed-runs","direction":"desc"},{"field":"full-repository","direction":"asc"},{"field":"workflow","direction":"asc"}]},{"name":"routing-weekly-models","from":"routing-runs","subject":"Count proxy-selected runs by UTC ISO week and picked model.","objective":"Show what the router chooses over time.","acceptance":"Only selected runs with a known pick model and a recorded run clock contribute; an unrecorded effort does not exclude a run.","filter":{"predicates":[{"field":"routing-state","equals":"selected"},{"field":"unknown-pick-model","equals":false},{"field":"run-clock","gte":0}]},"compute":[{"as":"week","function":"date-bucket","args":[{"field":"observed-at"},{"value":"week"}]}],"aggregate":{"by":["week","pick-model"],"values":[{"field":"run","as":"runs","reducer":"count"}]},"order-by":[{"field":"week","direction":"asc"},{"field":"pick-model","direction":"asc"}]},{"name":"routing-weekly-paired-totals","from":"routing-runs","subject":"Weekly paired complete main-request costs by baseline model.","objective":"Compare routing cost trends with each named baseline using identical main-request populations.","acceptance":"Only timed runs with complete positive baseline estimates and matching known main-request costs contribute to both medians.","filter":{"predicates":[{"field":"paired","equals":true},{"field":"run-clock","gte":0}]},"compute":[{"as":"week","function":"date-bucket","args":[{"field":"observed-at"},{"value":"week"}]}],"aggregate":{"by":["week","baseline-model"],"values":[{"field":"run","as":"complete-runs","reducer":"count"},{"field":"paired-main-aic","as":"observed-main-median","reducer":"median"},{"field":"paired-baseline-aic","as":"baseline-estimate-median","reducer":"median"}]}},{"name":"routing-weekly-paired-cost","from":"routing-weekly-paired-totals","subject":"Paired main-request samples that meet the chosen evidence floor.","objective":"Avoid changing routing policy based on insufficient paired evidence.","acceptance":"Observed and estimated series share the same complete-run count and configurable minimum sample.","parameters":[{"name":"minimum-sample","type":"number"}],"compute":[{"as":"sample-floor","function":"difference","args":[{"parameter":"minimum-sample"},{"value":1}]},{"as":"enough-samples","function":"greater-than","args":[{"field":"complete-runs"},{"field":"sample-floor"}]}]},{"name":"routing-weekly-main-observed","from":"routing-weekly-paired-cost","subject":"Observed main-request AIC for the same eligible runs as each baseline.","objective":"Identify weeks when routed main-request costs exceed the matching baseline estimate.","acceptance":"Observed medians exclude classifier and sub-agent costs and remain unknown below the paired sample floor.","compute":[{"as":"cost-series","function":"concat","args":[{"value":"Main requests observed (baseline: "},{"field":"baseline-model"},{"value":")"}]},{"as":"median-aic","function":"if","args":[{"field":"enough-samples"},{"field":"observed-main-median"},{"value":null}]}]},{"name":"routing-weekly-baseline-estimate","from":"routing-weekly-paired-cost","subject":"Explicitly estimated baseline AIC for paired main-agent requests.","objective":"Show the named counterfactual against which owners can assess routing goal or mode.","acceptance":"The series is labelled estimated, separates baseline models and uses exactly the observed series' eligible runs.","compute":[{"as":"cost-series","function":"concat","args":[{"value":"Baseline estimate (estimated, main requests): "},{"field":"baseline-model"}]},{"as":"median-aic","function":"if","args":[{"field":"enough-samples"},{"field":"baseline-estimate-median"},{"value":null}]}]},{"name":"routing-weekly-cost","from":"routing-weekly-accounting-cost","union":["routing-weekly-main-observed","routing-weekly-baseline-estimate"],"subject":"Compare the same main-agent requests to an explicitly estimated baseline.","objective":"Change routing goal or mode when paired observed cost exceeds the named baseline.","acceptance":"Keep agent-phase accounting separate, baseline models distinct and sparse weeks as gaps.","order-by":[{"field":"week","direction":"asc"},{"field":"cost-series","direction":"asc"}]},{"name":"routing-failure-problems","from":"routing-runs","subject":"Runs whose routing failure codes require investigation.","objective":"Investigate routing configuration or execution failures before changing rollout.","acceptance":"Emit one row per run with recorded routing failure identifiers, excluding upstream errors handled by their own kind.","filter":{"predicates":[{"field":"routing-failure-codes","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"routing failure"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"routing-failure-codes"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-deviation-problems","from":"routing-runs","subject":"Runs whose requests deviated from the routing pick.","objective":"Investigate why requests did not follow the selected model or effort.","acceptance":"Emit one row per run with distinct recorded deviation causes, without inferring causes from model names.","filter":{"predicates":[{"field":"routing-deviation-codes","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"deviation"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"routing-deviation-codes"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-resolution-problems","from":"routing-runs","subject":"Runs whose configured models could not be resolved.","objective":"Correct model aliases or restore catalogue availability for failed resolutions.","acceptance":"Emit one row per run with recorded resolution failure causes, not absence of resolution evidence.","filter":{"predicates":[{"field":"routing-resolution-codes","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"resolution failure"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"routing-resolution-codes"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-upstream-problems","from":"routing-runs","subject":"Provider-rejected requests with distinct upstream error codes.","objective":"Correct model or effort settings rejected by the provider.","acceptance":"Emit one upstream-error row per run with distinct safe codes or unknown, never a duplicate generic routing failure.","filter":{"predicates":[{"field":"routing-upstream-codes","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"upstream error"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"routing-upstream-codes"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-candidate-problems","from":"routing-runs","subject":"Runs whose full eligible pool contains choices the router cannot rank.","objective":"Review allowed models when the router cannot rank the complete eligible pool.","acceptance":"Emit one row only when both pool counters are known and overlap is below eligibility, displaying the observed ratio.","filter":{"predicates":[{"field":"candidate-coverage","gte":""}]},"compute":[{"as":"problem-kind","function":"literal","args":[{"value":"candidates not rankable"}]},{"as":"problem-cause","function":"coalesce","args":[{"field":"candidate-coverage"},{"value":null}]}],"select":[{"field":"routing-run-key"},{"field":"problem-kind"},{"field":"problem-cause"}]},{"name":"routing-problems","from":"routing-failure-problems","union":["routing-deviation-problems","routing-resolution-problems","routing-upstream-problems","routing-candidate-problems"],"subject":"List routing failures, deviations and resolution failures with one row per run and kind.","objective":"Show what needs attention and link each problem to its run page.","acceptance":"Time is the run's recorded observation time and stays unknown without a run clock; untimed rows sort after timed rows.","joins":[{"source":"routing-runs","type":"inner","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"run","as":"run"},{"field":"full-repository","as":"full-repository"},{"field":"workflow","as":"workflow"},{"field":"run-clock","as":"run-clock"},{"field":"observed-at","as":"observed-at"},{"field":"routing-dashboard-link","as":"routing-dashboard-link"}]}],"compute":[{"as":"untimed","function":"equals-any","args":[{"field":"run-clock"},{"value":null}]}],"order-by":[{"field":"untimed","direction":"asc"},{"field":"run-clock","direction":"desc"},{"field":"run","direction":"desc"},{"field":"problem-kind","direction":"asc"}]},{"name":"simulator-database-inputs","subject":"Model daily run volume and 30-day retained detail from user-supplied scenario inputs.","objective":"Compare hypothetical workload choices without treating results as observed activity.","acceptance":"Each simulated day uses the selected inputs; skipped runs retain summaries and detailed records have a 30-day lifetime.","description":"Each simulated day includes all accumulated run summaries; tools and issues belong only to non-skipped runs and expire after 30 days.","from":"simulation-days","parameters":[{"name":"repositories","type":"number"},{"name":"runs-per-day","type":"number"},{"name":"tools-per-run","type":"number"},{"name":"issues-per-run","type":"number"},{"name":"skip-rate","type":"number"}],"compute":[{"as":"runs-daily","function":"product","args":[{"parameter":"repositories"},{"parameter":"runs-per-day"}]},{"as":"skip-fraction","function":"quotient","args":[{"parameter":"skip-rate"},{"value":100}]},{"as":"active-fraction","function":"difference","args":[{"value":1},{"field":"skip-fraction"}]},{"as":"summary-runs","function":"product","args":[{"field":"day"},{"field":"runs-daily"}]},{"as":"past-ttl","function":"greater-than","args":[{"field":"day"},{"value":30}]},{"as":"detail-days","function":"if","args":[{"field":"past-ttl"},{"value":30},{"field":"day"}]},{"as":"detail-runs","function":"product","args":[{"field":"detail-days"},{"field":"runs-daily"},{"field":"active-fraction"}]},{"as":"tools-per-run","function":"literal","args":[{"parameter":"tools-per-run"}]},{"as":"issues-per-run","function":"literal","args":[{"parameter":"issues-per-run"}]}]},{"name":"simulator-run-size","subject":"Estimate retained run-summary table size at 512 bytes per run.","objective":"Show modeled accumulation of run summaries.","acceptance":"Summary size includes every simulated run at 512 bytes and is not presented as measured storage.","from":"simulator-database-inputs","compute":[{"as":"table","function":"literal","args":[{"value":"Run summaries"}]},{"as":"bytes","function":"product","args":[{"field":"summary-runs"},{"value":512}]}],"select":[{"field":"day"},{"field":"table"},{"field":"bytes"}]},{"name":"simulator-tool-size","subject":"Estimate retained tool table size at 256 bytes per tool on non-skipped runs.","objective":"Show modeled tool-record growth under the selected workload.","acceptance":"Tool size uses only non-skipped simulated runs and 256 bytes per tool over the retained period.","from":"simulator-database-inputs","compute":[{"as":"table","function":"literal","args":[{"value":"Tools (30-day TTL)"}]},{"as":"bytes","function":"product","args":[{"field":"detail-runs"},{"field":"tools-per-run"},{"value":256}]}],"select":[{"field":"day"},{"field":"table"},{"field":"bytes"}]},{"name":"simulator-issue-size","subject":"Estimate retained issue table size at 512 bytes per issue on non-skipped runs.","objective":"Show modeled issue-record growth under the selected workload.","acceptance":"Issue size uses only non-skipped simulated runs and 512 bytes per issue over the retained period.","from":"simulator-database-inputs","compute":[{"as":"table","function":"literal","args":[{"value":"Issues (30-day TTL)"}]},{"as":"bytes","function":"product","args":[{"field":"detail-runs"},{"field":"issues-per-run"},{"value":512}]}],"select":[{"field":"day"},{"field":"table"},{"field":"bytes"}]},{"name":"simulator-database-size","subject":"Show modeled run-summary, tool, and issue table bytes after 30 days.","objective":"Compare hypothetical database table sizes at the end of the retention horizon.","acceptance":"The model presents separate summary, tool, and issue estimates after 30 simulated days, never observed storage.","description":"Run summaries accumulate; detailed records have a 30-day TTL.","from":"simulator-run-size","union":["simulator-tool-size","simulator-issue-size"],"filter":{"predicates":[{"field":"day","equals":30}]},"select":[{"field":"table"},{"field":"bytes"}]},{"name":"simulator-database-total","subject":"Sum the modeled table sizes after 30 days.","objective":"Show the final estimated size of the modeled database tables.","acceptance":"The final value is the sum of the three modeled table sizes after 30 days.","from":"simulator-database-size","compute":[{"as":"total-label","function":"literal","args":[{"value":"Total"}]}],"aggregate":{"by":["total-label"],"values":[{"field":"bytes","as":"bytes","reducer":"sum"}]},"select":[{"field":"total-label","as":"table"},{"field":"bytes"}]},{"name":"simulator-database-summary","subject":"List modeled table sizes and their final total after 30 days.","objective":"Present the 30-day estimate in a compact table.","acceptance":"Three modeled table sizes and their summed final value are shown without a growth chart.","from":"simulator-database-size","union":["simulator-database-total"]},{"name":"simulator-pr-inputs","subject":"Model company PR volume, AW fan-out and AI Credits from editable assumptions.","objective":"Compare hypothetical company sizes without launching workflows or claiming measured capacity.","acceptance":"Developers multiply PRs per developer per day, AW runs per PR and AIC per run; repositories divide averages only. Duration scales totals independently of the synthetic day source.","from":"simulation-days","parameters":[{"name":"company-repositories","type":"number"},{"name":"developers","type":"number"},{"name":"prs-per-developer-per-day","type":"number"},{"name":"aw-runs-per-pr","type":"number"},{"name":"days","type":"number"},{"name":"aic-per-run","type":"number"}],"filter":{"predicates":[{"field":"day","equals":1}]},"compute":[{"as":"daily-prs","function":"product","args":[{"parameter":"developers"},{"parameter":"prs-per-developer-per-day"}]},{"as":"daily-runs","function":"product","args":[{"field":"daily-prs"},{"parameter":"aw-runs-per-pr"}]},{"as":"daily-aic","function":"product","args":[{"field":"daily-runs"},{"parameter":"aic-per-run"}]},{"as":"total-prs","function":"product","args":[{"field":"daily-prs"},{"parameter":"days"}]},{"as":"total-runs","function":"product","args":[{"field":"daily-runs"},{"parameter":"days"}]},{"as":"total-aic","function":"product","args":[{"field":"daily-aic"},{"parameter":"days"}]},{"as":"prs-per-repo","function":"quotient","args":[{"field":"daily-prs"},{"parameter":"company-repositories"}]},{"as":"runs-per-repo","function":"quotient","args":[{"field":"daily-runs"},{"parameter":"company-repositories"}]},{"as":"runs-per-second","function":"quotient","args":[{"field":"daily-runs"},{"value":86400}]}]},{"name":"simulator-pr-counts","subject":"Show modeled daily and horizon pull request counts.","objective":"Separate developer activity from repository scope.","acceptance":"PR totals depend on developers and duration, not repository count.","from":"simulator-pr-inputs","compute":[{"as":"measure","function":"literal","args":[{"value":"Pull requests"}]}],"select":[{"field":"measure"},{"field":"daily-prs","as":"daily"},{"field":"total-prs","as":"total"}]},{"name":"simulator-pr-runs","subject":"Show modeled AW runs generated by pull requests.","objective":"Expose the selected AW fan-out.","acceptance":"Daily and horizon runs use the configured AW runs per PR.","from":"simulator-pr-inputs","compute":[{"as":"measure","function":"literal","args":[{"value":"AW runs"}]}],"select":[{"field":"measure"},{"field":"daily-runs","as":"daily"},{"field":"total-runs","as":"total"}]},{"name":"simulator-pr-aic","subject":"Show modeled AI Credits, not actual spending or currency.","objective":"Make the editable AIC-per-run assumption explicit.","acceptance":"AIC totals multiply modeled runs by AIC per AW run; no dollar conversion or budget enforcement is inferred.","from":"simulator-pr-inputs","compute":[{"as":"measure","function":"literal","args":[{"value":"AI Credits (AIC)"}]}],"select":[{"field":"measure"},{"field":"daily-aic","as":"daily"},{"field":"total-aic","as":"total"}]},{"name":"simulator-pr-summary","subject":"Compare daily and horizon PR, AW-run and AI Credit estimates.","objective":"Support side-effect-free company workload planning.","acceptance":"Exactly three modeled measures are shown and recompute from all six form inputs.","from":"simulator-pr-counts","union":["simulator-pr-runs","simulator-pr-aic"]},{"name":"overview-run-summary","subject":"Summarize successful, failed, and active runs with rollout-mode counts.","objective":"Expose observed success, failure, and active run counts, including active live and review modes, for the selected horizon.","acceptance":"Each count follows its declared conclusion, status, and rollout-mode filters; run success is not treated as a verified outcome, and incomplete or stale evidence is identified.","from":"overview-runs","aggregate":{"values":[{"field":"run-conclusion","as":"successful-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","equals":"success"}]}},{"field":"run-conclusion","as":"failed-runs","reducer":"count","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","stale","timed-out"]}]}},{"field":"run-status","as":"active-runs","reducer":"count","filter":{"predicates":[{"field":"run-status","in":["queued","in-progress","in_progress"]}]}},{"field":"run-status","as":"active-live","reducer":"count","filter":{"predicates":[{"field":"run-status","in":["queued","in-progress","in_progress"]},{"field":"rollout-mode","equals":"live"}]}},{"field":"run-status","as":"active-review","reducer":"count","filter":{"predicates":[{"field":"run-status","in":["queued","in-progress","in_progress"]},{"field":"rollout-mode","equals":"review"}]}}]}},{"name":"overview-delivery-summary","subject":"Count distinct target repositories with successful worker dispatch runs in the selected horizon.","objective":"Measure observed reach among registered repositories with successful dispatched worker runs.","acceptance":"Distinct delivered-repositories is limited to registered targets and successful workflow_dispatch worker runs in the selected horizon; it does not establish accepted delivery or authorized coverage.","from":"overview-runs","joins":[{"source":"repositories","type":"inner","on":[{"left":"target-repository","right":"repository-coordinate"}],"fields":[{"field":"repository-coordinate","as":"registered-target-repository"}]}],"filter":{"predicates":[{"field":"event","equals":"workflow_dispatch"},{"field":"run-conclusion","equals":"success"},{"field":"workflow-role","equals":"worker"}]},"aggregate":{"values":[{"field":"target-repository","as":"delivered-repositories","reducer":"distinct-count"}]}},{"name":"overview-value-summary","subject":"Count all observed grader results.","objective":"Identify whether any grader observations are available to the Overview status presentation.","acceptance":"The value-gains field counts observed grader records only; inspect each result's native measure, unit, direction, maturity, and uncertainty before claiming an outcome or improvement.","from":"grader-observations","aggregate":{"values":[{"field":"grader","as":"value-gains","reducer":"count"}]}},{"name":"overview-issue-summary","subject":"Count retained issue and pull request safe-output records for Overview.","objective":"Restore the issue and pull request counter with a link to its evidence inventory.","acceptance":"The count includes retained canonical issue and pull request records, not inferred outcomes; unavailable evidence remains unavailable.","from":"issues","aggregate":{"values":[{"field":"id","as":"value","reducer":"count"}]},"limit":1},{"name":"overview-issue-station","subject":"Present the retained issue and pull request count for Overview.","objective":"Provide a presentation-ready count and accessible evidence description.","acceptance":"The value matches overview-issue-summary and describes retained safe outputs, not accepted outcomes.","from":"overview-issue-summary","compute":[{"as":"detail","function":"concat","args":[{"value":"Retained safe"},{"value":" outputs"}]},{"as":"description","function":"concat","args":[{"field":"value"},{"value":" retained issues and pull requests"}]}],"limit":1},{"name":"overview-value-station","subject":"Present the observed grader-result count as the legacy Value gains counter.","objective":"Restore the Value gains counter while making its observation-count semantics explicit.","acceptance":"The count matches overview-value-summary, including zero; grader presence is not proof of improvement and unavailable evidence is not zero.","from":"overview-value-summary","compute":[{"as":"detail","function":"concat","args":[{"value":"Observed grader"},{"value":" results"}]},{"as":"description","function":"concat","args":[{"field":"value-gains"},{"value":" observed grader results, not verified improvements"}]}],"select":[{"field":"value-gains","as":"value"},{"field":"detail"},{"field":"description"}],"limit":1},{"name":"overview-run-status-input","subject":"Prepare the compact run summary for declarative factory status classification.","objective":"Carry successful-runs, failed-runs, and active-runs into the status join without changing their meaning.","acceptance":"The projected counts retain the selected horizon and match overview-run-summary; the join key is only a presentation key, not additional evidence.","from":"overview-run-summary","compute":[{"as":"status-join-key","function":"concat","args":[{"value":"factory"},{"value":"-status"}]}],"select":[{"field":"status-join-key"},{"field":"successful-runs"},{"field":"failed-runs"},{"field":"active-runs"}]},{"name":"overview-value-status-input","subject":"Prepare the compact value summary for declarative factory status classification.","objective":"Carry the grader-observation count into the optional status join.","acceptance":"The projected value-gains count matches overview-value-summary; a zero count does not establish complete grader coverage, and a nonzero count is not proof of gain.","from":"overview-value-summary","compute":[{"as":"status-join-key","function":"concat","args":[{"value":"factory"},{"value":"-status"}]}],"select":[{"field":"status-join-key"},{"field":"value-gains"}]},{"name":"overview-factory-status","subject":"Classify the factory heading from compact run and optional value evidence.","objective":"Provide a bounded Overview heading based on observed run counts and optional grader-record presence.","acceptance":"The heading matches the declared run-count and optional grader-presence branches; grader presence is not verified value, and the heading does not authorize any policy change.","from":"overview-run-status-input","joins":[{"source":"overview-value-status-input","type":"left","on":[{"left":"status-join-key","right":"status-join-key"}],"fields":[{"field":"value-gains","as":"value-gains"}]}],"compute":[{"as":"has-successful-runs","function":"greater-than","args":[{"field":"successful-runs"},{"value":0}]},{"as":"has-failed-runs","function":"greater-than","args":[{"field":"failed-runs"},{"value":0}]},{"as":"failures-exceed-successes","function":"greater-than","args":[{"field":"failed-runs"},{"field":"successful-runs"}]},{"as":"has-active-runs","function":"greater-than","args":[{"field":"active-runs"},{"value":0}]},{"as":"has-value-gains","function":"greater-than","args":[{"field":"value-gains"},{"value":0}]},{"as":"successful-heading","function":"if","args":[{"field":"has-successful-runs"},{"value":"Your factory is humming."},{"value":"Your factory is idle."}]},{"as":"attention-heading","function":"if","args":[{"field":"has-failed-runs"},{"value":"Your factory needs attention."},{"field":"successful-heading"}]},{"as":"strain-heading","function":"if","args":[{"field":"failures-exceed-successes"},{"value":"Your factory is under strain."},{"field":"attention-heading"}]},{"as":"active-heading","function":"if","args":[{"field":"has-active-runs"},{"value":"Your factory is humming."},{"field":"strain-heading"}]},{"as":"factory-heading","function":"if","args":[{"field":"has-value-gains"},{"value":"Your factory is delivering value."},{"field":"active-heading"}]}],"select":[{"field":"factory-heading"}]},{"name":"overview-registered-repository-summary","subject":"Count canonical repository identities registered in the resolved control-plane scope.","objective":"Provide the registered-repository denominator for observed worker reach.","acceptance":"The count reflects canonical repository records in the resolved scope; it is not evidence of live enrollment, successful execution, or full inventory completeness.","from":"repositories","aggregate":{"values":[{"field":"repository","as":"registered-repositories","reducer":"count"}]}},{"name":"overview-delivery-coverage-input","subject":"Prepare successful delivery totals for the repository coverage summary.","objective":"Carry the distinct delivered-repositories count into the coverage join.","acceptance":"The projected count equals overview-delivery-summary for the selected horizon; the join key adds no repository observations.","from":"overview-delivery-summary","compute":[{"as":"coverage-key","function":"concat","args":[{"value":"repository-coverage"},{"value":""}]}],"select":[{"field":"delivered-repositories"},{"field":"coverage-key"}]},{"name":"overview-registered-repository-coverage-input","subject":"Prepare registered repository totals for the repository coverage summary.","objective":"Carry the registered-repositories count into the coverage denominator join.","acceptance":"The projected count equals overview-registered-repository-summary for the resolved scope; missing inventory is not treated as zero eligible targets.","from":"overview-registered-repository-summary","compute":[{"as":"coverage-key","function":"concat","args":[{"value":"repository-coverage"},{"value":""}]}],"select":[{"field":"registered-repositories"},{"field":"coverage-key"}]},{"name":"overview-rhythm","subject":"Compare all workflow runs by weekday, layering this week over last week.","objective":"Show the observed weekday pattern across both calendar weeks, regardless of status or conclusion.","acceptance":"Verify weekday order, counts including unsuccessful and in-flight runs, and reached-day flags. Missing rhythm is unavailable, not zero activity; do not attribute changes to workflow improvements.","from":"overview-runs","time":{"range":"15d"},"compute":[{"as":"rhythm-point","function":"calendar-week-point","args":[{"field":"started-at"},{"context":"time-end"},{"value":true}]}],"aggregate":{"values":[{"field":"rhythm-point","as":"rhythm","reducer":"calendar-week-rhythm"}]}},{"name":"overview-repository-coverage-summary","subject":"Aggregate reached and total repositories across the resolved organization scope.","objective":"Pair observed reached-repositories and registered-repositories-total for a comparable coverage denominator.","acceptance":"Both totals come from their named input queries and share the resolved scope; verify the left-joined inventory source independently before interpreting a zero total, since a missing join can aggregate to zero.","from":"overview-delivery-coverage-input","joins":[{"source":"overview-registered-repository-coverage-input","type":"left","on":[{"left":"coverage-key","right":"coverage-key"}],"fields":[{"field":"registered-repositories","as":"registered-repositories-total"}]}],"aggregate":{"values":[{"field":"delivered-repositories","as":"reached-repositories","reducer":"sum"},{"field":"registered-repositories-total","as":"registered-repositories-total","reducer":"sum"}]}},{"name":"overview-repository-coverage","subject":"Measure registered repository reach from successful worker execution.","objective":"Present observed successful-worker repository reach as a ratio alongside numerator and denominator.","acceptance":"repository-coverage is reached-repositories divided by registered-repositories-total when available; preserve the counts and undefined denominator, and do not call reach successful outcomes.","from":"overview-repository-coverage-summary","compute":[{"as":"repository-coverage","function":"quotient","args":[{"field":"reached-repositories"},{"field":"registered-repositories-total"}]}],"select":[{"field":"repository-coverage"},{"field":"reached-repositories"},{"field":"registered-repositories-total"}]},{"name":"overview-workflow-health-groups","subject":"Assess current runtime failures for every workflow across CAO and targeted repositories.","objective":"Compute the latest consecutive completed-run failure streak for each repository-scoped workflow without requiring campaign membership.","acceptance":"Group by organization, repository, and workflow; in-flight retries do not clear failures, and later non-failing completed runs reset the streak within the selected horizon.","from":"overview-runs","filter":{"predicates":[{"field":"run-status","equals":"completed"}]},"compute":[{"as":"is-runtime-failure","function":"equals-any","args":[{"field":"run-conclusion"},{"value":"failure"},{"value":"startup-failure"},{"value":"stale"},{"value":"timed-out"}]},{"as":"runtime-failure-streak-point","function":"failure-streak-point","args":[{"field":"started-at"},{"field":"run"},{"field":"is-runtime-failure"}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"runtime-failure-streak-point","as":"failure-count","reducer":"latest-failure-streak"}]}},{"name":"overview-workflow-health-summary","subject":"Count all registered workflows and those without current observed runtime failures.","objective":"Provide Factory health numerator and denominator across CAO and targeted repositories, including standalone and campaign workflows.","acceptance":"Each repository-scoped workflow counts once regardless of campaign or role; no retained failure is not proof of successful execution, missing inventory remains unavailable, and missing run evidence marks the result incomplete.","from":"workflows","joins":[{"source":"overview-workflow-health-groups","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"failure-count","as":"observed-failures"}]}],"compute":[{"as":"normalized-failures","function":"coalesce","args":[{"field":"observed-failures"},{"value":0}]},{"as":"problem-present","function":"greater-than","args":[{"field":"normalized-failures"},{"value":0}]}],"aggregate":{"values":[{"field":"workflow","as":"workflows","reducer":"count"},{"field":"workflow","as":"healthy-workflows","reducer":"count","filter":{"predicates":[{"field":"problem-present","equals":false}]}}]}},{"name":"overview-workflow-health-presentation-input","subject":"Prepare all-workflow health counts for Overview presentation.","objective":"Carry Factory health counts into the header and station presentation.","acceptance":"Both counts match overview-workflow-health-summary and preserve missing evidence metadata.","from":"overview-workflow-health-summary","compute":[{"as":"overview-presentation-key","function":"concat","args":[{"value":"overview"},{"value":"-presentation"}]}],"select":[{"field":"overview-presentation-key"},{"field":"workflows"},{"field":"healthy-workflows"}]},{"name":"overview-factory-health-presentation","subject":"Produce presentation-ready Factory health values for the Overview header and floor.","objective":"Display the ratio of workflows without current observed runtime failures to all registered workflows with both underlying counts.","acceptance":"The percentage and detail agree with healthy-workflows and workflows; a missing or zero denominator remains unavailable, and the ratio is not proof of impact.","from":"overview-workflow-health-presentation-input","compute":[{"as":"factory-health","function":"quotient","args":[{"field":"healthy-workflows"},{"field":"workflows"}]},{"as":"factory-health-display","function":"format-percent","args":[{"field":"factory-health"}]},{"as":"healthy-workflows-display","function":"format-count","args":[{"field":"healthy-workflows"}]},{"as":"workflows-display","function":"format-count","args":[{"field":"workflows"}]},{"as":"factory-health-detail","function":"concat","args":[{"field":"healthy-workflows-display"},{"value":"/"},{"field":"workflows-display"},{"value":" healthy workflows"}]},{"as":"factory-health-description","function":"concat","args":[{"field":"factory-health-display"},{"value":" factory health"}]}],"select":[{"field":"overview-presentation-key"},{"field":"factory-health"},{"field":"factory-health-display"},{"field":"factory-health-detail"},{"field":"factory-health-description"}]},{"name":"overview-header-status-presentation-input","subject":"Prepare the factory status heading for the declarative Overview header.","objective":"Carry the factory heading into the Overview header join unchanged.","acceptance":"The heading matches overview-factory-status; the presentation key does not imply additional evidence or a policy recommendation.","from":"overview-factory-status","compute":[{"as":"overview-presentation-key","function":"concat","args":[{"value":"overview"},{"value":"-presentation"}]}],"select":[{"field":"overview-presentation-key"},{"field":"factory-heading"}]},{"name":"overview-header-presentation","subject":"Resolve the Overview heading from declarative status and factory-health evidence.","objective":"Display the configured heading corresponding to observed run status and factory health.","acceptance":"The selected heading follows the declared presentation branches; numeric branch boundaries are UI classification only, not operational targets or rollout thresholds.","from":"overview-header-status-presentation-input","joins":[{"source":"overview-factory-health-presentation","type":"left","on":[{"left":"overview-presentation-key","right":"overview-presentation-key"}],"fields":[{"field":"factory-health","as":"factory-health"}]}],"compute":[{"as":"factory-health-positive","function":"greater-than","args":[{"field":"factory-health"},{"value":0}]},{"as":"factory-health-below-threshold","function":"greater-than","args":[{"value":0.66},{"field":"factory-health"}]},{"as":"positive-factory-health-heading","function":"if","args":[{"field":"factory-health-below-threshold"},{"value":"Your factory needs attention."},{"field":"factory-heading"}]},{"as":"heading","function":"if","args":[{"field":"factory-health-positive"},{"field":"positive-factory-health-heading"},{"field":"factory-heading"}]}],"select":[{"field":"heading"}]},{"name":"overview-run-motion-presentation-input","subject":"Prepare active run state for Overview station presentation.","objective":"Expose whether at least one queued or in-progress run was observed for station display.","acceptance":"active reflects overview-run-summary's active-runs count; no observed active run does not prove the fleet is idle when the snapshot is incomplete.","from":"overview-run-summary","compute":[{"as":"overview-presentation-key","function":"concat","args":[{"value":"overview"},{"value":"-presentation"}]},{"as":"active","function":"greater-than","args":[{"field":"active-runs"},{"value":0}]}],"select":[{"field":"overview-presentation-key"},{"field":"active"}]},{"name":"overview-factory-station","subject":"Provide the presentation-ready Factory health station for Overview.","objective":"Show the all-workflow runtime health ratio, supporting counts, and observed run motion together.","acceptance":"Station value, display, detail, description, and active flag match their input queries; neither absence of failures nor run motion is verified workflow effectiveness.","from":"overview-factory-health-presentation","joins":[{"source":"overview-run-motion-presentation-input","type":"left","on":[{"left":"overview-presentation-key","right":"overview-presentation-key"}],"fields":[{"field":"active","as":"active"}]}],"select":[{"field":"factory-health","as":"value"},{"field":"factory-health-display","as":"display-value"},{"field":"factory-health-detail","as":"detail"},{"field":"factory-health-description","as":"description"},{"field":"active"}]},{"name":"overview-repository-station-presentation-input","subject":"Prepare repository coverage for the presentation-ready Overview station.","objective":"Format repository reach with its reached and registered counts for the station.","acceptance":"The percentage and detail preserve overview-repository-coverage's numerator and denominator; unavailable coverage remains unavailable, not zero or complete reach.","from":"overview-repository-coverage","compute":[{"as":"overview-presentation-key","function":"concat","args":[{"value":"overview"},{"value":"-presentation"}]},{"as":"display-value","function":"format-percent","args":[{"field":"repository-coverage"}]},{"as":"reached-repositories-display","function":"format-count","args":[{"field":"reached-repositories"}]},{"as":"registered-repositories-display","function":"format-count","args":[{"field":"registered-repositories-total"}]},{"as":"detail","function":"concat","args":[{"field":"reached-repositories-display"},{"value":"/"},{"field":"registered-repositories-display"},{"value":" repositories reached"}]},{"as":"description","function":"concat","args":[{"field":"display-value"},{"value":" average repository coverage"}]}],"select":[{"field":"overview-presentation-key"},{"field":"repository-coverage","as":"value"},{"field":"display-value"},{"field":"detail"},{"field":"description"}]},{"name":"overview-repository-station","subject":"Provide the presentation-ready repository coverage station for Overview.","objective":"Show observed registered-repository worker reach and run motion in one station.","acceptance":"Value and formatted evidence match the coverage presentation input, and active matches run motion; neither changes policy or establishes accepted outcomes.","from":"overview-repository-station-presentation-input","joins":[{"source":"overview-run-motion-presentation-input","type":"left","on":[{"left":"overview-presentation-key","right":"overview-presentation-key"}],"fields":[{"field":"active","as":"active"}]}],"select":[{"field":"value"},{"field":"display-value"},{"field":"detail"},{"field":"description"},{"field":"active"}]},{"name":"cost-by-repository","subject":"Present observed AI Credit cost grouped by repository.","objective":"Locate repositories with higher observed AI Credit totals for evidence-led investigation.","acceptance":"Each repository coordinate and native aic total agrees with repository-aic-totals; confirm the selected horizon and underlying runs before attributing cost or proposing a change.","from":"repository-aic-totals","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository-coordinate"}]},{"as":"repository-dashboard-href","function":"concat","args":[{"value":"#page-repository-detail?repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"repository-coordinate"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository-coordinate"}]}],"select":[{"field":"repository-coordinate"},{"field":"repository-dashboard-link"},{"field":"aic"}],"order-by":[{"field":"aic","direction":"desc"}]},{"name":"cost-by-workflow","subject":"Present observed AI Credit cost grouped by repository-owned workflow.","objective":"Locate repository workflows with higher observed AI Credit totals and open their workflow evidence.","acceptance":"Workflow identity, link, and native aic total match workflow-aic-totals in descending order; cost alone does not establish waste, quality, or value.","from":"workflow-aic-totals","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-coordinate"}]}],"select":[{"field":"repository-coordinate"},{"field":"workflow"},{"field":"workflow-coordinate"},{"field":"workflow-dashboard-link"},{"field":"aic"}],"order-by":[{"field":"aic","direction":"desc"}]},{"name":"cost-per-workflow-run","subject":"Present the average observed AI Credit cost of a single run for each repository-owned workflow.","objective":"Compare observed AI Credit per run across repository workflows with each observed-runs denominator.","acceptance":"Include only workflows with positive-AIC run attempts, and use only those attempts in cost averages; observed-runs still counts all retained attempts.","description":"Observed AI Credit totals divided by positive-AIC run attempts for each declared workflow.","from":"workflow-aic-run-totals","filter":{"predicates":[{"field":"aic-runs","gte":1}]},"compute":[{"as":"aic-per-run","function":"quotient","args":[{"field":"aic"},{"field":"aic-runs"}]},{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"workflow-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"encoded-workflow","function":"url-encode","args":[{"field":"workflow-coordinate"}]},{"as":"workflow-dashboard-href","function":"concat","args":[{"value":"#page-workflow-runtime?workflow="},{"field":"encoded-workflow"}]},{"as":"workflow-dashboard-label","function":"concat","args":[{"value":"View "},{"field":"workflow-coordinate"},{"value":" workflow dashboard"}]},{"as":"workflow-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"workflow-dashboard-href"},{"field":"workflow-dashboard-label"},{"field":"workflow-coordinate"}]}],"select":[{"field":"repository-coordinate"},{"field":"workflow"},{"field":"workflow-coordinate"},{"field":"workflow-dashboard-link"},{"field":"runs","as":"observed-runs"},{"field":"aic-per-run"}],"order-by":[{"field":"aic-per-run","direction":"desc"}]},{"name":"failure-run-base","subject":"Select retained runs with failure, startup-failure, stale, or timed-out conclusions for the failed-run ledger and streak inputs.","objective":"Provide one consistent failure-conclusion evidence set to downstream Overview queries.","acceptance":"Each selected run has one of the four declared conclusions within the selected horizon; other conclusions remain outside this set, and missing run coverage is not interpreted as no failures.","from":"runs","filter":{"predicates":[{"field":"run-conclusion","in":["failure","startup-failure","stale","timed-out"]}]}},{"name":"failed-runs","subject":"List failed workflow runs that need operator attention.","objective":"Give operators the most recent observed failed runs to inspect in GitHub.","acceptance":"Unprojected run rows retain available conclusion, started-at, and run evidence fields in descending started-at order; inspect source logs and missing links before attributing a cause or declaring resolution.","from":"failure-run-base","order-by":[{"field":"started-at","direction":"desc"}]},{"name":"overview-failing-runs","subject":"Identify failed runs in the selected snapshot horizon so subsequent streak logic can use the same declarative failure definition.","objective":"Project distinct failure-run counts by organization, repository, workflow, and run for streak joins.","acceptance":"Each grouped run identity has a failing-runs count derived from failure-run-base in the selected horizon; this stage does not assert a consecutive streak or require action.","from":"failure-run-base","aggregate":{"by":["organization","repository","workflow","run"],"values":[{"field":"run","as":"failing-runs","reducer":"distinct-count"}]}},{"name":"overview-failing-workflows","subject":"Identify only workflows that have at least one failed run in the selected snapshot horizon before computing streaks.","objective":"Provide workflow identities with observed failed runs for the streak computation.","acceptance":"Each organization/repository/workflow group has a distinct failing-runs count from overview-failing-runs; the count covers observed failures, not the latest consecutive streak.","from":"overview-failing-runs","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run","as":"failing-runs","reducer":"distinct-count"}]}},{"name":"overview-repeated-failure-groups","subject":"Group each workflow's latest consecutive failing run sequence in the selected snapshot horizon, resetting the group after any successful run.","objective":"Project the latest observed consecutive failure-count per workflow for downstream blocked-work matching.","acceptance":"failure-count follows run ordering and the declared latest-failure-streak reducer, with non-failing runs breaking the streak; missing earlier runs or incomplete snapshots limit the observed sequence.","from":"runs","joins":[{"source":"overview-failing-workflows","type":"inner","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"failing-runs","as":"failing-runs"}]},{"source":"overview-failing-runs","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"},{"left":"run","right":"run"}],"fields":[{"field":"failing-runs","as":"run-failing-count"}]}],"compute":[{"as":"failure-streak-point","function":"failure-streak-point","args":[{"field":"started-at"},{"field":"run"},{"field":"run-failing-count"}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"failure-streak-point","as":"failure-count","reducer":"latest-failure-streak"}]}},{"name":"overview-repeated-failure-candidates","subject":"Attach selected-horizon failure counts to each workflow's latest canonical work item.","objective":"Pair blocked work items with observed workflow failure streaks and retained run evidence before attention filtering.","acceptance":"Candidates are filtered to blocked items with a matching organization/repository/workflow streak; is-repeated reflects failure-count greater than one, while selected evidence-link and run-link can be absent or refer to the work item rather than the latest failed run.","from":"work-items","joins":[{"source":"overview-repeated-failure-groups","type":"inner","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"failure-count","as":"failure-count"}]}],"filter":{"predicates":[{"field":"lifecycle-state","equals":"blocked"}]},"compute":[{"as":"is-repeated","function":"greater-than","args":[{"field":"failure-count"},{"value":1}]},{"as":"attention-signal-id","function":"concat","args":[{"value":"repeated-failure:"},{"field":"organization"},{"value":"/"},{"field":"repository"},{"value":":"},{"field":"workflow"}]},{"as":"kind","function":"coalesce","args":[{"value":"Repeated workflow failures"},{"value":"Repeated workflow failures"}]},{"as":"title","function":"coalesce","args":[{"field":"workflow"},{"value":"Workflow"}]},{"as":"attention-reason","function":"concat","args":[{"field":"failure-count"},{"value":" failed runs in the selected horizon"}]},{"as":"action","function":"coalesce","args":[{"value":"Open latest failed run on GitHub"},{"value":"Open latest failed run on GitHub"}]},{"as":"icon","function":"coalesce","args":[{"value":"x-circle"},{"value":"x-circle"}]},{"as":"tone","function":"coalesce","args":[{"value":"critical"},{"value":"critical"}]},{"as":"priority","function":"number","args":[{"value":0}]}],"select":[{"field":"is-repeated"},{"field":"attention-signal-id"},{"field":"kind"},{"field":"title"},{"field":"scope"},{"field":"attention-reason","as":"reason"},{"field":"observed-at"},{"field":"action"},{"field":"evidence-link"},{"field":"run-link"},{"field":"icon"},{"field":"tone"},{"field":"priority"},{"field":"failure-count"}]},{"name":"overview-repeated-failure-attention","subject":"Keep only unresolved workflows with two or more failures in the selected horizon.","objective":"Surface blocked workflow items with observed repeated failures for bounded run investigation.","acceptance":"Every row inherits a blocked item with is-repeated true and projects evidence-link and run-link when available; verify run order, links, and current state before treating the failure as still unresolved.","from":"overview-repeated-failure-candidates","filter":{"predicates":[{"field":"is-repeated","equals":true}]},"select":[{"field":"attention-signal-id"},{"field":"kind"},{"field":"title"},{"field":"scope"},{"field":"reason"},{"field":"observed-at"},{"field":"action"},{"field":"evidence-link"},{"field":"run-link"},{"field":"icon"},{"field":"tone"},{"field":"priority"},{"field":"failure-count"}]},{"name":"overview-review-attention","subject":"Select only unresolved outputs explicitly awaiting human review with their retained GitHub evidence destination.","objective":"Present review-state work items and their retained GitHub destination to a human reviewer.","acceptance":"Rows are filtered to lifecycle-state review and project the work-item ID as attention-signal-id, plus reason, evidence-link, and run-link where present; reviewer disposition must be checked at source.","from":"work-items","filter":{"predicates":[{"field":"lifecycle-state","equals":"review"}]},"compute":[{"as":"kind","function":"coalesce","args":[{"value":"Human review required"},{"value":"Human review required"}]},{"as":"title","function":"coalesce","args":[{"field":"objective"},{"value":"Produced output"}]},{"as":"action","function":"coalesce","args":[{"value":"Open review item on GitHub"},{"value":"Open review item on GitHub"}]},{"as":"icon","function":"coalesce","args":[{"value":"eye"},{"value":"eye"}]},{"as":"tone","function":"coalesce","args":[{"value":"action"},{"value":"action"}]},{"as":"priority","function":"number","args":[{"value":1}]}],"select":[{"field":"work-item-id","as":"attention-signal-id"},{"field":"kind"},{"field":"title"},{"field":"scope"},{"field":"reason"},{"field":"observed-at"},{"field":"action"},{"field":"evidence-link"},{"field":"run-link"},{"field":"icon"},{"field":"tone"},{"field":"priority"}]},{"name":"overview-needs-attention","subject":"Combine grouped repeated failures and unresolved review outputs without introducing ordinary activity or duplicate work items.","objective":"Prioritize observed blocked repeated-failure work and review-state outputs for investigation.","acceptance":"Rows come only from the repeated-failure or review inputs and retain their source reasons, links, and ordering; confirm fresh source status before acting, and do not equate a missing row with resolved work.","from":"overview-repeated-failure-attention","union":["overview-review-attention"],"order-by":[{"field":"priority","direction":"asc"},{"field":"observed-at","direction":"desc"},{"field":"attention-signal-id","direction":"asc"}]},{"name":"domain-route-record","subject":"Project the selected domain header and one retained run link.","objective":"Identify the selected domain and open a retained run before investigating its traffic evidence.","acceptance":"The route header preserves the selected domain and a run link from its retained observations; missing observations or links remain unavailable, and a header does not establish access policy or traffic completeness.","from":"domains","select":[{"field":"domain"},{"field":"run-link"}]},{"name":"domain-run-records","subject":"Retained run-linked observations for the selected domain.","objective":"Find related runs without returning the unscoped domain collection alongside the paginated view.","acceptance":"Preserve every domain observation field, exact route scope, filtering, ordering, total count, provenance and related-run links; only the bounded view payload crosses the worker boundary.","from":"domains"},{"name":"tool-route-record","subject":"Project the selected MCP tool header and one retained run link.","objective":"Identify the selected MCP tool and open a retained run before investigating its call evidence.","acceptance":"The route header preserves the selected MCP tool label and a run link from its retained calls; absent calls or links remain unavailable and do not imply zero usage or tool effectiveness.","from":"mcp-tool-calls","select":[{"field":"mcp-tool-label"},{"field":"run-link"}]},{"name":"audit-route-record","subject":"Project the selected audit summary header and one retained run link.","objective":"Identify the selected audit summary and open a retained run before investigating its observations.","acceptance":"The route header preserves the selected event summary and a run link from its retained audit observations; absent evidence remains unavailable and neither the header nor its absence establishes incident severity or a clean audit.","from":"audits","select":[{"field":"event-summary"},{"field":"run-link"}]},{"name":"domain-entity-insights","subject":"Summarize one domain entity for its dedicated Insights view.","objective":"Identify domain decisions with request volume worth investigating before considering any egress change.","acceptance":"For the selected domain, request totals match the retained domain observations grouped by decision; missing data or blocked traffic does not establish a need for access, which requires underlying request and policy review.","from":"domains","aggregate":{"by":["domain","decision"],"values":[{"field":"request-count","as":"requests","reducer":"sum"}]},"order-by":[{"field":"requests","direction":"desc"},{"field":"decision","direction":"asc"}]},{"name":"tool-entity-insights","subject":"Summarize one tool entity for its dedicated Insights view.","objective":"Select a tool and status combination whose recorded call volume merits investigation.","acceptance":"For the selected tool, observation counts match retained MCP call observations grouped by server, tool, and status; missing calls are not zero usage and status counts do not establish effectiveness or cause.","from":"mcp-tool-calls","aggregate":{"by":["mcp-tool-label","mcp-server","mcp-tool","mcp-status"],"values":[{"field":"mcp-observation","as":"observations","reducer":"count"}]},"order-by":[{"field":"observations","direction":"desc"},{"field":"mcp-status","direction":"asc"}]},{"name":"audit-entity-insights","subject":"Summarize one audit event entity for its dedicated Insights view.","objective":"Select an audit summary and status requiring closer review of underlying observations.","acceptance":"For the selected summary, counts agree with retained audit observation IDs grouped by event status; repeated observations are not silently treated as distinct incidents, and absence does not prove no findings.","from":"audits","aggregate":{"by":["event-summary","event-status"],"values":[{"field":"id","as":"observations","reducer":"count"}]},"order-by":[{"field":"observations","direction":"desc"},{"field":"event-status","direction":"asc"}]}] diff --git a/dashboard/site/test/fixtures/pull-request-simulator-contract.json b/dashboard/site/test/fixtures/pull-request-simulator-contract.json index d913391f6d..9876d7c9a7 100644 --- a/dashboard/site/test/fixtures/pull-request-simulator-contract.json +++ b/dashboard/site/test/fixtures/pull-request-simulator-contract.json @@ -5,7 +5,7 @@ "query": "simulator-pr-summary", "fields": ["measure", "daily", "total"], "defaults": { - "repositories": 10000, + "company-repositories": 10000, "developers": 10000, "prs-per-developer-per-day": 10, "aw-runs-per-pr": 5, diff --git a/dashboard/site/test/unit/pull-request-simulator.test.js b/dashboard/site/test/unit/pull-request-simulator.test.js index c7a725f2d2..703748dd99 100644 --- a/dashboard/site/test/unit/pull-request-simulator.test.js +++ b/dashboard/site/test/unit/pull-request-simulator.test.js @@ -41,7 +41,7 @@ describe('Pull request simulator', () => { .toEqual(contract.fields); expect(dashboardFormDefaultValues(page.form)).toEqual(contract.defaults); expect(contract.defaults).toEqual({ - repositories: large.repositories, developers: large.developers, + 'company-repositories': large.repositories, developers: large.developers, 'prs-per-developer-per-day': large.prsPerDeveloperPerDay, 'aw-runs-per-pr': large.awRunsPerPR, days: large.days, 'aic-per-run': large.aicPerRun }); @@ -63,7 +63,7 @@ describe('Pull request simulator', () => { it('recomputes all inputs and does not multiply volume by repository count', async () => { const values = { - repositories: 7, developers: 3, 'prs-per-developer-per-day': 2, + 'company-repositories': 7, developers: 3, 'prs-per-developer-per-day': 2, 'aw-runs-per-pr': 4, days: 31, 'aic-per-run': 0.25 }; const rows = await project(values); @@ -72,7 +72,7 @@ describe('Pull request simulator', () => { { measure: 'AW runs', daily: 24, total: 744 }, { measure: 'AI Credits (AIC)', daily: 6, total: 186 } ]); - expect(await project({ ...values, repositories: 1 })).toEqual(rows); + expect(await project({ ...values, 'company-repositories': 1 })).toEqual(rows); const [averages] = await project(values, 'simulator-pr-averages'); expect(averages['prs-per-repo']).toBeCloseTo(6 / 7); expect(averages['runs-per-repo']).toBeCloseTo(24 / 7); diff --git a/scripts/run-unit-area.mjs b/scripts/run-unit-area.mjs index 4d510c812b..23901b6e69 100644 --- a/scripts/run-unit-area.mjs +++ b/scripts/run-unit-area.mjs @@ -19,7 +19,7 @@ export const unitTestAreas = { /^eslint-rules-/, /^actions-context\./, /^actions-runtime\./, /^agent-plugin\./, /^install-script\./, /^installer-canary\./, /^repository-/, /^no-hardcoded-github-actions-url\./, /^token-optimization-data-contract\./, /^unit-area-selection\./, - /^backfill-stress-report\./, /^source-map-compat\./, + /^backfill-stress-report\./, /^company-stress\./, /^source-map-compat\./, /^maintainer-simulation\./, /^(?:native-value-import|value-session-archive)\./, ], diff --git a/server/internal/server/company_calculator_test.go b/server/internal/server/company_calculator_test.go index bd88c708c9..27bd3196af 100644 --- a/server/internal/server/company_calculator_test.go +++ b/server/internal/server/company_calculator_test.go @@ -27,7 +27,7 @@ func assertCompanyCalculator(t *testing.T, ctx context.Context, local *httptest. t.Fatal(err) } parameters := map[string]any{ - "repositories": company.Repositories, "developers": company.Developers, + "company-repositories": company.Repositories, "developers": company.Developers, "prs-per-developer-per-day": company.PRsPerDeveloperPerDay, "aw-runs-per-pr": company.AWRunsPerPR, "days": company.Days, "aic-per-run": company.AICPerRun, } diff --git a/tests/unit/dashboard-benchmark-queries.test.mjs b/tests/unit/dashboard-benchmark-queries.test.mjs index f0cd0be7bf..654c0e1be0 100644 --- a/tests/unit/dashboard-benchmark-queries.test.mjs +++ b/tests/unit/dashboard-benchmark-queries.test.mjs @@ -60,4 +60,8 @@ test("every deployed benchmark query has resolved operands", () => { const routing = queries.find(({ name }) => name === "routing-filter-candidates"); assert.ok(routing); assert.deepEqual(routing.compute.find(({ as }) => as === "all-workflows").args[0], { value: "" }); + const database = queries.find(({ name }) => name === "simulator-database-inputs"); + assert.deepEqual(database.compute.find(({ as }) => as === "runs-daily").args[0], { value: 1000 }); + const company = queries.find(({ name }) => name === "simulator-pr-inputs"); + assert.deepEqual(company.compute.find(({ as }) => as === "prs-per-repo").args[1], { value: 10000 }); }); diff --git a/tests/unit/unit-area-selection.test.mjs b/tests/unit/unit-area-selection.test.mjs index 07fe7b2169..17609606c5 100644 --- a/tests/unit/unit-area-selection.test.mjs +++ b/tests/unit/unit-area-selection.test.mjs @@ -13,6 +13,7 @@ test("every root unit test runs in exactly one topical area", () => { assert.ok(partition.documentation.includes("docs-workflow-ecosystem-layout.test.mjs")); assert.ok(partition.tooling.includes("azure-local-harness.test.mjs")); assert.ok(partition.tooling.includes("backfill-stress-report.test.mjs")); + assert.ok(partition.tooling.includes("company-stress.test.mjs")); assert.ok(partition.tooling.includes("source-map-compat.test.mjs")); assert.ok(partition.tooling.includes("installer-canary.test.mjs")); assert.ok(partition.tooling.includes("maintainer-simulation.test.mjs")); From 6b2d92c7ccc7644c826898568bc66d53ad32cc4a Mon Sep 17 00:00:00 2001 From: Peli de Halleux <4175913+pelikhan@users.noreply.github.com> Date: Fri, 30 Oct 2026 07:10:16 -0700 Subject: [PATCH 5/5] Fix company simulator lint findings Use root-confined fixture and generated-evidence reads and compare cancellation errors with errors.Is. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- server/internal/simulator/company_test.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/server/internal/simulator/company_test.go b/server/internal/simulator/company_test.go index 09c0d46b99..d3d89ebab9 100644 --- a/server/internal/simulator/company_test.go +++ b/server/internal/simulator/company_test.go @@ -4,8 +4,8 @@ import ( "bufio" "context" "encoding/json" + "errors" "os" - "path/filepath" "reflect" "strings" "testing" @@ -14,7 +14,12 @@ import ( func companyFixture(t *testing.T, name string) Company { t.Helper() - data, err := os.ReadFile("../../../tests/fixtures/company-stress/" + name + ".json") + root, err := os.OpenRoot("../../../tests/fixtures/company-stress") + if err != nil { + t.Fatal(err) + } + defer func() { _ = root.Close() }() + data, err := root.ReadFile(name + ".json") if err != nil { t.Fatal(err) } @@ -90,7 +95,12 @@ func TestCompanyEvidence(t *testing.T) { if err != nil || totals.PRs != 60 || totals.Runs != 300 || totals.AIC != 30_000 { t.Fatalf("totals: %+v %v", totals, err) } - data, err := os.ReadFile(filepath.Join(directory, "gh-aw-logs-runs/synthetic.jsonl")) + root, err := os.OpenRoot(directory) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = root.Close() }) + data, err := root.ReadFile("gh-aw-logs-runs/synthetic.jsonl") if err != nil { t.Fatal(err) } @@ -160,7 +170,7 @@ func TestCompanyZeroVolumeAndCancellation(t *testing.T) { } ctx, cancel := context.WithCancel(t.Context()) cancel() - if _, err := companyFixture(t, "small").WriteLake(ctx, t.TempDir(), time.Now()); err != context.Canceled { + if _, err := companyFixture(t, "small").WriteLake(ctx, t.TempDir(), time.Now()); !errors.Is(err, context.Canceled) { t.Fatalf("canceled generation: %v", err) } }