CI Pipeline / best-practices (push) Successful in 6s
CI Pipeline / documentation (push) Successful in 7s
CI Pipeline / gitea-offline (push) Successful in 19s
Auto-version and Release / release (push) Successful in 54s
CI Pipeline / type-check (push) Successful in 31s
CI Pipeline / lint (push) Failing after 30s
CI Pipeline / canary (push) Successful in 34s
CI Pipeline / unit-tests (push) Failing after 2m48s
CI Pipeline / required-checks (push) Failing after 1s
CI Pipeline / CI Pipeline / notify-event-bridge (push) Successful in 4s
deploy / deploy (push) Failing after 1m14s
- build_basis.py: durable versioned research basis — depth decision derived from adaptive_router routes (no second router; deviations recorded with justification), OUTWARD prior-art contract, legal dispositions (ADOPT/ADAPT/COMBINE/REJECT/INNOVATE), qualification gate, attachable evidence_ref, structured summary (no private reasoning). - 18D CORRECTION (Nick): THE RESEARCH PLAN ITSELF IS CONTEXTUALLY GENERATED — generate_research_plan synthesizes topics from THIS intent's material unknowns/decisions/risks; NO permanent topic list. Held-outs prove unrelated intents produce materially different plans; the structural-model topics never leak into unrelated research. Principle persisted in SCAFFOLDING_V1_DEFINITION.md. - 18D qualified Build Basis persisted from REAL prior-art research (Backstage/Kythe/SCIP/Nx/Bazel/C4/Glean surveyed; adopt/adapt/ combine/reject/innovate decisions recorded with refs). - structural_model.py: first-class project structural Scaffold over the EXISTING structural_store core (no second graph store, no competing Spine). Backstage relation vocabulary + Kythe edge kinds adopted; stable deterministic IDs (Kythe-adapted: stability PROMISED where Kythe declines); every edge carries evidence_refs+authority+ status (the genuinely-absent innovation); provides-ripple in impact closure (Nx-affected semantics); dynamic consumers stay explicit uncertainty. 7 held-outs. Suite 1938 green; ratchets PASS; Henxels rc=0.
104 lines
4.6 KiB
Python
104 lines
4.6 KiB
Python
"""test_contextual_research_plan.py — T18 §18D CORRECTION: the research
|
|
plan itself is contextually generated. No permanent topic list exists.
|
|
|
|
Held-outs prove UNRELATED requests generate MATERIALLY DIFFERENT plans
|
|
(disjoint topics unless they share genuine unknowns), and that the
|
|
structural-model topics from 18D do NOT leak into unrelated research.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
REPO = Path(__file__).resolve().parent.parent
|
|
sys.path.insert(0, str(REPO / "src"))
|
|
|
|
from rune import build_basis as bb # noqa: E402
|
|
|
|
|
|
def test_18d_unrelated_intents_generate_different_plans():
|
|
"""A structural-model request and an unrelated request must produce
|
|
materially different plans — the 18D architecture-graph topics must
|
|
NOT appear in unrelated research."""
|
|
structural = bb.generate_research_plan(
|
|
intent="design a persistent structural model for project scaffolds",
|
|
target="scaffolding",
|
|
unknowns=["what relationship vocabulary do existing systems use "
|
|
"(Backstage/Kythe)?",
|
|
"what graph interchange format is worth emitting?"],
|
|
decisions=["which store core carries the model?"],
|
|
depth=bb.DEPTH_FULL)
|
|
unrelated = bb.generate_research_plan(
|
|
intent="fix the flaky lease timeout test",
|
|
target="wr-bridge",
|
|
unknowns=["why does the lease watchdog fire before the ack window "
|
|
"closes on the runner?"],
|
|
decisions=[],
|
|
risks=["fix may mask a real timeout race"],
|
|
depth=bb.DEPTH_INWARD)
|
|
structural_topics = " ".join(t["topic"] for t in structural["topics"])
|
|
unrelated_topics = " ".join(t["topic"] for t in unrelated["topics"])
|
|
# the structural plan is about vocabulary/formats; the test-fix plan
|
|
# is about a watchdog race — zero topical overlap
|
|
assert "vocabulary" in structural_topics
|
|
assert "vocabulary" not in unrelated_topics
|
|
assert "watchdog" in unrelated_topics
|
|
assert "watchdog" not in structural_topics
|
|
# and neither plan carries a canned category list
|
|
for plan in (structural, unrelated):
|
|
canned = [t for t in plan["topics"]
|
|
if t["kind"] == "prior-art" and "THIS intent" not in
|
|
t["topic"]]
|
|
# prior-art topic only appears when the unknowns reference
|
|
# existing practice — and even then it names THIS intent
|
|
assert all("THIS intent" in t["topic"]
|
|
for t in plan["topics"] if t["kind"] == "prior-art")
|
|
|
|
|
|
def test_18d_no_unknowns_means_no_research_machinery():
|
|
"""A tiny obvious change with no material unknowns gets depth NONE
|
|
and an EMPTY topic list — no mechanical research ritual."""
|
|
plan = bb.generate_research_plan(intent="fix a typo in the README")
|
|
assert plan["depth"]["depth"] == bb.DEPTH_NONE
|
|
assert plan["topics"] == []
|
|
assert plan["depth"]["why"] # the NONE decision still records WHY
|
|
|
|
|
|
def test_18d_depth_heuristics_record_why():
|
|
plan = bb.generate_research_plan(
|
|
intent="migrate the auth schema",
|
|
unknowns=["which user tables hold credential hashes?"],
|
|
risks=["breaking change to login flow"])
|
|
assert plan["depth"]["depth"] == bb.DEPTH_FULL
|
|
assert "consequence" in plan["depth"]["why"]
|
|
# caller-supplied depth is recorded with accountability
|
|
plan2 = bb.generate_research_plan(intent="x", unknowns=["big unknown"],
|
|
depth=bb.DEPTH_INWARD)
|
|
assert plan2["depth"]["why"].startswith("depth supplied")
|
|
|
|
|
|
def test_18d_prior_art_topic_only_when_contextually_relevant():
|
|
"""Rule E's precedent question attaches when unknowns reference
|
|
existing practice — and is phrased for THIS intent, not a category."""
|
|
plan = bb.generate_research_plan(
|
|
intent="add PDF export to the report generator",
|
|
unknowns=["is there an existing Python PDF library that meets "
|
|
"the fidelity needs?"])
|
|
pa = [t for t in plan["topics"] if t["kind"] == "prior-art"]
|
|
assert len(pa) == 1
|
|
assert "THIS intent" in pa[0]["topic"]
|
|
# but a purely-internal unknown never summons prior-art machinery
|
|
plan2 = bb.generate_research_plan(
|
|
intent="add PDF export to the report generator",
|
|
unknowns=["which code path currently renders report tables?"])
|
|
assert not [t for t in plan2["topics"] if t["kind"] == "prior-art"]
|
|
|
|
|
|
def test_18d_every_topic_carries_why():
|
|
plan = bb.generate_research_plan(
|
|
intent="i", unknowns=["u1", "u2"], decisions=["d1"], risks=["r1"])
|
|
assert len(plan["topics"]) == 4
|
|
for t in plan["topics"]:
|
|
assert t["why"], t
|