Skip to content

[T-074a] InteractionTester: plan confirmatory scenarios and conclude interaction verdict (pure) #133

Closed

Description

@CodewithJha

Task T-074a · Milestone M6 — Analysis + risk · Size S · Priority P1 · Epic #6

Implements FR-ANA-005 · PR-14

Branch feat/t-074a-interactiontester-plan-confirmatory-scenarios-and — one task = one branch = one PR (doc 32 §6)

Summary

Implement analysis/interaction.py per doc 09 §6: singles, pairs (if |C| ≥ 3) and full scenarios from x_min and characteristic set C; repeats; verdict 'interaction failure' if full fails ≥ success_ratio and no single does; order = smallest failing subset size.

Context / motivation

The core research claim (H3): RoboProbe finds failures that require combinations of conditions.

Scope

In scope

  • plan(mode, space) -> list[Scenario] and conclude(mode, confirm_runs) -> InteractionVerdict (status, order, params, evidence run ids).
  • InteractionVerdict (status, order, params, per-subset ratios, evidence run ids).

Implementation guidance

  • Module roboprobe/analysis/interaction.py: class InteractionTester: def __init__(self, settings: InteractionSettings) -> None; def plan(self, mode: FailureModeSummary, space: ScenarioSpace) -> list[ConfirmScenario]; def conclude(self, mode: FailureModeSummary, confirm_runs: Sequence[RunRecord]) -> InteractionVerdict (doc 05 §7).
  • Planning (doc 09 §6): start from minimal scenario x_min; C = characteristic set (≤ 4 params; if more, take the 4 smallest-coverage ones). Generate: singles (only one c ∈ C at its x_min value, others at nominal), pairs if |C| ≥ 3, and full (all of C at x_min). Each × analysis.interaction.repeats, with seeds derived via derive_seed(campaign_seed, "confirm", mode_code, subset_key, rep).
  • ConfirmScenario carries subset: frozenset[str] and tags=("confirm", mode_code).
  • Conclusion: failure ratio per subset; interaction = full_ratio ≥ success_ratio and all(single_ratio < success_ratio); order = min |S| over subsets with ratio ≥ success_ratio; status CONFIRMED | NOT_INTERACTION | INCONCLUSIVE (inconclusive if any INVALID runs reduce n below repeats).
  • Pure; no DB, no queue.
  • Standards: respect the layering contracts (doc 16 §2) and conventions in doc 34; no hard-coded tunables — thresholds/defaults come from typed settings (doc 27); no magic numbers (ruff PLR2004); public APIs typed (mypy strict) and documented.

Configuration keys

From the configuration reference (doc 27). Keys marked (new) must be added to the typed settings models and appear in the generated reference (T-003c).

  • analysis.interaction.repeats
  • analysis.interaction.success_ratio

Acceptance criteria

  • Synthetic 3-way interaction detected with order 3; single-factor mode (GT-D style) not flagged.
  • Plan size = (|C| + C(|C|,2)·[|C|≥3] + 1) × repeats — property test.
  • Seeds reproducible and distinct per subset/repeat.
  • INCONCLUSIVE when INVALID runs present.
  • Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
  • Docs, config reference and CHANGELOG Unreleased updated where behaviour, keys or interfaces changed.
  • Definition of Done (doc 32 §3) satisfied.

Tests required

  • tests/unit/analysis/test_interaction.py.
  • Table-driven conclude() tests covering all three statuses.

Dependencies

Blocked by: #129 (T-071a)

Blocks: #134 (T-074b)

Parallelization notes

Files / paths owned by this task — avoid editing other paths; shared files (pyproject.toml entry points, cli/main.py, api/routers/__init__.py, router.tsx, docker/compose.yaml, ci.yml) are append-only:

  • backend/src/roboprobe/analysis/interaction.py

Independent.

Definition of Done

Per doc 32 §3 and AGENTS.md §5: lint, format, mypy strict and import-linter green; tests added and passing; docs updated; PR template completed with Closes #<this issue>; Conventional Commit messages referencing T-074a (doc 16 §6); commits authored only by the repository owner identity (AGENTS.md §4); CI green; reviewer checklist (doc 32 §5.1) satisfied.

References

Design docs: doc 09 §6 · doc 19 §1 · doc 21 §3

Requirements: FR-ANA-005 · PR-14 (traceability: doc 28)

External:

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:analysisFailure clustering, SHAP, rules, interactionsmilestone:M6M6 — Analysis + riskpriority:P1Required for milestone exitsize:S<= 1 daytaskChild task of a milestone epictype:featureNew functionality

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions