Fix short-intent discovery and publish verified browser provider guidance
Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a13690-1c84-77a2-aeee-7f517ec60f5d
This commit is contained in:
parent
9042dec5ed
commit
50077c9bea
22 changed files with 736 additions and 87 deletions
|
|
@ -80,6 +80,63 @@ def test_match_query_no_capabilities():
|
|||
assert match_query(query, []) == []
|
||||
|
||||
|
||||
def test_short_browser_intent_outranks_mature_headless_services(monkeypatch):
|
||||
browser = {
|
||||
"id": "capability.infotech.headless-browser",
|
||||
"name": "Headless Browser Automation",
|
||||
"summary": "Playwright Chromium screenshots keyboard " + " ".join(
|
||||
f"detail{i}" for i in range(100)
|
||||
),
|
||||
"vector": "D3 / A2 / C2 / R2",
|
||||
"tags": ["headless", "browser"],
|
||||
}
|
||||
other = {
|
||||
"id": "capability.communication.context-engine",
|
||||
"name": "Context Engine",
|
||||
"summary": "Headless knowledge operations",
|
||||
"vector": "D7 / A7 / C6 / R6",
|
||||
}
|
||||
monkeypatch.setattr(
|
||||
"reuse_surface.plan_check.load_federated_capabilities",
|
||||
lambda: ([other, browser], _recent_date()),
|
||||
)
|
||||
result = run_plan_check(load_query_from_intent("headless browser"), use_llm=False)
|
||||
assert result["verdict"] == "reuse"
|
||||
assert result["matches"][0]["id"] == browser["id"]
|
||||
assert result["matches"][0]["score"] > result["matches"][1]["score"]
|
||||
assert maybe_file_capability_request(
|
||||
result, requesting_domain="infotech", requesting_agent="test"
|
||||
) is None
|
||||
|
||||
# Extra operational documentation must not turn a direct name match into NEW.
|
||||
original_score = result["top_score"]
|
||||
browser["summary"] += " " + " ".join(f"command{i}" for i in range(100))
|
||||
repeated = run_plan_check(load_query_from_intent("headless browser"), use_llm=False)
|
||||
assert repeated["top_score"] == original_score
|
||||
|
||||
|
||||
def test_summary_only_matching_survives_name_scoring():
|
||||
query = load_query_from_intent("responsive screenshots keyboard assertions")
|
||||
matches = match_query(query, [{
|
||||
"id": "capability.infotech.headless-browser",
|
||||
"name": "Browser Automation",
|
||||
"summary": "Responsive screenshots keyboard assertions",
|
||||
}])
|
||||
assert verdict_for_score(matches[0].score) == "reuse"
|
||||
|
||||
|
||||
def test_maturity_still_breaks_equally_relevant_name_ties():
|
||||
candidates = [
|
||||
{"id": "capability.example.early", "name": "Browser Automation",
|
||||
"summary": "Early implementation", "vector": "D2 / A2 / C1 / R1"},
|
||||
{"id": "capability.example.mature", "name": "Browser Automation",
|
||||
"summary": "Documented implementation", "vector": "D4 / A5 / C3 / R3"},
|
||||
]
|
||||
matches = match_query(load_query_from_intent("browser automation"), candidates)
|
||||
assert matches[0].id == "capability.example.mature"
|
||||
assert matches[0].score == matches[1].score
|
||||
|
||||
|
||||
def test_load_query_from_workplan(tmp_path):
|
||||
workplan = tmp_path / "TEST-WP-0001-thing.md"
|
||||
workplan.write_text(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue