BDD Bindings and Coverage
Founder decision, 2026-10-17: BDD/E2E bindings never hardcode names. Names of products, repositories, databases and agents change (the ecosystem renamed several of each on 2026-10-17 alone); IDs do not. Every binding is a stable ID, and human-readable names are always resolved from the database at read time.
Binding tags
Section titled “Binding tags”Every scenario in anuka-bdd-e2e-tests carries a binding block:
| Tag | References | Notes |
|---|---|---|
@project-id-<int> | public.projects.id in ANUKA Core | the management/showcase project |
@app-id-<int> | public.platform_apps.id | the product surface (app) |
@repo-id-<int> | GitLab project ID | survives path renames; the path is resolved live by ID |
@sid-<id> | the scenario itself | assigned once by the sync tooling, never reused |
@agent-id-<uuid> / @team-id-<uuid> | public.agents.id / team ID | only when ownership does not resolve through the app |
Ownership is derived, not duplicated: for scenarios bound to an app, the owner
is whoever public.app_owners names for that app today. Changing the owner in
app_owners re-points coverage grouping without editing a single scenario.
@code-<CODE> remains as a human grouping/filter convenience only. It is not
a binding and is never a source of truth.
Coverage lives in ANUKA Core
Section titled “Coverage lives in ANUKA Core”Coverage is dynamic state in the project database, not a markdown file:
bdd_scenarios— one row per scenario:sid,project_id,app_id,repo_id, optionalagent_id/team_id, feature-file path, scenario title, content hash,impl_status,test_status,prod_status,first_seen_at,last_seen_at,removed_at.bdd_sync_runs— one row per sync: source commit of the e2e repository, started/finished timestamps, scenarios seen/added/updated/removed.- Aggregate views (
bdd_coverage_by_project,bdd_coverage_by_app,bdd_coverage_by_repo,bdd_coverage_by_owner) compute totals and implementation/test percentages for Dashboard quality monitoring.
A sync job parses the e2e repository and upserts rows by @sid. A scenario
whose title or steps changed keeps its history because matching is by sid,
not by text. A scenario missing from the repository is marked removed, never
silently dropped.
COVERAGE.md is at most a generated export of these aggregates. It is never
edited by hand and nothing reads it as a source of truth.
Repository links
Section titled “Repository links”Projects and apps link to repositories by GitLab project ID in a link table, not by path text in description fields. The current path, name and URL are resolved from the GitLab API by ID whenever they are displayed.
Run results journal and stability tracking
Section titled “Run results journal and stability tracking”Coverage says what exists; run results say how it actually behaves over time. Every run is journaled in ANUKA Core, append-only:
bdd_runs— one row per run:id,started_at,finished_at,source_commit,environment,executor_kind(agent / human / ci),executor_agent_id(nullable),status(passed / failed / partial).bdd_scenario_results— one row per executed scenario per run:run_id,sid,status(passed / failed / error / skipped),duration_ms,failure_kind,failure_summary,artifact_url. A scenario that did not run has no row and is never counted as passed.bdd_quality_daily— one row per project and day: run count, scenarios run, pass rate, flaky share (scenarios with mixed results in the last 20 runs), and the stability index. Days without runs have no row, so graphs show gaps, not invented values.
The journal is append-only for everyone it measures: an agent cannot edit or delete past results on their own project; a correction is a new run. Raw result rows may be pruned after a retention window; daily aggregates are kept indefinitely so the stability graph keeps its full history.
The stability index of a project for a day combines the pass rate of the day’s runs with the flaky share of its scenarios in the trailing window, so a project that passes only by re-running flaky scenarios does not look stable. Stability is computed from the journal, never self-reported.
These aggregates are the quality signal for people and agents alike: the agent-quality view aggregates results by executor/owner agent (pass trend, flaky share), and the project score reads the coverage share and the stability index from the same tables. Only public-safe aggregates (coverage share, stability index) are exposed publicly; raw failure details stay internal.
Search, relations and duplicate prevention
Section titled “Search, relations and duplicate prevention”The scenario table doubles as the search index: title, section, file path,
all tags as structured data, and the step texts are stored per scenario, so
agents query ANUKA Core (directly or through an MCP search tool with filters
for app-id, repo-id, owner, task, status and free text) instead of cloning
and grepping the repository. A generated INDEX.md at the repository root
gives humans the same picture per section: owner, bindings, counts. It is
regenerated by the sync and never edited by hand.
Relations. Scenarios link across sections with relation tags:
@rel-see-<sid>, @rel-variant-of-<sid> (this scenario is the surface
variant of a canonical one), @rel-shared-<sid>. The sync materializes them
into bdd_scenario_relations (from_sid, to_sid, kind), so related
scenarios are one graph query away.
Canonical plus variants. Behavior shared by several surfaces is specified
once, in the owning section, as the canonical scenario. Surface sections keep
only their differences and link @rel-variant-of. This replaces the current
copy-paste pattern (the audit found the shared rewards scenarios copied into
four sections and repo-guard into three).
Duplicate prevention.
- The validator enforces the canonical code registry — alias codes found in
the audit (
@code-auth,@code-auth-app,@code-mailerand similar) are normalized to canonical codes in one mechanical pass, then rejected. - Scenario titles must be unique within an
@app-idunless linked as variants. - The sync computes a normalized-steps hash and title similarity; near-duplicate
pairs land in a
bdd_duplicate_candidatesview for QA triage (mark canonical / merge / record as intentional variants). Nothing is auto-deleted. - Exactly one primary
@task-per scenario; other tasks use@rel-task-. The sync flags scenarios whose primary task closed early and scenarios claimed as primary by two open tasks — the double-work radar. - Draft branches are indexed too, marked
draft. Before writing a new spec, an agent’s search shows in-flight drafts of the same behavior, so two chats cannot unknowingly spec the same thing in parallel. - One writer per section: a generated
CODEOWNERSmaps each section to its owner agent fromapp_owners; everyone else proposes through Draft MRs.
Cross-cutting sections (security, performance, accessibility, migration) are
not products: their scenarios still carry @app-id bindings, so a product
slice always returns the complete set for that product.
Scenario lifecycle status and the roadmap
Section titled “Scenario lifecycle status and the roadmap”Scenario records carry their lifecycle stage, and the stage list itself is
data. bdd_lifecycle_stages holds the stages (key, public_label,
position, is_public) — drafting, in design, in implementation, in
integration, QA testing, user testing, live, or whatever the platform adopts
next. Adding or reordering a stage is a data change: no code, no deploy.
bdd_scenarios.current_stage_key points into that registry, and
bdd_scenario_stage_history journals every transition (sid, from_stage,
to_stage, changed_by by stable ID, source — task event, run journal,
sync, manual — changed_at). Stage changes flow from the work itself:
completing the linked primary task or journaling a QA run moves the scenario;
roadmap statuses are never edited by hand.
The widget roadmap and the Launchpad read the same records through the same read model: features show their scenarios with public stage labels and counts per stage. A feature’s displayed state rolls up from its scenarios (complete only when all are live; in testing when any is in QA or user testing). Stages marked non-public collapse to the nearest public label — internal stage names are never exposed. A project without scenario records renders its features with no stages rather than invented ones.
Database load discipline
Section titled “Database load discipline”ANUKA Core is a small database (55 MB total in October 2026) and this system must keep it that way. The load rules are part of the spec, not an afterthought:
- Writes are O(runs), never O(scenarios). A run is recorded as one batched payload (a single RPC call) and one bulk insert of its result rows server side. There are no per-scenario requests and no row-level triggers.
- Aggregates are incremental. Recording a run updates that project’s daily aggregate row in the same transaction. Nothing recomputes aggregates from raw rows at read time.
- Reads hit only small tables. The stability graph reads
bdd_quality_daily(one row per project per day). The project score reads one current-quality row per project. Raw result rows are read only for internal failure inspection. - Sync is diff-based. The coverage sync re-parses only feature files changed in the incoming commit; unchanged scenarios produce no writes.
- Growth is capped by retention. Raw
bdd_scenario_resultsrows are kept for a bounded window (proposed 90 days) and pruned in bounded batches off-peak; daily aggregates are kept indefinitely and are tiny. With per-project suites (tens to a few hundred scenarios per run) the journal adds a few thousand rows on a busy day — single-digit megabytes per month inside the retention window. - Size is monitored. Each sync/prune run records table sizes in the run journal, so growth is visible before it becomes a problem.
Validation
Section titled “Validation”The BDD validator resolves every binding ID against ANUKA Core (and GitLab for
repo-id) at validation time. An unknown project-id, app-id, repo-id or
a duplicated sid fails validation and names the offending ID.
Rollout
Section titled “Rollout”- Schema and views land in ANUKA Core; the project-to-repo link table is backfilled with GitLab IDs for the active apps.
- The sync tool assigns
@sidvalues and the ID binding block to existing scenarios mechanically, by folder mapping. Scenario texts do not change; scenario counts before and after must match exactly. - The validator rule turns on; QA verifies counts and ID resolution.
- Dashboard reads quality from the aggregate views;
COVERAGE.mdis regenerated from the database or removed.
Task: ANUKA #2974. Related: #2939 (validate repair), goal #1179 (coverage).
Interim state (2026-10-19)
Section titled “Interim state (2026-10-19)”The model above is the target. What is live today, verified against ANUKA Core and the MCP & Auth index work (#3115, #3156):
bdd_scenariosexists in ANUKA Core and is populated by the scenario index (#3115). Until the@sidrollout lands, the index keys scenarios by(feature_path, line_no)and parses today’s tags (slug axes, numeric@task-*/@goal-*) — an honestly temporary key, replaced by@sidwhen the rollout (deliverable 4 of #2974) is done.bdd_sync_runsand the aggregate coverage views are not built yet.- Scenario relations are designed in #3156 as
bdd_scenario_relations(typed edges with strength and rationale), building on this binding family. Edge types come from the shared relation-tag dictionary (tags.type = 'relation') — the same dictionaryentity_relationsuses — never a parallel enum. Auto-linking produces derived edges that consume these ID bindings as anchors; it does not replace them.