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
|
|
@ -2,6 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from reuse_surface.stats import (
|
||||
collect_roster_stats,
|
||||
collect_stats,
|
||||
|
|
@ -10,19 +12,36 @@ from reuse_surface.stats import (
|
|||
)
|
||||
|
||||
|
||||
def test_collect_stats_on_repo_root():
|
||||
root = Path(__file__).resolve().parent.parent
|
||||
stats = collect_stats(root)
|
||||
@pytest.fixture
|
||||
def stats_repo(tmp_path, monkeypatch):
|
||||
monkeypatch.delenv("REUSE_SURFACE_URL", raising=False)
|
||||
index = tmp_path / "registry/indexes/capabilities.yaml"
|
||||
index.parent.mkdir(parents=True)
|
||||
index.write_text("""version: 1
|
||||
domain: infotech
|
||||
capabilities:
|
||||
- id: capability.example.source
|
||||
vector: D3 / A2 / C2 / R2
|
||||
path: registry/capabilities/source.md
|
||||
- id: capability.example.service
|
||||
vector: D4 / A5 / C3 / R3
|
||||
path: registry/capabilities/service.md
|
||||
""")
|
||||
return tmp_path
|
||||
|
||||
|
||||
def test_collect_stats_on_repo_root(stats_repo):
|
||||
stats = collect_stats(stats_repo)
|
||||
assert stats["capability_count"] == 2
|
||||
assert stats["index_present"] is True
|
||||
assert "discovery" in stats["histograms"]
|
||||
assert stats["histograms"]["discovery"]["D3"] == 1
|
||||
assert stats["histograms"]["discovery"]["D4"] == 1
|
||||
assert stats["reliability"] == {"r0_r2": 1, "r3_plus": 1}
|
||||
|
||||
|
||||
def test_format_stats_markdown_contains_count():
|
||||
root = Path(__file__).resolve().parent.parent
|
||||
text = format_stats_markdown(collect_stats(root))
|
||||
assert "Capabilities:" in text
|
||||
assert "2" in text
|
||||
def test_format_stats_markdown_contains_count(stats_repo):
|
||||
text = format_stats_markdown(collect_stats(stats_repo))
|
||||
assert "**Capabilities:** 2" in text
|
||||
|
||||
|
||||
def test_collect_roster_stats_federation_ready():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue