Commit Graph

5 Commits

Author SHA1 Message Date
14a60ef77f feat(tanya): Execute engine acceptance criteria and record per-criterion verdicts
Outcome: done
Changed: none
Verified by: make verify -> exit_code 0, "Ran 199 tests in 2.168s OK verification passed" (only pre-existing StarletteDeprecationWarning from fastapi/testclient.py:1, not from the research package)
Findings:
- C1 PASS: grep non-rsearch URLs in research/*.py -> 0 lines; live tests.test_research_integration -> 1 OK, asserts all requested URLs start with https://rsearch.app.molodetz.nl
- C2 PASS: tests.test_research_scheduling -> 22 OK; peak == max_concurrency == 8 and pool bound asserted
- C3 PASS: web/images/describe/chat single _request mechanism + one pipeline tests OK; test_research_client -> 36 OK; engine probe round content_types {web:1,images:1,chat:1}
- C4 PASS: tests.test_research_dedup -> 36 OK; 64 concurrent same-query pushes -> 1 enqueued, 63 skipped; URL+content dedup asserted
- C5 PASS: TestClosureDecision -> 6 OK; ResearchEngine.run("closure probe") with NullClient -> closed=true, total_rounds=1, new_urls=0, new_queries=0, 3 calls
- C6 PASS: ast check over 9 modules -> 0 annotation problems; 21 logger.info + 10 logger.debug calls; 7 modules with logger; retoor header on all 9 files
- C7 PASS: grep TODO|FIXME|placeholder|stub -> 0 hits
- C8 PASS: make verify -> exit 0, "Ran 199 tests in 2.168s OK verification passed", no new warning
- Adversarial: ResearchEngine().run("   \n\t") -> ValueError "research subject must not be empty", no request issued, no hang
Open: none
Confidence: high - all 8 engine acceptance criteria executed with reco

Typosaurus-Run: 4e2afb673c7f4578a12276d9181b982d
Typosaurus-Node: f7f10c648a7d4b7fb65256acdaf7770a
Typosaurus-Agent: @tanya
Refs: #31
2026-08-07 19:39:04 +00:00
bc11dc18b2 test(sveta): Write live integration test against the rsearch API
Outcome: done
Changed: tests/test_research_integration.py:1-70
Verified by: make verify -> exit_code 0, 199 tests OK (1 new integration test), "verification passed"; only pre-existing StarletteDeprecationWarning from fastapi/testclient.py, none introduced; standalone run of tests.test_research_integration -> 1 test OK in 0.386s
Findings:
- Live smoke before writing: GET https://rsearch.app.molodetz.nl/search?query=python+asyncio&count=2&content=true -> 200, success=true, 2 results, first https://docs.python.org/3/library/asyncio.html with 2153-char content, ~1.5s
- TestLiveResearchProbe invokes ResearchPipeline.run() on one bounded web WorkItem ("python asyncio") with cache=true, default_count=2, max_concurrency=2, request_timeout 30s, wrapped in asyncio.wait_for(60s) so a hung run fails rather than blocking the suite; no skip decorator
- First run asserts requests_succeeded>=1, urls_found>=1, contents_seen>=1, and zero client-cache hits; second run on the same RsearchClient asserts cache_hit=True (pipeline.py:151 _probe_cache -> client.py:60 search_cached) and exactly zero additional network requests, proving the cache=true path end-to-end
- Only-rsearch enforcement: config.base_url asserted == https://rsearch.app.molodetz.nl (config.py:12) and every urllib.request.urlopen full_url recorded by a wrapper asserted startswith that base, plus at least one /search contact
- Non-empty result derived from live responses asserted via frontier.snapshot() urls_seen>=1 and content_seen

Typosaurus-Run: 4e2afb673c7f4578a12276d9181b982d
Typosaurus-Node: 101f25665b934f2fb52b11cbe0a4c7e8
Typosaurus-Agent: @sveta
Refs: #31
2026-08-07 19:36:20 +00:00
c0a59b4138 feat(nadia): Build content-type agnostic pipeline with bounded asyncio worker pool
Outcome: done
Changed: src/typosaurus_sandbox/research/pipeline.py:1-280 (new), src/typosaurus_sandbox/research/client.py:30-52,98-99,124-148, src/typosaurus_sandbox/research/__init__.py:21-49
Verified by: make verify -> exit_code 0, compileall OK, 195 tests OK, "verification passed" (pre-existing StarletteDeprecationWarning from tests/test_api.py); live smoke: web/images/chat via one pool (3 ok, urls=19, queries=92, contents=10), repeat web item cache_hit=True, empty query -> RsearchError 400 handled, pool survived
Findings:
- ResearchPipeline uses asyncio.Semaphore(max_concurrency, default 8); pool size logged INFO in run(); run(AsyncIterator[WorkItem]) = bounded queue (pool*4) + pool_size workers with None sentinels; process(item) is the public semaphore-guarded path.
- WorkItem(kind: web|images|describe|chat, value, deep=False, ai=False); web -> search(content=True), images -> search(type="images") without deep/ai, describe -> describe(url), chat -> chat(prompt); endpoints /search,/describe,/chat.
- extract_response() handles SearchResponse (results, ai_response, deep sources/markdown), ChatResponse.response, DescribeResponse.description in one function; apply_extraction() registers URLs, query seeds (title/description/extra/text with origin) and content fingerprints into QueryFrontier.
- client.py additive: _search_params() shared by search() and new search_cached()/describe_cached() probes so pipeline cache_hit is accurate; chat/deep cache hit from envelope fields cache

Typosaurus-Run: 4e2afb673c7f4578a12276d9181b982d
Typosaurus-Node: e85a60edbf7b47f1913d87602b9c553c
Typosaurus-Agent: @nadia
Refs: #31
2026-08-07 19:30:57 +00:00
31f2c6451f feat(nadia): Implement query-variant frontier and URL/content deduplication
Outcome: done
Changed: src/typosaurus_sandbox/research/frontier.py:1-234, src/typosaurus_sandbox/research/__init__.py:14-20,34-36,44-48
Verified by: make verify -> exit_code 0, compileall OK, 104 tests OK, "verification passed"; module smoke test passed (URL normalization, query/URL/content dedup, async get_query, snapshot accounting)
Findings:
- QueryFrontier API: seed, push_query(query, origin), push_variants_from_result (count of new queries from title/description/string extra; does not register URLs), register_url, register_content, register_result (URL+content dedup), get_query/pop_query (count queries_issued), snapshot() frozen DedupStats for closure deltas, origin_of.
- Query dedup key = whitespace-collapsed casefold; URL dedup via normalize_url (lowercase scheme/host, IDNA, strip default port/userinfo/fragment, collapse slashes); content dedup via sha256 of whitespace-normalized text.
- One threading.Lock guards all seen-sets/counters; pending queries in asyncio.Queue usable sync via pop_query and async via get_query.
- Query variant length window 2-200 chars; out-of-window dropped without touching counters.
- frontier.py imports only envelopes.SearchResult from foundation; no new dependency; retoor header, no comments/docstrings.
Open: engine leaf wires QueryFrontier into worker pool and computes per-round snapshot() deltas for closure; testwriter leaf covers frontier API.
Confidence: high - acceptance criteria exercised by smoke assertions; full suite passes via mak

Typosaurus-Run: 4e2afb673c7f4578a12276d9181b982d
Typosaurus-Node: 5e16725c0f944ca0b4373eb640430f7d
Typosaurus-Agent: @nadia
Refs: #31
2026-08-07 19:16:25 +00:00
e00a2db81b feat(nadia): Build research package foundation: config, rsearch-only HTTP client, TTL caches
Outcome: done
Changed: src/typosaurus_sandbox/research/__init__.py:1-28, src/typosaurus_sandbox/research/config.py:1-43, src/typosaurus_sandbox/research/envelopes.py:1-214, src/typosaurus_sandbox/research/cache.py:1-48, src/typosaurus_sandbox/research/client.py:1-196
Verified by: verify() -> "make verify" exit_code 0, compileall OK, 104 tests OK, "verification passed" (pre-existing StarletteDeprecationWarning from fastapi.testclient import in tests/test_api.py, not introduced by this change); live smoke: web/images/ai search, chat with usage, describe GET, describe_raw POST, search-cache hit, content-cache fill+hit all passed; deep envelope parsing validated against captured live response (model, rounds, sources, grades, queries_tried)
Findings:
- RsearchClient: search(query, source, count, content, type, deep, ai, cache), chat(prompt, system, json_mode, cache), describe(url), describe_upload(bytes, filename, mime_type), describe_raw(bytes, mime_type), get_cached_content(url); failures raise RsearchError(message, status_code) with server error text extracted (504 detail, success:false error).
- Caches: search 300s TTL keyed by sorted urlencoded params; content 86400s keyed by result URL; describe 86400s keyed by url:/hash:sha256; threading.Lock guarded; hit/miss logged DEBUG.
- ResearchConfig.load reads the "research" key of .env.json; defaults base_url https://rsearch.app.molodetz.nl, timeout 30s, deep timeout 180s, max_concurrency 8, default_count 10.
- HTTP is stdlib-only

Typosaurus-Run: 4e2afb673c7f4578a12276d9181b982d
Typosaurus-Node: 08bc7408f3ce4d25b13634501bb60a4d
Typosaurus-Agent: @nadia
Refs: #31
2026-08-07 18:48:55 +00:00