Skip to content

Introduce category definitions for category metadata - #933

Draft
Sun Haoran (haoranpb) wants to merge 1 commit into
app/stack-01-config-constantsfrom
app/stack-02-category-definitions
Draft

Sun Haoran (haoranpb) wants to merge 1 commit into
app/stack-01-config-constantsfrom
app/stack-02-category-definitions

Conversation

@haoranpb

Copy link
Copy Markdown
Collaborator

Goal 2 step 2, stacked on #932. Starts replacing the EvaluationCategory lookup table with category-owned definitions (hybrid layout: category-specific code under bcbench/categories/<name>/, shared pieces stay common).

  • New bcbench/categories/: a typed CategoryDefinition and one package per category with its definition.py (dataset file, entry type, evaluators, core score, runner, container requirement, credential policy). category_definition() dispatches with an exhaustive match.
  • The matching EvaluationCategory properties are removed; the CLI and commands use the definitions.
  • Runtime code gets inputs explicitly: agents take pass_bc_credentials, the bc-eval export takes loaded entries, the red-team target takes its entry.

Pipelines, result types, judge models and prompts move in the next steps. No behaviour change; CLI outputs verified against the old values.

Comment thread src/bcbench/types.py
EXTERNAL_COMMAND = "external-command"


CopilotModelName = Literal[
from collections.abc import Sequence
from dataclasses import dataclass
from pathlib import Path
from typing import Generic, Literal, TypeVar
__all__ = ["CategoryDefinition", "category_definition"]


def category_definition(category: EvaluationCategory) -> CategoryDefinition[BaseDatasetEntry]:
Goal 2 step 2, following the hybrid ownership model: each category gets a
package under bcbench.categories, starting with a typed definition.py.

- CategoryDefinition holds what was static metadata on EvaluationCategory:
  dataset file and entry type (requires_repo follows from it), bc-eval
  evaluators and core score, runner label, container requirement, and
  whether the agent may see the BC container credentials.
- category_definition() maps a category to its definition with an
  exhaustive match; the CLI and commands use it, and the corresponding
  EvaluationCategory properties are removed.
- Runtime code receives inputs instead of looking them up: the Copilot
  and Claude agents take pass_bc_credentials, the bc-eval export takes
  the loaded dataset entries, and the red-team target takes its entry.
- CopilotModelName moves to bcbench.types so config.py no longer imports
  the CLI options module.

Pipelines, result types, judge models and prompts still hang off
EvaluationCategory and move in the next steps. CATEGORIES.md and the
Copilot instructions describe the new layout.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@haoranpb
Sun Haoran (haoranpb) force-pushed the app/stack-02-category-definitions branch from 6634519 to 239bdda Compare October 8, 2026 13:13
@github-code-quality

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: Python

Python / code-coverage/pytest

The overall line coverage in commit 239bdda in the app/stack-02-categor... branch is 87%. The line coverage in commit 92af447 in the app/stack-01-config-... branch is 86%.

Show a line coverage summary of the most impacted files.
File app/stack-01-config-... 92af447 app/stack-02-categor... 239bdda +/-
src/bcbench/types.py 92% 94% +2%
src/bcbench/age...opilot/agent.py 73% 100% +27%
src/bcbench/cat...ies/__init__.py 0% 94% +94%
packages/bcbenc...ilot/metrics.py 0% 100% +100%
packages/bcbenc...opilot/agent.py 0% 100% +100%
packages/bcbenc...opilot/types.py 0% 100% +100%
src/bcbench/cat...s/definition.py 0% 100% +100%
packages/bcbenc...gent/version.py 0% 100% +100%
packages/bcbenc...gent/metrics.py 0% 100% +100%
src/bcbench/cat...x/definition.py 0% 100% +100%

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant