diff --git a/dashboard/site/dashboard-fragments/entities.json b/dashboard/site/dashboard-fragments/entities.json index 5cea7eb26b..d8d10abb85 100644 --- a/dashboard/site/dashboard-fragments/entities.json +++ b/dashboard/site/dashboard-fragments/entities.json @@ -8,6 +8,13 @@ "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.", @@ -262,7 +269,7 @@ "title": "Related runs", "description": "Run records related to this domain.", "data": { - "source": "domains", + "source": "domain-run-records", "arguments": [ { "name": "domain", diff --git a/dashboard/site/src/agent/catalog.generated.json b/dashboard/site/src/agent/catalog.generated.json index c0049fb17c..79c8651434 100644 --- a/dashboard/site/src/agent/catalog.generated.json +++ b/dashboard/site/src/agent/catalog.generated.json @@ -1411,7 +1411,8 @@ } ], "queries": [ - "domain-route-record" + "domain-route-record", + "domain-run-records" ] }, { @@ -14902,6 +14903,32 @@ ] } }, + { + "id": "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.", + "description": "", + "parameters": [ + { + "name": "domain", + "field": "domain" + } + ], + "sources": [ + "domains" + ], + "used-by-pages": [ + "domain-runs" + ], + "execution": { + "local": true, + "backend": "sqlite", + "requirements": [ + "domains" + ] + } + }, { "id": "tool-route-record", "subject": "Project the selected MCP tool header and one retained run link.", diff --git a/dashboard/site/src/agent/queries.generated.json b/dashboard/site/src/agent/queries.generated.json index 92402d9975..a500a82798 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-workflow-import-evidence","subject":"Summarize retained import evidence at workflow grain for campaign inventory quality.","objective":"Preserve import-evidence provenance without materializing per-run ingestion indicators.","acceptance":"Compose all four retained event sources with the same availability, freshness, and completeness as event-runs; counts describe retained records, not executions or outcomes.","from":"audit-event-runs","union":["domain-event-runs","tool-event-runs","issue-event-runs"],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"events","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":"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":"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":"The import-evidence join preserves inventory provenance without per-run ingestion indicators. It follows run aggregation so unavailable run evidence retains the original failure-quality semantics.","from":"campaign-workflow-execution-base","joins":[{"source":"campaign-workflow-import-evidence","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"events","as":"imported-events"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"runs"},{"field":"aic"}]},{"name":"campaign-workflow-inventory","subject":"Project declared campaign workflows with lean execution and configuration evidence.","objective":"Provide campaign totals and lists without unused ingestion, failure, or dashboard-link computations.","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":"workflows","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"}]}],"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":"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"}],"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-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 recorded installed/current version lists plus upgrade-required and unknown flags; inspect absent or mixed version evidence rather than inferring a repository-wide installed version.","from":"workflows","filter":{"predicates":[{"field":"workflow","includes":".md"}]},"compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"update-available","function":"equals-any","args":[{"field":"gh-aw-update-state"},{"value":"update-available"}]},{"as":"upgrade-state-unknown","function":"equals-any","args":[{"field":"gh-aw-update-state"},{"value":"unknown"}]},{"as":"upgrade-state-unknown-value","function":"if","args":[{"field":"upgrade-state-unknown"},{"value":1},{"value":0}]},{"as":"upgrade-required-value","function":"if","args":[{"field":"update-available"},{"value":1},{"value":0}]}],"aggregate":{"by":["repository-coordinate"],"values":[{"field":"gh-aw-version","as":"gh-aw-version","reducer":"distinct-list"},{"field":"gh-aw-current-version","as":"gh-aw-current-version","reducer":"distinct-list"},{"field":"upgrade-required-value","as":"upgrade-required","reducer":"max"},{"field":"upgrade-state-unknown-value","as":"upgrade-state-unknown","reducer":"max"}]}},{"name":"maintenance-repositories","subject":"List each repository with recorded compiler versions and computed upgrade state.","objective":"Expose recorded compiler versions and computed upgrade state per repository, with its GitHub home URL for inspection.","acceptance":"Return repository, repository-url, version lists, upgrade-required, upgrade-state, and upgrade-action-visible. Show Upgrade for outdated or unknown evidence; hide it for known-current repositories. Visibility grants no rollout authority.","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-unavailable","function":"equals-any","args":[{"field":"gh-aw-version"},{"value":""},{"value":"unknown"}]},{"as":"compiler-versions-match","function":"equals-any","args":[{"field":"gh-aw-version"},{"field":"gh-aw-current-version"}]},{"as":"known-current-versions","function":"if","args":[{"field":"installed-version-unavailable"},{"value":false},{"field":"compiler-versions-match"}]},{"as":"upgrade-status-unavailable","function":"if","args":[{"field":"known-current-versions"},{"value":false},{"value":true}]},{"as":"current-or-unavailable","function":"if","args":[{"field":"upgrade-status-unavailable"},{"value":"Upgrade status unavailable"},{"value":"Current"}]},{"as":"upgrade-action-visible","function":"if","args":[{"field":"should-upgrade"},{"value":true},{"field":"upgrade-status-unavailable"}]},{"as":"upgrade-state","function":"if","args":[{"field":"should-upgrade"},{"value":"Upgrade recommended"},{"field":"current-or-unavailable"}]}],"select":[{"field":"repository-coordinate","as":"repository"},{"field":"repository-url"},{"field":"gh-aw-version"},{"field":"gh-aw-current-version"},{"field":"upgrade-required"},{"field":"upgrade-action-visible"},{"field":"upgrade-state"}],"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":"campaigns","filter":{"predicates":[{"field":"campaign-update-state","equals":"update-available"}]},"select":[{"field":"campaign-update-state"}],"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-required row only when the retained value is 1; no row does not establish that all repositories are current when version data is missing.","from":"maintenance-repositories","filter":{"predicates":[{"field":"upgrade-required","equals":1}]},"select":[{"field":"upgrade-required"}],"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","filter":{"predicates":[{"field":"workflow-role","in":["orchestrator","worker"]}]},"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-observed-run-counts","subject":"Count distinct retained run IDs by repository without importing event evidence.","objective":"Supply the run-volume chart without computing activity health, ingestion coverage, or workflow costs.","acceptance":"Group by organization and repository coordinate and count distinct retained run IDs, not attempts; missing runs remain missing evidence and global scope and time filters still apply.","from":"runs","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]}],"aggregate":{"by":["organization","repository-coordinate"],"values":[{"field":"run","as":"runs","reducer":"distinct-count"}]}},{"name":"repository-run-inventory","subject":"Registered repositories and distinct retained workflow run IDs in the selected horizon.","objective":"Compare repository execution volume and choose repositories for drill-down.","acceptance":"Keep up to 100 repository identities and drill links, ordered by run count descending with repository tie-breaks. Zero means no retained runs, not proof of inactivity; preserve unavailable and partial evidence. The Table view retains the 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":"Count mutually exclusive runtime conclusion classes for the selected workflow.","objective":"Identify workflows whose retained run conclusions or pending execution warrant investigation.","acceptance":"Within each organization, repository, and workflow, successful, failed, approval, pending, and other counts sum to the retained run total; missing or unrecognized conclusions are not treated as success, and runtime success is not a verified outcome.","from":"runs","compute":[{"as":"successful","function":"equals-any","args":[{"field":"run-conclusion"},{"value":"success"}]},{"as":"failed","function":"equals-any","args":[{"field":"run-conclusion"},{"value":"failure"},{"value":"startup-failure"},{"value":"stale"},{"value":"timed-out"}]},{"as":"approval","function":"equals-any","args":[{"field":"run-conclusion"},{"value":"action-required"}]},{"as":"classified","function":"equals-any","args":[{"field":"run-conclusion"},{"value":"success"},{"value":"failure"},{"value":"startup-failure"},{"value":"stale"},{"value":"timed-out"},{"value":"action-required"}]},{"as":"status","function":"concat","args":[{"field":"run-status"},{"value":""}]},{"as":"terminal-or-missing","function":"equals-any","args":[{"field":"status"},{"value":"completed"},{"value":""}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run","as":"total","reducer":"count"},{"field":"run","as":"successful","reducer":"count","filter":{"predicates":[{"field":"successful","equals":true}]}},{"field":"run","as":"failed","reducer":"count","filter":{"predicates":[{"field":"failed","equals":true}]}},{"field":"run","as":"approval","reducer":"count","filter":{"predicates":[{"field":"approval","equals":true}]}},{"field":"run","as":"pending","reducer":"count","filter":{"predicates":[{"field":"classified","equals":false},{"field":"terminal-or-missing","equals":false}]}},{"field":"run","as":"other","reducer":"count","filter":{"predicates":[{"field":"classified","equals":false},{"field":"terminal-or-missing","equals":true}]}}]}},{"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":"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 display names and drill-down links computed only for the active list.","from":"campaign-workflow-inventory","filter":{"predicates":[{"field":"workflow-role","in":["orchestrator","worker"]},{"field":"workflow-active","equals":"true"}]},"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":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"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":"repository"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository"}]},{"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-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":"operational-value-plot-series","subject":"One primary outcome plot per repository, optional campaign, workflow and native measure.","objective":"Keep every finite value visible and move provenance to individual observations.","acceptance":"Separate unlike units and directions. Preserve evaluator, maturity and cadence on points. Connect only adjacent points with known matching context and declared cadence; never infer a combined trend or baseline.","from":"operational-values","filter":{"predicates":[{"field":"operational-value-role","equals":"primary"}]},"compute":[{"as":"value-workflow","function":"coalesce","args":[{"field":"workflow"},{"field":"workflow-slug"}]},{"as":"workflow-missing","function":"equals-any","args":[{"field":"value-workflow"},{"value":null}]},{"as":"workflow-title","function":"concat","args":[{"value":" - "},{"field":"value-workflow"}]},{"as":"workflow-title-suffix","function":"if","args":[{"field":"workflow-missing"},{"value":""},{"field":"workflow-title"}]},{"as":"plot-window-start-ms","function":"timestamp","args":[{"context":"time-start"}]},{"as":"plot-window-end-ms","function":"timestamp","args":[{"context":"time-end"}]},{"as":"plot-contract","function":"coalesce","args":[{"field":"evaluator-digest"},{"value":"unknown"}]},{"as":"plot-unversioned","function":"equals-any","args":[{"field":"plot-contract"},{"value":"unknown"}]},{"as":"plot-comparison-note","function":"literal","args":[{"value":"Recorded measurements, not a combined trend or a verified impact assessment."}]},{"as":"plot-evidence-mode","function":"literal","args":[{"value":"per-observation"}]},{"as":"plot-mature","function":"equals-any","args":[{"field":"maturity-status"},{"value":"matured"}]},{"as":"plot-provisional","function":"equals-any","args":[{"field":"plot-mature"},{"value":false}]},{"as":"plot-max-gap-days","function":"coalesce","args":[{"field":"cadence-days"},{"value":0}]},{"as":"plot-period-start","function":"timestamp","args":[{"field":"window-start"}]},{"as":"plot-period-end","function":"timestamp","args":[{"field":"window-end"}]},{"as":"plot-period-duration","function":"difference","args":[{"field":"plot-period-end"},{"field":"plot-period-start"}]},{"as":"plot-contract-context","function":"concat","args":[{"field":"plot-contract"},{"value":"|"},{"field":"maturity-status"},{"value":"|"},{"field":"cadence-days"},{"value":"|"},{"field":"measurement-kind"}]},{"as":"plot-period-context","function":"concat","args":[{"field":"plot-period-duration"},{"value":"|"},{"field":"evaluation-mode"},{"value":"|"},{"field":"adoption-at"}]},{"as":"plot-known-context","function":"concat","args":[{"field":"plot-contract-context"},{"value":"|"},{"field":"plot-period-context"}]},{"as":"plot-context-key","function":"if","args":[{"field":"plot-unversioned"},{"value":null},{"field":"plot-known-context"}]},{"as":"plot-provenance-description","function":"concat","args":[{"value":"Evaluator: "},{"field":"plot-contract"},{"value":". Maturity: "},{"field":"maturity-status"},{"value":". Cadence (days): "},{"field":"plot-max-gap-days"},{"value":" (0 means unknown). "}]},{"as":"plot-period-description","function":"concat","args":[{"value":"Window: "},{"field":"window-start"},{"value":" to "},{"field":"window-end"},{"value":". Adoption: "},{"field":"adoption-at"},{"value":". Mode: "},{"field":"evaluation-mode"}]},{"as":"plot-point-description","function":"concat","args":[{"field":"plot-provenance-description"},{"field":"plot-period-description"}]},{"as":"series-repository","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"measure-title","function":"coalesce","args":[{"field":"operational-value-name"},{"field":"operational-value-definition"}]},{"as":"plot-title","function":"concat","args":[{"field":"measure-title"},{"field":"workflow-title-suffix"}]}],"temporal-series":{"time":"observed-at","series":"series-repository","shape":"panels","link":"run-link","carry":["campaign","value-workflow","series-repository","plot-title","plot-window-start-ms","plot-window-end-ms","operational-value-definition","operational-value-name","operational-value-unit","operational-value-direction","plot-evidence-mode","plot-comparison-note"],"point-carry":["plot-context-key","plot-max-gap-days","plot-provisional","plot-point-description","evaluator-digest","maturity-status","cadence-days","window-start","window-end","adoption-at","evaluation-mode"],"measures":[{"field":"operational-value","key":"operational-value-definition","kind":"primary"}]},"order-by":[{"field":"plot-title","direction":"asc"}]},{"name":"operational-value-period-observations","subject":"Exact native measurement periods and frozen evaluator identities.","objective":"Keep measurement duration, cadence, analysis endpoint and adoption context separate.","acceptance":"Use only declared period boundaries and coverage. Never infer legacy metadata or turn the display horizon into an evidence window.","from":"operational-values","time":{"range":"all"},"compute":[{"as":"campaign-key","function":"concat","args":[{"value":"campaign:"},{"field":"campaign"}]},{"as":"value-workflow","function":"coalesce","args":[{"field":"workflow"},{"field":"workflow-slug"}]},{"as":"workflow-key","function":"concat","args":[{"value":"workflow:"},{"field":"value-workflow"}]},{"as":"observation-marker","function":"literal","args":[{"value":1}]},{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"window-start-ms","function":"timestamp","args":[{"field":"window-start"}]},{"as":"window-end-ms","function":"timestamp","args":[{"field":"window-end"}]},{"as":"assessment-ms","function":"timestamp","args":[{"field":"observed-at"}]},{"as":"period-order-ms","function":"coalesce","args":[{"field":"window-end-ms"},{"field":"assessment-ms"}]},{"as":"period-duration-ms","function":"difference","args":[{"field":"window-end-ms"},{"field":"window-start-ms"}]},{"as":"measurement-shape","function":"concat","args":[{"field":"operational-value-unit"},{"value":"|"},{"field":"operational-value-direction"},{"value":"|"},{"field":"measurement-kind"},{"value":"|"},{"field":"cadence-days"}]},{"as":"period-contract","function":"concat","args":[{"field":"evaluator-digest"},{"value":"|"},{"field":"measurement-shape"},{"value":"|"},{"field":"period-duration-ms"}]}],"window":[{"operation":"change","field":"observation-marker","as":"newer-period-assessment","mode":"absolute","groupby":["campaign-key","workflow-key","repository-coordinate","operational-value-definition","period-contract","window-start-ms","window-end-ms"],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"id","direction":"desc"}]}]},{"name":"operational-value-period-latest","subject":"Latest assessment of each exact measurement period.","objective":"Do not resurrect an older accepted value when the same period has a newer unavailable assessment.","acceptance":"Deduplicate before checking coverage or maturity. Preserve null values and missing metadata.","from":"operational-value-period-observations","filter":{"predicates":[{"field":"newer-period-assessment","equals":"unknown"}]}},{"name":"operational-value-complete-period-candidates","subject":"Complete mature reference periods.","objective":"Require accepted evidence for a recent comparison rather than arbitrary older observations.","acceptance":"Only explicitly complete mature periods can serve as references. Missing periods remain missing.","from":"operational-value-period-latest","filter":{"predicates":[{"field":"coverage-status","equals":"complete"},{"field":"maturity-status","equals":"matured"}]},"compute":[{"as":"reference-endpoint-ms","function":"timestamp","args":[{"context":"time-end"}]},{"as":"future-reference-assessment","function":"greater-than","args":[{"field":"assessment-ms"},{"field":"reference-endpoint-ms"}]}]},{"name":"operational-value-complete-periods","subject":"Complete reference evidence available by the analysis endpoint.","objective":"Prevent future reference corrections from changing a historical comparison.","acceptance":"A future latest assessment withholds the reference; never resurrect an older accepted correction.","from":"operational-value-complete-period-candidates","filter":{"predicates":[{"field":"future-reference-assessment","equals":false}]}},{"name":"operational-value-comparable-history","subject":"Native change between adjacent equal-duration measurement periods.","objective":"Compare non-overlapping intervals or snapshot cutoffs under one evaluator, independently of adoption classification.","acceptance":"The reference ends exactly at the current start, with the same duration, cadence, native unit, direction and evaluator. No overlapping daily rolling comparison or substitution across a gap.","from":"operational-value-period-latest","joins":[{"source":"operational-value-complete-periods","type":"left","on":[{"left":"campaign-key","right":"campaign-key"},{"left":"workflow-key","right":"workflow-key"},{"left":"repository-coordinate","right":"repository-coordinate"},{"left":"operational-value-definition","right":"operational-value-definition"},{"left":"period-contract","right":"period-contract"},{"left":"window-start-ms","right":"window-end-ms"}],"fields":[{"field":"operational-value","as":"reference-native-value"},{"field":"window-start","as":"reference-window-start"},{"field":"window-end","as":"reference-window-end"},{"field":"population-digest","as":"reference-population-digest"},{"field":"eligible-count","as":"reference-eligible-count"},{"field":"rollup-denominator","as":"reference-denominator"}]}],"compute":[{"as":"previous-native-change","function":"difference","args":[{"field":"operational-value"},{"field":"reference-native-value"}]},{"as":"current-period","function":"concat","args":[{"field":"window-start"},{"value":" to "},{"field":"window-end"}]},{"as":"reference-period","function":"concat","args":[{"field":"reference-window-start"},{"value":" to "},{"field":"reference-window-end"}]},{"as":"interval-comparison","function":"concat","args":[{"field":"current-period"},{"value":" vs "},{"field":"reference-period"}]},{"as":"snapshot-comparison","function":"concat","args":[{"value":"Cutoff "},{"field":"window-end"},{"value":" vs "},{"field":"reference-window-end"}]},{"as":"snapshot-measure","function":"equals-any","args":[{"field":"measurement-kind"},{"value":"snapshot"}]},{"as":"comparison-period","function":"if","args":[{"field":"snapshot-measure"},{"field":"snapshot-comparison"},{"field":"interval-comparison"}]}]},{"name":"operational-value-movements","subject":"Direction-aware movement of retained primary repository measures.","objective":"Classify native changes without averaging unlike measures.","acceptance":"Movement requires current complete mature periods, a known evaluator, native unit, increase/decrease direction and an adjacent equal-duration reference. Expose cohort and exposure changes; no sustained-trend, statistical or causal claim.","from":"operational-value-comparable-history","filter":{"predicates":[{"field":"operational-value-role","equals":"primary"}]},"compute":[{"as":"analysis-end-ms","function":"timestamp","args":[{"context":"time-end"}]},{"as":"assessment-age-ms","function":"difference","args":[{"field":"analysis-end-ms"},{"field":"assessment-ms"}]},{"as":"cadence-ms","function":"product","args":[{"field":"cadence-days"},{"value":86400000}]},{"as":"freshness-limit-ms","function":"difference","args":[{"field":"cadence-ms"},{"value":1}]},{"as":"past-cadence","function":"greater-than","args":[{"field":"assessment-age-ms"},{"field":"freshness-limit-ms"}]},{"as":"future-period","function":"greater-than","args":[{"value":0},{"field":"assessment-age-ms"}]},{"as":"known-analysis-end","function":"greater-than","args":[{"field":"analysis-end-ms"},{"value":0}]},{"as":"positive-period","function":"greater-than","args":[{"field":"period-duration-ms"},{"value":0}]},{"as":"positive-cadence","function":"greater-than","args":[{"field":"cadence-days"},{"value":0}]},{"as":"known-measurement-kind","function":"equals-any","args":[{"field":"measurement-kind"},{"value":"interval"},{"value":"snapshot"}]},{"as":"complete-coverage","function":"equals-any","args":[{"field":"coverage-status"},{"value":"complete"}]},{"as":"same-population","function":"equals-any","args":[{"field":"population-digest"},{"field":"reference-population-digest"}]},{"as":"population-note","function":"if","args":[{"field":"same-population"},{"value":"Aggregate movement is not proof of within-cohort improvement."},{"value":"Eligible cohort changed or its identity was not retained; inspect workload mix."}]},{"as":"exposure-change","function":"difference","args":[{"field":"rollup-denominator"},{"field":"reference-denominator"}]},{"as":"campaign-label","function":"coalesce","args":[{"field":"campaign-name"},{"field":"campaign"}]},{"as":"mature","function":"equals-any","args":[{"field":"maturity-status"},{"value":"matured"}]},{"as":"native-change-state","function":"coalesce","args":[{"field":"previous-native-change"},{"value":null}]},{"as":"missing-change","function":"equals-any","args":[{"field":"native-change-state"},{"value":null}]},{"as":"contract","function":"coalesce","args":[{"field":"evaluator-digest"},{"value":"unknown"}]},{"as":"missing-contract","function":"equals-any","args":[{"field":"contract"},{"value":"unknown"}]},{"as":"native-unit","function":"coalesce","args":[{"field":"operational-value-unit"},{"value":"unknown"}]},{"as":"missing-unit","function":"equals-any","args":[{"field":"native-unit"},{"value":"unknown"}]},{"as":"increase-goal","function":"equals-any","args":[{"field":"operational-value-direction"},{"value":"increase"}]},{"as":"decrease-goal","function":"equals-any","args":[{"field":"operational-value-direction"},{"value":"decrease"}]},{"as":"rising","function":"greater-than","args":[{"field":"previous-native-change"},{"value":0}]},{"as":"falling","function":"greater-than","args":[{"value":0},{"field":"previous-native-change"}]},{"as":"increasing-movement","function":"if","args":[{"field":"rising"},{"value":"Improving"},{"value":"Worsening"}]},{"as":"decreasing-movement","function":"if","args":[{"field":"falling"},{"value":"Improving"},{"value":"Worsening"}]},{"as":"increase-movement","function":"if","args":[{"field":"increase-goal"},{"field":"increasing-movement"},{"value":"Target assessment required"}]},{"as":"directed-movement","function":"if","args":[{"field":"decrease-goal"},{"field":"decreasing-movement"},{"field":"increase-movement"}]},{"as":"unchanged","function":"equals-any","args":[{"field":"previous-native-change"},{"value":0}]},{"as":"unchanged-increase","function":"if","args":[{"field":"increase-goal"},{"value":"Unchanged"},{"value":"Target assessment required"}]},{"as":"unchanged-direction","function":"if","args":[{"field":"decrease-goal"},{"value":"Unchanged"},{"field":"unchanged-increase"}]},{"as":"observed-movement","function":"if","args":[{"field":"unchanged"},{"field":"unchanged-direction"},{"field":"directed-movement"}]},{"as":"comparable-movement","function":"if","args":[{"field":"missing-change"},{"value":"Insufficient comparable history"},{"field":"observed-movement"}]},{"as":"versioned-movement","function":"if","args":[{"field":"missing-contract"},{"value":"Unversioned evidence"},{"field":"comparable-movement"}]},{"as":"unit-movement","function":"if","args":[{"field":"missing-unit"},{"value":"Native unit unavailable"},{"field":"versioned-movement"}]},{"as":"fresh-movement","function":"if","args":[{"field":"past-cadence"},{"value":"Stale or future evidence"},{"field":"unit-movement"}]},{"as":"bounded-movement","function":"if","args":[{"field":"future-period"},{"value":"Stale or future evidence"},{"field":"fresh-movement"}]},{"as":"endpoint-movement","function":"if","args":[{"field":"known-analysis-end"},{"field":"bounded-movement"},{"value":"Stale or future evidence"}]},{"as":"coverage-movement","function":"if","args":[{"field":"complete-coverage"},{"field":"endpoint-movement"},{"value":"Coverage incomplete or unknown"}]},{"as":"kind-movement","function":"if","args":[{"field":"known-measurement-kind"},{"field":"coverage-movement"},{"value":"Measurement period unavailable"}]},{"as":"cadence-movement","function":"if","args":[{"field":"positive-cadence"},{"field":"kind-movement"},{"value":"Measurement period unavailable"}]},{"as":"period-movement","function":"if","args":[{"field":"positive-period"},{"field":"cadence-movement"},{"value":"Measurement period unavailable"}]},{"as":"mature-movement","function":"if","args":[{"field":"mature"},{"field":"period-movement"},{"value":"Provisional or unavailable"}]},{"as":"movement","function":"if","args":[{"field":"missing-contract"},{"value":"Unversioned evidence"},{"field":"mature-movement"}]},{"as":"recent-comparable","function":"equals-any","args":[{"field":"movement"},{"value":"Improving"},{"value":"Worsening"},{"value":"Unchanged"}]},{"as":"native-change","function":"if","args":[{"field":"recent-comparable"},{"field":"previous-native-change"},{"value":null}]},{"as":"recent-comparison-period","function":"if","args":[{"field":"recent-comparable"},{"field":"comparison-period"},{"value":"Unavailable; inspect comparison status."}]},{"as":"measurement-note","function":"if","args":[{"field":"snapshot-measure"},{"value":"Cutoff-state change, not a count of remediations. "},{"value":""}]},{"as":"comparison-context","function":"concat","args":[{"field":"measurement-note"},{"field":"population-note"}]}],"order-by":[{"field":"campaign","direction":"asc"},{"field":"repository-coordinate","direction":"asc"},{"field":"operational-value-definition","direction":"asc"}]},{"name":"operational-value-ordered-history","subject":"Latest observation of each repository measure, before maturity or value filtering.","objective":"Prevent an older positive or mature result from masking a newer incomplete observation.","acceptance":"Order by measurement cutoff, then assessment timestamp and stable ID. Historical corrections cannot replace a newer measurement period. Missing period metadata falls back to assessment time and remains incomparable. Preserve native zero and null.","from":"operational-value-movements","window":[{"operation":"change","field":"observation-marker","as":"preceding-observation","mode":"absolute","groupby":["campaign-key","workflow-key","organization","repository","operational-value-definition"],"order-by":[{"field":"period-order-ms","direction":"desc"},{"field":"observed-at","direction":"desc"},{"field":"id","direction":"desc"}]}]},{"name":"operational-value-latest","subject":"Latest primary outcome per campaign, repository and measure.","objective":"Expose the latest retained movement, including incomplete evidence.","acceptance":"Latest selection precedes aggregation. Older mature or positive observations cannot mask newer incomplete evidence.","from":"operational-value-ordered-history","filter":{"predicates":[{"field":"preceding-observation","equals":"unknown"}]}},{"name":"operational-value-repository-evidence-order","subject":"Identify oldest and newest latest primary evidence per repository.","objective":"Expose date bounds across the latest retained primary measures for a repository.","acceptance":"Partition by repository, retaining all input rows. Identify first rows in ascending and descending observation order, with ID tie-breaks. Do not infer freshness or fill gaps.","from":"operational-value-latest","window":[{"operation":"change","field":"observation-marker","as":"before-newest","groupby":["repository-coordinate"],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"id","direction":"desc"}]},{"operation":"change","field":"observation-marker","as":"before-oldest","groupby":["repository-coordinate"],"order-by":[{"field":"observed-at","direction":"asc"},{"field":"id","direction":"asc"}]}]},{"name":"operational-value-repository-counts","subject":"Latest primary movement counts per repository across campaigns and standalone workflows.","objective":"Summarize comparable and missing primary-measure evidence without combining native values.","acceptance":"Group by repository; count goals and improving, worsening and unchanged measures. Preserve oldest/newest retained dates. Incomparable goals remain in the total, not in comparable counts.","from":"operational-value-repository-evidence-order","aggregate":{"by":["organization","repository","repository-coordinate"],"values":[{"field":"observation-marker","as":"goals","reducer":"count"},{"field":"operational-value","as":"mature-goals","reducer":"count","filter":{"predicates":[{"field":"maturity-status","equals":"matured"}]}},{"field":"observation-marker","as":"improving","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Improving"}]}},{"field":"observation-marker","as":"worsening","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Worsening"}]}},{"field":"observation-marker","as":"unchanged","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Unchanged"}]}},{"field":"observation-marker","as":"unversioned-goals","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Unversioned evidence"}]}},{"field":"observation-marker","as":"unitless-goals","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Native unit unavailable"}]}},{"field":"observation-marker","as":"provisional-goals","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Provisional or unavailable"}]}},{"field":"observation-marker","as":"history-gap-goals","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Insufficient comparable history"}]}},{"field":"observation-marker","as":"target-goals","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Target assessment required"}]}},{"field":"observation-marker","as":"period-gap-goals","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Measurement period unavailable"}]}},{"field":"observation-marker","as":"coverage-gap-goals","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Coverage incomplete or unknown"}]}},{"field":"observation-marker","as":"stale-goals","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Stale or future evidence"}]}},{"field":"observed-at","as":"newest-evidence-at","reducer":"unique","filter":{"predicates":[{"field":"before-newest","equals":"unknown"}]}},{"field":"observed-at","as":"oldest-evidence-at","reducer":"unique","filter":{"predicates":[{"field":"before-oldest","equals":"unknown"}]}}]}},{"name":"operational-value-repository-signals","subject":"One conservative direction signal per repository across all workflow outcomes.","objective":"Rank repository investigations while preserving disagreement and evidence gaps.","acceptance":"Any incomparable primary measure makes the repository insufficient; opposing comparable measures are Mixed. Count each repository once.","from":"operational-value-repository-counts","compute":[{"as":"comparable-goals","function":"sum","args":[{"field":"improving"},{"field":"worsening"},{"field":"unchanged"}]},{"as":"incomplete","function":"greater-than","args":[{"field":"goals"},{"field":"comparable-goals"}]},{"as":"has-improving","function":"greater-than","args":[{"field":"improving"},{"value":0}]},{"as":"has-worsening","function":"greater-than","args":[{"field":"worsening"},{"value":0}]},{"as":"positive-state","function":"if","args":[{"field":"has-improving"},{"value":"Improving"},{"value":"Unchanged"}]},{"as":"negative-state","function":"if","args":[{"field":"has-improving"},{"value":"Mixed"},{"value":"Worsening"}]},{"as":"comparable-state","function":"if","args":[{"field":"has-worsening"},{"field":"negative-state"},{"field":"positive-state"}]},{"as":"signal","function":"if","args":[{"field":"incomplete"},{"value":"Insufficient evidence"},{"field":"comparable-state"}]},{"as":"version-gap","function":"greater-than","args":[{"field":"unversioned-goals"},{"value":0}]},{"as":"unit-gap","function":"greater-than","args":[{"field":"unitless-goals"},{"value":0}]},{"as":"provisional-gap","function":"greater-than","args":[{"field":"provisional-goals"},{"value":0}]},{"as":"history-gap","function":"greater-than","args":[{"field":"history-gap-goals"},{"value":0}]},{"as":"target-gap","function":"greater-than","args":[{"field":"target-goals"},{"value":0}]},{"as":"version-note","function":"if","args":[{"field":"version-gap"},{"value":"Measurement version missing. "},{"value":""}]},{"as":"unit-note","function":"if","args":[{"field":"unit-gap"},{"value":"Native unit missing. "},{"value":""}]},{"as":"provisional-note","function":"if","args":[{"field":"provisional-gap"},{"value":"Provisional or unavailable measurements. "},{"value":""}]},{"as":"history-note","function":"if","args":[{"field":"history-gap"},{"value":"Comparable history missing. "},{"value":""}]},{"as":"target-note","function":"if","args":[{"field":"target-gap"},{"value":"Target assessment needed. "},{"value":""}]},{"as":"period-gap","function":"greater-than","args":[{"field":"period-gap-goals"},{"value":0}]},{"as":"coverage-gap","function":"greater-than","args":[{"field":"coverage-gap-goals"},{"value":0}]},{"as":"stale-gap","function":"greater-than","args":[{"field":"stale-goals"},{"value":0}]},{"as":"period-note","function":"if","args":[{"field":"period-gap"},{"value":"Measurement periods missing. "},{"value":""}]},{"as":"coverage-note","function":"if","args":[{"field":"coverage-gap"},{"value":"Period coverage incomplete or unknown. "},{"value":""}]},{"as":"stale-note","function":"if","args":[{"field":"stale-gap"},{"value":"Evidence outside the analysis cadence. "},{"value":""}]},{"as":"gap-reasons","function":"concat","args":[{"field":"version-note"},{"field":"unit-note"},{"field":"provisional-note"},{"field":"history-note"},{"field":"target-note"},{"field":"period-note"},{"field":"coverage-note"},{"field":"stale-note"}]},{"as":"evidence-reason","function":"if","args":[{"field":"incomplete"},{"field":"gap-reasons"},{"value":"Comparable measurements available."}]}],"order-by":[{"field":"worsening","direction":"desc"},{"field":"improving","direction":"desc"},{"field":"repository-coordinate","direction":"asc"}]},{"name":"operational-value-repository-subjects","subject":"Inventory and measured repositories, independent of campaign membership.","objective":"Include standalone workflow outcomes and unmeasured inventory repositories.","acceptance":"Deduplicate organization/repository identities. Observations outside campaign inventory remain visible; missing measurements are not zero value.","from":"repositories","union":["operational-values"],"aggregate":{"by":["organization","repository"],"values":[{"field":"repository","as":"subject-records","reducer":"count"}]}},{"name":"operational-value-repository-coverage","subject":"Outcome evidence coverage for each repository.","objective":"Expose measurement gaps without requiring campaign registration.","acceptance":"One row per repository. Count latest primary goals, not reports. Preserve conservative direction and comparison blockers; no evidence is not zero value.","from":"operational-value-repository-subjects","joins":[{"source":"operational-value-repository-signals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"goals","as":"goal-count"},{"field":"comparable-goals","as":"measured-comparable-goals"},{"field":"mature-goals","as":"measured-mature-goals"},{"field":"signal","as":"measured-signal"},{"field":"worsening","as":"measured-worsening"},{"field":"improving","as":"measured-improving"},{"field":"evidence-reason","as":"measured-evidence-reason"},{"field":"oldest-evidence-at","as":"measured-oldest-evidence-at"},{"field":"newest-evidence-at","as":"measured-newest-evidence-at"}]}],"compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"goals","function":"coalesce","args":[{"field":"goal-count"},{"value":0}]},{"as":"measured-goals","function":"coalesce","args":[{"field":"goal-count"},{"value":0}]},{"as":"comparable-goals","function":"coalesce","args":[{"field":"measured-comparable-goals"},{"value":0}]},{"as":"mature-goals","function":"coalesce","args":[{"field":"measured-mature-goals"},{"value":0}]},{"as":"signal","function":"coalesce","args":[{"field":"measured-signal"},{"value":"Not measured"}]},{"as":"evidence-reason","function":"coalesce","args":[{"field":"measured-evidence-reason"},{"value":"No retained primary measurements."}]},{"as":"oldest-evidence-at","function":"coalesce","args":[{"field":"measured-oldest-evidence-at"},{"value":null}]},{"as":"newest-evidence-at","function":"coalesce","args":[{"field":"measured-newest-evidence-at"},{"value":null}]},{"as":"has-evidence","function":"greater-than","args":[{"field":"measured-goals"},{"value":0}]},{"as":"worsening-goals","function":"coalesce","args":[{"field":"measured-worsening"},{"value":0}]},{"as":"improving-goals","function":"coalesce","args":[{"field":"measured-improving"},{"value":0}]},{"as":"has-mature-evidence","function":"greater-than","args":[{"field":"mature-goals"},{"value":0}]},{"as":"measured-state","function":"if","args":[{"field":"has-mature-evidence"},{"value":"Mature evidence available"},{"value":"Interim or unavailable evidence"}]},{"as":"measurement-state","function":"if","args":[{"field":"has-evidence"},{"field":"measured-state"},{"value":"Not measured"}]},{"as":"coverage-summary","function":"concat","args":[{"field":"measured-goals"},{"value":" measured goals / "},{"field":"comparable-goals"},{"value":" comparable"}]}],"order-by":[{"field":"worsening-goals","direction":"desc"},{"field":"improving-goals","direction":"desc"},{"field":"repository-coordinate","direction":"asc"}]},{"name":"operational-value-overview-totals","subject":"Repository measurement availability and latest comparable goal counts.","objective":"Explain evidence readiness before repository drill-down.","acceptance":"Count repositories once across campaigns and standalone workflows. Goal counts describe latest primary measurements, not impact.","from":"operational-value-repository-coverage","aggregate":{"by":[],"values":[{"field":"repository","as":"repositories","reducer":"count"},{"field":"repository","as":"measured-repositories","reducer":"count","filter":{"predicates":[{"field":"has-evidence","equals":true}]}},{"field":"measured-goals","as":"measured-goals","reducer":"sum"},{"field":"comparable-goals","as":"comparable-goals","reducer":"sum"}]}},{"name":"operational-value-overview-summary","subject":"Compact portfolio measurement readiness summary.","objective":"Explain comparison readiness without replacing unavailable movement with zero value.","acceptance":"Preserve repository and latest goal totals; distinguish no observations from measurements without comparable movement.","from":"operational-value-overview-totals","compute":[{"as":"summary","function":"concat","args":[{"field":"measured-repositories"},{"value":" of "},{"field":"repositories"},{"value":" repositories measured · "},{"field":"comparable-goals"},{"value":" comparable goals"}]},{"as":"has-measurements","function":"greater-than","args":[{"field":"measured-goals"},{"value":0}]},{"as":"has-comparisons","function":"greater-than","args":[{"field":"comparable-goals"},{"value":0}]},{"as":"measured-note","function":"if","args":[{"field":"has-comparisons"},{"value":"Inspect repository movement and comparison gaps below."},{"value":"Measurements are available, but none supports a comparable movement yet. Inspect the reasons below."}]},{"as":"summary-note","function":"if","args":[{"field":"has-measurements"},{"field":"measured-note"},{"value":"No primary measurements are retained. Inspect collection and measurement coverage in Evidence; absence is not zero value."}]}]},{"name":"operational-value-measured-repositories","subject":"Repositories with retained primary outcome measurements.","objective":"Choose a repository directly, including standalone workflow outcomes.","acceptance":"One repository card across all campaigns and standalone workflows. Preserve disagreement and missing comparison evidence.","from":"operational-value-repository-coverage","filter":{"predicates":[{"field":"has-evidence","equals":true}]}},{"name":"operational-value-unmeasured-repositories","subject":"Inventory repositories without retained primary measurements.","objective":"Inspect evidence gaps without implying absent contracts or zero value.","acceptance":"Keep every unmeasured inventory repository; no campaign is required.","from":"operational-value-repository-coverage","filter":{"predicates":[{"field":"has-evidence","equals":false}]}},{"name":"operational-value-direction-repositories","subject":"Comparable outcome direction per repository.","objective":"Inspect repository movement without combining native values.","acceptance":"One count per fully comparable repository. Opposing goals remain Mixed; absent evidence is not neutral. Links open repository history directly.","from":"operational-value-repository-signals","filter":{"predicates":[{"field":"signal","in":["Improving","Worsening","Mixed","Unchanged"]}]},"compute":[{"as":"encoded-organization","function":"url-encode","args":[{"field":"organization"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository"}]},{"as":"outcome-drill-href","function":"concat","args":[{"value":"#page-operational-value-repository?organization="},{"field":"encoded-organization"},{"value":"&repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"outcome-drill-href"},{"field":"repository-coordinate"}]},{"as":"repositories","function":"literal","args":[{"value":1}]}],"limit":100,"order-by":[{"field":"repository-coordinate","direction":"asc"}]},{"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-conclusions","subject":"Aggregate workflow run conclusions by UTC day for the Runs stacked area graph.","objective":"Expose changes in observed run conclusions by day for investigation.","acceptance":"Count retained runs by started-at UTC day and recorded conclusion; an empty day or missing conclusion is not evidence of healthy execution or absence of activity.","from":"runs","compute":[{"as":"day","function":"date-day","args":[{"field":"started-at"}]}],"aggregate":{"by":["day","run-conclusion"],"values":[{"field":"run","as":"runs","reducer":"count"}]}},{"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-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-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-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-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.event","firewall.upstream_error","model.config","model.inventory","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-duplicate-sessions","from":"routing-session-order","subject":"Count session attempts omitted from routing metrics.","objective":"Expose duplicate files instead of silently summing them.","acceptance":"Only nonauthoritative attempts contribute.","filter":{"predicates":[{"field":"session-position","gte":2}]},"aggregate":{"values":[{"field":"routing-run-key","as":"duplicate-files","reducer":"count"}]}},{"name":"routing-coverage","subject":"Expose supported, legacy, unsupported and unidentified session coverage.","objective":"Keep sessions excluded from adoption denominators visible.","acceptance":"Missing identity or time is never inferred from external run success.","from":"routing-run-facts","compute":[{"as":"identified","function":"greater-than","args":[{"field":"workflow-info-count"},{"value":0}]},{"as":"untimed","function":"equals-any","args":[{"field":"run-clock"},{"value":null}]}],"aggregate":{"by":["session-format","identified","untimed"],"values":[{"field":"routing-run-key","as":"sessions","reducer":"count"},{"field":"warnings","as":"warnings","reducer":"sum"}]}},{"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-resolved-runs","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-adoption","subject":"Count identified sessions by routing state and engine.","objective":"Show adoption without silently treating unknown or inferred routing as explicit configuration.","acceptance":"All seven states remain distinct and sum to identified sessions.","from":"routing-runs","aggregate":{"by":["routing-state","engine"],"values":[{"field":"routing-run-key","as":"runs","reducer":"count"}]}},{"name":"routing-adoption-totals","from":"routing-runs","subject":"Count routed populations and classifier coverage by engine.","objective":"Exclude unknown state from adoption shares without hiding it.","acceptance":"Configured-unrecorded counts as routed; inferred unrouted stays separate.","compute":[{"as":"workflow-key","function":"concat","args":[{"field":"full-repository"},{"value":":"},{"field":"workflow"}]},{"as":"is-routed","function":"equals-any","args":[{"field":"routing-state"},{"value":"selected"},{"value":"selection_failed"},{"value":"harness_reported"},{"value":"configured_unrecorded"}]}],"aggregate":{"by":["engine"],"values":[{"field":"run","as":"runs","reducer":"count"},{"field":"run","as":"routed","reducer":"count","filter":{"predicates":[{"field":"is-routed","equals":true}]}},{"field":"run","as":"unrouted","reducer":"count","filter":{"predicates":[{"field":"routing-state","equals":"unrouted"}]}},{"field":"run","as":"inferred-unrouted","reducer":"count","filter":{"predicates":[{"field":"routing-state","equals":"unrouted_inferred"}]}},{"field":"run","as":"unknown","reducer":"count","filter":{"predicates":[{"field":"routing-state","equals":"unknown"}]}},{"field":"workflow-key","as":"routed-workflows","reducer":"distinct-count","filter":{"predicates":[{"field":"is-routed","equals":true}]}},{"field":"routing-degraded","as":"degraded-known","reducer":"count"},{"field":"run","as":"degraded","reducer":"count","filter":{"predicates":[{"field":"routing-degraded","equals":true}]}}]}},{"name":"routing-adoption-summary","from":"routing-adoption-totals","subject":"Show adoption and degraded-classification shares with their denominators.","objective":"Distinguish unknown coverage from explicit zero.","acceptance":"A missing or zero denominator produces no ratio.","compute":[{"as":"known-state-runs","function":"difference","args":[{"field":"runs"},{"field":"unknown"}]},{"as":"routed-share","function":"quotient","args":[{"field":"routed"},{"field":"known-state-runs"}]},{"as":"degraded-share","function":"quotient","args":[{"field":"degraded"},{"field":"degraded-known"}]}]},{"name":"routing-decision-dimensions","from":"routing-runs","subject":"Group selected runs by configured and resolved objectives.","objective":"Expose configured mode independently of the router's resolved mode.","acceptance":"Absent goal, mode and classifier fields remain unknown.","filter":{"predicates":[{"field":"routing-state","equals":"selected"}]},"aggregate":{"by":["engine","routing-goal","routing-configured-mode","routing-mode","routing-classifier-model","routing-classifier-effort","routing-classifier-attempts"],"values":[{"field":"run","as":"runs","reducer":"count"},{"field":"routing-latency-ms","as":"latency-known","reducer":"count"},{"field":"routing-latency-ms","as":"latency-p50","reducer":"median"},{"field":"routing-latency-ms","as":"latency-p95","reducer":"p95"}]}},{"name":"routing-picks","subject":"Compare selected picks within classifier label cells.","objective":"Separate task variation from routing decisions.","acceptance":"Only proxy-selected runs contribute and absent labels remain unknown.","from":"routing-runs","filter":{"predicates":[{"field":"routing-state","equals":"selected"},{"field":"unknown-pick","equals":false}]},"aggregate":{"by":["pick","routing-task-type","routing-scope","routing-complexity"],"values":[{"field":"run","as":"runs","reducer":"count"},{"field":"routing-latency-ms","as":"latency-known","reducer":"count"},{"field":"routing-latency-ms","as":"mean-latency-ms","reducer":"mean"},{"field":"routing-latency-ms","as":"median-latency-ms","reducer":"median"},{"field":"routing-latency-ms","as":"p95-latency-ms","reducer":"p95"},{"field":"routing-degraded","as":"degraded-known","reducer":"count"},{"field":"run","as":"degraded-runs","reducer":"count","filter":{"predicates":[{"field":"routing-degraded","equals":true}]}}]}},{"name":"routing-pick-history","from":"routing-runs","subject":"Order known picks within workflow and classifier label cells.","objective":"Separate task variation from pick instability.","acceptance":"Unknown picks and untimed runs cannot establish adjacent changes.","filter":{"predicates":[{"field":"unknown-pick","equals":false},{"field":"run-clock","gte":0}]},"window":[{"operation":"previous","field":"pick","as":"previous-pick","groupby":["organization","repository","workflow"],"order-by":[{"field":"run-clock","direction":"asc"},{"field":"run","direction":"asc"}]},{"operation":"previous","field":"pick","as":"previous-cell-pick","groupby":["organization","repository","workflow","routing-task-type","routing-scope","routing-complexity"],"order-by":[{"field":"run-clock","direction":"asc"},{"field":"run","direction":"asc"}]}]},{"name":"routing-pick-changes","from":"routing-pick-history","subject":"Mark decidable adjacent pick changes.","objective":"Exclude first observations from change-rate denominators.","acceptance":"Label-conditioned pairs never compare unlike classifier cells.","compute":[{"as":"first-pick","function":"equals-any","args":[{"field":"previous-pick"},{"value":null}]},{"as":"first-cell-pick","function":"equals-any","args":[{"field":"previous-cell-pick"},{"value":null}]},{"as":"same-pick","function":"equals-any","args":[{"field":"previous-pick"},{"field":"pick"}]},{"as":"same-cell-pick","function":"equals-any","args":[{"field":"previous-cell-pick"},{"field":"pick"}]},{"as":"pair","function":"if","args":[{"field":"first-pick"},{"value":0},{"value":1}]},{"as":"cell-pair","function":"if","args":[{"field":"first-cell-pick"},{"value":0},{"value":1}]},{"as":"changed","function":"if","args":[{"field":"same-pick"},{"value":0},{"field":"pair"}]},{"as":"cell-changed","function":"if","args":[{"field":"same-cell-pick"},{"value":0},{"field":"cell-pair"}]}]},{"name":"routing-stability-totals","from":"routing-pick-changes","subject":"Count adjacent changes and distinct picks per workflow.","objective":"Measure stability with explicit pair denominators.","acceptance":"Label-conditioned change rate weights cells by their adjacent pairs.","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"pick","as":"distinct-picks","reducer":"distinct-count"},{"field":"pair","as":"pairs","reducer":"sum"},{"field":"cell-pair","as":"cell-pairs","reducer":"sum"},{"field":"changed","as":"changes","reducer":"sum"},{"field":"cell-changed","as":"cell-changes","reducer":"sum"}]}},{"name":"routing-pick-frequencies","from":"routing-runs","subject":"Count each known pick within its workflow.","objective":"Compute modal share without counting unknown picks.","acceptance":"All retained known picks contribute, including runs without an event clock.","filter":{"predicates":[{"field":"unknown-pick","equals":false}]},"aggregate":{"by":["organization","repository","workflow","pick"],"values":[{"field":"run","as":"pick-runs","reducer":"count"}]}},{"name":"routing-modal-picks","from":"routing-pick-frequencies","subject":"Count known picks and the largest workflow pick cohort.","objective":"Distinguish modal stability from adjacent change rates.","acceptance":"Modal share uses runs with known model and effort only.","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"pick","as":"distinct-picks","reducer":"count"},{"field":"pick-runs","as":"known-pick-runs","reducer":"sum"},{"field":"pick-runs","as":"modal-runs","reducer":"max"}]}},{"name":"routing-stability","from":"routing-modal-picks","subject":"Compute observed workflow and label-conditioned pick change rates.","objective":"Distinguish changing tasks from changing decisions.","acceptance":"Fewer than two comparable runs produces an unknown rate.","joins":[{"source":"routing-stability-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"pairs","as":"pairs"},{"field":"cell-pairs","as":"cell-pairs"},{"field":"changes","as":"changes"},{"field":"cell-changes","as":"cell-changes"}]}],"compute":[{"as":"modal-pick-share","function":"quotient","args":[{"field":"modal-runs"},{"field":"known-pick-runs"}]},{"as":"change-rate","function":"quotient","args":[{"field":"changes"},{"field":"pairs"}]},{"as":"cell-change-rate","function":"quotient","args":[{"field":"cell-changes"},{"field":"cell-pairs"}]}]},{"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":"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":"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-cost-bucket-totals","subject":"Sum nonoverlapping credits with explicit known and unknown coverage.","objective":"Show recorded lower bounds by served model and attribution bucket.","acceptance":"Unknown costs are counted, not repriced or silently treated as zero; evals remain separate.","from":"routing-attributed-accounting","aggregate":{"by":["bucket","agent-name","telemetry-model"],"values":[{"field":"event","as":"records","reducer":"count"},{"field":"aic","as":"known-cost-records","reducer":"count"},{"field":"unknown-aic-count","as":"unknown-cost-records","reducer":"sum"},{"field":"aic","as":"recorded-aic-lower-bound","reducer":"sum"},{"field":"input-tokens","as":"recorded-input-tokens","reducer":"sum"},{"field":"input-tokens","as":"input-known","reducer":"count"},{"field":"output-tokens","as":"recorded-output-tokens","reducer":"sum"},{"field":"output-tokens","as":"output-known","reducer":"count"},{"field":"reasoning-tokens","as":"recorded-reasoning-tokens","reducer":"sum"},{"field":"reasoning-tokens","as":"reasoning-known","reducer":"count"},{"field":"cache-read-tokens","as":"recorded-cache-read-tokens","reducer":"sum"},{"field":"cache-read-tokens","as":"cache-read-known","reducer":"count"},{"field":"cache-write-tokens","as":"recorded-cache-write-tokens","reducer":"sum"},{"field":"cache-write-tokens","as":"cache-write-known","reducer":"count"}]}},{"name":"routing-cost-buckets","from":"routing-cost-bucket-totals","subject":"Show known credit lower bounds with honest missing-value coverage.","objective":"Never display a zero sum when every cost is missing.","acceptance":"Every additive measure carries known and unknown record counts.","compute":[{"as":"has-known-cost","function":"greater-than","args":[{"field":"known-cost-records"},{"value":0}]},{"as":"aic-lower-bound","function":"if","args":[{"field":"has-known-cost"},{"field":"recorded-aic-lower-bound"},{"value":null}]},{"as":"input-unknown","function":"difference","args":[{"field":"records"},{"field":"input-known"}]},{"as":"output-unknown","function":"difference","args":[{"field":"records"},{"field":"output-known"}]},{"as":"reasoning-unknown","function":"difference","args":[{"field":"records"},{"field":"reasoning-known"}]},{"as":"cache-read-unknown","function":"difference","args":[{"field":"records"},{"field":"cache-read-known"}]},{"as":"cache-write-unknown","function":"difference","args":[{"field":"records"},{"field":"cache-write-known"}]},{"as":"has-input","function":"greater-than","args":[{"field":"input-known"},{"value":0}]},{"as":"has-output","function":"greater-than","args":[{"field":"output-known"},{"value":0}]},{"as":"has-reasoning","function":"greater-than","args":[{"field":"reasoning-known"},{"value":0}]},{"as":"has-cache-read","function":"greater-than","args":[{"field":"cache-read-known"},{"value":0}]},{"as":"has-cache-write","function":"greater-than","args":[{"field":"cache-write-known"},{"value":0}]},{"as":"input-tokens","function":"if","args":[{"field":"has-input"},{"field":"recorded-input-tokens"},{"value":null}]},{"as":"output-tokens","function":"if","args":[{"field":"has-output"},{"field":"recorded-output-tokens"},{"value":null}]},{"as":"reasoning-tokens","function":"if","args":[{"field":"has-reasoning"},{"field":"recorded-reasoning-tokens"},{"value":null}]},{"as":"cache-read-tokens","function":"if","args":[{"field":"has-cache-read"},{"field":"recorded-cache-read-tokens"},{"value":null}]},{"as":"cache-write-tokens","function":"if","args":[{"field":"has-cache-write"},{"field":"recorded-cache-write-tokens"},{"value":null}]}]},{"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-deviation-totals","from":"routing-deviations","subject":"Count deviations and their known response credits by phase.","objective":"Keep request-share and credit-share denominators distinct.","acceptance":"Missing joined AIC is excluded from credit share and counted.","aggregate":{"by":["phase"],"values":[{"field":"event","as":"requests","reducer":"count"},{"field":"routing-routed","as":"classified-requests","reducer":"count"},{"field":"event","as":"deviated-requests","reducer":"count","filter":{"predicates":[{"field":"routing-routed","equals":"deviated"}]}},{"field":"accounted-aic","as":"known-costs","reducer":"count"},{"field":"accounted-aic","as":"joined-aic","reducer":"sum"},{"field":"accounted-aic","as":"deviated-aic","reducer":"sum","filter":{"predicates":[{"field":"routing-routed","equals":"deviated"}]}}]}},{"name":"routing-deviation-summary","from":"routing-deviation-totals","subject":"Show deviation shares with explicit response coverage.","objective":"Never equate missing request accounting with free traffic.","acceptance":"Zero known joined credits produce no credit share.","compute":[{"as":"deviated-request-share","function":"quotient","args":[{"field":"deviated-requests"},{"field":"classified-requests"}]},{"as":"deviated-credit-share","function":"quotient","args":[{"field":"deviated-aic"},{"field":"joined-aic"}]},{"as":"unknown-costs","function":"difference","args":[{"field":"requests"},{"field":"known-costs"}]}]},{"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-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-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-cost-distribution-totals","from":"routing-cost-runs","subject":"Compare complete agent-phase AIC by workflow, routing state and pick.","objective":"Exclude partial runs from quantiles and display their coverage.","acceptance":"Comparisons are observational and do not imply a causal routing benefit.","aggregate":{"by":["organization","repository","workflow","routing-state","pick"],"values":[{"field":"run","as":"runs","reducer":"count"},{"field":"complete-aic","as":"complete-runs","reducer":"count"},{"field":"complete-aic","as":"observed-median-aic","reducer":"median"},{"field":"complete-aic","as":"observed-p75-aic","reducer":"p75"},{"field":"complete-aic","as":"observed-p90-aic","reducer":"p90"}]}},{"name":"routing-cost-distributions","from":"routing-cost-distribution-totals","subject":"Suppress cost comparisons with insufficient complete samples.","objective":"Enforce the configurable minimum sample rather than overstate sparse evidence.","acceptance":"Below the default ten complete runs, cost quantiles remain unavailable.","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"}]},{"as":"sample-status","function":"if","args":[{"field":"enough-samples"},{"value":"observational"},{"value":"insufficient data"}]},{"as":"partial-runs","function":"difference","args":[{"field":"runs"},{"field":"complete-runs"}]},{"as":"median-aic","function":"if","args":[{"field":"enough-samples"},{"field":"observed-median-aic"},{"value":null}]},{"as":"p75-aic","function":"if","args":[{"field":"enough-samples"},{"field":"observed-p75-aic"},{"value":null}]},{"as":"p90-aic","function":"if","args":[{"field":"enough-samples"},{"field":"observed-p90-aic"},{"value":null}]}]},{"name":"routing-weekly-cost-totals","from":"routing-cost-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-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":"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-comparison-totals","from":"routing-cost-runs","subject":"Compare complete agent-phase costs for selected and unrouted workflow runs.","objective":"Keep explicit and inferred baselines separate.","acceptance":"Partial costs never contribute to sample counts or quantiles.","aggregate":{"by":["organization","repository","workflow","routing-state"],"values":[{"field":"workflow-model","as":"workflow-model","reducer":"unique"},{"field":"complete-aic","as":"complete-runs","reducer":"count"},{"field":"complete-aic","as":"median-aic","reducer":"median"},{"field":"complete-aic","as":"p75-aic","reducer":"p75"}]}},{"name":"routing-explicit-baselines","from":"routing-comparison-totals","subject":"Read explicitly unrouted baseline costs.","objective":"Avoid combining inferred with configured baselines.","acceptance":"Only explicitly unrouted runs contribute.","filter":{"predicates":[{"field":"routing-state","equals":"unrouted"}]}},{"name":"routing-inferred-baselines","from":"routing-comparison-totals","subject":"Read inferred unrouted baseline costs.","objective":"Label inference rather than imply explicit routing configuration.","acceptance":"Only unrouted_inferred runs contribute.","filter":{"predicates":[{"field":"routing-state","equals":"unrouted_inferred"}]}},{"name":"routing-comparisons","from":"routing-comparison-totals","subject":"Compute observational routed-versus-unrouted cost deltas within one workflow.","objective":"Expose both baseline cohorts and their complete sample sizes.","acceptance":"Both cohorts must meet the minimum; zero or absent baseline costs produce no ratio.","parameters":[{"name":"minimum-sample","type":"number"}],"filter":{"predicates":[{"field":"routing-state","equals":"selected"}]},"joins":[{"source":"routing-explicit-baselines","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"workflow-model","as":"explicit-model"},{"field":"complete-runs","as":"explicit-runs"},{"field":"median-aic","as":"explicit-median"},{"field":"p75-aic","as":"explicit-p75"}]},{"source":"routing-inferred-baselines","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"workflow-model","as":"inferred-model"},{"field":"complete-runs","as":"inferred-runs"},{"field":"median-aic","as":"inferred-median"},{"field":"p75-aic","as":"inferred-p75"}]}],"compute":[{"as":"sample-floor","function":"difference","args":[{"parameter":"minimum-sample"},{"value":1}]},{"as":"routed-enough","function":"greater-than","args":[{"field":"complete-runs"},{"field":"sample-floor"}]},{"as":"explicit-enough","function":"greater-than","args":[{"field":"explicit-runs"},{"field":"sample-floor"}]},{"as":"inferred-enough","function":"greater-than","args":[{"field":"inferred-runs"},{"field":"sample-floor"}]},{"as":"explicit-comparable","function":"if","args":[{"field":"routed-enough"},{"field":"explicit-enough"},{"value":false}]},{"as":"inferred-comparable","function":"if","args":[{"field":"routed-enough"},{"field":"inferred-enough"},{"value":false}]},{"as":"selected-median-shown","function":"if","args":[{"field":"routed-enough"},{"field":"median-aic"},{"value":null}]},{"as":"explicit-median-shown","function":"if","args":[{"field":"explicit-enough"},{"field":"explicit-median"},{"value":null}]},{"as":"inferred-median-shown","function":"if","args":[{"field":"inferred-enough"},{"field":"inferred-median"},{"value":null}]},{"as":"explicit-difference","function":"difference","args":[{"field":"median-aic"},{"field":"explicit-median"}]},{"as":"inferred-difference","function":"difference","args":[{"field":"median-aic"},{"field":"inferred-median"}]},{"as":"explicit-ratio","function":"quotient","args":[{"field":"explicit-difference"},{"field":"explicit-median"}]},{"as":"inferred-ratio","function":"quotient","args":[{"field":"inferred-difference"},{"field":"inferred-median"}]},{"as":"explicit-delta","function":"if","args":[{"field":"explicit-comparable"},{"field":"explicit-ratio"},{"value":null}]},{"as":"inferred-delta","function":"if","args":[{"field":"inferred-comparable"},{"field":"inferred-ratio"},{"value":null}]},{"as":"explicit-evidence","function":"if","args":[{"field":"explicit-comparable"},{"value":"observational"},{"value":"insufficient data"}]},{"as":"inferred-evidence","function":"if","args":[{"field":"inferred-comparable"},{"value":"observational"},{"value":"insufficient data"}]}]},{"name":"routing-failure-candidates","subject":"Read routing failures, upstream errors, steering and exit 78 evidence.","objective":"Keep execution failures separate from the routing selection state.","acceptance":"A failure after selection never rewrites selected state; free-form error and steering text are absent.","from":"routing-events","compute":[{"as":"failure-event","function":"equals-any","args":[{"field":"event-type"},{"value":"firewall.steering"},{"value":"firewall.upstream_error"},{"value":"subagent.failed"},{"value":"subagent.model_unavailable"},{"value":"model_endpoint.mismatch"}]},{"as":"upstream-error","function":"equals-any","args":[{"field":"name"},{"value":"UPSTREAM_ERROR_RESPONSE"}]},{"as":"exit-78","function":"equals-any","args":[{"field":"exit-code"},{"value":78}]},{"as":"failure-evidence","function":"if","args":[{"field":"failure-event"},{"value":true},{"field":"proxy-failure"}]},{"as":"upstream-evidence","function":"if","args":[{"field":"upstream-error"},{"value":true},{"field":"failure-evidence"}]},{"as":"failure-row","function":"if","args":[{"field":"exit-78"},{"value":true},{"field":"upstream-evidence"}]}]},{"name":"routing-failures","subject":"Show recorded failure and steering events.","objective":"Retain failure evidence independently of selected state.","acceptance":"Only explicit identifiers and counters are shown.","from":"routing-failure-candidates","filter":{"predicates":[{"field":"failure-row","equals":true}]},"order-by":[{"field":"event-timestamp","direction":"desc"}]},{"name":"routing-outcome-totals","subject":"Compare recorded agent job outcomes within pick and classifier label cells.","objective":"Avoid conflating runtime success with delayed safe-output outcomes or operational value.","acceptance":"Unknown outcomes are excluded from success-rate denominators and shown as coverage.","from":"routing-cost-runs","filter":{"predicates":[{"field":"unknown-pick","equals":false}]},"aggregate":{"by":["pick","routing-task-type","routing-scope","routing-complexity"],"values":[{"field":"run","as":"runs","reducer":"count"},{"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-cost-total","reducer":"sum"},{"field":"complete-aic","as":"complete-cost-count","reducer":"count"},{"field":"run","as":"complete-successes","reducer":"count","filter":{"predicates":[{"field":"agent-result","equals":"success"},{"field":"cost-complete","equals":true}]}}]}},{"name":"routing-outcome-statistics","subject":"Compute outcome ratios with known denominators.","objective":"Keep excluded unknown job results visible.","acceptance":"Missing denominators remain unknown.","from":"routing-outcome-totals","compute":[{"as":"unknown-outcomes","function":"difference","args":[{"field":"runs"},{"field":"known-outcomes"}]},{"as":"success-rate","function":"quotient","args":[{"field":"successes"},{"field":"known-outcomes"}]},{"as":"cost-per-success","function":"quotient","args":[{"field":"complete-cost-total"},{"field":"successes"}]},{"as":"z-squared-over-n","function":"quotient","args":[{"value":3.8416},{"field":"known-outcomes"}]},{"as":"wilson-denominator","function":"sum","args":[{"value":1},{"field":"z-squared-over-n"}]},{"as":"wilson-adjustment","function":"quotient","args":[{"value":1.9208},{"field":"known-outcomes"}]},{"as":"wilson-numerator","function":"sum","args":[{"field":"success-rate"},{"field":"wilson-adjustment"}]},{"as":"wilson-center","function":"quotient","args":[{"field":"wilson-numerator"},{"field":"wilson-denominator"}]},{"as":"failure-rate","function":"difference","args":[{"value":1},{"field":"success-rate"}]},{"as":"bernoulli-variance","function":"product","args":[{"field":"success-rate"},{"field":"failure-rate"}]},{"as":"sample-variance","function":"quotient","args":[{"field":"bernoulli-variance"},{"field":"known-outcomes"}]},{"as":"n-squared","function":"product","args":[{"field":"known-outcomes"},{"field":"known-outcomes"}]},{"as":"variance-adjustment","function":"quotient","args":[{"value":0.9604},{"field":"n-squared"}]},{"as":"wilson-variance","function":"sum","args":[{"field":"sample-variance"},{"field":"variance-adjustment"}]},{"as":"wilson-root","function":"sqrt","args":[{"field":"wilson-variance"}]},{"as":"wilson-radius-numerator","function":"product","args":[{"value":1.96},{"field":"wilson-root"}]},{"as":"wilson-radius","function":"quotient","args":[{"field":"wilson-radius-numerator"},{"field":"wilson-denominator"}]},{"as":"wilson-low","function":"difference","args":[{"field":"wilson-center"},{"field":"wilson-radius"}]},{"as":"wilson-high","function":"sum","args":[{"field":"wilson-center"},{"field":"wilson-radius"}]}]},{"name":"routing-outcomes","from":"routing-outcome-statistics","subject":"Gate outcome comparisons with explicit sample coverage.","objective":"Avoid presenting sparse pick cohorts as reliable comparisons.","acceptance":"Success rates and intervals need enough known outcomes; cost per success also needs enough complete costs.","parameters":[{"name":"minimum-sample","type":"number"}],"compute":[{"as":"sample-floor","function":"difference","args":[{"parameter":"minimum-sample"},{"value":1}]},{"as":"enough-outcomes","function":"greater-than","args":[{"field":"known-outcomes"},{"field":"sample-floor"}]},{"as":"enough-costs","function":"greater-than","args":[{"field":"complete-cost-count"},{"field":"sample-floor"}]},{"as":"sample-status","function":"if","args":[{"field":"enough-outcomes"},{"value":"observational"},{"value":"insufficient data"}]},{"as":"display-rate","function":"if","args":[{"field":"enough-outcomes"},{"field":"success-rate"},{"value":null}]},{"as":"display-low","function":"if","args":[{"field":"enough-outcomes"},{"field":"wilson-low"},{"value":null}]},{"as":"display-high","function":"if","args":[{"field":"enough-outcomes"},{"field":"wilson-high"},{"value":null}]},{"as":"display-cost","function":"if","args":[{"field":"enough-costs"},{"field":"cost-per-success"},{"value":null}]}],"select":[{"field":"pick"},{"field":"routing-task-type"},{"field":"routing-scope"},{"field":"routing-complexity"},{"field":"successes"},{"field":"known-outcomes"},{"field":"unknown-outcomes"},{"field":"complete-cost-count"},{"field":"sample-status"},{"field":"display-rate","as":"success-rate"},{"field":"display-low","as":"wilson-low"},{"field":"display-high","as":"wilson-high"},{"field":"display-cost","as":"cost-per-success"}]},{"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-resolution-status","from":"routing-resolutions","subject":"Count configured-model resolution outcomes by event engine and role.","objective":"Show resolved, exact and failed resolutions without multiplying runs by roles.","acceptance":"Runs are distinct run identities; records count individual role resolutions.","aggregate":{"by":["resolution-engine","resolution-role-label","resolution-status"],"values":[{"field":"routing-run-key","as":"runs","reducer":"distinct-count"},{"field":"event","as":"records","reducer":"count"}]},"order-by":[{"field":"resolution-engine","direction":"asc"},{"field":"resolution-role-label","direction":"asc"},{"field":"resolution-status","direction":"asc"}]},{"name":"routing-resolution-run-counts","from":"routing-resolutions","subject":"Count resolution records per scoped run.","objective":"Attach configured-model resolution evidence to run-level coverage.","acceptance":"Several roles in one run remain one covered run.","aggregate":{"by":["routing-run-key"],"values":[{"field":"event","as":"resolution-records","reducer":"count"},{"field":"event","as":"failed-records","reducer":"count","filter":{"predicates":[{"field":"resolution-status","equals":"failed"}]}}]}},{"name":"routing-resolution-run-coverage","from":"routing-runs","subject":"Classify each scoped run's configured-model resolution evidence.","objective":"Separate covered runs, positively routed runs and runs lacking evidence.","acceptance":"Absence never establishes routing or failure; routed state comes only from routing evidence.","joins":[{"source":"routing-resolution-run-counts","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"resolution-records","as":"resolution-records"},{"field":"failed-records","as":"failed-records"}]}],"compute":[{"as":"resolution-record-count","function":"coalesce","args":[{"field":"resolution-records"},{"value":0}]},{"as":"failed-record-count","function":"coalesce","args":[{"field":"failed-records"},{"value":0}]},{"as":"has-resolution","function":"greater-than","args":[{"field":"resolution-record-count"},{"value":0}]},{"as":"has-failed-resolution","function":"greater-than","args":[{"field":"failed-record-count"},{"value":0}]},{"as":"is-routed","function":"equals-any","args":[{"field":"routing-state"},{"value":"selected"},{"value":"selection_failed"},{"value":"harness_reported"},{"value":"configured_unrecorded"}]},{"as":"absent-state","function":"if","args":[{"field":"is-routed"},{"value":"routed"},{"value":"missing"}]},{"as":"resolution-coverage-state","function":"if","args":[{"field":"has-resolution"},{"value":"covered"},{"field":"absent-state"}]}]},{"name":"routing-resolution-coverage-totals","from":"routing-resolution-run-coverage","subject":"Count scoped runs by configured-model resolution coverage.","objective":"Keep denominators explicit for covered, routed and missing evidence.","acceptance":"Routed runs without resolution are expected absence, not missing evidence.","aggregate":{"values":[{"field":"routing-run-key","as":"runs","reducer":"count"},{"field":"routing-run-key","as":"resolution-runs","reducer":"count","filter":{"predicates":[{"field":"has-resolution","equals":true}]}},{"field":"routing-run-key","as":"routed-runs","reducer":"count","filter":{"predicates":[{"field":"is-routed","equals":true}]}},{"field":"routing-run-key","as":"routed-without-resolution","reducer":"count","filter":{"predicates":[{"field":"resolution-coverage-state","equals":"routed"}]}},{"field":"routing-run-key","as":"missing-resolution","reducer":"count","filter":{"predicates":[{"field":"resolution-coverage-state","equals":"missing"}]}},{"field":"routing-run-key","as":"failed-runs","reducer":"count","filter":{"predicates":[{"field":"has-failed-resolution","equals":true}]}},{"field":"resolution-record-count","as":"resolution-records","reducer":"sum"}]}},{"name":"routing-resolution-coverage","from":"routing-resolution-coverage-totals","subject":"Show configured-model resolution coverage with its denominators.","objective":"Distinguish expected routed absence from missing resolution evidence.","acceptance":"A zero denominator produces no share.","compute":[{"as":"non-routed-runs","function":"difference","args":[{"field":"runs"},{"field":"routed-runs"}]},{"as":"resolution-share","function":"quotient","args":[{"field":"resolution-runs"},{"field":"runs"}]}]},{"name":"routing-resolution-observations","from":"routing-resolutions","subject":"Retain resolutions with a known resolved model.","objective":"Build alias history without treating failed or unsafe values as a model.","acceptance":"Failed null resolutions and unsafe resolved values never enter alias history.","filter":{"predicates":[{"field":"unknown-resolved-model","equals":false}]}},{"name":"routing-resolution-timeline","from":"routing-resolution-observations","subject":"Order timed resolutions within each workflow, engine, role, provider and configured model.","objective":"Compare only chronologically adjacent resolutions of the same alias series.","acceptance":"Untimed runs cannot establish a transition or a first or last observation.","filter":{"predicates":[{"field":"run-clock","gte":0}]},"window":[{"operation":"previous","field":"resolved-model-label","as":"previous-resolved-model","groupby":["resolution-series"],"order-by":[{"field":"run-clock","direction":"asc"},{"field":"run","direction":"asc"}]},{"operation":"row-number","field":"run","as":"series-first-position","groupby":["resolution-series"],"order-by":[{"field":"run-clock","direction":"asc"},{"field":"run","direction":"asc"}]},{"operation":"row-number","field":"run","as":"series-last-position","groupby":["resolution-series"],"order-by":[{"field":"run-clock","direction":"desc"},{"field":"run","direction":"desc"}]},{"operation":"row-number","field":"run","as":"model-first-position","groupby":["resolution-series","resolved-model-label"],"order-by":[{"field":"run-clock","direction":"asc"},{"field":"run","direction":"asc"}]},{"operation":"row-number","field":"run","as":"model-last-position","groupby":["resolution-series","resolved-model-label"],"order-by":[{"field":"run-clock","direction":"desc"},{"field":"run","direction":"desc"}]}]},{"name":"routing-resolution-transitions","from":"routing-resolution-timeline","subject":"Mark adjacent resolved-model changes within an alias series.","objective":"Count observed alias moves without claiming why they happened.","acceptance":"First observations are not changes; equal adjacent models are stable.","compute":[{"as":"first-resolution","function":"equals-any","args":[{"field":"previous-resolved-model"},{"value":null}]},{"as":"same-resolution","function":"equals-any","args":[{"field":"previous-resolved-model"},{"field":"resolved-model-label"}]},{"as":"resolution-pair","function":"if","args":[{"field":"first-resolution"},{"value":0},{"value":1}]},{"as":"resolution-changed","function":"if","args":[{"field":"same-resolution"},{"value":0},{"field":"resolution-pair"}]},{"as":"is-transition","function":"greater-than","args":[{"field":"resolution-changed"},{"value":0}]},{"as":"transition-label","function":"concat","args":[{"field":"previous-resolved-model"},{"value":" → "},{"field":"resolved-model-label"}]},{"as":"resolution-transition","function":"if","args":[{"field":"is-transition"},{"field":"transition-label"},{"value":null}]}]},{"name":"routing-alias-model-runs","from":"routing-resolution-transitions","subject":"Identify the first and last timed run for each resolved model of a series.","objective":"Link alias history rows to their contributing runs.","acceptance":"Only timed runs identify first and last observations.","aggregate":{"by":["resolution-series","resolved-model-label"],"values":[{"field":"run","as":"first-run","reducer":"unique","filter":{"predicates":[{"field":"model-first-position","equals":1}]}},{"field":"run","as":"last-run","reducer":"unique","filter":{"predicates":[{"field":"model-last-position","equals":1}]}},{"field":"routing-dashboard-link","as":"first-run-link","reducer":"unique","filter":{"predicates":[{"field":"model-first-position","equals":1}]}}]}},{"name":"routing-alias-history-totals","from":"routing-resolution-observations","subject":"Count runs and recorded clocks for each resolved model of an alias series.","objective":"Expose resolved-model history per workflow, engine, role, provider and configured model.","acceptance":"Distinct runs are counted once; untimed runs remain counted with unknown time.","aggregate":{"by":["resolution-series","full-repository","workflow","resolution-engine","resolution-role-label","resolution-provider","configured-model","resolved-model-label"],"values":[{"field":"routing-run-key","as":"runs","reducer":"distinct-count"},{"field":"routing-run-key","as":"untimed-runs","reducer":"distinct-count","filter":{"predicates":[{"field":"untimed","equals":true}]}},{"field":"run","as":"contributing-runs","reducer":"distinct-list"},{"field":"run-clock","as":"first-clock","reducer":"min"},{"field":"run-clock","as":"last-clock","reducer":"max"}]}},{"name":"routing-alias-history","from":"routing-alias-history-totals","subject":"Show the observed resolved-model history of each alias series.","objective":"Support investigation of alias moves with first and last observed runs.","acceptance":"History rows are observations, not proof that the model was served.","joins":[{"source":"routing-alias-model-runs","type":"left","on":[{"left":"resolution-series","right":"resolution-series"},{"left":"resolved-model-label","right":"resolved-model-label"}],"fields":[{"field":"first-run","as":"first-run"},{"field":"last-run","as":"last-run"},{"field":"first-run-link","as":"routing-dashboard-link"}]}],"compute":[{"as":"first-seen","function":"iso-timestamp","args":[{"field":"first-clock"}]},{"as":"last-seen","function":"iso-timestamp","args":[{"field":"last-clock"}]}],"order-by":[{"field":"resolution-series","direction":"asc"},{"field":"first-clock","direction":"asc"},{"field":"resolved-model-label","direction":"asc"}]},{"name":"routing-alias-sequences","from":"routing-resolution-transitions","subject":"Summarize timed resolved-model changes for each alias series.","objective":"Identify the earliest and latest resolved model and the observed transitions.","acceptance":"Transitions require adjacent recorded run clocks.","aggregate":{"by":["resolution-series"],"values":[{"field":"resolution-changed","as":"changes","reducer":"sum"},{"field":"resolution-pair","as":"pairs","reducer":"sum"},{"field":"resolution-transition","as":"transitions","reducer":"distinct-list"},{"field":"resolved-model-label","as":"first-model","reducer":"unique","filter":{"predicates":[{"field":"series-first-position","equals":1}]}},{"field":"resolved-model-label","as":"latest-model","reducer":"unique","filter":{"predicates":[{"field":"series-last-position","equals":1}]}},{"field":"run","as":"first-run","reducer":"unique","filter":{"predicates":[{"field":"series-first-position","equals":1}]}},{"field":"run","as":"last-run","reducer":"unique","filter":{"predicates":[{"field":"series-last-position","equals":1}]}},{"field":"routing-dashboard-link","as":"last-run-link","reducer":"unique","filter":{"predicates":[{"field":"series-last-position","equals":1}]}}]}},{"name":"routing-alias-move-totals","from":"routing-resolution-observations","subject":"Count runs and distinct resolved models for each alias series.","objective":"Provide one change-summary row per series, including stable aliases.","acceptance":"Engine, role and provider stay part of the series so unrelated resolutions cannot manufacture a move.","aggregate":{"by":["resolution-series","full-repository","workflow","resolution-engine","resolution-role-label","resolution-provider","configured-model"],"values":[{"field":"routing-run-key","as":"runs","reducer":"distinct-count"},{"field":"routing-run-key","as":"untimed-runs","reducer":"distinct-count","filter":{"predicates":[{"field":"untimed","equals":true}]}},{"field":"resolved-model-label","as":"distinct-models","reducer":"distinct-count"},{"field":"resolved-model-label","as":"resolved-models","reducer":"distinct-list"},{"field":"run-clock","as":"first-clock","reducer":"min"},{"field":"run-clock","as":"last-clock","reducer":"max"}]}},{"name":"routing-alias-moves","from":"routing-alias-move-totals","subject":"Highlight alias series whose resolved model changed between timed runs.","objective":"Investigate aliases moving to newer models without claiming cause or served-model evidence.","acceptance":"Exactly one row per series; only adjacent timed runs establish a move and unordered changes stay distinct.","joins":[{"source":"routing-alias-sequences","type":"left","on":[{"left":"resolution-series","right":"resolution-series"}],"fields":[{"field":"changes","as":"changes"},{"field":"pairs","as":"pairs"},{"field":"transitions","as":"transitions"},{"field":"first-model","as":"first-model"},{"field":"latest-model","as":"latest-model"},{"field":"first-run","as":"first-run"},{"field":"last-run","as":"last-run"},{"field":"last-run-link","as":"routing-dashboard-link"}]}],"compute":[{"as":"change-count","function":"coalesce","args":[{"field":"changes"},{"value":0}]},{"as":"moved","function":"greater-than","args":[{"field":"change-count"},{"value":0}]},{"as":"several-models","function":"greater-than","args":[{"field":"distinct-models"},{"value":1}]},{"as":"unmoved-state","function":"if","args":[{"field":"several-models"},{"value":"order unknown"},{"value":"stable"}]},{"as":"alias-change","function":"if","args":[{"field":"moved"},{"value":"alias moved"},{"field":"unmoved-state"}]},{"as":"move-label","function":"concat","args":[{"field":"first-model"},{"value":" → "},{"field":"latest-model"}]},{"as":"model-change","function":"if","args":[{"field":"moved"},{"field":"move-label"},{"value":null}]},{"as":"first-seen","function":"iso-timestamp","args":[{"field":"first-clock"}]},{"as":"last-seen","function":"iso-timestamp","args":[{"field":"last-clock"}]}],"order-by":[{"field":"change-count","direction":"desc"},{"field":"resolution-series","direction":"asc"}]},{"name":"routing-resolution-failure-records","from":"routing-resolutions","subject":"Retain failed configured-model resolutions with their runs.","objective":"Link each failed resolution to its contributing run.","acceptance":"Failed resolved models stay unknown; causes are never inferred.","filter":{"predicates":[{"field":"resolution-status","equals":"failed"}]},"order-by":[{"field":"run-clock","direction":"desc"},{"field":"run","direction":"desc"}]},{"name":"routing-resolution-failures","from":"routing-resolution-failure-records","subject":"Group failed resolutions by configured model and cause.","objective":"Keep model_unavailable and catalog_unavailable distinct with engine and role context.","acceptance":"Affected runs are distinct run identities; a single-run group links to that run.","aggregate":{"by":["configured-model","resolution-cause","resolution-engine","resolution-role-label","resolution-provider"],"values":[{"field":"routing-run-key","as":"affected-runs","reducer":"distinct-count"},{"field":"event","as":"records","reducer":"count"},{"field":"run","as":"runs","reducer":"distinct-list"},{"field":"routing-dashboard-link","as":"routing-dashboard-link","reducer":"unique"}]},"order-by":[{"field":"affected-runs","direction":"desc"},{"field":"configured-model","direction":"asc"},{"field":"resolution-cause","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":"campaign-cost-totals","subject":"Sum observed AI Credit cost across declared campaign orchestrators and workers.","objective":"Attribute retained workflow AIC totals to centrally managed campaigns without computing unrelated inventory metrics.","acceptance":"Sum only positive recorded orchestrator and worker workflow AIC by campaign; exclude workflows with zero or missing costs rather than treating them as free execution.","from":"workflows","joins":[{"source":"workflow-aic-totals","type":"inner","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"aic","as":"observed-aic"}]}],"filter":{"predicates":[{"field":"workflow-role","in":["orchestrator","worker"]}]},"compute":[{"as":"aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]}],"aggregate":{"by":["campaign"],"values":[{"field":"aic","as":"aic","reducer":"sum"}]}},{"name":"cost-by-campaign","subject":"Present observed AI Credit cost grouped by centrally managed campaign.","objective":"Identify campaigns whose observed AI Credit use needs investigation.","acceptance":"Rows preserve positive recorded native aic values and descending order; exclude campaigns without recorded positive costs rather than inferring free execution, savings, or value.","from":"campaigns","joins":[{"source":"campaign-cost-totals","type":"inner","on":[{"left":"campaign","right":"campaign"}],"fields":[{"field":"aic","as":"observed-aic"}]}],"compute":[{"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-name"},{"field":"campaign-dashboard-link"},{"field":"aic"}],"order-by":[{"field":"aic","direction":"desc"}]},{"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":"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-workflow-import-evidence","subject":"Summarize retained import evidence at workflow grain for campaign inventory quality.","objective":"Preserve import-evidence provenance without materializing per-run ingestion indicators.","acceptance":"Compose all four retained event sources with the same availability, freshness, and completeness as event-runs; counts describe retained records, not executions or outcomes.","from":"audit-event-runs","union":["domain-event-runs","tool-event-runs","issue-event-runs"],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"events","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":"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":"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":"The import-evidence join preserves inventory provenance without per-run ingestion indicators. It follows run aggregation so unavailable run evidence retains the original failure-quality semantics.","from":"campaign-workflow-execution-base","joins":[{"source":"campaign-workflow-import-evidence","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"events","as":"imported-events"}]}],"select":[{"field":"organization"},{"field":"repository"},{"field":"workflow"},{"field":"runs"},{"field":"aic"}]},{"name":"campaign-workflow-inventory","subject":"Project declared campaign workflows with lean execution and configuration evidence.","objective":"Provide campaign totals and lists without unused ingestion, failure, or dashboard-link computations.","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":"workflows","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"}]}],"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":"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"}],"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-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 recorded installed/current version lists plus upgrade-required and unknown flags; inspect absent or mixed version evidence rather than inferring a repository-wide installed version.","from":"workflows","filter":{"predicates":[{"field":"workflow","includes":".md"}]},"compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"update-available","function":"equals-any","args":[{"field":"gh-aw-update-state"},{"value":"update-available"}]},{"as":"upgrade-state-unknown","function":"equals-any","args":[{"field":"gh-aw-update-state"},{"value":"unknown"}]},{"as":"upgrade-state-unknown-value","function":"if","args":[{"field":"upgrade-state-unknown"},{"value":1},{"value":0}]},{"as":"upgrade-required-value","function":"if","args":[{"field":"update-available"},{"value":1},{"value":0}]}],"aggregate":{"by":["repository-coordinate"],"values":[{"field":"gh-aw-version","as":"gh-aw-version","reducer":"distinct-list"},{"field":"gh-aw-current-version","as":"gh-aw-current-version","reducer":"distinct-list"},{"field":"upgrade-required-value","as":"upgrade-required","reducer":"max"},{"field":"upgrade-state-unknown-value","as":"upgrade-state-unknown","reducer":"max"}]}},{"name":"maintenance-repositories","subject":"List each repository with recorded compiler versions and computed upgrade state.","objective":"Expose recorded compiler versions and computed upgrade state per repository, with its GitHub home URL for inspection.","acceptance":"Return repository, repository-url, version lists, upgrade-required, upgrade-state, and upgrade-action-visible. Show Upgrade for outdated or unknown evidence; hide it for known-current repositories. Visibility grants no rollout authority.","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-unavailable","function":"equals-any","args":[{"field":"gh-aw-version"},{"value":""},{"value":"unknown"}]},{"as":"compiler-versions-match","function":"equals-any","args":[{"field":"gh-aw-version"},{"field":"gh-aw-current-version"}]},{"as":"known-current-versions","function":"if","args":[{"field":"installed-version-unavailable"},{"value":false},{"field":"compiler-versions-match"}]},{"as":"upgrade-status-unavailable","function":"if","args":[{"field":"known-current-versions"},{"value":false},{"value":true}]},{"as":"current-or-unavailable","function":"if","args":[{"field":"upgrade-status-unavailable"},{"value":"Upgrade status unavailable"},{"value":"Current"}]},{"as":"upgrade-action-visible","function":"if","args":[{"field":"should-upgrade"},{"value":true},{"field":"upgrade-status-unavailable"}]},{"as":"upgrade-state","function":"if","args":[{"field":"should-upgrade"},{"value":"Upgrade recommended"},{"field":"current-or-unavailable"}]}],"select":[{"field":"repository-coordinate","as":"repository"},{"field":"repository-url"},{"field":"gh-aw-version"},{"field":"gh-aw-current-version"},{"field":"upgrade-required"},{"field":"upgrade-action-visible"},{"field":"upgrade-state"}],"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":"campaigns","filter":{"predicates":[{"field":"campaign-update-state","equals":"update-available"}]},"select":[{"field":"campaign-update-state"}],"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-required row only when the retained value is 1; no row does not establish that all repositories are current when version data is missing.","from":"maintenance-repositories","filter":{"predicates":[{"field":"upgrade-required","equals":1}]},"select":[{"field":"upgrade-required"}],"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","filter":{"predicates":[{"field":"workflow-role","in":["orchestrator","worker"]}]},"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-observed-run-counts","subject":"Count distinct retained run IDs by repository without importing event evidence.","objective":"Supply the run-volume chart without computing activity health, ingestion coverage, or workflow costs.","acceptance":"Group by organization and repository coordinate and count distinct retained run IDs, not attempts; missing runs remain missing evidence and global scope and time filters still apply.","from":"runs","compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]}],"aggregate":{"by":["organization","repository-coordinate"],"values":[{"field":"run","as":"runs","reducer":"distinct-count"}]}},{"name":"repository-run-inventory","subject":"Registered repositories and distinct retained workflow run IDs in the selected horizon.","objective":"Compare repository execution volume and choose repositories for drill-down.","acceptance":"Keep up to 100 repository identities and drill links, ordered by run count descending with repository tie-breaks. Zero means no retained runs, not proof of inactivity; preserve unavailable and partial evidence. The Table view retains the 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":"Count mutually exclusive runtime conclusion classes for the selected workflow.","objective":"Identify workflows whose retained run conclusions or pending execution warrant investigation.","acceptance":"Within each organization, repository, and workflow, successful, failed, approval, pending, and other counts sum to the retained run total; missing or unrecognized conclusions are not treated as success, and runtime success is not a verified outcome.","from":"runs","compute":[{"as":"successful","function":"equals-any","args":[{"field":"run-conclusion"},{"value":"success"}]},{"as":"failed","function":"equals-any","args":[{"field":"run-conclusion"},{"value":"failure"},{"value":"startup-failure"},{"value":"stale"},{"value":"timed-out"}]},{"as":"approval","function":"equals-any","args":[{"field":"run-conclusion"},{"value":"action-required"}]},{"as":"classified","function":"equals-any","args":[{"field":"run-conclusion"},{"value":"success"},{"value":"failure"},{"value":"startup-failure"},{"value":"stale"},{"value":"timed-out"},{"value":"action-required"}]},{"as":"status","function":"concat","args":[{"field":"run-status"},{"value":""}]},{"as":"terminal-or-missing","function":"equals-any","args":[{"field":"status"},{"value":"completed"},{"value":""}]}],"aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"run","as":"total","reducer":"count"},{"field":"run","as":"successful","reducer":"count","filter":{"predicates":[{"field":"successful","equals":true}]}},{"field":"run","as":"failed","reducer":"count","filter":{"predicates":[{"field":"failed","equals":true}]}},{"field":"run","as":"approval","reducer":"count","filter":{"predicates":[{"field":"approval","equals":true}]}},{"field":"run","as":"pending","reducer":"count","filter":{"predicates":[{"field":"classified","equals":false},{"field":"terminal-or-missing","equals":false}]}},{"field":"run","as":"other","reducer":"count","filter":{"predicates":[{"field":"classified","equals":false},{"field":"terminal-or-missing","equals":true}]}}]}},{"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":"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 display names and drill-down links computed only for the active list.","from":"campaign-workflow-inventory","filter":{"predicates":[{"field":"workflow-role","in":["orchestrator","worker"]},{"field":"workflow-active","equals":"true"}]},"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":"workflow-display-name","function":"coalesce","args":[{"field":"workflow-name"},{"field":"workflow"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"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":"repository"},{"value":" repository dashboard"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"field":"repository-link"},{"field":"repository-dashboard-href"},{"field":"repository-dashboard-label"},{"field":"repository"}]},{"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-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":"operational-value-plot-series","subject":"One primary outcome plot per repository, optional campaign, workflow and native measure.","objective":"Keep every finite value visible and move provenance to individual observations.","acceptance":"Separate unlike units and directions. Preserve evaluator, maturity and cadence on points. Connect only adjacent points with known matching context and declared cadence; never infer a combined trend or baseline.","from":"operational-values","filter":{"predicates":[{"field":"operational-value-role","equals":"primary"}]},"compute":[{"as":"value-workflow","function":"coalesce","args":[{"field":"workflow"},{"field":"workflow-slug"}]},{"as":"workflow-missing","function":"equals-any","args":[{"field":"value-workflow"},{"value":null}]},{"as":"workflow-title","function":"concat","args":[{"value":" - "},{"field":"value-workflow"}]},{"as":"workflow-title-suffix","function":"if","args":[{"field":"workflow-missing"},{"value":""},{"field":"workflow-title"}]},{"as":"plot-window-start-ms","function":"timestamp","args":[{"context":"time-start"}]},{"as":"plot-window-end-ms","function":"timestamp","args":[{"context":"time-end"}]},{"as":"plot-contract","function":"coalesce","args":[{"field":"evaluator-digest"},{"value":"unknown"}]},{"as":"plot-unversioned","function":"equals-any","args":[{"field":"plot-contract"},{"value":"unknown"}]},{"as":"plot-comparison-note","function":"literal","args":[{"value":"Recorded measurements, not a combined trend or a verified impact assessment."}]},{"as":"plot-evidence-mode","function":"literal","args":[{"value":"per-observation"}]},{"as":"plot-mature","function":"equals-any","args":[{"field":"maturity-status"},{"value":"matured"}]},{"as":"plot-provisional","function":"equals-any","args":[{"field":"plot-mature"},{"value":false}]},{"as":"plot-max-gap-days","function":"coalesce","args":[{"field":"cadence-days"},{"value":0}]},{"as":"plot-period-start","function":"timestamp","args":[{"field":"window-start"}]},{"as":"plot-period-end","function":"timestamp","args":[{"field":"window-end"}]},{"as":"plot-period-duration","function":"difference","args":[{"field":"plot-period-end"},{"field":"plot-period-start"}]},{"as":"plot-contract-context","function":"concat","args":[{"field":"plot-contract"},{"value":"|"},{"field":"maturity-status"},{"value":"|"},{"field":"cadence-days"},{"value":"|"},{"field":"measurement-kind"}]},{"as":"plot-period-context","function":"concat","args":[{"field":"plot-period-duration"},{"value":"|"},{"field":"evaluation-mode"},{"value":"|"},{"field":"adoption-at"}]},{"as":"plot-known-context","function":"concat","args":[{"field":"plot-contract-context"},{"value":"|"},{"field":"plot-period-context"}]},{"as":"plot-context-key","function":"if","args":[{"field":"plot-unversioned"},{"value":null},{"field":"plot-known-context"}]},{"as":"plot-provenance-description","function":"concat","args":[{"value":"Evaluator: "},{"field":"plot-contract"},{"value":". Maturity: "},{"field":"maturity-status"},{"value":". Cadence (days): "},{"field":"plot-max-gap-days"},{"value":" (0 means unknown). "}]},{"as":"plot-period-description","function":"concat","args":[{"value":"Window: "},{"field":"window-start"},{"value":" to "},{"field":"window-end"},{"value":". Adoption: "},{"field":"adoption-at"},{"value":". Mode: "},{"field":"evaluation-mode"}]},{"as":"plot-point-description","function":"concat","args":[{"field":"plot-provenance-description"},{"field":"plot-period-description"}]},{"as":"series-repository","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"measure-title","function":"coalesce","args":[{"field":"operational-value-name"},{"field":"operational-value-definition"}]},{"as":"plot-title","function":"concat","args":[{"field":"measure-title"},{"field":"workflow-title-suffix"}]}],"temporal-series":{"time":"observed-at","series":"series-repository","shape":"panels","link":"run-link","carry":["campaign","value-workflow","series-repository","plot-title","plot-window-start-ms","plot-window-end-ms","operational-value-definition","operational-value-name","operational-value-unit","operational-value-direction","plot-evidence-mode","plot-comparison-note"],"point-carry":["plot-context-key","plot-max-gap-days","plot-provisional","plot-point-description","evaluator-digest","maturity-status","cadence-days","window-start","window-end","adoption-at","evaluation-mode"],"measures":[{"field":"operational-value","key":"operational-value-definition","kind":"primary"}]},"order-by":[{"field":"plot-title","direction":"asc"}]},{"name":"operational-value-period-observations","subject":"Exact native measurement periods and frozen evaluator identities.","objective":"Keep measurement duration, cadence, analysis endpoint and adoption context separate.","acceptance":"Use only declared period boundaries and coverage. Never infer legacy metadata or turn the display horizon into an evidence window.","from":"operational-values","time":{"range":"all"},"compute":[{"as":"campaign-key","function":"concat","args":[{"value":"campaign:"},{"field":"campaign"}]},{"as":"value-workflow","function":"coalesce","args":[{"field":"workflow"},{"field":"workflow-slug"}]},{"as":"workflow-key","function":"concat","args":[{"value":"workflow:"},{"field":"value-workflow"}]},{"as":"observation-marker","function":"literal","args":[{"value":1}]},{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"window-start-ms","function":"timestamp","args":[{"field":"window-start"}]},{"as":"window-end-ms","function":"timestamp","args":[{"field":"window-end"}]},{"as":"assessment-ms","function":"timestamp","args":[{"field":"observed-at"}]},{"as":"period-order-ms","function":"coalesce","args":[{"field":"window-end-ms"},{"field":"assessment-ms"}]},{"as":"period-duration-ms","function":"difference","args":[{"field":"window-end-ms"},{"field":"window-start-ms"}]},{"as":"measurement-shape","function":"concat","args":[{"field":"operational-value-unit"},{"value":"|"},{"field":"operational-value-direction"},{"value":"|"},{"field":"measurement-kind"},{"value":"|"},{"field":"cadence-days"}]},{"as":"period-contract","function":"concat","args":[{"field":"evaluator-digest"},{"value":"|"},{"field":"measurement-shape"},{"value":"|"},{"field":"period-duration-ms"}]}],"window":[{"operation":"change","field":"observation-marker","as":"newer-period-assessment","mode":"absolute","groupby":["campaign-key","workflow-key","repository-coordinate","operational-value-definition","period-contract","window-start-ms","window-end-ms"],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"id","direction":"desc"}]}]},{"name":"operational-value-period-latest","subject":"Latest assessment of each exact measurement period.","objective":"Do not resurrect an older accepted value when the same period has a newer unavailable assessment.","acceptance":"Deduplicate before checking coverage or maturity. Preserve null values and missing metadata.","from":"operational-value-period-observations","filter":{"predicates":[{"field":"newer-period-assessment","equals":"unknown"}]}},{"name":"operational-value-complete-period-candidates","subject":"Complete mature reference periods.","objective":"Require accepted evidence for a recent comparison rather than arbitrary older observations.","acceptance":"Only explicitly complete mature periods can serve as references. Missing periods remain missing.","from":"operational-value-period-latest","filter":{"predicates":[{"field":"coverage-status","equals":"complete"},{"field":"maturity-status","equals":"matured"}]},"compute":[{"as":"reference-endpoint-ms","function":"timestamp","args":[{"context":"time-end"}]},{"as":"future-reference-assessment","function":"greater-than","args":[{"field":"assessment-ms"},{"field":"reference-endpoint-ms"}]}]},{"name":"operational-value-complete-periods","subject":"Complete reference evidence available by the analysis endpoint.","objective":"Prevent future reference corrections from changing a historical comparison.","acceptance":"A future latest assessment withholds the reference; never resurrect an older accepted correction.","from":"operational-value-complete-period-candidates","filter":{"predicates":[{"field":"future-reference-assessment","equals":false}]}},{"name":"operational-value-comparable-history","subject":"Native change between adjacent equal-duration measurement periods.","objective":"Compare non-overlapping intervals or snapshot cutoffs under one evaluator, independently of adoption classification.","acceptance":"The reference ends exactly at the current start, with the same duration, cadence, native unit, direction and evaluator. No overlapping daily rolling comparison or substitution across a gap.","from":"operational-value-period-latest","joins":[{"source":"operational-value-complete-periods","type":"left","on":[{"left":"campaign-key","right":"campaign-key"},{"left":"workflow-key","right":"workflow-key"},{"left":"repository-coordinate","right":"repository-coordinate"},{"left":"operational-value-definition","right":"operational-value-definition"},{"left":"period-contract","right":"period-contract"},{"left":"window-start-ms","right":"window-end-ms"}],"fields":[{"field":"operational-value","as":"reference-native-value"},{"field":"window-start","as":"reference-window-start"},{"field":"window-end","as":"reference-window-end"},{"field":"population-digest","as":"reference-population-digest"},{"field":"eligible-count","as":"reference-eligible-count"},{"field":"rollup-denominator","as":"reference-denominator"}]}],"compute":[{"as":"previous-native-change","function":"difference","args":[{"field":"operational-value"},{"field":"reference-native-value"}]},{"as":"current-period","function":"concat","args":[{"field":"window-start"},{"value":" to "},{"field":"window-end"}]},{"as":"reference-period","function":"concat","args":[{"field":"reference-window-start"},{"value":" to "},{"field":"reference-window-end"}]},{"as":"interval-comparison","function":"concat","args":[{"field":"current-period"},{"value":" vs "},{"field":"reference-period"}]},{"as":"snapshot-comparison","function":"concat","args":[{"value":"Cutoff "},{"field":"window-end"},{"value":" vs "},{"field":"reference-window-end"}]},{"as":"snapshot-measure","function":"equals-any","args":[{"field":"measurement-kind"},{"value":"snapshot"}]},{"as":"comparison-period","function":"if","args":[{"field":"snapshot-measure"},{"field":"snapshot-comparison"},{"field":"interval-comparison"}]}]},{"name":"operational-value-movements","subject":"Direction-aware movement of retained primary repository measures.","objective":"Classify native changes without averaging unlike measures.","acceptance":"Movement requires current complete mature periods, a known evaluator, native unit, increase/decrease direction and an adjacent equal-duration reference. Expose cohort and exposure changes; no sustained-trend, statistical or causal claim.","from":"operational-value-comparable-history","filter":{"predicates":[{"field":"operational-value-role","equals":"primary"}]},"compute":[{"as":"analysis-end-ms","function":"timestamp","args":[{"context":"time-end"}]},{"as":"assessment-age-ms","function":"difference","args":[{"field":"analysis-end-ms"},{"field":"assessment-ms"}]},{"as":"cadence-ms","function":"product","args":[{"field":"cadence-days"},{"value":86400000}]},{"as":"freshness-limit-ms","function":"difference","args":[{"field":"cadence-ms"},{"value":1}]},{"as":"past-cadence","function":"greater-than","args":[{"field":"assessment-age-ms"},{"field":"freshness-limit-ms"}]},{"as":"future-period","function":"greater-than","args":[{"value":0},{"field":"assessment-age-ms"}]},{"as":"known-analysis-end","function":"greater-than","args":[{"field":"analysis-end-ms"},{"value":0}]},{"as":"positive-period","function":"greater-than","args":[{"field":"period-duration-ms"},{"value":0}]},{"as":"positive-cadence","function":"greater-than","args":[{"field":"cadence-days"},{"value":0}]},{"as":"known-measurement-kind","function":"equals-any","args":[{"field":"measurement-kind"},{"value":"interval"},{"value":"snapshot"}]},{"as":"complete-coverage","function":"equals-any","args":[{"field":"coverage-status"},{"value":"complete"}]},{"as":"same-population","function":"equals-any","args":[{"field":"population-digest"},{"field":"reference-population-digest"}]},{"as":"population-note","function":"if","args":[{"field":"same-population"},{"value":"Aggregate movement is not proof of within-cohort improvement."},{"value":"Eligible cohort changed or its identity was not retained; inspect workload mix."}]},{"as":"exposure-change","function":"difference","args":[{"field":"rollup-denominator"},{"field":"reference-denominator"}]},{"as":"campaign-label","function":"coalesce","args":[{"field":"campaign-name"},{"field":"campaign"}]},{"as":"mature","function":"equals-any","args":[{"field":"maturity-status"},{"value":"matured"}]},{"as":"native-change-state","function":"coalesce","args":[{"field":"previous-native-change"},{"value":null}]},{"as":"missing-change","function":"equals-any","args":[{"field":"native-change-state"},{"value":null}]},{"as":"contract","function":"coalesce","args":[{"field":"evaluator-digest"},{"value":"unknown"}]},{"as":"missing-contract","function":"equals-any","args":[{"field":"contract"},{"value":"unknown"}]},{"as":"native-unit","function":"coalesce","args":[{"field":"operational-value-unit"},{"value":"unknown"}]},{"as":"missing-unit","function":"equals-any","args":[{"field":"native-unit"},{"value":"unknown"}]},{"as":"increase-goal","function":"equals-any","args":[{"field":"operational-value-direction"},{"value":"increase"}]},{"as":"decrease-goal","function":"equals-any","args":[{"field":"operational-value-direction"},{"value":"decrease"}]},{"as":"rising","function":"greater-than","args":[{"field":"previous-native-change"},{"value":0}]},{"as":"falling","function":"greater-than","args":[{"value":0},{"field":"previous-native-change"}]},{"as":"increasing-movement","function":"if","args":[{"field":"rising"},{"value":"Improving"},{"value":"Worsening"}]},{"as":"decreasing-movement","function":"if","args":[{"field":"falling"},{"value":"Improving"},{"value":"Worsening"}]},{"as":"increase-movement","function":"if","args":[{"field":"increase-goal"},{"field":"increasing-movement"},{"value":"Target assessment required"}]},{"as":"directed-movement","function":"if","args":[{"field":"decrease-goal"},{"field":"decreasing-movement"},{"field":"increase-movement"}]},{"as":"unchanged","function":"equals-any","args":[{"field":"previous-native-change"},{"value":0}]},{"as":"unchanged-increase","function":"if","args":[{"field":"increase-goal"},{"value":"Unchanged"},{"value":"Target assessment required"}]},{"as":"unchanged-direction","function":"if","args":[{"field":"decrease-goal"},{"value":"Unchanged"},{"field":"unchanged-increase"}]},{"as":"observed-movement","function":"if","args":[{"field":"unchanged"},{"field":"unchanged-direction"},{"field":"directed-movement"}]},{"as":"comparable-movement","function":"if","args":[{"field":"missing-change"},{"value":"Insufficient comparable history"},{"field":"observed-movement"}]},{"as":"versioned-movement","function":"if","args":[{"field":"missing-contract"},{"value":"Unversioned evidence"},{"field":"comparable-movement"}]},{"as":"unit-movement","function":"if","args":[{"field":"missing-unit"},{"value":"Native unit unavailable"},{"field":"versioned-movement"}]},{"as":"fresh-movement","function":"if","args":[{"field":"past-cadence"},{"value":"Stale or future evidence"},{"field":"unit-movement"}]},{"as":"bounded-movement","function":"if","args":[{"field":"future-period"},{"value":"Stale or future evidence"},{"field":"fresh-movement"}]},{"as":"endpoint-movement","function":"if","args":[{"field":"known-analysis-end"},{"field":"bounded-movement"},{"value":"Stale or future evidence"}]},{"as":"coverage-movement","function":"if","args":[{"field":"complete-coverage"},{"field":"endpoint-movement"},{"value":"Coverage incomplete or unknown"}]},{"as":"kind-movement","function":"if","args":[{"field":"known-measurement-kind"},{"field":"coverage-movement"},{"value":"Measurement period unavailable"}]},{"as":"cadence-movement","function":"if","args":[{"field":"positive-cadence"},{"field":"kind-movement"},{"value":"Measurement period unavailable"}]},{"as":"period-movement","function":"if","args":[{"field":"positive-period"},{"field":"cadence-movement"},{"value":"Measurement period unavailable"}]},{"as":"mature-movement","function":"if","args":[{"field":"mature"},{"field":"period-movement"},{"value":"Provisional or unavailable"}]},{"as":"movement","function":"if","args":[{"field":"missing-contract"},{"value":"Unversioned evidence"},{"field":"mature-movement"}]},{"as":"recent-comparable","function":"equals-any","args":[{"field":"movement"},{"value":"Improving"},{"value":"Worsening"},{"value":"Unchanged"}]},{"as":"native-change","function":"if","args":[{"field":"recent-comparable"},{"field":"previous-native-change"},{"value":null}]},{"as":"recent-comparison-period","function":"if","args":[{"field":"recent-comparable"},{"field":"comparison-period"},{"value":"Unavailable; inspect comparison status."}]},{"as":"measurement-note","function":"if","args":[{"field":"snapshot-measure"},{"value":"Cutoff-state change, not a count of remediations. "},{"value":""}]},{"as":"comparison-context","function":"concat","args":[{"field":"measurement-note"},{"field":"population-note"}]}],"order-by":[{"field":"campaign","direction":"asc"},{"field":"repository-coordinate","direction":"asc"},{"field":"operational-value-definition","direction":"asc"}]},{"name":"operational-value-ordered-history","subject":"Latest observation of each repository measure, before maturity or value filtering.","objective":"Prevent an older positive or mature result from masking a newer incomplete observation.","acceptance":"Order by measurement cutoff, then assessment timestamp and stable ID. Historical corrections cannot replace a newer measurement period. Missing period metadata falls back to assessment time and remains incomparable. Preserve native zero and null.","from":"operational-value-movements","window":[{"operation":"change","field":"observation-marker","as":"preceding-observation","mode":"absolute","groupby":["campaign-key","workflow-key","organization","repository","operational-value-definition"],"order-by":[{"field":"period-order-ms","direction":"desc"},{"field":"observed-at","direction":"desc"},{"field":"id","direction":"desc"}]}]},{"name":"operational-value-latest","subject":"Latest primary outcome per campaign, repository and measure.","objective":"Expose the latest retained movement, including incomplete evidence.","acceptance":"Latest selection precedes aggregation. Older mature or positive observations cannot mask newer incomplete evidence.","from":"operational-value-ordered-history","filter":{"predicates":[{"field":"preceding-observation","equals":"unknown"}]}},{"name":"operational-value-repository-evidence-order","subject":"Identify oldest and newest latest primary evidence per repository.","objective":"Expose date bounds across the latest retained primary measures for a repository.","acceptance":"Partition by repository, retaining all input rows. Identify first rows in ascending and descending observation order, with ID tie-breaks. Do not infer freshness or fill gaps.","from":"operational-value-latest","window":[{"operation":"change","field":"observation-marker","as":"before-newest","groupby":["repository-coordinate"],"order-by":[{"field":"observed-at","direction":"desc"},{"field":"id","direction":"desc"}]},{"operation":"change","field":"observation-marker","as":"before-oldest","groupby":["repository-coordinate"],"order-by":[{"field":"observed-at","direction":"asc"},{"field":"id","direction":"asc"}]}]},{"name":"operational-value-repository-counts","subject":"Latest primary movement counts per repository across campaigns and standalone workflows.","objective":"Summarize comparable and missing primary-measure evidence without combining native values.","acceptance":"Group by repository; count goals and improving, worsening and unchanged measures. Preserve oldest/newest retained dates. Incomparable goals remain in the total, not in comparable counts.","from":"operational-value-repository-evidence-order","aggregate":{"by":["organization","repository","repository-coordinate"],"values":[{"field":"observation-marker","as":"goals","reducer":"count"},{"field":"operational-value","as":"mature-goals","reducer":"count","filter":{"predicates":[{"field":"maturity-status","equals":"matured"}]}},{"field":"observation-marker","as":"improving","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Improving"}]}},{"field":"observation-marker","as":"worsening","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Worsening"}]}},{"field":"observation-marker","as":"unchanged","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Unchanged"}]}},{"field":"observation-marker","as":"unversioned-goals","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Unversioned evidence"}]}},{"field":"observation-marker","as":"unitless-goals","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Native unit unavailable"}]}},{"field":"observation-marker","as":"provisional-goals","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Provisional or unavailable"}]}},{"field":"observation-marker","as":"history-gap-goals","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Insufficient comparable history"}]}},{"field":"observation-marker","as":"target-goals","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Target assessment required"}]}},{"field":"observation-marker","as":"period-gap-goals","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Measurement period unavailable"}]}},{"field":"observation-marker","as":"coverage-gap-goals","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Coverage incomplete or unknown"}]}},{"field":"observation-marker","as":"stale-goals","reducer":"count","filter":{"predicates":[{"field":"movement","equals":"Stale or future evidence"}]}},{"field":"observed-at","as":"newest-evidence-at","reducer":"unique","filter":{"predicates":[{"field":"before-newest","equals":"unknown"}]}},{"field":"observed-at","as":"oldest-evidence-at","reducer":"unique","filter":{"predicates":[{"field":"before-oldest","equals":"unknown"}]}}]}},{"name":"operational-value-repository-signals","subject":"One conservative direction signal per repository across all workflow outcomes.","objective":"Rank repository investigations while preserving disagreement and evidence gaps.","acceptance":"Any incomparable primary measure makes the repository insufficient; opposing comparable measures are Mixed. Count each repository once.","from":"operational-value-repository-counts","compute":[{"as":"comparable-goals","function":"sum","args":[{"field":"improving"},{"field":"worsening"},{"field":"unchanged"}]},{"as":"incomplete","function":"greater-than","args":[{"field":"goals"},{"field":"comparable-goals"}]},{"as":"has-improving","function":"greater-than","args":[{"field":"improving"},{"value":0}]},{"as":"has-worsening","function":"greater-than","args":[{"field":"worsening"},{"value":0}]},{"as":"positive-state","function":"if","args":[{"field":"has-improving"},{"value":"Improving"},{"value":"Unchanged"}]},{"as":"negative-state","function":"if","args":[{"field":"has-improving"},{"value":"Mixed"},{"value":"Worsening"}]},{"as":"comparable-state","function":"if","args":[{"field":"has-worsening"},{"field":"negative-state"},{"field":"positive-state"}]},{"as":"signal","function":"if","args":[{"field":"incomplete"},{"value":"Insufficient evidence"},{"field":"comparable-state"}]},{"as":"version-gap","function":"greater-than","args":[{"field":"unversioned-goals"},{"value":0}]},{"as":"unit-gap","function":"greater-than","args":[{"field":"unitless-goals"},{"value":0}]},{"as":"provisional-gap","function":"greater-than","args":[{"field":"provisional-goals"},{"value":0}]},{"as":"history-gap","function":"greater-than","args":[{"field":"history-gap-goals"},{"value":0}]},{"as":"target-gap","function":"greater-than","args":[{"field":"target-goals"},{"value":0}]},{"as":"version-note","function":"if","args":[{"field":"version-gap"},{"value":"Measurement version missing. "},{"value":""}]},{"as":"unit-note","function":"if","args":[{"field":"unit-gap"},{"value":"Native unit missing. "},{"value":""}]},{"as":"provisional-note","function":"if","args":[{"field":"provisional-gap"},{"value":"Provisional or unavailable measurements. "},{"value":""}]},{"as":"history-note","function":"if","args":[{"field":"history-gap"},{"value":"Comparable history missing. "},{"value":""}]},{"as":"target-note","function":"if","args":[{"field":"target-gap"},{"value":"Target assessment needed. "},{"value":""}]},{"as":"period-gap","function":"greater-than","args":[{"field":"period-gap-goals"},{"value":0}]},{"as":"coverage-gap","function":"greater-than","args":[{"field":"coverage-gap-goals"},{"value":0}]},{"as":"stale-gap","function":"greater-than","args":[{"field":"stale-goals"},{"value":0}]},{"as":"period-note","function":"if","args":[{"field":"period-gap"},{"value":"Measurement periods missing. "},{"value":""}]},{"as":"coverage-note","function":"if","args":[{"field":"coverage-gap"},{"value":"Period coverage incomplete or unknown. "},{"value":""}]},{"as":"stale-note","function":"if","args":[{"field":"stale-gap"},{"value":"Evidence outside the analysis cadence. "},{"value":""}]},{"as":"gap-reasons","function":"concat","args":[{"field":"version-note"},{"field":"unit-note"},{"field":"provisional-note"},{"field":"history-note"},{"field":"target-note"},{"field":"period-note"},{"field":"coverage-note"},{"field":"stale-note"}]},{"as":"evidence-reason","function":"if","args":[{"field":"incomplete"},{"field":"gap-reasons"},{"value":"Comparable measurements available."}]}],"order-by":[{"field":"worsening","direction":"desc"},{"field":"improving","direction":"desc"},{"field":"repository-coordinate","direction":"asc"}]},{"name":"operational-value-repository-subjects","subject":"Inventory and measured repositories, independent of campaign membership.","objective":"Include standalone workflow outcomes and unmeasured inventory repositories.","acceptance":"Deduplicate organization/repository identities. Observations outside campaign inventory remain visible; missing measurements are not zero value.","from":"repositories","union":["operational-values"],"aggregate":{"by":["organization","repository"],"values":[{"field":"repository","as":"subject-records","reducer":"count"}]}},{"name":"operational-value-repository-coverage","subject":"Outcome evidence coverage for each repository.","objective":"Expose measurement gaps without requiring campaign registration.","acceptance":"One row per repository. Count latest primary goals, not reports. Preserve conservative direction and comparison blockers; no evidence is not zero value.","from":"operational-value-repository-subjects","joins":[{"source":"operational-value-repository-signals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"}],"fields":[{"field":"goals","as":"goal-count"},{"field":"comparable-goals","as":"measured-comparable-goals"},{"field":"mature-goals","as":"measured-mature-goals"},{"field":"signal","as":"measured-signal"},{"field":"worsening","as":"measured-worsening"},{"field":"improving","as":"measured-improving"},{"field":"evidence-reason","as":"measured-evidence-reason"},{"field":"oldest-evidence-at","as":"measured-oldest-evidence-at"},{"field":"newest-evidence-at","as":"measured-newest-evidence-at"}]}],"compute":[{"as":"repository-coordinate","function":"concat","args":[{"field":"organization"},{"value":"/"},{"field":"repository"}]},{"as":"goals","function":"coalesce","args":[{"field":"goal-count"},{"value":0}]},{"as":"measured-goals","function":"coalesce","args":[{"field":"goal-count"},{"value":0}]},{"as":"comparable-goals","function":"coalesce","args":[{"field":"measured-comparable-goals"},{"value":0}]},{"as":"mature-goals","function":"coalesce","args":[{"field":"measured-mature-goals"},{"value":0}]},{"as":"signal","function":"coalesce","args":[{"field":"measured-signal"},{"value":"Not measured"}]},{"as":"evidence-reason","function":"coalesce","args":[{"field":"measured-evidence-reason"},{"value":"No retained primary measurements."}]},{"as":"oldest-evidence-at","function":"coalesce","args":[{"field":"measured-oldest-evidence-at"},{"value":null}]},{"as":"newest-evidence-at","function":"coalesce","args":[{"field":"measured-newest-evidence-at"},{"value":null}]},{"as":"has-evidence","function":"greater-than","args":[{"field":"measured-goals"},{"value":0}]},{"as":"worsening-goals","function":"coalesce","args":[{"field":"measured-worsening"},{"value":0}]},{"as":"improving-goals","function":"coalesce","args":[{"field":"measured-improving"},{"value":0}]},{"as":"has-mature-evidence","function":"greater-than","args":[{"field":"mature-goals"},{"value":0}]},{"as":"measured-state","function":"if","args":[{"field":"has-mature-evidence"},{"value":"Mature evidence available"},{"value":"Interim or unavailable evidence"}]},{"as":"measurement-state","function":"if","args":[{"field":"has-evidence"},{"field":"measured-state"},{"value":"Not measured"}]},{"as":"coverage-summary","function":"concat","args":[{"field":"measured-goals"},{"value":" measured goals / "},{"field":"comparable-goals"},{"value":" comparable"}]}],"order-by":[{"field":"worsening-goals","direction":"desc"},{"field":"improving-goals","direction":"desc"},{"field":"repository-coordinate","direction":"asc"}]},{"name":"operational-value-overview-totals","subject":"Repository measurement availability and latest comparable goal counts.","objective":"Explain evidence readiness before repository drill-down.","acceptance":"Count repositories once across campaigns and standalone workflows. Goal counts describe latest primary measurements, not impact.","from":"operational-value-repository-coverage","aggregate":{"by":[],"values":[{"field":"repository","as":"repositories","reducer":"count"},{"field":"repository","as":"measured-repositories","reducer":"count","filter":{"predicates":[{"field":"has-evidence","equals":true}]}},{"field":"measured-goals","as":"measured-goals","reducer":"sum"},{"field":"comparable-goals","as":"comparable-goals","reducer":"sum"}]}},{"name":"operational-value-overview-summary","subject":"Compact portfolio measurement readiness summary.","objective":"Explain comparison readiness without replacing unavailable movement with zero value.","acceptance":"Preserve repository and latest goal totals; distinguish no observations from measurements without comparable movement.","from":"operational-value-overview-totals","compute":[{"as":"summary","function":"concat","args":[{"field":"measured-repositories"},{"value":" of "},{"field":"repositories"},{"value":" repositories measured · "},{"field":"comparable-goals"},{"value":" comparable goals"}]},{"as":"has-measurements","function":"greater-than","args":[{"field":"measured-goals"},{"value":0}]},{"as":"has-comparisons","function":"greater-than","args":[{"field":"comparable-goals"},{"value":0}]},{"as":"measured-note","function":"if","args":[{"field":"has-comparisons"},{"value":"Inspect repository movement and comparison gaps below."},{"value":"Measurements are available, but none supports a comparable movement yet. Inspect the reasons below."}]},{"as":"summary-note","function":"if","args":[{"field":"has-measurements"},{"field":"measured-note"},{"value":"No primary measurements are retained. Inspect collection and measurement coverage in Evidence; absence is not zero value."}]}]},{"name":"operational-value-measured-repositories","subject":"Repositories with retained primary outcome measurements.","objective":"Choose a repository directly, including standalone workflow outcomes.","acceptance":"One repository card across all campaigns and standalone workflows. Preserve disagreement and missing comparison evidence.","from":"operational-value-repository-coverage","filter":{"predicates":[{"field":"has-evidence","equals":true}]}},{"name":"operational-value-unmeasured-repositories","subject":"Inventory repositories without retained primary measurements.","objective":"Inspect evidence gaps without implying absent contracts or zero value.","acceptance":"Keep every unmeasured inventory repository; no campaign is required.","from":"operational-value-repository-coverage","filter":{"predicates":[{"field":"has-evidence","equals":false}]}},{"name":"operational-value-direction-repositories","subject":"Comparable outcome direction per repository.","objective":"Inspect repository movement without combining native values.","acceptance":"One count per fully comparable repository. Opposing goals remain Mixed; absent evidence is not neutral. Links open repository history directly.","from":"operational-value-repository-signals","filter":{"predicates":[{"field":"signal","in":["Improving","Worsening","Mixed","Unchanged"]}]},"compute":[{"as":"encoded-organization","function":"url-encode","args":[{"field":"organization"}]},{"as":"encoded-repository","function":"url-encode","args":[{"field":"repository"}]},{"as":"outcome-drill-href","function":"concat","args":[{"value":"#page-operational-value-repository?organization="},{"field":"encoded-organization"},{"value":"&repository="},{"field":"encoded-repository"}]},{"as":"repository-dashboard-link","function":"dashboard-link","args":[{"value":""},{"field":"outcome-drill-href"},{"field":"repository-coordinate"}]},{"as":"repositories","function":"literal","args":[{"value":1}]}],"limit":100,"order-by":[{"field":"repository-coordinate","direction":"asc"}]},{"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-conclusions","subject":"Aggregate workflow run conclusions by UTC day for the Runs stacked area graph.","objective":"Expose changes in observed run conclusions by day for investigation.","acceptance":"Count retained runs by started-at UTC day and recorded conclusion; an empty day or missing conclusion is not evidence of healthy execution or absence of activity.","from":"runs","compute":[{"as":"day","function":"date-day","args":[{"field":"started-at"}]}],"aggregate":{"by":["day","run-conclusion"],"values":[{"field":"run","as":"runs","reducer":"count"}]}},{"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-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-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-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-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.event","firewall.upstream_error","model.config","model.inventory","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-duplicate-sessions","from":"routing-session-order","subject":"Count session attempts omitted from routing metrics.","objective":"Expose duplicate files instead of silently summing them.","acceptance":"Only nonauthoritative attempts contribute.","filter":{"predicates":[{"field":"session-position","gte":2}]},"aggregate":{"values":[{"field":"routing-run-key","as":"duplicate-files","reducer":"count"}]}},{"name":"routing-coverage","subject":"Expose supported, legacy, unsupported and unidentified session coverage.","objective":"Keep sessions excluded from adoption denominators visible.","acceptance":"Missing identity or time is never inferred from external run success.","from":"routing-run-facts","compute":[{"as":"identified","function":"greater-than","args":[{"field":"workflow-info-count"},{"value":0}]},{"as":"untimed","function":"equals-any","args":[{"field":"run-clock"},{"value":null}]}],"aggregate":{"by":["session-format","identified","untimed"],"values":[{"field":"routing-run-key","as":"sessions","reducer":"count"},{"field":"warnings","as":"warnings","reducer":"sum"}]}},{"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-resolved-runs","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-adoption","subject":"Count identified sessions by routing state and engine.","objective":"Show adoption without silently treating unknown or inferred routing as explicit configuration.","acceptance":"All seven states remain distinct and sum to identified sessions.","from":"routing-runs","aggregate":{"by":["routing-state","engine"],"values":[{"field":"routing-run-key","as":"runs","reducer":"count"}]}},{"name":"routing-adoption-totals","from":"routing-runs","subject":"Count routed populations and classifier coverage by engine.","objective":"Exclude unknown state from adoption shares without hiding it.","acceptance":"Configured-unrecorded counts as routed; inferred unrouted stays separate.","compute":[{"as":"workflow-key","function":"concat","args":[{"field":"full-repository"},{"value":":"},{"field":"workflow"}]},{"as":"is-routed","function":"equals-any","args":[{"field":"routing-state"},{"value":"selected"},{"value":"selection_failed"},{"value":"harness_reported"},{"value":"configured_unrecorded"}]}],"aggregate":{"by":["engine"],"values":[{"field":"run","as":"runs","reducer":"count"},{"field":"run","as":"routed","reducer":"count","filter":{"predicates":[{"field":"is-routed","equals":true}]}},{"field":"run","as":"unrouted","reducer":"count","filter":{"predicates":[{"field":"routing-state","equals":"unrouted"}]}},{"field":"run","as":"inferred-unrouted","reducer":"count","filter":{"predicates":[{"field":"routing-state","equals":"unrouted_inferred"}]}},{"field":"run","as":"unknown","reducer":"count","filter":{"predicates":[{"field":"routing-state","equals":"unknown"}]}},{"field":"workflow-key","as":"routed-workflows","reducer":"distinct-count","filter":{"predicates":[{"field":"is-routed","equals":true}]}},{"field":"routing-degraded","as":"degraded-known","reducer":"count"},{"field":"run","as":"degraded","reducer":"count","filter":{"predicates":[{"field":"routing-degraded","equals":true}]}}]}},{"name":"routing-adoption-summary","from":"routing-adoption-totals","subject":"Show adoption and degraded-classification shares with their denominators.","objective":"Distinguish unknown coverage from explicit zero.","acceptance":"A missing or zero denominator produces no ratio.","compute":[{"as":"known-state-runs","function":"difference","args":[{"field":"runs"},{"field":"unknown"}]},{"as":"routed-share","function":"quotient","args":[{"field":"routed"},{"field":"known-state-runs"}]},{"as":"degraded-share","function":"quotient","args":[{"field":"degraded"},{"field":"degraded-known"}]}]},{"name":"routing-decision-dimensions","from":"routing-runs","subject":"Group selected runs by configured and resolved objectives.","objective":"Expose configured mode independently of the router's resolved mode.","acceptance":"Absent goal, mode and classifier fields remain unknown.","filter":{"predicates":[{"field":"routing-state","equals":"selected"}]},"aggregate":{"by":["engine","routing-goal","routing-configured-mode","routing-mode","routing-classifier-model","routing-classifier-effort","routing-classifier-attempts"],"values":[{"field":"run","as":"runs","reducer":"count"},{"field":"routing-latency-ms","as":"latency-known","reducer":"count"},{"field":"routing-latency-ms","as":"latency-p50","reducer":"median"},{"field":"routing-latency-ms","as":"latency-p95","reducer":"p95"}]}},{"name":"routing-picks","subject":"Compare selected picks within classifier label cells.","objective":"Separate task variation from routing decisions.","acceptance":"Only proxy-selected runs contribute and absent labels remain unknown.","from":"routing-runs","filter":{"predicates":[{"field":"routing-state","equals":"selected"},{"field":"unknown-pick","equals":false}]},"aggregate":{"by":["pick","routing-task-type","routing-scope","routing-complexity"],"values":[{"field":"run","as":"runs","reducer":"count"},{"field":"routing-latency-ms","as":"latency-known","reducer":"count"},{"field":"routing-latency-ms","as":"mean-latency-ms","reducer":"mean"},{"field":"routing-latency-ms","as":"median-latency-ms","reducer":"median"},{"field":"routing-latency-ms","as":"p95-latency-ms","reducer":"p95"},{"field":"routing-degraded","as":"degraded-known","reducer":"count"},{"field":"run","as":"degraded-runs","reducer":"count","filter":{"predicates":[{"field":"routing-degraded","equals":true}]}}]}},{"name":"routing-pick-history","from":"routing-runs","subject":"Order known picks within workflow and classifier label cells.","objective":"Separate task variation from pick instability.","acceptance":"Unknown picks and untimed runs cannot establish adjacent changes.","filter":{"predicates":[{"field":"unknown-pick","equals":false},{"field":"run-clock","gte":0}]},"window":[{"operation":"previous","field":"pick","as":"previous-pick","groupby":["organization","repository","workflow"],"order-by":[{"field":"run-clock","direction":"asc"},{"field":"run","direction":"asc"}]},{"operation":"previous","field":"pick","as":"previous-cell-pick","groupby":["organization","repository","workflow","routing-task-type","routing-scope","routing-complexity"],"order-by":[{"field":"run-clock","direction":"asc"},{"field":"run","direction":"asc"}]}]},{"name":"routing-pick-changes","from":"routing-pick-history","subject":"Mark decidable adjacent pick changes.","objective":"Exclude first observations from change-rate denominators.","acceptance":"Label-conditioned pairs never compare unlike classifier cells.","compute":[{"as":"first-pick","function":"equals-any","args":[{"field":"previous-pick"},{"value":null}]},{"as":"first-cell-pick","function":"equals-any","args":[{"field":"previous-cell-pick"},{"value":null}]},{"as":"same-pick","function":"equals-any","args":[{"field":"previous-pick"},{"field":"pick"}]},{"as":"same-cell-pick","function":"equals-any","args":[{"field":"previous-cell-pick"},{"field":"pick"}]},{"as":"pair","function":"if","args":[{"field":"first-pick"},{"value":0},{"value":1}]},{"as":"cell-pair","function":"if","args":[{"field":"first-cell-pick"},{"value":0},{"value":1}]},{"as":"changed","function":"if","args":[{"field":"same-pick"},{"value":0},{"field":"pair"}]},{"as":"cell-changed","function":"if","args":[{"field":"same-cell-pick"},{"value":0},{"field":"cell-pair"}]}]},{"name":"routing-stability-totals","from":"routing-pick-changes","subject":"Count adjacent changes and distinct picks per workflow.","objective":"Measure stability with explicit pair denominators.","acceptance":"Label-conditioned change rate weights cells by their adjacent pairs.","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"pick","as":"distinct-picks","reducer":"distinct-count"},{"field":"pair","as":"pairs","reducer":"sum"},{"field":"cell-pair","as":"cell-pairs","reducer":"sum"},{"field":"changed","as":"changes","reducer":"sum"},{"field":"cell-changed","as":"cell-changes","reducer":"sum"}]}},{"name":"routing-pick-frequencies","from":"routing-runs","subject":"Count each known pick within its workflow.","objective":"Compute modal share without counting unknown picks.","acceptance":"All retained known picks contribute, including runs without an event clock.","filter":{"predicates":[{"field":"unknown-pick","equals":false}]},"aggregate":{"by":["organization","repository","workflow","pick"],"values":[{"field":"run","as":"pick-runs","reducer":"count"}]}},{"name":"routing-modal-picks","from":"routing-pick-frequencies","subject":"Count known picks and the largest workflow pick cohort.","objective":"Distinguish modal stability from adjacent change rates.","acceptance":"Modal share uses runs with known model and effort only.","aggregate":{"by":["organization","repository","workflow"],"values":[{"field":"pick","as":"distinct-picks","reducer":"count"},{"field":"pick-runs","as":"known-pick-runs","reducer":"sum"},{"field":"pick-runs","as":"modal-runs","reducer":"max"}]}},{"name":"routing-stability","from":"routing-modal-picks","subject":"Compute observed workflow and label-conditioned pick change rates.","objective":"Distinguish changing tasks from changing decisions.","acceptance":"Fewer than two comparable runs produces an unknown rate.","joins":[{"source":"routing-stability-totals","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"pairs","as":"pairs"},{"field":"cell-pairs","as":"cell-pairs"},{"field":"changes","as":"changes"},{"field":"cell-changes","as":"cell-changes"}]}],"compute":[{"as":"modal-pick-share","function":"quotient","args":[{"field":"modal-runs"},{"field":"known-pick-runs"}]},{"as":"change-rate","function":"quotient","args":[{"field":"changes"},{"field":"pairs"}]},{"as":"cell-change-rate","function":"quotient","args":[{"field":"cell-changes"},{"field":"cell-pairs"}]}]},{"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":"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":"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-cost-bucket-totals","subject":"Sum nonoverlapping credits with explicit known and unknown coverage.","objective":"Show recorded lower bounds by served model and attribution bucket.","acceptance":"Unknown costs are counted, not repriced or silently treated as zero; evals remain separate.","from":"routing-attributed-accounting","aggregate":{"by":["bucket","agent-name","telemetry-model"],"values":[{"field":"event","as":"records","reducer":"count"},{"field":"aic","as":"known-cost-records","reducer":"count"},{"field":"unknown-aic-count","as":"unknown-cost-records","reducer":"sum"},{"field":"aic","as":"recorded-aic-lower-bound","reducer":"sum"},{"field":"input-tokens","as":"recorded-input-tokens","reducer":"sum"},{"field":"input-tokens","as":"input-known","reducer":"count"},{"field":"output-tokens","as":"recorded-output-tokens","reducer":"sum"},{"field":"output-tokens","as":"output-known","reducer":"count"},{"field":"reasoning-tokens","as":"recorded-reasoning-tokens","reducer":"sum"},{"field":"reasoning-tokens","as":"reasoning-known","reducer":"count"},{"field":"cache-read-tokens","as":"recorded-cache-read-tokens","reducer":"sum"},{"field":"cache-read-tokens","as":"cache-read-known","reducer":"count"},{"field":"cache-write-tokens","as":"recorded-cache-write-tokens","reducer":"sum"},{"field":"cache-write-tokens","as":"cache-write-known","reducer":"count"}]}},{"name":"routing-cost-buckets","from":"routing-cost-bucket-totals","subject":"Show known credit lower bounds with honest missing-value coverage.","objective":"Never display a zero sum when every cost is missing.","acceptance":"Every additive measure carries known and unknown record counts.","compute":[{"as":"has-known-cost","function":"greater-than","args":[{"field":"known-cost-records"},{"value":0}]},{"as":"aic-lower-bound","function":"if","args":[{"field":"has-known-cost"},{"field":"recorded-aic-lower-bound"},{"value":null}]},{"as":"input-unknown","function":"difference","args":[{"field":"records"},{"field":"input-known"}]},{"as":"output-unknown","function":"difference","args":[{"field":"records"},{"field":"output-known"}]},{"as":"reasoning-unknown","function":"difference","args":[{"field":"records"},{"field":"reasoning-known"}]},{"as":"cache-read-unknown","function":"difference","args":[{"field":"records"},{"field":"cache-read-known"}]},{"as":"cache-write-unknown","function":"difference","args":[{"field":"records"},{"field":"cache-write-known"}]},{"as":"has-input","function":"greater-than","args":[{"field":"input-known"},{"value":0}]},{"as":"has-output","function":"greater-than","args":[{"field":"output-known"},{"value":0}]},{"as":"has-reasoning","function":"greater-than","args":[{"field":"reasoning-known"},{"value":0}]},{"as":"has-cache-read","function":"greater-than","args":[{"field":"cache-read-known"},{"value":0}]},{"as":"has-cache-write","function":"greater-than","args":[{"field":"cache-write-known"},{"value":0}]},{"as":"input-tokens","function":"if","args":[{"field":"has-input"},{"field":"recorded-input-tokens"},{"value":null}]},{"as":"output-tokens","function":"if","args":[{"field":"has-output"},{"field":"recorded-output-tokens"},{"value":null}]},{"as":"reasoning-tokens","function":"if","args":[{"field":"has-reasoning"},{"field":"recorded-reasoning-tokens"},{"value":null}]},{"as":"cache-read-tokens","function":"if","args":[{"field":"has-cache-read"},{"field":"recorded-cache-read-tokens"},{"value":null}]},{"as":"cache-write-tokens","function":"if","args":[{"field":"has-cache-write"},{"field":"recorded-cache-write-tokens"},{"value":null}]}]},{"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-deviation-totals","from":"routing-deviations","subject":"Count deviations and their known response credits by phase.","objective":"Keep request-share and credit-share denominators distinct.","acceptance":"Missing joined AIC is excluded from credit share and counted.","aggregate":{"by":["phase"],"values":[{"field":"event","as":"requests","reducer":"count"},{"field":"routing-routed","as":"classified-requests","reducer":"count"},{"field":"event","as":"deviated-requests","reducer":"count","filter":{"predicates":[{"field":"routing-routed","equals":"deviated"}]}},{"field":"accounted-aic","as":"known-costs","reducer":"count"},{"field":"accounted-aic","as":"joined-aic","reducer":"sum"},{"field":"accounted-aic","as":"deviated-aic","reducer":"sum","filter":{"predicates":[{"field":"routing-routed","equals":"deviated"}]}}]}},{"name":"routing-deviation-summary","from":"routing-deviation-totals","subject":"Show deviation shares with explicit response coverage.","objective":"Never equate missing request accounting with free traffic.","acceptance":"Zero known joined credits produce no credit share.","compute":[{"as":"deviated-request-share","function":"quotient","args":[{"field":"deviated-requests"},{"field":"classified-requests"}]},{"as":"deviated-credit-share","function":"quotient","args":[{"field":"deviated-aic"},{"field":"joined-aic"}]},{"as":"unknown-costs","function":"difference","args":[{"field":"requests"},{"field":"known-costs"}]}]},{"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-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-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-cost-distribution-totals","from":"routing-cost-runs","subject":"Compare complete agent-phase AIC by workflow, routing state and pick.","objective":"Exclude partial runs from quantiles and display their coverage.","acceptance":"Comparisons are observational and do not imply a causal routing benefit.","aggregate":{"by":["organization","repository","workflow","routing-state","pick"],"values":[{"field":"run","as":"runs","reducer":"count"},{"field":"complete-aic","as":"complete-runs","reducer":"count"},{"field":"complete-aic","as":"observed-median-aic","reducer":"median"},{"field":"complete-aic","as":"observed-p75-aic","reducer":"p75"},{"field":"complete-aic","as":"observed-p90-aic","reducer":"p90"}]}},{"name":"routing-cost-distributions","from":"routing-cost-distribution-totals","subject":"Suppress cost comparisons with insufficient complete samples.","objective":"Enforce the configurable minimum sample rather than overstate sparse evidence.","acceptance":"Below the default ten complete runs, cost quantiles remain unavailable.","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"}]},{"as":"sample-status","function":"if","args":[{"field":"enough-samples"},{"value":"observational"},{"value":"insufficient data"}]},{"as":"partial-runs","function":"difference","args":[{"field":"runs"},{"field":"complete-runs"}]},{"as":"median-aic","function":"if","args":[{"field":"enough-samples"},{"field":"observed-median-aic"},{"value":null}]},{"as":"p75-aic","function":"if","args":[{"field":"enough-samples"},{"field":"observed-p75-aic"},{"value":null}]},{"as":"p90-aic","function":"if","args":[{"field":"enough-samples"},{"field":"observed-p90-aic"},{"value":null}]}]},{"name":"routing-weekly-cost-totals","from":"routing-cost-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-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":"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-comparison-totals","from":"routing-cost-runs","subject":"Compare complete agent-phase costs for selected and unrouted workflow runs.","objective":"Keep explicit and inferred baselines separate.","acceptance":"Partial costs never contribute to sample counts or quantiles.","aggregate":{"by":["organization","repository","workflow","routing-state"],"values":[{"field":"workflow-model","as":"workflow-model","reducer":"unique"},{"field":"complete-aic","as":"complete-runs","reducer":"count"},{"field":"complete-aic","as":"median-aic","reducer":"median"},{"field":"complete-aic","as":"p75-aic","reducer":"p75"}]}},{"name":"routing-explicit-baselines","from":"routing-comparison-totals","subject":"Read explicitly unrouted baseline costs.","objective":"Avoid combining inferred with configured baselines.","acceptance":"Only explicitly unrouted runs contribute.","filter":{"predicates":[{"field":"routing-state","equals":"unrouted"}]}},{"name":"routing-inferred-baselines","from":"routing-comparison-totals","subject":"Read inferred unrouted baseline costs.","objective":"Label inference rather than imply explicit routing configuration.","acceptance":"Only unrouted_inferred runs contribute.","filter":{"predicates":[{"field":"routing-state","equals":"unrouted_inferred"}]}},{"name":"routing-comparisons","from":"routing-comparison-totals","subject":"Compute observational routed-versus-unrouted cost deltas within one workflow.","objective":"Expose both baseline cohorts and their complete sample sizes.","acceptance":"Both cohorts must meet the minimum; zero or absent baseline costs produce no ratio.","parameters":[{"name":"minimum-sample","type":"number"}],"filter":{"predicates":[{"field":"routing-state","equals":"selected"}]},"joins":[{"source":"routing-explicit-baselines","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"workflow-model","as":"explicit-model"},{"field":"complete-runs","as":"explicit-runs"},{"field":"median-aic","as":"explicit-median"},{"field":"p75-aic","as":"explicit-p75"}]},{"source":"routing-inferred-baselines","type":"left","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"workflow-model","as":"inferred-model"},{"field":"complete-runs","as":"inferred-runs"},{"field":"median-aic","as":"inferred-median"},{"field":"p75-aic","as":"inferred-p75"}]}],"compute":[{"as":"sample-floor","function":"difference","args":[{"parameter":"minimum-sample"},{"value":1}]},{"as":"routed-enough","function":"greater-than","args":[{"field":"complete-runs"},{"field":"sample-floor"}]},{"as":"explicit-enough","function":"greater-than","args":[{"field":"explicit-runs"},{"field":"sample-floor"}]},{"as":"inferred-enough","function":"greater-than","args":[{"field":"inferred-runs"},{"field":"sample-floor"}]},{"as":"explicit-comparable","function":"if","args":[{"field":"routed-enough"},{"field":"explicit-enough"},{"value":false}]},{"as":"inferred-comparable","function":"if","args":[{"field":"routed-enough"},{"field":"inferred-enough"},{"value":false}]},{"as":"selected-median-shown","function":"if","args":[{"field":"routed-enough"},{"field":"median-aic"},{"value":null}]},{"as":"explicit-median-shown","function":"if","args":[{"field":"explicit-enough"},{"field":"explicit-median"},{"value":null}]},{"as":"inferred-median-shown","function":"if","args":[{"field":"inferred-enough"},{"field":"inferred-median"},{"value":null}]},{"as":"explicit-difference","function":"difference","args":[{"field":"median-aic"},{"field":"explicit-median"}]},{"as":"inferred-difference","function":"difference","args":[{"field":"median-aic"},{"field":"inferred-median"}]},{"as":"explicit-ratio","function":"quotient","args":[{"field":"explicit-difference"},{"field":"explicit-median"}]},{"as":"inferred-ratio","function":"quotient","args":[{"field":"inferred-difference"},{"field":"inferred-median"}]},{"as":"explicit-delta","function":"if","args":[{"field":"explicit-comparable"},{"field":"explicit-ratio"},{"value":null}]},{"as":"inferred-delta","function":"if","args":[{"field":"inferred-comparable"},{"field":"inferred-ratio"},{"value":null}]},{"as":"explicit-evidence","function":"if","args":[{"field":"explicit-comparable"},{"value":"observational"},{"value":"insufficient data"}]},{"as":"inferred-evidence","function":"if","args":[{"field":"inferred-comparable"},{"value":"observational"},{"value":"insufficient data"}]}]},{"name":"routing-failure-candidates","subject":"Read routing failures, upstream errors, steering and exit 78 evidence.","objective":"Keep execution failures separate from the routing selection state.","acceptance":"A failure after selection never rewrites selected state; free-form error and steering text are absent.","from":"routing-events","compute":[{"as":"failure-event","function":"equals-any","args":[{"field":"event-type"},{"value":"firewall.steering"},{"value":"firewall.upstream_error"},{"value":"subagent.failed"},{"value":"subagent.model_unavailable"},{"value":"model_endpoint.mismatch"}]},{"as":"upstream-error","function":"equals-any","args":[{"field":"name"},{"value":"UPSTREAM_ERROR_RESPONSE"}]},{"as":"exit-78","function":"equals-any","args":[{"field":"exit-code"},{"value":78}]},{"as":"failure-evidence","function":"if","args":[{"field":"failure-event"},{"value":true},{"field":"proxy-failure"}]},{"as":"upstream-evidence","function":"if","args":[{"field":"upstream-error"},{"value":true},{"field":"failure-evidence"}]},{"as":"failure-row","function":"if","args":[{"field":"exit-78"},{"value":true},{"field":"upstream-evidence"}]}]},{"name":"routing-failures","subject":"Show recorded failure and steering events.","objective":"Retain failure evidence independently of selected state.","acceptance":"Only explicit identifiers and counters are shown.","from":"routing-failure-candidates","filter":{"predicates":[{"field":"failure-row","equals":true}]},"order-by":[{"field":"event-timestamp","direction":"desc"}]},{"name":"routing-outcome-totals","subject":"Compare recorded agent job outcomes within pick and classifier label cells.","objective":"Avoid conflating runtime success with delayed safe-output outcomes or operational value.","acceptance":"Unknown outcomes are excluded from success-rate denominators and shown as coverage.","from":"routing-cost-runs","filter":{"predicates":[{"field":"unknown-pick","equals":false}]},"aggregate":{"by":["pick","routing-task-type","routing-scope","routing-complexity"],"values":[{"field":"run","as":"runs","reducer":"count"},{"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-cost-total","reducer":"sum"},{"field":"complete-aic","as":"complete-cost-count","reducer":"count"},{"field":"run","as":"complete-successes","reducer":"count","filter":{"predicates":[{"field":"agent-result","equals":"success"},{"field":"cost-complete","equals":true}]}}]}},{"name":"routing-outcome-statistics","subject":"Compute outcome ratios with known denominators.","objective":"Keep excluded unknown job results visible.","acceptance":"Missing denominators remain unknown.","from":"routing-outcome-totals","compute":[{"as":"unknown-outcomes","function":"difference","args":[{"field":"runs"},{"field":"known-outcomes"}]},{"as":"success-rate","function":"quotient","args":[{"field":"successes"},{"field":"known-outcomes"}]},{"as":"cost-per-success","function":"quotient","args":[{"field":"complete-cost-total"},{"field":"successes"}]},{"as":"z-squared-over-n","function":"quotient","args":[{"value":3.8416},{"field":"known-outcomes"}]},{"as":"wilson-denominator","function":"sum","args":[{"value":1},{"field":"z-squared-over-n"}]},{"as":"wilson-adjustment","function":"quotient","args":[{"value":1.9208},{"field":"known-outcomes"}]},{"as":"wilson-numerator","function":"sum","args":[{"field":"success-rate"},{"field":"wilson-adjustment"}]},{"as":"wilson-center","function":"quotient","args":[{"field":"wilson-numerator"},{"field":"wilson-denominator"}]},{"as":"failure-rate","function":"difference","args":[{"value":1},{"field":"success-rate"}]},{"as":"bernoulli-variance","function":"product","args":[{"field":"success-rate"},{"field":"failure-rate"}]},{"as":"sample-variance","function":"quotient","args":[{"field":"bernoulli-variance"},{"field":"known-outcomes"}]},{"as":"n-squared","function":"product","args":[{"field":"known-outcomes"},{"field":"known-outcomes"}]},{"as":"variance-adjustment","function":"quotient","args":[{"value":0.9604},{"field":"n-squared"}]},{"as":"wilson-variance","function":"sum","args":[{"field":"sample-variance"},{"field":"variance-adjustment"}]},{"as":"wilson-root","function":"sqrt","args":[{"field":"wilson-variance"}]},{"as":"wilson-radius-numerator","function":"product","args":[{"value":1.96},{"field":"wilson-root"}]},{"as":"wilson-radius","function":"quotient","args":[{"field":"wilson-radius-numerator"},{"field":"wilson-denominator"}]},{"as":"wilson-low","function":"difference","args":[{"field":"wilson-center"},{"field":"wilson-radius"}]},{"as":"wilson-high","function":"sum","args":[{"field":"wilson-center"},{"field":"wilson-radius"}]}]},{"name":"routing-outcomes","from":"routing-outcome-statistics","subject":"Gate outcome comparisons with explicit sample coverage.","objective":"Avoid presenting sparse pick cohorts as reliable comparisons.","acceptance":"Success rates and intervals need enough known outcomes; cost per success also needs enough complete costs.","parameters":[{"name":"minimum-sample","type":"number"}],"compute":[{"as":"sample-floor","function":"difference","args":[{"parameter":"minimum-sample"},{"value":1}]},{"as":"enough-outcomes","function":"greater-than","args":[{"field":"known-outcomes"},{"field":"sample-floor"}]},{"as":"enough-costs","function":"greater-than","args":[{"field":"complete-cost-count"},{"field":"sample-floor"}]},{"as":"sample-status","function":"if","args":[{"field":"enough-outcomes"},{"value":"observational"},{"value":"insufficient data"}]},{"as":"display-rate","function":"if","args":[{"field":"enough-outcomes"},{"field":"success-rate"},{"value":null}]},{"as":"display-low","function":"if","args":[{"field":"enough-outcomes"},{"field":"wilson-low"},{"value":null}]},{"as":"display-high","function":"if","args":[{"field":"enough-outcomes"},{"field":"wilson-high"},{"value":null}]},{"as":"display-cost","function":"if","args":[{"field":"enough-costs"},{"field":"cost-per-success"},{"value":null}]}],"select":[{"field":"pick"},{"field":"routing-task-type"},{"field":"routing-scope"},{"field":"routing-complexity"},{"field":"successes"},{"field":"known-outcomes"},{"field":"unknown-outcomes"},{"field":"complete-cost-count"},{"field":"sample-status"},{"field":"display-rate","as":"success-rate"},{"field":"display-low","as":"wilson-low"},{"field":"display-high","as":"wilson-high"},{"field":"display-cost","as":"cost-per-success"}]},{"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-resolution-status","from":"routing-resolutions","subject":"Count configured-model resolution outcomes by event engine and role.","objective":"Show resolved, exact and failed resolutions without multiplying runs by roles.","acceptance":"Runs are distinct run identities; records count individual role resolutions.","aggregate":{"by":["resolution-engine","resolution-role-label","resolution-status"],"values":[{"field":"routing-run-key","as":"runs","reducer":"distinct-count"},{"field":"event","as":"records","reducer":"count"}]},"order-by":[{"field":"resolution-engine","direction":"asc"},{"field":"resolution-role-label","direction":"asc"},{"field":"resolution-status","direction":"asc"}]},{"name":"routing-resolution-run-counts","from":"routing-resolutions","subject":"Count resolution records per scoped run.","objective":"Attach configured-model resolution evidence to run-level coverage.","acceptance":"Several roles in one run remain one covered run.","aggregate":{"by":["routing-run-key"],"values":[{"field":"event","as":"resolution-records","reducer":"count"},{"field":"event","as":"failed-records","reducer":"count","filter":{"predicates":[{"field":"resolution-status","equals":"failed"}]}}]}},{"name":"routing-resolution-run-coverage","from":"routing-runs","subject":"Classify each scoped run's configured-model resolution evidence.","objective":"Separate covered runs, positively routed runs and runs lacking evidence.","acceptance":"Absence never establishes routing or failure; routed state comes only from routing evidence.","joins":[{"source":"routing-resolution-run-counts","type":"left","on":[{"left":"routing-run-key","right":"routing-run-key"}],"fields":[{"field":"resolution-records","as":"resolution-records"},{"field":"failed-records","as":"failed-records"}]}],"compute":[{"as":"resolution-record-count","function":"coalesce","args":[{"field":"resolution-records"},{"value":0}]},{"as":"failed-record-count","function":"coalesce","args":[{"field":"failed-records"},{"value":0}]},{"as":"has-resolution","function":"greater-than","args":[{"field":"resolution-record-count"},{"value":0}]},{"as":"has-failed-resolution","function":"greater-than","args":[{"field":"failed-record-count"},{"value":0}]},{"as":"is-routed","function":"equals-any","args":[{"field":"routing-state"},{"value":"selected"},{"value":"selection_failed"},{"value":"harness_reported"},{"value":"configured_unrecorded"}]},{"as":"absent-state","function":"if","args":[{"field":"is-routed"},{"value":"routed"},{"value":"missing"}]},{"as":"resolution-coverage-state","function":"if","args":[{"field":"has-resolution"},{"value":"covered"},{"field":"absent-state"}]}]},{"name":"routing-resolution-coverage-totals","from":"routing-resolution-run-coverage","subject":"Count scoped runs by configured-model resolution coverage.","objective":"Keep denominators explicit for covered, routed and missing evidence.","acceptance":"Routed runs without resolution are expected absence, not missing evidence.","aggregate":{"values":[{"field":"routing-run-key","as":"runs","reducer":"count"},{"field":"routing-run-key","as":"resolution-runs","reducer":"count","filter":{"predicates":[{"field":"has-resolution","equals":true}]}},{"field":"routing-run-key","as":"routed-runs","reducer":"count","filter":{"predicates":[{"field":"is-routed","equals":true}]}},{"field":"routing-run-key","as":"routed-without-resolution","reducer":"count","filter":{"predicates":[{"field":"resolution-coverage-state","equals":"routed"}]}},{"field":"routing-run-key","as":"missing-resolution","reducer":"count","filter":{"predicates":[{"field":"resolution-coverage-state","equals":"missing"}]}},{"field":"routing-run-key","as":"failed-runs","reducer":"count","filter":{"predicates":[{"field":"has-failed-resolution","equals":true}]}},{"field":"resolution-record-count","as":"resolution-records","reducer":"sum"}]}},{"name":"routing-resolution-coverage","from":"routing-resolution-coverage-totals","subject":"Show configured-model resolution coverage with its denominators.","objective":"Distinguish expected routed absence from missing resolution evidence.","acceptance":"A zero denominator produces no share.","compute":[{"as":"non-routed-runs","function":"difference","args":[{"field":"runs"},{"field":"routed-runs"}]},{"as":"resolution-share","function":"quotient","args":[{"field":"resolution-runs"},{"field":"runs"}]}]},{"name":"routing-resolution-observations","from":"routing-resolutions","subject":"Retain resolutions with a known resolved model.","objective":"Build alias history without treating failed or unsafe values as a model.","acceptance":"Failed null resolutions and unsafe resolved values never enter alias history.","filter":{"predicates":[{"field":"unknown-resolved-model","equals":false}]}},{"name":"routing-resolution-timeline","from":"routing-resolution-observations","subject":"Order timed resolutions within each workflow, engine, role, provider and configured model.","objective":"Compare only chronologically adjacent resolutions of the same alias series.","acceptance":"Untimed runs cannot establish a transition or a first or last observation.","filter":{"predicates":[{"field":"run-clock","gte":0}]},"window":[{"operation":"previous","field":"resolved-model-label","as":"previous-resolved-model","groupby":["resolution-series"],"order-by":[{"field":"run-clock","direction":"asc"},{"field":"run","direction":"asc"}]},{"operation":"row-number","field":"run","as":"series-first-position","groupby":["resolution-series"],"order-by":[{"field":"run-clock","direction":"asc"},{"field":"run","direction":"asc"}]},{"operation":"row-number","field":"run","as":"series-last-position","groupby":["resolution-series"],"order-by":[{"field":"run-clock","direction":"desc"},{"field":"run","direction":"desc"}]},{"operation":"row-number","field":"run","as":"model-first-position","groupby":["resolution-series","resolved-model-label"],"order-by":[{"field":"run-clock","direction":"asc"},{"field":"run","direction":"asc"}]},{"operation":"row-number","field":"run","as":"model-last-position","groupby":["resolution-series","resolved-model-label"],"order-by":[{"field":"run-clock","direction":"desc"},{"field":"run","direction":"desc"}]}]},{"name":"routing-resolution-transitions","from":"routing-resolution-timeline","subject":"Mark adjacent resolved-model changes within an alias series.","objective":"Count observed alias moves without claiming why they happened.","acceptance":"First observations are not changes; equal adjacent models are stable.","compute":[{"as":"first-resolution","function":"equals-any","args":[{"field":"previous-resolved-model"},{"value":null}]},{"as":"same-resolution","function":"equals-any","args":[{"field":"previous-resolved-model"},{"field":"resolved-model-label"}]},{"as":"resolution-pair","function":"if","args":[{"field":"first-resolution"},{"value":0},{"value":1}]},{"as":"resolution-changed","function":"if","args":[{"field":"same-resolution"},{"value":0},{"field":"resolution-pair"}]},{"as":"is-transition","function":"greater-than","args":[{"field":"resolution-changed"},{"value":0}]},{"as":"transition-label","function":"concat","args":[{"field":"previous-resolved-model"},{"value":" → "},{"field":"resolved-model-label"}]},{"as":"resolution-transition","function":"if","args":[{"field":"is-transition"},{"field":"transition-label"},{"value":null}]}]},{"name":"routing-alias-model-runs","from":"routing-resolution-transitions","subject":"Identify the first and last timed run for each resolved model of a series.","objective":"Link alias history rows to their contributing runs.","acceptance":"Only timed runs identify first and last observations.","aggregate":{"by":["resolution-series","resolved-model-label"],"values":[{"field":"run","as":"first-run","reducer":"unique","filter":{"predicates":[{"field":"model-first-position","equals":1}]}},{"field":"run","as":"last-run","reducer":"unique","filter":{"predicates":[{"field":"model-last-position","equals":1}]}},{"field":"routing-dashboard-link","as":"first-run-link","reducer":"unique","filter":{"predicates":[{"field":"model-first-position","equals":1}]}}]}},{"name":"routing-alias-history-totals","from":"routing-resolution-observations","subject":"Count runs and recorded clocks for each resolved model of an alias series.","objective":"Expose resolved-model history per workflow, engine, role, provider and configured model.","acceptance":"Distinct runs are counted once; untimed runs remain counted with unknown time.","aggregate":{"by":["resolution-series","full-repository","workflow","resolution-engine","resolution-role-label","resolution-provider","configured-model","resolved-model-label"],"values":[{"field":"routing-run-key","as":"runs","reducer":"distinct-count"},{"field":"routing-run-key","as":"untimed-runs","reducer":"distinct-count","filter":{"predicates":[{"field":"untimed","equals":true}]}},{"field":"run","as":"contributing-runs","reducer":"distinct-list"},{"field":"run-clock","as":"first-clock","reducer":"min"},{"field":"run-clock","as":"last-clock","reducer":"max"}]}},{"name":"routing-alias-history","from":"routing-alias-history-totals","subject":"Show the observed resolved-model history of each alias series.","objective":"Support investigation of alias moves with first and last observed runs.","acceptance":"History rows are observations, not proof that the model was served.","joins":[{"source":"routing-alias-model-runs","type":"left","on":[{"left":"resolution-series","right":"resolution-series"},{"left":"resolved-model-label","right":"resolved-model-label"}],"fields":[{"field":"first-run","as":"first-run"},{"field":"last-run","as":"last-run"},{"field":"first-run-link","as":"routing-dashboard-link"}]}],"compute":[{"as":"first-seen","function":"iso-timestamp","args":[{"field":"first-clock"}]},{"as":"last-seen","function":"iso-timestamp","args":[{"field":"last-clock"}]}],"order-by":[{"field":"resolution-series","direction":"asc"},{"field":"first-clock","direction":"asc"},{"field":"resolved-model-label","direction":"asc"}]},{"name":"routing-alias-sequences","from":"routing-resolution-transitions","subject":"Summarize timed resolved-model changes for each alias series.","objective":"Identify the earliest and latest resolved model and the observed transitions.","acceptance":"Transitions require adjacent recorded run clocks.","aggregate":{"by":["resolution-series"],"values":[{"field":"resolution-changed","as":"changes","reducer":"sum"},{"field":"resolution-pair","as":"pairs","reducer":"sum"},{"field":"resolution-transition","as":"transitions","reducer":"distinct-list"},{"field":"resolved-model-label","as":"first-model","reducer":"unique","filter":{"predicates":[{"field":"series-first-position","equals":1}]}},{"field":"resolved-model-label","as":"latest-model","reducer":"unique","filter":{"predicates":[{"field":"series-last-position","equals":1}]}},{"field":"run","as":"first-run","reducer":"unique","filter":{"predicates":[{"field":"series-first-position","equals":1}]}},{"field":"run","as":"last-run","reducer":"unique","filter":{"predicates":[{"field":"series-last-position","equals":1}]}},{"field":"routing-dashboard-link","as":"last-run-link","reducer":"unique","filter":{"predicates":[{"field":"series-last-position","equals":1}]}}]}},{"name":"routing-alias-move-totals","from":"routing-resolution-observations","subject":"Count runs and distinct resolved models for each alias series.","objective":"Provide one change-summary row per series, including stable aliases.","acceptance":"Engine, role and provider stay part of the series so unrelated resolutions cannot manufacture a move.","aggregate":{"by":["resolution-series","full-repository","workflow","resolution-engine","resolution-role-label","resolution-provider","configured-model"],"values":[{"field":"routing-run-key","as":"runs","reducer":"distinct-count"},{"field":"routing-run-key","as":"untimed-runs","reducer":"distinct-count","filter":{"predicates":[{"field":"untimed","equals":true}]}},{"field":"resolved-model-label","as":"distinct-models","reducer":"distinct-count"},{"field":"resolved-model-label","as":"resolved-models","reducer":"distinct-list"},{"field":"run-clock","as":"first-clock","reducer":"min"},{"field":"run-clock","as":"last-clock","reducer":"max"}]}},{"name":"routing-alias-moves","from":"routing-alias-move-totals","subject":"Highlight alias series whose resolved model changed between timed runs.","objective":"Investigate aliases moving to newer models without claiming cause or served-model evidence.","acceptance":"Exactly one row per series; only adjacent timed runs establish a move and unordered changes stay distinct.","joins":[{"source":"routing-alias-sequences","type":"left","on":[{"left":"resolution-series","right":"resolution-series"}],"fields":[{"field":"changes","as":"changes"},{"field":"pairs","as":"pairs"},{"field":"transitions","as":"transitions"},{"field":"first-model","as":"first-model"},{"field":"latest-model","as":"latest-model"},{"field":"first-run","as":"first-run"},{"field":"last-run","as":"last-run"},{"field":"last-run-link","as":"routing-dashboard-link"}]}],"compute":[{"as":"change-count","function":"coalesce","args":[{"field":"changes"},{"value":0}]},{"as":"moved","function":"greater-than","args":[{"field":"change-count"},{"value":0}]},{"as":"several-models","function":"greater-than","args":[{"field":"distinct-models"},{"value":1}]},{"as":"unmoved-state","function":"if","args":[{"field":"several-models"},{"value":"order unknown"},{"value":"stable"}]},{"as":"alias-change","function":"if","args":[{"field":"moved"},{"value":"alias moved"},{"field":"unmoved-state"}]},{"as":"move-label","function":"concat","args":[{"field":"first-model"},{"value":" → "},{"field":"latest-model"}]},{"as":"model-change","function":"if","args":[{"field":"moved"},{"field":"move-label"},{"value":null}]},{"as":"first-seen","function":"iso-timestamp","args":[{"field":"first-clock"}]},{"as":"last-seen","function":"iso-timestamp","args":[{"field":"last-clock"}]}],"order-by":[{"field":"change-count","direction":"desc"},{"field":"resolution-series","direction":"asc"}]},{"name":"routing-resolution-failure-records","from":"routing-resolutions","subject":"Retain failed configured-model resolutions with their runs.","objective":"Link each failed resolution to its contributing run.","acceptance":"Failed resolved models stay unknown; causes are never inferred.","filter":{"predicates":[{"field":"resolution-status","equals":"failed"}]},"order-by":[{"field":"run-clock","direction":"desc"},{"field":"run","direction":"desc"}]},{"name":"routing-resolution-failures","from":"routing-resolution-failure-records","subject":"Group failed resolutions by configured model and cause.","objective":"Keep model_unavailable and catalog_unavailable distinct with engine and role context.","acceptance":"Affected runs are distinct run identities; a single-run group links to that run.","aggregate":{"by":["configured-model","resolution-cause","resolution-engine","resolution-role-label","resolution-provider"],"values":[{"field":"routing-run-key","as":"affected-runs","reducer":"distinct-count"},{"field":"event","as":"records","reducer":"count"},{"field":"run","as":"runs","reducer":"distinct-list"},{"field":"routing-dashboard-link","as":"routing-dashboard-link","reducer":"unique"}]},"order-by":[{"field":"affected-runs","direction":"desc"},{"field":"configured-model","direction":"asc"},{"field":"resolution-cause","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":"campaign-cost-totals","subject":"Sum observed AI Credit cost across declared campaign orchestrators and workers.","objective":"Attribute retained workflow AIC totals to centrally managed campaigns without computing unrelated inventory metrics.","acceptance":"Sum only positive recorded orchestrator and worker workflow AIC by campaign; exclude workflows with zero or missing costs rather than treating them as free execution.","from":"workflows","joins":[{"source":"workflow-aic-totals","type":"inner","on":[{"left":"organization","right":"organization"},{"left":"repository","right":"repository"},{"left":"workflow","right":"workflow"}],"fields":[{"field":"aic","as":"observed-aic"}]}],"filter":{"predicates":[{"field":"workflow-role","in":["orchestrator","worker"]}]},"compute":[{"as":"aic","function":"coalesce","args":[{"field":"observed-aic"},{"value":0}]}],"aggregate":{"by":["campaign"],"values":[{"field":"aic","as":"aic","reducer":"sum"}]}},{"name":"cost-by-campaign","subject":"Present observed AI Credit cost grouped by centrally managed campaign.","objective":"Identify campaigns whose observed AI Credit use needs investigation.","acceptance":"Rows preserve positive recorded native aic values and descending order; exclude campaigns without recorded positive costs rather than inferring free execution, savings, or value.","from":"campaigns","joins":[{"source":"campaign-cost-totals","type":"inner","on":[{"left":"campaign","right":"campaign"}],"fields":[{"field":"aic","as":"observed-aic"}]}],"compute":[{"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-name"},{"field":"campaign-dashboard-link"},{"field":"aic"}],"order-by":[{"field":"aic","direction":"desc"}]},{"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/src/data/queries/database.js b/dashboard/site/src/data/queries/database.js index 59f0910621..b8b9615476 100644 --- a/dashboard/site/src/data/queries/database.js +++ b/dashboard/site/src/data/queries/database.js @@ -325,11 +325,12 @@ export async function queryIndexedDatabaseSources(indexedDB, logicalSources, def if (unavailable) { return [name, executeRowLocalRecordGraph(plan.queries, { [source]: unavailable }, name, budget)]; } - const keyReadId = `${plan.store}:${plan.indexName}`; + const keyReadId = JSON.stringify([plan.store, plan.indexName, plan.exactKey]); let keyRead = keyReads.get(keyReadId); if (!keyRead) { keyRead = readCollectionQueryKeys(indexedDB, plan.store, plan.indexName, { - maxKeys: DASHBOARD_QUERY_LIMITS['max-input-rows'], checkpoint: () => budget.spend(1) + maxKeys: DASHBOARD_QUERY_LIMITS['max-input-rows'], checkpoint: () => budget.spend(1), + exactKey: plan.exactKey }); keyReads.set(keyReadId, keyRead); } @@ -742,11 +743,43 @@ function indexedRecordKeySelectionPlan(index, definition) { }); return { source, store, indexName: candidate.indexName, keyField, queries, + exactKey: exactRecordSelectionKey(recordProjection, stages, candidate.covered), projection: projection ? pruned[0] : undefined, keyQueries: projection ? pruned.slice(1) : pruned }; } +/** + * Only invert unchanged scalar projections, never computed labels. Storage + * additionally proves that all indexed tuples contain strings before using + * this shortcut; coercible or structured values retain dictionary evaluation. + * @param {import('./declarative.js').DashboardQuery} projection + * @param {Array<{ definition: import('./declarative.js').DashboardQuery }>} stages + * @param {Set} covered + */ +function exactRecordSelectionKey(projection, stages, covered) { + if (covered.size !== 1) return undefined; + const [rawField] = covered; + const computed = new Set((projection.compute ?? []).map((field) => field.as)); + let fields = new Set((projection.select ?? []).filter((field) => ( + field.field === rawField && !computed.has(field.field) + )).map((field) => field.as ?? field.field)); + for (const { definition } of stages) { + for (const field of definition.compute ?? []) fields.delete(field.as); + const predicate = definition.filter?.predicates?.find((predicate) => ( + fields.has(predicate.field) && !predicate.optional + && typeof predicate.equals === 'string' && !predicate.in + && predicate.includes === undefined && predicate.gte === undefined && predicate.lt === undefined + )); + if (predicate) return JSON.stringify([predicate.equals]); + if (definition.select) { + fields = new Set(definition.select.filter((field) => fields.has(field.field)) + .map((field) => field.as ?? field.field)); + } + } + return undefined; +} + /** * Fuse only row-local ancestors with their selection, retaining one shared * budget. Sorting and limiting still operate once on the complete result. diff --git a/dashboard/site/src/data/storage/indexeddb.js b/dashboard/site/src/data/storage/indexeddb.js index daf0c79fb0..a31e974954 100644 --- a/dashboard/site/src/data/storage/indexeddb.js +++ b/dashboard/site/src/data/storage/indexeddb.js @@ -1375,7 +1375,7 @@ export async function queryCollectionCountGroups(indexedDB, storeName, plan) { * @param {IDBFactory} indexedDB * @param {typeof ENTITY_STORES[number]} storeName * @param {string} indexName - * @param {{ maxKeys: number, checkpoint?: () => void }} options + * @param {{ maxKeys: number, checkpoint?: () => void, exactKey?: string }} options * @returns {Promise }> | null>} */ export async function readCollectionQueryKeys(indexedDB, storeName, indexName, options) { @@ -1392,6 +1392,18 @@ export async function readCollectionQueryKeys(indexedDB, storeName, indexName, o return null; } const fields = CANONICAL_QUERY_INDEX_FIELDS[indexName]; + if (options.exactKey !== undefined && fields.length === 1) { + // JSON string tuples sort before every non-string tuple. Check the tail + // without scanning the string dictionary, retaining coercion semantics. + const nonString = await requestResult(index.openKeyCursor(IDBKeyRange.lowerBound('[#'))); + options.checkpoint?.(); + if (!nonString) { + await done; + if (options.maxKeys < 1) throw new Error(`IndexedDB query keys exceeded max-input-rows of ${options.maxKeys}`); + const [value] = JSON.parse(options.exactKey); + return [{ key: options.exactKey, row: { [fields[0]]: value } }]; + } + } /** @type {Array<{ key: string, row: Record }>} */ const rows = []; try { diff --git a/dashboard/site/test/e2e/canonical-data.spec.js b/dashboard/site/test/e2e/canonical-data.spec.js index 8f2aac4555..f3f4cf1380 100644 --- a/dashboard/site/test/e2e/canonical-data.spec.js +++ b/dashboard/site/test/e2e/canonical-data.spec.js @@ -636,6 +636,58 @@ test('workflow route queries return bounded records and subscribed aggregates th expect(Object.values(result.missing).every((source) => source.rows.length === 0)).toBe(true); }); +test('Domain runs returns bounded aliases and refreshes its abort-scoped subscription', async ({ page, context }) => { + const initial = databaseTables(); + initial.domains.rows.push({ ...initial.domains.rows[0], event: 'unrelated-domain', domain: 'other.example' }); + await context.route('http://dashboard.test/domain-initial.json', (route) => route.fulfill({ + contentType: 'application/json', body: JSON.stringify(initial) + })); + await context.route('http://dashboard.test/domain-updated.json', (route) => route.fulfill({ + contentType: 'application/json', body: JSON.stringify(databaseTables('domain-refresh', '12346')) + })); + const result = await page.evaluate(async () => { + const processor = await import(`${location.origin}/src/data-processor.js`); + const { dashboard } = await fetch(`${location.origin}/dashboard.json`).then((response) => response.json()); + const source = 'domain-run-records'; + const alias = 'view:domain-runs:domain-runs-table:domain-run-records'; + const options = { + pageId: 'domain-runs', viewId: 'domain-runs-table', + routeParameters: { domain: 'api.github.com' } + }; + const pagination = { [alias]: { limit: 1 } }; + const initial = await processor.loadCanonicalDashboardSources( + `${location.origin}/domain-initial.json`, [source], dashboard, pagination, options + ); + const lifetime = new AbortController(); + let deliveries = 0; + try { + const refreshed = await new Promise((resolve, reject) => { + processor.subscribeCanonicalDashboardView('domain-runs-refresh', [source], dashboard, (/** @type {Record} */ payload) => { + deliveries++; + if (deliveries === 1) { + processor.refreshCanonicalDashboardSources( + `${location.origin}/domain-updated.json`, [source], dashboard, pagination, options + ).catch(reject); + } else if (payload[alias]?.metadata['total-row-count'] === 4) resolve(payload); + }, pagination, { ...options, signal: lifetime.signal, onError: reject }); + }); + return { initial, refreshed }; + } finally { lifetime.abort(); } + }); + const alias = 'view:domain-runs:domain-runs-table:domain-run-records'; + for (const payload of [result.initial, result.refreshed]) { + expect(Object.keys(payload)).toEqual([alias]); + expect(payload[alias].rows).toHaveLength(1); + expect(payload[alias].rows[0]).toMatchObject({ + domain: 'api.github.com', repository: 'gh-cao', + 'run-attempt': 2, 'run-link': { href: expect.stringMatching(/actions\/runs\/1234[56]/) } + }); + expect(payload[alias].continuationToken).toBeTruthy(); + } + expect(result.initial[alias].metadata['total-row-count']).toBe(2); + expect(result.refreshed[alias].metadata['total-row-count']).toBe(4); +}); + test('data worker avoids unavailable legacy boundaries on initial and navigated requests', async ({ context, page }) => { await context.route('http://dashboard.test/canonical-warning-sources.json', async (route) => { await route.fulfill({ diff --git a/dashboard/site/test/fixtures/detail-query-contracts.json b/dashboard/site/test/fixtures/detail-query-contracts.json index 67a2f065d1..e9fbc979c5 100644 --- a/dashboard/site/test/fixtures/detail-query-contracts.json +++ b/dashboard/site/test/fixtures/detail-query-contracts.json @@ -14,6 +14,16 @@ "missing-tool/" ], "sources": { + "domain-run-records": [ + "id", "organization", "repository", "workflow", "run", "run-attempt", + "event", "event-timestamp", "event-source", "event-type", "event-summary", + "event-status", "request-count", + "correlation-id", "payload-ref", "domain", "decision", "source-sequence", + "observed-at", "run-link", "engine", "engine-version", "requested-model", + "resolved-model", "model-id", "rollout-mode", "gh-aw-version", "run-conclusion", + "agent-id", "agent-version", "agent-runtime", "organization-link", + "repository-link", "workflow-link" + ], "entity-events": [ "organization", "repository", "workflow", "run", "run-attempt", "event", "event-source", "event-type", "event-summary", "event-status", @@ -48,6 +58,14 @@ ], "temporalPanelFields": ["campaign", "value-workflow", "series-repository", "plot-title", "plot-window-start-ms", "plot-window-end-ms", "operational-value-definition", "operational-value-name", "operational-value-unit", "operational-value-direction", "plot-evidence-mode", "plot-comparison-note", "metric", "metric-key", "metric-name", "metric-kind", "metric-group", "series"], "views": [ + { + "page": "domain-runs", + "id": "domain-runs-table", + "source": "domain-run-records", + "identity": "event", + "arguments": ["domain"], + "lazy-list": true + }, { "page": "run-events", "id": "run-events", diff --git a/dashboard/site/test/unit/data-sqlite-native-selection.test.js b/dashboard/site/test/unit/data-sqlite-native-selection.test.js index 3563235793..a60876d5f1 100644 --- a/dashboard/site/test/unit/data-sqlite-native-selection.test.js +++ b/dashboard/site/test/unit/data-sqlite-native-selection.test.js @@ -92,6 +92,24 @@ afterEach(() => { }); describe('real SQLite native record selection', () => { + it('retains the ordinary SQLite path when tuple-key cursors are unsupported', async () => { + const factory = sqliteFactory(); + vi.stubGlobal('IDBKeyRange', SqliteIDBKeyRange); + const canonical = evidence(); + canonical.audits = Array.from({ length: 101 }, (_, index) => ({ + id: `audit:${index}`, runId: 'run:42', summary: index === 0 ? 'selected' : `other-${index}` + })); + await upsertCanonicalBatch(factory, canonical); + const query = { + name: 'selected-audit', from: 'audits', + filter: { predicates: [{ field: 'event-summary', equals: 'selected' }] }, + select: [{ field: 'event' }] + }; + expect(await queryIndexedDatabaseSources(factory, sources, [query], [query.name])).toEqual({}); + const result = await loadDatabaseQuerySources(factory, sources, { queries: [query], sourceNames: [query.name] }); + expect(result[query.name].rows).toEqual([{ event: 'audit:0' }]); + }); + it('reduces production repository run statistics in bounded SQLite scans before joins', async () => { const factory = sqliteFactory(); vi.stubGlobal('IDBKeyRange', SqliteIDBKeyRange); diff --git a/dashboard/site/test/unit/domain-runs-query.test.js b/dashboard/site/test/unit/domain-runs-query.test.js new file mode 100644 index 0000000000..a1843fbeb1 --- /dev/null +++ b/dashboard/site/test/unit/domain-runs-query.test.js @@ -0,0 +1,186 @@ +// @vitest-environment node +import 'fake-indexeddb/auto'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { processDataRequest } from '../../src/data-worker.js'; +import { queryDatabaseSources, queryIndexedDatabaseSources } from '../../src/data/queries/database.js'; +import { DASHBOARD_QUERY_LIMITS, executeDashboardQueries } from '../../src/data/queries/declarative.js'; +import { compileDashboardViewPayloadQueries } from '../../src/data/queries/view-payload-compiler.js'; +import { DATABASE_NAME, openCanonicalDatabase, prepareCanonicalRecord, readCollections } from '../../src/data/storage/indexeddb.js'; +import { authoritativeDashboard } from '../authoritative-dashboard.js'; + +const dashboard = authoritativeDashboard.dashboard; +const page = dashboard.pages.find((/** @type {{ id: string }} */ page) => page.id === 'domain-runs'); +const metadata = { + 'as-of': '2026-10-02T20:00:00Z', 'artifact-generation': 'domain-runs', + availability: 'available', completeness: 'partial', freshness: 'fresh' +}; +const identity = { organization: 'org', repository: 'repo', workflow: 'worker.md', 'run-attempt': 1 }; +const sources = { + runs: { metadata, rows: [ + { ...identity, run: '42', 'started-at': metadata['as-of'], 'run-link': { href: 'https://github.com/org/repo/actions/runs/42', relation: 'run' } } + ] }, + domains: { metadata, rows: [] }, + workflows: { metadata, rows: [identity] }, + repositories: { metadata, rows: [identity] }, + campaigns: { metadata, rows: [] } +}; + +/** @param {Record[]} records @param {boolean} [prepare] */ +async function put(records, prepare = true) { + const [run] = (await readCollections(indexedDB, ['runs'])).runs; + const db = await openCanonicalDatabase(indexedDB); + try { + await new Promise((resolve, reject) => { + const tx = db.transaction('domains', 'readwrite'); + for (const record of records) { + const row = { ...record, runId: run.id }; + tx.objectStore('domains').put(prepare ? prepareCanonicalRecord('domains', row) : row); + } + tx.oncomplete = () => resolve(undefined); + tx.onerror = () => reject(tx.error); + }); + } finally { db.close(); } +} + +/** @param {string} viewId @param {Record} [routeParameters] @param {Record} [queryContext] */ +function compile(viewId, routeParameters = { domain: 'selected.example' }, queryContext = {}) { + return compileDashboardViewPayloadQueries(page, page.id, { + queries: dashboard.queries, views: dashboard.views, viewId, routeParameters, queryContext + }); +} + +/** @param {string} viewId @param {Record} [routeParameters] @param {Record} [queryContext] @param {string} [continuationToken] */ +async function load(viewId, routeParameters = { domain: 'selected.example' }, queryContext = {}, continuationToken) { + const compiled = compile(viewId, routeParameters, queryContext); + return /** @type {Record} */ (await processDataRequest({ + operation: 'query-canonical-dashboard', + context: { pages: [page], queries: dashboard.queries, views: dashboard.views }, + pageId: page.id, viewId, routeParameters, queryContext, + sourceNames: viewId === 'domain-runs-table' ? ['domain-run-records'] : ['domain-route-record'], + pagination: { [compiled.aliases[0]]: { limit: 25, continuationToken } } + })); +} + +beforeEach(async () => { + vi.stubGlobal('self', { postMessage: () => {} }); + await new Promise((resolve, reject) => { + const request = indexedDB.deleteDatabase(DATABASE_NAME); + request.onsuccess = () => resolve(undefined); + request.onerror = () => reject(request.error); + }); + vi.stubGlobal('fetch', vi.fn(async (url) => ({ + ok: !String(url).endsWith('/sources/manifest.json'), + status: String(url).endsWith('/sources/manifest.json') ? 404 : 200, + json: async () => structuredClone(sources) + }))); + await processDataRequest({ + operation: 'load-canonical-dashboard', sourceUrl: 'https://dashboard.example/sources.json', + sourceNames: [], context: { pages: [], queries: [] } + }); + await put(Array.from({ length: 560 }, (_, index) => ({ + id: `domain-${String(index).padStart(4, '0')}`, + domain: index < 60 ? 'selected.example' : `unrelated-${index}.example`, + decision: index % 2 ? 'denied' : 'allowed', + observedAt: `2026-10-02T${String(index % 20).padStart(2, '0')}:00:00Z`, + requestCount: index + 1, payloadRef: `evidence-${index}` + }))); +}); +afterEach(() => { vi.restoreAllMocks(); vi.unstubAllGlobals(); }); + +describe('bounded Domain runs worker contract', () => { + it('returns only the paginated alias and avoids whole-domain and distinct-key scans', async () => { + const records = vi.spyOn(IDBObjectStore.prototype, 'getAll'); + const cursors = vi.spyOn(IDBIndex.prototype, 'openKeyCursor'); + const limit = DASHBOARD_QUERY_LIMITS['max-input-rows']; + DASHBOARD_QUERY_LIMITS['max-input-rows'] = 100; + let result; + try { + result = await load('domain-runs-table'); + } finally { DASHBOARD_QUERY_LIMITS['max-input-rows'] = limit; } + const alias = compile('domain-runs-table').aliases[0]; + expect(Object.keys(result)).toEqual([alias]); + expect(result[alias].rows).toHaveLength(25); + expect(result[alias].metadata).toMatchObject({ 'total-row-count': 60, completeness: 'partial' }); + expect(result[alias].continuationToken).toBeTruthy(); + expect(result[alias].rows.every((row) => row.domain === 'selected.example')).toBe(true); + expect(result[alias].rows[0]).toMatchObject({ + run: '42', 'payload-ref': expect.any(String), + 'run-link': { href: 'https://github.com/org/repo/actions/runs/42' } + }); + expect(records.mock.contexts.filter((store) => store instanceof IDBObjectStore && store.name === 'domains')).toHaveLength(0); + const domainCursors = cursors.mock.calls.filter((_, index) => { + const indexObject = cursors.mock.contexts[index]; + return indexObject instanceof IDBIndex && indexObject.name === 'byQueryDomain'; + }); + expect(domainCursors).toHaveLength(1); + expect(domainCursors[0][0]).toMatchObject({ lower: '[#' }); + }); + + it('matches the ordinary query for ordering, filters, search and all observation fields', async () => { + const queryContext = { + filters: { decision: ['denied'] }, + search: { fields: ['repository', 'workflow'], query: 'worker' }, + orderBy: [{ field: 'observed-at', direction: 'asc' }] + }; + const compiled = compile('domain-runs-table', undefined, queryContext); + const canonical = await queryDatabaseSources(indexedDB, sources, ['domains']); + const expected = executeDashboardQueries(compiled.queries, canonical, compiled.aliases)[compiled.aliases[0]]; + const actual = await load('domain-runs-table', undefined, queryContext); + expect(actual[compiled.aliases[0]].rows).toEqual(expected.rows.slice(0, 25)); + expect(actual[compiled.aliases[0]].metadata['total-row-count']).toBe(30); + const header = await load('domain-runs-route-chrome'); + expect(Object.values(header)[0].rows).toEqual([{ domain: 'selected.example', 'run-link': sources.runs.rows[0]['run-link'] }]); + }); + + it('paginates every matching observation exactly once and rejects cross-domain cursors', async () => { + const ids = []; + /** @type {string | undefined} */ + let token; + do { + const [source] = Object.values(await load('domain-runs-table', undefined, undefined, token)); + ids.push(...source.rows.map((row) => row.id)); + token = source.continuationToken; + if (token) await expect(load('domain-runs-table', { domain: 'unrelated-60.example' }, undefined, token)) + .rejects.toThrow(/stale continuation token/); + } while (token); + expect(ids).toHaveLength(60); + expect(new Set(ids).size).toBe(60); + await put([{ id: 'new-evidence', domain: 'selected.example', observedAt: metadata['as-of'] }]); + expect(Object.values(await load('domain-runs-table'))[0].metadata['total-row-count']).toBe(61); + }); + + it('keeps missing and nonmatching domain routes empty', async () => { + for (const route of /** @type {Record[]} */ ([{}, { domain: '' }, { domain: 'not-observed.example' }])) { + for (const view of ['domain-runs-table', 'domain-runs-route-chrome']) { + const result = Object.values(await load(view, route))[0]; + expect(result.rows).toEqual([]); + expect(result.metadata.availability).toBe('empty'); + } + } + }); + + it('falls back for nullable, structured and coercible keys without changing equality semantics', async () => { + await put([ + { id: 'array', domain: ['selected.example'] }, + { id: 'number', domain: 123 }, + { id: 'string', domain: '123' }, + { id: 'null', domain: null }, + { id: 'missing' }, + { id: 'unknown', domain: 'unknown' } + ]); + for (const [domain, total] of [['selected.example', 61], ['123', 2], ['unknown', 3]]) { + const compiled = compile('domain-runs-table', { domain: String(domain) }); + const canonical = await queryDatabaseSources(indexedDB, sources, ['domains']); + const expected = executeDashboardQueries(compiled.queries, canonical, compiled.aliases)[compiled.aliases[0]]; + const actual = Object.values(await load('domain-runs-table', { domain: String(domain) }))[0]; + expect(actual.rows).toEqual(expected.rows.slice(0, 25)); + expect(actual.metadata['total-row-count']).toBe(total); + } + }); + + it('rejects incomplete physical indexes rather than silently dropping observations', async () => { + await put([{ id: 'unindexed', domain: 'selected.example' }], false); + const compiled = compile('domain-runs-table'); + expect(await queryIndexedDatabaseSources(indexedDB, sources, compiled.queries, compiled.aliases)).toEqual({}); + }); +}); diff --git a/dashboard/site/test/unit/entity-insights-contract.test.js b/dashboard/site/test/unit/entity-insights-contract.test.js index e08e18259f..cb4bccb875 100644 --- a/dashboard/site/test/unit/entity-insights-contract.test.js +++ b/dashboard/site/test/unit/entity-insights-contract.test.js @@ -6,7 +6,7 @@ const dashboard = authoritativeDashboard.dashboard; describe('canonical entity insights', () => { for (const entity of [ - { id: 'domain', card: 'firewall-domain', source: 'domains', identifier: 'domain' }, + { id: 'domain', card: 'firewall-domain', source: 'domain-run-records', identifier: 'domain' }, { id: 'tool', card: 'mcp-tool', source: 'mcp-tool-calls', identifier: 'mcp-tool-label' }, { id: 'audit', card: 'audit', source: 'audits', identifier: 'event-summary' } ]) { diff --git a/specs/dashboard-data.md b/specs/dashboard-data.md index 72f2e5fad2..9369525ead 100644 --- a/specs/dashboard-data.md +++ b/specs/dashboard-data.md @@ -642,7 +642,12 @@ Canonical write APIs SHALL prepare these keys after pruning redundant fields; canonical read APIs SHALL remove them. Equivalent native query plans MAY evaluate declared row-local expressions on distinct indexed keys, read only matching observations, and obtain grouped event counts from indexes before -materializing bounded results. Such plans MUST preserve observation grain, +materializing bounded results. An unchanged single-field string equality MAY +seek its encoded tuple directly only after verifying index coverage and excluding +non-string tuples; nullable, coercible, structured, or computed values retain +normal dictionary evaluation. The Domain runs table SHALL consume its declared +`domain-run-records` query and return only the paginated view alias, not an +additional unbounded `domains` collection. Such plans MUST preserve observation grain, run attempts, null and missing values, ordering, provenance, pagination, and unavailable inputs. Unsupported plans retain normal fail-closed execution, and an oversized selected scope MUST NOT be truncated or have its limits raised.