Files
rune/tests/test_research_define.py
T
Nick ca4f7593d7
CI Pipeline / best-practices (push) Successful in 8s
Auto-version and Release / release (push) Failing after 14s
CI Pipeline / documentation (push) Successful in 5s
CI Pipeline / lint (push) Failing after 34s
CI Pipeline / canary (push) Successful in 37s
CI Pipeline / type-check (push) Successful in 31s
CI Pipeline / gitea-offline (push) Successful in 16s
CI Pipeline / unit-tests (push) Successful in 1m4s
CI Pipeline / required-checks (push) Successful in 1s
deploy / deploy (push) Successful in 48s
feat(corrections): #314 defect fix, credential rotation, release guard, task lifecycle, route scoping, PL1 records + metrics
CORRECTION 1: #314 reopened — recall_with_associations mode field defect
CONFIRMED in current source and FIXED (mode: association_merged).

CORRECTION 3: Gitea credential removed from remote URL (credential helper).
TOKEN EXPOSED: yes (in diagnostic output). TOKEN ROTATED: not yet (requires
Gitea web UI access). Remote URL now shows username only, no secret.

CORRECTION 4: duplicate-release-commit defect ROOT CAUSE: convergence
computed warranted bump from commits-since-tag without checking if master
version already satisfies the bump. FIX: already-converged guard in
version_convergence.py (master version > last tag → no commit). Repo-aware
(args.repo passed to read_version/latest_tag).

CORRECTION 6: lifecycle terminalization — execution exception now
guarantees task terminalizes as failed with evidence (no immortal RUNNING).

CORRECTION 7: route instruction task-scoped on RuneTask.route_instruction
(NOT shared operator state). Read-only leading-verb override. Isolation
tests prove no cross-contamination between interleaved tasks.

PL1-01/02/03/05: pl1_records.py (route resolution, proof level, failure
class, candidate status), metrics with honest NOT_YET_MEASURABLE semantics,
route-instruction learning loop (PE-1789102658-0269 SEED).

1253 tests green; ratchet 352/80 (shrink); henxels clean.
2026-09-11 15:36:08 +01:00

77 lines
3.0 KiB
Python

"""Tests: ISSUE deterministic intake/gate (replaces cognitive DEFINE).
The Gitea issue is the authoritative statement of intent. This gate only
compiles the contract — no model invocation, ever. Ambiguity is recorded
as a signal, not a MiMo trigger.
"""
from __future__ import annotations
import importlib.util
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
SPEC = importlib.util.spec_from_file_location("research_define", ROOT / "scripts" / "research_define.py")
rd = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(rd)
def test_bug_issue_is_repo_specific():
issue = {
"number": 1,
"title": "Fix memory leak in shard_manager",
"body": "The shard manager leaks connections when topics are created rapidly.",
}
c = rd.compile_define_contract(issue)
assert c["question_type"] == "repo-specific"
assert c["needs_mimo"] is False # ISSUE NEVER invokes a model
assert "OUTWARD" not in c["required_stages"]
def test_architecture_issue_is_mixed():
issue = {
"number": 2,
"title": "Design the memory selection architecture",
"body": "We need to choose the best approach for hybrid recall. Compare alternatives and benchmark them.",
}
c = rd.compile_define_contract(issue)
assert c["question_type"] in ("mixed", "current-tech")
assert "OUTWARD" in c["required_stages"]
# Design indicators → INNOVATION_WARRANTED is credible, so INNOVATION included
assert "INNOVATION" in c["required_stages"]
def test_simple_bug_skips_outward():
issue = {"number": 3, "title": "Fix import error in tui_validator", "body": "The import allowlist is wrong."}
c = rd.compile_define_contract(issue)
assert "OUTWARD" in c.get("skipped_stages", {})
assert "INWARD" in c["required_stages"]
def test_subquestions_extracted():
issue = {
"number": 4,
"title": "Evaluate memory backends",
"body": "Which backend is fastest?\nWhat about memory usage?\nDoes it support concurrent access?",
}
c = rd.compile_define_contract(issue)
assert len(c["sub_questions"]) >= 2
def test_ambiguous_issue_records_signal_not_mimo():
"""Ambiguity is a recorded signal for downstream stages — NOT a model trigger.
ISSUE must never invoke MiMo, even when the issue is ambiguous."""
issue = {"number": 5, "title": "?", "body": ""}
c = rd.compile_define_contract(issue)
assert c["ambiguous"] is True
assert c["needs_mimo"] is False
def test_retired_stage_names_absent_from_contract():
"""Retired stages must not appear in any compiled contract field."""
for body in ("fix bug", "design architecture approach", "compare and benchmark"):
c = rd.compile_define_contract({"number": 9, "title": "t", "body": body})
for field in ("required_stages", "skipped_stages"):
for retired in ("DEFINE", "OUTWARD_DISCOVERY", "OUTWARD_READING"):
assert retired not in c[field], f"{retired} leaked into {field}"