amirbena / amirbena/code-review-skill

Consolidate specialist-depth/deepening policy-doc test skeletons

Open
#396 0 comments 0 reactions 1 assignee Claimed by @amirbena View on GitHub
area:packaging-portability contributor-owned help wanted priority:P2 type:refactor
Dominant language
Python
Stars
7
Forks
2
Avg merge
27m
Merged PRs (30d)
188

Description

## Type

Refactor

## Area

Packaging / Portability

## Priority

P2 — Medium

Contributor-owned: bounded to `tests/policy/review/specialist_depth/`, no policy or production semantics touched.

## Problem

`tests/policy/review/specialist_depth/{test_security_deepening_83,test_database_migration_deepening_179,test_distributed_systems_deepening_84,test_performance_deepening_180}.py` (129 tests across 4 files) each pin a different domain-specific "deepening capability" policy, but ~26 of each file's tests are the identical composition-contract skeleton (policy file exists and declares scope, never decides whether a dimension is considered at all, two-part activation condition, signals never independently sufficient, defers severity/evidence to the shared model, no second output schema, capability-provenance field named, etc.) applied verbatim to a different policy path and phrase text per domain. It is one invariant instantiated four times, not four distinct invariants.

## Goal

Replace the repeated skeleton with shared/table-driven test infrastructure parametrized per domain, while every domain-specific example (e.g. the SQL worked contrast, migration-specific concern areas) remains a distinct, non-parametrized test owned by its file.

## Scope

- Extract the ~26-test shared skeleton common to all 4 files into one parametrized test (or shared base fixture) over `(domain, policy_path, concern_area_list, exclusion_phrase)`.
- Keep each file's domain-specific residual assertions (worked examples, domain-specific concern-area content, domain-specific exclusion phrasing) as distinct, locally-owned tests.
- Preserve per-domain failure attribution: a parametrized case's failure must identify which domain/policy broke.

## Non-Goals

- Does not touch `test_specialist_depth_82.py` (the composition contract itself) or the non-`_deepening_` files in the same directory (`test_api_contract_compatibility.py`, `test_dependency_supply_chain_deepening.py` — scoped to the shared-policy-wiring child instead).
- Does not change any `shared/policies/*-deepening.md` content or semantics.

## Acceptance Criteria

- [ ] Baseline test count for the 4 scoped files recorded (129).
- [ ] After-change test count recorded and reported.
- [ ] Every phrase/invariant currently asserted remains checked somewhere; no semantic assertion silently dropped.
- [ ] Domain-specific worked examples remain distinct, locally-owned tests, not folded into the generic skeleton.
- [ ] A failing parametrized case still identifies which domain/policy file broke.
- [ ] Scoped tests and the full suite (`python3 -m unittest discover -s tests -t .`) pass.

## Dependencies

Depends on: none
Blocks: none
Parent: #395

## Validation

- Before/after: `grep -rc "def test_" tests/policy/review/specialist_depth/test_*_deepening_*.py`.
- `python3 -m unittest discover -s tests -t .`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.