diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1016c60..d4885f97 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,6 +40,22 @@ jobs: BRAVE_API_KEY: "" SEMANTIC_SCHOLAR_API_KEY: "" NVD_API_KEY: "" + browser-absence: + name: browser absent degradation contract + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable snapshot 2026-09-28 + with: + toolchain: "1.89" + - name: Run deterministic missing-browser library tests + run: cargo test --locked --features mock --lib browser_absent + - name: Run deterministic missing-browser CLI tests + run: cargo test --locked --features mock --bin eggsearch browser_absent + - name: Run feature-absent CLI error test + run: cargo test --locked --no-default-features --bin eggsearch browser_not_compiled_cli_request_has_stable_code + - name: Run browser launch-failure contract test + run: cargo test --locked --features mock --lib browser_launch_failure_is_named_and_does_not_repeat_http windows-portability: name: windows portability (x86_64-pc-windows-msvc all-features check) runs-on: windows-latest diff --git a/.github/workflows/python-native-qualification.yml b/.github/workflows/python-native-qualification.yml index 43dee791..bf57a780 100644 --- a/.github/workflows/python-native-qualification.yml +++ b/.github/workflows/python-native-qualification.yml @@ -68,6 +68,21 @@ jobs: python -m pip install packaging==26.0 python -m pip install --no-index --no-deps --only-binary=:all: dist/*.whl python -c "from importlib.metadata import distribution; from packaging.utils import parse_wheel_filename; from pathlib import Path; d=distribution('eggsearch'); wheels=list(Path('dist').glob('*.whl')); assert len(wheels) == 1; name, version, build, tags=parse_wheel_filename(wheels[0].name); assert name == 'eggsearch' and str(version) == d.version; assert all(tag.abi == 'abi3' and tag.interpreter == 'cp311' for tag in tags); print(d.metadata['Name'], d.version, d.metadata['Requires-Python']); print(*d.files, sep='\\n')" > dist/metadata.txt + python - <<'PY' + import os + from pathlib import Path + wheels = list(Path("dist").glob("*.whl")) + if len(wheels) != 1: + raise SystemExit(f"expected one wheel, found {len(wheels)}") + wheel = wheels[0] + size = wheel.stat().st_size + line = f"- {wheel.name}: {size} bytes ({size / 1_000_000:.2f} MB)" + print(line) + with open(os.environ["GITHUB_STEP_SUMMARY"], "a", encoding="utf-8") as summary: + summary.write(line + "\n") + if size > 20_000_000: + raise SystemExit(f"{wheel.name} exceeds 20 MB; maintainer review required") + PY sha256sum dist/*.whl | tee dist/SHA256SUMS cat dist/SHA256SUMS >> "$GITHUB_STEP_SUMMARY" - id: upload @@ -140,11 +155,137 @@ jobs: shell: bash working-directory: ${{ runner.temp }} + browser-with-chrome: + name: Verify browser rendering with Chrome + needs: build-wheel + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 + with: + python-version: "3.11" + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 + with: + name: wheel-linux-x86_64 + path: ${{ runner.temp }}/wheelhouse + - uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 + with: + toolchain: 1.89.0 + - name: Install the release wheel in a clean environment + run: | + python -m venv "$RUNNER_TEMP/.venv" + "$RUNNER_TEMP/.venv/bin/python" -m pip install --no-index --no-deps --only-binary=:all: "$RUNNER_TEMP"/wheelhouse/*.whl + "$RUNNER_TEMP/.venv/bin/python" -m pip install pytest==8.4.2 + shell: bash + - name: Assert Chrome discovery in the release wheel + env: + EGGSEARCH_TEST_BROWSER_WITH_CHROME: "1" + run: >- + "$RUNNER_TEMP/.venv/bin/python" -m pytest -q -s + "$GITHUB_WORKSPACE/bindings/python/tests/test_native.py" -k + browser_capability_with_chrome + shell: bash + working-directory: ${{ runner.temp }} + - name: Build and install a mock-only deterministic fixture wheel + run: | + python -m pip install maturin==1.15.0 + maturin build --manifest-path bindings/python/Cargo.toml --release --locked --features eggsearch/mock --out "$RUNNER_TEMP/fixture-wheelhouse" -i python3.11 + python -m venv "$RUNNER_TEMP/fixture-venv" + "$RUNNER_TEMP/fixture-venv/bin/python" -m pip install --no-index --no-deps --only-binary=:all: "$RUNNER_TEMP"/fixture-wheelhouse/*.whl + "$RUNNER_TEMP/fixture-venv/bin/python" -m pip install pytest==8.4.2 + shell: bash + - name: Assert real Chrome renders the deterministic fixture and lifecycle bounds + env: + EGGSEARCH_TEST_BROWSER_WITH_CHROME: "1" + run: >- + "$RUNNER_TEMP/fixture-venv/bin/python" -m pytest -q -s + "$GITHUB_WORKSPACE/bindings/python/tests/test_native.py" -k + "browser_render_with_chrome or browser_idle_and_session_cap_counters_are_visible" + shell: bash + working-directory: ${{ runner.temp }} + + browser-without-chrome: + name: Verify explicit browser absence ${{ matrix.id }} + needs: build-wheel + runs-on: ${{ matrix.runner }} + strategy: + fail-fast: false + matrix: + include: + - { id: linux-x86_64, runner: ubuntu-24.04 } + - { id: linux-aarch64, runner: ubuntu-24.04-arm } + - { id: macos-x86_64, runner: macos-15-intel } + - { id: macos-arm64, runner: macos-15 } + - { id: windows-x86_64, runner: windows-2022 } + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 + with: + python-version: "3.11" + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 + with: + name: wheel-${{ matrix.id }} + path: ${{ runner.temp }}/wheelhouse + - name: Create a clean consumer environment + run: python -m venv "$RUNNER_TEMP/.venv" + shell: bash + - name: Assert deterministic explicit-path absence and unaffected operations + run: | + if [ "$RUNNER_OS" = "Windows" ]; then + python_bin="$(cygpath -u "$RUNNER_TEMP")/.venv/Scripts/python.exe" + else + python_bin="$RUNNER_TEMP/.venv/bin/python" + fi + "$python_bin" -m pip install --no-index --no-deps --only-binary=:all: "$RUNNER_TEMP"/wheelhouse/*.whl + "$python_bin" -m pip install pytest==8.4.2 + "$python_bin" -m pytest -q -s "$GITHUB_WORKSPACE/bindings/python/tests/test_native.py" -k browser_absence_is_explicit_and_http_operations_still_work + shell: bash + working-directory: ${{ runner.temp }} + + browser-auto-discovery-no-chrome: + name: Verify automatic discovery without Chrome + needs: build-wheel + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 + with: + name: wheel-linux-x86_64 + path: ${{ runner.temp }}/wheelhouse + - name: Run installed-wheel contract in a browser-free container + env: + EGGSEARCH_TEST_BROWSER_AUTO_ABSENCE: "1" + run: | + docker run --rm \ + -e EGGSEARCH_TEST_BROWSER_AUTO_ABSENCE \ + -v "$GITHUB_WORKSPACE:/source:ro" \ + -v "$RUNNER_TEMP/wheelhouse:/wheelhouse:ro" \ + python:3.11-slim-bookworm \ + /bin/sh -euxc ' + python -m venv /tmp/eggsearch-venv + /tmp/eggsearch-venv/bin/python -m pip install --no-index --no-deps --only-binary=:all: /wheelhouse/*.whl + /tmp/eggsearch-venv/bin/python -m pip install pytest==8.4.2 + cd /tmp + /tmp/eggsearch-venv/bin/python -m pytest -q -s /source/bindings/python/tests/test_native.py -k browser_absence_is_explicit_and_http_operations_still_work + ' + shell: bash + working-directory: ${{ runner.temp }} + armv7-build: name: Build ARMv7 hard-float wheel runs-on: ubuntu-24.04 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 + with: + toolchain: 1.89.0 + targets: armv7-unknown-linux-gnueabihf + - name: Install ARMv7 C compiler for the binding check + run: sudo apt-get update && sudo apt-get install --no-install-recommends -y gcc-arm-linux-gnueabihf libc6-dev-armhf-cross + - name: Check Python binding for ARMv7 + env: + CC_armv7_unknown_linux_gnueabihf: arm-linux-gnueabihf-gcc + run: RUSTUP_TOOLCHAIN=1.89.0 cargo check --locked --manifest-path bindings/python/Cargo.toml --target armv7-unknown-linux-gnueabihf - uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b with: maturin-version: v1.15.0 @@ -157,8 +298,23 @@ jobs: run: | python -m pip install packaging==26.0 python bindings/python/scripts/audit_armv7_wheel.py dist/*.whl | tee dist/armv7-audit.txt - sha256sum dist/*.whl | tee dist/SHA256SUMS cat dist/armv7-audit.txt >> "$GITHUB_STEP_SUMMARY" + python - <<'PY' + import os + from pathlib import Path + wheels = list(Path("dist").glob("*.whl")) + if len(wheels) != 1: + raise SystemExit(f"expected one ARMv7 wheel, found {len(wheels)}") + wheel = wheels[0] + size = wheel.stat().st_size + line = f"- linux-armv7l: {wheel.name}, {size} bytes ({size / 1_000_000:.2f} MB)" + print(line) + with open(os.environ["GITHUB_STEP_SUMMARY"], "a", encoding="utf-8") as summary: + summary.write(line + "\n") + if size > 20_000_000: + raise SystemExit(f"{wheel.name} exceeds 20 MB; maintainer review required") + PY + sha256sum dist/*.whl | tee dist/SHA256SUMS - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 with: name: wheel-linux-armv7l @@ -229,6 +385,23 @@ jobs: cd "$RUNNER_TEMP" "$RUNNER_TEMP/runtime-venv/bin/python" -m pytest -q "$source_dir/bindings/python/tests" "$RUNNER_TEMP/runtime-venv/bin/python" -c "import tomllib; from pathlib import Path; import eggsearch; from importlib.metadata import distribution; expected=tomllib.loads(Path('$GITHUB_WORKSPACE/bindings/python/pyproject.toml').read_text())['project']['version']; assert len(eggsearch.tool_names()) == 9; assert distribution('eggsearch').version == expected" + python - <<'PY' + import os + from pathlib import Path + workspace = Path(os.environ["GITHUB_WORKSPACE"]) + artifacts = sorted([ + *workspace.joinpath("dist").glob("*.tar.gz"), + *workspace.joinpath("extracted-wheel").glob("*.whl"), + ]) + if not artifacts: + raise SystemExit("no sdist or rebuilt wheel found") + with open(os.environ["GITHUB_STEP_SUMMARY"], "a", encoding="utf-8") as summary: + for artifact in artifacts: + size = artifact.stat().st_size + line = f"- {artifact.name}: {size} bytes ({size / 1_000_000:.2f} MB)" + print(line) + summary.write(line + "\n") + PY sha256sum "$GITHUB_WORKSPACE"/dist/* "$GITHUB_WORKSPACE"/extracted-wheel/* | tee "$GITHUB_WORKSPACE/dist/SHA256SUMS" cat "$GITHUB_WORKSPACE/dist/SHA256SUMS" >> "$GITHUB_STEP_SUMMARY" - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9de23139..5d2062f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Batch fetch budgets now measure each item after its selected response-detail projection, and `payload_chars` / `total_payload_chars` match the returned projected payloads. Web document structure degrades before text clipping or omission, under the existing aggregate cap and envelope-overhead exclusion. +- HTML extraction preserves source whitespace around inline text, links, and code in text and Markdown output. Repeated whitespace still normalizes, but words are not merged and no spaces are invented when absent from the source. + ### Added +- The Python wheel now compiles browser rendering alongside PDF extraction, so a + `pip install eggsearch` consumer gets the same capability as the released + binary. A system Chrome or Chromium is discovered at runtime and is never + bundled. A host without one still installs, imports, searches, and fetches: an + explicit browser request returns `browser_unavailable` naming the cause, and + an automatic one returns the HTTP result with a `browser_unavailable` + warning. + - `web_fetch`, `batch_fetch` web items, the unified `fetch` tool, and CLI `eggsearch fetch` now reach a browser-gated origin for the same reason `web_search` already did. A `429` or `5xx` from such an origin escalates once to the shipped browser render under `render: "auto"` instead of diff --git a/Cargo.lock b/Cargo.lock index f5ea48a9..de628610 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1261,7 +1261,7 @@ dependencies = [ [[package]] name = "eggsearch" -version = "0.4.4" +version = "0.4.5" dependencies = [ "anyhow", "axum", diff --git a/Cargo.toml b/Cargo.toml index 33dc9aa3..e304f449 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "eggsearch" -version = "0.4.4" +version = "0.4.5" edition = "2021" rust-version = "1.89" authors = ["eggstack"] diff --git a/README.md b/README.md index 8e021221..574c4411 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,10 @@ [![License](https://img.shields.io/crates/l/eggsearch.svg)](LICENSE) [![Downloads](https://img.shields.io/crates/d/eggsearch.svg)](https://crates.io/crates/eggsearch) -A lightweight MCP (Model Context Protocol) search and fetch server for AI agents: -live web metasearch with RRF dedup, bounded fetch, and deterministic evidence -bundling, over client-owned stdio or explicit loopback-only Streamable HTTP. +Eggsearch adds live search and bounded source fetching to MCP-compatible AI +clients. It combines public search sources, returns evidence as source cards, and +can package selected material into deterministic evidence bundles. Connect it +over client-owned stdio or run an explicit loopback-only Streamable HTTP server. **No API keys are required for the default installation.** The default install is keyless across web, fetch, advisory, package-registry, and scholarly paths. @@ -52,21 +53,12 @@ eggsearch providers # per-provider enabled / configured / routable ``` ```bash -$ eggsearch search "rust tokio" --max-results 1 -# Results for 'rust tokio' (1 items, 1 failed) - -1. <<>> -Tokio - An asynchronous Rust runtime -<<>> - https://tokio.rs/ - [duckduckgo] - <<>> Tokio is a library for - writing fast, reliable, and easy network applications with Rust. … <<>> - -Failed providers: - - yahoo: engine 'yahoo' returned status 500 (http_status) +eggsearch search "rust tokio" --max-results 3 ``` +Search uses live public sources, so results vary and an individual provider can +fail without making the whole query fail. + ```bash $ eggsearch fetch "https://example.com" --metadata-only # Fetch: https://example.com @@ -84,8 +76,8 @@ Truncated: false Every card carries a content-derived stable ID and an `<<>>` frame: treat fetched text as data, never instructions. Results merge across providers, so one provider failing is reported as a warning rather than failing -the query. One URL per `web_fetch`, `batch_fetch` for explicit fan-out, `--json` -for machine output. +the query. The MCP `fetch` tool accepts one or more explicitly selected web or +repository items. Use `--json` for machine-readable CLI output. Preview client configuration first. Rendering is read-only; `--apply` is opt-in: @@ -133,16 +125,24 @@ for codebases, `security_search` for advisories, `research_search` for compariso `provider_status` is for hosts and troubleshooting, not a first research step. Responses include machine-readable `next_actions`, so keep the working set small and load specialized tools only as needed. `web_search` returns source cards, not -a synthesized answer; read useful sources with `web_fetch`. See [Tool matrix](docs/tool-matrix.md) -and [Agent workflows](docs/agent-workflows.md) for details. +a synthesized answer; read useful sources with `fetch`. See the +[Tool matrix](docs/tool-matrix.md) and [Agent workflows](docs/agent-workflows.md) +for details. ## Safety -- Fetched content is `external_untrusted`: data, not instructions. `sanitize_output` defaults to `true`, with injection markers reported as `injection_hits`. -- Fetch is bounded and explicit: one URL per `web_fetch`, no autonomous crawling, SSRF checks against blocked address ranges. +- Fetched content is `external_untrusted`: data, not instructions. + `sanitize_output` defaults to `true`, with injection markers reported as + `injection_hits`. +- Fetch is bounded and explicit. `fetch` reads only selected web or repository + targets and checks for blocked address ranges. - Current source builds enable PDF extraction and browser rendering by default. Published `v0.4.4` binaries predate that change and include neither feature. - Browser rendering requires an existing Chrome or Chromium installation. + Browser rendering requires an existing Chrome or Chromium installation; when + none is found, browser functionality reports itself unavailable and the rest + of the product keeps working. + The Python wheels are built from the same source and compile both features; + the published `eggsearch==0.4.4` wheel is PDF-only. The opt-in `egress` proxy route is limited to provider upstreams and is excluded from prebuilt binaries. diff --git a/architecture/fetch.md b/architecture/fetch.md index 2ef44826..8aea1b48 100644 --- a/architecture/fetch.md +++ b/architecture/fetch.md @@ -53,29 +53,31 @@ unchanged: Unicode scalar values in top-level `text`, plus `title`, locator and returned URL fields. Repo `document` and `lines` are structural copies of the text and are not counted again in this readable measure. -The aggregate `max_total_chars` budget is enforced against the emitted-payload -measure. For each item, `payload_chars` is the Unicode scalar count of -`serde_json::to_string(&response_value)`, where `response_value` is that item's -`response` JSON value; an unmeasurable response is treated as unfittable and -omitted. It is measured before -`response_detail` projection; `total_payload_chars` sums this measure for emitted -items, while omitted items contribute zero. The budget covers the sum of these -response values, not the complete serialized envelope: item wrappers, the results -array, aggregate counts and telemetry, warnings, addressing fields, and projection -stamps are envelope overhead outside the measure. Compact and standard projections -can remove response fields after measurement, so `payload_chars` and -`total_payload_chars` may conservatively over-count the projected response. - -When a repo response exceeds the remaining budget, preserve requested text by -applying this ladder in order, remeasuring the serialized response after each -step and stopping as soon as it fits: remove `document.blocks` and -`document.chunks` together; remove `document`; remove `lines`; then clip top-level -`text`. Never clip text while one of those structural fields remains. Each removed -field is listed in `degraded_fields`; structural drops made by the budget do not -set `truncated`, which continues to mean text was clipped. Web responses retain their existing -title/description/links trimming and text clipping, with the final fit decided by -`payload_chars`. An item that still cannot fit is omitted under M036's contract: -`ok: false`, `response: null`, `chars_returned: 0`, a budget error, and a warning. +The aggregate `max_total_chars` budget is enforced against each item’s selected +response-detail projection. `payload_chars` is the Unicode scalar count of +`serde_json::to_string(&response_value)`, where `response_value` is the item’s +`response` after the same per-item projection used by the final output. Diagnostic +keeps the full response; standard, compact, and brief use their respective item +projections. `total_payload_chars` sums the projected payloads returned, with +omitted items contributing zero. Counters are refreshed after the final envelope +projection so brief-mode trimming and omitted results are reflected exactly. +The budget covers the sum of these response values, not the complete serialized +envelope: item wrappers, the results array, aggregate counts and telemetry, +warnings, addressing fields, and projection stamps are overhead outside the +measure. + +When an item exceeds the remaining budget, preserve requested text by applying +the same structural ladder to fields present in its selected projection: +remove `document.blocks` and `document.chunks` together; remove `document`; +remove `lines`; then, for web items, trim `links` from the end, remove +`description`, and remove `title`; finally clip top-level `text`. Remeasure the +projected response after each step and stop as soon as it fits. Compact and brief +projections may remove optional fields before budgeting; those presentation +choices are not budget drops and are not listed in `degraded_fields`. Never clip +text while removable returned structure or web metadata remains. Budget-driven +structural drops do not set `truncated`, which continues to mean text was clipped. +An item that still cannot fit is omitted under M036's contract: `ok: false`, +`response: null`, `chars_returned: 0`, a budget error, and a warning. Each degraded item emits one `batch_payload_budget_degraded` legacy warning naming the sanitized item label, comma-separated dropped-field markers, measured @@ -381,6 +383,10 @@ text/markdown`. budget lasts, code blocks snap to a newline when past the halfway point, and stale outline entries are pruned. `text` vs `markdown` modes differ only in the final projection plus inline `` `code` `` / `[text](url)` collection. +- Inline collection preserves source whitespace boundaries around inline text, + links, and code in both text and Markdown modes. Final normalization collapses + repeated whitespace without joining adjacent words or inventing separators; + raw code-block whitespace is unchanged. Non-HTML bodies dispatch on `detect.rs`: notebooks, CSV, XML/RST/AsciiDoc, Markdown sources, diffs, line-preserving code, or plain paragraphs. Code/diff @@ -528,19 +534,44 @@ DNS/refused/unreachable→Connection, TLS/protocol/other→Other). Headless Chrome/Chromium over CDP. The `browser` feature is in the default set, so the capability is compiled into default binaries and `[fetch.browser].policy` -defaults to `auto`; HTTP remains the hot path and rendering is escalation. +defaults to `auto`; HTTP remains the hot path and rendering is escalation. A +system Chrome/Chromium executable is a runtime dependency and is never bundled. +Its absence does not block process startup, search, or HTTP-only fetch. An explicit `render = "browser"` or `browser_profile` request reports the stable codes `browser_not_compiled_in` (feature absent), `browser_disabled` (`enabled = false`), and `browser_unavailable` (no discovered executable) -instead of silently performing an HTTP fetch. The tool-level codes are the -agent contract; the fetch-layer error variants of the same names remain reserved -for direct library use. `RenderPolicy::Auto` never errors: -when escalation was warranted but unavailable, the call returns the HTTP document -with the `browser_unavailable` structured warning and `browser_escalated: false`. +instead of silently performing an HTTP fetch. For `browser_unavailable`, the +structured tool error carries the discovery or launch cause in its message. The +tool-level codes are the agent contract; the fetch-layer error variants of the +same names remain reserved for direct library use. `RenderPolicy::Auto` never +errors: when escalation was warranted but unavailable, the call returns the HTTP +document with the `browser_unavailable` structured warning and +`browser_escalated: false`; no warning is added when rendering is not warranted. Escalation is triggered by wall-shaped `2xx` content or by a browser-gated status (`429` or `5xx`); § Browser challenge completion states the status seam, the return rule, and the retry interaction. +### No-Chrome seam audit + +| Entry point | Outcome with no discovered browser | +|---|---| +| CLI `mcp serve` / Python import and client initialization | Startup and import do not require a usable browser and continue normally. | +| CLI `search` / MCP `web_search` | Search remains available through providers that do not need browser rendering; a missing browser does not disable search. | +| CLI `fetch` | HTTP-only fetch returns normally. `auto` returns the HTTP document with `browser_unavailable` when a wall warrants rendering; a configured explicit `browser` policy fails with `browser_unavailable` and the discovery reason. | +| MCP `web_fetch`, `batch_fetch`, unified `fetch` web items | `auto` keeps HTTP content and adds a `browser_unavailable` structured warning only when escalation is warranted. Explicit browser requests return a structured `browser_unavailable` error with the discovery or launch cause; disabled and uncompiled cases retain `browser_disabled` and `browser_not_compiled_in`. | +| MCP `provider_status` | `browser_capabilities` retains its existing fields and reports `usable: false` with a discovery reason. | +| CLI `doctor` | Does not probe Chrome; ordinary diagnostics remain available. | +| CLI `browser_login` | Creates the requested profile metadata and reports that Chrome was not discovered; it does not require a browser process to start. | +| CLI `browser_profiles` | List/remove remain local profile-store operations. Inspect reports browser compatibility only when a browser is discovered. | +| Python `AsyncEggsearch` | Delegates canonical calls through the native execution bridge; explicit browser failures raise `EggsearchError` with the same `code` and cause message. | + +The CI `browser-absence` job configures a deterministic nonexistent executable, so its +contract tests do not depend on whether the hosted image happens to contain Chrome. A launch error +after successful discovery is reported as `browser_unavailable` for explicit rendering, or as the +original HTTP response plus a reasoned warning for `auto`. The browser launch retains `--no-sandbox` +for container runtimes; remaining launch diagnostics name the underlying failure and never trigger +an extra HTTP request. + | File | Responsibility | |------|---------------| | `mod.rs` | Module declarations + re-exports | @@ -560,7 +591,9 @@ return rule, and the retry interaction. anything else → `ExplicitPathInvalid { path }`. No auto-discovery fallback. - Otherwise probe Linux well-known paths, macOS bundles (`~` expanded), then `PATH` binaries. Each candidate must exist, be a file, and survive a - 5 s `--version` probe. Nothing found → `NotFound`. + 5 s `--version` probe. Nothing found → `NotFound`. The exact candidate order + and the `[fetch.browser].executable` escape hatch are documented in + [Configuration](../docs/config.md#executable-discovery-and-override). ### Lifecycle: ephemeral vs persistent diff --git a/architecture/maintenance.md b/architecture/maintenance.md index 1b819ef2..c0cee377 100644 --- a/architecture/maintenance.md +++ b/architecture/maintenance.md @@ -231,7 +231,7 @@ Unit tests for private functions live at the bottom of the source file. Preserve - Dispatch and advisory semantics: `capability_dispatch_preserves_partial_roles`, `no_rq_label_role_derivation_in_dispatch`, `no_first_only_intended_roles_conversion`, `no_silent_if_let_ok_around_native_advisory`, `native_advisory_outcomes_are_provider_scoped_and_error_visible`, `no_single_native_advisory_operations_constant`, `native_operation_budget_has_reserve_methods`, `record_package_outcomes_emits_two_attempts_per_provider`. - Retrieval state shape: `retrieval_dimension_state_has_all_variants`, `validate_attempt_ledger_is_public`, `summarize_retrieval_with_attempts_is_public`, `dimension_status_has_state_field`, `response_summary_has_dimension_count_fields`. - Decomposition and overlap: `orchestration_module_size_ratchet`, `decomposed_dispatch_layout`, `decomposed_dependency_layout`, `evidence_bundle_owns_packaging_not_ranking`, `canonical_helpers_have_single_owner`, `suggested_fetch_group_helpers_stay_typed`, `workflows_consume_shared_primitives`, `compatibility_dead_code_inventory`. -- Dependency and transport policy: `no_direct_reqwest_in_production_source`, `eggfetch_feature_budget_stays_bounded`, `tokio_feature_policy_stays_explicit`, `timeout_overrides_retain_the_shared_fetch_client`, `fetch_timeout_paths_use_effective_limits_for_request_and_validation`, `html_scrape_engines_use_automatic_decompression`. +- Dependency and transport policy: `no_direct_reqwest_in_production_source`, `eggfetch_feature_budget_stays_bounded`, `tokio_feature_policy_stays_explicit`, `timeout_overrides_retain_the_shared_fetch_client`, `fetch_timeout_paths_use_effective_limits_for_request_and_validation`, `html_scrape_engines_use_automatic_decompression`, `default_features_ship_pdf_and_browser`. - Egress scope: `egress_route_stays_out_of_dynamic_fetch`, `egress_route_stays_out_of_loopback_paths`, `egress_route_stays_out_of_browser_paths`, `egress_feature_budget_stays_bounded`. - Smoke discipline: `no_process_exit_in_native_smoke_tests`, `no_fallback_mode_in_native_smoke`, `postprocess_called_with_workflow_model_for_non_web_tools`. diff --git a/architecture/python-library.md b/architecture/python-library.md index 1997467c..fc3f9f39 100644 --- a/architecture/python-library.md +++ b/architecture/python-library.md @@ -52,12 +52,32 @@ The Python package lives in an independent `bindings/python` Cargo package. PyO3 and Python packaging dependencies must not enter the root crate's default dependency graph or change its binary artifact inventory. Python import is side-effect-free. The binding owns Python types and lifecycle -adaptation; all execution delegates through `src/sdk.rs`. The PyO3 layer -initializes one process-scoped Tokio runtime on first operation, caps shared -in-flight calls at 32, and bounds JSON conversion to 1 MiB, 64 levels, and -10,000 values. `aclose()` rejects new work, cancels active operations, and -waits for their Rust futures to drop; Python task cancellation drops its -corresponding future. The runtime intentionally remains process-scoped. +adaptation; all execution delegates through `src/sdk.rs`. The binding compiles +`pdf` and `browser` with default features disabled; this is the single feature +set used across Python wheel targets, and `egress` is not compiled. The browser +feature uses a system Chrome/Chromium executable at runtime and never bundles +one. Missing Chrome does not block installation, import, process startup, +search, or HTTP fetch. For a missing executable, explicit browser requests +raise `EggsearchError` with `code == "browser_unavailable"` and the cause in +`message`; `auto` retains the HTTP outcome and adds a structured +`browser_unavailable` warning only when rendering is warranted. Its availability +and degradation contract is documented in [architecture/fetch.md](fetch.md). + +In the browser-enabled binding graph, `reqwest` appears only through +`chromiumoxide`; there are no `openssl` or `native-tls` nodes. The tracked +`bindings/python/Cargo.lock` is a release input and must be kept in sync with +the binding manifest for locked builds. + +Python import is side-effect-free. The PyO3 layer initializes one +process-scoped Tokio runtime on first operation, caps shared in-flight calls at +32, and bounds JSON conversion to 1 MiB, 64 levels, and 10,000 values. +`aclose()` rejects new work, cancels active operations, waits for their Rust +futures to drop, then releases that client's `EggsearchClient` handle. The +process-scoped runtime remains alive after client close. The binding records the +client and runtime process IDs and rejects mismatched state with +`forked_process` instead of reusing it after fork; Python task cancellation +drops its corresponding future. The runtime intentionally remains +process-scoped. `AsyncEggsearch()` preserves no-arg `AppConfig::default()` semantics. `AsyncEggsearch.from_default_config()` and `default_config_path()` use diff --git a/bindings/python/Cargo.lock b/bindings/python/Cargo.lock index 7e7da1e0..553c8fb9 100644 --- a/bindings/python/Cargo.lock +++ b/bindings/python/Cargo.lock @@ -150,6 +150,23 @@ dependencies = [ "syn 3.0.3", ] +[[package]] +name = "async-tungstenite" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acc405d38be14342132609f06f02acaf825ddccfe76c4824a69281e0458ebd4" +dependencies = [ + "atomic-waker", + "futures-core", + "futures-io", + "futures-task", + "futures-util", + "log", + "pin-project-lite", + "tokio", + "tungstenite", +] + [[package]] name = "atomic-waker" version = "1.1.2" @@ -340,6 +357,70 @@ dependencies = [ "rand_core 0.10.1", ] +[[package]] +name = "chromiumoxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26ed067eb6c1f660bdb87c05efb964421d2ca262bae0296cdfe38cf0cd949a3e" +dependencies = [ + "async-tungstenite", + "base64 0.22.1", + "chromiumoxide_cdp", + "chromiumoxide_types", + "dunce", + "fnv", + "futures", + "futures-timer", + "pin-project-lite", + "reqwest", + "serde", + "serde_json", + "thiserror 2.0.20", + "tokio", + "tracing", + "url", + "which", + "windows-registry", +] + +[[package]] +name = "chromiumoxide_cdp" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68a6a03a7ebac4ea85308f285d6959a3e6b2ce32a0c9465dc7a7b1db0144eec7" +dependencies = [ + "chromiumoxide_pdl", + "chromiumoxide_types", + "serde", + "serde_json", +] + +[[package]] +name = "chromiumoxide_pdl" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c602dea92337bc4d824668d78c5b79c3b4ddb29b40dd7218282bbe8fd3fc2091" +dependencies = [ + "chromiumoxide_types", + "either", + "heck", + "once_cell", + "proc-macro2", + "quote", + "regex", + "serde_json", +] + +[[package]] +name = "chromiumoxide_types" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678d5146e74f16fc4a41978b275af572cd913de1f10270d2b93b6c276bc57d80" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "chrono" version = "0.4.45" @@ -547,6 +628,12 @@ dependencies = [ "syn 3.0.3", ] +[[package]] +name = "data-encoding" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06" + [[package]] name = "derive_more" version = "0.99.20" @@ -627,6 +714,12 @@ dependencies = [ "dtoa", ] +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "dyn-clone" version = "1.0.20" @@ -677,11 +770,12 @@ dependencies = [ [[package]] name = "eggsearch" -version = "0.4.4" +version = "0.4.5" dependencies = [ "anyhow", "axum", "base64 0.22.1", + "chromiumoxide", "chrono", "clap", "dirs", @@ -721,7 +815,7 @@ dependencies = [ [[package]] name = "eggsearch-python" -version = "0.4.4" +version = "0.4.5" dependencies = [ "eggsearch", "futures", @@ -738,6 +832,12 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12a0bb14ac04a9fcf170d0bbbef949b44cc492f4452bd20c095636956f653642" +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" + [[package]] name = "encoding_rs" version = "0.8.44" @@ -803,6 +903,12 @@ dependencies = [ "zlib-rs", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "foldhash" version = "0.2.0" @@ -899,6 +1005,12 @@ version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" +[[package]] +name = "futures-timer" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af43fadb8a98512d547e37b4e92e0ced13e205c061b87b4623eff01d918d6968" + [[package]] name = "futures-util" version = "0.3.34" @@ -1125,13 +1237,16 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" dependencies = [ + "base64 0.22.1", "bytes", "futures-channel", "futures-util", "http", "http-body", "hyper", + "ipnet", "libc", + "percent-encoding", "pin-project-lite", "socket2", "tokio", @@ -1295,6 +1410,12 @@ dependencies = [ "generic-array", ] +[[package]] +name = "ipnet" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" + [[package]] name = "is_terminal_polyfill" version = "1.70.2" @@ -1896,10 +2017,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22f6172bdec972074665ed81ed53b71da00bfc44b65a753cfde883ec4c702a1a" dependencies = [ "libc", - "rand_chacha", + "rand_chacha 0.3.1", "rand_core 0.6.4", ] +[[package]] +name = "rand" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + [[package]] name = "rand" version = "0.10.2" @@ -1921,6 +2052,16 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -1930,6 +2071,15 @@ dependencies = [ "getrandom 0.2.17", ] +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + [[package]] name = "rand_core" version = "0.10.1" @@ -2011,6 +2161,35 @@ version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" +[[package]] +name = "reqwest" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16a1cfa75cc186dd73d5818e510e042e40927bccc9c236b061cea97e1eb08029" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "ring" version = "0.17.14" @@ -2307,6 +2486,17 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "sha1" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest 0.10.7", +] + [[package]] name = "sha2" version = "0.10.9" @@ -2504,6 +2694,9 @@ name = "sync_wrapper" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] [[package]] name = "synstructure" @@ -2729,6 +2922,24 @@ dependencies = [ "tower-service", ] +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + [[package]] name = "tower-layer" version = "0.3.3" @@ -2814,6 +3025,23 @@ version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" +[[package]] +name = "tungstenite" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8628dcc84e5a09eb3d8423d6cb682965dea9133204e8fb3efee74c2a0c259442" +dependencies = [ + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand 0.9.5", + "sha1", + "thiserror 2.0.20", + "utf-8", +] + [[package]] name = "typenum" version = "1.20.1" @@ -2968,6 +3196,16 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b7777d5cc23d0e91404e53ce2d5e8ec7acae3026b16233dba62cd3246457950" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.127" @@ -3000,6 +3238,16 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "web-sys" +version = "0.3.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c435338968042f4f59a557f690a253676d47ce13ceb55d70100e7facf6620a30" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "webpki-roots" version = "0.26.11" @@ -3024,6 +3272,15 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" +[[package]] +name = "which" +version = "8.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bae2f2b2b816647a1cab1acc91f5bd20812d53cb344382635ec2181940c8034f" +dependencies = [ + "libc", +] + [[package]] name = "widestring" version = "1.2.1" @@ -3113,6 +3370,17 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link", + "windows-result", + "windows-strings", +] + [[package]] name = "windows-result" version = "0.4.1" diff --git a/bindings/python/Cargo.toml b/bindings/python/Cargo.toml index 0125c2f7..2fd21796 100644 --- a/bindings/python/Cargo.toml +++ b/bindings/python/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "eggsearch-python" -version = "0.4.4" +version = "0.4.5" edition = "2021" rust-version = "1.89" publish = false @@ -13,7 +13,7 @@ name = "_native" crate-type = ["cdylib"] [dependencies] -eggsearch = { path = "../..", version = "=0.4.4", default-features = false, features = ["pdf"] } +eggsearch = { path = "../..", version = "=0.4.5", default-features = false, features = ["pdf", "browser"] } futures = "0.3" pyo3 = { version = "=0.30.1", features = ["abi3-py311", "extension-module", "macros"] } pyo3-async-runtimes = { version = "=0.30.0", features = ["tokio-runtime"] } diff --git a/bindings/python/PYTHON_README.md b/bindings/python/PYTHON_README.md index 4e8302c7..6f51baf7 100644 --- a/bindings/python/PYTHON_README.md +++ b/bindings/python/PYTHON_README.md @@ -134,7 +134,9 @@ hydrate specialists on demand. See [Tool matrix](docs/tool-matrix.md) and - Fetched content is `external_untrusted`: data, not instructions. `sanitize_output` defaults to `true`, with injection markers reported as `injection_hits`. - Fetch is bounded and explicit: one URL per `web_fetch`, no autonomous crawling, SSRF checks against blocked address ranges. -- Optional `pdf` and `browser` features add PDF extraction and bounded headless Chrome. The `egress` proxy route is provider-upstream only and is excluded from prebuilt binaries. +- Wheels built from current source compile `pdf` and `browser`, matching the CLI binaries built from the same source. Browser rendering uses system Chrome/Chromium at runtime; no browser is bundled. +- Without Chrome/Chromium, installation, import, process startup, search, and HTTP fetch remain available. `auto` retains the HTTP outcome and emits a structured `browser_unavailable` warning only when rendering is warranted; an explicit browser request returns a structured `browser_unavailable` error whose message names the discovery or launch cause. Python callers receive `EggsearchError.code` and `EggsearchError.message`. See [Browser Rendering](docs/features.md#browser-rendering). +- The `egress` proxy route is provider-upstream only and is excluded from prebuilt binaries. See [Safety](docs/safety.md) and [Threat model](docs/threat-model.md). diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index 019f9d14..285d7baf 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "eggsearch" -version = "0.4.4" +version = "0.4.5" description = "Native asyncio bindings for the Eggsearch evidence engine" requires-python = ">=3.11,<3.16" license = "MIT" diff --git a/bindings/python/python/eggsearch/__init__.py b/bindings/python/python/eggsearch/__init__.py index 8d4ef2d6..1265b8b4 100644 --- a/bindings/python/python/eggsearch/__init__.py +++ b/bindings/python/python/eggsearch/__init__.py @@ -64,6 +64,9 @@ async def __aexit__(self, exc_type: Any, exc: Any, traceback: Any) -> None: async def aclose(self) -> None: await self._native.aclose() + async def close(self) -> None: + await self.aclose() + async def execute(self, tool: str, arguments: dict[str, Any]) -> dict[str, Any]: return await self._native.execute(tool, arguments) diff --git a/bindings/python/src/lib.rs b/bindings/python/src/lib.rs index 20d39ee5..446e2ad3 100644 --- a/bindings/python/src/lib.rs +++ b/bindings/python/src/lib.rs @@ -22,7 +22,35 @@ const MAX_IN_FLIGHT: usize = 32; create_exception!(_native, EggsearchError, pyo3::exceptions::PyException); +fn client_closed_error() -> SdkError { + SdkError { + code: "client_closed".into(), + message: "Eggsearch client is closed".into(), + repair: None, + data: None, + } +} + +fn ensure_process(py: Python<'_>, client_pid: Option) -> PyResult<()> { + let current_pid = std::process::id(); + if client_pid.is_some_and(|pid| pid != current_pid) + || PROCESS_OWNER.get().is_some_and(|pid| *pid != current_pid) + { + return Err(sdk_error( + py, + SdkError { + code: "forked_process".into(), + message: "Eggsearch Python state cannot be reused after fork; create a fresh process and client".into(), + repair: None, + data: None, + }, + )); + } + Ok(()) +} + static RUNTIME_INIT: OnceLock<()> = OnceLock::new(); +static PROCESS_OWNER: OnceLock = OnceLock::new(); static IN_FLIGHT: LazyLock> = LazyLock::new(|| Arc::new(Semaphore::new(MAX_IN_FLIGHT))); #[cfg(debug_assertions)] @@ -61,6 +89,7 @@ impl Drop for GateDropGuard { } fn initialize_runtime() { + PROCESS_OWNER.get_or_init(std::process::id); RUNTIME_INIT.get_or_init(|| { let mut builder = tokio::runtime::Builder::new_multi_thread(); builder @@ -78,10 +107,13 @@ struct Lifecycle { } struct ClientState { - client: EggsearchClient, + client: Mutex>, + tool_contracts: Value, + process_id: u32, lifecycle: Mutex, cancelled: CancellationToken, drained: Notify, + close_completion: tokio::sync::OnceCell<()>, } impl ClientState { @@ -114,6 +146,30 @@ impl ClientState { self.cancelled.cancel(); } + fn client(&self) -> Result { + self.client + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner) + .as_ref() + .cloned() + .ok_or_else(client_closed_error) + } + + async fn release_client(&self) { + self.close_completion + .get_or_init(|| async { + let client = self + .client + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner) + .take(); + if let Some(client) = client { + client.close().await; + } + }) + .await; + } + async fn wait_drained(&self) { loop { let notified = self.drained.notified(); @@ -161,11 +217,15 @@ fn build_state(config: AppConfig) -> PyResult> { let client = EggsearchClient::new(config).map_err(|error| { PyValueError::new_err(format!("invalid Eggsearch configuration: {error}")) })?; + let tool_contracts = client.tool_contracts(); Ok(Arc::new(ClientState { - client, + client: Mutex::new(Some(client)), + tool_contracts, + process_id: std::process::id(), lifecycle: Mutex::new(Lifecycle::default()), cancelled: CancellationToken::new(), drained: Notify::new(), + close_completion: tokio::sync::OnceCell::new(), })) } @@ -178,7 +238,8 @@ fn load_config_from_path(path: &PathBuf) -> PyResult { impl PyAsyncEggsearch { #[new] #[pyo3(signature = (config_path=None))] - fn new(config_path: Option) -> PyResult { + fn new(py: Python<'_>, config_path: Option) -> PyResult { + ensure_process(py, None)?; let config = match config_path { Some(path) => load_config_from_path(&path)?, None => AppConfig::default(), @@ -196,7 +257,8 @@ impl PyAsyncEggsearch { } #[staticmethod] - fn from_default_config() -> PyResult { + fn from_default_config(py: Python<'_>) -> PyResult { + ensure_process(py, None)?; let path = eggsearch::core::config::default_config_path(); let config = load_config_from_path(&path)?; Ok(Self { @@ -210,6 +272,7 @@ impl PyAsyncEggsearch { tool: String, arguments: &Bound<'py, PyAny>, ) -> PyResult> { + ensure_process(py, Some(self.state.process_id))?; initialize_runtime(); let active_call = self .state @@ -227,6 +290,7 @@ impl PyAsyncEggsearch { }, ) })?; + let client = self.state.client().map_err(|error| sdk_error(py, error))?; let state = self.state.clone(); pyo3_async_runtimes::tokio::future_into_py(py, async move { let _active_call = active_call; @@ -239,7 +303,7 @@ impl PyAsyncEggsearch { repair: None, data: None, }), - result = state.client.execute(tool, arguments) => result, + result = client.execute(tool, arguments) => result, } }) .catch_unwind() @@ -252,6 +316,9 @@ impl PyAsyncEggsearch { data: None, }) }); + drop(client); + drop(_permit); + drop(_active_call); Python::attach(|py| match result { Ok(value) => json_to_python(py, &value).map(Bound::unbind), Err(error) => Err(sdk_error(py, error)), @@ -260,18 +327,20 @@ impl PyAsyncEggsearch { } fn aclose<'py>(&self, py: Python<'py>) -> PyResult> { + ensure_process(py, Some(self.state.process_id))?; initialize_runtime(); self.state.close(); let state = self.state.clone(); pyo3_async_runtimes::tokio::future_into_py(py, async move { state.wait_drained().await; + state.release_client().await; Python::attach(|py| Ok(py.None())) }) } fn tool_contracts(&self, py: Python<'_>) -> PyResult> { - let contracts = self.state.client.tool_contracts(); - json_to_python(py, &contracts).map(Bound::unbind) + ensure_process(py, Some(self.state.process_id))?; + json_to_python(py, &self.state.tool_contracts).map(Bound::unbind) } #[cfg(debug_assertions)] @@ -310,6 +379,7 @@ impl PyAsyncEggsearch { #[cfg(debug_assertions)] fn _test_blocking_execute<'py>(&self, py: Python<'py>) -> PyResult> { + ensure_process(py, Some(self.state.process_id))?; initialize_runtime(); let active_call = self .state diff --git a/bindings/python/tests/test_native.py b/bindings/python/tests/test_native.py index ec4f7384..65e98520 100644 --- a/bindings/python/tests/test_native.py +++ b/bindings/python/tests/test_native.py @@ -1,8 +1,14 @@ import asyncio +import http.server import json import math import os +import select +import signal +import threading +import time import typing +from contextlib import contextmanager import pytest @@ -59,6 +65,71 @@ def _write_config(path, text): path.write_text(text, encoding="utf-8") +def _write_browser_config( + path, + executable=None, + max_requests=100, + idle_timeout_ms=5000, + fetch_timeout_ms=8000, + startup_timeout_ms=10_000, +): + workspace = path.parent / "workspace" + workspace.mkdir(parents=True, exist_ok=True) + (workspace / "README.md").write_text( + "offline-browser-marker local retrieval fixture", encoding="utf-8" + ) + executable_line = ( + f"executable = {json.dumps(str(executable))}\n" + if executable is not None + else "" + ) + _write_config( + path, + "[search]\nmode = 'off'\ndefault_max_results = 10\nmax_results_cap = 50\n" + "max_query_chars = 512\ntimeout_ms = 8000\ndefault_providers = ['duckduckgo']\n" + "sanitize_output = true\n[search.providers]\nduckduckgo = true\n\n" + f"[fetch]\nenabled = true\ntimeout_ms = {fetch_timeout_ms}\nmax_bytes = 2000000\n" + "max_chars_default = 12000\nmax_chars_cap = 50000\nredirect_limit = 5\n" + "allow_private_network = false\nallow_localhost = true\nsanitize_output = true\n\n" + "[fetch.browser]\nenabled = true\npolicy = 'auto'\n" + f"{executable_line}max_requests = {max_requests}\n" + f"idle_timeout_ms = {idle_timeout_ms}\n" + f"startup_timeout_ms = {startup_timeout_ms}\n\n" + f"[local]\nenabled = true\nroots = [{json.dumps(str(workspace))}]\n", + ) + return path + + +@contextmanager +def _local_page(): + class Handler(http.server.BaseHTTPRequestHandler): + def do_GET(self): + body = ( + b"local test" + b"

http-only-marker

" + ) + self.send_response(200) + self.send_header("Content-Type", "text/html; charset=utf-8") + self.send_header("Content-Length", str(len(body))) + self.end_headers() + self.wfile.write(body) + + def log_message(self, format, *args): + return + + server = http.server.ThreadingHTTPServer(("127.0.0.1", 0), Handler) + thread = threading.Thread(target=server.serve_forever, daemon=True) + thread.start() + try: + yield f"http://127.0.0.1:{server.server_port}/fixture" + finally: + server.shutdown() + thread.join(timeout=3) + server.server_close() + + def _mojeek_enabled(status): providers = status.get("providers", status) if isinstance(providers, dict): @@ -426,6 +497,242 @@ async def run(): asyncio.run(run()) +def test_browser_absence_is_explicit_and_http_operations_still_work(tmp_path): + auto_discovery_absence = os.environ.get("EGGSEARCH_TEST_BROWSER_AUTO_ABSENCE") == "1" + missing_executable = None if auto_discovery_absence else tmp_path / "missing-chrome" + config = _write_browser_config( + tmp_path / "absent-browser.toml", executable=missing_executable + ) + + with _local_page() as url: + async def run(): + client = AsyncEggsearch(str(config)) + try: + status = await client.provider_status(probe=False) + capabilities = status["browser_capabilities"] + assert capabilities["compiled"] is True + assert capabilities["configured"] is True + assert capabilities["discovered"] is False + assert capabilities["usable"] is False + if auto_discovery_absence: + assert "no Chrome/Chromium executable was found" in capabilities["reason"] + else: + assert "invalid" in capabilities["reason"] + assert str(missing_executable) in capabilities["reason"] + lifecycle = capabilities["lifecycle"] + assert { + "resident", + "session_launches", + "renders", + "idle_teardowns", + "session_cap_teardowns", + } <= set(lifecycle) + print("browser_capabilities=" + json.dumps(capabilities, sort_keys=True)) + + with pytest.raises(EggsearchError) as unavailable: + await client.web_fetch(url=url, render="browser") + assert unavailable.value.code == "capability_unavailable" + assert unavailable.value.data["code"] == "browser_unavailable" + assert "executable" in unavailable.value.data["message"] + + fetched = await client.fetch( + items={"type": "web", "url": url, "render": "http_only"} + ) + assert isinstance(fetched, dict) + assert "http-only-marker" in json.dumps(fetched) + + searched = await client.repo_search( + query="offline-browser-marker", include_local=True + ) + cards = [ + card + for group in searched.get("groups", []) + for card in group.get("results", []) + ] + assert any( + "offline-browser-marker" in (card.get("snippet") or "") + for card in cards + ) + finally: + await client.aclose() + await client.aclose() + + with pytest.raises(EggsearchError) as closed: + await client.provider_status(probe=False) + assert closed.value.code == "client_closed" + + with pytest.raises(EggsearchError) as closed_browser: + await client.web_fetch(url=url, render="browser") + assert closed_browser.value.code == "client_closed" + + asyncio.run(run()) + + +@contextmanager +def _browser_render_fixture_page(): + yield "https://93.184.216.34/eggsearch-browser-render-fixture" + + +@pytest.mark.skipif( + os.environ.get("EGGSEARCH_TEST_BROWSER_WITH_CHROME") != "1", + reason="real Chrome qualification is enabled only in its CI lane", +) +def test_browser_capability_with_chrome(tmp_path): + config = _write_browser_config(tmp_path / "available-browser.toml") + + async def run(): + client = AsyncEggsearch(str(config)) + try: + capabilities = (await client.provider_status(probe=False))["browser_capabilities"] + assert capabilities["compiled"] is True + assert capabilities["configured"] is True + assert capabilities["discovered"] is True + assert capabilities["usable"] is True + finally: + await client.close() + + asyncio.run(run()) + + +@pytest.mark.skipif( + os.environ.get("EGGSEARCH_TEST_BROWSER_WITH_CHROME") != "1", + reason="real Chrome qualification is enabled only in its CI lane", +) +def test_browser_render_with_chrome(tmp_path): + config = _write_browser_config( + tmp_path / "available-browser.toml", + fetch_timeout_ms=60_000, + startup_timeout_ms=45_000, + ) + + with _browser_render_fixture_page() as url: + async def run(): + client = AsyncEggsearch(str(config)) + try: + before = await client.provider_status(probe=False) + capabilities = before["browser_capabilities"] + assert capabilities["compiled"] is True + assert capabilities["configured"] is True + assert capabilities["discovered"] is True + assert capabilities["usable"] is True + print("browser_capabilities=" + json.dumps(capabilities, sort_keys=True)) + + rendered = await asyncio.wait_for( + client.web_fetch(url=url, render="browser"), timeout=75 + ) + assert isinstance(rendered, dict) + assert "browser-render-marker" in json.dumps(rendered) + + after = await client.provider_status(probe=False) + lifecycle = after["browser_capabilities"]["lifecycle"] + assert lifecycle["renders"] == 1 + assert lifecycle["session_launches"] == 1 + print("browser_capabilities=" + json.dumps(after["browser_capabilities"], sort_keys=True)) + finally: + await client.close() + + asyncio.run(run()) + + +@pytest.mark.skipif( + os.environ.get("EGGSEARCH_TEST_BROWSER_WITH_CHROME") != "1", + reason="real Chrome qualification is enabled only in its CI lane", +) +def test_browser_idle_and_session_cap_counters_are_visible(tmp_path): + config_cap = _write_browser_config( + tmp_path / "session-cap.toml", + max_requests=1, + fetch_timeout_ms=60_000, + startup_timeout_ms=45_000, + ) + config_idle = _write_browser_config( + tmp_path / "idle-teardown.toml", + idle_timeout_ms=5000, + fetch_timeout_ms=60_000, + startup_timeout_ms=45_000, + ) + + with _browser_render_fixture_page() as url: + async def run(): + cap_client = AsyncEggsearch(str(config_cap)) + try: + await asyncio.wait_for( + cap_client.web_fetch(url=url, render="browser"), timeout=75 + ) + capped = await cap_client.provider_status(probe=False) + counters = capped["browser_capabilities"]["lifecycle"] + assert counters["session_cap_teardowns"] == 1 + assert counters["idle_teardowns"] == 0 + assert counters["resident"] is False + finally: + await cap_client.close() + + idle_client = AsyncEggsearch(str(config_idle)) + try: + await asyncio.wait_for( + idle_client.web_fetch(url=url, render="browser"), timeout=75 + ) + deadline = time.monotonic() + 12 + idle = await idle_client.provider_status(probe=False) + while ( + idle["browser_capabilities"]["lifecycle"]["idle_teardowns"] == 0 + and time.monotonic() < deadline + ): + await asyncio.sleep(0.2) + idle = await idle_client.provider_status(probe=False) + counters = idle["browser_capabilities"]["lifecycle"] + assert counters["idle_teardowns"] == 1 + assert counters["session_cap_teardowns"] == 0 + assert counters["resident"] is False + print("browser_lifecycle_counters=" + json.dumps(counters, sort_keys=True)) + finally: + await idle_client.close() + + asyncio.run(run()) + + +def test_forked_child_rejects_inherited_runtime_and_client(config_path): + if not hasattr(os, "fork"): + pytest.skip("fork is unavailable on this platform") + + async def initialize(): + client = AsyncEggsearch(str(config_path)) + await client.provider_status(probe=False) + return client + + client = asyncio.run(initialize()) + read_fd, write_fd = os.pipe() + child = os.fork() + if child == 0: + os.close(read_fd) + try: + asyncio.run(client.provider_status(probe=False)) + result = {"code": None} + except EggsearchError as error: + result = {"code": error.code, "message": error.message} + except BaseException as error: + result = {"code": "unexpected", "message": str(error)} + try: + os.write(write_fd, json.dumps(result).encode("utf-8")) + finally: + os._exit(0) + + os.close(write_fd) + try: + readable, _, _ = select.select([read_fd], [], [], 10) + if not readable: + os.kill(child, signal.SIGKILL) + os.waitpid(child, 0) + pytest.fail("forked child did not return a structured error") + result = json.loads(os.read(read_fd, 4096)) + os.waitpid(child, 0) + assert result["code"] == "forked_process" + assert "after fork" in result["message"] + finally: + os.close(read_fd) + asyncio.run(client.aclose()) + + def test_mode_off_repo_search_returns_local_trusted_results(config_path, tmp_path): workspace = tmp_path / "workspace" workspace.mkdir() diff --git a/docs/agent-workflows.md b/docs/agent-workflows.md index 709b5dcd..42f2f0c0 100644 --- a/docs/agent-workflows.md +++ b/docs/agent-workflows.md @@ -4,9 +4,10 @@ Recommended tool call sequences for common agent tasks. Start with the task-appropriate search primitive. Call `provider_status` only when provider availability itself is relevant or troubleshooting is required; hosts may inspect it during bootstrap. It is diagnostic, not a normal first research step. Pass `probe: true` for a bounded live liveness check (same core service as `eggsearch doctor --probe`); `recipe_detail` defaults to `summary`. -`web_fetch` also supports `extract_mode = "metadata_only"` when you only need page metadata and do not need the body text. +A web item in `fetch` supports `extract_mode = "metadata_only"` when you need +page metadata without the body text. -`web_search` supports exact constraints: `date_range` (`{"start": "2024-01-01", "end": "2024-01-31"}`, mutually exclusive with `freshness`), `include_domains`/`exclude_domains` (e.g. `["docs.rs"]`, natively enforced by Exa/Tavily when selected and locally enforced otherwise), and `language`/`region` (e.g. `"en"`, `"US"`, natively enforced by Brave API and Tavily when representable). Pass `excerpt_count` (1-3) when short source passages help triage, and `web_fetch` with `focus` (or one focused `batch_fetch` for several candidates) to read only the query-relevant chunks of the selected pages. +`web_search` supports exact constraints: `date_range` (`{"start": "2024-01-01", "end": "2024-01-31"}`, mutually exclusive with `freshness`), `include_domains`/`exclude_domains` (e.g. `["docs.rs"]`, natively enforced by Exa/Tavily when selected and locally enforced otherwise), and `language`/`region` (e.g. `"en"`, `"US"`, natively enforced by Brave API and Tavily when representable). Pass `excerpt_count` (1-3) when short source passages help triage. Use `fetch` with tagged web items and `focus` to read selected pages, or pass several selected items in one bounded call. All search/fetch tools except `provider_status` accept optional `response_detail`: `compact`, `standard`, `brief`, or `diagnostic`. When omitted, full schema mode defaults to `diagnostic` and compact schema mode defaults to `brief`. Use `compact` for ordinary turns, `standard` for specialist research or security work, and `diagnostic` for troubleshooting. `build_evidence_bundle` returns the same canonical content in all modes. @@ -74,7 +75,7 @@ All search/fetch tools except `provider_status` accept optional `response_detail "sources": ["docs", "issues", "pull_requests"] } -// Follow up with web_fetch on the issue/PR URL from suggested_fetches +// Follow up with fetch on the issue/PR URL from suggested_fetches // to read the full thread; excerpts alone never authorize code changes. ``` @@ -98,7 +99,7 @@ All search/fetch tools except `provider_status` accept optional `response_detail "excerpt_count": 2 } -// Follow up with web_fetch on the selected URL from suggested_fetches +// Follow up with fetch on the selected URL from suggested_fetches // to read the full page; excerpts alone never authorize conclusions. ``` @@ -152,7 +153,7 @@ more than latency. "excerpt_count": 2 } -// Follow up with web_fetch on the selected URL from suggested_fetches +// Follow up with fetch on the selected URL from suggested_fetches // to read the full page; excerpts alone never authorize conclusions. ``` @@ -160,6 +161,7 @@ more than latency. ```jsonc // Step 1: Search for vulnerabilities +// `dependency_files` is optional and requires paths under configured local roots. { "query": "axum", "ecosystem": "crates.io", @@ -171,7 +173,7 @@ more than latency. } // Step 2: Fetch a specific advisory -// web_fetch on the advisory URL from suggested_fetches +// fetch on the advisory URL from suggested_fetches ``` ## 4. Research Architecture Decision @@ -388,7 +390,7 @@ Search responses include an `evidence_role_summary` field with per-role counts a 4. **Start with the task-appropriate search primitive**: call `provider_status` only when provider availability itself is relevant or troubleshooting is required 5. **Use suggested_fetches**: they are ranked by deterministic scoring, not random 6. **Respect trust markers**: all external content is `external_untrusted` -7. **One URL per web_fetch**: never batch-fetch without using batch_fetch tool; prefer one focused `batch_fetch` over serial `web_fetch` calls when candidates share safety prerequisites +7. **Fetch selected targets only**: use tagged web items with `fetch` for bounded fan-out; do not automatically follow every suggested link. 8. **Use evidence bundles for handoff**: don't summarize, bundle the raw evidence See [threat-model.md](threat-model.md) for the full threat model, including safe/unsafe usage patterns and configuration escape-hatch risks. diff --git a/docs/config.md b/docs/config.md index 372b57e4..4243e36d 100644 --- a/docs/config.md +++ b/docs/config.md @@ -10,41 +10,9 @@ location: If no config file is found, built-in defaults apply. -## Minimal Default - -```toml eggsearch-config -[search] -mode = "live" -default_max_results = 10 -max_results_cap = 50 -max_query_chars = 512 -timeout_ms = 8000 -default_providers = ["duckduckgo", "brave", "yahoo"] -sanitize_output = true -cache_ttl_seconds = 300 -cache_max_entries = 128 - -[search.providers] -duckduckgo = true -brave = true -startpage = true -yahoo = true - -[fetch] -enabled = true -timeout_ms = 8000 -max_bytes = 2000000 -max_chars_default = 12000 -max_chars_cap = 50000 -redirect_limit = 5 -allow_private_network = false -allow_localhost = false -sanitize_output = true - -[local] -enabled = false -roots = [] -``` +Most users can leave the config file absent and use the built-in defaults. If +you want a complete starter file, see [Keyless Default](#keyless-default) +below. The following sections describe optional settings and advanced controls. ## MCP Tool Schema Profile @@ -836,17 +804,21 @@ When enabled, local results use `local_trusted` trust labels and can be surfaced ## Browser Rendering -The `[fetch.browser]` section configures headless Chrome/Chromium rendering. -Current source builds enable the `browser` Cargo feature by default; published -`v0.4.4` binaries do not include it. `enabled` follows the compiled-in feature -state, and `policy` defaults to `auto`. Rendering requires an installed -Chrome/Chromium. Eggsearch never downloads or installs a browser. +The `[fetch.browser]` section configures headless Chrome/Chromium rendering. The +`browser` feature is compiled into every artifact built from current source, +including the next CLI release and the next Python wheel; the published `v0.4.4` +binaries predate it. A system Chrome/Chromium executable is a runtime dependency +only and is never bundled. Its absence does not break installation, process +startup, search, or an HTTP fetch; browser requests follow the degradation +contract below. +`enabled` defaults to the compiled-in feature state, and `policy` defaults to +`auto`. | Setting | Default | Description | |---------|---------|-------------| -| `enabled` | `true` when compiled | Enables browser rendering. The feature is included by default in current source builds, but not in published `v0.4.4` binaries. | +| `enabled` | `true` when compiled | Enables browser rendering; the `browser` feature is compiled in by default in current source builds. | | `policy` | `"auto"` | Render policy used when the caller omits `render`: `http_only`, `auto`, or `browser`. A per-call `render` overrides it. | -| `executable` | auto-discovered | Path to Chrome/Chromium executable. An explicitly configured invalid path fails instead of falling back to auto-discovery. | +| `executable` | auto-discovered | Optional path to a Chrome/Chromium executable; an invalid explicit path stops discovery rather than falling back. | | `startup_timeout_ms` | `10000` | Browser startup timeout | | `navigation_timeout_ms` | `20000` | Page navigation timeout | | `post_load_wait_ms` | `1500` | Wait after page load | @@ -858,6 +830,52 @@ Chrome/Chromium. Eggsearch never downloads or installs a browser. | `per_origin_concurrency` | `1` | Per-origin browser render cap (combined with `origin_browser_concurrency` via `min`) | | `block_media` | `true` | Block media autoplay | +### Executable Discovery and Override + +A non-empty `[fetch.browser].executable` path is checked first. If the configured +path is invalid, discovery stops and does not fall back to automatic discovery. +Use this setting as an escape hatch when Chrome/Chromium is installed outside +the automatic candidates: + +```toml +[fetch.browser] +executable = "/usr/bin/google-chrome" +``` + +Without an explicit path, discovery checks these candidates in order: + +1. Linux absolute candidates: `/usr/bin/google-chrome-stable`, + `/usr/bin/google-chrome`, `/usr/bin/chromium`, + `/usr/bin/chromium-browser`, `/snap/bin/chromium`. +2. macOS app-bundle candidates: `/Applications/Google Chrome.app/Contents/MacOS/Google Chrome`, + `~/Applications/Google Chrome.app/Contents/MacOS/Google Chrome`, and + `/Applications/Chromium.app/Contents/MacOS/Chromium`. +3. `PATH` lookup, in order: `google-chrome-stable`, `google-chrome`, + `chromium`, `chromium-browser`. + +### Availability and Degradation + +The following table is normative for explicit browser requests and implicit +(`auto`) requests: + +| Condition | Explicit browser request | Implicit (`auto`) request | +|---|---|---| +| Feature not compiled | `browser_not_compiled_in` | HTTP outcome plus a `browser_unavailable` warning only if rendering was warranted | +| `enabled = false` | `browser_disabled` | HTTP outcome plus a `browser_unavailable` warning only if rendering was warranted | +| Enabled, no executable found | Structured `browser_unavailable` error with the discovery reason | HTTP outcome plus a `browser_unavailable` warning with the discovery reason only if rendering was warranted | +| Enabled, unrecognized Chrome/Chromium version output | Structured `browser_unavailable` error naming the output | HTTP outcome plus a `browser_unavailable` warning with the discovery reason only if rendering was warranted | +| Enabled, explicit path invalid | Structured `browser_unavailable` error naming the path; no fallback to auto-discovery | HTTP outcome plus a `browser_unavailable` warning only if rendering was warranted | +| Enabled and discovered but the launch fails | Structured `browser_unavailable`-class failure naming the launch error, never a silent HTTP fetch | Original HTTP outcome plus a `browser_unavailable` warning with the launch cause only if rendering was warranted | + +The explicit tool error carries `data.code = "browser_unavailable"` and a +`data.message` naming the discovery, version, path, or launch cause. In `auto`, +HTTP remains the outcome when rendering is unavailable; no warning is added when +rendering was not warranted. + +`provider_status.browser_capabilities` always reports `compiled`, `configured` +`discovered`, `usable`, `reason`, and the lifecycle counters, in every one of +those states. + ### Persistent Browser Profiles The `[fetch.browser.persistent_profiles]` section configures named, origin-scoped persistent browser profiles. diff --git a/docs/deployment.md b/docs/deployment.md index 6ded3100..f18bf9ae 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -21,10 +21,10 @@ address and this release rejects every non-loopback address, including `http://127.0.0.1:11320/mcp`. The HTTP transport uses rmcp 3.2.0's Streamable HTTP implementation and keeps -the same server identity, ten tools, schemas, validation, and tool behavior as -stdio. Legacy clients can use the initialize/initialized session flow. Current -MCP clients can use the stateless discovery/request-metadata flow supported by -rmcp. +the same server identity, nine advertised tools, schemas, validation, and +tool behavior as stdio. Legacy clients can use the initialize/initialized +session flow. Current clients can use rmcp's stateless discovery and +request-metadata flow. The listener applies loopback Host and local Origin validation. MCP POST bodies are capped at 1 MiB, request headers are bounded, and requests have a @@ -39,7 +39,7 @@ fetch, provider, and sanitization limits. { "service": "eggsearch", "status": "ready", - "version": "0.3.8", + "version": "0.4.4", "protocol": "streamable-http" } ``` diff --git a/docs/features.md b/docs/features.md index b1b4e569..7c863ee0 100644 --- a/docs/features.md +++ b/docs/features.md @@ -1,6 +1,6 @@ # Capabilities and Optional Features -eggsearch provides keyless web, fetch, advisory, registry, and scholarly paths by default. Current source builds also enable PDF extraction and browser rendering by default. The published `v0.4.4` binaries predate that change and include neither feature. Other optional capabilities require Cargo features or config changes. +eggsearch provides keyless web, fetch, advisory, registry, and scholarly paths by default. Current source builds enable PDF extraction and browser rendering by default, and the next release carries both into the CLI binaries and the Python wheels. The published `v0.4.4` binaries predate that change and include neither feature; the published `eggsearch==0.4.4` wheel is PDF-only. A system Chrome/Chromium executable is a runtime dependency for browser rendering only; no browser is bundled. Other optional capabilities require Cargo features or config changes. ## Knowledge delta @@ -23,26 +23,33 @@ configuration. ### Unified fetch budget -`fetch` keeps two distinct measures. `chars_returned` is the readable-text -measure: Unicode scalar values in the returned `text` plus bounded visible -metadata; a repo item is not charged twice for its structural `document`/`lines` -copy of the same text. `payload_chars` is the serialized character count of the -item's response value before `response_detail` projection, and -`total_payload_chars` sums it across emitted items; both are additive telemetry, -and projection may remove fields after measurement, so they conservatively -over-count a compact response. - -The aggregate `max_total_chars` budget is enforced against that emitted payload. -Before any text is clipped, a repo item drops optional structure in order: -`document.blocks`/`document.chunks`, then `document`, then `lines`. Each removed -field is listed in `degraded_fields` and produces one -`batch_payload_budget_degraded` warning; a structural drop does not set -`truncated`, which continues to mean text was clipped. Only when no droppable -structure remains is `text` clipped, and an item that still cannot fit its -locator and metadata is a failed item (`ok: false`, `response: null`, -`chars_returned: 0`) with an attributable `batch_total_budget_exhausted` error -and warning. A repo item missing `owner`, `repo`, or `path` fails before -dispatch with an error that names the field and the accepted shape. +`fetch` keeps two distinct measures. `chars_returned` is the M036 readable-text +measure: Unicode scalar values in `text` plus bounded visible metadata; a repo +item is not charged twice for structural `document`/`lines` copies. `payload_chars` +is the serialized character count of the response after the selected +`response_detail` projection; `total_payload_chars` is the exact sum across +returned item responses. Both are additive telemetry and the aggregate budget +uses that same projected payload. + +The aggregate `max_total_chars` budget caps the sum of projected item response +payloads, not the full MCP envelope (item wrappers, aggregate counts, warnings, +addressing keys, and projection stamps are excluded). Optional returned structure +is removed before text clipping for both web and repo items: `document.blocks`/ +`document.chunks`, `document`, then `lines`; web items then trim links and remove +description/title. Budget drops appear in `degraded_fields` and produce one +`batch_payload_budget_degraded` warning; structural drops do not set `truncated`, +which continues to mean text was clipped. An item that cannot fit is a failed +item (`ok: false`, `response: null`, `chars_returned: 0`) with an attributable +`batch_total_budget_exhausted` error and warning. A repo item missing `owner`, +`repo`, or `path` fails before dispatch with an error naming the field and +accepted shape. + +### Inline HTML whitespace fidelity + +HTML extraction retains source whitespace at inline text, link, and code +boundaries before normalization in both text and Markdown modes. Repeated +whitespace collapses, but adjacent words are not merged and no separator is +invented where the source contains none. Raw code-block whitespace is unchanged. ### Local search admission and scope @@ -87,10 +94,11 @@ returned vulnerability carries severity. ## PDF Extraction -`web_fetch` extracts PDF text when the binary includes the `pdf` Cargo feature -and `[fetch].pdf_enabled` is true. Current source builds enable this feature by -default. Published `v0.4.4` binaries do not include it. The config value defaults -to the compiled-in feature state. +A web item sent to canonical `fetch` extracts PDF text when the binary includes +the `pdf` Cargo feature and `[fetch].pdf_enabled` is true. Current source builds +enable this feature by default; the published `v0.4.4` binaries do not include it, +while the published `eggsearch==0.4.4` wheel does. The config value defaults to +the compiled-in feature state. ### Enabling @@ -109,9 +117,12 @@ defaults to `false`; add the feature back explicitly: cargo build --no-default-features --features pdf ``` -The published Python wheel enables `pdf` only -(`default-features = false, features = ["pdf"]`), so it carries PDF extraction and -no browser rendering. See the [Python library guide](python-library.md). +The Python extension builds with `default-features = false` and +`features = ["pdf", "browser"]`. Every Python wheel target uses this one +feature set; there is no browser/no-browser wheel variant, and `egress` is not +compiled. A wheel built from current source includes both PDF extraction and +browser rendering. The published `eggsearch==0.4.4` wheel remains PDF-only. See +the [Python library guide](python-library.md). ### Capabilities @@ -125,10 +136,10 @@ no browser rendering. See the [Python library guide](python-library.md). ### Page Selection -The `pages` field on `web_fetch` and each `batch_fetch` web item supports `1`, -`1,3,5`, `1-5`, and `1,3,7-10` syntax (one-indexed). Batch items validate -syntax before fetching; page numbers beyond the fetched document fail only that -item. Non-PDF URLs and `metadata_only` follow the same behavior as `web_fetch`. +A web item's `pdf.pages` option supports `1`, `1,3,5`, `1-5`, and `1,3,7-10` +syntax (one-indexed). Multi-item fetches validate syntax before fetching; page +numbers beyond the fetched document fail only that item. Non-PDF URLs and +`metadata_only` use the ordinary fetch behavior. An explicitly named PDF under an enabled `[local]` root is also extracted by `fetch` with a repo item whose `host` is `"workspace"`. Detection uses a case-insensitive `.pdf` @@ -197,7 +208,7 @@ enabled = false - Solves the methods the engine set actually encounters: Anubis `fast`, `slow` (an alias of `fast`), `preact`, `metarefresh`, and WASM `sha256`, plus ALTCHA `PBKDF2/SHA-256` (Mojeek); `argon2id` and `hashx` stay unsupported - Search engines share the solver in `src/meta/challenge/`; fetch-path detect/solve/replay is owned by `src/challenge_replay/` -- With solving on (the default), `web_fetch`, `batch_fetch`, unified `fetch` web/repo items, and CLI `eggsearch fetch` attempt a bounded solve for a published Anubis or ALTCHA challenge +- With solving enabled (the default), web items sent to canonical `fetch`, its direct-call `web_fetch` and `batch_fetch` aliases, and CLI `eggsearch fetch` attempt a bounded solve for a published Anubis or ALTCHA challenge - A fetch-path ALTCHA solve takes its challenge document and its verification endpoint from the page's own `altcha-widget` publication, same-origin only; a cross-origin, scheme-changing, or malformed publication is refused before any request is issued - A fetch-path pass cookie is reused for a later fetch to the same origin, from a process-local cache keyed by origin. The window is the upstream-published lifetime clamped by `cookie_ttl_seconds`; a fetch that crossed an origin stores nothing and reuses nothing - A pair set the upstream refuses is evicted, and the same call then solves the challenge it was already holding and replays once with the freshly issued pair set, so a stale pair set costs no second fetch. A transport error or a non-2xx status is not a refusal: the stored pair set is kept and no solve is attempted @@ -234,13 +245,14 @@ naming the bound, not an empty result. A solved page that fails to parse is ## Browser Rendering -Headless Chrome/Chromium rendering supports JavaScript-heavy pages that ordinary HTTP fetching cannot render. Current source builds include the `browser` Cargo feature by default, but published `v0.4.4` binaries do not. Rendering uses a Chrome or Chromium executable already installed on the host. +Headless Chrome/Chromium rendering supports JavaScript-heavy pages that ordinary HTTP fetching cannot render. The `browser` feature is compiled into the default artifact set built from current source, including the CLI and the single Python wheel feature set; the published `v0.4.4` binaries predate it. Chrome/Chromium is an external runtime dependency and is never bundled. Its absence does not prevent installation, process startup, search, or HTTP fetching; only requests that need rendering are degraded. ### Enabling -In current source builds, `[fetch.browser].enabled` defaults to the compiled-in -feature state, so no config is required. To enable rendering in a build that -includes the feature but has disabled it in config: +In builds from current source, `[fetch.browser].enabled` defaults to `true` +because the feature is compiled in, so no config is required. +To enable rendering in a build that includes the feature but has disabled it in +config: ```toml [fetch.browser] @@ -266,15 +278,16 @@ downloads, installs, or manages one. with HTTP 429 and Yahoo answers a headless client with HTTP 500 and no body. When `[fetch.browser].enabled` is true and a Chrome or Chromium executable was discovered, both engines fall back to one bounded render of their result page and parse the rendered DOM; without a browser -they report the HTTP failure unchanged. The fallback costs a render per search (a few seconds) and -is bounded by the request deadline. A wall that needs a person — an interactive CAPTCHA — is never -attempted and is reported instead. +they report the HTTP outcome and, when rendering was warranted, a +`browser_unavailable` warning with the capability reason. The fallback costs a +render per search (a few seconds) and is bounded by the request deadline. +Interactive CAPTCHAs are never attempted and are reported instead. ### Render Policy -The `render` parameter on `web_fetch` controls transport selection. When the -caller omits it, the configured `[fetch.browser].policy` applies; a per-call -`render` overrides the configured policy. +For a web item sent to canonical `fetch`, `render` controls transport selection. +When the caller omits it, the configured `[fetch.browser].policy` applies; an +item-level `render` overrides the configured policy. | Value | Behavior | |-------|----------| @@ -283,27 +296,35 @@ caller omits it, the configured `[fetch.browser].policy` applies; a per-call | `browser` | Browser directly, no HTTP prefetch. Fails if no Chrome/Chromium executable is available | `auto` does not escalate for authentication or rate-limited responses. If browser -rendering finds an interactive challenge, `web_fetch` returns a manual-interaction -error; it never clicks or simulates it. A non-interactive script wall is completed by +rendering finds an interactive challenge, it reports a manual-interaction error; +eggsearch never clicks or simulates it. A non-interactive script wall is completed by letting the page's own script run, and the render polls the live classification for up to `verification_wait_ms`. A wall that still has not resolved is returned marked as a challenge page rather than as a document. -### Error Outcomes +### Availability and Degradation -An explicit `render = "browser"` or `browser_profile` request reports a stable -code rather than silently downgrading to HTTP: +The table is normative for explicit browser requests and implicit (`auto`) +requests. A request that does not require rendering continues on its HTTP path. -| Code | Condition | -|------|-----------| -| `browser_not_compiled_in` | The binary was built without the `browser` feature | -| `browser_disabled` | The feature is compiled but `[fetch.browser].enabled = false` | -| `browser_unavailable` | Enabled, but no Chrome/Chromium executable was discovered | +| Condition | Explicit browser request | Implicit (`auto`) request | +|---|---|---| +| Feature not compiled | `browser_not_compiled_in` | HTTP outcome plus a `browser_unavailable` warning only if rendering was warranted | +| `enabled = false` | `browser_disabled` | HTTP outcome plus a `browser_unavailable` warning only if rendering was warranted | +| Enabled, no executable found | Structured `browser_unavailable` error with the discovery reason | HTTP outcome plus a `browser_unavailable` warning with the discovery reason only if rendering was warranted | +| Enabled, unrecognized Chrome/Chromium version output | Structured `browser_unavailable` error naming the output | HTTP outcome plus a `browser_unavailable` warning with the discovery reason only if rendering was warranted | +| Enabled, explicit path invalid | Structured `browser_unavailable` error naming the path; no fallback to auto-discovery | HTTP outcome plus a `browser_unavailable` warning only if rendering was warranted | +| Enabled and discovered but the launch fails | Structured `browser_unavailable`-class failure naming the launch error, never a silent HTTP fetch | Original HTTP outcome plus a `browser_unavailable` warning with the launch cause only if rendering was warranted | -When auto escalation is unavailable, the HTTP response is returned with the -structured warning `browser_unavailable` and `browser_escalated: false`. If the -browser detects an interactive challenge, the call returns a manual-interaction -error instead. +The explicit tool error carries `data.code = "browser_unavailable"` and a +`data.message` naming the discovery, version, path, or launch cause. In `auto`, +HTTP remains the outcome when rendering is unavailable; no warning is added when +rendering was not warranted. + +`provider_status.browser_capabilities` always reports `compiled`, `configured`, +`discovered`, `usable`, `reason`, and the lifecycle counters, in every one of +those states. If the browser detects an interactive challenge, the call returns +a manual-interaction error instead. Auto mode also escalates when the origin answers the HTTP attempt with a browser-gated status: `429`, or a `5xx` such as Yahoo's empty `500` to a client @@ -312,8 +333,8 @@ when the render ended on a `2xx`/`3xx` page or completed a recognised wall; a `5xx` page the browser only re-rendered keeps the original `http_status` error, with the attempted escalation named in the message. Under auto a gated status is not retried, because a retry meets the same wall. A `401`, `402`, `403`, or -`404` never renders. The same rule covers `web_fetch`, every `fetch` web item, -and CLI `eggsearch fetch`. +`404` never renders. This rule covers web items sent to `fetch`, direct-call +compatibility aliases, and CLI `eggsearch fetch`. ### Safety Properties @@ -346,8 +367,8 @@ Fresh raw cache entries can satisfy a new extraction mode, link setting, charact ### Viewport Screenshots -`web_fetch` and each `batch_fetch` web item accept the opt-in `include_screenshot` -boolean. When true, eggsearch forces browser rendering and captures the current +A web item sent to `fetch` accepts the opt-in `include_screenshot` boolean. When +true, eggsearch forces browser rendering and captures the current viewport as PNG after page extraction. The browser must be enabled and an installed Chrome/Chromium executable must be available; capability failures are explicit, with no HTTP-only fallback. An explicit `render = "http_only"` conflicts with @@ -357,9 +378,8 @@ configured render policy. The screenshot is delivered as native MCP image content, separate from the unchanged structured JSON response. It is limited to 1280×720 pixels and 4 MiB. Recognized PDF responses are not captured; repository and workspace items do not -support screenshots. Screenshot requests bypass cache reads and writes. In -`batch_fetch`, each image is associated with its original zero-based item index -and label, in input order; any batch containing a screenshot request runs +support screenshots. Screenshot requests bypass cache reads and writes. In a multi-item `fetch`, each image is associated with its original zero-based +item index and label, in input order. A request containing a screenshot runs synchronously rather than as a deferred task. ### Configuration Reference @@ -411,10 +431,11 @@ eggsearch browser-profiles remove my-portal ### Using a Profile -Once established, use it in `web_fetch`: +Once established, select it on a web item sent to canonical `fetch`: ```json { + "type": "web", "url": "https://example.com/dashboard", "browser_profile": "my-portal" } diff --git a/docs/installation.md b/docs/installation.md index 01ca840d..683904e3 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -64,9 +64,9 @@ The pinned installer requests assets from the exact `vX.Y.Z` release. The unpinned form uses `releases/latest/download` for convenience. For configuring Eggsearch as a local stdio server in LM Studio, see -[LM Studio integration](lm-studio.md). The compact profile requires an -executable built with that feature; older published versions use the full -profile. +[LM Studio integration](lm-studio.md). Compact schema settings require an +executable version that supports `[mcp].schema_profile`; use the full profile +with older executables. ## Release targets @@ -130,19 +130,8 @@ exact matching GitHub Release asset, with the same target names and checksum contract documented above. See [Self-update](update.md) for verification, Cargo fallback, permission, and lifecycle behavior. -## Fleet one-liners +## Client setup -Binary-only installation is the default. -Add `--service` only when the host should run the persistent loopback endpoint: - -```bash -curl -fsSL https://github.com/eggstack/eggsearch/releases/latest/download/install.sh | bash -curl -fsSL https://github.com/eggstack/eggsearch/releases/latest/download/install.sh | bash -s -- --service -``` - -After installation, print or apply a client registration explicitly: - -```bash -eggsearch integrate codegg --apply -eggsearch integrate codex --apply -``` +Use [MCP integrations](integrations.md) to preview or apply a client +registration. Add `--service` during installation only when the host should run +a persistent loopback endpoint; see [Managed service](service.md). diff --git a/docs/integrations.md b/docs/integrations.md index 9aee3a8c..4b057c4f 100644 --- a/docs/integrations.md +++ b/docs/integrations.md @@ -34,8 +34,9 @@ eggsearch integrate codegg --transport http --apply ``` The HTTP form selects the eggsearch search backend and adds CodeGG's normal -remote `mcp.eggsearch` entry at `http://127.0.0.1:11320/mcp`. CodeGG still -requires `web_search` and `web_fetch`; its provider diagnostic is best effort. +remote `mcp.eggsearch` entry at `http://127.0.0.1:11320/mcp`. CodeGG requires +`web_search` and the canonical `fetch` tool; its provider diagnostic is best +effort. ## Native CLI clients @@ -91,8 +92,8 @@ Current references: [Zed MCP](https://zed.dev/docs/ai/mcp), ## Verification and executable paths An applied registration is verified with MCP `initialize` and `tools/list`. -The minimum required tools are `web_search` and `web_fetch`; missing -recommended tools are reported as a warning. HTTP verification first checks +The minimum required tools are `web_search` and `fetch`; missing recommended +tools are reported as a warning. HTTP verification first checks `/healthz` and rejects an unhealthy or non-eggsearch service. When invoked from a development checkout, stdio apply requires an installed diff --git a/docs/lm-studio.md b/docs/lm-studio.md index 332fe62b..eabde61e 100644 --- a/docs/lm-studio.md +++ b/docs/lm-studio.md @@ -1,9 +1,9 @@ # LM Studio Eggsearch can run as a local stdio MCP server in LM Studio. The `compact` -presentation keeps all ten Eggsearch tools available while shortening their -advertised schemas. It also selects the `brief` response default; callers can -request `response_detail = "diagnostic"` for a full diagnostic response. +presentation keeps all nine canonical Eggsearch tools available while shortening +their advertised schemas. It also selects the `brief` response default; callers +can request `response_detail = "diagnostic"` for a full diagnostic response. The ordinary `full` profile and its diagnostic default remain unchanged. ## Install and configure @@ -45,7 +45,7 @@ path such as `C:\\Users\\you\\.config\\eggsearch\\lm-studio.toml` in the JSON strings. Keep the JSON escaping for backslashes. Restart LM Studio or refresh its MCP server list, then start a new chat. Confirm -that the server connects and all ten Eggsearch tool names appear. stdio is a +that the server connects and all nine canonical tool names appear. stdio is a client-owned process: stdout carries MCP protocol messages, so do not wrap the command in a script that writes status text to stdout. Eggsearch logs to stderr. @@ -54,17 +54,6 @@ or set `schema_profile = "full"`. The executable must still be a build that understands the `[mcp]` section. Changes to the profile require a fresh server process and may require a new chat because MCP clients can cache tool lists. -To verify an installed candidate's stdio handshake, tool list and local -diagnostic call without starting a model, run: - -```bash -python3 scripts/lm_studio_stdio_smoke.py /absolute/path/to/eggsearch -``` - -The smoke starts the executable with temporary full and compact configs, -checks all ten names and the compact byte limit, calls `provider_status` with -probing disabled, and compares its structured output across profiles. - ## API integrations LM Studio's API can address configured MCP servers as `mcp/eggsearch` and can @@ -79,21 +68,9 @@ See LM Studio's [MCP app guide](https://lmstudio.ai/docs/app/mcp), [MCP API guide](https://lmstudio.ai/docs/developer/core/mcp), and [server settings](https://lmstudio.ai/docs/developer/core/server/settings). -## What the measurements establish - -Eggsearch's offline fixtures measure serialized schema and result sizes and -exercise the MCP protocol. They do not establish model context use, tool-choice -quality, or end-to-end task success. LM Studio's native `/api/v1/chat` endpoint -can invoke configured MCP servers and returns actual tool calls, tool results, -and usage counters. Its `stats.input_tokens` includes formatting, tool -definitions, and prior messages; see the [native chat API -docs](https://lmstudio.ai/docs/developer/rest/chat). Use paired requests with -the same model, prompt, context, and allowed tool set to compare profiles. -The M003 record contains LFM3-2B and Gemma E2B trials showing reduced input -usage and result size with compact/brief, along with mixed answer quality and -host/plugin failures. These are model-use experiments through LM Studio as the -available local inference host; app UI refresh and tool-result presentation -are outside the qualification scope. +## Schema and response size -For configuration keys and bounds, see [Eggsearch configuration](config.md) -and the [context-efficiency measurements](retrieval-quality-context-efficiency.md). +The compact profile reduces advertised schema size and defaults search/fetch +responses to `brief`. It does not guarantee a fixed model-token reduction or +better task results. See [Eggsearch configuration](config.md) for the setting +and its bounds. diff --git a/docs/provider-setup.md b/docs/provider-setup.md index cf043904..48e3e601 100644 --- a/docs/provider-setup.md +++ b/docs/provider-setup.md @@ -84,9 +84,17 @@ Features](features.md#bounded-challenge-solving) for limits and restrictions. ``` Its ALTCHA proof-of-work wall is solved by the default solver settings. - -The upstream may require an ALTCHA proof-of-work challenge. Challenge solving is -off by default, uses configured limits, and can add CPU time. See +- Mojeek can refuse an individual search outright. It answers `HTTP 403` with a short page that reads + "Sorry your network appears to be sending automated queries". No challenge is served, so the solver + cannot clear it, and the request reports `blocked` with the status in the reason. The refusal tracks + the query and any recent automated burst, not the user agent or the network as a whole: other + queries from the same host return the solvable wall and results. Mojeek's `robots.txt` declares + `Disallow: /search` for every agent, so treat this provider as operator-selected rather than + policy-neutral. + +The upstream may require an ALTCHA proof-of-work challenge. The bounded solver +is enabled by default and can add CPU time. Set `[search.challenge].enabled` to +`false` to disable it; a challenged request then reports `blocked`. See [Capabilities and Optional Features](features.md#bounded-challenge-solving). ## Keyless-Optional Developer Index diff --git a/docs/python-library.md b/docs/python-library.md index ed10125e..7eae9889 100644 --- a/docs/python-library.md +++ b/docs/python-library.md @@ -46,9 +46,12 @@ the standard installed config using Rust-owned `default_config_path()` and is absent and reporting invalid TOML as a deterministic `ValueError` without leaking credentials. `AsyncEggsearch.default_config_path()` exposes the resolved standard path without loading credentials or raw config. Context -management calls `aclose()` on exit. Closing is idempotent, cancels active -operation futures, waits for them to drop, and rejects later calls with -`EggsearchError` whose `code` is `client_closed`. +management calls `aclose()` on exit. `aclose()` is idempotent: it marks that +client closed, cancels active operation futures, waits for them to drain, then +releases the client's Rust SDK handle. Later calls fail with `EggsearchError` +whose `code` is `client_closed`. The shared process-scoped Tokio runtime +continues after client close. State reused from a different process is rejected +with `forked_process`; start a fresh process rather than reuse inherited state. The generic `execute(tool, arguments)` method and these named async methods use the canonical tool names and pass accepted arguments to the Rust SDK: @@ -83,15 +86,18 @@ future promptly via `pyo3-async-runtimes` 0.29 `Cancellable` polling; the shared 32-permit and per-client active count are released by RAII guards, and a subsequent operation succeeds. `aclose()` cancels the per-client `CancellationToken`, makes the `tokio::select!` close branch win over a running -`EggsearchClient::execute`, drains active calls, and returns `client_closed` -for close-triggered operations while user cancellation still surfaces as -`asyncio.CancelledError`. Dropping the SDK future also drops a blocked provider -engine future, verified by a counted barrier engine in `src/sdk.rs` and a -debug-only bridge barrier in `bindings/python`. Underlying TCP/TLS teardown -remains bounded by Tokio and `eggfetch-core` timeouts; cancellation is a prompt -future drop with permit recovery, not a proven instantaneous socket reset. New -calls after close fail with `client_closed`, independent clients keep their own -lifecycle, and the runtime survives sequential `asyncio.run` loops. +`EggsearchClient::execute`, drains active calls, then releases that client's +`EggsearchClient`. Close-triggered operations return `client_closed` while user +cancellation still surfaces as `asyncio.CancelledError`. The process-scoped +Tokio runtime survives client close. Client state used from a different process +is rejected with `forked_process` instead of reusing inherited runtime state. +Dropping the SDK future also drops a blocked provider engine future, verified +by a counted barrier engine in `src/sdk.rs` and a debug-only bridge barrier in +`bindings/python`. Underlying TCP/TLS teardown remains bounded by Tokio and +`eggfetch-core` timeouts; cancellation is a prompt future drop with permit +recovery, not a proven instantaneous socket reset. New calls after close fail +with `client_closed`, independent clients keep their own lifecycle, and the +runtime survives sequential `asyncio.run` loops. ## Types and errors @@ -154,13 +160,28 @@ python -m pip install --only-binary=:all: eggsearch Do not build the source distribution on an SBC. The source distribution is a developer fallback for environments outside the published wheel matrix. The extension package builds the Rust crate with `default-features = false, -features = ["pdf"]`: the wheel carries PDF extraction only, and no `browser` or -`egress` feature is compiled. Python users who need browser rendering need the -Rust binary or a source build that enables the feature. The native library uses -the same Eggsearch configuration, provider credential environment variables, -bounded operations, sanitization, and trust labels as the Rust engine. It does -not probe credentials during import. Python distributions do not alter Eggpack's -binary release assets. +features = ["pdf", "browser"]`: the wheel compiles both PDF extraction and +browser rendering; `egress` is not compiled. A wheel built from current source +matches the CLI binaries built from the same source; the published +`eggsearch==0.4.4` wheel is PDF-only. A system Chrome/Chromium executable is a runtime +dependency only and is never bundled. If it is absent, +`provider_status.browser_capabilities.usable` is `false`; installation, import, +process startup, search, and HTTP fetch remain available. An `auto` request +retains the HTTP outcome and adds a structured `browser_unavailable` warning +only when rendering was warranted. An explicit browser request raises +`EggsearchError` with `code == "capability_unavailable"` and +`data["code"] == "browser_unavailable"`; `data["message"]` names the +discovery or launch cause. An explicit `[fetch.browser].executable` path is +checked first and an invalid path never falls back. Otherwise discovery checks +Linux absolute candidates, macOS app-bundle candidates, then `PATH` names; the +[configuration guide](config.md#executable-discovery-and-override) lists the +exact order and candidates. Set `[fetch.browser].executable` as the escape +hatch for Chrome/Chromium installed elsewhere. See the [browser degradation +contract](features.md#browser-rendering). The native library uses the same Eggsearch +configuration, provider credential environment variables, bounded operations, +sanitation, and trust labels as the Rust engine. It does not probe credentials +during import. Python distributions do not alter Eggpack's binary release +assets. An sdist build requires Rust 1.89, a C toolchain, and the Cargo dependencies in `bindings/python/Cargo.lock`. It can build offline when those locked crate @@ -169,37 +190,5 @@ them from Cargo registries. Native wheels avoid those build requirements at install and runtime. Upgrade with `python -m pip install --upgrade eggsearch` and remove with `python -m pip uninstall eggsearch`. -## Post-publication SBC benchmark - -M004's native aarch64 smoke and benchmark passed on a Libre Computer -AML-S905X-CC. Results and the raw JSON are in -`plans/closure/python-pypi-distribution/004-status.md` and -`plans/closure/python-pypi-distribution/004-aarch64.json`. ARMv7 physical -testing is deferred; keep that wheel experimental. To reproduce the aarch64 -run, install the exact public wheel with -`--only-binary=:all:`, then run the standard-library harness: - -```bash -python -m pip download --only-binary=:all: --no-deps --dest wheelhouse eggsearch==0.4.4 -python -m pip install --only-binary=:all: --no-deps --report install-report.json eggsearch==0.4.4 -python /path/to/eggsearch/bindings/python/scripts/smoke_installed_wheel.py -python /path/to/eggsearch/bindings/python/benchmarks/sbc_runtime.py \ - --version 0.4.4 --source-sha 1135608af5d625cd72db6704adf3bcabd1a58ab1 \ - --wheel /path/to/wheelhouse/eggsearch-0.4.4-*.whl \ - --pip-report install-report.json --output sbc-runtime.json -``` - -The harness verifies that the wheel matches the public PyPI URL and SHA-256 in -the pip install report, including the installed native extension. It uses a -local Mode-Off search fixture and a loopback-only fetch fixture. It records cold -import, first operation, repeated sequential event loops, search latency at -1–32 concurrent calls, fetch latency and output near configured character -bounds, cancellation and close, memory, thread and descriptor counts, wheel -size, OS, CPU, RAM, libc, storage, and available thermal or throttling -information. It performs no wheel build and calls no remote providers. Keep -the JSON output with the exact published wheel hash and hardware inventory for -the M004 closure record. - -See [Tool Matrix](tool-matrix.md), [Agent Workflows](agent-workflows.md), and -[Python Library Architecture](../architecture/python-library.md) for tool -semantics, result trust, and implementation ownership. +For tool details and common call sequences, see the [Tool Matrix](tool-matrix.md) +and [Agent Workflows](agent-workflows.md). diff --git a/docs/quickstart-codegg.md b/docs/quickstart-codegg.md index a08148f3..8fa14e49 100644 --- a/docs/quickstart-codegg.md +++ b/docs/quickstart-codegg.md @@ -1,13 +1,12 @@ -# Quickstart: Using eggsearch with CodeGG +# Quickstart: eggsearch with CodeGG -This guide walks through installing eggsearch, configuring it, and using it from an MCP-compatible client such as CodeGG. +This guide gets eggsearch connected and ready for a first search. No API key or +configuration file is needed for the built-in defaults. The install command adds +the executable; it does not start a background service. -## Prerequisites +## 1. Install eggsearch -- Rust 1.89 or later installed when building from source -- An MCP-compatible client (CodeGG, Claude Code, or any client supporting MCP over stdio or Streamable HTTP) - -## Installation +On macOS or Linux: ```bash curl -fsSL https://github.com/eggstack/eggsearch/releases/latest/download/install.sh | bash @@ -19,234 +18,70 @@ On Windows PowerShell: irm https://github.com/eggstack/eggsearch/releases/latest/download/install.ps1 | iex ``` -For a source installation: - -```bash -cargo install eggsearch --locked -``` - -Or build from source: +Confirm the command is available: ```bash -git clone https://github.com/eggstack/eggsearch.git -cd eggsearch -cargo build --release +eggsearch --version +eggsearch doctor ``` -The binary is written to `target/release/eggsearch`. - -## Configuration - -The config file is optional. eggsearch uses platform-specific locations: -`$XDG_CONFIG_HOME/eggsearch/config.toml` on Linux (usually -`~/.config/eggsearch/config.toml`), `~/Library/Application Support/eggsearch/config.toml` -on macOS, and `%APPDATA%\eggsearch\config.toml` on Windows. It uses built-in defaults when no config file exists. - -If you add a `[search]` table, include all of its required fields. Partial -`[search]` tables are rejected. See [Configuration](config.md) for the full -reference. - -A minimal config: - -```toml -[search] -mode = "live" -default_max_results = 10 -max_results_cap = 50 -max_query_chars = 512 -timeout_ms = 8000 -default_providers = ["duckduckgo", "brave", "yahoo"] - -[search.providers] -duckduckgo = true -brave = true -startpage = true -yahoo = true - -[fetch] -enabled = true -``` - -For coding work with GitHub integration: - -```toml -[search] -mode = "live" -default_max_results = 10 -max_results_cap = 50 -max_query_chars = 512 -timeout_ms = 8000 -default_providers = ["duckduckgo", "brave"] - -[search.providers] -duckduckgo = true -brave = true - -[search.api.github_code] -enabled = true -api_key_env = "GITHUB_TOKEN" +Rust is required only if you build from source. See [Installation](installation.md) +for supported platforms and binary details. -[search.api.github_issues] -enabled = true -api_key_env = "GITHUB_TOKEN" +## 2. Connect CodeGG -[search.api.github_releases] -enabled = true -api_key_env = "GITHUB_TOKEN" - -[fetch] -enabled = true -``` - -Set the `GITHUB_TOKEN` environment variable before starting the server. - -## Running the MCP Server - -Start the server on stdio transport: - -```bash -eggsearch mcp stdio -``` - -Or set a custom config path: +Preview the CodeGG integration before changing its settings: ```bash -eggsearch --config /path/to/config.toml mcp stdio +eggsearch integrate codegg --transport stdio ``` -The server reads MCP JSON-RPC messages from stdin and writes responses to stdout. - -For a persistent local endpoint instead, run: +If you want eggsearch to update and verify the CodeGG entry, add `--apply`: ```bash -eggsearch mcp serve --bind 127.0.0.1:11320 --path /mcp +eggsearch integrate codegg --transport stdio --apply ``` -Check `http://127.0.0.1:11320/healthz` before connecting. This mode is -foreground-only and loopback-only; the installer does not register it as a -service. - -## Client Configuration - -Configure your MCP client to launch eggsearch as a child process over stdio, or -declare the explicit local HTTP endpoint if the client supports Streamable HTTP. -The exact configuration depends on your client. +Applying is explicit. Eggsearch updates only its own entry and backs up a JSON +settings file before changing it. If CodeGG is not installed or you prefer to +edit settings yourself, use the printed configuration. See [MCP integrations](integrations.md) +for other clients and the persistent HTTP option. -### CodeGG +## 3. Search, then fetch a selected source -In your CodeGG MCP server configuration: +Call `web_search` with a query to find sources. It returns source cards, not +full page text or a synthesized answer: ```json { - "mcpServers": { - "eggsearch": { - "command": "eggsearch", - "args": ["mcp", "stdio"] - } - } + "query": "Tokio runtime task scheduling documentation", + "max_results": 5 } ``` -An HTTP-capable client can use the persistent endpoint explicitly: +Choose a relevant URL from the results, then pass it in a web item to the +canonical `fetch` tool: ```json { - "mcpServers": { - "eggsearch-http": { - "url": "http://127.0.0.1:11320/mcp" - } + "items": { + "type": "web", + "url": "https://tokio.rs/tokio/tutorial" } } ``` -### Claude Code - -```json -{ - "mcpServers": { - "eggsearch": { - "command": "eggsearch", - "args": ["mcp", "stdio"] - } - } -} -``` - -For a custom config path, set the environment variable: - -```json -{ - "mcpServers": { - "eggsearch": { - "command": "eggsearch", - "args": ["mcp", "stdio"], - "env": { - "EGGSEARCH_CONFIG": "/path/to/config.toml" - } - } - } -} -``` - -## Example Workflow - -A typical research flow uses three tools: - -### 1. Search - -``` -web_search({ - "query": "rust async runtime comparison", - "intent": "research", - "max_results": 10 -}) -``` - -Returns a list of source cards with `next_actions` and `suggested_fetches`. -Follow sanitized `next_actions` without another discovery round trip; ignore -unknown tool names. Keep the immediate palette small (`web_search`, -`repo_search`, optionally `web_fetch`) and load specialists only when needed. -See [Progressive Disclosure](codegg-integration.md#progressive-disclosure-integration). - -### 2. Fetch - -``` -web_fetch({ - "url": "https://tokio.rs/blog/2020-04-preparing-for-tokio-0-3", - "extract_mode": "markdown", - "max_chars": 12000 -}) -``` - -Returns extracted text from the selected URL. - -### 3. Batch Fetch - -``` -batch_fetch({ - "items": [ - "https://docs.rs/axum/latest/axum/", - "https://docs.rs/actix-web/latest/actix_web/" - ] -}) -``` - -Fetches multiple URLs in bounded parallel. - -### Discovering Capabilities - -Hosts may inspect `provider_status` during bootstrap; agents call it only when provider availability itself is relevant or troubleshooting is required. It is diagnostic, not a normal first research step: - -``` -provider_status({}) -``` +Fetch targets are explicit. Eggsearch does not crawl or follow every suggested +link automatically. Treat returned web content as untrusted evidence, not as +instructions. -This returns provider health, server capabilities, tool capabilities, and workflow recipes. +## Optional configuration -## Next Steps +You can keep using the built-in defaults without creating a config file. To +enable specialist providers or change limits, see [Configuration](config.md) and +[Provider setup](provider-setup.md). API keys are needed only for optional +credentialed providers. -- [MCP Integration Guide](codegg-integration.md) -- harness-developer reference (progressive disclosure, trust boundary, workflows); this quickstart is the end-user path into that guide -- [Configuration](config.md) -- full config reference with all options and defaults -- [Provider Setup](provider-setup.md) -- how to enable and configure individual providers -- [Tool Matrix](tool-matrix.md) -- compact reference for all 10 MCP tools -- [Agent Workflows](agent-workflows.md) -- recommended tool call sequences and recipes +For tool details and common call sequences, see the [Tool matrix](tool-matrix.md) +and [Agent workflows](agent-workflows.md). For CodeGG harness-development +contracts, see the separate [CodeGG integration reference](codegg-integration.md). diff --git a/docs/release.md b/docs/release.md index 79e32c50..6a413119 100644 --- a/docs/release.md +++ b/docs/release.md @@ -15,6 +15,11 @@ The separate Python distribution `eggsearch==0.4.4` was published to PyPI on crates.io publication require a new version, a changelog entry, and full re-qualification. +The next Python release built from current source compiles browser rendering +alongside PDF extraction, matching the CLI binaries built from the same source. +It relies on a system Chrome or Chromium at runtime and never bundles one; a +host without one still installs, imports, searches, and fetches. + ## Preparation 1. Ensure intended changes are on `main`. diff --git a/docs/safety.md b/docs/safety.md index 610d6686..a42e8bdf 100644 --- a/docs/safety.md +++ b/docs/safety.md @@ -14,7 +14,8 @@ For the full operator threat model, including trust boundaries, configuration es ## Fetch Boundaries -`web_fetch` accepts one explicit HTTP(S) URL and does not crawl. The HTTP +The canonical `fetch` tool accepts one or more tagged items. Each web item +contains one explicit HTTP(S) URL, and eggsearch does not crawl. The HTTP transport does not execute JavaScript. Current source builds also enable browser rendering with an `auto` policy, which can escalate once for JavaScript-heavy pages, non-interactive verification, or recognized challenge pages. The browser @@ -119,7 +120,7 @@ Setting `sanitize_output = false` disables framing and marker scanning, but cont ## `metadata_only` -`web_fetch` supports `extract_mode = "metadata_only"`. +A web item in `fetch` supports `extract_mode = "metadata_only"`. - For HTML, eggsearch still reads a bounded response body so it can extract title and description metadata, but it suppresses body text and the structured document. - For plain-text or other non-HTML responses, eggsearch suppresses body text and does not build a structured document. @@ -129,7 +130,12 @@ Use `metadata_only` when you need page metadata but do not need the body content ## Focused Fetch and Cache Controls -`web_fetch` and per-item `batch_fetch` accept an optional `focus` query for deterministic query-focused chunk selection. Focus ranking is lexical and local (token overlap, exact-phrase, heading, and code-symbol boosts); it performs no extra URL traversal and calls no model. Focused chunk texts are projections of the already-fetched document (batch repo items without a document use line-window text projection), never generated summaries. Focus never changes stable IDs and never enters cache keys. +Web and repo items in the canonical `fetch` tool accept an optional `focus` +query for deterministic query-focused chunk selection. Focus ranking is lexical +and local (token overlap, exact-phrase, heading, and code-symbol boosts); it +performs no extra URL traversal and calls no model. Focused chunk texts project +the already-fetched document; repo items without a document use line-window text. +Focus never changes stable IDs and never enters cache keys. `cache_policy` (`default`/`bypass`/`refresh`) and `max_cache_age_seconds` affect cache reuse and revalidation only. They never bypass target validation, redirect checks, origin concurrency/circuit breakers, browser-profile isolation, content limits, or sanitization. `bypass` still stores the fresh response unless the origin forbids caching; `refresh` revalidates with `ETag`/`Last-Modified` when validators exist. @@ -182,7 +188,12 @@ Browser rendering is compiled into default builds and enabled by default (`polic - **Public-network-only**: Browser transport rejects localhost, private IPv4/IPv6, link-local, and cloud metadata addresses regardless of `allow_localhost`/`allow_private_network` settings. - **No browser download**: eggsearch discovers an already-installed Chrome/Chromium. It never downloads, installs, or manages browser updates. -- **No challenge solving**: Interactive challenges (CAPTCHAs, Turnstile) are detected and reported as structured MCP error codes (`browser_manual_interaction_required`, `browser_profile_requires_attention`). eggsearch never clicks, simulates input, or uses external solving services. This rule is scoped to the browser path; engine-level proof-of-work solving under ADR-0009 is a separate, opt-in, non-interactive mechanism. +- **No interactive challenge solving in the browser**: CAPTCHAs and Turnstile are +detected and reported as structured MCP error codes +(`browser_manual_interaction_required`, `browser_profile_requires_attention`). +eggsearch never clicks, simulates input, or uses external solving services. This +rule is scoped to the browser path; engine-level proof-of-work solving under +ADR-0009 is separate, bounded, enabled by default, and non-interactive. - **Profile isolation**: Anonymous browser contexts are ephemeral and incognito. Persistent profile fetches use only the Eggsearch-owned `chrome-data` directory established by `browser-login`; the user's ordinary Chrome profile is never used. Persistent fetches are request-scoped and serialized by the profile lock. - **Deterministic executable path**: An explicitly configured invalid browser executable path fails deterministically. It does not silently fall back to auto-discovery. - **Request interception**: All observable requests are intercepted and checked against the network policy. diff --git a/docs/threat-model.md b/docs/threat-model.md index c0378a39..2f936ec1 100644 --- a/docs/threat-model.md +++ b/docs/threat-model.md @@ -59,7 +59,8 @@ eggsearch does not enforce host-agent policy. It provides signals (trust markers ### Fetch Behavior -- `web_fetch` accepts one explicit HTTP(S) URL. It does not crawl. +- The canonical `fetch` tool accepts one or more explicitly selected tagged items. + Each web item contains one explicit HTTP(S) URL. Eggsearch does not crawl. - Ordinary HTTP fetch does not execute JavaScript or submit forms. Current source builds also enable browser rendering, which can execute page JavaScript. It is not a malware sandbox. Persistent browser profiles are opt-in and retain cookies and storage. - Bounded body bytes (default 2 MB) and extracted text (default 12k characters, cap 50k). - HTTP redirects are limited (default 5), and each target is revalidated against blocked address ranges. diff --git a/docs/tool-matrix.md b/docs/tool-matrix.md index 0171d96c..03860e24 100644 --- a/docs/tool-matrix.md +++ b/docs/tool-matrix.md @@ -5,7 +5,7 @@ Compact reference for the nine canonical MCP tools. | Tool | Purpose | Key Inputs | Output | Trust | When to Use | |------|---------|------------|--------|-------|-------------| | `web_search` | Live metasearch over configured providers | `query`, optional `intent`, `freshness`, `date_range` (`YYYY-MM-DD` start/end, mutually exclusive with `freshness`), `include_domains`/`exclude_domains` (lowercase hostnames, max 32; natively enforced by `exa`/`tavily`, otherwise local enforcement), `language`/`region` (best-effort unless enforced; native on Brave API and Tavily when representable), `excerpt_count` (0-3, default 0), `max_results`. Advanced `providers`/`timeout_ms` remain accepted but are hidden from the ordinary schema | `Vec` plus `next_actions` and `capability_enforcement` telemetry (`requested`/`enforced`/`approximated`/`not_enforced`). When `intent` is omitted the response also carries `derived_intent` and `derived_intent_reasons` (deterministic lexical derivation; an explicit `intent` is authoritative and suppresses both; compact detail keeps the intent string only). Cards carry `excerpts` (bounded source passages, only when requested) and `metadata.published_at` (RFC 3339, when a provider returned parseable timestamp evidence). Source cards only; the tool never returns a synthesized answer | `external_untrusted` | General web research and source discovery. Source cards include `evidence_role`; `conflict_metadata` present when sources disagree. | -| `fetch` | Bounded fetch of one explicitly selected web or repo target, or an ordered set | `items`: one tagged `FetchItem` or a non-empty array; every item has `type: "web"` or `type: "repo"`. A web item carries its URL and controls: `extract_mode`, `max_chars`, document `offset`/`limit`, `include_links`, `pdf`, `render`, `browser_profile`, `include_screenshot`, `cache_policy`/`max_cache_age_seconds`, `focus`, `focus_max_chunks`, and `focus_max_chars`. A repo item carries its structured locator/ref and line/context/symbol/match-text/block-expansion/`prefer_local`/focus controls. Request-level: `max_items`, `max_chars_per_item`, `max_total_chars`, `timeout_ms`, `continue_on_error`, collection `offset`/`limit`, `response_detail`. | Always a batch-style response with ordered `results[]`; each item carries its target type, optional label/stable ID, success state, response or error, returned-character count, and truncation state. Aggregate counts, truncation, total characters, warnings, telemetry, and collection-addressing metadata are retained. Screenshot image blocks stay out of structured JSON. Repo items report the readable measure (`chars_returned`) and the emitted payload (`payload_chars`); the aggregate budget degrades optional structure (`document.blocks`/`document.chunks`, `document`, `lines`) before clipping text, marks each drop in `degraded_fields`, and omits an item only when it still cannot fit. | `external_untrusted` or `local_trusted` | Use one web/repo item or a mixed array; use a `repo` item for structured repository targets | +| `fetch` | Bounded fetch of one explicitly selected web or repo target, or an ordered set | `items`: one tagged `FetchItem` or a non-empty array; every item has `type: "web"` or `type: "repo"`. A web item carries its URL and controls: `extract_mode`, `max_chars`, document `offset`/`limit`, `include_links`, `pdf`, `render`, `browser_profile`, `include_screenshot`, `cache_policy`/`max_cache_age_seconds`, `focus`, `focus_max_chunks`, and `focus_max_chars`. A repo item carries its structured locator/ref and line/context/symbol/match-text/block-expansion/`prefer_local`/focus controls. Request-level: `max_items`, `max_chars_per_item`, `max_total_chars`, `timeout_ms`, `continue_on_error`, collection `offset`/`limit`, `response_detail`. | Always a batch-style response with ordered `results[]`; each item carries its target type, optional label/stable ID, success state, response or error, returned-character count, and truncation state. Aggregate counts, truncation, total characters, warnings, telemetry, and collection-addressing metadata are retained. Screenshot image blocks stay out of structured JSON. Each item reports the readable measure (`chars_returned`) and projected payload (`payload_chars`); the aggregate budget uses that projected shape, degrades returned document structure (`document.blocks`/`document.chunks`, `document`, `lines`) and web metadata before clipping text, marks budget drops in `degraded_fields`, and omits an item only when it still cannot fit. | `external_untrusted` or `local_trusted` | Use one web/repo item or a mixed array; use a `repo` item for structured repository targets | | `provider_status` | Diagnostic report of provider config, health, capabilities, and workflow recipes | none required; optional `recipe_detail` (`none`, `summary`, `full`), `probe` (bool, bounded live liveness check) | Provider list with `routable`, `skip_reason`, and `skip_code` fields, `health_views` (per-provider health, including `parse_shape` = `ok`/`empty`/`shifted` for observed providers), `code_hosts`, `health` (snapshots), `probe` (`requested`/`implemented`/`started`/`succeeded`/`failed`/`skipped`/`outcomes`), `server_capabilities`, `tool_capabilities`, `quality_metadata`, `workflow_recipes`, and a diagnostic-only `search_cache { entries, hits, misses, coalesced, bypassed, evictions }` block when the process-local search cache is enabled | `local_trusted` | Diagnostics and troubleshooting only; not a normal research step. Hosts may inspect during bootstrap; agents call only when provider availability itself is relevant | | `repo_search` | Structured repository evidence discovery with grouped bundles | `query`, `goal` (understand, architecture, debug, migration, security, dependency, performance, compare, pre_change, post_change), `sources` (code, docs, registry, issues, pull_requests, releases, examples, changelog, migration_guides, security; omit for goal defaults), optional repo locator fields, package fields, `include_local`. Legacy `profile`/`mode`/`workflow`/`include_*`/`providers`/`timeout_ms` remain accepted but are hidden from the ordinary schema | `RepoSearchResponse` with grouped `SourceCard` bundles and `next_actions` | `external_untrusted` or `local_trusted` | Find code, issues, releases, docs, and repo metadata. With search mode off, an enabled local workspace is searched under explicit no-remote-dispatch policy; absent or disabled local search is rejected. Source cards include `evidence_role`; `conflict_metadata` present when sources disagree. Local matches carry `symbol_provenance` (`structured`/`regex_fallback`), `enclosing_symbol`, and `is_exact_definition`; structured definitions score above lexical matches with `Exact` confidence. Local results require a query, path/file, or symbol match; a remote-scoped request includes them only with explicit `include_local: true`. A content or symbol query continues beyond the path-ranked first window inside a bounded scan (512 files, 8 MiB, 1.5 s, request deadline); `local_search_truncated` means a bound cut that scan short, while `local_search_completed_no_matches` means it completed. | | `repo_map` | Bounded repository-structure discovery | `host`, `owner`, `repo`, optional `ref_name`, `max_entries`, `max_depth` | `RepoMapResponse` with important files and directories plus additive `packages`, `language_distribution`, `modules`, `entrypoints`, `top_symbols`, `test_relationships`, `build_configs`, `structure_truncated` | `external_untrusted` or `local_trusted` | Understand repo layout before detailed search | @@ -41,7 +41,10 @@ Every tool advertises all four static behavior hints: `readOnlyHint: true`, ## Legacy call compatibility and web field aliases -`fetch` is the canonical advertised operation. Direct calls using the legacy tool names `web_fetch` and `batch_fetch` remain callable and retain their existing request and response shapes; they are not advertised in `tools/list`, canonical metadata, or `next_actions`. New host integrations should use `fetch`. +`fetch` is the canonical advertised operation. Direct calls using the legacy +names `web_fetch`, `batch_fetch`, and `repo_fetch` remain callable with their +existing request and response shapes, but are not advertised in `tools/list`, +canonical metadata, or `next_actions`. New integrations should use `fetch`. The legacy `web_fetch` request continues to accept these field-name aliases: @@ -79,10 +82,6 @@ it cannot see. `provider_status.mcp_advertisement` reports `tool_preset`, `schema_profile`, `advertised_count`, `advertised_tools`, and `hidden_tools`. There is deliberately no `tools/list._meta` signal. -Pre-M029 ten-tool baseline (full / compact serialized bytes): `full` -74,422 / 20,196; `research` 66,821 / 17,083; `code` 69,318 / 17,220; `minimal` -58,874 / 13,516. These are comparison figures, not the current ten-tool advertisement. - ## Progressive disclosure Keep the immediate palette small and hydrate specialists on demand: @@ -100,7 +99,12 @@ by content fingerprint plus server version, never by count. ## MCP result and error contract -Success returns native `structuredContent` with a text JSON fallback; every tool advertises `outputSchema`. Canonical `fetch` always uses an ordered batch-style `results` envelope, even for one item. `tools/list` contains the canonical ten-name surface and is name-sorted with an FNV-1a content fingerprint for caching. rmcp 3.2.0 speaks MCP 2026-07-28 (`server/discover`, stateless metadata) and legacy initialize sessions; tool names are stable across eras. +Success returns native `structuredContent` with a text JSON fallback; every tool +advertises `outputSchema`. Canonical `fetch` always uses an ordered batch-style +`results` envelope, even for one item. `tools/list` contains nine canonical tools +and is name-sorted with an FNV-1a content fingerprint for caching. rmcp 3.2.0 +speaks MCP 2026-07-28 (`server/discover`, stateless metadata) and legacy +initialize sessions; tool names are stable across eras. Semantic failures are repairable `isError: true` tool errors with stable `code` (`invalid_semantic_value`, `conflicting_arguments`, `capability_unavailable`, `provider_unavailable`, `policy_denied`, `budget_invalid`, `locator_invalid`, `manual_interaction_required`, `upstream_failed`, `plan_mismatch`, `document_unavailable`) and bounded `repair { field, accepted[], suggested_value }`. Only uninterpretable invocation shapes are JSON-RPC `invalid_params`; server faults are `internal_error`. diff --git a/docs/update.md b/docs/update.md index eb5da603..2c1ed9ed 100644 --- a/docs/update.md +++ b/docs/update.md @@ -56,10 +56,3 @@ If replacement succeeds but restart fails, the command returns a nonzero typed error that includes the installed version and exact restart command. An update of a stdio-only installation does not restart any process. See [Managed service](service.md). - -## Closure checks - -The release candidate must pass `make check`, `make packaging-check`, and the -release smoke's stdio/HTTP initialize plus exact ten-tool inventory before it -is published. Updates consume the same target and asset names as the -installer; integration configuration never contains provider keys. diff --git a/packaging/check-http-dependency-shape.py b/packaging/check-http-dependency-shape.py index 9fabc40e..36ca3cfb 100644 --- a/packaging/check-http-dependency-shape.py +++ b/packaging/check-http-dependency-shape.py @@ -1,15 +1,29 @@ #!/usr/bin/env python3 +import re import subprocess import sys -import re +from pathlib import Path + +ROOT = Path(__file__).resolve().parent.parent def run(*args): - return subprocess.run(args, check=False, capture_output=True, text=True) + return subprocess.run(args, cwd=ROOT, check=False, capture_output=True, text=True) -def reverse_roots(*args): - result = run("cargo", "tree", "--color", "never", "--locked", *args, "-i", "reqwest") +def reverse_roots(manifest, package, *args): + result = run( + "cargo", + "tree", + "--manifest-path", + str(manifest), + "--color", + "never", + "--locked", + *args, + "-i", + package, + ) if result.returncode != 0: if "did not match any packages" in result.stderr: return [] @@ -22,8 +36,8 @@ def reverse_roots(*args): ] -def check(label, *args): - roots = reverse_roots(*args) +def check_reqwest(label, manifest, *args): + roots = reverse_roots(manifest, "reqwest", *args) if roots and roots != ["chromiumoxide"]: print( f"http-dependency-shape: {label} graph may carry reqwest only through " @@ -34,11 +48,51 @@ def check(label, *args): return roots -default_roots = check("default") -all_features_roots = check("all-features", "--all-features") +def graph_nodes(manifest): + result = run( + "cargo", + "tree", + "--manifest-path", + str(manifest), + "--color", + "never", + "--locked", + "--target", + "all", + "--prefix", + "none", + ) + if result.returncode != 0: + print(result.stderr, file=sys.stderr) + sys.exit(result.returncode) + return {line.strip().split(" ", 1)[0] for line in result.stdout.splitlines() if line.strip()} + + +def check_binding_graph(manifest): + reqwest_roots = check_reqwest("bindings/python", manifest, "--target", "all") + nodes = graph_nodes(manifest) + forbidden = sorted( + nodes + & {"openssl", "openssl-probe", "openssl-sys", "native-tls", "native-tls-alpn"} + ) + if forbidden: + print( + f"http-dependency-shape: bindings/python graph contains forbidden TLS nodes {forbidden}", + file=sys.stderr, + ) + sys.exit(1) + return reqwest_roots, forbidden + + +root_manifest = ROOT / "Cargo.toml" +binding_manifest = ROOT / "bindings/python/Cargo.toml" +default_roots = check_reqwest("default", root_manifest) +all_features_roots = check_reqwest("all-features", root_manifest, "--all-features") +binding_roots, binding_forbidden = check_binding_graph(binding_manifest) print( "http-dependency-shape: reqwest " f"default={default_roots or 'absent'} " - f"all-features={all_features_roots or 'absent'}" + f"all-features={all_features_roots or 'absent'} " + f"binding={binding_roots or 'absent'} forbidden-binding-tls={binding_forbidden or 'absent'}" ) diff --git a/packaging/check-packaged-assets.py b/packaging/check-packaged-assets.py index b6085083..ca1d21b9 100755 --- a/packaging/check-packaged-assets.py +++ b/packaging/check-packaged-assets.py @@ -17,9 +17,18 @@ INCLUDE_LITERAL = re.compile(r'include_(?:str|bytes)!\s*\(\s*"([^"]+)"\s*\)') -def package_files() -> set[str]: +def package_files(manifest: pathlib.Path) -> set[str]: completed = subprocess.run( - ["cargo", "package", "--list", "--allow-dirty", "--locked", "--quiet"], + [ + "cargo", + "package", + "--list", + "--allow-dirty", + "--locked", + "--quiet", + "--manifest-path", + str(manifest), + ], cwd=ROOT, capture_output=True, text=True, @@ -35,8 +44,12 @@ def strip_line_comments(source: str) -> str: def main() -> int: - packaged = package_files() + packaged = package_files(ROOT / "Cargo.toml") + binding_packaged = package_files(ROOT / "bindings/python/Cargo.toml") problems: list[str] = [] + binding_lock = ROOT / "bindings/python/Cargo.lock" + if not binding_lock.is_file() or "Cargo.lock" not in binding_packaged: + problems.append("bindings/python/Cargo.lock is missing from the binding package file set") checked = 0 for source in sorted((ROOT / "src").rglob("*.rs")): text = strip_line_comments(source.read_text(encoding="utf-8", errors="replace")) @@ -66,7 +79,10 @@ def main() -> int: print(f"packaged-assets: {problem}", file=sys.stderr) if problems: return 1 - print(f"packaged-assets: ok ({checked} compile-time asset(s) across {len(packaged)} packaged files)") + print( + f"packaged-assets: ok ({checked} compile-time asset(s) across {len(packaged)} root files; " + f"binding lock packaged among {len(binding_packaged)} binding files)" + ) return 0 diff --git a/packaging/release-inputs.txt b/packaging/release-inputs.txt index 760a6536..dc573cfd 100644 --- a/packaging/release-inputs.txt +++ b/packaging/release-inputs.txt @@ -7,6 +7,7 @@ # # Cargo.toml # Cargo.lock +# bindings/python/Cargo.lock # release/eggpack/distribution.toml # release/eggpack/pack.toml # release/eggpack/build-bindings.toml @@ -33,6 +34,7 @@ # packaging/test-install.ps1 Cargo.toml Cargo.lock +bindings/python/Cargo.lock release/eggpack/distribution.toml release/eggpack/pack.toml release/eggpack/build-bindings.toml diff --git a/plans/adrs/ADR-0024-browser-enabled-wheels-and-absent-browser-degradation.md b/plans/adrs/ADR-0024-browser-enabled-wheels-and-absent-browser-degradation.md new file mode 100644 index 00000000..029830c1 --- /dev/null +++ b/plans/adrs/ADR-0024-browser-enabled-wheels-and-absent-browser-degradation.md @@ -0,0 +1,90 @@ +# ADR-0024 — Browser-Enabled Wheels with Absent-Browser Degradation + +Status: accepted +Date: 2026-11-24 +Accepted: 2026-11-24 (maintainer instruction: "Accept adr-0024 and complete the 2 new plans") +Supersedes: ADR-0014 §7 (Python wheel exclusion) and the browser roadmap non-goal +"Browser rendering in the Python wheel" +Extends: ADR-0014 §4–§6 (default feature set, browser defaults, dependency boundary) and +ADR-0014 §8 (platform gate) + +## Context + +ADR-0014 shipped PDF and browser rendering in the binary default feature set, enabled by default +through `cfg!(feature = "browser")`, while deliberately excluding browser rendering from the Python +wheel (§7). Its stated reasons were that a wheel still needs a system Chrome and that a wheel-local +CDP client adds size and a second HTTP client at the Python process boundary. + +That split now costs more than it saves. A Python consumer of the published wheel cannot render a +JavaScript shell, cannot pass a challenge wall, and receives `browser_not_compiled_in` for a request +the Rust binary of the same version answers. The two artifacts of one version advertise different +capabilities. + +Measured on 2026-11-23/24 (macOS arm64, warm cargo cache) by building the wheel with +`features = ["pdf", "browser"]`: + +| Fact | Measurement | +|---|---| +| Wheel size | 8,498,057 → 13,064,562 bytes (+4,566,505; **+53.7%**) | +| Build time | 1 min 57 s warm; cold CI is longer | +| New native libraries | none — `reqwest` appears only through `chromiumoxide`, and the graph has **zero** `openssl`/`native-tls` nodes | +| Lockfile | `bindings/python/Cargo.lock` is tracked and gains 11 entries; a `--locked` build fails until it is regenerated | +| Installed capability | `compiled: true, configured: true, discovered: true, usable: true` | +| Render from Python | `renders: 1`, `session_launches: 1`, `resident: true` | +| Client close | `AsyncEggsearch.close()` leaves the browser resident; process exit tears it down | +| Absent-browser seams | the four codes and the `browser_unavailable` warning already exist (see the contract below) | + +The user directed on 2026-11-24 that one version ship with PDF and browser across the regular release +and the wheels, that a system Chrome remain the runtime dependency, and that environments without +Chrome keep working with browser functionality simply unavailable. + +## Decision + +1. **Single artifact alignment.** The CLI and the Python wheel compile `pdf` and `browser` by + default. There is no variant wheel, no per-target feature set, and no second SKU. This keeps + ADR-0014 §4's "one executable per target" invariant and extends it to wheels. +2. **System Chrome is a runtime dependency, never a build dependency.** No browser is bundled. A + manylinux, macOS, or Windows wheel that compiles must stay self-contained: no new shared library + may enter the wheel for the browser feature. +3. **Absence is a supported state.** Missing Chrome, an unsupported version, an invalid explicit + path, or `enabled = false` must never fail installation, process startup, a search, or a fetch + that does not require rendering. +4. **Degradation contract (normative).** + +| Condition | Explicit browser request | Implicit (`auto`) request | +|---|---|---| +| Feature not compiled | `browser_not_compiled_in` | HTTP outcome, `browser_unavailable` warning if rendering was warranted | +| `enabled = false` | `browser_disabled` | same | +| Enabled, no executable found | `browser_unavailable` with an actionable reason | same | +| Enabled, unsupported version | `browser_unavailable` naming the version | same | +| Enabled, explicit path invalid | `browser_unavailable` naming the path; no fallback to auto-discovery | same | +| Enabled and discovered but the launch fails | `browser_unavailable`-class failure naming the launch error, never a silent HTTP fetch | the original HTTP outcome plus the failure reason | + +`provider_status.browser_capabilities` always reports `compiled`, `configured`, `discovered`, +`usable`, `reason`, and the lifecycle counters, in every one of those states. +5. **Wheel size is accepted and recorded.** The measured increase is accepted; every published + target records its size, and an unexplained target exceeding 20 MB pauses the release for review + rather than shipping silently. +6. **Process lifetime is part of the contract.** A resident browser is torn down by the idle timeout, + by the session request cap, and by process exit. A client close must either tear it down or + document the hold. A forked child must fail honestly rather than reuse a dead runtime or DevTools + handle. +7. **Guards and evidence.** The default feature set, the dependency shape, and the lockfile stay + guarded; a continuous-integration lane without Chrome proves the degradation contract on every + change, alongside a lane with Chrome that proves rendering still works. + +## Consequences + +- Roughly +4.6 MB per wheel and a longer cold build; measured per target before publication. +- `docs/python-library.md` currently documents the opposite and must change in the same delivery, as + must the browser roadmap non-goal. +- Python consumers gain escalation by default, with its latency, exactly as CLI users already have. +- Two new CI lanes and a lockfile that becomes a release input. +- ADR-0014 §8's `armv7-unknown-linux-gnueabihf` compile gate extends to the binding crate, because a + published armv7l wheel exists. + +## Non-goals + +Bundling a browser; publishing a second wheel variant or a second project name; enabling persistent +profiles by default; auto-login; making rendering the default extraction path; reopening the tool, +provider, ranking, or evidence-bundle contracts. diff --git a/plans/archive/implementation/agentic-retrieval-integrity/047-projection-aware-batch-fetch-budget.md b/plans/archive/implementation/agentic-retrieval-integrity/047-projection-aware-batch-fetch-budget.md new file mode 100644 index 00000000..96d800e6 --- /dev/null +++ b/plans/archive/implementation/agentic-retrieval-integrity/047-projection-aware-batch-fetch-budget.md @@ -0,0 +1,88 @@ +# M047 — Projection-Aware Batch Fetch Budget and Web Structural Degradation + +Status: closed +Date: 2026-11-23 +Subsystem: agentic retrieval integrity +Milestone class: invariant (corrective to M039) +Baseline: c75bfec9c3cc13a53b3b2c061a326d99b1cc2c38 (docs/user-facing-polish-20261123, clean; based on origin/main) +Source roadmap: §2 current-state gaps, §5 dependency graph, §6 M047 +Decision authority: M039 and ADR-0016/M029 unified fetch contract. No new ADR unless preserving the public meaning of existing payload telemetry proves incompatible with projection-aware budgeting. + +References: plans/implementation/agentic-retrieval-integrity/039-fetch-emitted-payload-budget.md; plans/closure/agentic-retrieval-integrity/039-status.md; architecture/fetch.md, Batch returned-character and emitted-payload budgets; src/mcp/tools/batch_fetch.rs; src/mcp/projection.rs. + +## Objective + +Make the batch fetch budget match the item payload the selected response-detail projection actually returns. For both web and repository items, optional duplicated document structure must degrade before requested text is clipped or an item is omitted. Keep the aggregate cap, deterministic input ordering, existing failure outcomes, and the unified fetch schema unchanged. + +## Discovered gap and why M039 did not catch it + +M039 closed on 10ed7ed08ac47d80e39ca676ea157ecf0728518c. Its structural ladder is entered only for repository items in src/mcp/tools/batch_fetch.rs; the web branch clips text and trims selected metadata but does not remove a large document. The batch is budgeted before project_with_budget applies response_detail in src/mcp/projection.rs. M039’s closure explicitly records this compact-projection over-count as a residual limitation. + +In the 2026-11-23 live three-page fetch, NASA and CDC items succeeded, while the Python documentation item was omitted as batch_total_budget_exhausted with 23,331 characters remaining. Each URL succeeded when fetched individually. This outcome does not by itself establish that document structure was the only cause; it is a reproduction target, not a pre-judged fix. The code path establishes that web document structure is not degraded before clipping or omission and that compact projection may remove fields only after their size was charged. + +## Scope + +In scope: apply the same selected item projection used by the final batch response before charging each item against max_total_chars; extend structural-degradation-before-text to web items while preserving the repository ladder and each item’s locator, requested text, focus, and addressing data; keep payload_chars and total_payload_chars truthful for projected item payloads; preserve explicit degradation warnings and omission outcomes; add full/standard and compact-mode tests. + +Out of scope: raising limits or changing defaults/max_items; adding pagination; changing direct web_fetch or repo_fetch budgets, browser/PDF behavior, cache policy, or workspace authorization; changing the tool inventory, item schema, stable IDs, trust/sanitization rules, or envelope-overhead policy. + +## Invariants that cannot regress + +- max_total_chars caps the sum of projected per-item response payloads in the existing character unit. Common envelope overhead remains excluded and documented. +- payload_chars and total_payload_chars use that same projected measure and remain deterministic. chars_returned retains its M036 readable-text meaning; truncated means requested text was clipped. +- Requested text is preserved while removable optional structure can make the item fit. Every structural drop remains visible in degraded_fields and the existing warning contract. +- A budget-omitted item remains ok: false with a null response and the M036 budget error; result order and continue_on_error behavior do not change. +- Projection is shared with the output path; do not maintain a second approximation that can drift. Existing offset/limit addressing, focus results, stable identifiers, trust markers, sanitization, deadlines, and SSRF controls remain unchanged. +- No schema/property or default change is required. Document any change from the current pre-projection telemetry to the projected caller-visible count; the value must remain a conservative count of what the caller receives. + +## Expected production changes + +- src/mcp/tools/batch_fetch.rs: projection-aware per-item accounting and web structural degradation before text clipping or omission. +- src/mcp/projection.rs: factor or expose the smallest shared item projection so budget calculation and final output use identical transformations. +- tests/batch_fetch_retrieval.rs and tests/mcp_projection.rs; extend web-fetch integration coverage where the behavior is externally visible. +- architecture/fetch.md, docs/features.md, and docs/tool-matrix.md if they state batch-budget behavior; update docs/test-inventory.md only if a suite is added or renamed; append CHANGELOG.md with implementation. + +## Compatibility and migration + +No argument, response field, or configuration key is added. Compact-mode items may remain successful where a pre-projection estimate previously clipped or omitted them; payload telemetry may decrease because it measures the selected projected payload rather than fields the caller will not receive. Full/diagnostic output is unchanged unless its budget is exceeded. Explain this behavior and measure in architecture/fetch.md. No stored data or migration. + +## Dependencies + +- Hard: M039 (closed), including M036’s failed-item outcome and readable-text semantics. +- Interface: ADR-0016 and M029 (closed unified fetch surface and existing projections). +- Soft: none. + +## Ordered work packages + +1. Reproduce the gap with deterministic web and repo fixtures in full/standard and compact modes. Include a large document whose requested text fits after structure is removed, plus a compact item that fits only after projection. Record current counts, markers, and outcomes. +2. Use one shared projection path for each batch item type and response-detail mode. Budget the same projected response the final output exposes; preserve current character-counting units and documented envelope exclusion. Do not measure different data than the output. +3. Apply optional-structure degradation before clipping text. Preserve M039’s repository order. For web items, remove large document structure before clipping or omission; retain locators and minimal addressing metadata required by the existing contract. Keep metadata trimming explicit and deterministic. If the irreducible item cannot fit, use M036’s failed omission outcome. +4. Add tests asserting web text survives when structure removal makes it fit; compact mode does not charge removed fields; full mode charges returned fields; payload telemetry matches projected item responses; aggregate item payload is within the cap; warnings, truncation markers, M036 omission, and addressed windows remain correct. +5. Update architecture/fetch.md first, then affected user-facing tool docs and CHANGELOG.md. Do not claim max_total_chars bounds the full serialized MCP envelope. + +## Verification + +```sh +cargo test --locked --all-features --test batch_fetch_retrieval +cargo test --locked --all-features --test mcp_projection +cargo test --locked --all-features --test web_fetch_integration +cargo test --locked --all-features --test extract_fetch_contract +cargo test --locked --all-features --test static_guards +make check +make docs-check +./packaging/check-repo-hygiene.sh +``` + +No test requires network or credentials. If a suite is added or renamed, synchronize docs/test-inventory.md, architecture/testing.md, and skills/eggsearch-dev/SKILL.md. + +## Acceptance and stop conditions + +- For every response-detail mode, total_payload_chars equals the sum of per-item payload_chars after the same projection used for output and does not exceed max_total_chars (common envelope overhead remains outside the documented bound). +- A web item whose requested text fits after optional document structure is removed remains ok: true; it is not clipped or omitted first. +- Compact mode does not charge fields it removes; full/diagnostic mode charges fields it returns. Output without budget pressure is unchanged. +- Text, focus, offsets, stable IDs, sanitization/trust fields, warning taxonomy, and M036/M039 failure semantics remain covered; broad gates pass. +- Stop and record a separate decision if truthful post-projection counts require a breaking wire change, shared projection cannot preserve final-output parity, or the budget can only be met by removing required addressing/trust metadata. Do not silently raise a cap or change a default. + +## Required closure evidence + +Create plans/closure/agentic-retrieval-integrity/047-status.md with the exact candidate SHA; before/after web and repo results in full and compact modes; a requirement-to-evidence matrix; projected item-size calculations and envelope-exclusion caveat; per-item and aggregate budget behavior; warning/omission/addressing compatibility; focused and broad test outcomes; hosted qualification; and remaining limitations. diff --git a/plans/archive/implementation/agentic-retrieval-integrity/048-inline-html-whitespace-fidelity.md b/plans/archive/implementation/agentic-retrieval-integrity/048-inline-html-whitespace-fidelity.md new file mode 100644 index 00000000..7d136f4e --- /dev/null +++ b/plans/archive/implementation/agentic-retrieval-integrity/048-inline-html-whitespace-fidelity.md @@ -0,0 +1,85 @@ +# M048 — Inline HTML Whitespace Fidelity + +Status: closed +Date: 2026-11-23 +Subsystem: agentic retrieval integrity +Milestone class: invariant (new rendering-fidelity milestone) +Baseline: c75bfec9c3cc13a53b3b2c061a326d99b1cc2c38 (docs/user-facing-polish-20261123, clean; based on origin/main) +Source roadmap: §2 current-state gaps, §5 dependency graph, §6 M048 +Decision authority: existing HTML text extraction and sanitization contract. M003 remains closed; this plan does not amend or reopen markdown-first negotiation. + +References: plans/003-planning-process.md `7; architecture/fetch.md; src/fetch/render/blocks.rs, especially collect_inline_text and collect_text_parts; existing inline-render tests in src/fetch/render/blocks.rs. + +## Objective + +Preserve the source HTML’s whitespace boundaries when combining inline text, links, and code in extracted text. Normalization may collapse whitespace runs, but must not erase a source boundary and merge neighboring words. Apply the same fidelity in plain-text and Markdown rendering without inventing spaces where the source contains none. + +## Evidence + +The live comparison against Python’s tutorial showed missing spaces around inline links in both default text and Markdown modes; Markdown retained link/code markup but did not fix the spacing. One Markdown passage contained a form like The[list](...)data. + +The code trims each non-empty text node in collect_text_parts, concatenates the resulting parts with an empty separator in collect_inline_text, then normalizes whitespace. Once boundary spaces are trimmed, normalize_whitespace cannot recover them. Existing tests exercise paragraphs with spaces around inline code/links but assert only that substrings are present, not the complete rendered sentence, so the boundary loss passes unnoticed. + +## Scope + +In scope: correct boundary whitespace preservation in HTML inline extraction for text and Markdown representations; add exact-output regression tests for inline text, links, and code, including adjacent markup and punctuation; document the extraction fidelity behavior in the owning architecture section. + +Out of scope: new HTML/Markdown dependency or changes to markdown-first negotiation, link resolution, block boundaries, or document chunking; altering source text beyond boundary-whitespace fidelity; adding spaces absent in source; changing code-block whitespace; changes to MCP schemas, tool inventory, fetch budgets, focus ranking, browser policy, or sanitization/trust rules. + +## Invariants that cannot regress + +- Source boundary whitespace is retained through inline collection; whitespace normalization happens after boundaries are represented. +- No synthetic separator is inserted when adjacent source text has no whitespace. Punctuation remains attached as in the source. +- Markdown link syntax, URL resolution, inline-code markup, and raw code-block contents remain unchanged. +- Block-level paragraph/list/table boundaries, depth caps, skipped-node behavior, sanitization, and the four scraper outcomes remain unchanged. +- No new dependency, tool, schema field, default, network requirement, or credential requirement. + +## Expected production changes + +- src/fetch/render/blocks.rs: retain or reconstruct text-node boundary whitespace before normalization while preserving inline link/code wrappers. +- src/fetch/render/blocks.rs unit tests: assert exact text-mode and Markdown-mode output for whitespace on each side of inline links/code, markup with no source whitespace, punctuation, and repeated whitespace. +- tests/web_fetch_integration.rs if needed to prove corrected rendered text reaches the public fetch response; no new suite unless necessary. +- architecture/fetch.md and a CHANGELOG.md entry for the user-visible extraction correction. + +## Compatibility and migration + +No wire shape, schema, identifier, or configuration change. Fetched prose may gain spaces that were present in source HTML but previously lost; this can change downstream text matching and passage contents, which is the intended correction. Markdown link/code notation and no-source-whitespace adjacency remain stable. No migration. + +## Dependencies + +- Hard: none. The implementation is local to the existing HTML rendering layer. +- Interface: existing fetch response and sanitization contracts; no new interface dependency. +- Soft: none. +- M003 is related history only, not reopened; its accepted negotiation/fallback behavior is unchanged. + +## Ordered work packages + +1. Add failing exact-output unit tests demonstrating current boundary loss in plain text and Markdown. Include a no-whitespace adjacency case to prevent a blanket join-with-space workaround, plus inline code and punctuation cases. +2. Change the collector to preserve source text-node whitespace at the join boundary and normalize only after original boundaries and generated inline wrappers are combined. Keep raw code-block collection separate. +3. Verify nested inline elements, empty/skipped nodes, URL resolution, depth limits, and repeated whitespace. Add an integration assertion only if unit-level rendered blocks do not cover MCP-visible text. +4. Update architecture/fetch.md and CHANGELOG.md. No test-inventory update is needed unless a suite name or count changes. + +## Verification + +```sh +cargo test --locked --all-features --lib fetch::render::blocks +cargo test --locked --all-features --test web_fetch_integration +cargo test --locked --all-features --test engine_parse_conformance +cargo test --locked --all-features --test static_guards +make check +make docs-check +./packaging/check-repo-hygiene.sh +``` + +The tests are local and deterministic; no live URL is required. Run cargo fmt as part of make check. + +## Acceptance and stop conditions + +- Exact-output tests pass for text and Markdown modes, including source spaces around an inline element and a case with no source spaces; no words merge and no unsupported separator is added. +- Existing link/code formatting, block/code-block behavior, parser conformance outcomes, and fetch response contracts remain unchanged. +- Focused tests and broad gates pass with no network or credentials. +- Stop and record a design note if the markup tree cannot preserve source boundaries without changing code-block or block-level semantics; do not paper over it by unconditionally joining parts with spaces. + +## Required closure evidence + +Create plans/closure/agentic-retrieval-integrity/048-status.md with the exact candidate SHA, before/after exact-output cases for both modes, a requirement-to-test matrix, confirmation of unchanged link/code/block behavior, focused and broad test results, hosted qualification, and residual risks. diff --git a/plans/archive/implementation/browser-artifact-availability/006-absent-browser-degradation-contract.md b/plans/archive/implementation/browser-artifact-availability/006-absent-browser-degradation-contract.md new file mode 100644 index 00000000..b8f0289d --- /dev/null +++ b/plans/archive/implementation/browser-artifact-availability/006-absent-browser-degradation-contract.md @@ -0,0 +1,68 @@ +# M006 — Absent-Browser Degradation Contract + +Status: ready +Date: 2026-11-24 +Subsystem: browser artifact availability and render bounds +Milestone class: correctness (capability degradation) +Decision: `plans/adrs/ADR-0024-browser-enabled-wheels-and-absent-browser-degradation.md` +References: ADR-0014 §4–§8; `architecture/fetch.md` §8–§9; `docs/features.md`; `docs/config.md`; `src/fetch/browser/discover.rs`; `src/mcp/tools/web_fetch.rs`; `src/mcp/tools/provider_status.rs`; `plans/closure/browser-artifact-availability/003-status.md`. + +## Objective + +Make "no Chrome installed" a proven, harmless state across every entry point, and make every +browser-unavailable outcome name its exact cause. The feature is now compiled in everywhere, so the +absence path is the common case on a fresh Linux server, a slim container, and any machine without a +browser. + +## What already exists (verified 2026-11-24) + +- `discover_browser()` yields `Available`, `NotFound`, `NotConfigured`, `VersionUnsupported`, or + `ExplicitPathInvalid`; `browser_lifecycle` is constructed whenever `enabled` is true, so an + undiscovered browser is "enabled but unavailable", not "disabled". +- Tool seams return `browser_not_compiled_in` (feature absent), `browser_disabled` + (`enabled = false`), and `browser_unavailable` (enabled, not usable), while an implicit `auto` + request returns the HTTP outcome plus a `browser_unavailable` warning carrying the capability + reason. +- `provider_status.browser_capabilities` reports `compiled`, `configured`, `discovered`, + `usable`, `reason`, and lifecycle counters, with a reason string per discovery state. +- Unit coverage exists for the capability report; there is **no** end-to-end lane that runs with no + browser installed. + +## Work packages + +1. **Seam audit.** Build a table of every entry point — CLI `search`/`fetch`, MCP `web_search`, + `web_fetch`, `batch_fetch`, unified `fetch`, `provider_status`, `doctor`, `browser_login`, + `browser_profiles`, and the Python client — and record the exact outcome with no Chrome present. + Any hard failure, panic, hang, or silent HTTP retry at an explicit browser request is a defect. +2. **Taxonomy tightening.** Assert the exact code at each seam for each discovery state, including + the branch where the lifecycle is absent because rendering is disabled versus the branch where it + exists but discovery failed. No call may report `browser_disabled` for a missing executable. +3. **Warning completeness.** Prove the `auto` path emits `browser_unavailable` with the reason + whenever rendering was warranted, and emits nothing when it was not. +4. **Launch-failure path.** A discovered browser can still fail to start (container sandbox, missing + shared library, profile lock). Ensure the outcome names the launch error and never silently + repeats the HTTP fetch; cover the container case with the documented `--no-sandbox` guidance. +5. **No-Chrome CI lane.** Add a lane that removes or hides every browser executable and runs the + seam audit as an executable test: search still returns provider results, fetch still returns + content, explicit browser requests return the exact structured code, and `provider_status` + reports `usable: false` with a reason. This lane is the regression barrier the product currently + lacks. +6. **Documentation.** Publish the degradation table in `docs/features.md` and mirror it in + `docs/config.md` and the browser section of the Python guide, including the discovery order and + the `[fetch.browser].executable` escape hatch. + +## Acceptance + +- The seam audit table is complete and every row passes in the no-Chrome lane. +- Explicit browser requests return exactly `browser_not_compiled_in`, `browser_disabled`, or + `browser_unavailable`; no silent HTTP fallback exists. +- `auto` requests never fail because rendering is unavailable, and warn exactly when warranted. +- `provider_status.browser_capabilities` is accurate for all five discovery states. +- A launch-failure test yields a named reason rather than a bare status. +- `make check`, `make docs-check`, `packaged-assets`, and `planning-consistency` pass. + +## Stop conditions + +Stop and report if any entry point cannot degrade without changing a tool schema, an error code, or +the advertised tool inventory; if the no-Chrome lane cannot be made deterministic on a hosted runner; +or if a launch-failure path would require bundling a browser. diff --git a/plans/closure/agentic-retrieval-integrity/047-status.md b/plans/closure/agentic-retrieval-integrity/047-status.md new file mode 100644 index 00000000..9da1fed4 --- /dev/null +++ b/plans/closure/agentic-retrieval-integrity/047-status.md @@ -0,0 +1,65 @@ +# M047 Projection-Aware Batch Fetch Budget and Web Structural Degradation — Closure Evidence + +Status: closed + +Source plan: plans/implementation/agentic-retrieval-integrity/047-projection-aware-batch-fetch-budget.md + +Roadmap: plans/subsystems/agentic-retrieval-integrity-roadmap.md M047 + +Decision authority: M039 and the existing M036/M029 batch-fetch and projection contracts. No new ADR, tool, argument, response field, default, stable ID, or dependency. + +## Exact code candidate + +Implementation candidate 9528d4131591392c0d9f6ec5f0422903e4b7815b on docs/user-facing-polish-20261123, based on c75bfec9c3cc13a53b3b2c061a326d99b1cc2c38. Candidate tree: ee8e56e747c92da196f419d763d14439a4ce97b1. Local commands ran against the content-identical pre-commit tree; the implementation commit is clean. This closure commit will carry the closure records and synchronized plan status only; it changes no source. + +Hosted CI run 45127251813 succeeded on this exact SHA via workflow dispatch: Linux `ci`, Windows portability, and macOS canonical/filesystem portability all passed. The Node.js 20 deprecation annotation was non-blocking. Run: https://github.com/eggstack/eggsearch/actions/runs/45127251813. + +## Defect and change + +M039 charged a pre-projection item payload. Standard/compact/brief projections could remove content after that charge, and the structural degradation path was repository-specific. A web item could therefore be clipped or omitted while removable document structure was still present. Brief mode also projected the batch envelope only after initial budget/item selection, so early enforcement could skip later items before the complete Brief projection was known. + +The implementation now uses the shared per-item projection for both measurement and final output, degrades returned optional structure before requested text, and refreshes item/aggregate payload telemetry after projection. Diagnostic, standard, and compact modes apply the aggregate cap during ordered processing; Brief mode waits until the complete Brief envelope projection is available, then enforces the cap against retained projected item responses. The Brief helper updates the projected JSON fields directly because Brief projection intentionally omits the row index. + +## Requirement-to-evidence mapping + +| Requirement | Evidence | +|---|---| +| Count the same projected per-item response the caller receives; preserve character-count units | tests/mcp_projection.rs::batch_payload_budget_fields_track_projected_responses checks Diagnostic, Standard, Compact, and Brief: each payload_chars equals the serialized projected response, and total_payload_chars is their sum. batch_web_payload_budget_counts_only_projected_fields confirms Compact does not charge a projected-away document. | +| Degrade web structure before clipping or omission | tests/batch_fetch_retrieval.rs::batch_web_budget_uses_projected_payload_and_drops_structure_before_text: Standard’s full projected document exceeds the computed cap, while removing document.blocks/document.chunks leaves room; the result stays successful, preserves requested text, is not text-truncated, reports both degradation markers, and reports the exact response-size count within the cap. | +| Compact projection is charged after its presentation fields are removed | The same web regression chooses a cap above the Compact serialized projection but below the original payload. The item remains successful with unchanged text, no document, no false budget-degradation markers, and exact payload telemetry within the cap. | +| Preserve repository behavior and M036 omission outcomes | batch_repo_degradation_drops_structure_before_text preserves a non-empty text prefix, drops lines before text clipping under a 25,000-character cap, and checks item/aggregate counts and both warning forms. batch_repo_metadata_budget_omission_is_a_failed_item checks an irreducible item remains ok: false, has null response and zero readable/payload characters, and updates failure telemetry. | +| Enforce only after the complete Brief projection; preserve deterministic fetch/item selection | brief_batch_budget_waits_for_final_projection uses two local endpoints and a 512-character aggregate cap; both requests are made, results remain, total projected payload is at most 512, and no result is misreported as “was skipped.” | +| Preserve addressed windows, partial failures, focus, truncation, and aggregate behavior | Existing mcp_projection addressed-window and batch-failure tests, plus batch_total_payload_chars_bounds_three_item_batch, remain green in the full gate. chars_returned remains the M036 readable-text measure; truncated still denotes requested text clipping. | + +## Budget and compatibility evidence + +payload_chars is the Unicode-scalar count of serde_json::to_string(projected_response); total_payload_chars sums those item counts. The cap excludes common envelope overhead: row wrappers, the results array, aggregate counts/telemetry, warnings, addressing fields, and projection stamps. This is not a serialized-envelope, byte, or token cap. These units and exclusions are documented in architecture/fetch.md and docs/features.md. + +Before M047, Compact/Brief fields removed by projection could still be included in the pre-projection charge, and web document structure was not in the degradation ladder. After M047, tests calculate the projected web sizes from the fixture itself and assert that the response fits the cap without sacrificing requested text. For repository responses, the regression asserts the actual returned text and dropped-field marker under the cap; the projection suite checks exact counts for all four detail modes. The historical three-page live batch is retained as motivation, not as proof that document structure was its sole cause; no live network probe was run for this closure. + +No tool/schema/default/identity, locator-safety, trust, sanitization, deadline, SSRF, or migration behavior changed. Existing budget warning taxonomy and omission semantics remain intact. + +## Verification + +- RUSTUP_TOOLCHAIN=1.89.0 cargo test --locked --all-features --test batch_fetch_retrieval: 29 passed. +- RUSTUP_TOOLCHAIN=1.89.0 cargo test --locked --all-features --test mcp_projection: 36 passed. +- RUSTUP_TOOLCHAIN=1.89.0 cargo test --locked --all-features --lib fetch::render::blocks: 34 passed (shared M048 rendering regression suite). +- RUSTUP_TOOLCHAIN=1.89.0 make check: passed, including formatting, Clippy, no-default-features check, all-features tests, hygiene, dependency policy, and packaging checks. +- RUSTUP_TOOLCHAIN=1.89.0 make docs-check: passed. +- ./packaging/check-repo-hygiene.sh: passed (repo-hygiene: ok). +- Independent read-only review: PASS; no concrete defects found. It also passed batch retrieval (29), MCP projection (36), renderer (34), web-fetch integration (128 passed, 1 live test ignored), parser conformance (6), static guards (68), and docs-check. +- Hosted CI: run 45127251813 completed successfully on the exact candidate SHA above; Linux CI, Windows portability, and macOS canonical/filesystem checks all passed. + +## Residual limitations + +- Common envelope overhead is intentionally excluded; the cap is on projected item-response payloads only. +- Brief mode must fetch and project the complete selected item window before enforcing its aggregate cap. Work remains bounded by existing item, deadline, and I/O limits, but it no longer short-circuits later Brief items solely from a pre-projection estimate. +- Payload counts are serialized Unicode characters, not bytes or model-token estimates. + +No unresolved implementation finding blocks closure. Final recommendation: closed. No unresolved implementation finding or acceptance condition remains. + +## Verification commands + +RUSTUP_TOOLCHAIN=1.89.0 make check +RUSTUP_TOOLCHAIN=1.89.0 make docs-check +./packaging/check-repo-hygiene.sh diff --git a/plans/closure/agentic-retrieval-integrity/048-status.md b/plans/closure/agentic-retrieval-integrity/048-status.md new file mode 100644 index 00000000..3d019a5a --- /dev/null +++ b/plans/closure/agentic-retrieval-integrity/048-status.md @@ -0,0 +1,64 @@ +# M048 Inline HTML Whitespace Fidelity — Closure Evidence + +Status: closed + +Source plan: plans/implementation/agentic-retrieval-integrity/048-inline-html-whitespace-fidelity.md + +Roadmap: plans/subsystems/agentic-retrieval-integrity-roadmap.md M048 + +Decision authority: existing HTML extraction and sanitization contracts. M003 remains closed; no markdown-first negotiation or fetch contract is reopened. + +## Exact code candidate + +Implementation candidate 9528d4131591392c0d9f6ec5f0422903e4b7815b on docs/user-facing-polish-20261123, based on c75bfec9c3cc13a53b3b2c061a326d99b1cc2c38. Candidate tree: ee8e56e747c92da196f419d763d14439a4ce97b1. Local commands ran against the content-identical pre-commit tree; the implementation commit is clean. This closure commit will carry the closure records and synchronized plan status only; it changes no source. + +Hosted CI run 45127251813 succeeded on this exact SHA via workflow dispatch: Linux `ci`, Windows portability, and macOS canonical/filesystem portability all passed. The Node.js 20 deprecation annotation was non-blocking. Run: https://github.com/eggstack/eggsearch/actions/runs/45127251813. + +## Defect and change + +The previous inline collector trimmed every non-empty text node, concatenated the remaining parts without a separator, then normalized whitespace. A source boundary around inline markup was lost before normalization, merging words in plain-text and Markdown output. The collector now preserves source-present whitespace through inline text/link/code composition and normalizes only after the boundaries are represented. It does not add spaces where the source contains none. + +## Exact-output evidence + +src/fetch/render/blocks.rs::inline_whitespace_preserves_source_boundaries_exactly asserts both rendering modes for every case below: + +| Source case | Text output | Markdown output | +|---|---|---| +| Multiple spaces before a nested inline link; a space and newline after it; inline code later in the sentence | Before linked text then sample after. | Before [linked text](https://example.com/docs) then `sample` after. | +| Source-adjacent link and code followed by punctuation | Seethisx,next! | See[this](https://example.com/docs)`x`,next! | +| Space inside the link wrapper, no space outside before/after | Before linked after | Before [linked](https://example.com/docs) after | +| Space inside the code wrapper, no space outside before/after | Before sample after | Before `sample` after | + +The first case proves repeated source spaces normalize while boundaries survive. The second proves no synthetic spaces are added at source-adjacent link/code or punctuation boundaries. The last two prove spaces inside inline wrappers survive after trimming wrapper content. Existing link URL resolution and inline-code formatting tests remain unchanged. render_blocks_code_whitespace_preserved confirms raw code-block whitespace is unchanged. + +## Requirement-to-evidence mapping + +| Requirement | Evidence | +|---|---| +| Preserve source-present boundaries in text and Markdown output | Exact-output test above covers nested inline emphasis/link, whitespace around links/code, repeated whitespace, and both modes. | +| Never invent spaces for source-adjacent words or punctuation | The source-adjacent link/code case asserts Seethisx,next! and See[this](...)`x`,next! exactly. | +| Keep link/code markup and raw code blocks stable | Existing render_blocks_inline_link_markdown, render_blocks_inline_code_markdown, render_blocks_inline_code_text_mode_no_backticks, URL-resolution tests, and render_blocks_code_whitespace_preserved pass. | +| Preserve public fetch/parser behavior and boundaries | All-features web_fetch_integration and engine_parse_conformance passed in both local/full-gate and independent reviewer runs. No scraper outcome, sanitization, block boundary, tool/schema, configuration, or dependency changed. | + +## Compatibility and residual risk + +No wire shape, schema, tool inventory, default, stable identifier, dependency, cache behavior, or migration changed. Extracted prose now retains spaces that existed in source HTML and were previously lost; downstream text matching and passage content may therefore differ as intended. Normalization still collapses repeated whitespace, and no-source-space adjacency remains unchanged. Block-level behavior, skipped nodes, depth caps, sanitization, and raw code-block contents are unchanged. + +No unresolved implementation finding blocks closure. No live network or credentialed probe was needed. Final recommendation: closed. + +## Verification + +- RUSTUP_TOOLCHAIN=1.89.0 cargo test --locked --all-features --lib fetch::render::blocks: 34 passed. +- RUSTUP_TOOLCHAIN=1.89.0 cargo test --locked --all-features --test batch_fetch_retrieval: 29 passed (M047 shared candidate suite). +- RUSTUP_TOOLCHAIN=1.89.0 cargo test --locked --all-features --test mcp_projection: 36 passed. +- RUSTUP_TOOLCHAIN=1.89.0 make check: passed, including formatting, Clippy, no-default-features check, all-features tests, hygiene, dependency policy, and packaging checks. +- RUSTUP_TOOLCHAIN=1.89.0 make docs-check: passed. +- ./packaging/check-repo-hygiene.sh: passed (repo-hygiene: ok). +- Independent read-only review: PASS; no concrete defects found. Web-fetch integration (128 passed, 1 live test ignored), parser conformance (6), static guards (68), and docs-check passed. +- Hosted CI: run 45127251813 completed successfully on the exact candidate SHA above; Linux CI, Windows portability, and macOS canonical/filesystem checks all passed. + +## Verification commands + +RUSTUP_TOOLCHAIN=1.89.0 make check +RUSTUP_TOOLCHAIN=1.89.0 make docs-check +./packaging/check-repo-hygiene.sh diff --git a/plans/closure/python-pypi-distribution/evidence/browser-wheel-baseline.json b/plans/closure/python-pypi-distribution/evidence/browser-wheel-baseline.json new file mode 100644 index 00000000..af024429 --- /dev/null +++ b/plans/closure/python-pypi-distribution/evidence/browser-wheel-baseline.json @@ -0,0 +1,106 @@ +{ + "milestone": "python-pypi-distribution-M006", + "record_type": "local browser-enabled Python wheel baseline", + "recorded_on": "2026-11-24", + "candidate": { + "base_commit": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "tree_state": "uncommitted shared worktree; no exact-candidate commit SHA", + "qualification_status": "local baseline only; M006 is not fully qualified or closed" + }, + "environment": { + "platform": "macOS arm64", + "python_abi": "cp311-abi3", + "rust_toolchain": "1.89.0", + "maturin_local": "1.9.5", + "maturin_ci_pin": "1.15.0", + "note": "Local builds succeeded with a Maturin version warning; CI-pinned Maturin was not used locally." + }, + "artifacts": [ + { + "kind": "release_wheel", + "filename": "eggsearch-0.4.4-cp311-abi3-macosx_11_0_arm64.whl", + "size_bytes": 13854441, + "sha256": "efcfb6525cf3d6880007fd3c245e25da3b8469fe0c16b44d7526ee34e3d3dcf8", + "installed": true, + "native_payload": [ + "eggsearch/_native.abi3.so" + ], + "additional_native_libraries": [] + }, + { + "kind": "sdist", + "filename": "eggsearch-0.4.4.tar.gz", + "size_bytes": 1633094, + "sha256": "839cbd8643a9f5ea511fa2b6fcefdf2388c1cfeed0e6742d62af3b696fb54718" + }, + { + "kind": "offline_sdist_rebuilt_wheel", + "filename": "eggsearch-0.4.4-cp311-abi3-macosx_11_0_arm64.whl", + "size_bytes": 13860935, + "sha256": "cea4ecb37fdc0eaa89974360e1ae68daf849454c89680ef2346172b4067011c5", + "installed": true, + "build_mode": "offline Cargo build from extracted sdist" + } + ], + "installed_no_chrome": { + "capability_report": { + "compiled": true, + "configured": true, + "discovered": false, + "usable": false, + "reason": "Explicit browser executable path was invalid; deterministic no-browser fixture." + }, + "explicit_render_error": { + "error_code": "capability_unavailable", + "data_code": "browser_unavailable" + }, + "operations": { + "search": "passed", + "http_only_fetch": "passed", + "offline_repository_search": "passed" + } + }, + "python_lifecycle_and_tests": { + "close_alias": "close() delegates to idempotent aclose(); close drains/cancels active calls and releases per-client SDK state.", + "fork_behavior": "Inherited client/runtime use in a forked child returns structured error code forked_process.", + "debug_suite": { + "result": "passed", + "passed": 32, + "skipped": 3 + }, + "extracted_sdist_suite": { + "result": "passed", + "passed": 27, + "skipped": 8 + }, + "chrome_dependent_coverage": "Real rendering, idle teardown, and session-cap counter checks were skipped because no Chrome executable is available locally." + }, + "validation": { + "passed": [ + "Python dependency-shape guard", + "Packaged-assets guard", + "Locked binding cargo check", + "cargo package --list", + "Python syntax compilation", + "git diff --check", + "make docs-check", + "Release wheel build/install/import", + "Offline sdist rebuild/install" + ], + "make_check": { + "first_attempt": "Timed out at 300 seconds while all-features tests were still running.", + "retry": { + "exit_code": 2, + "failing_phase": "clippy", + "diagnostic": "src/mcp/tools/tests.rs:1556-1557 assigns to config fields through Arc; rustc E0594 cannot assign to data in an Arc." + } + } + }, + "unverified": [ + "Hosted Chrome rendering and no-Chrome lanes", + "Six-platform wheel matrix on the exact candidate", + "ARMv7 binding compile/cross-build: Rust 1.89 installation lacks armv7-unknown-linux-gnueabihf core; arm-linux-gnueabihf-gcc and Docker are absent locally", + "Chrome real render, idle teardown, and session-cap behavior", + "Hosted CI on the exact final candidate" + ] +} diff --git a/plans/closure/retrieval-quality-evidence-extension/008-status.md b/plans/closure/retrieval-quality-evidence-extension/008-status.md new file mode 100644 index 00000000..6fb45f02 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/008-status.md @@ -0,0 +1,104 @@ +# M008 — Mojeek Generic-Default Qualification Status + +Status: blocked +Recommendation: do not add Mojeek to the shipped generic defaults on this candidate. +Candidate source SHA: `7ec251df2ba715705468f2eb1e5392fa87fc4d32` +Release CLI binary SHA-256: `14370900e193c56273c46409b2736ff7ac795a1a4c96ddf16510c870959d56fe` +Runner SHA-256: `2bb24640027801e9c29f2839e1f8e84b8007a66a3ceb4cb7d489e8f4c72767d3` +Qualification config SHA-256: `6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174` +Host: `macOS-26.6.2-arm64-arm-64bit-Mach-O` + +## Evidence + +The frozen runner executed 72 bounded, keyless attempts: DuckDuckGo, Brave, Yahoo, and Mojeek × SciFact, NQ, and FEVER × three selected held-out queries × two repetitions. The exact seed was `m008-mojeek-default-qualification-v1`; each attempt requested ten results with an eighteen-second ceiling. There were no retries. All 12 JSON reports were recovered from the captured runner outputs and saved under `plans/closure/retrieval-quality-evidence-extension/evidence/`. + +| Provider | SciFact | NQ | FEVER | Valid / 18 | Distinct qrel pairs | +|---|---|---|---|---:|---:| +| DuckDuckGo | 6 results | 4 results, 2 blocked | 6 blocked | 10 | 1 | +| Brave | 6 results | 2 results, 4 blocked | 6 blocked | 8 | 1 | +| Yahoo | 6 HTTP-status errors | 6 HTTP-status errors | 6 HTTP-status errors | 0 | 0 | +| Mojeek | 5 results, 1 HTTP-status error | 6 HTTP-status errors | 6 HTTP-status errors | 5 | 0 | + +The only positive match from DuckDuckGo and Brave was the same NQ qrel pair, `nq:test1742` / `doc61640`, on one repetition. Mojeek matched no qrel document. Mojeek's five valid results all came from SciFact; the 13 other attempts were provider errors classified `http_status`. Its CLI-process latency was 393–1,980 ms, median 438 ms. No successful empty responses or timeouts occurred for Mojeek. + +Dataset fingerprints were SciFact `40f78fb516f4a69bfc4fc13b5b4f1d7ee784638d937ccf338c6b6436934613d2`, NQ `76f3240642b95adaccc4a0e6cb7ef75776ec105e6763585f37ade994663673ed`, FEVER `4f359df04ad5a9a29c2f78009e7229d2a1c8eb0bf42d953853811373dea13305`. Selected IDs: SciFact `775`, `100`, `619`; NQ `nq:test2352`, `nq:test1742`, `nq:test2376`; FEVER `fever:test31743`, `fever:test120259`, `fever:test194565`. + +## Acceptance matrix + +| Requirement | Result | Evidence | +|---|---|---| +| Exact candidate, binary, runner, config, seed, query IDs, and all 72 outcomes recorded | Pass | Twelve per-arm JSON reports; provenance above | +| Mojeek ≥17/18 valid; ≥5/6 valid and ≥4/6 non-empty per dataset | Fail | Mojeek 5/18 valid; dataset counts 5/6, 0/6, 0/6; non-empty only 5/6 SciFact | +| Each existing default ≥4/6 valid in each dataset | Fail | DuckDuckGo 4/6 NQ and 0/6 FEVER; Brave 2/6 NQ and 0/6 FEVER; Yahoo 0/6 throughout | +| ≥3 distinct Mojeek qrel pairs over ≥2 datasets and ≥1 unique fully paired match | Fail | 0 Mojeek matches; no fully comparable default coverage | +| Preserve defaults if any gate condition fails | Pass | No production config, tests, or default docs changed | + +The sample uses positive qrels and URL/normalized-title matching only; unlisted results are unjudged, not irrelevant. The errors are current egress observations and do not prove Mojeek is intrinsically unavailable. The runner does not retain raw result bodies and cannot distinguish source quality from the observed blocked/HTTP-status conditions. + +## Changes and checks + +No production provider defaults, tests, or provider setup documentation were changed. The live default-fan-out smoke and implementation gates were not run because qualification failed. The temporary config retained the shipped default list and enabled the four keyless HTML providers only for explicit isolated trials; no credential or paid-provider configuration was used. The previous three-query functional smoke remains functional evidence only and does not override this held-out gate. + +Blocker: Mojeek did not return valid result responses outside the SciFact arm, and existing default controls were too incomplete for a paired qualification. M008 remains blocked; a future qualification would require a separately authorized, newly bounded run after endpoint/control availability changes. The defaults remain `[duckduckgo, brave, yahoo]`; Mojeek remains disabled. + +## Correction (2026-11-23) + +The paragraph above and the acceptance matrix are left as recorded and corrected here rather than +rewritten. + +The thirteen Mojeek attempts recorded above as `http_status` cannot be re-inspected: the runner +retained error classes and no response bodies. What this egress did capture is a **hard refusal +page**, not a transport fault. The qualification-time diagnostic reported +`engine 'mojeek' returned status 403`, and one bounded keyless capture on 2026-11-23 returned +`HTTP/1.1 403 Forbidden`, `Content-Length: 363`, `Server: lighttpd/1.4.53`, and this body: + +```html +403 - Forbidden

403 - Forbidden

Sorry your network appears to be sending automated queries so we can't process your search at this time.

… +``` + +The body carries the marker `mojeek.rs` already declares in `SHAPE.blocked_markers` +(`your network appears to be sending automated queries`), but `send_search()` returned +`BadStatus` before reading the body, so the marker never ran. Under the rule in +`architecture/engines.md` § Scraper Fidelity and M045 work package 1, those thirteen observations +are `blocked`, not `http_status`. M049 corrects the classification. + +This changes the label, not the gate result. `blocked` is a non-retryable provider refusal with a +cooldown, which is the honest classification for these responses. + +- `https://www.mojeek.com/robots.txt` declares `User-agent: *` / `Disallow: /search`: the HTML + search page is not offered to automated clients. +- Mojeek gates `/search` with an ALTCHA proof-of-work wall served with `HTTP 200` `div.captcha-wrap`, + added 2026-06-23. +- Sustained automated traffic escalates to a hard `403` carrying that page. Mojeek's forum documents + the same page for datacenter and VPN egress and, separately, for single over-broad bot rules that + fire on the query text. +- The refusal is **query-keyed, not network-wide and not user-agent-wide**. On 2026-11-23 this + egress (public address `96.236.59.113`, verified identical for the in-app browser and the CLI) + served Mojeek's homepage with `200`; served `/search` with the solvable `200` ALTCHA wall for + `test`, `rust`, `official website`, `rust programming language`, a long benign sentence, and the + held-out question `nq:test2352` (including a reload and a repeat); and the shipped client returned + five real results for that question with no provider failures. The captured `403` reproduced only + for the probe string `Rust programming language official website`, from the in-app Chromium engine, + from curl with a stale Windows Chrome/124 identity, and from curl with a current macOS Chrome/148 + identity plus `sec-ch-ua`/`sec-fetch-*`; changing the user agent and client hints changed nothing. +- An earlier version of this note called the refusal network-scoped. That scope is withdrawn. The + controls are retained in + `plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-403-mechanism-controls.json`. +- The supported automated route is `https://api.mojeek.com/search` with `api_key` (PAYG, from + £2 per 1,000 requests); their terms allow automated access only by an authorised API user. + +A related deviation: the M008 candidate was built with `--no-default-features`, which is **not** the +shipped feature set. The shipped CLI builds with default features (`default = ["pdf", "browser"]`), +and `[fetch.browser].enabled` resolves from `cfg!(feature = "browser")`, so browser rendering is on by +default unless an operator disables it. Building the qualification candidate without the browser +removed Yahoo's escalation path and made condition 3 unsatisfiable regardless of Mojeek. M010 +corrects the candidate class; see its record. + +The M008 gate and the default set are unchanged: `[duckduckgo, brave, yahoo]`, Mojeek disabled. The +held-out gate failed on the day and is not retroactively passed. What changes is the disposition of +the failure: the thirteen refusals are query-keyed `403`s, and the cohort's own 72 rapid attempts are +consistent with the documented escalation path, so the run may have measured its own request +pressure. A paced, bounded rerun is therefore worth authorising; it is not authorised here and was +not run. Mojeek's `robots.txt` still declares `Disallow: /search`, so such a rerun remains an +operator decision rather than a policy-neutral one. Both captures are retained in +`plans/closure/retrieval-quality-evidence-extension/evidence/`. diff --git a/plans/closure/retrieval-quality-evidence-extension/009-status.md b/plans/closure/retrieval-quality-evidence-extension/009-status.md new file mode 100644 index 00000000..4742b218 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/009-status.md @@ -0,0 +1,91 @@ +# M009 — Paced Mojeek Default-Qualification Rerun Status + +Status: blocked +Recommendation: do not add Mojeek to the shipped generic defaults. +Protocol: `m009-paced-v1` (25–40 s per-attempt pacing, stop after 3 consecutive blocked, 24 h cooldown) +Source SHA: `7ec251df2ba715705468f2eb1e5392fa87fc4d32` — **working tree dirty** (see Limitations) +Release CLI binary SHA-256: `fd90457efcb52aa69acccd306c9af2f4e335dc54259a447df5479bcf66e1daf2` +Runner SHA-256: `d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f` +Qualification config SHA-256: `6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174` +Host: `macOS-26.6.2-arm64-arm-64bit-Mach-O` +Window: 2026-11-23 21:16:13Z – 21:47:03Z + +## Evidence + +The frozen runner executed twelve paced arms — DuckDuckGo, Brave, Yahoo, and Mojeek × SciFact, NQ, +and FEVER × the same three held-out queries and two repetitions M008 used (seed +`m008-mojeek-default-qualification-v1`), ten results per query, eighteen-second ceiling, 72 attempts, +no retries. Reports: `evidence/mojeek---m009.json`. + +| Provider | SciFact | NQ | FEVER | Valid / 18 | Distinct qrel pairs | +|---|---|---|---:|---:|---:| +| DuckDuckGo | 6/6 | 6/6 | 6/6 | 18 | 4 | +| Brave | 6/6 | 6/6 | 6/6 | 18 | 4 | +| Yahoo | 0/6 | 0/6 | 0/6 | 0 | 0 | +| Mojeek | 6/6 | 6/6 | 6/6 | 18 | 1 | + +Mojeek returned non-empty results for every attempt, with no `blocked` outcome, no `zero_results`, +no timeout, and no provider error. Its latency was 1,454 / 1,823 / 2,700 ms (min / p50 / max); the +ALTCHA solve is included. Its single matched pair is `fever:test194565` → `Kyle_MacLachlan`, at rank 1 +on both repetitions. + +Yahoo answered `500` to all eighteen attempts (`engine 'yahoo' returned status 500`, p50 1,083 ms). + +Pacing was honoured: minimum observed interval 25.228 s across all 72 attempts, zero declared +violations, and every row carries `planned_interval_seconds`, `actual_interval_seconds`, +`started_at_utc`, and `http_status`. + +## Acceptance matrix + +| Requirement | Result | Evidence | +|---|---|---| +| 1. Trial integrity: same source, binary, runner, protocol, seed, query IDs per dataset, result limit, timeout, pacing parameters; all attempts represented | Pass on report content | Twelve reports agree per dataset; 72 attempts; config fingerprint identical; no paid provider or credential | +| 2. Mojeek ≥17/18 valid; ≥5/6 valid and ≥4/6 non-empty per dataset | **Pass** | 18/18 valid, 18/18 non-empty, 6/6 in each dataset | +| 3. Each existing default ≥4/6 valid per dataset, and paired uniqueness | **Fail** | Yahoo 0/6 in every dataset; 0/18 Mojeek trials have all three controls valid, so no paired or unique match can be established | +| 4. ≥3 distinct Mojeek pairs over ≥2 datasets, ≥1 unique | **Fail** | 1 pair (`fever`), 0 unique | +| 5. Report per-arm counts, matches, hit@10, recall, latency, limitations | Pass | Above, and the reports themselves | + +Defaults remain `[duckduckgo, brave, yahoo]`; Mojeek remains disabled. No production configuration, +test, or user-facing default documentation was changed. + +## Findings + +1. **The refusal was protocol-induced.** Under pacing, Mojeek refused nothing: 18/18 valid against + M008's 5/18. That confirms the M009 premise — the earlier `403`s tracked request pressure and a + query-keyed rule, not a blocked network or a client identity. +2. **Held-out contribution is weak on this sample.** One distinct query/document pair against four + each for DuckDuckGo and Brave, and no pair across a second dataset family. This is a minimum + evidence floor that was not met, not a claim that Mojeek lacks value. +3. **Condition 3 is unsatisfiable in this candidate class.** Yahoo is a shipped default that answers + `500` to every HTML request and is served only by the browser escalation path, which + `--no-default-features` removes. A browser-free keyless candidate therefore cannot produce the + paired control coverage the gate requires — the same structural reason M008 could not pass. The + gate, not Mojeek, is the binding constraint here. + +## Limitations + +- The working tree was dirty at build time: the release binary carries the uncommitted M049 + classification change (`src/meta/engines/mojeek.rs`) and the M009 runner protocol change. The + reported source SHA identifies the commit, not the exact built tree, so this is not an + exact-candidate qualification. The classification change affects labelling only, and Mojeek + produced no refusal to label. +- Three queries per dataset and two repetitions is a small sample; the runner scores only URL or + normalized-title matches against positive qrels, so unjudged results are not irrelevant. +- One egress, one run, one host; cache state is uncontrolled. +- Pacing bounds are an engineering choice, not a measured optimum. A slower or faster protocol could + change refusal behaviour. + +## Checks + +- `python3 -m unittest scripts/test_retrieval_quality_runner.py`: 9 tests pass (schedule determinism, + interval bounds, status extraction from both message shapes, blocked detection, abort rule, legacy + unpaced behaviour). +- `./packaging/check-contract.sh`: `planning-consistency: ok`, `packaged-assets: ok`. +- `git diff --check`: clean. + +## Next + +Condition 3 cannot pass without either a browser-enabled candidate, in which Yahoo and Brave can be +served, or a predeclared control set that excludes providers structurally unable to answer in the +tested configuration. Either change is a gate-design decision and needs its own registered milestone; +this record does not assume one. diff --git a/plans/closure/retrieval-quality-evidence-extension/010-status.md b/plans/closure/retrieval-quality-evidence-extension/010-status.md new file mode 100644 index 00000000..7892bf46 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/010-status.md @@ -0,0 +1,113 @@ +# M010 — Browser-Enabled Mojeek Default-Qualification Rerun Status + +Status: blocked +Recommendation: do not add Mojeek to the shipped generic defaults. +Protocol: `m010-paced-v1` (25–40 s per-attempt pacing, stop after 3 consecutive blocked) +Source SHA: `7ec251df2ba715705468f2eb1e5392fa87fc4d32` — **working tree dirty** (see Limitations) +Release CLI binary SHA-256: `5c8c65fe099f7370bcfc04fd85cb6ba717eed7c4d83dfa0fa9ae1d4d27bcc65f` (default features: `browser`, `pdf`) +Runner SHA-256: `d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f` +Qualification config SHA-256: `01e08d77178bf091707ece340bc1ac27614bfa92a0f2b9999547c653c0093530` +Host: `macOS-26.6.2-arm64-arm-64bit-Mach-O` +Window: 2026-11-23 22:17:34Z – 22:49:21Z + +## Evidence + +Twelve paced arms — DuckDuckGo, Brave, Yahoo, and Mojeek × SciFact, NQ, and FEVER × the same three +held-out queries and two repetitions (seed `m008-mojeek-default-qualification-v1`), ten results, +eighteen-second ceiling, 72 attempts, no retries. Reports: +`evidence/mojeek---m010.json`. + +| Provider | SciFact | NQ | FEVER | Valid / 18 | Distinct qrel pairs | hit@10 | micro recall@10 | latency p50 | +|---|---|---|---:|---:|---:|---:|---:|---:| +| DuckDuckGo | 6/6 | 6/6 | 6/6 | 18 | 5 | 9/18 | 9/20 | 1,002 ms | +| Brave | 6/6 | 6/6 | 6/6 | 18 | 4 | 8/18 | 8/20 | 838 ms | +| Yahoo | 6/6 | 6/6 | 6/6 | 18 | 4 | 8/18 | 8/20 | 6,028 ms | +| Mojeek | 6/6 | 6/6 | 6/6 | 18 | **1** | 2/18 | 2/20 | 1,723 ms | + +Every arm returned non-empty results for all attempts. No arm aborted; the stop rule never fired. +Pacing was honoured: minimum observed interval 25.478 s, zero declared violations, all rows carry +`planned_interval_seconds`, `actual_interval_seconds`, `started_at_utc`, and `http_status`. + +Yahoo's p50 of 6.0 s (max 7.6 s) is the browser-render cost: it answered `500` over HTTP in M009 and +is served only by SERP escalation, which this default-features candidate provides. + +## Acceptance matrix + +| Requirement | Result | Evidence | +|---|---|---| +| 1. Trial integrity: same source, binary, runner, protocol, seed, per-dataset query IDs, limit, timeout, pacing parameters; all attempts represented | Pass on report content | Twelve reports agree; 72 attempts; one config fingerprint; no credential or paid provider | +| 2. Mojeek ≥17/18 valid; ≥5/6 valid and ≥4/6 non-empty per dataset | **Pass** | 18/18 valid, 18/18 non-empty, 6/6 everywhere | +| 3. Each default ≥4/6 valid per dataset; paired uniqueness | **Fail** on uniqueness | All three controls are 18/18 and all 18 Mojeek trials have three valid controls, so pairing is established; Mojeek's single matched pair is not unique — the controls also matched it | +| 4. ≥3 distinct Mojeek pairs over ≥2 datasets, ≥1 unique | **Fail** | 1 pair (`fever:test194565` → `Kyle_MacLachlan`), one dataset family, 0 unique | +| 5. Per-arm counts, matches, hit@10, recall, latency, limitations reported | Pass | Above, and the reports | + +Defaults remain `[duckduckgo, brave, yahoo]`; Mojeek remains disabled. No production configuration, +test, or user-facing default documentation changed. + +## Findings + +1. **The M009 control failure was the candidate class, as suspected.** With `browser` included, + Yahoo went from 0/18 to 18/18 and the paired-coverage test became meaningful for the first time. +2. **Mojeek is operationally sound and contributes little on this sample.** 18/18 valid at 1.7 s p50 + — faster than the browser-rendered default — but one distinct qrel pair, 2/18 hit@10, and no + unique match. The failure is now a relevance result, not a mechanics result. +3. **The gate is intact.** Condition 4 is a minimum evidence floor that a supplementary provider with + this recall does not clear; nothing was re-tuned after seeing the numbers. +4. **A side observation, not acted on:** the shipped default Yahoo now needs browser rendering on this + egress and costs ~6 s per query. That is a default-set question of its own and is out of scope + here. + +## Limitations + +- The working tree was dirty at build time: the release binary carries the uncommitted M049 + classification change and the M009 runner protocol change. The reported source SHA names the + commit, not the exact built tree, so this is not an exact-candidate qualification. +- Browser rendering is a candidate property: results are conditional on `[fetch.browser].enabled` and + a discovered Chrome. A browser-free deployment sees M009's Yahoo behaviour. +- Three queries per dataset and two repetitions is a small sample; the runner scores only URL or + normalized-title matches against positive qrels, so unjudged results are not irrelevant. +- One egress, one run, one host; cache state is uncontrolled. M010 ran ~30 minutes after M009, a + declared deviation from M009's 24 h cooldown, with identical bounded pressure. + +## Shipping verification (2026-11-23) + +The shipped configuration was checked rather than assumed. + +- `Cargo.toml` declares `default = ["pdf", "browser"]`, and `src/core/config.rs` resolves + `fetch.browser.enabled` from `cfg!(feature = "browser")`, so browser rendering is enabled by + default in any default-feature build with no configuration at all. +- Verified live: with a config containing **no** `[fetch.browser]` section, the default-feature + release binary answered a Yahoo search with three results and no provider failures. Yahoo answers + `500` over plain HTTP on this egress, so that response can only come through the browser path. +- The generated release workflow builds every target with + `cargo build --release --locked --target --package eggsearch --bin eggsearch` and never passes + `--no-default-features`, so prebuilt binaries ship the browser. +- The single artifact without browser rendering is the Python wheel: + `bindings/python/Cargo.toml` sets `default-features = false, features = ["pdf"]`, which ADR-0014 §7 + and `docs/python-library.md` document deliberately — a wheel still needs a system Chrome, and a + wheel-local CDP client adds size and a second HTTP client at the Python process boundary. Changing + that is an ADR-level decision, not a default flip. +- `tests/static_guards.rs` gains `default_features_ship_pdf_and_browser`, which fails closed if the + default feature set loses `pdf` or `browser`, if `egress` enters it, if the browser config + default stops tracking the feature, or if a release build command starts passing + `--no-default-features`. Full suite: 69 guards pass. + +## Standing decision + +Mojeek remains disabled by default. Three gate attempts failed on three different grounds — +reachability (M008), candidate class (M009), and relevance (M010) — and the last is the substantive +one: Mojeek is reliable and fast but contributed one non-unique held-out pair. Nothing here reopens +the gate, and no further attempt is planned without a new registered milestone. + +## Checks + +- `python3 -m unittest scripts/test_retrieval_quality_runner.py`: 9 tests pass. +- `./packaging/check-repo-hygiene.sh`: `repo-hygiene: ok`. +- `./packaging/check-contract.sh`: `planning-consistency: ok`, `packaged-assets: ok`. +- `git diff --check`: clean. + +## Next + +Mojeek is reliable and cheap but contributes one non-unique held-out pair on this sample. Raising its +standing would need either a larger held-out sample that shows a contribution this one does not, or a +deliberate gate revision — neither is assumed here. No further rerun occurs within 24 h. diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-403-mechanism-controls.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-403-mechanism-controls.json new file mode 100644 index 00000000..e100e2e2 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-403-mechanism-controls.json @@ -0,0 +1,78 @@ +{ + "experiment": "mojeek-403-mechanism-controls", + "date_utc": "2026-11-23T20:49-20:58Z", + "question": "Is Mojeek's HTTP 403 caused by the egress IP, the user-agent/headers, or the query?", + "egress": { + "public_ip": "96.236.59.113", + "verified_by": [ + "in-app browser GET https://api.ipify.org/", + "curl GET https://api.ipify.org" + ], + "note": "browser and CLI resolve to the same public address, so the browser test is on the CLI egress" + }, + "controls": [ + { + "client": "in-app browser (Chromium 148 engine)", + "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) MiniMaxAgent/3.1.17 Chrome/148.0.7778.280 Electron/42.11.16 Safari/537.36", + "request": "GET /", + "outcome": "200 Mojeek homepage" + }, + { + "client": "in-app browser", + "query": "Rust programming language official website", + "outcome": "403 block page (repeatable, twice)" + }, + { + "client": "in-app browser", + "query": "test", + "outcome": "200 ALTCHA wall (div.captcha-wrap)" + }, + { + "client": "in-app browser", + "query": "the quick brown fox jumps over the lazy dog repeatedly today", + "outcome": "200 ALTCHA wall" + }, + { + "client": "in-app browser", + "query": "rust", + "outcome": "200 ALTCHA wall" + }, + { + "client": "in-app browser", + "query": "official website", + "outcome": "200 ALTCHA wall" + }, + { + "client": "in-app browser", + "query": "rust programming language", + "outcome": "200 ALTCHA wall" + }, + { + "client": "in-app browser", + "query": "which river separates the bronx in new york city from manhattan island", + "outcome": "200 ALTCHA wall (also after reload and a second identical request)" + }, + { + "client": "curl, stale Chrome/124 Windows UA", + "query": "Rust programming language official website", + "outcome": "403 block page" + }, + { + "client": "curl, current Chrome/148 macOS UA + sec-ch-ua + sec-fetch-* (HTTP/1.1)", + "query": "Rust programming language official website", + "outcome": "403 block page, byte-identical 363-byte page" + }, + { + "client": "eggsearch release client (browser-like UA, ALTCHA solver)", + "query": "which river separates the bronx in new york city from manhattan island", + "outcome": "5 real results, providers_failed empty" + }, + { + "client": "eggsearch release client with M049 fix", + "query": "Rust programming language official website", + "outcome": "error_class blocked, \"challenge page detected (your network appears to be sending automated queries) on HTTP 403\"" + } + ], + "conclusion": "The 403 is not a network-wide or user-agent-wide refusal. The same egress serves Mojeek's homepage, serves /search with the solvable ALTCHA wall for ordinary queries, and the shipped client returns real results for a held-out N8 question. The 403 tracks the query: one specific probe string is refused for every client tested, including a real Chromium engine, while changing the UA string and client hints changes nothing. Sustained automated bursts remain the documented escalation path, so the earlier M008 403s are consistent with query-keyed blocking and/or escalation caused by the cohort's own request pressure.", + "supersedes": "The earlier note in this plan and in the M008 correction that called the refusal network-scoped and reachable only through the keyed API." +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-fever-m008.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-fever-m008.json new file mode 100644 index 00000000..45fb7d35 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-fever-m008.json @@ -0,0 +1,149 @@ +{ + "schema_version": 1, + "dataset": "FEVER BEIR test", + "dataset_sha256": "4f359df04ad5a9a29c2f78009e7229d2a1c8eb0bf42d953853811373dea13305", + "dataset_archive_sha256": null, + "source_component_sha256": { + "beir_fever_queries_parquet_sha256": "b9cf00001ef1aa07a7030118490ce5f8a840e783ad8d972b9afee8ef281d6093", + "beir_fever_test_qrels_tsv_sha256": "6599dab4e2189ca5eb5216546021710c06dc8bdd1a0c59cc1fa52129c6e038b3", + "beir_fever_revision": "426aea4d30c65c041f093ae072e25fb5a0e64659", + "beir_fever_qrels_revision": "64cd0e4ef9b63a88ac8e69d1133a2f649acd4745" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "2bb24640027801e9c29f2839e1f8e84b8007a66a3ceb4cb7d489e8f4c72767d3", + "binary_sha256": "14370900e193c56273c46409b2736ff7ac795a1a4c96ddf16510c870959d56fe", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "brave", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "fever:test31743", + "fever:test120259", + "fever:test194565" + ], + "query_count": 3, + "repetitions": 2, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "provider_error": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 0, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 0, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": null, + "macro_recall_at_k_over_valid_result_trials": null, + "micro_recall_at_k_over_valid_result_trials": null, + "rows": [ + { + "query_id": "fever:test31743", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "brave", + "error_class": "blocked" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 208, + "raw_response_sha256": "727d9722343057fb62412e8f026c4f84b5fc9334d7b51ece958e6f68d9d06e54" + }, + { + "query_id": "fever:test120259", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "brave", + "error_class": "blocked" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 200, + "raw_response_sha256": "02a9dccca4d61525c56a9f7e2a0daaf36f3426a23943297a6f9e60675ace0789" + }, + { + "query_id": "fever:test194565", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "brave", + "error_class": "blocked" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 217, + "raw_response_sha256": "be5c8132f0a5ae19457c50eea77261d4b8f901bce64f11b0521daee06bee56df" + }, + { + "query_id": "fever:test31743", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "brave", + "error_class": "blocked" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 201, + "raw_response_sha256": "727d9722343057fb62412e8f026c4f84b5fc9334d7b51ece958e6f68d9d06e54" + }, + { + "query_id": "fever:test120259", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "brave", + "error_class": "blocked" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 205, + "raw_response_sha256": "02a9dccca4d61525c56a9f7e2a0daaf36f3426a23943297a6f9e60675ace0789" + }, + { + "query_id": "fever:test194565", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "brave", + "error_class": "blocked" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 246, + "raw_response_sha256": "be5c8132f0a5ae19457c50eea77261d4b8f901bce64f11b0521daee06bee56df" + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-fever-m009.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-fever-m009.json new file mode 100644 index 00000000..d46243c8 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-fever-m009.json @@ -0,0 +1,188 @@ +{ + "schema_version": 1, + "dataset": "FEVER BEIR test", + "dataset_sha256": "4f359df04ad5a9a29c2f78009e7229d2a1c8eb0bf42d953853811373dea13305", + "dataset_archive_sha256": null, + "source_component_sha256": { + "beir_fever_queries_parquet_sha256": "b9cf00001ef1aa07a7030118490ce5f8a840e783ad8d972b9afee8ef281d6093", + "beir_fever_test_qrels_tsv_sha256": "6599dab4e2189ca5eb5216546021710c06dc8bdd1a0c59cc1fa52129c6e038b3", + "beir_fever_revision": "426aea4d30c65c041f093ae072e25fb5a0e64659", + "beir_fever_qrels_revision": "64cd0e4ef9b63a88ac8e69d1133a2f649acd4745" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "fd90457efcb52aa69acccd306c9af2f4e335dc54259a447df5479bcf66e1daf2", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "brave", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "fever:test31743", + "fever:test120259", + "fever:test194565" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m009-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 25.603, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 6, + "matched_relevant_query_document_pairs_across_valid_trials": 6 + }, + "hit_at_k_over_valid_result_trials": 1.0, + "macro_recall_at_k_over_valid_result_trials": 1.0, + "micro_recall_at_k_over_valid_result_trials": 1.0, + "rows": [ + { + "query_id": "fever:test31743", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Yvonne_Strahovski", + "rank": 2 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 759, + "raw_response_sha256": "2f12c7c77522a0328ee4f52839e490270422ecb2583591814f6e45ee10dfb9f4", + "started_at_utc": "2026-11-23T21:38:41Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "fever:test120259", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Ed_Decter", + "rank": 2 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 859, + "raw_response_sha256": "4a79fe88fe30e543544520108564a54bcd59d3edd49743bcc7ba55f5af6aa7e7", + "started_at_utc": "2026-11-23T21:39:07Z", + "planned_interval_seconds": 25.593, + "actual_interval_seconds": 25.603 + }, + { + "query_id": "fever:test194565", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Kyle_MacLachlan", + "rank": 2 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 722, + "raw_response_sha256": "3fa8c42790da9bd034df6f784ce4588ae29264d8b5d7565ee6ed20973553e365", + "started_at_utc": "2026-11-23T21:39:45Z", + "planned_interval_seconds": 37.853, + "actual_interval_seconds": 37.861 + }, + { + "query_id": "fever:test31743", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Yvonne_Strahovski", + "rank": 2 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 391, + "raw_response_sha256": "2f12c7c77522a0328ee4f52839e490270422ecb2583591814f6e45ee10dfb9f4", + "started_at_utc": "2026-11-23T21:40:25Z", + "planned_interval_seconds": 39.804, + "actual_interval_seconds": 39.813 + }, + { + "query_id": "fever:test120259", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Ed_Decter", + "rank": 2 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 426, + "raw_response_sha256": "4a79fe88fe30e543544520108564a54bcd59d3edd49743bcc7ba55f5af6aa7e7", + "started_at_utc": "2026-11-23T21:40:59Z", + "planned_interval_seconds": 34.706, + "actual_interval_seconds": 34.708 + }, + { + "query_id": "fever:test194565", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Kyle_MacLachlan", + "rank": 2 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 374, + "raw_response_sha256": "3fa8c42790da9bd034df6f784ce4588ae29264d8b5d7565ee6ed20973553e365", + "started_at_utc": "2026-11-23T21:41:38Z", + "planned_interval_seconds": 38.697, + "actual_interval_seconds": 38.704 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-fever-m010.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-fever-m010.json new file mode 100644 index 00000000..27eedeba --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-fever-m010.json @@ -0,0 +1,188 @@ +{ + "schema_version": 1, + "dataset": "FEVER BEIR test", + "dataset_sha256": "4f359df04ad5a9a29c2f78009e7229d2a1c8eb0bf42d953853811373dea13305", + "dataset_archive_sha256": null, + "source_component_sha256": { + "beir_fever_queries_parquet_sha256": "b9cf00001ef1aa07a7030118490ce5f8a840e783ad8d972b9afee8ef281d6093", + "beir_fever_test_qrels_tsv_sha256": "6599dab4e2189ca5eb5216546021710c06dc8bdd1a0c59cc1fa52129c6e038b3", + "beir_fever_revision": "426aea4d30c65c041f093ae072e25fb5a0e64659", + "beir_fever_qrels_revision": "64cd0e4ef9b63a88ac8e69d1133a2f649acd4745" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "5c8c65fe099f7370bcfc04fd85cb6ba717eed7c4d83dfa0fa9ae1d4d27bcc65f", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "brave", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "01e08d77178bf091707ece340bc1ac27614bfa92a0f2b9999547c653c0093530", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "fever:test31743", + "fever:test120259", + "fever:test194565" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m010-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 25.692, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 6, + "matched_relevant_query_document_pairs_across_valid_trials": 6 + }, + "hit_at_k_over_valid_result_trials": 1.0, + "macro_recall_at_k_over_valid_result_trials": 1.0, + "micro_recall_at_k_over_valid_result_trials": 1.0, + "rows": [ + { + "query_id": "fever:test31743", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Yvonne_Strahovski", + "rank": 2 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 776, + "raw_response_sha256": "2f12c7c77522a0328ee4f52839e490270422ecb2583591814f6e45ee10dfb9f4", + "started_at_utc": "2026-11-23T22:41:21Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "fever:test120259", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Ed_Decter", + "rank": 2 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 910, + "raw_response_sha256": "7ebca4182ad2579be96001217aa0debc429af0461cbdb28b64b1572a701361f1", + "started_at_utc": "2026-11-23T22:42:00Z", + "planned_interval_seconds": 38.325, + "actual_interval_seconds": 38.327 + }, + { + "query_id": "fever:test194565", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Kyle_MacLachlan", + "rank": 2 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 796, + "raw_response_sha256": "cc356636aea691d44010e22770e955db9c3061bd2b26eba550e99bf8cd111afc", + "started_at_utc": "2026-11-23T22:42:30Z", + "planned_interval_seconds": 30.237, + "actual_interval_seconds": 30.242 + }, + { + "query_id": "fever:test31743", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Yvonne_Strahovski", + "rank": 2 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 464, + "raw_response_sha256": "2f12c7c77522a0328ee4f52839e490270422ecb2583591814f6e45ee10dfb9f4", + "started_at_utc": "2026-11-23T22:43:01Z", + "planned_interval_seconds": 31.448, + "actual_interval_seconds": 31.452 + }, + { + "query_id": "fever:test120259", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Ed_Decter", + "rank": 2 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 739, + "raw_response_sha256": "7ebca4182ad2579be96001217aa0debc429af0461cbdb28b64b1572a701361f1", + "started_at_utc": "2026-11-23T22:43:27Z", + "planned_interval_seconds": 25.687, + "actual_interval_seconds": 25.692 + }, + { + "query_id": "fever:test194565", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Kyle_MacLachlan", + "rank": 2 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 502, + "raw_response_sha256": "cc356636aea691d44010e22770e955db9c3061bd2b26eba550e99bf8cd111afc", + "started_at_utc": "2026-11-23T22:44:00Z", + "planned_interval_seconds": 32.575, + "actual_interval_seconds": 32.58 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-nq-m008.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-nq-m008.json new file mode 100644 index 00000000..93fb72cb --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-nq-m008.json @@ -0,0 +1,142 @@ +{ + "schema_version": 1, + "dataset": "Natural Questions BEIR test", + "dataset_sha256": "76f3240642b95adaccc4a0e6cb7ef75776ec105e6763585f37ade994663673ed", + "dataset_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752", + "source_component_sha256": { + "beir_nq_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "2bb24640027801e9c29f2839e1f8e84b8007a66a3ceb4cb7d489e8f4c72767d3", + "binary_sha256": "14370900e193c56273c46409b2736ff7ac795a1a4c96ddf16510c870959d56fe", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "brave", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "nq:test2352", + "nq:test1742", + "nq:test2376" + ], + "query_count": 3, + "repetitions": 2, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "provider_error": 4, + "results": 2 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 2, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 2, + "matched_relevant_query_document_pairs_across_valid_trials": 1 + }, + "hit_at_k_over_valid_result_trials": 0.5, + "macro_recall_at_k_over_valid_result_trials": 0.5, + "micro_recall_at_k_over_valid_result_trials": 0.5, + "rows": [ + { + "query_id": "nq:test2352", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 946, + "raw_response_sha256": "5813a40f53396740dfa3d8ad4f1036e52495b3db142a4940997a82cead95f291" + }, + { + "query_id": "nq:test1742", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "doc61640", + "rank": 4 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 766, + "raw_response_sha256": "530acdcfb7ddd0aa4aad9dd891e57cd961c906835a3968b35f7b3e58232ba561" + }, + { + "query_id": "nq:test2376", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "brave", + "error_class": "blocked" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 228, + "raw_response_sha256": "8da159d52509123a7b903a84aee02d29193758c8d84cc27bc648787390f12de8" + }, + { + "query_id": "nq:test2352", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "brave", + "error_class": "blocked" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 261, + "raw_response_sha256": "be926d0198ab68b0495b17200743b65393934e5b056a3fec327129a77ce9fa79" + }, + { + "query_id": "nq:test1742", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "brave", + "error_class": "blocked" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 211, + "raw_response_sha256": "0164da9ddf6972a70a638fbbe82c4344e8055484351baacdf3e64e160c7a7a53" + }, + { + "query_id": "nq:test2376", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "brave", + "error_class": "blocked" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 216, + "raw_response_sha256": "8da159d52509123a7b903a84aee02d29193758c8d84cc27bc648787390f12de8" + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-nq-m009.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-nq-m009.json new file mode 100644 index 00000000..62c17dd9 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-nq-m009.json @@ -0,0 +1,165 @@ +{ + "schema_version": 1, + "dataset": "Natural Questions BEIR test", + "dataset_sha256": "76f3240642b95adaccc4a0e6cb7ef75776ec105e6763585f37ade994663673ed", + "dataset_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752", + "source_component_sha256": { + "beir_nq_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "fd90457efcb52aa69acccd306c9af2f4e335dc54259a447df5479bcf66e1daf2", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "brave", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "nq:test2352", + "nq:test1742", + "nq:test2376" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m009-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 26.202, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 6, + "matched_relevant_query_document_pairs_across_valid_trials": 2 + }, + "hit_at_k_over_valid_result_trials": 0.3333333333333333, + "macro_recall_at_k_over_valid_result_trials": 0.3333333333333333, + "micro_recall_at_k_over_valid_result_trials": 0.3333333333333333, + "rows": [ + { + "query_id": "nq:test2352", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 917, + "raw_response_sha256": "d502ecb1a7ebc6b5afc64db027c4d8b4dbc3103dfc6ffeb9e1abec2d59b4f80d", + "started_at_utc": "2026-11-23T21:27:35Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "nq:test1742", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "doc61640", + "rank": 4 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 889, + "raw_response_sha256": "747b3bb64d9bc00e0e4617a558f8185d565ffa21ff03118250ff567e264c5084", + "started_at_utc": "2026-11-23T21:28:07Z", + "planned_interval_seconds": 32.202, + "actual_interval_seconds": 32.206 + }, + { + "query_id": "nq:test2376", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 814, + "raw_response_sha256": "fa4aaf7283ea79771313ebfa93872f616965ddb849ee8ebbc254f1ed53cbfcb2", + "started_at_utc": "2026-11-23T21:28:35Z", + "planned_interval_seconds": 27.096, + "actual_interval_seconds": 27.105 + }, + { + "query_id": "nq:test2352", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 642, + "raw_response_sha256": "d502ecb1a7ebc6b5afc64db027c4d8b4dbc3103dfc6ffeb9e1abec2d59b4f80d", + "started_at_utc": "2026-11-23T21:29:15Z", + "planned_interval_seconds": 39.948, + "actual_interval_seconds": 39.956 + }, + { + "query_id": "nq:test1742", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "doc61640", + "rank": 4 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 543, + "raw_response_sha256": "747b3bb64d9bc00e0e4617a558f8185d565ffa21ff03118250ff567e264c5084", + "started_at_utc": "2026-11-23T21:29:41Z", + "planned_interval_seconds": 26.195, + "actual_interval_seconds": 26.202 + }, + { + "query_id": "nq:test2376", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 401, + "raw_response_sha256": "fa4aaf7283ea79771313ebfa93872f616965ddb849ee8ebbc254f1ed53cbfcb2", + "started_at_utc": "2026-11-23T21:30:19Z", + "planned_interval_seconds": 38.32, + "actual_interval_seconds": 38.322 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-nq-m010.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-nq-m010.json new file mode 100644 index 00000000..6190bc92 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-nq-m010.json @@ -0,0 +1,165 @@ +{ + "schema_version": 1, + "dataset": "Natural Questions BEIR test", + "dataset_sha256": "76f3240642b95adaccc4a0e6cb7ef75776ec105e6763585f37ade994663673ed", + "dataset_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752", + "source_component_sha256": { + "beir_nq_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "5c8c65fe099f7370bcfc04fd85cb6ba717eed7c4d83dfa0fa9ae1d4d27bcc65f", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "brave", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "01e08d77178bf091707ece340bc1ac27614bfa92a0f2b9999547c653c0093530", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "nq:test2352", + "nq:test1742", + "nq:test2376" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m010-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 26.03, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 6, + "matched_relevant_query_document_pairs_across_valid_trials": 2 + }, + "hit_at_k_over_valid_result_trials": 0.3333333333333333, + "macro_recall_at_k_over_valid_result_trials": 0.3333333333333333, + "micro_recall_at_k_over_valid_result_trials": 0.3333333333333333, + "rows": [ + { + "query_id": "nq:test2352", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 972, + "raw_response_sha256": "541c2b1e7c4af86a9868c6b7f6203540b4a08a9705c852db5e572d0affe1ed53", + "started_at_utc": "2026-11-23T22:31:09Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "nq:test1742", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "doc61640", + "rank": 4 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 1612, + "raw_response_sha256": "747b3bb64d9bc00e0e4617a558f8185d565ffa21ff03118250ff567e264c5084", + "started_at_utc": "2026-11-23T22:31:36Z", + "planned_interval_seconds": 27.26, + "actual_interval_seconds": 27.268 + }, + { + "query_id": "nq:test2376", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1067, + "raw_response_sha256": "cedd8a9072c371e01629a7067fc1d104ee5d9706526eb4ff224aa867c8e21dfb", + "started_at_utc": "2026-11-23T22:32:09Z", + "planned_interval_seconds": 33.203, + "actual_interval_seconds": 33.216 + }, + { + "query_id": "nq:test2352", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 850, + "raw_response_sha256": "541c2b1e7c4af86a9868c6b7f6203540b4a08a9705c852db5e572d0affe1ed53", + "started_at_utc": "2026-11-23T22:32:35Z", + "planned_interval_seconds": 26.02, + "actual_interval_seconds": 26.03 + }, + { + "query_id": "nq:test1742", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "doc61640", + "rank": 4 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 893, + "raw_response_sha256": "747b3bb64d9bc00e0e4617a558f8185d565ffa21ff03118250ff567e264c5084", + "started_at_utc": "2026-11-23T22:33:09Z", + "planned_interval_seconds": 33.529, + "actual_interval_seconds": 33.539 + }, + { + "query_id": "nq:test2376", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 599, + "raw_response_sha256": "cedd8a9072c371e01629a7067fc1d104ee5d9706526eb4ff224aa867c8e21dfb", + "started_at_utc": "2026-11-23T22:33:39Z", + "planned_interval_seconds": 30.107, + "actual_interval_seconds": 30.112 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-scifact-m008.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-scifact-m008.json new file mode 100644 index 00000000..c946c53b --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-scifact-m008.json @@ -0,0 +1,114 @@ +{ + "schema_version": 1, + "dataset": "SciFact BEIR test", + "dataset_sha256": "40f78fb516f4a69bfc4fc13b5b4f1d7ee784638d937ccf338c6b6436934613d2", + "dataset_archive_sha256": "536e14446a0ba56ed1398ab1055f39fe852686ecad24a6306c80c490fa8e0165", + "source_component_sha256": {}, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "2bb24640027801e9c29f2839e1f8e84b8007a66a3ceb4cb7d489e8f4c72767d3", + "binary_sha256": "14370900e193c56273c46409b2736ff7ac795a1a4c96ddf16510c870959d56fe", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "brave", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "775", + "100", + "619" + ], + "query_count": 3, + "repetitions": 2, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 4, + "known_relevant_query_document_pairs_across_valid_trials": 8, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": 0, + "macro_recall_at_k_over_valid_result_trials": 0, + "micro_recall_at_k_over_valid_result_trials": 0, + "rows": [ + { + "query_id": "775", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 815, + "raw_response_sha256": "1153bb270807bc2219bd76a1ce0ac8ad2f887155f5358169b401ec626d353556" + }, + { + "query_id": "100", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 890, + "raw_response_sha256": "e233d50d1163b4172b58e36cd8c1b1f1aa1832b903d6207bde6f3e072fc39e78" + }, + { + "query_id": "619", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 852, + "raw_response_sha256": "3eb2a0ac49126999542169bc5f762bb2f74e7fcbef55afe0ae6bc002de0ade8b" + }, + { + "query_id": "775", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 405, + "raw_response_sha256": "1153bb270807bc2219bd76a1ce0ac8ad2f887155f5358169b401ec626d353556" + }, + { + "query_id": "100", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 406, + "raw_response_sha256": "e233d50d1163b4172b58e36cd8c1b1f1aa1832b903d6207bde6f3e072fc39e78" + }, + { + "query_id": "619", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 339, + "raw_response_sha256": "3eb2a0ac49126999542169bc5f762bb2f74e7fcbef55afe0ae6bc002de0ade8b" + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-scifact-m009.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-scifact-m009.json new file mode 100644 index 00000000..82ddc373 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-scifact-m009.json @@ -0,0 +1,153 @@ +{ + "schema_version": 1, + "dataset": "SciFact BEIR test", + "dataset_sha256": "40f78fb516f4a69bfc4fc13b5b4f1d7ee784638d937ccf338c6b6436934613d2", + "dataset_archive_sha256": "536e14446a0ba56ed1398ab1055f39fe852686ecad24a6306c80c490fa8e0165", + "source_component_sha256": {}, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "fd90457efcb52aa69acccd306c9af2f4e335dc54259a447df5479bcf66e1daf2", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "brave", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "775", + "100", + "619" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m009-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 27.877, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 4, + "known_relevant_query_document_pairs_across_valid_trials": 8, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": 0.0, + "macro_recall_at_k_over_valid_result_trials": 0.0, + "micro_recall_at_k_over_valid_result_trials": 0.0, + "rows": [ + { + "query_id": "775", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 788, + "raw_response_sha256": "d17ee8fa2d850786ada1083fdfa25037b1964a1481dc296476870a962df1eb9a", + "started_at_utc": "2026-11-23T21:16:13Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "100", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 917, + "raw_response_sha256": "f85e041afd0a0937f6cc92ad689673f5f914e0260905ba43814213849b0bc43a", + "started_at_utc": "2026-11-23T21:16:41Z", + "planned_interval_seconds": 27.868, + "actual_interval_seconds": 27.877 + }, + { + "query_id": "619", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 906, + "raw_response_sha256": "3eb2a0ac49126999542169bc5f762bb2f74e7fcbef55afe0ae6bc002de0ade8b", + "started_at_utc": "2026-11-23T21:17:17Z", + "planned_interval_seconds": 36.092, + "actual_interval_seconds": 36.097 + }, + { + "query_id": "775", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 436, + "raw_response_sha256": "d17ee8fa2d850786ada1083fdfa25037b1964a1481dc296476870a962df1eb9a", + "started_at_utc": "2026-11-23T21:17:47Z", + "planned_interval_seconds": 29.813, + "actual_interval_seconds": 29.819 + }, + { + "query_id": "100", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 579, + "raw_response_sha256": "f85e041afd0a0937f6cc92ad689673f5f914e0260905ba43814213849b0bc43a", + "started_at_utc": "2026-11-23T21:18:20Z", + "planned_interval_seconds": 32.927, + "actual_interval_seconds": 32.932 + }, + { + "query_id": "619", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 386, + "raw_response_sha256": "3eb2a0ac49126999542169bc5f762bb2f74e7fcbef55afe0ae6bc002de0ade8b", + "started_at_utc": "2026-11-23T21:18:50Z", + "planned_interval_seconds": 30.016, + "actual_interval_seconds": 30.019 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-scifact-m010.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-scifact-m010.json new file mode 100644 index 00000000..b97923db --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-brave-scifact-m010.json @@ -0,0 +1,153 @@ +{ + "schema_version": 1, + "dataset": "SciFact BEIR test", + "dataset_sha256": "40f78fb516f4a69bfc4fc13b5b4f1d7ee784638d937ccf338c6b6436934613d2", + "dataset_archive_sha256": "536e14446a0ba56ed1398ab1055f39fe852686ecad24a6306c80c490fa8e0165", + "source_component_sha256": {}, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "5c8c65fe099f7370bcfc04fd85cb6ba717eed7c4d83dfa0fa9ae1d4d27bcc65f", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "brave", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "01e08d77178bf091707ece340bc1ac27614bfa92a0f2b9999547c653c0093530", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "775", + "100", + "619" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m010-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 27.198, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 4, + "known_relevant_query_document_pairs_across_valid_trials": 8, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": 0.0, + "macro_recall_at_k_over_valid_result_trials": 0.0, + "micro_recall_at_k_over_valid_result_trials": 0.0, + "rows": [ + { + "query_id": "775", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 838, + "raw_response_sha256": "0dc5a01b35cf1228807b3249ef0c4598fff51b2ee2e824a07f32aa407b4bbb12", + "started_at_utc": "2026-11-23T22:20:11Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "100", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 854, + "raw_response_sha256": "f85e041afd0a0937f6cc92ad689673f5f914e0260905ba43814213849b0bc43a", + "started_at_utc": "2026-11-23T22:20:47Z", + "planned_interval_seconds": 36.705, + "actual_interval_seconds": 36.71 + }, + { + "query_id": "619", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 928, + "raw_response_sha256": "c3ffa64c8eefb979e26c0111caa967c90a644014265e6cc42fe664486fafbe28", + "started_at_utc": "2026-11-23T22:21:15Z", + "planned_interval_seconds": 27.194, + "actual_interval_seconds": 27.198 + }, + { + "query_id": "775", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 543, + "raw_response_sha256": "0dc5a01b35cf1228807b3249ef0c4598fff51b2ee2e824a07f32aa407b4bbb12", + "started_at_utc": "2026-11-23T22:21:45Z", + "planned_interval_seconds": 30.005, + "actual_interval_seconds": 30.01 + }, + { + "query_id": "100", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 452, + "raw_response_sha256": "f85e041afd0a0937f6cc92ad689673f5f914e0260905ba43814213849b0bc43a", + "started_at_utc": "2026-11-23T22:22:13Z", + "planned_interval_seconds": 28.617, + "actual_interval_seconds": 28.619 + }, + { + "query_id": "619", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 506, + "raw_response_sha256": "c3ffa64c8eefb979e26c0111caa967c90a644014265e6cc42fe664486fafbe28", + "started_at_utc": "2026-11-23T22:22:52Z", + "planned_interval_seconds": 38.457, + "actual_interval_seconds": 38.462 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-fever-m008.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-fever-m008.json new file mode 100644 index 00000000..5c9f819c --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-fever-m008.json @@ -0,0 +1,149 @@ +{ + "schema_version": 1, + "dataset": "FEVER BEIR test", + "dataset_sha256": "4f359df04ad5a9a29c2f78009e7229d2a1c8eb0bf42d953853811373dea13305", + "dataset_archive_sha256": null, + "source_component_sha256": { + "beir_fever_queries_parquet_sha256": "b9cf00001ef1aa07a7030118490ce5f8a840e783ad8d972b9afee8ef281d6093", + "beir_fever_test_qrels_tsv_sha256": "6599dab4e2189ca5eb5216546021710c06dc8bdd1a0c59cc1fa52129c6e038b3", + "beir_fever_revision": "426aea4d30c65c041f093ae072e25fb5a0e64659", + "beir_fever_qrels_revision": "64cd0e4ef9b63a88ac8e69d1133a2f649acd4745" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "2bb24640027801e9c29f2839e1f8e84b8007a66a3ceb4cb7d489e8f4c72767d3", + "binary_sha256": "14370900e193c56273c46409b2736ff7ac795a1a4c96ddf16510c870959d56fe", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "duckduckgo", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "fever:test31743", + "fever:test120259", + "fever:test194565" + ], + "query_count": 3, + "repetitions": 2, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "provider_error": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 0, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 0, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": null, + "macro_recall_at_k_over_valid_result_trials": null, + "micro_recall_at_k_over_valid_result_trials": null, + "rows": [ + { + "query_id": "fever:test31743", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "duckduckgo", + "error_class": "blocked" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 239, + "raw_response_sha256": "423fe71dd5f3519809fed602de723d5d12e2864a49f0f7685930c49646590803" + }, + { + "query_id": "fever:test120259", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "duckduckgo", + "error_class": "blocked" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 215, + "raw_response_sha256": "85759e856c15e71e3ff77ce5dec2189fbac16205681970797ce4b1d49f68d545" + }, + { + "query_id": "fever:test194565", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "duckduckgo", + "error_class": "blocked" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 292, + "raw_response_sha256": "0254871783fbd41a08318296bf871a0a3ea503007663d124a6b5f3c3fa4a4d99" + }, + { + "query_id": "fever:test31743", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "duckduckgo", + "error_class": "blocked" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 236, + "raw_response_sha256": "423fe71dd5f3519809fed602de723d5d12e2864a49f0f7685930c49646590803" + }, + { + "query_id": "fever:test120259", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "duckduckgo", + "error_class": "blocked" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 237, + "raw_response_sha256": "85759e856c15e71e3ff77ce5dec2189fbac16205681970797ce4b1d49f68d545" + }, + { + "query_id": "fever:test194565", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "duckduckgo", + "error_class": "blocked" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 225, + "raw_response_sha256": "0254871783fbd41a08318296bf871a0a3ea503007663d124a6b5f3c3fa4a4d99" + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-fever-m009.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-fever-m009.json new file mode 100644 index 00000000..b23c48ca --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-fever-m009.json @@ -0,0 +1,188 @@ +{ + "schema_version": 1, + "dataset": "FEVER BEIR test", + "dataset_sha256": "4f359df04ad5a9a29c2f78009e7229d2a1c8eb0bf42d953853811373dea13305", + "dataset_archive_sha256": null, + "source_component_sha256": { + "beir_fever_queries_parquet_sha256": "b9cf00001ef1aa07a7030118490ce5f8a840e783ad8d972b9afee8ef281d6093", + "beir_fever_test_qrels_tsv_sha256": "6599dab4e2189ca5eb5216546021710c06dc8bdd1a0c59cc1fa52129c6e038b3", + "beir_fever_revision": "426aea4d30c65c041f093ae072e25fb5a0e64659", + "beir_fever_qrels_revision": "64cd0e4ef9b63a88ac8e69d1133a2f649acd4745" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "fd90457efcb52aa69acccd306c9af2f4e335dc54259a447df5479bcf66e1daf2", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "duckduckgo", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "fever:test31743", + "fever:test120259", + "fever:test194565" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m009-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 28.541, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 6, + "matched_relevant_query_document_pairs_across_valid_trials": 6 + }, + "hit_at_k_over_valid_result_trials": 1.0, + "macro_recall_at_k_over_valid_result_trials": 1.0, + "micro_recall_at_k_over_valid_result_trials": 1.0, + "rows": [ + { + "query_id": "fever:test31743", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Yvonne_Strahovski", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 870, + "raw_response_sha256": "8ba63c7da0408895f3a647b42d315a561dd94ef8ae50bae936ca1353c56acdf1", + "started_at_utc": "2026-11-23T21:35:57Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "fever:test120259", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Ed_Decter", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 1051, + "raw_response_sha256": "9b244fed392b74d9cb6eaec511e7a0ff5d8d281482649b3a983a64b460c2c01a", + "started_at_utc": "2026-11-23T21:36:26Z", + "planned_interval_seconds": 28.537, + "actual_interval_seconds": 28.541 + }, + { + "query_id": "fever:test194565", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Kyle_MacLachlan", + "rank": 2 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 982, + "raw_response_sha256": "60ca1d762e9067b032601c7a0d9d662695fd96d9e9d86a89e5691cf76234b0b3", + "started_at_utc": "2026-11-23T21:37:03Z", + "planned_interval_seconds": 37.473, + "actual_interval_seconds": 37.484 + }, + { + "query_id": "fever:test31743", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Yvonne_Strahovski", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 882, + "raw_response_sha256": "33d8c90e45b2af8a0b5a9611a3b8d5391f964da5f0a1b23485787e1642d77abe", + "started_at_utc": "2026-11-23T21:37:33Z", + "planned_interval_seconds": 29.871, + "actual_interval_seconds": 29.878 + }, + { + "query_id": "fever:test120259", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Ed_Decter", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 950, + "raw_response_sha256": "9b244fed392b74d9cb6eaec511e7a0ff5d8d281482649b3a983a64b460c2c01a", + "started_at_utc": "2026-11-23T21:38:04Z", + "planned_interval_seconds": 30.568, + "actual_interval_seconds": 30.578 + }, + { + "query_id": "fever:test194565", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Kyle_MacLachlan", + "rank": 2 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 931, + "raw_response_sha256": "60ca1d762e9067b032601c7a0d9d662695fd96d9e9d86a89e5691cf76234b0b3", + "started_at_utc": "2026-11-23T21:38:40Z", + "planned_interval_seconds": 36.379, + "actual_interval_seconds": 36.38 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-fever-m010.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-fever-m010.json new file mode 100644 index 00000000..188ec39f --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-fever-m010.json @@ -0,0 +1,188 @@ +{ + "schema_version": 1, + "dataset": "FEVER BEIR test", + "dataset_sha256": "4f359df04ad5a9a29c2f78009e7229d2a1c8eb0bf42d953853811373dea13305", + "dataset_archive_sha256": null, + "source_component_sha256": { + "beir_fever_queries_parquet_sha256": "b9cf00001ef1aa07a7030118490ce5f8a840e783ad8d972b9afee8ef281d6093", + "beir_fever_test_qrels_tsv_sha256": "6599dab4e2189ca5eb5216546021710c06dc8bdd1a0c59cc1fa52129c6e038b3", + "beir_fever_revision": "426aea4d30c65c041f093ae072e25fb5a0e64659", + "beir_fever_qrels_revision": "64cd0e4ef9b63a88ac8e69d1133a2f649acd4745" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "5c8c65fe099f7370bcfc04fd85cb6ba717eed7c4d83dfa0fa9ae1d4d27bcc65f", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "duckduckgo", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "01e08d77178bf091707ece340bc1ac27614bfa92a0f2b9999547c653c0093530", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "fever:test31743", + "fever:test120259", + "fever:test194565" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m010-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 25.765, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 6, + "matched_relevant_query_document_pairs_across_valid_trials": 6 + }, + "hit_at_k_over_valid_result_trials": 1.0, + "macro_recall_at_k_over_valid_result_trials": 1.0, + "micro_recall_at_k_over_valid_result_trials": 1.0, + "rows": [ + { + "query_id": "fever:test31743", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 9, + "matched_relevant_documents": [ + { + "corpus_id": "Yvonne_Strahovski", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 1021, + "raw_response_sha256": "e09cb77570bd07872e8afed016636e223bba7132f42a3c002e74f5cac07910ce", + "started_at_utc": "2026-11-23T22:38:41Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "fever:test120259", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Ed_Decter", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 1002, + "raw_response_sha256": "62c4a692eddccaedb938dc0b880484bfc2db7a4ec9d923607c491055f23012e3", + "started_at_utc": "2026-11-23T22:39:20Z", + "planned_interval_seconds": 39.067, + "actual_interval_seconds": 39.068 + }, + { + "query_id": "fever:test194565", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Kyle_MacLachlan", + "rank": 2 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 1058, + "raw_response_sha256": "30bdba79eefce0a1514a257c88de2b5c02cd7719c0d2abf792ff4db9eba7143d", + "started_at_utc": "2026-11-23T22:39:51Z", + "planned_interval_seconds": 30.433, + "actual_interval_seconds": 30.437 + }, + { + "query_id": "fever:test31743", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Yvonne_Strahovski", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 912, + "raw_response_sha256": "1198ae60d26e257e346dad8ba2a62a0edac4e0f4b3b23c144add412a960cd73e", + "started_at_utc": "2026-11-23T22:40:17Z", + "planned_interval_seconds": 26.491, + "actual_interval_seconds": 26.497 + }, + { + "query_id": "fever:test120259", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Ed_Decter", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 957, + "raw_response_sha256": "9b244fed392b74d9cb6eaec511e7a0ff5d8d281482649b3a983a64b460c2c01a", + "started_at_utc": "2026-11-23T22:40:43Z", + "planned_interval_seconds": 25.763, + "actual_interval_seconds": 25.765 + }, + { + "query_id": "fever:test194565", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Kyle_MacLachlan", + "rank": 2 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 1008, + "raw_response_sha256": "94e774343d55b4a2818f0667a3a3e0a466ec9380ebc9fba8208308b711544195", + "started_at_utc": "2026-11-23T22:41:20Z", + "planned_interval_seconds": 36.847, + "actual_interval_seconds": 36.849 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-nq-m008.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-nq-m008.json new file mode 100644 index 00000000..e73aef45 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-nq-m008.json @@ -0,0 +1,132 @@ +{ + "schema_version": 1, + "dataset": "Natural Questions BEIR test", + "dataset_sha256": "76f3240642b95adaccc4a0e6cb7ef75776ec105e6763585f37ade994663673ed", + "dataset_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752", + "source_component_sha256": { + "beir_nq_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "2bb24640027801e9c29f2839e1f8e84b8007a66a3ceb4cb7d489e8f4c72767d3", + "binary_sha256": "14370900e193c56273c46409b2736ff7ac795a1a4c96ddf16510c870959d56fe", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "duckduckgo", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "nq:test2352", + "nq:test1742", + "nq:test2376" + ], + "query_count": 3, + "repetitions": 2, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "provider_error": 2, + "results": 4 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 4, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 4, + "matched_relevant_query_document_pairs_across_valid_trials": 1 + }, + "hit_at_k_over_valid_result_trials": 0.25, + "macro_recall_at_k_over_valid_result_trials": 0.25, + "micro_recall_at_k_over_valid_result_trials": 0.25, + "rows": [ + { + "query_id": "nq:test2352", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "result_count": 8, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 781, + "raw_response_sha256": "0e9d73b4abddd529ed12df99c3b99eefd7743b2d3cf5fe5d3dee37f318752a95" + }, + { + "query_id": "nq:test1742", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "doc61640", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 1037, + "raw_response_sha256": "375459c899e731cf234d73b20db0b51f2f335293e2f2093bb83538b30f1f5089" + }, + { + "query_id": "nq:test2376", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 769, + "raw_response_sha256": "e4e7d482b44852f7c97f54adc8665766d1fd41e806dbb39644b3aa4890923daa" + }, + { + "query_id": "nq:test2352", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "result_count": 8, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 816, + "raw_response_sha256": "aa0705e502b70606f4c628a46d1e0cfb439f63c659817931e839849a696fd533" + }, + { + "query_id": "nq:test1742", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "duckduckgo", + "error_class": "blocked" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 247, + "raw_response_sha256": "d73a770fb210b2ab3e7f03e9d617a51893d25c5f80d33f7c926f4d07ae307c1d" + }, + { + "query_id": "nq:test2376", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "duckduckgo", + "error_class": "blocked" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 270, + "raw_response_sha256": "91ac660083aa804838dc620bb06171498dc2549ed7c7c008bfb534340946711d" + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-nq-m009.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-nq-m009.json new file mode 100644 index 00000000..62ee9c8b --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-nq-m009.json @@ -0,0 +1,165 @@ +{ + "schema_version": 1, + "dataset": "Natural Questions BEIR test", + "dataset_sha256": "76f3240642b95adaccc4a0e6cb7ef75776ec105e6763585f37ade994663673ed", + "dataset_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752", + "source_component_sha256": { + "beir_nq_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "fd90457efcb52aa69acccd306c9af2f4e335dc54259a447df5479bcf66e1daf2", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "duckduckgo", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "nq:test2352", + "nq:test1742", + "nq:test2376" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m009-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 25.228, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 6, + "matched_relevant_query_document_pairs_across_valid_trials": 2 + }, + "hit_at_k_over_valid_result_trials": 0.3333333333333333, + "macro_recall_at_k_over_valid_result_trials": 0.3333333333333333, + "micro_recall_at_k_over_valid_result_trials": 0.3333333333333333, + "rows": [ + { + "query_id": "nq:test2352", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 8, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 847, + "raw_response_sha256": "56c49d18e8506c5868b3e8cc0dc6574044f410856a3dd96ec8213962a0c877e8", + "started_at_utc": "2026-11-23T21:24:40Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "nq:test1742", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "doc61640", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 1003, + "raw_response_sha256": "c846cd50437aac499c37320a907772328880886db125d222c92987bcc4a2aeba", + "started_at_utc": "2026-11-23T21:25:06Z", + "planned_interval_seconds": 25.224, + "actual_interval_seconds": 25.228 + }, + { + "query_id": "nq:test2376", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 911, + "raw_response_sha256": "d9e81f4484d348a2cf48b0113b7b305792758c01735cdba29bcaba8795d00a3d", + "started_at_utc": "2026-11-23T21:25:40Z", + "planned_interval_seconds": 34.823, + "actual_interval_seconds": 34.833 + }, + { + "query_id": "nq:test2352", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 8, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1010, + "raw_response_sha256": "fda36d5597f094363d9ce5793f2c256dc458ddde4534929ffc262b31481d584a", + "started_at_utc": "2026-11-23T21:26:20Z", + "planned_interval_seconds": 39.801, + "actual_interval_seconds": 39.802 + }, + { + "query_id": "nq:test1742", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "doc61640", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 919, + "raw_response_sha256": "9bcb3a7acce84810b6de6e847a7041913c2869a7627b1ff0e0fb6778dfe40a70", + "started_at_utc": "2026-11-23T21:26:57Z", + "planned_interval_seconds": 37.234, + "actual_interval_seconds": 37.236 + }, + { + "query_id": "nq:test2376", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 825, + "raw_response_sha256": "c5eff9368310e5f39f43c62eadee5881cb8e5f804e7a06855babbe37ea370045", + "started_at_utc": "2026-11-23T21:27:34Z", + "planned_interval_seconds": 36.883, + "actual_interval_seconds": 36.886 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-nq-m010.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-nq-m010.json new file mode 100644 index 00000000..7ffbb9ec --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-nq-m010.json @@ -0,0 +1,170 @@ +{ + "schema_version": 1, + "dataset": "Natural Questions BEIR test", + "dataset_sha256": "76f3240642b95adaccc4a0e6cb7ef75776ec105e6763585f37ade994663673ed", + "dataset_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752", + "source_component_sha256": { + "beir_nq_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "5c8c65fe099f7370bcfc04fd85cb6ba717eed7c4d83dfa0fa9ae1d4d27bcc65f", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "duckduckgo", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "01e08d77178bf091707ece340bc1ac27614bfa92a0f2b9999547c653c0093530", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "nq:test2352", + "nq:test1742", + "nq:test2376" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m010-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 30.378, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 6, + "matched_relevant_query_document_pairs_across_valid_trials": 3 + }, + "hit_at_k_over_valid_result_trials": 0.5, + "macro_recall_at_k_over_valid_result_trials": 0.5, + "micro_recall_at_k_over_valid_result_trials": 0.5, + "rows": [ + { + "query_id": "nq:test2352", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 9, + "matched_relevant_documents": [ + { + "corpus_id": "doc81267", + "rank": 7 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 867, + "raw_response_sha256": "105ee5d52668e68c462e79adbb9abdf23fccb118a6236162d81505ae7b9ae057", + "started_at_utc": "2026-11-23T22:28:18Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "nq:test1742", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "doc61640", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 866, + "raw_response_sha256": "a1b409e9811ee59097acf0a51f2bba5fcac72e4e3a71a7e95427f84a41916d68", + "started_at_utc": "2026-11-23T22:28:55Z", + "planned_interval_seconds": 37.682, + "actual_interval_seconds": 37.685 + }, + { + "query_id": "nq:test2376", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 975, + "raw_response_sha256": "195fa3e8a965eb13ba49a6b9f93a61e08df95ab36cb439855d9885d2e666fb21", + "started_at_utc": "2026-11-23T22:29:27Z", + "planned_interval_seconds": 31.466, + "actual_interval_seconds": 31.467 + }, + { + "query_id": "nq:test2352", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 8, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1016, + "raw_response_sha256": "11327bb6672f1403a24e725201667cf6c4d30ed7235844e5d978a69f56ff1231", + "started_at_utc": "2026-11-23T22:29:57Z", + "planned_interval_seconds": 30.371, + "actual_interval_seconds": 30.378 + }, + { + "query_id": "nq:test1742", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "doc61640", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 975, + "raw_response_sha256": "172f32001d9d9ca3580c8e0e0221a77a2d5ed0ff69645838556fca35b35c3531", + "started_at_utc": "2026-11-23T22:30:33Z", + "planned_interval_seconds": 35.8, + "actual_interval_seconds": 35.804 + }, + { + "query_id": "nq:test2376", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 932, + "raw_response_sha256": "6342566e7a115ef016b174b94978cf625d6691379a8d99b86d6b9292bf344e4d", + "started_at_utc": "2026-11-23T22:31:08Z", + "planned_interval_seconds": 34.649, + "actual_interval_seconds": 34.656 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-scifact-m008.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-scifact-m008.json new file mode 100644 index 00000000..182a6b9f --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-scifact-m008.json @@ -0,0 +1,114 @@ +{ + "schema_version": 1, + "dataset": "SciFact BEIR test", + "dataset_sha256": "40f78fb516f4a69bfc4fc13b5b4f1d7ee784638d937ccf338c6b6436934613d2", + "dataset_archive_sha256": "536e14446a0ba56ed1398ab1055f39fe852686ecad24a6306c80c490fa8e0165", + "source_component_sha256": {}, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "2bb24640027801e9c29f2839e1f8e84b8007a66a3ceb4cb7d489e8f4c72767d3", + "binary_sha256": "14370900e193c56273c46409b2736ff7ac795a1a4c96ddf16510c870959d56fe", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "duckduckgo", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "775", + "100", + "619" + ], + "query_count": 3, + "repetitions": 2, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 4, + "known_relevant_query_document_pairs_across_valid_trials": 8, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": 0, + "macro_recall_at_k_over_valid_result_trials": 0, + "micro_recall_at_k_over_valid_result_trials": 0, + "rows": [ + { + "query_id": "775", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1002, + "raw_response_sha256": "782cc5e14533a5c5f75122a168533c41913339b17d15c332859950339a756af6" + }, + { + "query_id": "100", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 799, + "raw_response_sha256": "3cdbb5404b0a887fdeac81a1ef57c26bcc74bbbf87484e5cc3370a387b3e8707" + }, + { + "query_id": "619", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 1144, + "raw_response_sha256": "b4bcaeed115577b20f112a7d2edc36e5ace8ec9f17b21a00ca58c7b5465234bc" + }, + { + "query_id": "775", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1007, + "raw_response_sha256": "6538f10a556ed15dc52e490506790f31e85b582a9a6d82f4c552d2a2206c608c" + }, + { + "query_id": "100", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 871, + "raw_response_sha256": "c0ed3ee3d6c74e6ecd659a88ffbd16795fc0a1830d0c8423e20e13a68b863122" + }, + { + "query_id": "619", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 1087, + "raw_response_sha256": "97a585038ca04294bfc87c839d76b62863d6b8d8406a6156bcda83fa557d9758" + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-scifact-m009.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-scifact-m009.json new file mode 100644 index 00000000..5ba70a3c --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-scifact-m009.json @@ -0,0 +1,153 @@ +{ + "schema_version": 1, + "dataset": "SciFact BEIR test", + "dataset_sha256": "40f78fb516f4a69bfc4fc13b5b4f1d7ee784638d937ccf338c6b6436934613d2", + "dataset_archive_sha256": "536e14446a0ba56ed1398ab1055f39fe852686ecad24a6306c80c490fa8e0165", + "source_component_sha256": {}, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "fd90457efcb52aa69acccd306c9af2f4e335dc54259a447df5479bcf66e1daf2", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "duckduckgo", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "775", + "100", + "619" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m009-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 29.029, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 4, + "known_relevant_query_document_pairs_across_valid_trials": 8, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": 0.0, + "macro_recall_at_k_over_valid_result_trials": 0.0, + "micro_recall_at_k_over_valid_result_trials": 0.0, + "rows": [ + { + "query_id": "775", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1119, + "raw_response_sha256": "0068f6f40bfcd256339b996ac3f53e6ee729e983fc65808a9dba0f6a65adebdb", + "started_at_utc": "2026-11-23T21:13:24Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "100", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 942, + "raw_response_sha256": "c8009675785e54ce86adf111e06faf4c3161ae12d8a30bfe3c05f3300f054bcb", + "started_at_utc": "2026-11-23T21:13:54Z", + "planned_interval_seconds": 29.707, + "actual_interval_seconds": 29.711 + }, + { + "query_id": "619", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 1023, + "raw_response_sha256": "34fc848c95a15841ca6b0b492c1219a9aa5ff3d48010f18e88abbdd0451bfc28", + "started_at_utc": "2026-11-23T21:14:28Z", + "planned_interval_seconds": 34.321, + "actual_interval_seconds": 34.329 + }, + { + "query_id": "775", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1116, + "raw_response_sha256": "0068f6f40bfcd256339b996ac3f53e6ee729e983fc65808a9dba0f6a65adebdb", + "started_at_utc": "2026-11-23T21:15:08Z", + "planned_interval_seconds": 39.856, + "actual_interval_seconds": 39.857 + }, + { + "query_id": "100", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 889, + "raw_response_sha256": "56cb068ed12a8dabce9b7f992b608dbfe74768c5819342ff63e2a6ca34dbc993", + "started_at_utc": "2026-11-23T21:15:37Z", + "planned_interval_seconds": 29.026, + "actual_interval_seconds": 29.029 + }, + { + "query_id": "619", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 1152, + "raw_response_sha256": "6837675fba90f63f6424e922d79fffbdf34c7018887d3b56397e399319bb7e29", + "started_at_utc": "2026-11-23T21:16:12Z", + "planned_interval_seconds": 34.92, + "actual_interval_seconds": 34.924 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-scifact-m010.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-scifact-m010.json new file mode 100644 index 00000000..e1a2b0eb --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-duckduckgo-scifact-m010.json @@ -0,0 +1,153 @@ +{ + "schema_version": 1, + "dataset": "SciFact BEIR test", + "dataset_sha256": "40f78fb516f4a69bfc4fc13b5b4f1d7ee784638d937ccf338c6b6436934613d2", + "dataset_archive_sha256": "536e14446a0ba56ed1398ab1055f39fe852686ecad24a6306c80c490fa8e0165", + "source_component_sha256": {}, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "5c8c65fe099f7370bcfc04fd85cb6ba717eed7c4d83dfa0fa9ae1d4d27bcc65f", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "duckduckgo", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "01e08d77178bf091707ece340bc1ac27614bfa92a0f2b9999547c653c0093530", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "775", + "100", + "619" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m010-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 26.007, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 4, + "known_relevant_query_document_pairs_across_valid_trials": 8, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": 0.0, + "macro_recall_at_k_over_valid_result_trials": 0.0, + "micro_recall_at_k_over_valid_result_trials": 0.0, + "rows": [ + { + "query_id": "775", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1140, + "raw_response_sha256": "d00bc2d0c759d55c65661cb3fc0a9668e1d7e6510404e79f24dc33587089e202", + "started_at_utc": "2026-11-23T22:17:34Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "100", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 961, + "raw_response_sha256": "c8009675785e54ce86adf111e06faf4c3161ae12d8a30bfe3c05f3300f054bcb", + "started_at_utc": "2026-11-23T22:18:09Z", + "planned_interval_seconds": 34.376, + "actual_interval_seconds": 34.379 + }, + { + "query_id": "619", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 1861, + "raw_response_sha256": "4652ba1210c6ad5727b9f960769e3e0d5306511ac4703038190c39567c6b2df8", + "started_at_utc": "2026-11-23T22:18:43Z", + "planned_interval_seconds": 34.121, + "actual_interval_seconds": 34.126 + }, + { + "query_id": "775", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 946, + "raw_response_sha256": "b2e743f163eb0bf617dc9892eede900a2d26c61d608ec174e618ad186ca1d9f8", + "started_at_utc": "2026-11-23T22:19:09Z", + "planned_interval_seconds": 26.002, + "actual_interval_seconds": 26.007 + }, + { + "query_id": "100", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1009, + "raw_response_sha256": "d53e5aab99029634771516ed7ecd15e8d2864321974aa38d41ef918d5debcaf9", + "started_at_utc": "2026-11-23T22:19:38Z", + "planned_interval_seconds": 28.952, + "actual_interval_seconds": 28.955 + }, + { + "query_id": "619", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 1140, + "raw_response_sha256": "280869da388f4216630984817356ad1b6a37e8d6f5a0acc132e637ea11bda10b", + "started_at_utc": "2026-11-23T22:20:09Z", + "planned_interval_seconds": 31.608, + "actual_interval_seconds": 31.612 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-fever-m008.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-fever-m008.json new file mode 100644 index 00000000..4bed7642 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-fever-m008.json @@ -0,0 +1,149 @@ +{ + "schema_version": 1, + "dataset": "FEVER BEIR test", + "dataset_sha256": "4f359df04ad5a9a29c2f78009e7229d2a1c8eb0bf42d953853811373dea13305", + "dataset_archive_sha256": null, + "source_component_sha256": { + "beir_fever_queries_parquet_sha256": "b9cf00001ef1aa07a7030118490ce5f8a840e783ad8d972b9afee8ef281d6093", + "beir_fever_test_qrels_tsv_sha256": "6599dab4e2189ca5eb5216546021710c06dc8bdd1a0c59cc1fa52129c6e038b3", + "beir_fever_revision": "426aea4d30c65c041f093ae072e25fb5a0e64659", + "beir_fever_qrels_revision": "64cd0e4ef9b63a88ac8e69d1133a2f649acd4745" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "2bb24640027801e9c29f2839e1f8e84b8007a66a3ceb4cb7d489e8f4c72767d3", + "binary_sha256": "14370900e193c56273c46409b2736ff7ac795a1a4c96ddf16510c870959d56fe", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "mojeek", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "fever:test31743", + "fever:test120259", + "fever:test194565" + ], + "query_count": 3, + "repetitions": 2, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "provider_error": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 0, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 0, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": null, + "macro_recall_at_k_over_valid_result_trials": null, + "micro_recall_at_k_over_valid_result_trials": null, + "rows": [ + { + "query_id": "fever:test31743", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "mojeek", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 408, + "raw_response_sha256": "65011b7ed332a4ebd4e15995d09468ed2ff94b26ff320653ddb373923cbdb6d1" + }, + { + "query_id": "fever:test120259", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "mojeek", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 457, + "raw_response_sha256": "735bc2f9e5af1c16d06b4c6e5692739bc059ee1f053d0fd8fe270886ef10b246" + }, + { + "query_id": "fever:test194565", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "mojeek", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 438, + "raw_response_sha256": "9974b7312bc64d4aa1dacc0cbd373dbe27f460913aceaf3ec2cc371be5803afb" + }, + { + "query_id": "fever:test31743", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "mojeek", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 437, + "raw_response_sha256": "65011b7ed332a4ebd4e15995d09468ed2ff94b26ff320653ddb373923cbdb6d1" + }, + { + "query_id": "fever:test120259", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "mojeek", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 417, + "raw_response_sha256": "735bc2f9e5af1c16d06b4c6e5692739bc059ee1f053d0fd8fe270886ef10b246" + }, + { + "query_id": "fever:test194565", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "mojeek", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 456, + "raw_response_sha256": "9974b7312bc64d4aa1dacc0cbd373dbe27f460913aceaf3ec2cc371be5803afb" + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-fever-m009.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-fever-m009.json new file mode 100644 index 00000000..27e777b5 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-fever-m009.json @@ -0,0 +1,168 @@ +{ + "schema_version": 1, + "dataset": "FEVER BEIR test", + "dataset_sha256": "4f359df04ad5a9a29c2f78009e7229d2a1c8eb0bf42d953853811373dea13305", + "dataset_archive_sha256": null, + "source_component_sha256": { + "beir_fever_queries_parquet_sha256": "b9cf00001ef1aa07a7030118490ce5f8a840e783ad8d972b9afee8ef281d6093", + "beir_fever_test_qrels_tsv_sha256": "6599dab4e2189ca5eb5216546021710c06dc8bdd1a0c59cc1fa52129c6e038b3", + "beir_fever_revision": "426aea4d30c65c041f093ae072e25fb5a0e64659", + "beir_fever_qrels_revision": "64cd0e4ef9b63a88ac8e69d1133a2f649acd4745" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "fd90457efcb52aa69acccd306c9af2f4e335dc54259a447df5479bcf66e1daf2", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "mojeek", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "fever:test31743", + "fever:test120259", + "fever:test194565" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m009-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 26.123, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 6, + "matched_relevant_query_document_pairs_across_valid_trials": 2 + }, + "hit_at_k_over_valid_result_trials": 0.3333333333333333, + "macro_recall_at_k_over_valid_result_trials": 0.3333333333333333, + "micro_recall_at_k_over_valid_result_trials": 0.3333333333333333, + "rows": [ + { + "query_id": "fever:test31743", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1949, + "raw_response_sha256": "495cd385411fc11bf9bd6a78af669f99efcfcec5e674bb167396e45e55fd9728", + "started_at_utc": "2026-11-23T21:44:18Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "fever:test120259", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 2022, + "raw_response_sha256": "76a9e59fd79decdb7a8c188ac4ef932b4bbd367d78c2b2d347edc9ba38afe935", + "started_at_utc": "2026-11-23T21:44:44Z", + "planned_interval_seconds": 26.118, + "actual_interval_seconds": 26.123 + }, + { + "query_id": "fever:test194565", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Kyle_MacLachlan", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 2116, + "raw_response_sha256": "5c1d5925a9312a535fc3d4681f8d1c0726f855ac4da8b5205227e6cc0809b67c", + "started_at_utc": "2026-11-23T21:45:23Z", + "planned_interval_seconds": 38.25, + "actual_interval_seconds": 38.256 + }, + { + "query_id": "fever:test31743", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1903, + "raw_response_sha256": "495cd385411fc11bf9bd6a78af669f99efcfcec5e674bb167396e45e55fd9728", + "started_at_utc": "2026-11-23T21:46:01Z", + "planned_interval_seconds": 37.98, + "actual_interval_seconds": 37.992 + }, + { + "query_id": "fever:test120259", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1534, + "raw_response_sha256": "76a9e59fd79decdb7a8c188ac4ef932b4bbd367d78c2b2d347edc9ba38afe935", + "started_at_utc": "2026-11-23T21:46:29Z", + "planned_interval_seconds": 28.549, + "actual_interval_seconds": 28.555 + }, + { + "query_id": "fever:test194565", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Kyle_MacLachlan", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 1607, + "raw_response_sha256": "5c1d5925a9312a535fc3d4681f8d1c0726f855ac4da8b5205227e6cc0809b67c", + "started_at_utc": "2026-11-23T21:47:01Z", + "planned_interval_seconds": 32.191, + "actual_interval_seconds": 32.198 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-fever-m010.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-fever-m010.json new file mode 100644 index 00000000..c0975a1b --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-fever-m010.json @@ -0,0 +1,168 @@ +{ + "schema_version": 1, + "dataset": "FEVER BEIR test", + "dataset_sha256": "4f359df04ad5a9a29c2f78009e7229d2a1c8eb0bf42d953853811373dea13305", + "dataset_archive_sha256": null, + "source_component_sha256": { + "beir_fever_queries_parquet_sha256": "b9cf00001ef1aa07a7030118490ce5f8a840e783ad8d972b9afee8ef281d6093", + "beir_fever_test_qrels_tsv_sha256": "6599dab4e2189ca5eb5216546021710c06dc8bdd1a0c59cc1fa52129c6e038b3", + "beir_fever_revision": "426aea4d30c65c041f093ae072e25fb5a0e64659", + "beir_fever_qrels_revision": "64cd0e4ef9b63a88ac8e69d1133a2f649acd4745" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "5c8c65fe099f7370bcfc04fd85cb6ba717eed7c4d83dfa0fa9ae1d4d27bcc65f", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "mojeek", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "01e08d77178bf091707ece340bc1ac27614bfa92a0f2b9999547c653c0093530", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "fever:test31743", + "fever:test120259", + "fever:test194565" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m010-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 26.219, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 6, + "matched_relevant_query_document_pairs_across_valid_trials": 2 + }, + "hit_at_k_over_valid_result_trials": 0.3333333333333333, + "macro_recall_at_k_over_valid_result_trials": 0.3333333333333333, + "micro_recall_at_k_over_valid_result_trials": 0.3333333333333333, + "rows": [ + { + "query_id": "fever:test31743", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1631, + "raw_response_sha256": "495cd385411fc11bf9bd6a78af669f99efcfcec5e674bb167396e45e55fd9728", + "started_at_utc": "2026-11-23T22:46:43Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "fever:test120259", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1723, + "raw_response_sha256": "76a9e59fd79decdb7a8c188ac4ef932b4bbd367d78c2b2d347edc9ba38afe935", + "started_at_utc": "2026-11-23T22:47:14Z", + "planned_interval_seconds": 31.358, + "actual_interval_seconds": 31.363 + }, + { + "query_id": "fever:test194565", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Kyle_MacLachlan", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 1660, + "raw_response_sha256": "5c1d5925a9312a535fc3d4681f8d1c0726f855ac4da8b5205227e6cc0809b67c", + "started_at_utc": "2026-11-23T22:47:50Z", + "planned_interval_seconds": 36.02, + "actual_interval_seconds": 36.024 + }, + { + "query_id": "fever:test31743", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1596, + "raw_response_sha256": "495cd385411fc11bf9bd6a78af669f99efcfcec5e674bb167396e45e55fd9728", + "started_at_utc": "2026-11-23T22:48:21Z", + "planned_interval_seconds": 31.188, + "actual_interval_seconds": 31.192 + }, + { + "query_id": "fever:test120259", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1613, + "raw_response_sha256": "76a9e59fd79decdb7a8c188ac4ef932b4bbd367d78c2b2d347edc9ba38afe935", + "started_at_utc": "2026-11-23T22:48:47Z", + "planned_interval_seconds": 26.215, + "actual_interval_seconds": 26.219 + }, + { + "query_id": "fever:test194565", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [ + { + "corpus_id": "Kyle_MacLachlan", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 1625, + "raw_response_sha256": "5c1d5925a9312a535fc3d4681f8d1c0726f855ac4da8b5205227e6cc0809b67c", + "started_at_utc": "2026-11-23T22:49:20Z", + "planned_interval_seconds": 32.217, + "actual_interval_seconds": 32.22 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-nq-m008.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-nq-m008.json new file mode 100644 index 00000000..3b5631d9 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-nq-m008.json @@ -0,0 +1,146 @@ +{ + "schema_version": 1, + "dataset": "Natural Questions BEIR test", + "dataset_sha256": "76f3240642b95adaccc4a0e6cb7ef75776ec105e6763585f37ade994663673ed", + "dataset_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752", + "source_component_sha256": { + "beir_nq_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "2bb24640027801e9c29f2839e1f8e84b8007a66a3ceb4cb7d489e8f4c72767d3", + "binary_sha256": "14370900e193c56273c46409b2736ff7ac795a1a4c96ddf16510c870959d56fe", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "mojeek", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "nq:test2352", + "nq:test1742", + "nq:test2376" + ], + "query_count": 3, + "repetitions": 2, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "provider_error": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 0, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 0, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": null, + "macro_recall_at_k_over_valid_result_trials": null, + "micro_recall_at_k_over_valid_result_trials": null, + "rows": [ + { + "query_id": "nq:test2352", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "mojeek", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 393, + "raw_response_sha256": "31155370ceb0a12c354d759050ebb427aacec6a83ef9cf936fb32f1be57428a1" + }, + { + "query_id": "nq:test1742", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "mojeek", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 402, + "raw_response_sha256": "75370cb885af8d2b3aff4b728ddbc7acd3a555ffcac2e3a65732a175f7f0534b" + }, + { + "query_id": "nq:test2376", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "mojeek", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 528, + "raw_response_sha256": "4e3ebcb2382d148761403a0f87455c7f78b0cfe20d9137b027725166271b9a23" + }, + { + "query_id": "nq:test2352", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "mojeek", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 417, + "raw_response_sha256": "31155370ceb0a12c354d759050ebb427aacec6a83ef9cf936fb32f1be57428a1" + }, + { + "query_id": "nq:test1742", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "mojeek", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 395, + "raw_response_sha256": "75370cb885af8d2b3aff4b728ddbc7acd3a555ffcac2e3a65732a175f7f0534b" + }, + { + "query_id": "nq:test2376", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "mojeek", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 419, + "raw_response_sha256": "4e3ebcb2382d148761403a0f87455c7f78b0cfe20d9137b027725166271b9a23" + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-nq-m009.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-nq-m009.json new file mode 100644 index 00000000..2ece0b9c --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-nq-m009.json @@ -0,0 +1,155 @@ +{ + "schema_version": 1, + "dataset": "Natural Questions BEIR test", + "dataset_sha256": "76f3240642b95adaccc4a0e6cb7ef75776ec105e6763585f37ade994663673ed", + "dataset_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752", + "source_component_sha256": { + "beir_nq_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "fd90457efcb52aa69acccd306c9af2f4e335dc54259a447df5479bcf66e1daf2", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "mojeek", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "nq:test2352", + "nq:test1742", + "nq:test2376" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m009-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 28.745, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 6, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": 0.0, + "macro_recall_at_k_over_valid_result_trials": 0.0, + "micro_recall_at_k_over_valid_result_trials": 0.0, + "rows": [ + { + "query_id": "nq:test2352", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1785, + "raw_response_sha256": "cfc08dc186179dbf5d12ea531e30207710541b0714b0ec5545388e67416b177c", + "started_at_utc": "2026-11-23T21:33:08Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "nq:test1742", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 2611, + "raw_response_sha256": "49ee00bd2ae0e54402513b0b59e02d2e25fa4deff142e26edf41c220a8201604", + "started_at_utc": "2026-11-23T21:33:38Z", + "planned_interval_seconds": 29.543, + "actual_interval_seconds": 29.551 + }, + { + "query_id": "nq:test2376", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 2700, + "raw_response_sha256": "9cf3ae72d4785fdfb538d6494d65df98f5343c933b9fd04f56fd4bb866efb9d7", + "started_at_utc": "2026-11-23T21:34:17Z", + "planned_interval_seconds": 39.721, + "actual_interval_seconds": 39.729 + }, + { + "query_id": "nq:test2352", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1552, + "raw_response_sha256": "cfc08dc186179dbf5d12ea531e30207710541b0714b0ec5545388e67416b177c", + "started_at_utc": "2026-11-23T21:34:46Z", + "planned_interval_seconds": 28.739, + "actual_interval_seconds": 28.745 + }, + { + "query_id": "nq:test1742", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1649, + "raw_response_sha256": "49ee00bd2ae0e54402513b0b59e02d2e25fa4deff142e26edf41c220a8201604", + "started_at_utc": "2026-11-23T21:35:24Z", + "planned_interval_seconds": 37.383, + "actual_interval_seconds": 37.393 + }, + { + "query_id": "nq:test2376", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1558, + "raw_response_sha256": "9cf3ae72d4785fdfb538d6494d65df98f5343c933b9fd04f56fd4bb866efb9d7", + "started_at_utc": "2026-11-23T21:35:56Z", + "planned_interval_seconds": 31.887, + "actual_interval_seconds": 31.894 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-nq-m010.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-nq-m010.json new file mode 100644 index 00000000..e4bed61d --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-nq-m010.json @@ -0,0 +1,155 @@ +{ + "schema_version": 1, + "dataset": "Natural Questions BEIR test", + "dataset_sha256": "76f3240642b95adaccc4a0e6cb7ef75776ec105e6763585f37ade994663673ed", + "dataset_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752", + "source_component_sha256": { + "beir_nq_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "5c8c65fe099f7370bcfc04fd85cb6ba717eed7c4d83dfa0fa9ae1d4d27bcc65f", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "mojeek", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "01e08d77178bf091707ece340bc1ac27614bfa92a0f2b9999547c653c0093530", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "nq:test2352", + "nq:test1742", + "nq:test2376" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m010-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 25.774, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 6, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": 0.0, + "macro_recall_at_k_over_valid_result_trials": 0.0, + "micro_recall_at_k_over_valid_result_trials": 0.0, + "rows": [ + { + "query_id": "nq:test2352", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1524, + "raw_response_sha256": "cfc08dc186179dbf5d12ea531e30207710541b0714b0ec5545388e67416b177c", + "started_at_utc": "2026-11-23T22:36:08Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "nq:test1742", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1940, + "raw_response_sha256": "49ee00bd2ae0e54402513b0b59e02d2e25fa4deff142e26edf41c220a8201604", + "started_at_utc": "2026-11-23T22:36:34Z", + "planned_interval_seconds": 25.77, + "actual_interval_seconds": 25.774 + }, + { + "query_id": "nq:test2376", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 2033, + "raw_response_sha256": "9cf3ae72d4785fdfb538d6494d65df98f5343c933b9fd04f56fd4bb866efb9d7", + "started_at_utc": "2026-11-23T22:37:04Z", + "planned_interval_seconds": 29.58, + "actual_interval_seconds": 29.583 + }, + { + "query_id": "nq:test2352", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1980, + "raw_response_sha256": "cfc08dc186179dbf5d12ea531e30207710541b0714b0ec5545388e67416b177c", + "started_at_utc": "2026-11-23T22:37:32Z", + "planned_interval_seconds": 28.315, + "actual_interval_seconds": 28.32 + }, + { + "query_id": "nq:test1742", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1816, + "raw_response_sha256": "49ee00bd2ae0e54402513b0b59e02d2e25fa4deff142e26edf41c220a8201604", + "started_at_utc": "2026-11-23T22:38:11Z", + "planned_interval_seconds": 39.307, + "actual_interval_seconds": 39.308 + }, + { + "query_id": "nq:test2376", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1675, + "raw_response_sha256": "9cf3ae72d4785fdfb538d6494d65df98f5343c933b9fd04f56fd4bb866efb9d7", + "started_at_utc": "2026-11-23T22:38:40Z", + "planned_interval_seconds": 28.333, + "actual_interval_seconds": 28.335 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-scifact-m008.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-scifact-m008.json new file mode 100644 index 00000000..c90f55a1 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-scifact-m008.json @@ -0,0 +1,120 @@ +{ + "schema_version": 1, + "dataset": "SciFact BEIR test", + "dataset_sha256": "40f78fb516f4a69bfc4fc13b5b4f1d7ee784638d937ccf338c6b6436934613d2", + "dataset_archive_sha256": "536e14446a0ba56ed1398ab1055f39fe852686ecad24a6306c80c490fa8e0165", + "source_component_sha256": {}, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "2bb24640027801e9c29f2839e1f8e84b8007a66a3ceb4cb7d489e8f4c72767d3", + "binary_sha256": "14370900e193c56273c46409b2736ff7ac795a1a4c96ddf16510c870959d56fe", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "mojeek", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "775", + "100", + "619" + ], + "query_count": 3, + "repetitions": 2, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "provider_error": 1, + "results": 5 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 5, + "known_relevant_query_document_pairs_per_cohort": 4, + "known_relevant_query_document_pairs_across_valid_trials": 6, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": 0, + "macro_recall_at_k_over_valid_result_trials": 0, + "micro_recall_at_k_over_valid_result_trials": 0, + "rows": [ + { + "query_id": "775", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "result_count": 5, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1980, + "raw_response_sha256": "1ad530103e522e8b8356e0cf598bbafa07f8eafc2bfc8442625a93f150e67306" + }, + { + "query_id": "100", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1939, + "raw_response_sha256": "6b06ad1fa2568c6e612e46cc74d579a1a9c989718aa30354efe601f0d9b67e79" + }, + { + "query_id": "619", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 1870, + "raw_response_sha256": "a698e1dee2d2157f3ed22c44ed5edc629e773bd6ac3ea7ac6597e928a9437049" + }, + { + "query_id": "775", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "result_count": 5, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1632, + "raw_response_sha256": "1ad530103e522e8b8356e0cf598bbafa07f8eafc2bfc8442625a93f150e67306" + }, + { + "query_id": "100", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1523, + "raw_response_sha256": "6b06ad1fa2568c6e612e46cc74d579a1a9c989718aa30354efe601f0d9b67e79" + }, + { + "query_id": "619", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "mojeek", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 410, + "raw_response_sha256": "1d2b1c6b6de69540b5b0a8c94a13c980fd28092eff232421f0bc58efaf0511ed" + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-scifact-m009.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-scifact-m009.json new file mode 100644 index 00000000..6118db28 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-scifact-m009.json @@ -0,0 +1,153 @@ +{ + "schema_version": 1, + "dataset": "SciFact BEIR test", + "dataset_sha256": "40f78fb516f4a69bfc4fc13b5b4f1d7ee784638d937ccf338c6b6436934613d2", + "dataset_archive_sha256": "536e14446a0ba56ed1398ab1055f39fe852686ecad24a6306c80c490fa8e0165", + "source_component_sha256": {}, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "fd90457efcb52aa69acccd306c9af2f4e335dc54259a447df5479bcf66e1daf2", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "mojeek", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "775", + "100", + "619" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m009-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 31.244, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 4, + "known_relevant_query_document_pairs_across_valid_trials": 8, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": 0.0, + "macro_recall_at_k_over_valid_result_trials": 0.0, + "micro_recall_at_k_over_valid_result_trials": 0.0, + "rows": [ + { + "query_id": "775", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 4, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1823, + "raw_response_sha256": "3f3395e4ee7617da6ad081a37c31ae273a6f5d6de55cc394bf481655887d25a8", + "started_at_utc": "2026-11-23T21:21:37Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "100", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 2109, + "raw_response_sha256": "6b06ad1fa2568c6e612e46cc74d579a1a9c989718aa30354efe601f0d9b67e79", + "started_at_utc": "2026-11-23T21:22:15Z", + "planned_interval_seconds": 38.55, + "actual_interval_seconds": 38.557 + }, + { + "query_id": "619", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 1890, + "raw_response_sha256": "a698e1dee2d2157f3ed22c44ed5edc629e773bd6ac3ea7ac6597e928a9437049", + "started_at_utc": "2026-11-23T21:22:50Z", + "planned_interval_seconds": 34.704, + "actual_interval_seconds": 34.714 + }, + { + "query_id": "775", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 4, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1679, + "raw_response_sha256": "3f3395e4ee7617da6ad081a37c31ae273a6f5d6de55cc394bf481655887d25a8", + "started_at_utc": "2026-11-23T21:23:30Z", + "planned_interval_seconds": 39.664, + "actual_interval_seconds": 39.674 + }, + { + "query_id": "100", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1542, + "raw_response_sha256": "6b06ad1fa2568c6e612e46cc74d579a1a9c989718aa30354efe601f0d9b67e79", + "started_at_utc": "2026-11-23T21:24:07Z", + "planned_interval_seconds": 37.783, + "actual_interval_seconds": 37.793 + }, + { + "query_id": "619", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 1454, + "raw_response_sha256": "a698e1dee2d2157f3ed22c44ed5edc629e773bd6ac3ea7ac6597e928a9437049", + "started_at_utc": "2026-11-23T21:24:39Z", + "planned_interval_seconds": 31.239, + "actual_interval_seconds": 31.244 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-scifact-m010.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-scifact-m010.json new file mode 100644 index 00000000..8147142e --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-mojeek-scifact-m010.json @@ -0,0 +1,153 @@ +{ + "schema_version": 1, + "dataset": "SciFact BEIR test", + "dataset_sha256": "40f78fb516f4a69bfc4fc13b5b4f1d7ee784638d937ccf338c6b6436934613d2", + "dataset_archive_sha256": "536e14446a0ba56ed1398ab1055f39fe852686ecad24a6306c80c490fa8e0165", + "source_component_sha256": {}, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "5c8c65fe099f7370bcfc04fd85cb6ba717eed7c4d83dfa0fa9ae1d4d27bcc65f", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "mojeek", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "01e08d77178bf091707ece340bc1ac27614bfa92a0f2b9999547c653c0093530", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "775", + "100", + "619" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m010-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 25.478, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 4, + "known_relevant_query_document_pairs_across_valid_trials": 8, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": 0.0, + "macro_recall_at_k_over_valid_result_trials": 0.0, + "micro_recall_at_k_over_valid_result_trials": 0.0, + "rows": [ + { + "query_id": "775", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 5, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1770, + "raw_response_sha256": "1ad530103e522e8b8356e0cf598bbafa07f8eafc2bfc8442625a93f150e67306", + "started_at_utc": "2026-11-23T22:25:41Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "100", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1882, + "raw_response_sha256": "6b06ad1fa2568c6e612e46cc74d579a1a9c989718aa30354efe601f0d9b67e79", + "started_at_utc": "2026-11-23T22:26:11Z", + "planned_interval_seconds": 30.589, + "actual_interval_seconds": 30.594 + }, + { + "query_id": "619", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 1761, + "raw_response_sha256": "a698e1dee2d2157f3ed22c44ed5edc629e773bd6ac3ea7ac6597e928a9437049", + "started_at_utc": "2026-11-23T22:26:37Z", + "planned_interval_seconds": 25.475, + "actual_interval_seconds": 25.478 + }, + { + "query_id": "775", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 5, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1688, + "raw_response_sha256": "1ad530103e522e8b8356e0cf598bbafa07f8eafc2bfc8442625a93f150e67306", + "started_at_utc": "2026-11-23T22:27:16Z", + "planned_interval_seconds": 39.203, + "actual_interval_seconds": 39.207 + }, + { + "query_id": "100", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1801, + "raw_response_sha256": "6b06ad1fa2568c6e612e46cc74d579a1a9c989718aa30354efe601f0d9b67e79", + "started_at_utc": "2026-11-23T22:27:45Z", + "planned_interval_seconds": 28.884, + "actual_interval_seconds": 28.886 + }, + { + "query_id": "619", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 10, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 1643, + "raw_response_sha256": "a698e1dee2d2157f3ed22c44ed5edc629e773bd6ac3ea7ac6597e928a9437049", + "started_at_utc": "2026-11-23T22:28:16Z", + "planned_interval_seconds": 30.695, + "actual_interval_seconds": 30.697 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-network-block-403-capture.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-network-block-403-capture.json new file mode 100644 index 00000000..f1f24c16 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-network-block-403-capture.json @@ -0,0 +1,55 @@ +{ + "capture": "mojeek-network-block-403", + "captured_at_utc": "2026-11-23T20:14:24Z", + "reason": "M008 root-cause capture and M049 classification evidence", + "request": { + "method": "GET", + "url": "https://www.mojeek.com/search?q=", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36", + "headers": { + "Accept-Language": "en-US,en;q=0.9", + "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", + "Accept-Encoding": "deflate, gzip" + }, + "bounded_by": "curl --max-time 20 --max-filesize 2000000", + "credentials": "none" + }, + "response": { + "status": 403, + "reason": "Forbidden", + "headers": { + "Content-type": "text/html; charset=UTF-8", + "X-XSS-Protection": "1; mode=block", + "X-Content-Type-Options": "nosniff", + "Referrer-Policy": "origin", + "Access-Control-Allow-Origin": "*", + "Content-Length": "363", + "Date": "Mon, 23 Nov 2026 20:14:24 GMT", + "Server": "lighttpd/1.4.53" + }, + "body_bytes": 363, + "body_sha256": "50666d78ab85d7af911166fa712af887dedcf4a2751df8927992a4d253548691", + "body": "403 - Forbidden

403 - Forbidden

Sorry your network appears to be sending automated queries so we can't process your search at this time.

If you are seeing this in error please contact us.

", + "redactions": [ + "the echoed query in the /about/contact link was removed", + "the Content-Security-Policy header is omitted as boilerplate" + ] + }, + "classification": { + "before": "EngineError::BadStatus { status: 403 }; reported as error_class http_status because send_search() returned before reading the body", + "after": "EngineError::Blocked; reason 'challenge page detected (your network appears to be sending automated queries) on HTTP 403'", + "marker": "PageMarker::Text(\"your network appears to be sending automated queries\") in mojeek.rs SHAPE.blocked_markers" + }, + "upstream_policy": { + "robots_txt": { + "url": "https://www.mojeek.com/robots.txt", + "status": 200, + "body": "# Let's treat everybody the same, bad bots will ignore it anyway.\nUser-agent: *\nDisallow: /search\nDisallow: /url\nDisallow: /focus/dashboard\nDisallow: /eval\nDisallow: /image?\n" + }, + "challenge_wall": "ALTCHA proof-of-work served with HTTP 200 at /search (div.captcha-wrap); added 2026-06-23", + "escalation": "continued automated traffic can receive the hard 403 page recorded above", + "supported_route": "https://api.mojeek.com/search with api_key (paid, PAYG)" + }, + "analysis_corrected": "The conclusion first written here ('network reputation; only a different egress or the keyed API would return results') is withdrawn. Follow-up controls on the same public address showed the 403 is query-keyed: the homepage returns 200, ordinary queries return the solvable 200 ALTCHA wall, the shipped client returns real results, and changing the user agent and client hints changes nothing. See mojeek-403-mechanism-controls.json.", + "conclusion": "The 403 is a hard, per-query automated-query refusal, not parser drift and not a solvable challenge. It is not a network-wide or user-agent-wide block." +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-fever-m008.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-fever-m008.json new file mode 100644 index 00000000..2fc60424 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-fever-m008.json @@ -0,0 +1,149 @@ +{ + "schema_version": 1, + "dataset": "FEVER BEIR test", + "dataset_sha256": "4f359df04ad5a9a29c2f78009e7229d2a1c8eb0bf42d953853811373dea13305", + "dataset_archive_sha256": null, + "source_component_sha256": { + "beir_fever_queries_parquet_sha256": "b9cf00001ef1aa07a7030118490ce5f8a840e783ad8d972b9afee8ef281d6093", + "beir_fever_test_qrels_tsv_sha256": "6599dab4e2189ca5eb5216546021710c06dc8bdd1a0c59cc1fa52129c6e038b3", + "beir_fever_revision": "426aea4d30c65c041f093ae072e25fb5a0e64659", + "beir_fever_qrels_revision": "64cd0e4ef9b63a88ac8e69d1133a2f649acd4745" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "2bb24640027801e9c29f2839e1f8e84b8007a66a3ceb4cb7d489e8f4c72767d3", + "binary_sha256": "14370900e193c56273c46409b2736ff7ac795a1a4c96ddf16510c870959d56fe", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "yahoo", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "fever:test31743", + "fever:test120259", + "fever:test194565" + ], + "query_count": 3, + "repetitions": 2, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "provider_error": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 0, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 0, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": null, + "macro_recall_at_k_over_valid_result_trials": null, + "micro_recall_at_k_over_valid_result_trials": null, + "rows": [ + { + "query_id": "fever:test31743", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 980, + "raw_response_sha256": "1f439f4edaf41e46aa26f92d90904dd942f3faff661926ab2d703e9ec07a1d0b" + }, + { + "query_id": "fever:test120259", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1028, + "raw_response_sha256": "c9f937f6cc9b7e8d04f6a73103cd7dc42ce704d8361548657e08778c6f36f80f" + }, + { + "query_id": "fever:test194565", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1139, + "raw_response_sha256": "e45be992b0b414113e5be5a2560d62513d57de3404e55b54803c2aea36f58f2a" + }, + { + "query_id": "fever:test31743", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1010, + "raw_response_sha256": "1f439f4edaf41e46aa26f92d90904dd942f3faff661926ab2d703e9ec07a1d0b" + }, + { + "query_id": "fever:test120259", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1124, + "raw_response_sha256": "c9f937f6cc9b7e8d04f6a73103cd7dc42ce704d8361548657e08778c6f36f80f" + }, + { + "query_id": "fever:test194565", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1203, + "raw_response_sha256": "e45be992b0b414113e5be5a2560d62513d57de3404e55b54803c2aea36f58f2a" + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-fever-m009.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-fever-m009.json new file mode 100644 index 00000000..27e4f376 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-fever-m009.json @@ -0,0 +1,202 @@ +{ + "schema_version": 1, + "dataset": "FEVER BEIR test", + "dataset_sha256": "4f359df04ad5a9a29c2f78009e7229d2a1c8eb0bf42d953853811373dea13305", + "dataset_archive_sha256": null, + "source_component_sha256": { + "beir_fever_queries_parquet_sha256": "b9cf00001ef1aa07a7030118490ce5f8a840e783ad8d972b9afee8ef281d6093", + "beir_fever_test_qrels_tsv_sha256": "6599dab4e2189ca5eb5216546021710c06dc8bdd1a0c59cc1fa52129c6e038b3", + "beir_fever_revision": "426aea4d30c65c041f093ae072e25fb5a0e64659", + "beir_fever_qrels_revision": "64cd0e4ef9b63a88ac8e69d1133a2f649acd4745" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "fd90457efcb52aa69acccd306c9af2f4e335dc54259a447df5479bcf66e1daf2", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "yahoo", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "fever:test31743", + "fever:test120259", + "fever:test194565" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m009-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 27.542, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": { + "500": 6 + }, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "provider_error": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 0, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 0, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": null, + "macro_recall_at_k_over_valid_result_trials": null, + "micro_recall_at_k_over_valid_result_trials": null, + "rows": [ + { + "query_id": "fever:test31743", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status", + "http_status": 500, + "message": "engine 'yahoo' returned status 500" + } + ], + "http_status": 500, + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1040, + "raw_response_sha256": "1f439f4edaf41e46aa26f92d90904dd942f3faff661926ab2d703e9ec07a1d0b", + "started_at_utc": "2026-11-23T21:41:39Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "fever:test120259", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status", + "http_status": 500, + "message": "engine 'yahoo' returned status 500" + } + ], + "http_status": 500, + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1080, + "raw_response_sha256": "c9f937f6cc9b7e8d04f6a73103cd7dc42ce704d8361548657e08778c6f36f80f", + "started_at_utc": "2026-11-23T21:42:11Z", + "planned_interval_seconds": 32.591, + "actual_interval_seconds": 32.599 + }, + { + "query_id": "fever:test194565", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status", + "http_status": 500, + "message": "engine 'yahoo' returned status 500" + } + ], + "http_status": 500, + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1052, + "raw_response_sha256": "e45be992b0b414113e5be5a2560d62513d57de3404e55b54803c2aea36f58f2a", + "started_at_utc": "2026-11-23T21:42:39Z", + "planned_interval_seconds": 27.532, + "actual_interval_seconds": 27.542 + }, + { + "query_id": "fever:test31743", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status", + "http_status": 500, + "message": "engine 'yahoo' returned status 500" + } + ], + "http_status": 500, + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1089, + "raw_response_sha256": "1f439f4edaf41e46aa26f92d90904dd942f3faff661926ab2d703e9ec07a1d0b", + "started_at_utc": "2026-11-23T21:43:17Z", + "planned_interval_seconds": 38.354, + "actual_interval_seconds": 38.359 + }, + { + "query_id": "fever:test120259", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status", + "http_status": 500, + "message": "engine 'yahoo' returned status 500" + } + ], + "http_status": 500, + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1086, + "raw_response_sha256": "c9f937f6cc9b7e8d04f6a73103cd7dc42ce704d8361548657e08778c6f36f80f", + "started_at_utc": "2026-11-23T21:43:46Z", + "planned_interval_seconds": 29.19, + "actual_interval_seconds": 29.199 + }, + { + "query_id": "fever:test194565", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status", + "http_status": 500, + "message": "engine 'yahoo' returned status 500" + } + ], + "http_status": 500, + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1083, + "raw_response_sha256": "e45be992b0b414113e5be5a2560d62513d57de3404e55b54803c2aea36f58f2a", + "started_at_utc": "2026-11-23T21:44:17Z", + "planned_interval_seconds": 30.808, + "actual_interval_seconds": 30.817 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-fever-m010.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-fever-m010.json new file mode 100644 index 00000000..28f9cbec --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-fever-m010.json @@ -0,0 +1,188 @@ +{ + "schema_version": 1, + "dataset": "FEVER BEIR test", + "dataset_sha256": "4f359df04ad5a9a29c2f78009e7229d2a1c8eb0bf42d953853811373dea13305", + "dataset_archive_sha256": null, + "source_component_sha256": { + "beir_fever_queries_parquet_sha256": "b9cf00001ef1aa07a7030118490ce5f8a840e783ad8d972b9afee8ef281d6093", + "beir_fever_test_qrels_tsv_sha256": "6599dab4e2189ca5eb5216546021710c06dc8bdd1a0c59cc1fa52129c6e038b3", + "beir_fever_revision": "426aea4d30c65c041f093ae072e25fb5a0e64659", + "beir_fever_qrels_revision": "64cd0e4ef9b63a88ac8e69d1133a2f649acd4745" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "5c8c65fe099f7370bcfc04fd85cb6ba717eed7c4d83dfa0fa9ae1d4d27bcc65f", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "yahoo", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "01e08d77178bf091707ece340bc1ac27614bfa92a0f2b9999547c653c0093530", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "fever:test31743", + "fever:test120259", + "fever:test194565" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m010-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 27.26, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 6, + "matched_relevant_query_document_pairs_across_valid_trials": 6 + }, + "hit_at_k_over_valid_result_trials": 1.0, + "macro_recall_at_k_over_valid_result_trials": 1.0, + "micro_recall_at_k_over_valid_result_trials": 1.0, + "rows": [ + { + "query_id": "fever:test31743", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 7, + "matched_relevant_documents": [ + { + "corpus_id": "Yvonne_Strahovski", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 6802, + "raw_response_sha256": "2b9797b5657303e6030569d00a9653e602d8be8700763a4dffcd5f0a2a58a7fe", + "started_at_utc": "2026-11-23T22:44:00Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "fever:test120259", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 7, + "matched_relevant_documents": [ + { + "corpus_id": "Ed_Decter", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 5423, + "raw_response_sha256": "2e7e4290ae1367090fb00587cb056656323f62b8fa6c4d63f72823a17cea9133", + "started_at_utc": "2026-11-23T22:44:39Z", + "planned_interval_seconds": 38.725, + "actual_interval_seconds": 38.729 + }, + { + "query_id": "fever:test194565", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 7, + "matched_relevant_documents": [ + { + "corpus_id": "Kyle_MacLachlan", + "rank": 2 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 5244, + "raw_response_sha256": "2b5858458b35e23b51e8c28ac5e81c1e13ee126242ee02205b872d09fc3eee43", + "started_at_utc": "2026-11-23T22:45:08Z", + "planned_interval_seconds": 29.166, + "actual_interval_seconds": 29.171 + }, + { + "query_id": "fever:test31743", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 7, + "matched_relevant_documents": [ + { + "corpus_id": "Yvonne_Strahovski", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 5248, + "raw_response_sha256": "f06ed9a520ae40b39594358c3ea0bd34b70ce8474a15db75b5cc7f81adb44877", + "started_at_utc": "2026-11-23T22:45:39Z", + "planned_interval_seconds": 30.64, + "actual_interval_seconds": 30.646 + }, + { + "query_id": "fever:test120259", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 7, + "matched_relevant_documents": [ + { + "corpus_id": "Ed_Decter", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 4696, + "raw_response_sha256": "8d185dc77906a4c3b591d674ba33b34b43c17664112c4c5fc562ae74cdd699f0", + "started_at_utc": "2026-11-23T22:46:06Z", + "planned_interval_seconds": 27.259, + "actual_interval_seconds": 27.26 + }, + { + "query_id": "fever:test194565", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 7, + "matched_relevant_documents": [ + { + "corpus_id": "Kyle_MacLachlan", + "rank": 2 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 4785, + "raw_response_sha256": "eb7462e7e60936ba200583b4071b1564e8c8562fdf54129667377965bcb74022", + "started_at_utc": "2026-11-23T22:46:38Z", + "planned_interval_seconds": 31.578, + "actual_interval_seconds": 31.579 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-nq-m008.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-nq-m008.json new file mode 100644 index 00000000..dc7402bd --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-nq-m008.json @@ -0,0 +1,146 @@ +{ + "schema_version": 1, + "dataset": "Natural Questions BEIR test", + "dataset_sha256": "76f3240642b95adaccc4a0e6cb7ef75776ec105e6763585f37ade994663673ed", + "dataset_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752", + "source_component_sha256": { + "beir_nq_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "2bb24640027801e9c29f2839e1f8e84b8007a66a3ceb4cb7d489e8f4c72767d3", + "binary_sha256": "14370900e193c56273c46409b2736ff7ac795a1a4c96ddf16510c870959d56fe", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "yahoo", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "nq:test2352", + "nq:test1742", + "nq:test2376" + ], + "query_count": 3, + "repetitions": 2, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "provider_error": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 0, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 0, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": null, + "macro_recall_at_k_over_valid_result_trials": null, + "micro_recall_at_k_over_valid_result_trials": null, + "rows": [ + { + "query_id": "nq:test2352", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1106, + "raw_response_sha256": "e6b6e17475e71f895378877e52e673406b080253e27efdf958928560cc11f1a7" + }, + { + "query_id": "nq:test1742", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1082, + "raw_response_sha256": "87a77d5a9f35e5a41b1fc051c725ae05feab5ad8c72238dc4d8417b9f005a9aa" + }, + { + "query_id": "nq:test2376", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 971, + "raw_response_sha256": "ecd742e92def3baa7f14bea7bfda91485b750c30a82b86f4f99b322ccd82fefc" + }, + { + "query_id": "nq:test2352", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1003, + "raw_response_sha256": "e6b6e17475e71f895378877e52e673406b080253e27efdf958928560cc11f1a7" + }, + { + "query_id": "nq:test1742", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1005, + "raw_response_sha256": "87a77d5a9f35e5a41b1fc051c725ae05feab5ad8c72238dc4d8417b9f005a9aa" + }, + { + "query_id": "nq:test2376", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1034, + "raw_response_sha256": "ecd742e92def3baa7f14bea7bfda91485b750c30a82b86f4f99b322ccd82fefc" + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-nq-m009.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-nq-m009.json new file mode 100644 index 00000000..374dfb96 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-nq-m009.json @@ -0,0 +1,199 @@ +{ + "schema_version": 1, + "dataset": "Natural Questions BEIR test", + "dataset_sha256": "76f3240642b95adaccc4a0e6cb7ef75776ec105e6763585f37ade994663673ed", + "dataset_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752", + "source_component_sha256": { + "beir_nq_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "fd90457efcb52aa69acccd306c9af2f4e335dc54259a447df5479bcf66e1daf2", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "yahoo", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "nq:test2352", + "nq:test1742", + "nq:test2376" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m009-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 27.329, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": { + "500": 6 + }, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "provider_error": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 0, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 0, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": null, + "macro_recall_at_k_over_valid_result_trials": null, + "micro_recall_at_k_over_valid_result_trials": null, + "rows": [ + { + "query_id": "nq:test2352", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status", + "http_status": 500, + "message": "engine 'yahoo' returned status 500" + } + ], + "http_status": 500, + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1034, + "raw_response_sha256": "e6b6e17475e71f895378877e52e673406b080253e27efdf958928560cc11f1a7", + "started_at_utc": "2026-11-23T21:30:20Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "nq:test1742", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status", + "http_status": 500, + "message": "engine 'yahoo' returned status 500" + } + ], + "http_status": 500, + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1096, + "raw_response_sha256": "87a77d5a9f35e5a41b1fc051c725ae05feab5ad8c72238dc4d8417b9f005a9aa", + "started_at_utc": "2026-11-23T21:30:48Z", + "planned_interval_seconds": 28.14, + "actual_interval_seconds": 28.143 + }, + { + "query_id": "nq:test2376", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status", + "http_status": 500, + "message": "engine 'yahoo' returned status 500" + } + ], + "http_status": 500, + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1042, + "raw_response_sha256": "ecd742e92def3baa7f14bea7bfda91485b750c30a82b86f4f99b322ccd82fefc", + "started_at_utc": "2026-11-23T21:31:27Z", + "planned_interval_seconds": 39.351, + "actual_interval_seconds": 39.357 + }, + { + "query_id": "nq:test2352", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status", + "http_status": 500, + "message": "engine 'yahoo' returned status 500" + } + ], + "http_status": 500, + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1182, + "raw_response_sha256": "e6b6e17475e71f895378877e52e673406b080253e27efdf958928560cc11f1a7", + "started_at_utc": "2026-11-23T21:32:02Z", + "planned_interval_seconds": 34.586, + "actual_interval_seconds": 34.591 + }, + { + "query_id": "nq:test1742", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status", + "http_status": 500, + "message": "engine 'yahoo' returned status 500" + } + ], + "http_status": 500, + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1080, + "raw_response_sha256": "87a77d5a9f35e5a41b1fc051c725ae05feab5ad8c72238dc4d8417b9f005a9aa", + "started_at_utc": "2026-11-23T21:32:29Z", + "planned_interval_seconds": 27.319, + "actual_interval_seconds": 27.329 + }, + { + "query_id": "nq:test2376", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status", + "http_status": 500, + "message": "engine 'yahoo' returned status 500" + } + ], + "http_status": 500, + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1035, + "raw_response_sha256": "ecd742e92def3baa7f14bea7bfda91485b750c30a82b86f4f99b322ccd82fefc", + "started_at_utc": "2026-11-23T21:33:07Z", + "planned_interval_seconds": 37.977, + "actual_interval_seconds": 37.986 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-nq-m010.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-nq-m010.json new file mode 100644 index 00000000..f8174732 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-nq-m010.json @@ -0,0 +1,165 @@ +{ + "schema_version": 1, + "dataset": "Natural Questions BEIR test", + "dataset_sha256": "76f3240642b95adaccc4a0e6cb7ef75776ec105e6763585f37ade994663673ed", + "dataset_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752", + "source_component_sha256": { + "beir_nq_archive_sha256": "2553bf7bfbab47b1436ca00a34bce57320e18e611fd00999a2a3a1b4714be752" + }, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "5c8c65fe099f7370bcfc04fd85cb6ba717eed7c4d83dfa0fa9ae1d4d27bcc65f", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "yahoo", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "01e08d77178bf091707ece340bc1ac27614bfa92a0f2b9999547c653c0093530", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "nq:test2352", + "nq:test1742", + "nq:test2376" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m010-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 26.39, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 3, + "known_relevant_query_document_pairs_across_valid_trials": 6, + "matched_relevant_query_document_pairs_across_valid_trials": 2 + }, + "hit_at_k_over_valid_result_trials": 0.3333333333333333, + "macro_recall_at_k_over_valid_result_trials": 0.3333333333333333, + "micro_recall_at_k_over_valid_result_trials": 0.3333333333333333, + "rows": [ + { + "query_id": "nq:test2352", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 7, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 6787, + "raw_response_sha256": "e29a50dae9661dc7ffb693d88652873702d6a67b1b7adce3ea3ceb0020e8789e", + "started_at_utc": "2026-11-23T22:33:40Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "nq:test1742", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 7, + "matched_relevant_documents": [ + { + "corpus_id": "doc61640", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 6222, + "raw_response_sha256": "5c351109b06a7a22341259d3950666e3fe780ee0f91eca3fb532576fa39e28c1", + "started_at_utc": "2026-11-23T22:34:10Z", + "planned_interval_seconds": 30.694, + "actual_interval_seconds": 30.701 + }, + { + "query_id": "nq:test2376", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 7, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 6931, + "raw_response_sha256": "41b1e4e2a58539a316c8c18c4f212e60251574a78e7e1acf077fd1186dd8f67a", + "started_at_utc": "2026-11-23T22:34:40Z", + "planned_interval_seconds": 29.263, + "actual_interval_seconds": 29.275 + }, + { + "query_id": "nq:test2352", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 7, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 7622, + "raw_response_sha256": "ee0c09514bfee5fcda41bc3ec7ffb1a73390fd227a2e3b5f268358b28e931ea6", + "started_at_utc": "2026-11-23T22:35:08Z", + "planned_interval_seconds": 28.616, + "actual_interval_seconds": 28.621 + }, + { + "query_id": "nq:test1742", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 7, + "matched_relevant_documents": [ + { + "corpus_id": "doc61640", + "rank": 1 + } + ], + "relevant_document_count": 1, + "matched_relevant_document_count": 1, + "latency_ms": 6276, + "raw_response_sha256": "d5f1e234659cd08ec3af4eb3d3a84b3d119a69121baef12292f484f4f953c8c0", + "started_at_utc": "2026-11-23T22:35:36Z", + "planned_interval_seconds": 27.612, + "actual_interval_seconds": 27.622 + }, + { + "query_id": "nq:test2376", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 7, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 5833, + "raw_response_sha256": "0ae923c62ec7c384e9a4328c128875042dfea3bfbe2be5dbefb8631f11910377", + "started_at_utc": "2026-11-23T22:36:02Z", + "planned_interval_seconds": 26.383, + "actual_interval_seconds": 26.39 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-scifact-m008.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-scifact-m008.json new file mode 100644 index 00000000..eb94fd47 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-scifact-m008.json @@ -0,0 +1,144 @@ +{ + "schema_version": 1, + "dataset": "SciFact BEIR test", + "dataset_sha256": "40f78fb516f4a69bfc4fc13b5b4f1d7ee784638d937ccf338c6b6436934613d2", + "dataset_archive_sha256": "536e14446a0ba56ed1398ab1055f39fe852686ecad24a6306c80c490fa8e0165", + "source_component_sha256": {}, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "2bb24640027801e9c29f2839e1f8e84b8007a66a3ceb4cb7d489e8f4c72767d3", + "binary_sha256": "14370900e193c56273c46409b2736ff7ac795a1a4c96ddf16510c870959d56fe", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "yahoo", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "775", + "100", + "619" + ], + "query_count": 3, + "repetitions": 2, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "provider_error": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 0, + "known_relevant_query_document_pairs_per_cohort": 4, + "known_relevant_query_document_pairs_across_valid_trials": 0, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": null, + "macro_recall_at_k_over_valid_result_trials": null, + "micro_recall_at_k_over_valid_result_trials": null, + "rows": [ + { + "query_id": "775", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1080, + "raw_response_sha256": "3e1a27bfa831448a5fe3638bf549c37e287f38d5383dcd7c565e165328d496da" + }, + { + "query_id": "100", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1123, + "raw_response_sha256": "34ceac55ba6c1846a0346248b39374128f64e887d3bf2c43b91d6f9faa438b29" + }, + { + "query_id": "619", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 1056, + "raw_response_sha256": "b0ba3bdceed87388b94d30da237540ab0d3c453fcffcc0af7526beb880dcc0d1" + }, + { + "query_id": "775", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1023, + "raw_response_sha256": "3e1a27bfa831448a5fe3638bf549c37e287f38d5383dcd7c565e165328d496da" + }, + { + "query_id": "100", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1155, + "raw_response_sha256": "34ceac55ba6c1846a0346248b39374128f64e887d3bf2c43b91d6f9faa438b29" + }, + { + "query_id": "619", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status" + } + ], + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 1008, + "raw_response_sha256": "b0ba3bdceed87388b94d30da237540ab0d3c453fcffcc0af7526beb880dcc0d1" + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-scifact-m009.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-scifact-m009.json new file mode 100644 index 00000000..ae4180a5 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-scifact-m009.json @@ -0,0 +1,197 @@ +{ + "schema_version": 1, + "dataset": "SciFact BEIR test", + "dataset_sha256": "40f78fb516f4a69bfc4fc13b5b4f1d7ee784638d937ccf338c6b6436934613d2", + "dataset_archive_sha256": "536e14446a0ba56ed1398ab1055f39fe852686ecad24a6306c80c490fa8e0165", + "source_component_sha256": {}, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "fd90457efcb52aa69acccd306c9af2f4e335dc54259a447df5479bcf66e1daf2", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "yahoo", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "775", + "100", + "619" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m009-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 25.379, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": { + "500": 6 + }, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "provider_error": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 0, + "known_relevant_query_document_pairs_per_cohort": 4, + "known_relevant_query_document_pairs_across_valid_trials": 0, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": null, + "macro_recall_at_k_over_valid_result_trials": null, + "micro_recall_at_k_over_valid_result_trials": null, + "rows": [ + { + "query_id": "775", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status", + "http_status": 500, + "message": "engine 'yahoo' returned status 500" + } + ], + "http_status": 500, + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1128, + "raw_response_sha256": "3e1a27bfa831448a5fe3638bf549c37e287f38d5383dcd7c565e165328d496da", + "started_at_utc": "2026-11-23T21:18:50Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "100", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status", + "http_status": 500, + "message": "engine 'yahoo' returned status 500" + } + ], + "http_status": 500, + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1031, + "raw_response_sha256": "34ceac55ba6c1846a0346248b39374128f64e887d3bf2c43b91d6f9faa438b29", + "started_at_utc": "2026-11-23T21:19:16Z", + "planned_interval_seconds": 25.375, + "actual_interval_seconds": 25.379 + }, + { + "query_id": "619", + "repetition": 1, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status", + "http_status": 500, + "message": "engine 'yahoo' returned status 500" + } + ], + "http_status": 500, + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 1110, + "raw_response_sha256": "b0ba3bdceed87388b94d30da237540ab0d3c453fcffcc0af7526beb880dcc0d1", + "started_at_utc": "2026-11-23T21:19:54Z", + "planned_interval_seconds": 38.393, + "actual_interval_seconds": 38.396 + }, + { + "query_id": "775", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status", + "http_status": 500, + "message": "engine 'yahoo' returned status 500" + } + ], + "http_status": 500, + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1070, + "raw_response_sha256": "3e1a27bfa831448a5fe3638bf549c37e287f38d5383dcd7c565e165328d496da", + "started_at_utc": "2026-11-23T21:20:24Z", + "planned_interval_seconds": 30.375, + "actual_interval_seconds": 30.386 + }, + { + "query_id": "100", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status", + "http_status": 500, + "message": "engine 'yahoo' returned status 500" + } + ], + "http_status": 500, + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 1181, + "raw_response_sha256": "34ceac55ba6c1846a0346248b39374128f64e887d3bf2c43b91d6f9faa438b29", + "started_at_utc": "2026-11-23T21:21:04Z", + "planned_interval_seconds": 39.659, + "actual_interval_seconds": 39.671 + }, + { + "query_id": "619", + "repetition": 2, + "outcome": "provider_error", + "provider_errors": [ + { + "id": "yahoo", + "error_class": "http_status", + "http_status": 500, + "message": "engine 'yahoo' returned status 500" + } + ], + "http_status": 500, + "result_count": 0, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 1159, + "raw_response_sha256": "b0ba3bdceed87388b94d30da237540ab0d3c453fcffcc0af7526beb880dcc0d1", + "started_at_utc": "2026-11-23T21:21:35Z", + "planned_interval_seconds": 31.248, + "actual_interval_seconds": 31.253 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-scifact-m010.json b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-scifact-m010.json new file mode 100644 index 00000000..42d341ac --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-yahoo-scifact-m010.json @@ -0,0 +1,153 @@ +{ + "schema_version": 1, + "dataset": "SciFact BEIR test", + "dataset_sha256": "40f78fb516f4a69bfc4fc13b5b4f1d7ee784638d937ccf338c6b6436934613d2", + "dataset_archive_sha256": "536e14446a0ba56ed1398ab1055f39fe852686ecad24a6306c80c490fa8e0165", + "source_component_sha256": {}, + "source_sha": "7ec251df2ba715705468f2eb1e5392fa87fc4d32", + "runner_sha256": "d70d086974e73fd1209f98fc2eecb25c9671366a75670b96b8851ad146e2082f", + "binary_sha256": "5c8c65fe099f7370bcfc04fd85cb6ba717eed7c4d83dfa0fa9ae1d4d27bcc65f", + "host": "macOS-26.6.2-arm64-arm-64bit-Mach-O", + "provider": "yahoo", + "config_state": "explicit config supplied", + "config_fingerprint_sha256": "01e08d77178bf091707ece340bc1ac27614bfa92a0f2b9999547c653c0093530", + "cache_state": "uncontrolled; CLI provides no cache-state control", + "seed": "m008-mojeek-default-qualification-v1", + "query_ids": [ + "775", + "100", + "619" + ], + "query_count": 3, + "repetitions": 2, + "protocol": { + "id": "m010-paced-v1", + "mode": "paced", + "min_interval_seconds": 25.0, + "max_interval_seconds": 40.0, + "consecutive_blocked_stop": 3 + }, + "pacing": { + "attempts": 6, + "min_observed_interval_seconds": 27.06, + "violations": [] + }, + "aborted": false, + "refused_attempts": 0, + "http_status_counts": {}, + "provider_query_attempts": 6, + "max_results": 10, + "timeout_seconds_per_attempt": 18, + "outcomes": { + "results": 6 + }, + "judgment_denominators": { + "selected_queries": 3, + "repeated_valid_result_query_trials": 6, + "known_relevant_query_document_pairs_per_cohort": 4, + "known_relevant_query_document_pairs_across_valid_trials": 8, + "matched_relevant_query_document_pairs_across_valid_trials": 0 + }, + "hit_at_k_over_valid_result_trials": 0.0, + "macro_recall_at_k_over_valid_result_trials": 0.0, + "micro_recall_at_k_over_valid_result_trials": 0.0, + "rows": [ + { + "query_id": "775", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 7, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 6028, + "raw_response_sha256": "f39c76e2d215a16bc6adb10fb8478c0ef23a48a0d2f7a8571bbb21ebf68056ab", + "started_at_utc": "2026-11-23T22:22:52Z", + "planned_interval_seconds": 0.0, + "actual_interval_seconds": null + }, + { + "query_id": "100", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 7, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 5208, + "raw_response_sha256": "35c96714a2a24e868729e0ab5aafd3d3529636c6d5d26eb40d37ccc55d136806", + "started_at_utc": "2026-11-23T22:23:19Z", + "planned_interval_seconds": 27.058, + "actual_interval_seconds": 27.06 + }, + { + "query_id": "619", + "repetition": 1, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 7, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 5067, + "raw_response_sha256": "719352268a205de0e61d8a31431df63bdcb04885a7b9e7a8daa7a215aaa6478f", + "started_at_utc": "2026-11-23T22:23:51Z", + "planned_interval_seconds": 31.268, + "actual_interval_seconds": 31.277 + }, + { + "query_id": "775", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 7, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 4731, + "raw_response_sha256": "b5d7bbfd595df884d45ea07b6c817f7e13916b2c8f915ff252222fd4865f06d2", + "started_at_utc": "2026-11-23T22:24:24Z", + "planned_interval_seconds": 32.997, + "actual_interval_seconds": 33.007 + }, + { + "query_id": "100", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 7, + "matched_relevant_documents": [], + "relevant_document_count": 1, + "matched_relevant_document_count": 0, + "latency_ms": 6498, + "raw_response_sha256": "76d45ab760b2a0ff2024757dcb9225b401395e43765a062cb2f50c9724e0c19d", + "started_at_utc": "2026-11-23T22:24:58Z", + "planned_interval_seconds": 34.672, + "actual_interval_seconds": 34.684 + }, + { + "query_id": "619", + "repetition": 2, + "outcome": "results", + "provider_errors": [], + "http_status": null, + "result_count": 7, + "matched_relevant_documents": [], + "relevant_document_count": 2, + "matched_relevant_document_count": 0, + "latency_ms": 6213, + "raw_response_sha256": "ab9a9644334ab2bb54070f60d7a1cb058e671c52187b3584858d19801c986bbf", + "started_at_utc": "2026-11-23T22:25:34Z", + "planned_interval_seconds": 35.994, + "actual_interval_seconds": 36.007 + } + ], + "raw_search_results_included": false +} diff --git a/plans/closure/retrieval-quality-evidence-extension/mojeek-default-qualification-008.md b/plans/closure/retrieval-quality-evidence-extension/mojeek-default-qualification-008.md new file mode 100644 index 00000000..716364a6 --- /dev/null +++ b/plans/closure/retrieval-quality-evidence-extension/mojeek-default-qualification-008.md @@ -0,0 +1,41 @@ +# M008 Mojeek default qualification — held-out trial summary + +Decision: **not qualified; keep the shipped defaults unchanged.** The predeclared admission gate fails on Mojeek operational reliability, comparable-control coverage, and held-out contribution. The trial is an egress-specific observation, not a general claim about Mojeek quality. + +## Provenance and protocol + +- Source SHA: `7ec251df2ba715705468f2eb1e5392fa87fc4d32` +- Release CLI binary SHA-256: `14370900e193c56273c46409b2736ff7ac795a1a4c96ddf16510c870959d56fe` (release, `--no-default-features`; build succeeded) +- Runner SHA-256: `2bb24640027801e9c29f2839e1f8e84b8007a66a3ceb4cb7d489e8f4c72767d3` +- Temporary config SHA-256: `6483e7b6beb1503f4032d3c6c95745c6cf6af2b0a9bc366ab4fe580243ca6174`; enabled only DuckDuckGo, Brave, Yahoo, and Mojeek for isolated explicit-provider trials, while retaining the existing three-provider default list. No credentials or paid providers were used. +- Host: `macOS-26.6.2-arm64-arm-64bit-Mach-O` +- Fixed seed: `m008-mojeek-default-qualification-v1`; 3 queries × 2 repetitions × 10 results × 18-second per-attempt bound, for each of 4 providers on each of 3 datasets. Total: 72 attempts, no retries. +- Dataset fingerprints: SciFact `40f78fb516f4a69bfc4fc13b5b4f1d7ee784638d937ccf338c6b6436934613d2`; NQ `76f3240642b95adaccc4a0e6cb7ef75776ec105e6763585f37ade994663673ed`; FEVER `4f359df04ad5a9a29c2f78009e7229d2a1c8eb0bf42d953853811373dea13305`. +- Selected query IDs: SciFact `775`, `100`, `619`; NQ `nq:test2352`, `nq:test1742`, `nq:test2376`; FEVER `fever:test31743`, `fever:test120259`, `fever:test194565`. + +## Outcomes + +Each cell is six attempts; result/error classes are retained separately. The runner stores qrel matches and response hashes, not raw search-result bodies. + +| Provider | SciFact | NQ | FEVER | Valid outcomes / 18 | Distinct matched qrel pairs | +|---|---|---|---|---:|---:| +| `duckduckgo` | 6 results | 4 results, 2 blocked | 6 blocked | 10 | 1 (NQ `nq:test1742` / `doc61640`) | +| `brave` | 6 results | 2 results, 4 blocked | 6 blocked | 8 | 1 (same NQ pair) | +| `yahoo` | 6 HTTP-status errors | 6 HTTP-status errors | 6 HTTP-status errors | 0 | 0 | +| `mojeek` | 5 results, 1 HTTP-status error | 6 HTTP-status errors | 6 HTTP-status errors | 5 | 0 | + +Mojeek's 5 valid rows were all from SciFact. Across all 18 Mojeek attempts: 5 results, 13 provider errors, no successful empty responses, no timeouts, and no qrel matches. Its CLI-process latency range was 393–1,980 ms (median 438 ms); this is not time-to-first-useful-text and cache state was uncontrolled. The errors were classified as `http_status` by the runner. + +DuckDuckGo and Brave each matched the same single NQ positive qrel pair on one valid trial; those matches do not establish broad retrieval quality. Yahoo had no valid rows. Because all three current defaults did not have sufficient valid paired coverage, errors cannot be treated as empty result sets and Mojeek novelty versus the complete default set cannot be established. + +## Gate verdict + +1. Trial integrity: **pass** — all 12 preserved reports share the source, binary, runner, config, seed, settings, and corresponding query IDs. +2. Mojeek operations: **fail** — 5/18 valid versus the 17/18 floor; per dataset, 5/6 SciFact, 0/6 NQ, 0/6 FEVER, with non-empty results only in SciFact. +3. Comparable controls: **fail** — DuckDuckGo is 4/6 on NQ and 0/6 on FEVER; Brave is 2/6 on NQ and 0/6 on FEVER; Yahoo is 0/6 on every dataset. +4. Held-out contribution: **fail** — Mojeek matched 0 distinct query/document pairs, below the 3-pair floor, and has no unique paired match. +5. Reporting: **complete** — all 72 attempts, outcomes, qrel denominators/matches, latencies, fingerprints, and limitations are in the 12 raw runner reports. + +No provider-default code, tests, or user-facing default docs were changed. The default-fan-out live smoke and full implementation gates were skipped because M008 did not pass its admission gate. The prior three-query Mojeek functional smoke is not a substitute for this failed held-out qualification. + +Raw reports: `plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-*-m008.json`. Closure record: `plans/closure/retrieval-quality-evidence-extension/008-status.md`. diff --git a/plans/implementation/agentic-retrieval-integrity/049-non-success-block-classification.md b/plans/implementation/agentic-retrieval-integrity/049-non-success-block-classification.md new file mode 100644 index 00000000..fe0f72a4 --- /dev/null +++ b/plans/implementation/agentic-retrieval-integrity/049-non-success-block-classification.md @@ -0,0 +1,123 @@ +# M049 — Non-Success Block Classification for Mojeek + +Status: active (work package 1 implemented; canonical gate outstanding) +Date: 2026-11-23 +Subsystem: agentic retrieval integrity +Milestone class: correctness (provider error classification) +Baseline: `7ec251df2ba715705468f2eb1e5392fa87fc4d32` on `docs/user-facing-polish-20261123` +Decision authority: `architecture/engines.md` § Scraper Fidelity; M045 work package 1 establishes +the same rule for `brave` and `yahoo`. No new ADR. + +References: `plans/000-long-term-specification.md` §2; `plans/003-planning-process.md` §7; +ADR-0006 (keyless retrieval is first-class); `architecture/engines.md` § Scraper Fidelity; +`docs/provider-setup.md`; M008 closure record. + +## Objective + +Make `mojeek` report a refusal that arrives with a non-success status as `blocked`, naming the +status and the matched marker, instead of `http_status`. This brings the engine in line with the +rule `architecture/engines.md` already states and that `read_search_body()` already implements. + +## Evidence (2026-11-23, this egress) + +One bounded, keyless request to `https://www.mojeek.com/search?q=Rust+programming+language+official+website` +with the shipped search user agent and `Accept-Language: en-US,en;q=0.9`: + +- `HTTP/1.1 403 Forbidden`, `Content-Length: 363`, `Content-type: text/html; charset=UTF-8`, + `Server: lighttpd/1.4.53` +- Body: `403 - Forbidden` … `

Sorry your network appears to be sending automated + queries so we can't process your search at this time.

` … `/about/contact?refr=403` +- Body SHA-256 `50666d78ab85d7af911166fa712af887dedcf4a2751df8927992a4d253548691` + +That body matches the `PageMarker::Text("your network appears to be sending automated queries")` +marker already declared in `mojeek.rs` `SHAPE.blocked_markers`. `send_search()` returned +`EngineError::BadStatus { status: 403 }` before reading the body, so the marker never ran. The same +observation is recorded against M008: thirteen of eighteen Mojeek attempts were `http_status`. + +## Why Mojeek refuses this egress (research, 2026-11-23) + +1. `https://www.mojeek.com/robots.txt` (live, HTTP 200) declares `User-agent: *` / + `Disallow: /search`. The HTML search page is not offered to automated clients at all. +2. Mojeek gates `/search` with an ALTCHA proof-of-work wall served with **HTTP 200** + (`div.captcha-wrap`), added 2026-06-23 and cited on their forum as a response to roughly 100 + automated searches per second. +3. Continued automated traffic escalates to a hard `403` carrying the exact page captured above. + Mojeek's own forum documents the same page for datacenter and VPN egress and, separately, for + single over-broad bot rules that fire on the query text. +4. The supported automated route is the Mojeek Search API (`https://api.mojeek.com/search`, + `api_key`, JSON/XML, PAYG from £2 per 1,000 requests). Their terms permit automated access only + by "an authorised Mojeek API user". + +Conclusion: the `403` is not parser drift and not a solvable challenge. It is also **not** +network-wide and **not** user-agent-wide: that was this plan's first reading, and the controls below +disprove it. + +## Mechanism controls (2026-11-23) + +Public address `96.236.59.113`, identical for the in-app browser and the CLI. + +| Client | Query | Outcome | +|---|---|---| +| in-app Chromium 148 (`… MiniMaxAgent/3.1.17 … Electron/42.11.16`) | `/` | `200` homepage | +| in-app Chromium | probe string | `403`, repeatable | +| in-app Chromium | `test`, `rust`, `official website`, `rust programming language`, a long benign sentence, `nq:test2352` | `200` ALTCHA wall | +| in-app Chromium | `nq:test2352`, reloaded and re-requested | `200` ALTCHA wall | +| curl, stale Windows Chrome/124 UA | probe string | `403`, byte-identical | +| curl, current macOS Chrome/148 UA + `sec-ch-ua` + `sec-fetch-*` | probe string | `403`, byte-identical | +| eggsearch release client | `nq:test2352` | five real results, no provider failures | +| eggsearch release client, post-fix | probe string | `blocked`, "…on HTTP 403" | + +The outcome tracks the query, not the client. Changing the user-agent string, its version, or the +client hints changes nothing, so the shipped identity is not the cause and does not need to change. +Sustained automated bursts remain the documented escalation path, and that is the most likely +explanation for M008's thirteen refusals from its own 72-attempt cohort. Controls retained in +`plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-403-mechanism-controls.json`. + +## Work package 1 — classification (this milestone) + +- `src/meta/engines/mojeek.rs` `send_search()` uses `super::read_search_body(resp, ENGINE, &SHAPE, + MAX_BODY_BYTES, &[])` instead of short-circuiting on `!status.is_success()` and then reading the + body. A non-success body that matches a blocked marker becomes + `Blocked { reason: "challenge page detected () on HTTP " }`; a non-success body + that matches no marker stays `BadStatus`. +- A `200` challenge page keeps its existing path: body returned, `is_challenge_page()` true, ALTCHA + solver and single replay. A `403` block page no longer reaches the solver, because a network block + is not a solvable challenge. +- Two unit tests: a `403` block page yields `Blocked` naming the marker and `HTTP 403` with zero + solve or verify requests; an empty `403`/no-marker failure stays `BadStatus`. + +M045 work package 1 covered `brave` (429 proof-of-work) and `yahoo` (500). `duckduckgo` and +`startpage` are unaffected in practice because their walls arrive with success statuses (`202` and +a `200` redirect target). They keep their current code; the shared helper is ready if that changes. + +Records updated with the change: `tests/fixtures/engines/README.md` (capture provenance and why the +body must be read on a non-success status), `docs/provider-setup.md` (an operator caveat that the +solver cannot clear a network refusal), the M008 closure correction, this roadmap, and +`plans/registry.md`. The captured response is retained in +`plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-network-block-403-capture.json`. + +## Non-goals + +- No provider default, enablement, or capability change. Mojeek stays disabled; + defaults stay `[duckduckgo, brave, yahoo]`. +- No Mojeek API key, no paid provider, no credential. +- No browser escalation for Mojeek: a browser on the same egress receives the same network block. +- No rerun of the M008 held-out cohort. + +## Acceptance and stop conditions + +- A mock `403` carrying the captured block page yields `Blocked` whose reason contains + `challenge page detected`, the marker text, and `HTTP 403`. +- A mock `403` with no marker stays `BadStatus { status: 403 }`. +- Mock `200` challenge-page, cached-cookie, rejected-cookie, and exhausted-attempt paths are + unchanged. +- `cargo fmt --check`, `cargo clippy`, the `mock` feature test suites, and `make docs-check` pass. +- **Stop:** the classification cannot be reached without reading an unbounded body, or the change + alters the advertised tool surface, provider enablement, or defaults. + +## Recorded correction + +`plans/closure/retrieval-quality-evidence-extension/008-status.md` gains an appended correction: its +thirteen Mojeek `http_status` observations are this class of refusal and classify as `blocked`. The +runner kept no bodies, so the correction states what was captured rather than claiming all thirteen +were byte-identical. The negative M008 outcome stands; the qualification gate is unchanged. diff --git a/plans/implementation/browser-artifact-availability/006-absent-browser-degradation-contract.md b/plans/implementation/browser-artifact-availability/006-absent-browser-degradation-contract.md new file mode 100644 index 00000000..e7a1d01e --- /dev/null +++ b/plans/implementation/browser-artifact-availability/006-absent-browser-degradation-contract.md @@ -0,0 +1,71 @@ +# M006 — Absent-Browser Degradation Contract + +Status: active +Date: 2026-11-24 +Baseline: `e012dd7aa9071b1fc14e206e727ac8635f4064e4` on `docs/user-facing-polish-20261123`, after merging `origin/main` `4de20a0f0d748b89147829a51384e385a5bee388` +Subsystem: browser artifact availability and render bounds +Milestone class: correctness (capability degradation) +Decision: `plans/adrs/ADR-0024-browser-enabled-wheels-and-absent-browser-degradation.md` +References: ADR-0014 §4–§8; `architecture/fetch.md` §8–§9; `docs/features.md`; `docs/config.md`; `src/fetch/browser/discover.rs`; `src/mcp/tools/web_fetch.rs`; `src/mcp/tools/provider_status.rs`; `plans/closure/browser-artifact-availability/003-status.md`. + +## Objective + +Make "no Chrome installed" a proven, harmless state across every entry point, and make every +browser-unavailable outcome name its exact cause. The feature is now compiled in everywhere, so the +absence path is the common case on a fresh Linux server, a slim container, and any machine without a +browser. + +## What already exists (verified 2026-11-24) + +- `discover_browser()` yields `Available`, `NotFound`, `VersionUnrecognized`, or + `ExplicitPathInvalid`; `VersionUnrecognized` means the executable did not report recognizable + Chrome/Chromium version output, not that it failed an established minimum-version threshold. + `browser_lifecycle` is constructed whenever `enabled` is true, so an undiscovered browser is + "enabled but unavailable", not "disabled". +- Tool seams return `browser_not_compiled_in` (feature absent), `browser_disabled` + (`enabled = false`), and `browser_unavailable` (enabled, not usable), while an implicit `auto` + request returns the HTTP outcome plus a `browser_unavailable` warning carrying the capability + reason. +- `provider_status.browser_capabilities` reports `compiled`, `configured`, `discovered`, + `usable`, `reason`, and lifecycle counters, with a reason string per discovery state. +- Unit coverage exists for the capability report; there is **no** end-to-end lane that runs with no + browser installed. + +## Work packages + +1. **Seam audit.** Build a table of every entry point — CLI `search`/`fetch`, MCP `web_search`, + `web_fetch`, `batch_fetch`, unified `fetch`, `provider_status`, `doctor`, `browser_login`, + `browser_profiles`, and the Python client — and record the exact outcome with no Chrome present. + Any hard failure, panic, hang, or silent HTTP retry at an explicit browser request is a defect. +2. **Taxonomy tightening.** Assert the exact code at each seam for each discovery state, including + the branch where the lifecycle is absent because rendering is disabled versus the branch where it + exists but discovery failed. No call may report `browser_disabled` for a missing executable. +3. **Warning completeness.** Prove the `auto` path emits `browser_unavailable` with the reason + whenever rendering was warranted, and emits nothing when it was not. +4. **Launch-failure path.** A discovered browser can still fail to start (container sandbox, missing + shared library, profile lock). Ensure the outcome names the launch error and never silently + repeats the HTTP fetch; cover the container case with the documented `--no-sandbox` guidance. +5. **No-Chrome CI lane.** Add a lane that removes or hides every browser executable and runs the + seam audit as an executable test: search still returns provider results, fetch still returns + content, explicit browser requests return the exact structured code, and `provider_status` + reports `usable: false` with a reason. This lane is the regression barrier the product currently + lacks. +6. **Documentation.** Publish the degradation table in `docs/features.md` and mirror it in + `docs/config.md` and the browser section of the Python guide, including the discovery order and + the `[fetch.browser].executable` escape hatch. + +## Acceptance + +- The seam audit table is complete and every row passes in the no-Chrome lane. +- Explicit browser requests return exactly `browser_not_compiled_in`, `browser_disabled`, or + `browser_unavailable`; no silent HTTP fallback exists. +- `auto` requests never fail because rendering is unavailable, and warn exactly when warranted. +- `provider_status.browser_capabilities` is accurate for all four discovery states. +- A launch-failure test yields a named reason rather than a bare status. +- `make check`, `make docs-check`, `packaged-assets`, and `planning-consistency` pass. + +## Stop conditions + +Stop and report if any entry point cannot degrade without changing a tool schema, an error code, or +the advertised tool inventory; if the no-Chrome lane cannot be made deterministic on a hosted runner; +or if a launch-failure path would require bundling a browser. diff --git a/plans/implementation/python-pypi-distribution/006-browser-enabled-wheels.md b/plans/implementation/python-pypi-distribution/006-browser-enabled-wheels.md new file mode 100644 index 00000000..b6acf349 --- /dev/null +++ b/plans/implementation/python-pypi-distribution/006-browser-enabled-wheels.md @@ -0,0 +1,54 @@ +# M006 — Browser-Enabled Python Wheels + +Status: active +Date: 2026-11-24 +Baseline: `e012dd7aa9071b1fc14e206e727ac8635f4064e4` on `docs/user-facing-polish-20261123`, after merging `origin/main` `4de20a0f0d748b89147829a51384e385a5bee388` +Subsystem: Python PyPI distribution and prebuilt SBC wheels +Milestone class: capability (distribution alignment) +Decision: `plans/adrs/ADR-0024-browser-enabled-wheels-and-absent-browser-degradation.md` +Dependency: browser M006 absent-browser degradation contract must land first or in the same delivery +References: ADR-0014 §4–§8; `architecture/python-library.md`; `docs/python-library.md`; `bindings/python`; `.github/workflows/python-native-qualification.yml`; `.github/workflows/release-python-pypi.yml`; `packaging/check-http-dependency-shape.py`; `packaging/release-inputs.txt`; `plans/closure/python-pypi-distribution/003-status.md`. + +## Objective + +Ship one Python wheel set whose capability matches the shipped CLI: PDF extraction and browser +rendering both compiled, with system Chrome discovered at runtime and its absence handled by the +degradation contract rather than by a different artifact. + +## Measured baseline (2026-11-23/24, macOS arm64) + +| Fact | Measurement | +|---|---| +| Wheel with `features = ["pdf", "browser"]` | builds, installs, imports | +| Size change | 8,498,057 → 13,064,562 bytes (+4,566,505; +53.7%) | +| Warm build time | 1 min 57 s | +| Native libraries added | none; `reqwest` only via `chromiumoxide`; zero `openssl`/`native-tls` | +| `browser_capabilities` | `compiled/configured/discovered/usable = true` on a Chrome host | +| Render from Python | `renders: 1`, `session_launches: 1`, `resident: true` | +| `--locked` build | fails until `bindings/python/Cargo.lock` is regenerated (11 new entries) | +| `close()` | leaves the browser resident; process exit tears it down | + +## Work packages + +1. **Manifest and lock.** Set the binding dependency to `default-features = false, features = ["pdf", "browser"]`; regenerate the tracked `bindings/python/Cargo.lock`; prove `maturin build --release --locked` succeeds and that an offline sdist build still resolves from the committed lock. +2. **Dependency-shape guard.** `packaging/check-http-dependency-shape.py` inspects only the repository root, and there is no workspace, so the binding graph is currently unchecked. Extend it to evaluate `bindings/python` too: `reqwest` may appear only through `chromiumoxide`, and no `openssl`/`native-tls` node may enter the wheel graph. +3. **Release plumbing.** Add `bindings/python/Cargo.lock` to `packaging/release-inputs.txt` and cover it in the packaged-asset check, so the Python M005 class of defect (a required file missing from the packaged set) cannot recur. +4. **Python process lifetime.** Decide and implement the resident-browser contract at the Python boundary: a client close tears the browser down (preferred) or documents the idle hold; a forked child fails with an explicit error instead of reusing a dead runtime or DevTools handle; idle-teardown and session-cap counters are asserted from Python. +5. **CI lanes.** Extend the wheel matrix with two capability lanes over the existing platform families: one with Chrome that asserts `usable: true` and performs one real render, and one without Chrome that asserts `usable: false` with a reason, an exact `browser_unavailable` code for an explicit request, and unchanged success for search and HTTP fetch. Keep the `armv7-unknown-linux-gnueabihf` compile gate from ADR-0014 §8, now covering the binding crate. +6. **Qualification and documentation.** Record every wheel and sdist size, the installed capability report per platform, and the no-Chrome outcome; update `docs/python-library.md`, `bindings/python/PYTHON_README.md`, `docs/features.md`, and `architecture/python-library.md`; retire the browser roadmap non-goal that forbids rendering in the wheel; bump the version and add a changelog entry for the capability change. + +## Acceptance + +- Six wheels (linux x86_64/aarch64/armv7l, macOS x86_64/arm64, Windows x86_64) and the sdist build with `--locked` from a clean checkout. +- Every wheel installs and reports `compiled: true`; on a Chrome host `usable: true` and one render succeeds. +- On a host without Chrome every wheel installs, imports, searches, and fetches without error; an explicit browser request returns `browser_unavailable` naming the cause; `provider_status` reports `usable: false` with a reason. +- No wheel gains a native shared library for the browser feature; the dependency-shape guard fails if one does. +- Sizes are recorded per target; no target exceeds 20 MB without an explicit review decision. +- `make check`, the Python suites, `make docs-check`, `packaged-assets`, and `planning-consistency` pass. + +## Stop conditions + +Stop and report rather than shipping if: `openssl`, `native-tls`, or any new shared library enters +the wheel graph; the armv7 target fails to compile with the browser feature; a platform's wheel +exceeds 20 MB without an accepted review; the resident-browser or fork semantics cannot be made safe +without changing the public Python API; or ADR-0024 is not accepted. diff --git a/plans/implementation/retrieval-quality-evidence-extension/008-mojeek-default-qualification.md b/plans/implementation/retrieval-quality-evidence-extension/008-mojeek-default-qualification.md new file mode 100644 index 00000000..85e46e37 --- /dev/null +++ b/plans/implementation/retrieval-quality-evidence-extension/008-mojeek-default-qualification.md @@ -0,0 +1,63 @@ +# M008 — Mojeek Generic-Default Provider Qualification + +Status: blocked +Blocker: held-out Mojeek and current-default provider arms did not meet the predeclared reliability, paired-control, and relevance gates. +Source: `plans/subsystems/retrieval-quality-evidence-extension-roadmap.md` M008 +Primary class: capability +Baseline source SHA: `7ec251df2ba715705468f2eb1e5392fa87fc4d32`; rebuild and record the exact release binary identity before trials +References: retrieval-quality M007 plans 001 and 002; `docs/retrieval-quality-cross-domain-live.md`; external runner `scripts/run_retrieval_quality_external_live.py`; fixture provenance `tests/fixtures/retrieval_quality/README.md`; ADR-0006; `plans/003-planning-process.md`. +Dependencies: Interface — frozen M007 SciFact, NQ, and FEVER test query/qrel fixtures and runner report contract, already present in the repository. M007's separate hosted-CI closure remains open and is not claimed here. Operational — reachable keyless Mojeek, DuckDuckGo, Brave HTML, and Yahoo endpoints. No paid provider, credential, or configured external service is allowed. + +## Objective and non-goals + +Determine whether Mojeek has sufficiently reliable and distinct held-out retrieval value to join Eggsearch's generic shipped defaults. Use the same fixed query IDs and repetition numbers for Mojeek and each currently shipped generic default provider. Change production defaults, tests, and user-facing configuration documentation only if every predeclared qualification gate below passes. + +Non-goals: do not amend M007 or its historical reports; do not change ranking, provider adapter/parser/challenge behavior, routing, or MCP contracts; do not add paid providers or credentials; do not change qrels or select queries after observing results; do not retain raw search responses or upstream page bodies; and do not claim general provider superiority from this small positive-qrel sample. A failed, incomplete, or control-incomparable trial leaves the defaults unchanged. + +## Current implementation evidence + +- `src/core/config.rs` ships `default_providers = [duckduckgo, brave, yahoo]` and has Mojeek disabled in `search.providers`. +- `src/core/config/tests.rs` and `tests/config_validation.rs` assert the disabled/default-provider contract; `docs/provider-setup.md`, `docs/config.md`, and `docs/codegg-integration.md` contain user-facing provider/default examples. +- A prior three-query Mojeek-only release-profile smoke returned five unique sources per query with no reported provider errors. That is functional evidence only, not held-out relevance or a default-admission decision. +- The runner scores only URL or normalized-title matches against positive qrels. Unmatched results are unjudged, not irrelevant; cache state is uncontrolled. + +## Frozen trial design + +- Candidate source SHA: `7ec251df2ba715705468f2eb1e5392fa87fc4d32`. Build a release `eggsearch` binary with `cargo build --release --locked --no-default-features --bin eggsearch` and record the binary SHA-256. Do not use the test harness binary. +- Dataset arms: `scifact`, `nq`, and `fever`, using the checked-in frozen test query/qrel fixtures. Exclude Touché 2020 because the runner cannot safely match its opaque qrel IDs. +- Fixed seed: `m008-mojeek-default-qualification-v1`; three deterministically selected queries per dataset, two repetitions, ten results per query, eighteen-second per-attempt timeout. +- Provider arms, isolated by the existing runner: `duckduckgo`, `brave`, `yahoo`, and `mojeek`. Each arm runs the exact same selected query IDs and repetition numbers. Total budget: 72 provider attempts (4 × 3 × 3 × 2); no retries or extra queries. The runner's 80-attempt per-provider ceiling remains in force. +- Build a temporary, credential-free qualification config that enables only these four keyless HTML providers while retaining the shipped three-provider default list; every trial explicitly selects exactly one provider. Record the config fingerprint. Do not read or alter the user's runtime config. +- Run the external runner once per provider/dataset with `--query-count 3 --repetitions 2 --seed m008-mojeek-default-qualification-v1 --max-results 10 --timeout-seconds 18 --max-provider-queries 80`. Preserve complete JSON reports in `plans/closure/retrieval-quality-evidence-extension/evidence/mojeek---m008.json`. + +## Predeclared admission gate + +All conditions are required; otherwise do not change the defaults. + +1. Trial integrity: all 12 reports identify the same exact source SHA, release binary SHA, runner fingerprint, selected query IDs for each dataset, seed, result limit, and timeout; no paid providers or credentials were used; all attempts and all non-success outcomes are represented. +2. Mojeek operations: at least 17/18 outcomes are valid (`results` or `zero_results`), at least 5/6 are valid in each dataset, and at least 4/6 return non-empty result sets in each dataset. Timeouts, provider errors, and command errors count as invalid. +3. Comparable controls: each existing default provider has at least 4/6 valid outcomes in each dataset. A Mojeek match counts as unique only on a query/repetition for which all three existing default-provider arms have valid outcomes and none matched that same relevant corpus document. If this paired coverage is missing, the gate does not pass. +4. Held-out contribution: Mojeek matches at least three distinct query/document pairs, across at least two dataset families, and at least one such pair is unique under condition 3. Repeated observations of the same query/document pair count once. This is a minimum evidence floor, not a superiority claim. +5. Record per-arm valid/error/empty counts, matched qrel pairs and denominators, hit@10, macro/micro recall@10, query-level unique contributions, latency distribution, and all limitations. No qrel match is not interpreted as proof of irrelevance. + +## Ordered work packages + +1. Validate fixture and runner identities, confirm the frozen selection, and build the exact release CLI candidate. +2. Create the minimal temporary qualification config and run the 72 bounded, keyless, paired provider attempts. Preserve every report, including empty responses and failures; do not retry. +3. Evaluate every gate condition from the raw JSON reports and write the qualification summary and closure record. If any condition fails or is unmeasurable, leave shipped defaults and provider enablement unchanged. +4. Only if all gates pass: add Mojeek to the shipped generic default list and enable it in default configuration; update exact-default tests and user-facing default lists/examples in `docs/provider-setup.md`, `docs/config.md`, and `docs/codegg-integration.md`. Do not alter parser or ranking behavior. +5. For a passing candidate, run focused default/config and search integration tests, `make check` and `make docs-check`, then a bounded three-query live default-fan-out smoke using the resulting release binary. Record selected providers, per-provider outcomes, result counts, and latency. If tests or the fan-out smoke fail, revert the default change and record the failure; do not claim qualification. + +## Verification and closure evidence + +- The plan's qualification decision is based on the exact candidate source SHA and binary hash; changes to the source or the frozen cohort invalidate the trial. +- Persist the 12 raw runner JSON reports, qualification summary, and `plans/closure/retrieval-quality-evidence-extension/008-status.md`. Include source/binary/runner/config/corpus fingerprints, exact query IDs, host, per-arm counts and metrics, gate-by-gate verdict, any default fan-out run, tests run, and residual limitations. +- If the gate fails, the closure recommendation is no default change and the evidence must identify the failed/incomplete condition. If it passes, closure additionally requires tests/docs/fan-out acceptance and registry/roadmap updates; hosted CI remains a separate qualification when required by the broader M007 process. + +## Progress — 2026-11-23 + +The exact 72-attempt cohort ran once on the pinned source and release CLI; all 12 runner JSON reports are preserved. Mojeek produced five valid result outcomes, all on SciFact, plus 13 HTTP-status errors and zero matched held-out qrel pairs. The controls also failed the paired-coverage gate (Yahoo had 18 HTTP-status errors; DuckDuckGo/Brave had no valid FEVER outcomes). Trial integrity passed; operational reliability, control comparability, and held-out contribution failed. No defaults, production code, tests, or user-facing default docs changed; the live default-fan-out smoke was skipped. Summary: `plans/closure/retrieval-quality-evidence-extension/mojeek-default-qualification-008.md`; closure: `plans/closure/retrieval-quality-evidence-extension/008-status.md`. No network retries were issued. + +## Stop conditions + +Stop without retries if credentials or paid-provider access are required, if a provider arm cannot use the frozen test cohort, if the exact source/binary identity changes, or if the 18-second per-attempt bound is exceeded. Record a provider outage as an operational outcome, not a relevance score. Never compensate for missing paired controls by treating errors as empty results. diff --git a/plans/implementation/retrieval-quality-evidence-extension/009-paced-mojeek-qualification-rerun.md b/plans/implementation/retrieval-quality-evidence-extension/009-paced-mojeek-qualification-rerun.md new file mode 100644 index 00000000..428613dd --- /dev/null +++ b/plans/implementation/retrieval-quality-evidence-extension/009-paced-mojeek-qualification-rerun.md @@ -0,0 +1,139 @@ +# M009 — Paced Mojeek Default-Qualification Rerun + +Status: blocked (executed 2026-11-23; see `plans/closure/retrieval-quality-evidence-extension/009-status.md`) +Date: 2026-11-23 +Source: `plans/subsystems/retrieval-quality-evidence-extension-roadmap.md` M009 +Primary class: capability (qualification; corrective to the M008 execution protocol) +Baseline source SHA: to be recorded at run time; M008's candidate was `7ec251df2ba715705468f2eb1e5392fa87fc4d32` +References: `plans/implementation/retrieval-quality-evidence-extension/008-mojeek-default-qualification.md`; `plans/closure/retrieval-quality-evidence-extension/008-status.md`; `plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-403-mechanism-controls.json`; external runner `scripts/run_retrieval_quality_external_live.py`; `docs/retrieval-quality-cross-domain-live.md`; ADR-0006; `plans/003-planning-process.md`. +Dependencies: Interface — the frozen M007 SciFact, NQ, and FEVER test query/qrel fixtures and the runner report contract. Operational — reachable keyless Mojeek, DuckDuckGo, Brave HTML, and Yahoo endpoints; confirmed on 2026-11-23. No paid provider, credential, or configured external service. + +## Objective and non-goals + +Re-run the M008 held-out admission gate for Mojeek with an execution protocol that does not itself +provoke Mojeek's automated-query escalation, so the outcome measures the provider rather than the +cohort's own request pressure. + +The gate is unchanged. This milestone changes only how the same frozen trials are paced, and it adds +the per-attempt status capture M008 lacked. + +Non-goals: do not amend M008's historical result, do not relax or re-tune the admission thresholds, +do not change the selected query IDs, qrels, or repetitions, do not change ranking, provider +parsing, routing, challenge behavior, or MCP contracts, do not add paid providers or credentials, and +do not retain raw search responses or upstream page bodies. A failed, incomplete, or refused rerun +leaves the defaults unchanged. + +## Why a rerun is justified + +M008 recorded thirteen Mojeek `http_status` outcomes and concluded Mojeek did not serve this egress. +The 2026-11-23 controls in +`plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-403-mechanism-controls.json` +withdraw the network scope of that reading: + +- the same public address served Mojeek's homepage (`200`) and `/search` with the solvable `200` + ALTCHA wall for ordinary queries, including the held-out question `nq:test2352`; +- the shipped client returned five real results for that question with no provider failures; +- the hard `403` reproduced only for one specific probe string, from three different client + identities, and changing the user agent or client hints changed nothing. + +Sustained automated bursts remain Mojeek's documented escalation path, and M008 issued 72 attempts +without pacing. The rerun therefore tests the same question under a protocol that does not +manufacture the failure. + +Mojeek's `https://www.mojeek.com/robots.txt` still declares `User-agent: *` / `Disallow: /search`. +Running this milestone is an operator decision about that stated preference, not a policy-neutral +act, and it stays opt-in and outside routine CI. + +## Frozen trial design + +- Dataset arms, provider arms, query IDs, and repetitions are identical to M008: `scifact`, `nq`, + `fever`; `duckduckgo`, `brave`, `yahoo`, `mojeek`; three deterministically selected queries per + dataset; two repetitions; ten results per query; eighteen-second per-attempt timeout; 72 provider + attempts total with no retries or extra queries. +- Protocol id `m009-paced-v1`. The dataset selection seed stays the M008 seed + `m008-mojeek-default-qualification-v1` so the same queries are selected; the protocol id names the + changed execution parameters and must appear in every report. +- **Pacing.** Minimum 25 s and maximum 40 s between consecutive attempts of the same provider arm, + derived deterministically from `(protocol id, provider, query id, repetition)` so the schedule is + reproducible. No two attempts to the same provider within 25 s. +- **Stop rule.** Three consecutive `blocked` outcomes for one provider arm abort that arm. The + refusals are recorded and the gate fails for that arm; the arm is not retried to push through. +- **Cooldown.** At most one full rerun per 24 h from the same egress. +- **Status capture.** Every attempt records the classified `error_class`, the HTTP status when the + response carried one, and the attempt start time, so pacing and refusals are checkable from the + report rather than asserted. +- A temporary, credential-free qualification config enabling only these four keyless HTML providers + while retaining the shipped three-provider default list; every trial explicitly selects one + provider. Record the config fingerprint. + +## Work package 1 — runner protocol support (implementation) + +`scripts/run_retrieval_quality_external_live.py` currently exposes `--query-count`, +`--repetitions`, `--seed`, `--max-results`, `--timeout-seconds`, and `--max-provider-queries`, and +records only `error_class` per provider failure (`{"id": …, "error_class": …}`). It has no pacing +and no status capture, which is why M008 could not distinguish refusal classes. + +1. Add a protocol option group: `--protocol-id`, `--min-interval-seconds` (default 25), + `--max-interval-seconds` (default 40), and `--consecutive-blocked-stop` (default 3). Defaults + preserve today's behaviour only when the protocol flags are absent; a paced run must pass a + protocol id and be branded in the report. +2. Wait the deterministic per-attempt interval before each attempt, and record the planned and actual + interval plus the attempt start time in the report. +3. Record `http_status` per attempt, parsing it from the CLI provider-failure message when the + engine reports one (for example `status 403`), and never storing a response body. +4. Abort an arm on the consecutive-blocked stop rule and mark the arm `aborted` with the refusal + count; do not silently convert an aborted arm into a zero-result arm. +5. Add runner unit tests for the schedule determinism, the stop rule, and status extraction from the + two message shapes the engines emit. + +## Predeclared admission gate + +Identical to M008. All conditions are required; otherwise the defaults do not change. + +1. Trial integrity: all 12 reports identify the same source SHA, release binary SHA, runner + fingerprint, protocol id, selected query IDs, seed, result limit, timeout, and pacing parameters; + the recorded intervals satisfy the declared minimum; no paid providers or credentials were used; + every attempt and every non-success outcome is represented. +2. Mojeek operations: at least 17/18 outcomes valid (`results` or `zero_results`), at least 5/6 valid + in each dataset, and at least 4/6 non-empty in each dataset. Timeouts, provider errors, aborted + arms, and command errors count as invalid. +3. Comparable controls: each existing default provider has at least 4/6 valid outcomes in each + dataset; a Mojeek match counts as unique only on a query/repetition where all three controls have + valid outcomes and none matched that corpus document. +4. Held-out contribution: at least three distinct query/document pairs across at least two dataset + families, with at least one pair unique under condition 3. +5. Reporting: per-arm valid/error/empty/aborted counts, matched qrel pairs and denominators, hit@10, + macro and micro recall@10, query-level unique contributions, latency distribution, refusal + reasons, and limitations. No qrel match is never read as proof of irrelevance. + +## Ordered work packages + +1. Implement and test the runner protocol support (work package 1). +2. Freeze the candidate: build `cargo build --release --locked --no-default-features --bin eggsearch`, + record the source SHA, binary SHA-256, runner fingerprint, config fingerprint, protocol id, and + the resolved attempt schedule. +3. Run the twelve arms once each, sequentially, honouring the pacing, stop rule, and 24 h cooldown. +4. Score, record the gate matrix, and either change defaults plus tests and user-facing + documentation together, or record M009 blocked with the defaults untouched. +5. Reconcile M009, the roadmap, and the registry in the same change as the closure record. + +## Acceptance and stop conditions + +- The runner change passes `cargo test` for the affected suites and the repository hygiene checks, + and a dry run on local fixtures shows the declared intervals and the stop rule firing. +- A paced run is valid only if the report itself demonstrates the intervals; a report without timing + evidence fails condition 1. +- Defaults change only when every gate condition passes on the exact candidate. +- **Stop:** a third consecutive blocked outcome ends the arm; a refused arm is not retried within + 24 h; no gate threshold, query ID, or qrel is revised after observing results. + +## Execution outcome + +Executed 2026-11-23 under `m009-paced-v1`. Mojeek met its own reliability condition with 18/18 valid, +18/18 non-empty outcomes and no refusals — against M008's 5/18 — which confirms the pacing premise. + +The gate still failed, on the controls rather than on Mojeek: Yahoo, a shipped default, answered +`500` to all eighteen attempts, so no Mojeek trial had all three controls valid and no paired or +unique contribution could be established. Condition 4 also failed on its own terms with one distinct +qrel pair across one dataset family. Defaults are unchanged and Mojeek remains disabled. See +`plans/closure/retrieval-quality-evidence-extension/009-status.md`. diff --git a/plans/implementation/retrieval-quality-evidence-extension/010-browser-enabled-mojeek-qualification.md b/plans/implementation/retrieval-quality-evidence-extension/010-browser-enabled-mojeek-qualification.md new file mode 100644 index 00000000..f25d9e68 --- /dev/null +++ b/plans/implementation/retrieval-quality-evidence-extension/010-browser-enabled-mojeek-qualification.md @@ -0,0 +1,63 @@ +# M010 — Browser-Enabled Mojeek Default-Qualification Rerun + +Status: blocked (executed 2026-11-23; see `plans/closure/retrieval-quality-evidence-extension/010-status.md`) +Date: 2026-11-23 +Source: `plans/subsystems/retrieval-quality-evidence-extension-roadmap.md` M010 +Primary class: capability (qualification; corrective to the M009 candidate class) +References: M008 plan and closure; M009 plan and closure; ADR-0006; ADR-0019 §5; `architecture/engines.md` § Browser-rendered access; `plans/003-planning-process.md`. + +## Objective + +Re-run the unchanged admission gate with a candidate that can actually serve every control provider, so +condition 3 tests paired control coverage instead of a structural limitation. + +M009 failed condition 3 because Yahoo — a shipped default — answered `500` to all eighteen attempts, +and the `--no-default-features` candidate has no browser. `browser` is a **default** Cargo feature +(`default = ["pdf", "browser"]`), and `engines.md` installs SERP escalation when +`[fetch.browser].enabled` is true and a browser is discovered. M009 therefore measured the candidate +class rather than the gate. + +## Candidate class + +- Build: `cargo build --release --locked --bin eggsearch` (default features, browser included). +- Config: `target/m010-provider-qualification.toml`, identical to the M009 config plus + `[fetch.browser] enabled = true`; shipped `default_providers` still retained. +- Pre-flight (2026-11-23T22:16Z): `search --providers yahoo` returned five real results with no + provider failures in 6.2 s, so browser escalation is available and Google Chrome is installed. + +## Protocol + +`m010-paced-v1`, identical to `m009-paced-v1`: 25–40 s deterministic per-attempt pacing, +abort after three consecutive `blocked`, per-attempt `http_status` and interval capture, same frozen +query IDs (seed `m008-mojeek-default-qualification-v1`), ten results, eighteen-second ceiling, +72 attempts, no retries. + +**Declared deviation.** M009's protocol set a 24 h cooldown before another full rerun from this +egress; M010 runs about 30 minutes later at the operator's direction. The cooldown existed to avoid +driving the host into an escalation; M009 recorded zero Mojeek refusals, and M010 keeps the same +bounded pressure (18 Mojeek attempts, paced). The deviation is recorded rather than hidden, and no +further rerun happens within 24 h of this one. + +## Gate + +Identical to M008/M009 conditions 1–5. Condition 3 is now expected to be satisfiable, which is the +entire point of the milestone. + +## Acceptance + +- Twelve reports whose recorded intervals honour the declared minimum and whose source, binary, + runner, config, protocol, seed, and per-dataset query IDs agree. +- Defaults change only if all five conditions pass. +- A refusal, abort, or control shortfall is recorded; it is not re-pushed. + +## Execution outcome + +Executed 2026-11-23 under `m010-paced-v1`. All twelve arms returned 18/18 valid and 18/18 non-empty +outcomes with no refusals and no aborts, so paired coverage was established for the first time: every +Mojeek trial had three valid controls. + +The gate still failed, now on relevance rather than mechanics. Mojeek produced one distinct qrel pair +(`fever:test194565` → `Kyle_MacLachlan`) across one dataset family with no unique match, against a +floor of three pairs across two families; DuckDuckGo produced five pairs, Brave and Yahoo four each. +Defaults are unchanged and Mojeek remains disabled. See +`plans/closure/retrieval-quality-evidence-extension/010-status.md`. diff --git a/plans/registry.md b/plans/registry.md index 7c92e57e..8d6faa39 100644 --- a/plans/registry.md +++ b/plans/registry.md @@ -25,12 +25,12 @@ Closed or superseded implementation plans are archived under | Subsystem | Status | Roadmap | Current control point or blocker | |---|---|---|---| | Repository security, supply-chain, and maintenance hardening | active; M001, M002, M003, M004, M005, M007, M008, M009, M010, and M011 closed; M006 superseded by ADR-0014 | `plans/subsystems/repository-hardening-roadmap.md` | M007: `plans/archive/implementation/repository-hardening/007-corrective-closure-evidence-and-process-ratchet.md` (closed by M010); M011 closure: `plans/closure/repository-hardening/011-status.md`; chromiumoxide `reqwest` edge accepted and guard-bounded. | -| Python PyPI distribution and prebuilt SBC wheels | active; M001–M003, M005 closed; M004 blocked | `plans/subsystems/python-pypi-distribution-roadmap.md` | M004 awaits physical ARMv7 evidence; M005 closure is recorded in `plans/closure/python-pypi-distribution/005-status.md`. | +| Python PyPI distribution and prebuilt SBC wheels | active; M001–M003, M005 closed; M004 blocked; M006 active (ADR-0024) | `plans/subsystems/python-pypi-distribution-roadmap.md` | M004 awaits physical ARMv7 evidence; M005 closure is recorded in `plans/closure/python-pypi-distribution/005-status.md`; M006: `plans/implementation/python-pypi-distribution/006-browser-enabled-wheels.md` (browser M006 dependency and hosted qualification remain). | | Retrieval quality evidence extension | closing (M007) | `plans/subsystems/retrieval-quality-evidence-extension-roadmap.md` | Local evidence is complete; hosted Linux, macOS, and Windows CI is required on the merged candidate. | -| Agentic retrieval integrity and context economy | active; M001–M046 closed | `plans/subsystems/agentic-retrieval-integrity-roadmap.md` | M030 records the M014 acceptance decision; follow-ups and evidence are in the roadmap and closure records. | +| Agentic retrieval integrity and context economy | active; M001–M048 closed; M049 active | `plans/subsystems/agentic-retrieval-integrity-roadmap.md` | M049: `plans/implementation/agentic-retrieval-integrity/049-non-success-block-classification.md` (canonical gate outstanding); M047/M048 remain closed with their closure records. | | PDF ingestion and extraction fidelity | closing | `plans/subsystems/pdf-ingestion-fidelity-roadmap.md` | M001/M002/M007 are implemented with closure records; M006 qualification remains open; M008 is active by user approval against the existing M001 implementation, with M001 exact-candidate status reconciliation still open; M003–M005 are ready. | | Adaptive fetch target routing and artifacts | active (M001 active; M002 and M003 closed) | `plans/subsystems/adaptive-fetch-routing-roadmap.md` | M002 closed on `24f045729f8409dadc96b4c2455253d8a9c7b6ec`; see `plans/closure/adaptive-fetch-routing/002-status.md`. M001's implementation remains committed on that candidate but its closure record is outstanding. M003 closed on candidate `59ff64ad00940573ee520ecf19d7b5c0abcb1c87`; see `plans/closure/adaptive-fetch-routing/003-status.md`. Local PDF behavior remains owned by PDF M008. | -| Browser artifact availability and render bounds | closing (M001–M005 acceptance complete; PR #16 merged) | `plans/subsystems/browser-artifact-availability-roadmap.md` | M003 closure records hosted qualification and artifact sizes. | +| Browser artifact availability and render bounds | active (M001–M005 acceptance complete; M006 active; PR #16 merged) | `plans/subsystems/browser-artifact-availability-roadmap.md` | M006: `plans/implementation/browser-artifact-availability/006-absent-browser-degradation-contract.md`; hosted no-Chrome qualification remains. | | Knowledge-delta research | active; M001–M007 closed | `plans/subsystems/knowledge-delta-roadmap.md` | Closure evidence is linked from the roadmap. | ## Active and dependency-ready implementation plans @@ -38,6 +38,9 @@ Closed or superseded implementation plans are archived under | Subsystem | Milestone | Status | Plan | Gate | |---|---|---|---|---| | Python PyPI distribution | M004 physical SBC benchmarking | blocked | `plans/implementation/python-pypi-distribution/004-post-publication-sbc-benchmarking.md` | ARMv7 32-bit physical testing is deferred; do not compile on SBCs. | +| Browser artifact availability | M006 absent-browser degradation contract | active | `plans/implementation/browser-artifact-availability/006-absent-browser-degradation-contract.md` | Hosted no-Chrome qualification and exact-candidate closure remain. | +| Python PyPI distribution | M006 browser-enabled wheels | active | `plans/implementation/python-pypi-distribution/006-browser-enabled-wheels.md` | Hard dependency: browser M006; hosted six-target wheel and sdist qualification remain. | +| Agentic retrieval integrity | M049 non-success block classification for Mojeek | active | `plans/implementation/agentic-retrieval-integrity/049-non-success-block-classification.md` | Work package 1 is implemented; the canonical gate remains outstanding. | | Retrieval quality evidence extension | M007 expanded live and consumer acceptance | active | `plans/implementation/retrieval-quality-evidence-extension/001-expanded-live-and-consumer-acceptance.md` | No M006 amendment or production behavior change. | | Retrieval quality evidence extension | M007 cross-domain, extraction, and resource qualification | closing | `plans/implementation/retrieval-quality-evidence-extension/002-cross-domain-extraction-and-resource-qualification.md` | Hosted Linux, macOS, and Windows CI remains. | | PDF ingestion | M001 PDF fetch contract and budgets | closing | `plans/implementation/pdf-ingestion-fidelity/001-pdf-fetch-contract-and-budgets.md` | Closure record is present. | diff --git a/plans/subsystems/agentic-retrieval-integrity-roadmap.md b/plans/subsystems/agentic-retrieval-integrity-roadmap.md index 115ee8df..ba5198a2 100644 --- a/plans/subsystems/agentic-retrieval-integrity-roadmap.md +++ b/plans/subsystems/agentic-retrieval-integrity-roadmap.md @@ -1,7 +1,7 @@ # Agentic Retrieval Integrity and Context Economy Roadmap -Status: active (M001–M046 closed) -Planning baseline: `cd81f4d5e966364918fe2be25485b8ebbf424e71` (origin/main, 2026-11-10 UTC) +Status: active (M001–M048 closed; M049 active) +Planning baseline: `4de20a0f0d748b89147829a51384e385a5bee388` (origin/main, 2026-11-24 UTC) References: `plans/000-long-term-specification.md` §1, 3, 5, 7, 8; `plans/001-terminology-and-domain-model.md` §1–5; `plans/002-long-term-roadmap.md`; `plans/003-planning-process.md`; accepted ADR-0001, ADR-0006, ADR-0016. @@ -136,6 +136,9 @@ ADR-0019 ──> M035 browser challenge completion ADR-0019 §4 ──> M044 challenge solving on by default (corrective to M035) ADR-0006 + ADR-0019 §5 ──> M045 browser-fidelity provider access (closed) └──> M046 fetch browser-escalation parity (closed; corrective to M045) +M039 ──> M047 projection-aware batch-fetch payload budget (closed; corrective) +M048 inline HTML whitespace fidelity (closed; independent) +M045 work package 1 ──> M049 Mojeek non-success block classification (active; canonical gate outstanding) M029 unified fetch ──> M036 unified fetch repo-item budget and outcome M006 repo workflow ──> M037 local repo-search relevance and scope M006 routing ──> M038 security-search native advisory routing @@ -371,6 +374,14 @@ exposed M011's mandatory-`redir` defect. remainder is mandatory schema envelope), and M011's difficulty-6 opt-in requires raising `max_attempts` alongside `max_difficulty` and the timeouts because the shipped attempt default matches the shipped difficulty ceiling of 5. +- M047 and M048 are `closed` on implementation candidate + `9528d4131591392c0d9f6ec5f0422903e4b7815b`; both closure records cite hosted CI run `45127251813`. + Evidence: `plans/closure/agentic-retrieval-integrity/047-status.md` and + `plans/closure/agentic-retrieval-integrity/048-status.md`. +- M049 remains `active`: work package 1 is implemented, but the canonical gate is outstanding. Keep + its classification corrective scoped to the registered keyless behavior and do not infer a new + paid-provider, credential, or default-enable task. Evidence and acceptance gates: + `plans/implementation/agentic-retrieval-integrity/049-non-success-block-classification.md`. ## 10. Recorded decisions diff --git a/plans/subsystems/browser-artifact-availability-roadmap.md b/plans/subsystems/browser-artifact-availability-roadmap.md index 27c02241..d7b28590 100644 --- a/plans/subsystems/browser-artifact-availability-roadmap.md +++ b/plans/subsystems/browser-artifact-availability-roadmap.md @@ -1,11 +1,12 @@ # Browser Artifact Availability and Render Bounds Roadmap -Status: closing (M001–M005 acceptance complete; PR #16 merged as `aea34ee`) +Status: active (M001–M005 acceptance complete; M006 absent-browser degradation in progress; PR #16 merged as `aea34ee`) Baseline: `f265f08` (branch `feat/auto-20261110-0a674cdc`) Owner: fetch/extraction and distribution -Decision: `plans/adrs/ADR-0014-browser-artifact-availability-and-render-bounds.md` +Decision: `plans/adrs/ADR-0014-browser-artifact-availability-and-render-bounds.md`; +`plans/adrs/ADR-0024-browser-enabled-wheels-and-absent-browser-degradation.md` (accepted 2026-11-24) -References: `plans/000-long-term-specification.md` §6, §7; `plans/002-long-term-roadmap.md`; accepted ADR-0002, ADR-0006, ADR-0007, ADR-0009, ADR-0010, ADR-0014; `architecture/fetch.md` §8, §9; `architecture/build.md` § Feature flags matrix; `architecture/packaging.md` § Target contract; `architecture/mcp.md` § Policy; `docs/features.md`; `docs/config.md`; `docs/release.md`; `docs/installation.md`. +References: `plans/000-long-term-specification.md` §6, §7; `plans/002-long-term-roadmap.md`; accepted ADR-0002, ADR-0006, ADR-0007, ADR-0009, ADR-0010, ADR-0014, ADR-0024; `architecture/fetch.md` §8, §9; `architecture/build.md` § Feature flags matrix; `architecture/packaging.md` § Target contract; `architecture/mcp.md` § Policy; `docs/features.md`; `docs/config.md`; `docs/release.md`; `docs/installation.md`. ## 1. Purpose and ownership boundary @@ -52,7 +53,8 @@ M003–M008), the release producer (`release/eggpack/`), challenge solving - OCR, rasterization, a second PDF parser, or an image pipeline. - A new CDP client, a chromiumoxide fork, or a vendored patch. - Per-target feature sets or a browser-enabled variant asset. -- Browser rendering in the Python wheel. +- Browser rendering in the Python wheel — superseded 2026-11-24 by ADR-0024: the wheel compiles + the feature and relies on the M006 degradation contract instead of a different artifact. - Persistent profiles enabled by default, or any profile auto-login. - Making rendering the default extraction path, or automatically rendering pages that rendered empty over HTTP. @@ -60,8 +62,9 @@ M003–M008), the release producer (`release/eggpack/`), challenge solving ## 4. Current state -- Release binaries compile `pdf` and `browser` by default. Browser defaults to - `enabled = true` and `policy = "auto"`; the Python wheel remains PDF-only. +- Release binaries and Python wheels compile `pdf` and `browser`. Browser defaults to + `enabled = true` and `policy = "auto"`; Chrome is discovered at runtime, and its absence is + a supported state governed by M006. - HTTP is the hot path. `auto` escalates only for JavaScript shells, non-interactive verification pages, or detected challenges. - The shared lifecycle enforces `max_requests`, tears down after 90 seconds idle, @@ -120,15 +123,18 @@ M001 render lifecycle bounds PDF roadmap M006 (independent; owns the pdf half) └── coordinates with M003 on wheel feature selection + +M003 ──> M006 absent-browser degradation contract (correctness; independent of the wheel) +ADR-0024 + M006 ──> Python M006 browser-enabled wheels (delivery) ``` - M002 is not dependency-ready until M001 closes: enabling escalation by default while Chrome has no idle teardown would pin roughly 1.2 GB for the lifetime of every long-running session, which is the defect this workstream exists to close. - M003 is evidence work for the exact candidate; it cannot start before M002 lands. -- The PDF half has no new plan. M006 of the PDF roadmap is the vehicle, and the - browser M003 plan owns the wheel's explicit feature selection so the wheel gains - PDF without gaining browser. +- The PDF half had no new plan. The wheel's feature selection was owned by browser M003 and kept + PDF without browser; ADR-0024 supersedes that on 2026-11-24, Python M006 now compiles both, and + browser M006 owns the degradation contract that makes a browser-less host safe. ## 6. Milestones @@ -252,8 +258,8 @@ and continue to receive HTTP extraction. ## 9. Risks and deferred work - **armv7 build.** `chromiumoxide` must compile for `armv7-unknown-linux-gnueabihf`. - This is a hard gate in M002; if it fails, the workstream returns to PDF-only - default rather than introducing per-target feature sets. + This is a hard gate for Python M006 under ADR-0024; if it fails, stop the single-wheel delivery + rather than publishing a PDF-only armv7 variant or introducing per-target feature sets. - **armv7 runtime.** Chromium is effectively unavailable on that target. The feature compiles but cannot escalate, and capability reporting must say so rather than leaving agents to guess. @@ -267,6 +273,26 @@ and continue to receive HTTP extraction. reverse-dependency set stays restricted to chromiumoxide. Removing the edge remains deferred until an upstream release makes HTTP discovery optional; if one appears, it is an optimization under this ADR, not a reopening of it. -- **Wheel parity.** The wheel will not render. This is a deliberate asymmetry, not - an oversight, and must be documented in `docs/python-library.md` and - `docs/features.md`. +- **Wheel parity.** Superseded 2026-11-24 by ADR-0024. The wheel now compiles rendering and the + asymmetry moves from capability to environment: a wheel host without Chrome still runs, and the + M006 degradation contract governs what it reports. + +### M006 — Absent-browser degradation contract (correctness) — active + +**Objective.** Prove and, where needed, complete the promise this workstream already makes: a host +without Chrome still installs, starts, searches, and fetches, and every browser-unavailable outcome +names its exact cause. + +**Why now.** ADR-0024 compiles the feature into the Python wheel as well, so the absence path stops +being an edge case and becomes the default on every machine without a browser. + +**Scope.** Seam audit across the CLI, MCP tools, `provider_status`, `doctor`, `browser_login`, +`browser_profiles`, and the Python client; exact-code assertions for `browser_not_compiled_in`, +`browser_disabled`, and `browser_unavailable`; `auto` warning completeness; the +discovered-but-launch-fails path (container sandbox, missing shared library); a continuous-integration +lane with no browser executable; documentation of the degradation table and discovery order. + +**Exit.** Every seam degrades without panic, hang, or silent explicit fallback; capability reporting +is accurate for all four discovery states; the no-Chrome lane is the regression barrier. + +**Plan.** `plans/implementation/browser-artifact-availability/006-absent-browser-degradation-contract.md`. diff --git a/plans/subsystems/python-pypi-distribution-roadmap.md b/plans/subsystems/python-pypi-distribution-roadmap.md index 3892ee1c..ec4c1d06 100644 --- a/plans/subsystems/python-pypi-distribution-roadmap.md +++ b/plans/subsystems/python-pypi-distribution-roadmap.md @@ -1,8 +1,8 @@ # Python PyPI Distribution and Prebuilt SBC Wheels Roadmap -Status: active (M001–M003 closed; M005 closed; M004 blocked on native ARMv7 32-bit evidence) +Status: active (M001–M003 closed; M005 closed; M004 blocked on native ARMv7 32-bit evidence); M006 active (browser-enabled wheels, ADR-0024 accepted 2026-11-24) Primary outcome: publish the existing in-process `eggsearch` Python package promptly, with CPython 3.11–3.15 and broad precompiled platform wheels, explicitly experimental SBC support, then perform hardware benchmarking **after publication**. -Planning baseline: `main` `13fcac0b7ac0125d38e4e9775ebe1d62028fda72` (2026-10-28; root/binding/pyproject 0.4.4). Refresh the baseline at execution. +Planning baseline: `origin/main` `4de20a0f0d748b89147829a51384e385a5bee388` (2026-11-24; root/binding/pyproject 0.4.4); M006 implementation starts from branch baseline `e012dd7aa9071b1fc14e206e727ac8635f4064e4`. Authority: user confirmed the `eggsearch` PyPI project name is available by manual check and requested a release-first sequence without compiling on SBCs. Owners: `bindings/python`, `.github/workflows/python-native-qualification.yml`, a separate Python publication workflow, Python documentation, and Python-only benchmarking. Not Eggpack. References: `plans/000-long-term-specification.md` §§1, 6–9; `plans/001-terminology-and-domain-model.md`; `plans/002-long-term-roadmap.md`; `plans/003-planning-process.md`; accepted `plans/adrs/ADR-0005-python-native-library-boundary.md`; `architecture/python-library.md`; historical `plans/subsystems/python-native-library-roadmap.md` and `plans/closure/python-native-library/008-status.md`. @@ -41,6 +41,7 @@ The term *experimental SBC support* covers hardware-model/runtime/footprint unce | M002 hosted ARMv7 and Linux wheel expansion | closed | interface: M001 keeps `abi3-py311` stable; operational integration before M003 | Closed at `1135608af5d625cd72db6704adf3bcabd1a58ab1`; hosted ARMv7 hard-float build, ELF audit and CPython 3.11/3.15 QEMU installs passed in run `40729011504`. No SBC compilation; optional musllinux remains deferred. Closure: `plans/closure/python-pypi-distribution/002-status.md`. | | M003 controlled PyPI first publication | closed | interface: established M001/M002 artifact contracts; operational: M001/M002 qualification and exact candidate | Published `eggsearch==0.4.4` from candidate `1135608af5d625cd72db6704adf3bcabd1a58ab1`; workflow `40742653291` passed source/artifact verification, OIDC upload, and public binary-only installs on five native families plus emulated ARMv7. Closure: `plans/closure/python-pypi-distribution/003-status.md`. | | M005 packaged-artifact asset completeness | closed | interface: M001–M003 artifact contracts; corrective to agentic M005 | Closed at `ca24ee1ca7ddd355bd8d2170617238b02ddbaafa`: `src/meta/knowledge_delta/catalog.json` and `packaging/release-targets.txt` were absent from `[package] include`, so `cargo package` verification and the extracted-sdist rebuild failed. Both are packaged, `packaging/check-packaged-assets.py` gates the asset list, and hosted `Python native qualification` run `44839984115` passed. Closure: `plans/closure/python-pypi-distribution/005-status.md`. | +| M006 browser-enabled wheels | capability | active | decision: ADR-0024 accepted; hard: browser M006 absent-browser degradation; interface: M001–M003 artifact contracts | Every wheel compiles PDF and browser, installs on a host without Chrome, reports exact capability and degradation codes, records per-target sizes, and keeps the dependency graph free of native TLS | | M004 post-publication SBC benchmarking and tuning decision | blocked | operational: native ARMv7 32-bit runtime evidence | The published 0.4.4 aarch64 wheel passed native installed-wheel smoke and benchmark on a Libre Computer AML-S905X-CC. Full measurements are in `plans/closure/python-pypi-distribution/004-status.md` and `004-aarch64.json`. The maintainer deferred ARMv7 physical testing; keep that wheel experimental. | M001–M003 are closed. The first public release was manually dispatched through the configured PyPI Trusted Publisher and pre-created GitHub `pypi` environment; the maintainer directed that no required reviewer be used. M004 is post-publication. Its native aarch64 sample is complete; ARMv7 32-bit physical benchmarking is deferred by the maintainer and remains the only M004 blocker. Keep ARMv7 support experimental until that evidence exists. diff --git a/plans/subsystems/retrieval-quality-evidence-extension-roadmap.md b/plans/subsystems/retrieval-quality-evidence-extension-roadmap.md index 9f8febcb..9b776f5a 100644 --- a/plans/subsystems/retrieval-quality-evidence-extension-roadmap.md +++ b/plans/subsystems/retrieval-quality-evidence-extension-roadmap.md @@ -1,6 +1,6 @@ # Retrieval Quality Evidence Extension Roadmap -Status: closing +Status: closing (M007); blocked (M008); blocked (M009); blocked (M010) Source: corrective follow-up to closed deterministic retrieval quality M006 References: `plans/archive/implementation/deterministic-retrieval-quality/006-comparative-qualification-and-closure.md`; `plans/closure/deterministic-retrieval-quality/006-status.md`; ADR-0006. @@ -16,8 +16,10 @@ routine CI. ## Invariants and non-goals -- Keep the closed M001-M006 evidence immutable; no ranking, provider selection, - feature default, MCP tool, or CodeGG policy changes are authorized here. +- Keep the closed M001-M006 evidence immutable. M007 is measurement-only and + authorizes no ranking, provider selection, feature default, MCP tool, or CodeGG + policy changes. Any such production change needs a separate registered milestone + and independently held-out evidence; M008 registers the Mojeek default gate. - Keep routine CI offline and deterministic. Live retrieval and model-backed consumer evaluation require explicit manual dispatch and bounded budgets. - Separate corpus annotations from evaluator implementation and report @@ -31,6 +33,8 @@ routine CI. | Milestone | Class | Dependencies | Exit | |---|---|---|---| | M007 — expanded retrieval evidence and consumer acceptance | infrastructure | Operational: configured keyless providers, reachable SearXNG baseline, Chrome, PDF fixtures, and authorized CodeGG model route | Independently judged real query corpus; repeated bounded keyless trials; observed SearXNG baseline; paired HTML/browser/PDF outcomes; repeated CodeGG task acceptance; exact candidate provenance and honest limitations | +| M008 — Mojeek generic-default provider qualification | capability | Interface: frozen M007 held-out test fixtures and external runner; Operational: reachable keyless Mojeek and current generic defaults | Predeclared paired held-out gate passes on exact candidate; only then change defaults/tests/docs and verify default fan-out, otherwise retain defaults and record the negative/incomplete outcome | +| M009 — paced Mojeek default-qualification rerun | capability (qualification; corrective to the M008 execution protocol) | Hard M008 gate (blocked, unchanged); Interface: frozen fixtures and runner; Operational: reachable keyless Mojeek (confirmed 2026-11-23) | The identical M008 gate re-run under a predeclared paced protocol that records intervals and per-attempt status, with a consecutive-blocked stop rule; defaults change only if every condition passes, and a refused or aborted arm is recorded rather than re-pushed | ## Acceptance and handoff @@ -43,5 +47,54 @@ trial windows and budgets, feature/runtime versions, model route and usage, per-case judgments and failures, plus explicit unavailable/blocked arms in `plans/closure/retrieval-quality-evidence-extension/001-status.md`. Do not revise the M006 comparison report's historical findings; link the -extension report as a later evidence window. Any algorithm or production -policy change requires a separate plan and independently held-out evidence. +extension report as a later evidence window. M008 is a separate qualification +plan, not an amendment to M007, and authorizes a Mojeek default change only if +its predeclared held-out gate passes. Any other algorithm or production policy +change requires a separate plan and independently held-out evidence. + +## Status note (2026-11-23) + +M008 remains blocked and the defaults remain `[duckduckgo, brave, yahoo]`. A bounded keyless capture +identified the response behind the thirteen `http_status` observations: `HTTP 403` with Mojeek's own +363-byte "your network appears to be sending automated queries" page. They are corrected to `blocked` +in `plans/closure/retrieval-quality-evidence-extension/008-status.md`, and the classification defect +that hid the page is corrected by M049 under the agentic retrieval integrity roadmap, which changes no +default, enablement, or credential. + +The refusal is **query-keyed, not network-wide and not user-agent-wide**. Follow-up controls on this +egress served Mojeek's homepage and served `/search` with the solvable `200` ALTCHA wall for ordinary +queries, including the held-out question `nq:test2352`, for which the shipped client returned five +real results with no provider failures. Only the probe string reproduced the `403`, from three +different client identities. The cohort's own 72 rapid attempts remain the most likely escalation +trigger, so the negative result may partly measure the run's request pressure; a paced, bounded rerun +is a reasonable next step but is not authorised by this note. Mojeek's `robots.txt` still declares +`Disallow: /search`, so any rerun remains an operator decision. + +M009 was authorised and executed under that protocol on 2026-11-23 and is **blocked**. Mojeek met its +own reliability condition (18/18 valid, 18/18 non-empty, no refusals, against M008's 5/18), which +confirms the pacing premise, but the gate failed on the controls: Yahoo answered `500` to all +eighteen attempts, so no trial had three valid controls and no paired or unique match could be +established. Condition 4 also failed independently with one distinct qrel pair across one dataset +family. Defaults remain `[duckduckgo, brave, yahoo]` and Mojeek remains disabled. + +The binding constraint is now the gate, not the provider: a browser-free keyless candidate cannot +serve Yahoo, so condition 3 cannot pass in that candidate class. Resolving it needs a new registered +milestone that either qualifies with a browser-enabled candidate or predeclares a control set limited +to providers the tested configuration can actually answer. See +`plans/closure/retrieval-quality-evidence-extension/009-status.md`. + +M010 answered that question and is **blocked** on relevance. With the `browser` feature included and +`[fetch.browser] enabled = true`, Yahoo went from 0/18 to 18/18, so condition 3's pairing requirement +was satisfied for the first time: all twelve arms scored 18/18 valid, 18/18 non-empty, no refusals, +no aborts, minimum observed interval 25.478 s. Mojeek still produced only one distinct qrel pair across +one dataset family with no unique match (hit@10 2/18, micro recall 2/20) against a floor of three pairs +across two families, while DuckDuckGo produced five pairs and Brave and Yahoo four each. The gate was +not re-tuned after the fact. Mojeek is operationally sound at 1.7 s p50; it does not clear the +minimum-evidence floor on this sample, and defaults remain `[duckduckgo, brave, yahoo]`. See +`plans/closure/retrieval-quality-evidence-extension/010-status.md`. + +**Disposition (2026-11-23).** Mojeek remains disabled by default. Browser rendering is already the +shipped default (`default = ["pdf", "browser"]`, with `fetch.browser.enabled` resolving from the +compiled feature), and `default_features_ship_pdf_and_browser` now guards that; the M008/M009 +candidates were built with `--no-default-features`, which was the anomaly. The Python wheel remains +browser-free by ADR-0014 §7. No further Mojeek gate attempt is planned without a new milestone. diff --git a/scripts/run_retrieval_quality_external_live.py b/scripts/run_retrieval_quality_external_live.py index ec2eb707..8f00c75f 100644 --- a/scripts/run_retrieval_quality_external_live.py +++ b/scripts/run_retrieval_quality_external_live.py @@ -51,6 +51,10 @@ KEYLESS_PROVIDERS = {"duckduckgo", "startpage", "yahoo", "brave", "mojeek", "searxng"} MAX_PROVIDER_QUERIES = 80 MAX_RESULTS = 10 +STATUS_PATTERNS = ( + re.compile(r"returned status (\d{3})"), + re.compile(r"on HTTP (\d{3})"), +) DATASET_ARCHIVE_SHA256 = "536e14446a0ba56ed1398ab1055f39fe852686ecad24a6306c80c490fa8e0165" @@ -68,6 +72,30 @@ def normalize_url(value): return value.rstrip("/") +def attempt_interval(protocol_id, provider, query_id, repetition, minimum, maximum): + key = f"{protocol_id}:{provider}:{query_id}:{repetition}".encode() + fraction = int.from_bytes(hashlib.sha256(key).digest()[:8], "big") / float(1 << 64) + return round(minimum + fraction * (maximum - minimum), 3) + + +def http_status_from_errors(errors): + for item in errors: + if not isinstance(item, dict): + continue + message = item.get("message") or "" + for pattern in STATUS_PATTERNS: + found = pattern.search(message) + if found: + return int(found.group(1)) + return None + + +def is_blocked_row(row): + if row.get("outcome") != "provider_error": + return False + return any(error.get("error_class") == "blocked" for error in row.get("provider_errors", [])) + + def load_corpus(dataset_id): manifest = DATASETS[dataset_id] queries_raw = (FIXTURE_DIRECTORY / manifest["query_file"]).read_bytes() @@ -145,10 +173,16 @@ def run_one(binary, config, provider, case, repetition, max_results, timeout): "repetition": repetition, "outcome": outcome, "provider_errors": [ - {"id": item.get("id"), "error_class": item.get("error_class")} + { + "id": item.get("id"), + "error_class": item.get("error_class"), + "http_status": http_status_from_errors([item]), + "message": (item.get("message") or "")[:200], + } for item in errors if isinstance(item, dict) ], + "http_status": http_status_from_errors(errors), "result_count": len(results), "matched_relevant_documents": matches, "relevant_document_count": len(relevant_ids), @@ -165,6 +199,7 @@ def run_one(binary, config, provider, case, repetition, max_results, timeout): "matched_relevant_documents": [], "relevant_document_count": len(case["relevant_documents"]), "matched_relevant_document_count": 0, + "http_status": None, "latency_ms": round(timeout * 1000), "raw_response_sha256": None, } @@ -183,6 +218,10 @@ def main(): parser.add_argument("--max-results", type=int, default=5) parser.add_argument("--timeout-seconds", type=int, default=18) parser.add_argument("--max-provider-queries", type=int, default=80) + parser.add_argument("--protocol-id") + parser.add_argument("--min-interval-seconds", type=float, default=25.0) + parser.add_argument("--max-interval-seconds", type=float, default=40.0) + parser.add_argument("--consecutive-blocked-stop", type=int, default=3) args = parser.parse_args() if not re.fullmatch(r"[0-9a-fA-F]{40}", args.source_sha): @@ -199,24 +238,75 @@ def main(): parser.error("query_count x repetitions exceeds the provider-query ceiling") if args.max_provider_queries > MAX_PROVIDER_QUERIES: parser.error(f"--max-provider-queries cannot exceed {MAX_PROVIDER_QUERIES}") + if args.min_interval_seconds < 0 or args.max_interval_seconds < args.min_interval_seconds: + parser.error("interval bounds must satisfy 0 <= minimum <= maximum") + if args.consecutive_blocked_stop < 1: + parser.error("--consecutive-blocked-stop must be positive") + if not args.protocol_id and ( + args.min_interval_seconds != 25.0 + or args.max_interval_seconds != 40.0 + or args.consecutive_blocked_stop != 3 + ): + parser.error("pacing and stop-rule options require --protocol-id") corpus, corpus_sha, dataset_manifest = load_corpus(args.dataset) selected = select_cases(corpus["cases"], args.query_count, args.seed) binary_sha = digest(args.binary.read_bytes()) + protocol = None + if args.protocol_id: + protocol = { + "id": args.protocol_id, + "mode": "paced", + "min_interval_seconds": args.min_interval_seconds, + "max_interval_seconds": args.max_interval_seconds, + "consecutive_blocked_stop": args.consecutive_blocked_stop, + } rows = [] - for repetition in range(1, args.repetitions + 1): - for case in selected: - rows.append( - run_one( - args.binary, - args.config, - args.provider, - case, - repetition, - args.max_results, - args.timeout_seconds, - ) + aborted = False + previous_started = None + consecutive_blocked = 0 + attempts = [ + (repetition, case) + for repetition in range(1, args.repetitions + 1) + for case in selected + ] + for repetition, case in attempts: + planned_interval = 0.0 + if protocol and previous_started is not None: + planned_interval = attempt_interval( + protocol["id"], + args.provider, + case["id"], + repetition, + args.min_interval_seconds, + args.max_interval_seconds, ) + remaining = previous_started + planned_interval - time.monotonic() + if remaining > 0: + time.sleep(remaining) + started = time.monotonic() + started_wall = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()) + actual_interval = None if previous_started is None else round(started - previous_started, 3) + previous_started = started + row = run_one( + args.binary, + args.config, + args.provider, + case, + repetition, + args.max_results, + args.timeout_seconds, + ) + row["started_at_utc"] = started_wall + if protocol: + row["planned_interval_seconds"] = planned_interval + row["actual_interval_seconds"] = actual_interval + rows.append(row) + if protocol: + consecutive_blocked = consecutive_blocked + 1 if is_blocked_row(row) else 0 + if consecutive_blocked >= args.consecutive_blocked_stop: + aborted = True + break expected_documents = sum(len(case["relevant_documents"]) for case in selected) valid_rows = [row for row in rows if row["outcome"] in {"results", "zero_results"}] @@ -229,6 +319,28 @@ def main(): if valid_rows else None ) + observed_intervals = [ + row["actual_interval_seconds"] + for row in rows + if row.get("actual_interval_seconds") is not None + ] + pacing = { + "attempts": len(rows), + "min_observed_interval_seconds": min(observed_intervals) if observed_intervals else None, + "violations": [ + row["query_id"] + for row in rows + if row.get("actual_interval_seconds") is not None + and row["actual_interval_seconds"] < args.min_interval_seconds + ], + } + refused_attempts = sum(1 for row in rows if is_blocked_row(row)) + http_status_counts = {} + for row in rows: + status = row.get("http_status") + if status is not None: + http_status_counts[str(status)] = http_status_counts.get(str(status), 0) + 1 + report = { "schema_version": 1, "dataset": corpus["dataset"], @@ -247,6 +359,11 @@ def main(): "query_ids": [case["id"] for case in selected], "query_count": len(selected), "repetitions": args.repetitions, + "protocol": protocol, + "pacing": pacing, + "aborted": aborted, + "refused_attempts": refused_attempts, + "http_status_counts": http_status_counts, "provider_query_attempts": len(rows), "max_results": args.max_results, "timeout_seconds_per_attempt": args.timeout_seconds, diff --git a/scripts/test_retrieval_quality_runner.py b/scripts/test_retrieval_quality_runner.py new file mode 100644 index 00000000..6fef6df4 --- /dev/null +++ b/scripts/test_retrieval_quality_runner.py @@ -0,0 +1,146 @@ +import json +import os +import stat +import subprocess +import sys +import tempfile +import unittest +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import run_retrieval_quality_external_live as runner + + +BLOCKED_OUTPUT = { + "results": [], + "providers_failed": [ + { + "id": "mojeek", + "error_class": "blocked", + "message": "engine 'mojeek' blocked: challenge page detected (automated queries) on HTTP 403", + } + ], +} +BAD_STATUS_OUTPUT = { + "results": [], + "providers_failed": [ + {"id": "mojeek", "error_class": "http_status", "message": "engine 'mojeek' returned status 503"} + ], +} +RESULTS_OUTPUT = { + "results": [{"title": "Example", "url": "https://example.com", "snippet": "s"}], + "providers_failed": [], +} + + +def write_stub(directory, payload): + path = Path(directory) / "stub-binary.sh" + path.write_text("#!/bin/sh\necho '" + json.dumps(payload) + "'\n") + path.chmod(path.stat().st_mode | stat.S_IEXEC) + return path + + +def run_script(binary, extra): + command = [ + sys.executable, + str(Path(runner.__file__)), + "--binary", + str(binary), + "--source-sha", + "0" * 40, + "--provider", + "mojeek", + "--dataset", + "scifact", + "--query-count", + "2", + "--repetitions", + "2", + "--max-results", + "5", + "--timeout-seconds", + "5", + *extra, + ] + completed = subprocess.run(command, capture_output=True, text=True, check=False) + if completed.returncode != 0: + raise AssertionError(completed.stderr) + return json.loads(completed.stdout) + + +class ScheduleTests(unittest.TestCase): + def test_interval_is_deterministic_and_bounded(self): + first = runner.attempt_interval("m009-paced-v1", "mojeek", "scifact:1", 1, 25.0, 40.0) + second = runner.attempt_interval("m009-paced-v1", "mojeek", "scifact:1", 1, 25.0, 40.0) + self.assertEqual(first, second) + self.assertGreaterEqual(first, 25.0) + self.assertLessEqual(first, 40.0) + + def test_interval_varies_by_attempt_identity(self): + values = { + runner.attempt_interval("m009-paced-v1", "mojeek", f"scifact:{index}", repetition, 25.0, 40.0) + for index in range(6) + for repetition in (1, 2) + } + self.assertGreater(len(values), 1) + + +class StatusExtractionTests(unittest.TestCase): + def test_bad_status_message(self): + self.assertEqual(runner.http_status_from_errors(BAD_STATUS_OUTPUT["providers_failed"]), 503) + + def test_blocked_message_carries_status(self): + self.assertEqual(runner.http_status_from_errors(BLOCKED_OUTPUT["providers_failed"]), 403) + + def test_absent_status_is_none(self): + self.assertIsNone(runner.http_status_from_errors([{"id": "x", "error_class": "timeout"}])) + + def test_blocked_row_detection(self): + self.assertTrue(runner.is_blocked_row({"outcome": "provider_error", "provider_errors": BLOCKED_OUTPUT["providers_failed"]})) + self.assertFalse(runner.is_blocked_row({"outcome": "provider_error", "provider_errors": BAD_STATUS_OUTPUT["providers_failed"]})) + self.assertFalse(runner.is_blocked_row({"outcome": "results", "provider_errors": []})) + + +class ProtocolTests(unittest.TestCase): + def test_consecutive_blocks_abort_the_arm(self): + with tempfile.TemporaryDirectory() as directory: + binary = write_stub(directory, BLOCKED_OUTPUT) + report = run_script( + binary, + [ + "--protocol-id", "m009-test", + "--min-interval-seconds", "0.05", + "--max-interval-seconds", "0.1", + "--consecutive-blocked-stop", "3", + ], + ) + self.assertTrue(report["aborted"]) + self.assertEqual(report["provider_query_attempts"], 3) + self.assertEqual(report["refused_attempts"], 3) + self.assertEqual(report["http_status_counts"], {"403": 3}) + self.assertEqual(report["protocol"]["id"], "m009-test") + self.assertEqual(report["pacing"]["violations"], []) + self.assertGreaterEqual(report["pacing"]["min_observed_interval_seconds"], 0.05) + self.assertIsNone(report["rows"][0]["actual_interval_seconds"]) + + def test_single_block_run_completes(self): + with tempfile.TemporaryDirectory() as directory: + binary = write_stub(directory, RESULTS_OUTPUT) + report = run_script(binary, ["--protocol-id", "m009-test", "--min-interval-seconds", "0.05", "--max-interval-seconds", "0.1"]) + self.assertFalse(report["aborted"]) + self.assertEqual(report["provider_query_attempts"], 4) + self.assertEqual(report["refused_attempts"], 0) + self.assertEqual(report["pacing"]["violations"], []) + + def test_unpaced_run_keeps_legacy_report(self): + with tempfile.TemporaryDirectory() as directory: + binary = write_stub(directory, RESULTS_OUTPUT) + report = run_script(binary, []) + self.assertIsNone(report["protocol"]) + self.assertFalse(report["aborted"]) + self.assertEqual(report["provider_query_attempts"], 4) + self.assertNotIn("actual_interval_seconds", report["rows"][0]) + + +if __name__ == "__main__": + unittest.main() diff --git a/src/commands/browser_login.rs b/src/commands/browser_login.rs index 4d8ec921..68980ad2 100644 --- a/src/commands/browser_login.rs +++ b/src/commands/browser_login.rs @@ -45,9 +45,9 @@ pub async fn run(cfg: &AppConfig, origin: &str, profile_name: Option<&str>) -> R // Discover the browser before creating any profile state so an // invalid configured executable cannot leave an orphaned profile. - let discovery = match eggsearch::fetch::browser::discover_browser( - cfg.fetch.browser.executable.as_deref(), - ) { + let discovery_state = + eggsearch::fetch::browser::discover_browser(cfg.fetch.browser.executable.as_deref()); + let discovery = match &discovery_state { eggsearch::fetch::browser::BrowserDiscoveryState::Available(discovery) => Some(discovery), eggsearch::fetch::browser::BrowserDiscoveryState::ExplicitPathInvalid { path } => { return Err(anyhow!("configured browser executable is invalid: {path}")); @@ -73,7 +73,7 @@ pub async fn run(cfg: &AppConfig, origin: &str, profile_name: Option<&str>) -> R println!(" Profile: {}", profile_dir.display()); println!(); - if let Some(ref discovery) = discovery { + if let Some(discovery) = discovery { println!( "Chrome discovered. Launching headed browser at {}...", meta.allowed_origin @@ -109,7 +109,10 @@ pub async fn run(cfg: &AppConfig, origin: &str, profile_name: Option<&str>) -> R } } } else { - println!("No Chrome/Chromium executable found."); + println!( + "Browser unavailable: {}", + unavailable_browser_reason(&discovery_state) + ); println!("Install Chrome or set [fetch.browser].executable in config."); println!(); println!("Profile '{display_name}' has been created. Once Chrome is available,"); @@ -119,6 +122,11 @@ pub async fn run(cfg: &AppConfig, origin: &str, profile_name: Option<&str>) -> R Ok(()) } +fn unavailable_browser_reason(state: &eggsearch::fetch::browser::BrowserDiscoveryState) -> String { + eggsearch::fetch::browser::browser_discovery_reason(state) + .unwrap_or_else(|| "browser rendering is unavailable".to_string()) +} + async fn launch_headed_browser( cfg: &AppConfig, discovery: &eggsearch::fetch::browser::BrowserDiscovery, @@ -192,4 +200,14 @@ mod tests { assert_eq!(parse_major_version("1"), Some(1)); assert_eq!(parse_major_version("abc"), None); } + + #[test] + fn browser_absent_login_names_unrecognized_version() { + let state = eggsearch::fetch::browser::BrowserDiscoveryState::VersionUnrecognized { + version: "Chromium unknown".to_string(), + }; + let reason = unavailable_browser_reason(&state); + assert!(reason.contains("not recognized as Chrome/Chromium")); + assert!(reason.contains("Chromium unknown")); + } } diff --git a/src/commands/fetch.rs b/src/commands/fetch.rs index 8241a62f..f8f30a78 100644 --- a/src/commands/fetch.rs +++ b/src/commands/fetch.rs @@ -10,9 +10,9 @@ use std::sync::Arc; #[cfg(feature = "browser")] use eggsearch::fetch::browser::{ - browser_fetch_with_policy, browser_result_to_response, discover_browser, escalate, - gated_status, BrowserConfig, BrowserFetchError, BrowserFetchOutcome, BrowserLifecycle, - EscalationOutcome, EscalationRequest, RenderPolicy, + browser_discovery_reason, browser_fetch_with_policy, browser_result_to_response, + discover_browser, escalate, gated_status, BrowserConfig, BrowserFetchError, + BrowserFetchOutcome, BrowserLifecycle, EscalationOutcome, EscalationRequest, RenderPolicy, }; /// CLI-visible link cap; the extractor retains more for programmatic consumers. @@ -127,6 +127,11 @@ async fn fetch_response( other => anyhow::bail!("URL must be http or https; got '{other}'"), } + #[cfg(not(feature = "browser"))] + if cfg.fetch.browser.policy == "browser" { + anyhow::bail!("browser_not_compiled_in: browser rendering is not compiled into this build"); + } + if let Some(0) = max_chars { anyhow::bail!("max_chars must be > 0"); } @@ -163,31 +168,27 @@ async fn fetch_response( #[cfg(feature = "browser")] let render_policy = cli_render_policy(&browser_settings); #[cfg(feature = "browser")] + let browser_discovery_state = discover_browser(browser_settings.executable.as_deref()); + #[cfg(feature = "browser")] + let browser_unavailable_reason = browser_discovery_reason(&browser_discovery_state) + .unwrap_or_else(|| "browser rendering is unavailable".to_string()); + #[cfg(feature = "browser")] let browser_lifecycle = if matches!(render_policy, RenderPolicy::HttpOnly) { None } else { - let discovery = discover_browser(browser_settings.executable.as_deref()) - .discovery() - .cloned(); Some(Arc::new(BrowserLifecycle::new( - discovery, + browser_discovery_state.discovery().cloned(), browser_settings.clone(), ))) }; #[cfg(feature = "browser")] if matches!(render_policy, RenderPolicy::Browser) { - let lifecycle = browser_lifecycle.as_ref().ok_or_else(|| { - anyhow!( - "render policy is 'browser' but browser rendering is unavailable; \ - set [fetch.browser].executable or install Chrome/Chromium" - ) - })?; + let lifecycle = browser_lifecycle + .as_ref() + .ok_or_else(|| anyhow!("browser_disabled: browser rendering is disabled in config"))?; if !lifecycle.is_available() { - anyhow::bail!( - "render policy is 'browser' but no Chrome/Chromium executable was found; \ - set [fetch.browser].executable or install Chrome/Chromium" - ); + anyhow::bail!("browser_unavailable: {browser_unavailable_reason}"); } let remaining = deadline.saturating_duration_since(std::time::Instant::now()); if remaining.as_millis() < 2000 { @@ -204,8 +205,13 @@ async fn fetch_response( ), ) .await - .map_err(|_| anyhow!("browser rendering timed out"))? - .map_err(|error| anyhow!("browser_fetch_failed: {error}"))?; + .map_err(|_| anyhow!("browser_unavailable: browser rendering timed out"))? + .map_err(|error| match error { + BrowserFetchError::LaunchFailed(reason) => { + anyhow!("browser_unavailable: browser launch failed: {reason}") + } + other => anyhow!("browser_fetch_failed: {other}"), + })?; if rendered.challenge_completed { eggsearch::challenge_replay::record_browser_completion(); } @@ -233,7 +239,89 @@ async fn fetch_response( match eggsearch::challenge_replay::fetch_with_challenge_replay(&client, url, &challenge_plan) .await { - Ok(response) => Ok(response), + Ok(response) => { + #[allow(unused_mut)] + let mut response = response; + #[cfg(feature = "browser")] + if matches!(render_policy, RenderPolicy::Auto) && response_requires_browser(&response) { + if let Some(lifecycle) = browser_lifecycle.as_ref() { + if !lifecycle.is_available() { + response.structured_warnings.push( + eggsearch::core::warning::AgentWarning::new( + eggsearch::core::warning::WarningCode::BrowserUnavailable, + browser_unavailable_reason.clone(), + ), + ); + } else { + let remaining = + deadline.saturating_duration_since(std::time::Instant::now()); + let unavailable_reason = if remaining.as_millis() < 2000 { + Some( + "insufficient remaining call budget for browser rendering" + .to_string(), + ) + } else { + match tokio::time::timeout( + remaining, + browser_fetch_with_policy( + lifecycle, + url, + &browser_settings, + cfg.fetch.sanitize_output, + &render_policy, + ), + ) + .await + { + Ok(Ok(rendered)) => { + if rendered.challenge_completed { + eggsearch::challenge_replay::record_browser_completion(); + } + return Ok(browser_result_to_response( + rendered, + url, + budgets, + extract_mode, + include_links, + cfg.fetch.sanitize_output, + )); + } + Ok(Err(BrowserFetchError::LaunchFailed(reason))) => { + Some(format!("browser launch failed: {reason}")) + } + Ok(Err(error)) => { + Some(format!("browser escalation failed: {error}")) + } + Err(_) => { + Some("browser escalation exceeded the call budget".to_string()) + } + } + }; + if let Some(reason) = unavailable_reason { + response.structured_warnings.push( + eggsearch::core::warning::AgentWarning::new( + eggsearch::core::warning::WarningCode::BrowserUnavailable, + reason, + ), + ); + } + } + } + } + #[cfg(not(feature = "browser"))] + if cfg.fetch.browser.enabled + && cfg.fetch.browser.policy == "auto" + && response_requires_browser(&response) + { + response + .structured_warnings + .push(eggsearch::core::warning::AgentWarning::new( + eggsearch::core::warning::WarningCode::BrowserUnavailable, + "browser rendering is not compiled into this build".to_string(), + )); + } + Ok(response) + } Err(error) => { #[cfg(feature = "browser")] if matches!(render_policy, RenderPolicy::Auto) { @@ -246,11 +334,8 @@ async fn fetch_response( policy: &render_policy, browser_available: lifecycle .is_some_and(|lifecycle| lifecycle.is_available()), - unavailable_reason: if lifecycle.is_some() { - Some("no Chrome/Chromium executable was found") - } else { - None - }, + unavailable_reason: lifecycle + .map(|_| browser_unavailable_reason.as_str()), profile_name: None, budgets, extract_mode, @@ -314,6 +399,20 @@ async fn fetch_response( } } +fn response_requires_browser(response: &WebFetchResponse) -> bool { + let body = response.raw_text.as_deref().unwrap_or(""); + let text_len = response + .raw_text_chars_returned + .unwrap_or_else(|| body.chars().count()); + eggsearch::fetch::classify::browser_rendering_is_warranted( + response.status, + response.content_type.as_deref(), + response.title.as_deref(), + text_len, + body.as_bytes(), + ) +} + /// Resolve the CLI policy; a disabled browser forces `http_only`, matching MCP behavior. #[cfg(feature = "browser")] fn cli_render_policy(settings: &BrowserConfig) -> RenderPolicy { @@ -391,6 +490,168 @@ mod tests { ); } + #[cfg(feature = "browser")] + fn browser_absent_config() -> AppConfig { + let mut cfg = AppConfig::default(); + cfg.fetch.allow_localhost = true; + cfg.fetch.allow_private_network = true; + cfg.fetch.browser.enabled = true; + cfg.fetch.browser.executable = Some("/synthetic/missing/chrome".to_string()); + cfg + } + + #[cfg(feature = "browser")] + #[tokio::test] + async fn browser_absent_auto_warns_only_when_rendering_is_warranted() { + use httpmock::prelude::*; + + let server = MockServer::start(); + let _ordinary = server.mock(|when, then| { + when.method(GET).path("/ordinary"); + then.status(200) + .header("content-type", "text/html") + .body("Ordinary page with readable content and no render markers."); + }); + let _verification = server.mock(|when, then| { + when.method(GET).path("/verification"); + then.status(200) + .header("content-type", "text/html") + .body("Checking your browserPlease wait while we verify."); + }); + let cfg = browser_absent_config(); + + let ordinary = fetch_response( + &cfg, + &server.url("/ordinary"), + Some(1000), + Some(5000), + false, + false, + false, + ) + .await + .expect("ordinary HTTP fetch succeeds without Chrome"); + assert!(!ordinary.structured_warnings.iter().any( + |warning| warning.code == eggsearch::core::warning::WarningCode::BrowserUnavailable + )); + + let verification = fetch_response( + &cfg, + &server.url("/verification"), + Some(1000), + Some(5000), + false, + false, + false, + ) + .await + .expect("auto fetch retains HTTP response when Chrome is absent"); + assert!(verification + .structured_warnings + .iter() + .any(|warning| warning.code + == eggsearch::core::warning::WarningCode::BrowserUnavailable + && warning.message.contains("/synthetic/missing/chrome"))); + } + + #[cfg(not(feature = "browser"))] + #[tokio::test] + async fn browser_uncompiled_auto_warns_only_when_rendering_is_warranted() { + use httpmock::prelude::*; + + let server = MockServer::start(); + let _ordinary = server.mock(|when, then| { + when.method(GET).path("/ordinary"); + then.status(200) + .header("content-type", "text/html") + .body("Ordinary readable article content."); + }); + let _verification = server.mock(|when, then| { + when.method(GET).path("/verification"); + then.status(200) + .header("content-type", "text/html") + .body("Checking your browserPlease wait while we verify."); + }); + let mut cfg = AppConfig::default(); + cfg.fetch.allow_localhost = true; + cfg.fetch.allow_private_network = true; + cfg.fetch.browser.enabled = true; + cfg.fetch.browser.policy = "auto".to_string(); + + let ordinary = fetch_response( + &cfg, + &server.url("/ordinary"), + Some(1000), + Some(5000), + false, + false, + false, + ) + .await + .expect("ordinary HTTP fetch succeeds without the browser feature"); + assert!(!ordinary.structured_warnings.iter().any(|warning| { + warning.code == eggsearch::core::warning::WarningCode::BrowserUnavailable + })); + + let verification = fetch_response( + &cfg, + &server.url("/verification"), + Some(1000), + Some(5000), + false, + false, + false, + ) + .await + .expect("auto fetch retains HTTP response without the browser feature"); + assert!(verification.structured_warnings.iter().any(|warning| { + warning.code == eggsearch::core::warning::WarningCode::BrowserUnavailable + && warning.message.contains("not compiled") + })); + } + + #[cfg(not(feature = "browser"))] + #[tokio::test] + async fn browser_not_compiled_cli_request_has_stable_code() { + let mut cfg = AppConfig::default(); + cfg.fetch.browser.policy = "browser".to_string(); + let error = fetch_response( + &cfg, + "https://example.test/explicit-browser", + None, + Some(5000), + false, + false, + false, + ) + .await + .expect_err("explicit browser request requires the browser feature"); + assert!( + error.to_string().contains("browser_not_compiled_in"), + "{error}" + ); + } + + #[cfg(feature = "browser")] + #[tokio::test] + async fn browser_absent_explicit_cli_request_names_code_and_reason() { + let mut cfg = browser_absent_config(); + cfg.fetch.browser.policy = "browser".to_string(); + let error = fetch_response( + &cfg, + "https://example.test/explicit-browser", + None, + Some(5000), + false, + false, + false, + ) + .await + .expect_err("explicit browser request must reject unavailable Chrome"); + assert!(error.to_string().contains("browser_unavailable")); + assert!(error.to_string().contains("/synthetic/missing/chrome")); + } + #[tokio::test] async fn run_zero_max_chars_returns_error() { let cfg = AppConfig::default(); diff --git a/src/core/batch_fetch.rs b/src/core/batch_fetch.rs index d1adb6b4..17fe4c12 100644 --- a/src/core/batch_fetch.rs +++ b/src/core/batch_fetch.rs @@ -174,7 +174,7 @@ pub struct BatchFetchResult { pub error: Option, /// Approximate character count of the returned text content. pub chars_returned: usize, - /// Unicode scalar count of the serialized response value before projection. + /// Unicode scalar count of the serialized response value after response-detail projection. #[serde(default)] pub payload_chars: usize, /// Response fields removed to fit the aggregate payload budget. diff --git a/src/fetch/browser/classify.rs b/src/fetch/browser/classify.rs index ebaf8a69..66394016 100644 --- a/src/fetch/browser/classify.rs +++ b/src/fetch/browser/classify.rs @@ -1,381 +1 @@ -#[derive(Clone, Debug, PartialEq, Eq)] -pub enum FetchDisposition { - UsefulContent, - JavascriptShell, - NonInteractiveVerification, - InteractiveChallenge, - RateLimited, - AccessDenied, - AuthenticationRequired, - ServerError, - Unsupported, -} - -impl FetchDisposition { - /// Whether the browser should wait for a scripted wall to clear. - #[must_use] - pub fn is_script_wall(&self) -> bool { - matches!( - self, - Self::JavascriptShell | Self::NonInteractiveVerification - ) - } -} - -/// Rendered text below this length never overrides an interstitial status. -const RENDERED_CONTENT_MIN_CHARS: usize = 200; - -pub fn classify_response( - status: u16, - content_type: Option<&str>, - title: Option<&str>, - text_len: usize, - body_snippet: &[u8], -) -> FetchDisposition { - if status == 401 { - return FetchDisposition::AuthenticationRequired; - } - - let ct = content_type.unwrap_or(""); - let is_html = ct.is_empty() || ct.contains("text/html"); - if is_html { - let title_lower = title.unwrap_or("").to_lowercase(); - let body_lower = String::from_utf8_lossy(body_snippet).to_lowercase(); - - // Classify challenge markers before status; some solvable walls arrive as 429. - if is_interactive_challenge(&title_lower, &body_lower) { - return FetchDisposition::InteractiveChallenge; - } - if is_noninteractive_verification(&title_lower, &body_lower) { - return FetchDisposition::NonInteractiveVerification; - } - if is_javascript_shell(&title_lower, text_len, &body_lower) { - return FetchDisposition::JavascriptShell; - } - // After rendering, accept substantial content only for 202/429; other failures remain failures. - if matches!(status, 202 | 429) && text_len >= RENDERED_CONTENT_MIN_CHARS { - return FetchDisposition::UsefulContent; - } - } - - match status { - 403 | 404 => FetchDisposition::AccessDenied, - 429 => FetchDisposition::RateLimited, - 500..=599 => FetchDisposition::ServerError, - _ => FetchDisposition::UsefulContent, - } -} - -/// Accept rendered content only on success/redirect or after a recognized wall completes. -#[must_use] -pub fn rendered_result_serves(status: Option, challenge_completed: bool) -> bool { - challenge_completed || status.is_some_and(|status| (200..400).contains(&status)) -} - -fn is_interactive_challenge(title_lower: &str, body: &str) -> bool { - if title_lower.contains("access denied") - || title_lower.contains("security check") - || title_lower.contains("verify you are human") - { - return true; - } - - // Match explicit widget markers; generic "captcha" text may accompany a solvable wall. - let indicators = [ - "cf-turnstile", - "challenge-platform", - "g-recaptcha", - "h-captcha", - "hcaptcha.com", - "recaptcha/api", - "interactive challenge", - "verify you are human", - ]; - for indicator in &indicators { - if body.contains(indicator) { - return true; - } - } - - false -} - -fn is_noninteractive_verification(title_lower: &str, body: &str) -> bool { - let markers = [ - "just a moment", - "checking your browser", - "please wait", - "verifying", - "security verification", - ]; - for marker in &markers { - if title_lower.contains(marker) || body.contains(marker) { - return true; - } - } - false -} - -fn is_javascript_shell(_title_lower: &str, text_len: usize, body: &str) -> bool { - let body_lower = body.to_lowercase(); - - if text_len < 50 - && (body_lower.contains("
0 { - let ratio = script_count as f64 / tag_count as f64; - if ratio > 0.3 && text_len < 100 && body_lower.contains("= 3 && body_lower.contains("Hello world" - ), - FetchDisposition::UsefulContent - ); - } - - #[test] - fn http_401_returns_auth_required() { - assert_eq!( - classify_response(401, Some("text/html"), None, 0, b""), - FetchDisposition::AuthenticationRequired - ); - } - - #[test] - fn http_403_returns_access_denied() { - assert_eq!( - classify_response(403, Some("text/html"), None, 0, b""), - FetchDisposition::AccessDenied - ); - } - - #[test] - fn http_429_returns_rate_limited() { - assert_eq!( - classify_response(429, Some("text/html"), None, 0, b""), - FetchDisposition::RateLimited - ); - } - - #[test] - fn http_500_returns_server_error() { - assert_eq!( - classify_response(500, Some("text/html"), None, 0, b""), - FetchDisposition::ServerError - ); - } - - #[test] - fn interstitial_status_with_a_rendered_page_is_useful_content() { - assert_eq!( - classify_response( - 429, - Some("text/html"), - Some("rust programming language - Brave Search"), - 12000, - b"
results
" - ), - FetchDisposition::UsefulContent - ); - } - - #[test] - fn a_short_interstitial_document_keeps_its_status() { - assert_eq!( - classify_response( - 429, - Some("text/html"), - Some("Brave Search"), - 26, - b"" - ), - FetchDisposition::RateLimited - ); - assert_eq!( - classify_response( - 500, - Some("text/html"), - Some("Server"), - 900, - b"" - ), - FetchDisposition::ServerError - ); - assert_eq!( - classify_response( - 403, - Some("text/html"), - Some("Denied"), - 900, - b"" - ), - FetchDisposition::AccessDenied - ); - } - - #[test] - fn scripted_wall_beats_its_status() { - let body = b"Verifying you're not a bot. Quick check before you continue searching."; - assert_eq!( - classify_response(429, Some("text/html"), Some("Brave Search"), 64, body), - FetchDisposition::NonInteractiveVerification - ); - } - - #[test] - fn offering_a_traditional_captcha_is_not_an_interactive_challenge() { - let body = b"Switch to traditional CAPTCHA"; - assert_eq!( - classify_response(429, Some("text/html"), Some("Brave Search"), 500, body), - FetchDisposition::UsefulContent - ); - } - - #[test] - fn non_html_returns_useful() { - assert_eq!( - classify_response(200, Some("application/json"), None, 0, b"{}"), - FetchDisposition::UsefulContent - ); - } - - #[test] - fn interactive_challenge_detected() { - assert_eq!( - classify_response( - 200, - Some("text/html"), - Some("Access Denied"), - 200, - b"Access Denied" - ), - FetchDisposition::InteractiveChallenge - ); - } - - #[test] - fn captcha_body_marker() { - assert_eq!( - classify_response( - 200, - Some("text/html"), - Some("Just a moment"), - 300, - b"
" - ), - FetchDisposition::InteractiveChallenge - ); - } - - #[test] - fn noninteractive_verification_detected() { - assert_eq!( - classify_response( - 200, - Some("text/html"), - Some("Just a moment..."), - 200, - b"Please wait while we verify your browser" - ), - FetchDisposition::NonInteractiveVerification - ); - } - - #[test] - fn js_shell_empty_root() { - let body = r#"App
"#; - assert_eq!( - classify_response(200, Some("text/html"), Some("App"), 20, body.as_bytes()), - FetchDisposition::JavascriptShell - ); - } - - #[test] - fn js_shell_high_script_density() { - let body = r#"
"#; - assert_eq!( - classify_response(200, Some("text/html"), Some("App"), 10, body.as_bytes()), - FetchDisposition::JavascriptShell - ); - } - - #[test] - fn useful_content_with_scripts_and_text() { - let body = r#"

This is a real page with lots of text content that makes it useful.

"#; - assert_eq!( - classify_response( - 200, - Some("text/html"), - Some("Article"), - 500, - body.as_bytes() - ), - FetchDisposition::UsefulContent - ); - } -} +pub use crate::fetch::classify::*; diff --git a/src/fetch/browser/discover.rs b/src/fetch/browser/discover.rs index 3f6b43ac..004cab55 100644 --- a/src/fetch/browser/discover.rs +++ b/src/fetch/browser/discover.rs @@ -8,26 +8,42 @@ pub fn discover_browser(configured_path: Option<&str>) -> BrowserDiscoveryState if let Some(path) = configured_path { if !path.is_empty() { let p = PathBuf::from(path); - match try_validate(&p, BrowserSource::Configured) { - Some(disc) => return BrowserDiscoveryState::Available(disc), - None => { - return BrowserDiscoveryState::ExplicitPathInvalid { - path: path.to_string(), - }; + return match try_validate(&p, BrowserSource::Configured) { + CandidateValidation::Available(discovery) => { + BrowserDiscoveryState::Available(discovery) } - } + CandidateValidation::VersionUnrecognized(version) => { + BrowserDiscoveryState::VersionUnrecognized { version } + } + CandidateValidation::Invalid => BrowserDiscoveryState::ExplicitPathInvalid { + path: path.to_string(), + }, + }; } } + let mut unrecognized_version = None; for candidate in linux_candidates() { - if let Some(disc) = try_validate(&candidate, BrowserSource::AutoDiscovered) { - return BrowserDiscoveryState::Available(disc); + match try_validate(&candidate, BrowserSource::AutoDiscovered) { + CandidateValidation::Available(discovery) => { + return BrowserDiscoveryState::Available(discovery) + } + CandidateValidation::VersionUnrecognized(version) => { + unrecognized_version.get_or_insert(version); + } + CandidateValidation::Invalid => {} } } for candidate in macos_candidates() { - if let Some(disc) = try_validate_expanded(&candidate, BrowserSource::AutoDiscovered) { - return BrowserDiscoveryState::Available(disc); + match try_validate_expanded(&candidate, BrowserSource::AutoDiscovered) { + CandidateValidation::Available(discovery) => { + return BrowserDiscoveryState::Available(discovery) + } + CandidateValidation::VersionUnrecognized(version) => { + unrecognized_version.get_or_insert(version); + } + CandidateValidation::Invalid => {} } } @@ -38,13 +54,36 @@ pub fn discover_browser(configured_path: Option<&str>) -> BrowserDiscoveryState "chromium-browser", ] { if let Some(path) = find_in_path(name) { - if let Some(discovery) = try_validate(&path, BrowserSource::AutoDiscovered) { - return BrowserDiscoveryState::Available(discovery); + match try_validate(&path, BrowserSource::AutoDiscovered) { + CandidateValidation::Available(discovery) => { + return BrowserDiscoveryState::Available(discovery) + } + CandidateValidation::VersionUnrecognized(version) => { + unrecognized_version.get_or_insert(version); + } + CandidateValidation::Invalid => {} } } } - BrowserDiscoveryState::NotFound + unrecognized_version.map_or(BrowserDiscoveryState::NotFound, |version| { + BrowserDiscoveryState::VersionUnrecognized { version } + }) +} + +pub fn browser_discovery_reason(state: &BrowserDiscoveryState) -> Option { + match state { + BrowserDiscoveryState::Available(_) => None, + BrowserDiscoveryState::ExplicitPathInvalid { path } => Some(format!( + "configured browser executable is invalid: {path}; set [fetch.browser].executable to a valid executable" + )), + BrowserDiscoveryState::NotFound => Some( + "no Chrome/Chromium executable was found; install Chrome/Chromium or set [fetch.browser].executable".to_string(), + ), + BrowserDiscoveryState::VersionUnrecognized { version } => Some(format!( + "browser version output is not recognized as Chrome/Chromium: {version}; set [fetch.browser].executable to a Chrome/Chromium executable that reports its version" + )), + } } fn linux_candidates() -> Vec { @@ -65,23 +104,26 @@ fn macos_candidates() -> Vec { ] } -fn try_validate(path: &Path, source: BrowserSource) -> Option { - if !path.exists() { - return None; - } - if !path.is_file() { - return None; - } +enum CandidateValidation { + Available(BrowserDiscovery), + VersionUnrecognized(String), + Invalid, +} - if !is_executable(path) { - return None; +fn try_validate(path: &Path, source: BrowserSource) -> CandidateValidation { + if !path.exists() || !path.is_file() || !is_executable(path) { + return CandidateValidation::Invalid; + } + let Some(version) = run_version(path) else { + return CandidateValidation::Invalid; + }; + if !has_recognized_version_output(&version) { + return CandidateValidation::VersionUnrecognized(version); } - let family = detect_family(path); - let version = run_version(path)?; - Some(BrowserDiscovery { + CandidateValidation::Available(BrowserDiscovery { path: path.to_path_buf(), - family, + family: detect_family(path), version, source, }) @@ -100,15 +142,26 @@ fn is_executable(path: &Path) -> bool { path.is_file() } -fn try_validate_expanded(path_str: &str, source: BrowserSource) -> Option { +fn try_validate_expanded(path_str: &str, source: BrowserSource) -> CandidateValidation { let expanded = if let Some(rest) = path_str.strip_prefix("~/") { - dirs::home_dir()?.join(rest) + let Some(home) = dirs::home_dir() else { + return CandidateValidation::Invalid; + }; + home.join(rest) } else { PathBuf::from(path_str) }; try_validate(&expanded, source) } +fn has_recognized_version_output(version: &str) -> bool { + let version = version.trim(); + let recognized_product = ["Google Chrome", "Chrome", "Chromium"] + .iter() + .any(|product| version.starts_with(product)); + recognized_product && super::profiles::parse_browser_major_version(version).is_some() +} + fn detect_family(path: &Path) -> BrowserFamily { let name = path .file_name() @@ -262,6 +315,14 @@ mod tests { ); } + #[test] + fn version_output_requires_a_recognized_product_and_version() { + assert!(has_recognized_version_output("Google Chrome 142.0.7431.0")); + assert!(has_recognized_version_output("Chromium 120.0.0.0")); + assert!(!has_recognized_version_output("Chrome unknown")); + assert!(!has_recognized_version_output("Unknown browser 120.0.0.0")); + } + #[test] fn capability_report_no_browser() { let report = browser_capability_report(true, false, None); @@ -270,4 +331,33 @@ mod tests { assert_eq!(report["executable_discovered"], false); assert_eq!(report["usable"], false); } + + #[test] + fn discovery_reasons_cover_every_state() { + let available = BrowserDiscoveryState::Available(BrowserDiscovery { + path: PathBuf::from("/synthetic/chrome"), + family: BrowserFamily::Chrome, + version: "Chrome 120.0.0.0".to_string(), + source: BrowserSource::Configured, + }); + assert_eq!(browser_discovery_reason(&available), None); + assert_eq!( + browser_discovery_reason(&BrowserDiscoveryState::ExplicitPathInvalid { + path: "/synthetic/missing/chrome".to_string(), + }) + .as_deref(), + Some("configured browser executable is invalid: /synthetic/missing/chrome; set [fetch.browser].executable to a valid executable") + ); + assert_eq!( + browser_discovery_reason(&BrowserDiscoveryState::NotFound).as_deref(), + Some("no Chrome/Chromium executable was found; install Chrome/Chromium or set [fetch.browser].executable") + ); + assert_eq!( + browser_discovery_reason(&BrowserDiscoveryState::VersionUnrecognized { + version: "Chromium unknown".to_string(), + }) + .as_deref(), + Some("browser version output is not recognized as Chrome/Chromium: Chromium unknown; set [fetch.browser].executable to a Chrome/Chromium executable that reports its version") + ); + } } diff --git a/src/fetch/browser/mod.rs b/src/fetch/browser/mod.rs index 73684d30..fb7e70db 100644 --- a/src/fetch/browser/mod.rs +++ b/src/fetch/browser/mod.rs @@ -13,7 +13,7 @@ pub use capture::{ MAX_SCREENSHOT_WIDTH, }; pub use classify::{classify_response, rendered_result_serves, FetchDisposition}; -pub use discover::{browser_capability_report, discover_browser}; +pub use discover::{browser_capability_report, browser_discovery_reason, discover_browser}; pub use escalation::{escalate, gated_status, EscalationOutcome, EscalationRequest}; pub use intercept::{is_request_allowed, is_request_allowed_with_dns, PolicyViolation}; pub use lifecycle::{BrowserLaunchError, BrowserLifecycle, BrowserLifecycleStatus}; diff --git a/src/fetch/browser/navigate.rs b/src/fetch/browser/navigate.rs index a8c4d80b..26cd7ce6 100644 --- a/src/fetch/browser/navigate.rs +++ b/src/fetch/browser/navigate.rs @@ -1,6 +1,8 @@ use std::sync::{Arc, Mutex as StdMutex}; use std::time::{Duration, Instant}; +#[cfg(feature = "mock")] +use base64::Engine as _; use chromiumoxide::cdp::browser_protocol::fetch as cdp_fetch; use chromiumoxide::cdp::browser_protocol::network as cdp_network; use chromiumoxide::page::Page; @@ -18,6 +20,16 @@ use crate::core::sanitize::{ bound_text, frame, scan_injection_markers, strip_control_chars, TrustMarkers, TITLE_MAX_CHARS, }; +#[cfg(feature = "mock")] +const MOCK_BROWSER_FIXTURE_URL: &str = "https://93.184.216.34/eggsearch-browser-render-fixture"; +#[cfg(feature = "mock")] +const MOCK_BROWSER_FIXTURE_BODY: &str = concat!( + "browser fixture", + "

http-only-marker

" +); + /// Status and content type of the main document response, captured /// from CDP Network.responseReceived events. type CapturedMainResponse = (u16, Option); @@ -230,6 +242,32 @@ async fn enforce_policy_per_request(page: &Page) -> Option { + #[cfg(feature = "mock")] + if request_url == MOCK_BROWSER_FIXTURE_URL { + let body = base64::engine::general_purpose::STANDARD + .encode(MOCK_BROWSER_FIXTURE_BODY.as_bytes()); + let params = cdp_fetch::FulfillRequestParams { + request_id: event.request_id.clone(), + response_code: 200, + response_headers: Some(vec![cdp_fetch::HeaderEntry { + name: "Content-Type".to_string(), + value: "text/html; charset=utf-8".to_string(), + }]), + body: Some(body.into()), + binary_response_headers: None, + response_phrase: None, + }; + if task_page.execute(params).await.is_err() { + let _ = task_page + .execute(cdp_fetch::FailRequestParams::new( + event.request_id.clone(), + cdp_network::ErrorReason::Failed, + )) + .await; + } + continue; + } + let _ = task_page .execute(cdp_fetch::ContinueRequestParams::new( event.request_id.clone(), @@ -812,6 +850,12 @@ mod tests { use super::super::intercept::is_request_allowed; use super::*; + #[cfg(feature = "mock")] + #[test] + fn mock_browser_fixture_uses_policy_approved_public_target() { + assert!(is_request_allowed(MOCK_BROWSER_FIXTURE_URL).is_ok()); + } + #[test] fn policy_blocks_private_url() { assert!(is_request_allowed("http://127.0.0.1/").is_err()); diff --git a/src/fetch/browser/types.rs b/src/fetch/browser/types.rs index ac9d2613..6538ae10 100644 --- a/src/fetch/browser/types.rs +++ b/src/fetch/browser/types.rs @@ -326,10 +326,9 @@ impl BrowserAvailability { #[derive(Clone, Debug)] pub enum BrowserDiscoveryState { Available(BrowserDiscovery), - NotConfigured, ExplicitPathInvalid { path: String }, NotFound, - VersionUnsupported { version: String }, + VersionUnrecognized { version: String }, } impl BrowserDiscoveryState { diff --git a/src/fetch/classify.rs b/src/fetch/classify.rs new file mode 100644 index 00000000..ea8bf311 --- /dev/null +++ b/src/fetch/classify.rs @@ -0,0 +1,418 @@ +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum FetchDisposition { + UsefulContent, + JavascriptShell, + NonInteractiveVerification, + InteractiveChallenge, + RateLimited, + AccessDenied, + AuthenticationRequired, + ServerError, + Unsupported, +} + +impl FetchDisposition { + /// Whether the browser should wait for a scripted wall to clear. + #[must_use] + pub fn is_script_wall(&self) -> bool { + matches!( + self, + Self::JavascriptShell | Self::NonInteractiveVerification + ) + } +} + +/// Rendered text below this length never overrides an interstitial status. +const RENDERED_CONTENT_MIN_CHARS: usize = 200; + +pub fn classify_response( + status: u16, + content_type: Option<&str>, + title: Option<&str>, + text_len: usize, + body_snippet: &[u8], +) -> FetchDisposition { + if status == 401 { + return FetchDisposition::AuthenticationRequired; + } + + let ct = content_type.unwrap_or(""); + let is_html = ct.is_empty() || ct.contains("text/html"); + if is_html { + let title_lower = title.unwrap_or("").to_lowercase(); + let body_lower = String::from_utf8_lossy(body_snippet).to_lowercase(); + + // Classify challenge markers before status; some solvable walls arrive as 429. + if is_interactive_challenge(&title_lower, &body_lower) { + return FetchDisposition::InteractiveChallenge; + } + if is_noninteractive_verification(&title_lower, &body_lower) { + return FetchDisposition::NonInteractiveVerification; + } + if is_javascript_shell(&title_lower, text_len, &body_lower) { + return FetchDisposition::JavascriptShell; + } + // After rendering, accept substantial content only for 202/429; other failures remain failures. + if matches!(status, 202 | 429) && text_len >= RENDERED_CONTENT_MIN_CHARS { + return FetchDisposition::UsefulContent; + } + } + + match status { + 403 | 404 => FetchDisposition::AccessDenied, + 429 => FetchDisposition::RateLimited, + 500..=599 => FetchDisposition::ServerError, + _ => FetchDisposition::UsefulContent, + } +} + +/// Accept rendered content only on success/redirect or after a recognized wall completes. +#[must_use] +pub fn rendered_result_serves(status: Option, challenge_completed: bool) -> bool { + challenge_completed || status.is_some_and(|status| (200..400).contains(&status)) +} + +fn is_interactive_challenge(title_lower: &str, body: &str) -> bool { + if title_lower.contains("access denied") + || title_lower.contains("security check") + || title_lower.contains("verify you are human") + { + return true; + } + + // Match explicit widget markers; generic "captcha" text may accompany a solvable wall. + let indicators = [ + "cf-turnstile", + "challenge-platform", + "g-recaptcha", + "h-captcha", + "hcaptcha.com", + "recaptcha/api", + "interactive challenge", + "verify you are human", + ]; + for indicator in &indicators { + if body.contains(indicator) { + return true; + } + } + + false +} + +fn is_noninteractive_verification(title_lower: &str, body: &str) -> bool { + let markers = [ + "just a moment", + "checking your browser", + "please wait", + "verifying", + "security verification", + ]; + for marker in &markers { + if title_lower.contains(marker) || body.contains(marker) { + return true; + } + } + false +} + +fn is_javascript_shell(_title_lower: &str, text_len: usize, body: &str) -> bool { + let body_lower = body.to_lowercase(); + + if text_len < 50 + && (body_lower.contains("
0 { + let ratio = script_count as f64 / tag_count as f64; + if ratio > 0.3 && text_len < 100 && body_lower.contains("= 3 && body_lower.contains(", + title: Option<&str>, + text_len: usize, + body: &[u8], +) -> bool { + let body_text = String::from_utf8_lossy(body); + crate::fetch::challenge::detect(title, &body_text).is_some() + || classify_response(status, content_type, title, text_len, body).is_script_wall() +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn browser_warrant_classification_is_feature_independent() { + assert!(browser_rendering_is_warranted( + 200, + Some("text/html"), + Some("Checking your browser"), + 10, + b"Please wait", + )); + assert!(browser_rendering_is_warranted( + 200, + Some("text/html"), + Some("App"), + 10, + br#"
"#, + )); + assert!(!browser_rendering_is_warranted( + 200, + Some("text/html"), + Some("Article"), + 500, + b"Ordinary readable article content.", + )); + } + + #[test] + fn only_the_two_script_wall_dispositions_wait_for_completion() { + assert!(FetchDisposition::JavascriptShell.is_script_wall()); + assert!(FetchDisposition::NonInteractiveVerification.is_script_wall()); + for settled in [ + FetchDisposition::UsefulContent, + FetchDisposition::InteractiveChallenge, + FetchDisposition::RateLimited, + FetchDisposition::AccessDenied, + FetchDisposition::AuthenticationRequired, + FetchDisposition::ServerError, + FetchDisposition::Unsupported, + ] { + assert!(!settled.is_script_wall(), "{settled:?} must not wait"); + } + } + + #[test] + fn a_render_serves_only_when_it_improved_on_the_status() { + assert!(rendered_result_serves(Some(200), false)); + assert!(rendered_result_serves(Some(302), false)); + assert!( + rendered_result_serves(Some(503), true), + "a completed wall is served whatever the document status says" + ); + assert!( + !rendered_result_serves(Some(500), false), + "an error page the browser only re-rendered is not the document" + ); + assert!(!rendered_result_serves(None, false)); + assert!( + rendered_result_serves(None, true), + "a completed wall is served even without an observed status" + ); + } + + #[test] + fn useful_content() { + assert_eq!( + classify_response( + 200, + Some("text/html"), + Some("My Page"), + 500, + b"Hello world" + ), + FetchDisposition::UsefulContent + ); + } + + #[test] + fn http_401_returns_auth_required() { + assert_eq!( + classify_response(401, Some("text/html"), None, 0, b""), + FetchDisposition::AuthenticationRequired + ); + } + + #[test] + fn http_403_returns_access_denied() { + assert_eq!( + classify_response(403, Some("text/html"), None, 0, b""), + FetchDisposition::AccessDenied + ); + } + + #[test] + fn http_429_returns_rate_limited() { + assert_eq!( + classify_response(429, Some("text/html"), None, 0, b""), + FetchDisposition::RateLimited + ); + } + + #[test] + fn http_500_returns_server_error() { + assert_eq!( + classify_response(500, Some("text/html"), None, 0, b""), + FetchDisposition::ServerError + ); + } + + #[test] + fn interstitial_status_with_a_rendered_page_is_useful_content() { + assert_eq!( + classify_response( + 429, + Some("text/html"), + Some("rust programming language - Brave Search"), + 12000, + b"
results
" + ), + FetchDisposition::UsefulContent + ); + } + + #[test] + fn a_short_interstitial_document_keeps_its_status() { + assert_eq!( + classify_response( + 429, + Some("text/html"), + Some("Brave Search"), + 26, + b"" + ), + FetchDisposition::RateLimited + ); + assert_eq!( + classify_response( + 500, + Some("text/html"), + Some("Server"), + 900, + b"" + ), + FetchDisposition::ServerError + ); + assert_eq!( + classify_response( + 403, + Some("text/html"), + Some("Denied"), + 900, + b"" + ), + FetchDisposition::AccessDenied + ); + } + + #[test] + fn scripted_wall_beats_its_status() { + let body = b"Verifying you're not a bot. Quick check before you continue searching."; + assert_eq!( + classify_response(429, Some("text/html"), Some("Brave Search"), 64, body), + FetchDisposition::NonInteractiveVerification + ); + } + + #[test] + fn offering_a_traditional_captcha_is_not_an_interactive_challenge() { + let body = b"Switch to traditional CAPTCHA"; + assert_eq!( + classify_response(429, Some("text/html"), Some("Brave Search"), 500, body), + FetchDisposition::UsefulContent + ); + } + + #[test] + fn non_html_returns_useful() { + assert_eq!( + classify_response(200, Some("application/json"), None, 0, b"{}"), + FetchDisposition::UsefulContent + ); + } + + #[test] + fn interactive_challenge_detected() { + assert_eq!( + classify_response( + 200, + Some("text/html"), + Some("Access Denied"), + 200, + b"Access Denied" + ), + FetchDisposition::InteractiveChallenge + ); + } + + #[test] + fn captcha_body_marker() { + assert_eq!( + classify_response( + 200, + Some("text/html"), + Some("Just a moment"), + 300, + b"
" + ), + FetchDisposition::InteractiveChallenge + ); + } + + #[test] + fn noninteractive_verification_detected() { + assert_eq!( + classify_response( + 200, + Some("text/html"), + Some("Just a moment..."), + 200, + b"Please wait while we verify your browser" + ), + FetchDisposition::NonInteractiveVerification + ); + } + + #[test] + fn js_shell_empty_root() { + let body = r#"App
"#; + assert_eq!( + classify_response(200, Some("text/html"), Some("App"), 20, body.as_bytes()), + FetchDisposition::JavascriptShell + ); + } + + #[test] + fn js_shell_high_script_density() { + let body = r#"
"#; + assert_eq!( + classify_response(200, Some("text/html"), Some("App"), 10, body.as_bytes()), + FetchDisposition::JavascriptShell + ); + } + + #[test] + fn useful_content_with_scripts_and_text() { + let body = r#"

This is a real page with lots of text content that makes it useful.

"#; + assert_eq!( + classify_response( + 200, + Some("text/html"), + Some("Article"), + 500, + body.as_bytes() + ), + FetchDisposition::UsefulContent + ); + } +} diff --git a/src/fetch/mod.rs b/src/fetch/mod.rs index cc005025..48a08d43 100644 --- a/src/fetch/mod.rs +++ b/src/fetch/mod.rs @@ -13,6 +13,8 @@ pub mod budget; pub mod cache; /// Anti-bot challenge detection for plain HTTP responses. pub mod challenge; +#[allow(missing_docs)] +pub mod classify; pub mod client; pub mod detect; pub mod egress; diff --git a/src/fetch/render/blocks.rs b/src/fetch/render/blocks.rs index a63647d4..55bec431 100644 --- a/src/fetch/render/blocks.rs +++ b/src/fetch/render/blocks.rs @@ -443,9 +443,8 @@ fn collect_text_parts<'a>( return; } if let Some(text) = node.value().as_text() { - let s = text.trim(); - if !s.is_empty() { - parts.push(s.to_string()); + if !text.is_empty() { + parts.push(text.to_string()); } } else if let Some(elem) = ElementRef::wrap(node) { if should_skip(&elem) { @@ -454,22 +453,24 @@ fn collect_text_parts<'a>( let tag = elem.value().name(); if markdown && tag == "code" { // Inline code: wrap in backticks. - let inner = collect_raw_text(node).trim().to_string(); - if !inner.is_empty() { - parts.push(format!("`{inner}`")); - } + let raw_inner = collect_raw_text(node); + let inner = raw_inner.trim(); + let rendered = (!inner.is_empty()).then(|| format!("`{inner}`")); + push_inline_part_with_source_boundaries(parts, &raw_inner, rendered); return; } if markdown && tag == "a" { // Inline link: produce [text](url) Markdown syntax. let href = elem.value().attr("href").unwrap_or(""); - let link_text = collect_raw_text(node).trim().to_string(); - if !link_text.is_empty() && !href.is_empty() { + let raw_link_text = collect_raw_text(node); + let link_text = raw_link_text.trim(); + let rendered = if link_text.is_empty() || href.is_empty() { + None + } else { let resolved = resolve_url(href, base_url); - parts.push(format!("[{link_text}]({resolved})")); - } else if !link_text.is_empty() { - parts.push(link_text); - } + Some(format!("[{link_text}]({resolved})")) + }; + push_inline_part_with_source_boundaries(parts, &raw_link_text, rendered); return; } for child in node.children() { @@ -478,6 +479,30 @@ fn collect_text_parts<'a>( } } +fn push_inline_part_with_source_boundaries( + parts: &mut Vec, + source: &str, + rendered: Option, +) { + let trimmed = source.trim(); + if trimmed.is_empty() { + if !source.is_empty() { + parts.push(source.to_string()); + } + return; + } + + let leading_len = source.len() - source.trim_start().len(); + if leading_len > 0 { + parts.push(source[..leading_len].to_string()); + } + parts.push(rendered.unwrap_or_else(|| trimmed.to_string())); + let trailing_start = source.trim_end().len(); + if trailing_start < source.len() { + parts.push(source[trailing_start..].to_string()); + } +} + /// Collect raw text from a node, preserving whitespace (for code blocks). fn collect_raw_text<'a>(node: NodeRef<'a, scraper::Node>) -> String { let mut text = String::new(); @@ -845,10 +870,7 @@ mod tests { let (_, _, rendered, _, _) = render_blocks(html, "https://example.com/", 10000, false); assert_eq!(rendered.blocks.len(), 1); assert_eq!(rendered.blocks[0].kind, BlockKind::Code); - assert!(rendered.blocks[0].text.contains("line1")); - assert!(rendered.blocks[0].text.contains(" line2")); - assert!(rendered.blocks[0].text.contains(" line3")); - assert!(rendered.blocks[0].text.contains('\n')); + assert_eq!(rendered.blocks[0].text, "line1\n line2\n line3"); } #[test] @@ -930,6 +952,42 @@ mod tests { .contains("[other site](https://other.com/x)")); } + #[test] + fn inline_whitespace_preserves_source_boundaries_exactly() { + let cases = [ + ( + "

Before linked text \n then sample after.

", + "Before linked text then sample after.", + "Before [linked text](https://example.com/docs) then `sample` after.", + ), + ( + "

Seethisx,next!

", + "Seethisx,next!", + "See[this](https://example.com/docs)`x`,next!", + ), + ( + "

Before linked after

", + "Before linked after", + "Before [linked](https://example.com/docs) after", + ), + ( + "

Before sample after

", + "Before sample after", + "Before `sample` after", + ), + ]; + + for (html, text_expected, markdown_expected) in cases { + let (_, _, text_rendered, _, _) = + render_blocks(html.as_bytes(), "https://example.com/page", 10000, false); + let (_, _, markdown_rendered, _, _) = + render_blocks(html.as_bytes(), "https://example.com/page", 10000, true); + + assert_eq!(text_rendered.blocks[0].text, text_expected); + assert_eq!(markdown_rendered.blocks[0].text, markdown_expected); + } + } + #[test] fn empty_main_falls_back_to_body() { let html = b"Sparse Main

Body content that should be visible and is long enough to pass the threshold.

"; diff --git a/src/mcp/projection.rs b/src/mcp/projection.rs index 505e7561..f33c93f1 100644 --- a/src/mcp/projection.rs +++ b/src/mcp/projection.rs @@ -96,7 +96,7 @@ pub fn project_with_limits( detail: ResponseDetail, limits: ProjectionLimits, ) -> serde_json::Value { - match detail { + let mut projected = match detail { ResponseDetail::Brief => project_brief(tool, value, limits), ResponseDetail::Diagnostic => value, ResponseDetail::Compact => economy_project( @@ -127,6 +127,53 @@ pub fn project_with_limits( "build_evidence_bundle" => value, _ => value, }, + }; + if matches!(tool, "fetch" | "batch_fetch") { + refresh_batch_fetch_payload_counts(&mut projected); + } + projected +} + +fn refresh_batch_fetch_payload_counts(value: &mut serde_json::Value) { + let has_payload_telemetry = value.get("total_payload_chars").is_some() + || value + .get("results") + .and_then(serde_json::Value::as_array) + .is_some_and(|results| { + results + .iter() + .any(|result| result.get("payload_chars").is_some()) + }); + if !has_payload_telemetry { + return; + } + let total_payload_chars = { + let Some(results) = value + .get_mut("results") + .and_then(serde_json::Value::as_array_mut) + else { + return; + }; + let mut total = 0usize; + for result in results { + let payload_chars = result + .get("response") + .filter(|response| !response.is_null()) + .and_then(|response| serde_json::to_string(response).ok()) + .map(|serialized| serialized.chars().count()) + .unwrap_or(0); + if let Some(object) = result.as_object_mut() { + object.insert("payload_chars".to_string(), payload_chars.into()); + } + total = total.saturating_add(payload_chars); + } + total + }; + if let Some(object) = value.as_object_mut() { + object.insert( + "total_payload_chars".to_string(), + total_payload_chars.into(), + ); } } @@ -1095,22 +1142,26 @@ fn project_repo_map(mut value: serde_json::Value, compact: bool) -> serde_json:: } fn project_batch_fetch(mut value: serde_json::Value, compact: bool) -> serde_json::Value { + let detail = if compact { + ResponseDetail::Compact + } else { + ResponseDetail::Standard + }; if let Some(results) = value.get_mut("results").and_then(|v| v.as_array_mut()) { for result in results.iter_mut() { - let item_type = result + let is_repo = result .get("item_type") .and_then(|v| v.as_str()) - .unwrap_or("web") - .to_string(); + .is_some_and(|item_type| item_type == "repo"); if let Some(payload) = result.get_mut("response") { if !payload.is_null() { let taken = payload.take(); - let projected = if item_type == "repo" { - project_repo_fetch(taken, compact) - } else { - project_web_fetch(taken, compact) - }; - *payload = projected; + *payload = project_batch_fetch_item_response( + taken, + is_repo, + detail, + DEFAULT_BRIEF_MAX_CHARS, + ); } } } @@ -1119,6 +1170,28 @@ fn project_batch_fetch(mut value: serde_json::Value, compact: bool) -> serde_jso stamp_detail(value, mode, serde_json::json!({})) } +pub(crate) fn project_batch_fetch_item_response( + value: serde_json::Value, + is_repo: bool, + detail: ResponseDetail, + brief_max_chars: usize, +) -> serde_json::Value { + if detail == ResponseDetail::Diagnostic { + return value; + } + let compact = matches!(detail, ResponseDetail::Compact | ResponseDetail::Brief); + let mut projected = if is_repo { + project_repo_fetch(value, compact) + } else { + project_web_fetch(value, compact) + }; + if detail == ResponseDetail::Brief { + reduce_brief_fields(&mut projected); + clip_brief_strings(&mut projected, brief_max_chars); + } + projected +} + #[cfg(test)] mod tests { use super::*; diff --git a/src/mcp/tools/batch_fetch.rs b/src/mcp/tools/batch_fetch.rs index 30e9b684..1174a4be 100644 --- a/src/mcp/tools/batch_fetch.rs +++ b/src/mcp/tools/batch_fetch.rs @@ -384,6 +384,7 @@ pub(crate) async fn run_batch_fetch_with_item_windows_and_progress( render.as_deref(), browser_profile.as_deref(), include_screenshot.unwrap_or(false), + false, ) .map_err(|error| ToolError::Validation(format!("item {i}: {error}")))?; #[cfg(not(feature = "pdf"))] @@ -532,6 +533,12 @@ pub(crate) async fn run_batch_fetch_with_item_windows_and_progress( .filter(|ms| *ms < state.config.fetch.timeout_ms), )?; + let detail = crate::mcp::projection::ResponseDetail::from_opt_for_profile( + args.response_detail, + state.config.mcp.schema_profile, + ); + let brief_max_chars = state.config.mcp.brief_max_chars; + let aggregate_budget_during_fetch = detail != crate::mcp::projection::ResponseDetail::Brief; let concurrency = state.config.fetch.batch_concurrency; let semaphore = Arc::new(tokio::sync::Semaphore::new(concurrency)); @@ -587,16 +594,27 @@ pub(crate) async fn run_batch_fetch_with_item_windows_and_progress( } let wave_end = (wave_start + effective_concurrency).min(effective_items.len()); - let remaining_budget = total_cap.saturating_sub(total_payload_chars); + let remaining_budget = if aggregate_budget_during_fetch { + total_cap.saturating_sub(total_payload_chars) + } else { + usize::MAX + }; // Divide the remaining output budget across concurrent items. let wave_len = wave_end - wave_start; let per_wave_item_budget = remaining_budget .checked_div(wave_len) .unwrap_or(remaining_budget); - let item_budget_cap = per_item_cap.max(1).min(per_wave_item_budget.max(1)); - // Limit launches to what the remaining output budget can reserve. - let launchable = remaining_budget; + let item_budget_cap = if aggregate_budget_during_fetch { + per_item_cap.max(1).min(per_wave_item_budget.max(1)) + } else { + per_item_cap + }; + let launchable = if aggregate_budget_during_fetch { + remaining_budget + } else { + usize::MAX + }; let mut join_set = tokio::task::JoinSet::new(); let mut wave_indices = Vec::new(); @@ -685,9 +703,18 @@ pub(crate) async fn run_batch_fetch_with_item_windows_and_progress( for idx in &wave_indices { match wave_results.remove(idx) { Some((mut batch_result, image)) => { - let remaining = total_cap.saturating_sub(total_payload_chars); - batch_result = - truncate_batch_result_to_budget(batch_result, remaining, total_cap); + let remaining = if aggregate_budget_during_fetch { + total_cap.saturating_sub(total_payload_chars) + } else { + usize::MAX + }; + batch_result = truncate_batch_result_to_budget_for_detail( + batch_result, + remaining, + total_cap, + detail, + brief_max_chars, + ); if !batch_result.ok && !continue_on_error { aborted = true; } @@ -705,7 +732,9 @@ pub(crate) async fn run_batch_fetch_with_item_windows_and_progress( .error .as_deref() .is_some_and(|error| error.starts_with("batch_total_budget_exhausted")); - if !batch_result.degraded_fields.is_empty() || omitted_for_budget { + if aggregate_budget_during_fetch + && (!batch_result.degraded_fields.is_empty() || omitted_for_budget) + { budget_exhausted = true; if budget_warning.is_none() { budget_warning = Some(batch_total_budget_warning( @@ -720,7 +749,10 @@ pub(crate) async fn run_batch_fetch_with_item_windows_and_progress( )); } } - if total_payload_chars >= total_cap && budget_warning.is_none() { + if aggregate_budget_during_fetch + && total_payload_chars >= total_cap + && budget_warning.is_none() + { budget_warning = Some(batch_total_budget_warning( &batch_result.label, "reached the batch limit", @@ -768,7 +800,7 @@ pub(crate) async fn run_batch_fetch_with_item_windows_and_progress( progress.dispatch(wave_end, effective_items.len()); - if total_payload_chars >= total_cap { + if aggregate_budget_during_fetch && total_payload_chars >= total_cap { budget_exhausted = true; } } @@ -880,10 +912,6 @@ pub(crate) async fn run_batch_fetch_with_item_windows_and_progress( } else { value }; - let detail = crate::mcp::projection::ResponseDetail::from_opt_for_profile( - args.response_detail, - state.config.mcp.schema_profile, - ); progress.phase("project"); let value = crate::mcp::projection::project_with_budget( "batch_fetch", @@ -891,21 +919,48 @@ pub(crate) async fn run_batch_fetch_with_item_windows_and_progress( detail, state.config.mcp.brief_max_chars, ); + let value = if detail == crate::mcp::projection::ResponseDetail::Brief { + let budgeted = super::batch_fetch_budget::enforce_projected_batch_total_budget( + value, + total_cap, + brief_max_chars, + ); + crate::mcp::projection::project_with_budget( + "batch_fetch", + budgeted, + detail, + brief_max_chars, + ) + } else { + value + }; Ok(ToolOutcome { value, images: images.into_iter().flatten().collect(), }) } -/// Apply an item's remaining aggregate payload budget, degrading optional -/// structural response fields before clipping the requested text. The emitted -/// payload is measured as its serialized character count; `chars_returned` -/// keeps the readable-text meaning. An item that cannot fit is omitted as a -/// failed, truncated result. +#[cfg(test)] pub(crate) fn truncate_batch_result_to_budget( + result: crate::core::batch_fetch::BatchFetchResult, + remaining: usize, + total_cap: usize, +) -> crate::core::batch_fetch::BatchFetchResult { + truncate_batch_result_to_budget_for_detail( + result, + remaining, + total_cap, + crate::mcp::projection::ResponseDetail::Diagnostic, + crate::mcp::projection::DEFAULT_BRIEF_MAX_CHARS, + ) +} + +pub(super) fn truncate_batch_result_to_budget_for_detail( mut result: crate::core::batch_fetch::BatchFetchResult, remaining: usize, total_cap: usize, + detail: crate::mcp::projection::ResponseDetail, + brief_max_chars: usize, ) -> crate::core::batch_fetch::BatchFetchResult { if !result.ok { result.payload_chars = 0; @@ -915,7 +970,9 @@ pub(crate) fn truncate_batch_result_to_budget( let Some(mut payload) = result.response.take() else { return omit_batch_result_for_budget(result, remaining, total_cap); }; - let Some(payload_chars) = batch_payload_chars(&payload) else { + let Some(payload_chars) = + projected_batch_payload_chars(&payload, result.item_type, detail, brief_max_chars) + else { return omit_batch_result_for_budget(result, remaining, total_cap); }; if payload_chars <= remaining { @@ -923,18 +980,12 @@ pub(crate) fn truncate_batch_result_to_budget( } if result.item_type == crate::core::batch_fetch::BatchFetchItemType::Repo { - if let Some(document) = payload - .get_mut("document") - .and_then(serde_json::Value::as_object_mut) - { - for field in ["blocks", "chunks"] { - if document.remove(field).is_some() { - result.degraded_fields.push(format!("document.{field}")); - } - } - } - if !result.degraded_fields.is_empty() { - let Some(payload_chars) = batch_payload_chars(&payload) else { + let projected = + projected_batch_payload(&payload, result.item_type, detail, brief_max_chars); + if drop_document_parts_if_projected(&mut payload, &projected, &mut result.degraded_fields) { + let Some(payload_chars) = + projected_batch_payload_chars(&payload, result.item_type, detail, brief_max_chars) + else { return omit_batch_result_for_budget(result, remaining, total_cap); }; if payload_chars <= remaining { @@ -942,24 +993,27 @@ pub(crate) fn truncate_batch_result_to_budget( } } - if payload - .as_object_mut() - .is_some_and(|object| object.remove("document").is_some()) - { + let projected = + projected_batch_payload(&payload, result.item_type, detail, brief_max_chars); + if drop_projected_root_field(&mut payload, &projected, "document") { result.degraded_fields.push("document".to_string()); - let Some(payload_chars) = batch_payload_chars(&payload) else { + let Some(payload_chars) = + projected_batch_payload_chars(&payload, result.item_type, detail, brief_max_chars) + else { return omit_batch_result_for_budget(result, remaining, total_cap); }; if payload_chars <= remaining { return finish_batch_result(result, payload, payload_chars); } } - if payload - .as_object_mut() - .is_some_and(|object| object.remove("lines").is_some()) - { + + let projected = + projected_batch_payload(&payload, result.item_type, detail, brief_max_chars); + if drop_projected_root_field(&mut payload, &projected, "lines") { result.degraded_fields.push("lines".to_string()); - let Some(payload_chars) = batch_payload_chars(&payload) else { + let Some(payload_chars) = + projected_batch_payload_chars(&payload, result.item_type, detail, brief_max_chars) + else { return omit_batch_result_for_budget(result, remaining, total_cap); }; if payload_chars <= remaining { @@ -967,160 +1021,239 @@ pub(crate) fn truncate_batch_result_to_budget( } } - let text = payload - .get("text") - .and_then(serde_json::Value::as_str) - .map(str::to_owned); - if let Some(text) = text.filter(|text| !text.is_empty()) { - let chars: Vec = text.chars().collect(); - if let Some(object) = payload.as_object_mut() { - object.insert("truncated".to_string(), serde_json::Value::Bool(true)); - } - let mut low = 0usize; - let mut high = chars.len(); - let mut best = 0usize; - while low <= high { - let mid = low + (high - low) / 2; - if let Some(object) = payload.as_object_mut() { - object.insert( - "text".to_string(), - serde_json::Value::String(chars[..mid].iter().collect()), - ); - } - let Some(measured) = batch_payload_chars(&payload) else { - return omit_batch_result_for_budget(result, remaining, total_cap); - }; - if measured <= remaining { - best = mid; - low = mid + 1; - } else if mid == 0 { - break; - } else { - high = mid - 1; - } - } - if let Some(object) = payload.as_object_mut() { - object.insert( - "text".to_string(), - serde_json::Value::String(chars[..best].iter().collect()), - ); - } - result.truncated = true; - result.degraded_fields.push("text".to_string()); - let Some(payload_chars) = batch_payload_chars(&payload) else { + let Some(payload_chars) = clip_batch_text_to_budget( + &mut result, + &mut payload, + remaining, + detail, + brief_max_chars, + ) else { + return omit_batch_result_for_budget(result, remaining, total_cap); + }; + if payload_chars <= remaining { + return finish_batch_result(result, payload, payload_chars); + } + return omit_batch_result_for_budget(result, remaining, total_cap); + } + + let mut projected = + projected_batch_payload(&payload, result.item_type, detail, brief_max_chars); + if drop_document_parts_if_projected(&mut payload, &projected, &mut result.degraded_fields) { + let Some(payload_chars) = + projected_batch_payload_chars(&payload, result.item_type, detail, brief_max_chars) + else { + return omit_batch_result_for_budget(result, remaining, total_cap); + }; + if payload_chars <= remaining { + return finish_batch_result(result, payload, payload_chars); + } + projected = projected_batch_payload(&payload, result.item_type, detail, brief_max_chars); + } + + if drop_projected_root_field(&mut payload, &projected, "document") { + result.degraded_fields.push("document".to_string()); + let Some(payload_chars) = + projected_batch_payload_chars(&payload, result.item_type, detail, brief_max_chars) + else { + return omit_batch_result_for_budget(result, remaining, total_cap); + }; + if payload_chars <= remaining { + return finish_batch_result(result, payload, payload_chars); + } + projected = projected_batch_payload(&payload, result.item_type, detail, brief_max_chars); + } + + if drop_projected_root_field(&mut payload, &projected, "lines") { + result.degraded_fields.push("lines".to_string()); + let Some(payload_chars) = + projected_batch_payload_chars(&payload, result.item_type, detail, brief_max_chars) + else { + return omit_batch_result_for_budget(result, remaining, total_cap); + }; + if payload_chars <= remaining { + return finish_batch_result(result, payload, payload_chars); + } + projected = projected_batch_payload(&payload, result.item_type, detail, brief_max_chars); + } + + loop { + let has_links = projected + .get("links") + .and_then(serde_json::Value::as_array) + .is_some_and(|links| !links.is_empty()); + if !has_links { + break; + } + let popped = payload + .get_mut("links") + .and_then(serde_json::Value::as_array_mut) + .and_then(Vec::pop) + .is_some(); + if !popped { + break; + } + if !result.degraded_fields.iter().any(|field| field == "links") { + result.degraded_fields.push("links".to_string()); + } + let Some(payload_chars) = + projected_batch_payload_chars(&payload, result.item_type, detail, brief_max_chars) + else { + return omit_batch_result_for_budget(result, remaining, total_cap); + }; + if payload_chars <= remaining { + return finish_batch_result(result, payload, payload_chars); + } + projected = projected_batch_payload(&payload, result.item_type, detail, brief_max_chars); + } + + for field in ["description", "title"] { + if drop_projected_root_field(&mut payload, &projected, field) { + result.degraded_fields.push(field.to_string()); + let Some(payload_chars) = + projected_batch_payload_chars(&payload, result.item_type, detail, brief_max_chars) + else { return omit_batch_result_for_budget(result, remaining, total_cap); }; if payload_chars <= remaining { return finish_batch_result(result, payload, payload_chars); } + projected = + projected_batch_payload(&payload, result.item_type, detail, brief_max_chars); } + } + let Some(payload_chars) = clip_batch_text_to_budget( + &mut result, + &mut payload, + remaining, + detail, + brief_max_chars, + ) else { return omit_batch_result_for_budget(result, remaining, total_cap); + }; + if payload_chars <= remaining { + return finish_batch_result(result, payload, payload_chars); } + omit_batch_result_for_budget(result, remaining, total_cap) +} - let budget = remaining; - let mut text_clipped = false; - if let Some(text) = payload - .get("text") - .and_then(serde_json::Value::as_str) - .map(str::to_owned) - { - if text.chars().count() > budget { - if let Some(obj) = payload.as_object_mut() { - obj.insert( - "text".to_string(), - serde_json::Value::String(text.chars().take(budget).collect()), - ); - } - result.degraded_fields.push("text".to_string()); - text_clipped = true; - } - } +fn projected_batch_payload( + payload: &serde_json::Value, + item_type: crate::core::batch_fetch::BatchFetchItemType, + detail: crate::mcp::projection::ResponseDetail, + brief_max_chars: usize, +) -> serde_json::Value { + crate::mcp::projection::project_batch_fetch_item_response( + payload.clone(), + item_type == crate::core::batch_fetch::BatchFetchItemType::Repo, + detail, + brief_max_chars, + ) +} - let meta_chars = |obj: &serde_json::Map| -> usize { - obj.get("title") - .and_then(|v| v.as_str()) - .map(|s| s.chars().count()) - .unwrap_or(0) - + obj - .get("description") - .and_then(|v| v.as_str()) - .map(|s| s.chars().count()) - .unwrap_or(0) - + obj - .get("links") - .and_then(|v| v.as_array()) - .map(|arr| { - arr.iter() - .map(|l| { - l.get("url") - .and_then(|u| u.as_str()) - .map(|s| s.chars().count()) - .unwrap_or(0) - + l.get("text") - .and_then(|t| t.as_str()) - .map(|s| s.chars().count()) - .unwrap_or(0) - }) - .sum::() - }) - .unwrap_or(0) +fn projected_batch_payload_chars( + payload: &serde_json::Value, + item_type: crate::core::batch_fetch::BatchFetchItemType, + detail: crate::mcp::projection::ResponseDetail, + brief_max_chars: usize, +) -> Option { + let projected = projected_batch_payload(payload, item_type, detail, brief_max_chars); + batch_payload_chars(&projected) +} + +fn drop_document_parts_if_projected( + payload: &mut serde_json::Value, + projected: &serde_json::Value, + degraded_fields: &mut Vec, +) -> bool { + let Some(projected_document) = projected + .get("document") + .and_then(serde_json::Value::as_object) + else { + return false; }; - let text_chars = |obj: &serde_json::Map| -> usize { - obj.get("text") - .and_then(|v| v.as_str()) - .map(|s| s.chars().count()) - .unwrap_or(0) + let Some(document) = payload + .get_mut("document") + .and_then(serde_json::Value::as_object_mut) + else { + return false; }; - - if let Some(obj) = payload.as_object_mut() { - let mut current = text_chars(obj) + meta_chars(obj); - if current > budget { - loop { - let popped = obj - .get_mut("links") - .and_then(|v| v.as_array_mut()) - .and_then(|arr| { - if arr.is_empty() { - None - } else { - arr.pop(); - Some(()) - } - }); - if popped.is_none() { - break; - } - if !result.degraded_fields.iter().any(|field| field == "links") { - result.degraded_fields.push("links".to_string()); - } - current = text_chars(obj) + meta_chars(obj); - if current <= budget { - break; - } - } + let mut dropped = false; + for field in ["blocks", "chunks"] { + if projected_document.contains_key(field) && document.remove(field).is_some() { + degraded_fields.push(format!("document.{field}")); + dropped = true; } - if current > budget && obj.remove("description").is_some() { - result.degraded_fields.push("description".to_string()); - current = text_chars(obj) + meta_chars(obj); + } + dropped +} + +fn drop_projected_root_field( + payload: &mut serde_json::Value, + projected: &serde_json::Value, + field: &str, +) -> bool { + projected.get(field).is_some() + && payload + .as_object_mut() + .is_some_and(|object| object.remove(field).is_some()) +} + +fn clip_batch_text_to_budget( + result: &mut crate::core::batch_fetch::BatchFetchResult, + payload: &mut serde_json::Value, + remaining: usize, + detail: crate::mcp::projection::ResponseDetail, + brief_max_chars: usize, +) -> Option { + let Some(text) = payload + .get("text") + .and_then(serde_json::Value::as_str) + .map(str::to_owned) + .filter(|text| !text.is_empty()) + else { + return projected_batch_payload_chars(payload, result.item_type, detail, brief_max_chars); + }; + let chars: Vec = text.chars().collect(); + if let Some(object) = payload.as_object_mut() { + object.insert("truncated".to_string(), serde_json::Value::Bool(true)); + } + let mut low = 0usize; + let mut high = chars.len(); + let mut best = 0usize; + while low <= high { + let mid = low + (high - low) / 2; + if let Some(object) = payload.as_object_mut() { + object.insert( + "text".to_string(), + serde_json::Value::String(chars[..mid].iter().collect()), + ); } - if current > budget && obj.remove("title").is_some() { - result.degraded_fields.push("title".to_string()); + let measured = + projected_batch_payload_chars(payload, result.item_type, detail, brief_max_chars)?; + if measured <= remaining { + best = mid; + low = mid + 1; + } else if mid == 0 { + break; + } else { + high = mid - 1; } } - if text_clipped { - result.truncated = true; + if let Some(object) = payload.as_object_mut() { + object.insert( + "text".to_string(), + serde_json::Value::String(chars[..best].iter().collect()), + ); } - let Some(payload_chars) = batch_payload_chars(&payload) else { - return omit_batch_result_for_budget(result, remaining, total_cap); - }; - if payload_chars > remaining { - return omit_batch_result_for_budget(result, remaining, total_cap); + result.truncated = true; + if !result.degraded_fields.iter().any(|field| field == "text") { + result.degraded_fields.push("text".to_string()); } - finish_batch_result(result, payload, payload_chars) + projected_batch_payload_chars(payload, result.item_type, detail, brief_max_chars) } -fn batch_payload_chars(response_value: &serde_json::Value) -> Option { +pub(super) fn batch_payload_chars(response_value: &serde_json::Value) -> Option { let serialized = serde_json::to_string(response_value); let payload_chars = serialized.as_ref().map(|s| s.chars().count()).unwrap_or(0); serialized.map(|_| payload_chars).ok() @@ -1194,7 +1327,7 @@ fn safe_batch_item_label(label: &str) -> String { label } -fn batch_total_budget_warning( +pub(super) fn batch_total_budget_warning( label: &str, outcome: &str, remaining: usize, @@ -1206,7 +1339,7 @@ fn batch_total_budget_warning( ) } -fn batch_payload_budget_warning( +pub(super) fn batch_payload_budget_warning( result: &crate::core::batch_fetch::BatchFetchResult, remaining: usize, total_cap: usize, diff --git a/src/mcp/tools/batch_fetch_budget.rs b/src/mcp/tools/batch_fetch_budget.rs new file mode 100644 index 00000000..20e1503b --- /dev/null +++ b/src/mcp/tools/batch_fetch_budget.rs @@ -0,0 +1,287 @@ +use super::batch_fetch::{ + batch_payload_budget_warning, batch_payload_chars, batch_total_budget_warning, + truncate_batch_result_to_budget_for_detail, +}; + +pub(super) fn enforce_projected_batch_total_budget( + mut value: serde_json::Value, + total_cap: usize, + brief_max_chars: usize, +) -> serde_json::Value { + let mut total_payload_chars = 0usize; + let mut new_warnings = Vec::new(); + let mut budget_warning = None; + let mut last_item_label = None; + let mut newly_failed = 0usize; + let mut newly_truncated = 0usize; + let mut chars_removed = 0usize; + let mut chars_added = 0usize; + let mut budget_changed = false; + + { + let Some(results) = value + .get_mut("results") + .and_then(serde_json::Value::as_array_mut) + else { + return value; + }; + for (position, item) in results.iter_mut().enumerate() { + let Some(object) = item.as_object_mut() else { + continue; + }; + let item_type = + if object.get("item_type").and_then(serde_json::Value::as_str) == Some("repo") { + crate::core::batch_fetch::BatchFetchItemType::Repo + } else { + crate::core::batch_fetch::BatchFetchItemType::Web + }; + let label = object + .get("label") + .and_then(serde_json::Value::as_str) + .unwrap_or_default() + .to_string(); + last_item_label = Some(label.clone()); + let current_payload_chars = object + .get("response") + .filter(|response| !response.is_null()) + .and_then(batch_payload_chars) + .unwrap_or(0); + if object.get("ok").and_then(serde_json::Value::as_bool) != Some(true) { + object.insert("payload_chars".into(), 0usize.into()); + continue; + } + + let remaining = total_cap.saturating_sub(total_payload_chars); + if current_payload_chars <= remaining { + object.insert("payload_chars".into(), current_payload_chars.into()); + total_payload_chars = total_payload_chars.saturating_add(current_payload_chars); + continue; + } + + let mut result = crate::core::batch_fetch::BatchFetchResult { + index: object + .get("index") + .and_then(serde_json::Value::as_u64) + .map(|index| index as usize) + .unwrap_or(position), + item_type, + label, + stable_id: object + .get("stable_id") + .and_then(serde_json::Value::as_str) + .map(str::to_owned), + ok: true, + response: object.get("response").cloned(), + error: object + .get("error") + .and_then(serde_json::Value::as_str) + .map(str::to_owned), + chars_returned: object + .get("chars_returned") + .and_then(serde_json::Value::as_u64) + .unwrap_or(0) as usize, + payload_chars: current_payload_chars, + degraded_fields: object + .get("degraded_fields") + .and_then(serde_json::Value::as_array) + .map(|fields| { + fields + .iter() + .filter_map(serde_json::Value::as_str) + .map(str::to_owned) + .collect() + }) + .unwrap_or_default(), + truncated: object + .get("truncated") + .and_then(serde_json::Value::as_bool) + .unwrap_or(false), + }; + let before_chars_returned = result.chars_returned; + let before_truncated = result.truncated; + result = truncate_batch_result_to_budget_for_detail( + result, + remaining, + total_cap, + crate::mcp::projection::ResponseDetail::Diagnostic, + brief_max_chars, + ); + budget_changed = true; + if result.ok && !result.degraded_fields.is_empty() { + new_warnings.push(batch_payload_budget_warning(&result, remaining, total_cap)); + if budget_warning.is_none() { + budget_warning = Some(batch_total_budget_warning( + &result.label, + "was degraded", + remaining, + total_cap, + )); + } + } + if !result.ok { + newly_failed += 1; + if budget_warning.is_none() { + budget_warning = Some(batch_total_budget_warning( + &result.label, + "was omitted", + remaining, + total_cap, + )); + } + } + if result.chars_returned < before_chars_returned { + chars_removed = + chars_removed.saturating_add(before_chars_returned - result.chars_returned); + } else { + chars_added = + chars_added.saturating_add(result.chars_returned - before_chars_returned); + } + if result.truncated && !before_truncated { + newly_truncated += 1; + } + total_payload_chars = total_payload_chars.saturating_add(result.payload_chars); + object.insert("ok".into(), result.ok.into()); + object.insert( + "response".into(), + result.response.unwrap_or(serde_json::Value::Null), + ); + if let Some(error) = result.error { + object.insert("error".into(), error.into()); + } else { + object.remove("error"); + } + object.insert("chars_returned".into(), result.chars_returned.into()); + object.insert("payload_chars".into(), result.payload_chars.into()); + if result.degraded_fields.is_empty() { + object.remove("degraded_fields"); + } else { + object.insert("degraded_fields".into(), result.degraded_fields.into()); + } + object.insert("truncated".into(), result.truncated.into()); + } + } + + if total_payload_chars >= total_cap { + budget_changed = true; + if budget_warning.is_none() { + if let Some(label) = last_item_label.as_deref() { + budget_warning = Some(batch_total_budget_warning( + label, + "reached the batch limit", + 0, + total_cap, + )); + } + } + } + if let Some(warning) = budget_warning { + new_warnings.push(warning); + } + + let structured_warnings = crate::core::warning::convert_fetch_warnings(&new_warnings) + .into_iter() + .filter_map(|warning| serde_json::to_value(warning).ok()) + .collect::>(); + if let Some(object) = value.as_object_mut() { + let warning_values = object + .entry("warnings") + .or_insert_with(|| serde_json::Value::Array(Vec::new())); + if let Some(warnings) = warning_values.as_array_mut() { + warnings.extend(new_warnings.into_iter().map(serde_json::Value::String)); + } + let structured_values = object + .entry("structured_warnings") + .or_insert_with(|| serde_json::Value::Array(Vec::new())); + if let Some(warnings) = structured_values.as_array_mut() { + warnings.extend(structured_warnings); + } + } + + if let Some(object) = value.as_object_mut() { + object.insert("total_payload_chars".into(), total_payload_chars.into()); + if newly_failed > 0 { + let fetched = object + .get("fetched") + .and_then(serde_json::Value::as_u64) + .unwrap_or(0) as usize; + let failed = object + .get("failed") + .and_then(serde_json::Value::as_u64) + .unwrap_or(0) as usize; + object.insert( + "fetched".into(), + fetched.saturating_sub(newly_failed).into(), + ); + object.insert("failed".into(), failed.saturating_add(newly_failed).into()); + } + if chars_removed > 0 || chars_added > 0 { + let total = object + .get("total_chars_returned") + .and_then(serde_json::Value::as_u64) + .unwrap_or(0) as usize; + object.insert( + "total_chars_returned".into(), + total + .saturating_sub(chars_removed) + .saturating_add(chars_added) + .into(), + ); + } + if newly_truncated > 0 { + object.insert("truncated".into(), true.into()); + } + if budget_changed { + object.insert("output_truncated".into(), true.into()); + } + if let Some(telemetry) = object + .get_mut("telemetry") + .and_then(serde_json::Value::as_object_mut) + { + if newly_failed > 0 { + let completed = telemetry + .get("items_completed") + .and_then(serde_json::Value::as_u64) + .unwrap_or(0) as usize; + let failed = telemetry + .get("items_failed") + .and_then(serde_json::Value::as_u64) + .unwrap_or(0) as usize; + telemetry.insert( + "items_completed".into(), + completed.saturating_sub(newly_failed).into(), + ); + telemetry.insert( + "items_failed".into(), + failed.saturating_add(newly_failed).into(), + ); + } + if newly_truncated > 0 { + let truncated = telemetry + .get("items_truncated") + .and_then(serde_json::Value::as_u64) + .unwrap_or(0) as usize; + telemetry.insert( + "items_truncated".into(), + truncated.saturating_add(newly_truncated).into(), + ); + } + if chars_removed > 0 || chars_added > 0 { + let total = telemetry + .get("total_chars_returned") + .and_then(serde_json::Value::as_u64) + .unwrap_or(0) as usize; + telemetry.insert( + "total_chars_returned".into(), + total + .saturating_sub(chars_removed) + .saturating_add(chars_added) + .into(), + ); + } + if budget_changed { + telemetry.insert("aggregate_budget_exhausted".into(), true.into()); + } + } + } + value +} diff --git a/src/mcp/tools/batch_fetch_item.rs b/src/mcp/tools/batch_fetch_item.rs index 44dbf403..cc4cf01b 100644 --- a/src/mcp/tools/batch_fetch_item.rs +++ b/src/mcp/tools/batch_fetch_item.rs @@ -131,8 +131,14 @@ pub(crate) fn make_batch_fetch_future(context: BatchFetchItemContext<'_>) -> Bat Err(error) => { let error_payload = error.error_payload(); let code = error_payload - .get("code") + .get("data") + .and_then(|data| data.get("code")) .and_then(serde_json::Value::as_str) + .or_else(|| { + error_payload + .get("code") + .and_then(serde_json::Value::as_str) + }) .unwrap_or("fetch_failed"); Ok(( BatchFetchResult { diff --git a/src/mcp/tools/browser_availability_tests.rs b/src/mcp/tools/browser_availability_tests.rs new file mode 100644 index 00000000..e94394c7 --- /dev/null +++ b/src/mcp/tools/browser_availability_tests.rs @@ -0,0 +1,304 @@ +use super::*; +use crate::core::config::AppConfig; +use crate::mcp::state::ServerState; +use std::sync::Arc; + +#[cfg(all(feature = "mock", feature = "browser"))] +fn synthetic_available_browser_state( + browser_fetch_override: crate::mcp::state::BrowserFetchOverride, +) -> Arc { + use crate::fetch::browser::{ + BrowserConfig, BrowserDiscovery, BrowserDiscoveryState, BrowserFamily, BrowserLifecycle, + BrowserSource, RenderPolicy, + }; + + let mut config = AppConfig::default(); + config.fetch.allow_localhost = true; + config.fetch.allow_private_network = true; + config.fetch.browser.enabled = true; + let mut state = Arc::new(ServerState::build(config).expect("state builds")); + let discovery = BrowserDiscovery { + path: std::path::PathBuf::from("/synthetic/chrome"), + family: BrowserFamily::Chrome, + version: "Chrome 120.0.0.0".to_string(), + source: BrowserSource::AutoDiscovered, + }; + let browser_config = BrowserConfig { + enabled: true, + policy: RenderPolicy::Browser, + ..BrowserConfig::default() + }; + let state_mut = Arc::get_mut(&mut state).expect("unique state"); + state_mut.browser_discovery_state = BrowserDiscoveryState::Available(discovery.clone()); + state_mut.browser_lifecycle = Some(Arc::new(BrowserLifecycle::new( + Some(discovery), + browser_config, + ))); + state_mut.browser_fetch_override = Some(browser_fetch_override); + state +} + +#[cfg(all(feature = "mock", feature = "browser"))] +#[tokio::test] +async fn browser_absent_mcp_search_fetch_and_status_degrade() { + use crate::meta::mock::{mock_engines, MockEngine, MockResult}; + use httpmock::prelude::*; + + let server = MockServer::start(); + let _ordinary = server.mock(|when, then| { + when.method(GET).path("/ordinary"); + then.status(200).header("content-type", "text/html").body( + "Ordinary page with readable content and no render markers.", + ); + }); + let _verification = server.mock(|when, then| { + when.method(GET).path("/verification"); + then.status(200) + .header("content-type", "text/html") + .body("Checking your browserPlease wait while we verify."); + }); + let mut config = AppConfig::default(); + config.fetch.allow_localhost = true; + config.fetch.allow_private_network = true; + config.fetch.browser.enabled = true; + config.fetch.browser.executable = Some("/synthetic/missing/chrome".to_string()); + let engine = MockEngine::success( + "duckduckgo", + vec![MockResult::new( + "Example result", + "https://example.com/result", + "duckduckgo", + )], + ); + let adapter = crate::meta::MetadataSearchAdapter::from_engines( + mock_engines(vec![engine]), + std::time::Duration::from_millis(config.search.timeout_ms), + ); + let mut state = Arc::new(ServerState::build(config).expect("state builds")); + Arc::get_mut(&mut state).expect("unique state").adapter = Arc::new(adapter); + + let search = run_web_search( + state.clone(), + WebSearchArgs { + query: "test query".to_string(), + max_results: Some(5), + providers: vec![], + safe_search: None, + timeout_ms: None, + intent: None, + freshness: None, + date_range: None, + include_domains: Vec::new(), + exclude_domains: Vec::new(), + language: None, + region: None, + excerpt_count: None, + response_detail: None, + }, + ) + .await + .expect("search does not require Chrome"); + assert!(search.to_string().contains("Example result")); + + let ordinary = run_web_fetch( + state.clone(), + serde_json::from_value(serde_json::json!({ + "url": server.url("/ordinary"), + "render": "auto" + })) + .unwrap(), + ) + .await + .expect("ordinary HTTP fetch does not require Chrome"); + assert!(!ordinary["structured_warnings"] + .to_string() + .contains("browser_unavailable")); + + let verification = run_web_fetch( + state.clone(), + serde_json::from_value(serde_json::json!({ + "url": server.url("/verification"), + "render": "auto" + })) + .unwrap(), + ) + .await + .expect("auto fetch keeps the HTTP response without Chrome"); + assert!(verification["structured_warnings"] + .to_string() + .contains("browser_unavailable")); + assert!( + verification["structured_warnings"] + .to_string() + .contains("/synthetic/missing/chrome"), + "{verification}" + ); + + let explicit = run_web_fetch( + state.clone(), + serde_json::from_value(serde_json::json!({ + "url": "https://example.test/explicit-browser", + "render": "browser" + })) + .unwrap(), + ) + .await + .expect_err("explicit browser request must report unavailability"); + assert_eq!( + explicit.error_payload()["data"]["code"], + "browser_unavailable" + ); + assert!(explicit + .error_payload() + .to_string() + .contains("/synthetic/missing/chrome")); + + let status = super::provider_status::run_provider_status( + state, + super::provider_status::ProviderStatusArgs { + probe: false, + recipe_detail: None, + }, + ) + .expect("provider status remains available without Chrome"); + let capabilities = &status["browser_capabilities"]; + assert_eq!(capabilities["usable"], false); + assert_eq!(capabilities["discovered"], false); + assert!(capabilities["reason"] + .as_str() + .unwrap_or_default() + .contains("/synthetic/missing/chrome")); + for field in [ + "compiled", + "configured", + "discovered", + "usable", + "reason", + "lifecycle", + ] { + assert!(capabilities.get(field).is_some(), "missing field {field}"); + } +} + +#[cfg(all(feature = "mock", feature = "browser"))] +#[tokio::test] +async fn browser_absent_batch_and_unified_fetch_preserve_specific_error_code() { + let mut config = AppConfig::default(); + config.fetch.browser.enabled = true; + config.fetch.browser.executable = Some("/synthetic/missing/chrome".to_string()); + let state = Arc::new(ServerState::build(config).expect("state builds")); + + let batch = super::run_batch_fetch( + state.clone(), + serde_json::from_value(serde_json::json!({ + "items": [{ + "type": "web", + "url": "https://example.test/batch-browser", + "render": "browser" + }] + })) + .expect("batch arguments deserialize"), + ) + .await + .expect("batch preserves the item failure"); + let batch_error = batch["results"][0]["error"] + .as_str() + .expect("batch error string"); + assert!( + batch_error.starts_with("browser_unavailable:"), + "{batch_error}" + ); + assert!( + batch_error.contains("/synthetic/missing/chrome"), + "{batch_error}" + ); + + let unified = super::run_fetch( + state, + serde_json::from_value(serde_json::json!({ + "items": { + "type": "web", + "url": "https://example.test/unified-browser", + "render": "browser" + } + })) + .expect("unified fetch arguments deserialize"), + ) + .await + .expect("unified fetch preserves the item failure"); + let unified_error = unified["results"][0]["error"] + .as_str() + .expect("unified fetch error string"); + assert!( + unified_error.starts_with("browser_unavailable:"), + "{unified_error}" + ); + assert!( + unified_error.contains("/synthetic/missing/chrome"), + "{unified_error}" + ); +} + +#[cfg(all(feature = "mock", feature = "browser"))] +#[tokio::test] +async fn browser_launch_failure_is_named_and_does_not_repeat_http() { + use httpmock::prelude::*; + use std::sync::atomic::{AtomicUsize, Ordering}; + + let server = MockServer::start(); + let mock = server.mock(|when, then| { + when.method(GET).path("/verification"); + then.status(200) + .header("content-type", "text/html") + .body("Checking your browserPlease wait while we verify."); + }); + let browser_calls = Arc::new(AtomicUsize::new(0)); + let seen = browser_calls.clone(); + let state = synthetic_available_browser_state(Arc::new( + move |_request: crate::mcp::state::MockBrowserRequest| { + seen.fetch_add(1, Ordering::SeqCst); + Err(crate::fetch::browser::BrowserFetchError::LaunchFailed( + "container sandbox rejected Chrome launch".to_string(), + )) + }, + )); + let response = run_web_fetch( + state.clone(), + serde_json::from_value(serde_json::json!({ + "url": server.url("/verification"), + "render": "auto" + })) + .unwrap(), + ) + .await + .expect("auto render failure retains the HTTP document"); + assert!(response["structured_warnings"] + .to_string() + .contains("browser_unavailable")); + assert!(response["structured_warnings"] + .to_string() + .contains("container sandbox rejected Chrome launch")); + assert_eq!(browser_calls.load(Ordering::SeqCst), 1); + mock.assert_hits(1); + + let explicit = run_web_fetch( + state, + serde_json::from_value(serde_json::json!({ + "url": "https://example.test/explicit-launch-failure", + "render": "browser" + })) + .unwrap(), + ) + .await + .expect_err("explicit launch failure must remain a structured browser error"); + assert_eq!( + explicit.error_payload()["data"]["code"], + "browser_unavailable" + ); + assert!(explicit + .error_payload() + .to_string() + .contains("browser launch failed: container sandbox rejected Chrome launch")); + assert_eq!(browser_calls.load(Ordering::SeqCst), 2); + mock.assert_hits(1); +} diff --git a/src/mcp/tools/mod.rs b/src/mcp/tools/mod.rs index a3d4ac70..03538c39 100644 --- a/src/mcp/tools/mod.rs +++ b/src/mcp/tools/mod.rs @@ -5,6 +5,7 @@ //! The stable `crate::mcp::tools::X` paths are preserved via re-exports. mod batch_fetch; +mod batch_fetch_budget; mod batch_fetch_item; pub mod canonical; mod common; @@ -58,5 +59,8 @@ pub fn compact_fields(name: &str) -> Option<&'static [&'static str]> { }) } +#[cfg(all(test, feature = "mock", feature = "browser"))] +mod browser_availability_tests; + #[cfg(test)] mod tests; diff --git a/src/mcp/tools/provider_status.rs b/src/mcp/tools/provider_status.rs index af0ade80..25fa7563 100644 --- a/src/mcp/tools/provider_status.rs +++ b/src/mcp/tools/provider_status.rs @@ -76,21 +76,7 @@ fn build_payload_without_probe( let reason = if !configured { Some("disabled in config".to_string()) } else { - match discovery_state { - crate::fetch::browser::types::BrowserDiscoveryState::ExplicitPathInvalid { - path, - } => Some(format!("explicit path invalid: {path}")), - crate::fetch::browser::types::BrowserDiscoveryState::NotFound => { - Some("no Chrome/Chromium executable found".to_string()) - } - crate::fetch::browser::types::BrowserDiscoveryState::NotConfigured => { - Some("no executable configured".to_string()) - } - crate::fetch::browser::types::BrowserDiscoveryState::VersionUnsupported { - version, - } => Some(format!("browser version unsupported: {version}")), - crate::fetch::browser::types::BrowserDiscoveryState::Available(_) => None, - } + crate::fetch::browser::browser_discovery_reason(discovery_state) }; (compiled, configured, discovered, usable, reason) } diff --git a/src/mcp/tools/tests.rs b/src/mcp/tools/tests.rs index 3d3054da..8746531e 100644 --- a/src/mcp/tools/tests.rs +++ b/src/mcp/tools/tests.rs @@ -1095,6 +1095,8 @@ fn synthetic_browser_state( }; let mut config = AppConfig::default(); + config.fetch.allow_localhost = true; + config.fetch.allow_private_network = true; config.fetch.browser.enabled = true; let mut state = Arc::new(ServerState::build(config).expect("state builds")); let discovery = BrowserDiscovery { diff --git a/src/mcp/tools/web_fetch.rs b/src/mcp/tools/web_fetch.rs index 9a384cc9..e7b3baf1 100644 --- a/src/mcp/tools/web_fetch.rs +++ b/src/mcp/tools/web_fetch.rs @@ -38,6 +38,7 @@ pub(crate) fn validate_batch_route_options( render: Option<&str>, browser_profile: Option<&str>, include_screenshot: bool, + _enforce_runtime_availability: bool, ) -> Result<(), ToolError> { #[cfg(not(feature = "browser"))] let _ = url; @@ -79,6 +80,9 @@ pub(crate) fn validate_batch_route_options( RenderRequest::Browser => RenderPolicy::Browser, }; if matches!(render_policy, RenderPolicy::HttpOnly) && browser_profile.is_some() { + if !state.config.fetch.browser.enabled { + return Err(browser_disabled_error()); + } return Err(ToolError::Validation( "browser_profile is not valid with render=http_only".to_string(), )); @@ -86,11 +90,19 @@ pub(crate) fn validate_batch_route_options( let explicit_browser = matches!(render_policy, RenderPolicy::Browser) || browser_profile.is_some(); match state.browser_lifecycle() { - None if explicit_browser => return Err(browser_disabled_error()), - Some(lifecycle) if !lifecycle.is_available() && explicit_browser => { + None if explicit_browser && _enforce_runtime_availability => { + return Err(browser_disabled_error()) + } + Some(lifecycle) + if !lifecycle.is_available() + && explicit_browser + && _enforce_runtime_availability => + { return Err(browser_unavailable_error( - "browser rendering is enabled but no Chrome/Chromium executable was found; \ - set [fetch.browser].executable or install Chrome/Chromium", + &crate::fetch::browser::browser_discovery_reason( + &state.browser_discovery_state, + ) + .unwrap_or_else(|| "browser rendering is unavailable".to_string()), )); } _ => {} @@ -307,6 +319,7 @@ async fn run_web_fetch_inner( args.render.as_deref(), args.browser_profile.as_deref(), include_screenshot, + true, )?; if let Some(0) = args.max_chars { @@ -441,8 +454,18 @@ async fn run_web_fetch_inner( }; #[cfg(feature = "browser")] let mut browser_available = false; + #[cfg(feature = "browser")] + let browser_unavailable_reason = if state.config.fetch.browser.enabled { + crate::fetch::browser::browser_discovery_reason(&state.browser_discovery_state) + .unwrap_or_else(|| "browser rendering is unavailable".to_string()) + } else { + "browser rendering is disabled in config".to_string() + }; #[cfg(not(feature = "browser"))] let browser_available = false; + #[cfg(not(feature = "browser"))] + let browser_unavailable_reason = + "browser rendering is not compiled into this build".to_string(); #[cfg(not(feature = "browser"))] { @@ -456,6 +479,9 @@ async fn run_web_fetch_inner( use crate::fetch::browser::RenderPolicy; if matches!(render_policy, RenderPolicy::HttpOnly) && args.browser_profile.is_some() { + if !state.config.fetch.browser.enabled { + return Err(browser_disabled_error()); + } return Err(ToolError::Validation( "browser_profile is not valid with render=http_only".to_string(), )); @@ -472,8 +498,10 @@ async fn run_web_fetch_inner( Some(lifecycle) if !lifecycle.is_available() => { if explicit_browser { return Err(browser_unavailable_error( - "browser rendering is enabled but no Chrome/Chromium executable was found; \ - set [fetch.browser].executable or install Chrome/Chromium", + &crate::fetch::browser::browser_discovery_reason( + &state.browser_discovery_state, + ) + .unwrap_or_else(|| "browser rendering is unavailable".to_string()), )); } } @@ -797,7 +825,7 @@ async fn run_web_fetch_inner( let mut retry_after_ms: Option = None; let deadline = std::time::Instant::now() + std::time::Duration::from_millis(budget_ms); progress.phase("plan"); - let mut auto_escalation_unavailable = false; + let mut auto_escalation_unavailable: Option = None; #[cfg(feature = "browser")] let mut gated_escalation_spent = false; #[allow(unused_mut)] @@ -867,6 +895,11 @@ async fn run_web_fetch_inner( next_action.as_deref(), )); } + Ok(Err(crate::fetch::browser::BrowserFetchError::LaunchFailed(reason))) => { + return Err(browser_unavailable_error(&format!( + "browser launch failed: {reason}" + ))); + } Ok(Err(e)) => { return Err(ToolError::internal(format!("browser_fetch_failed: {e}"))); } @@ -985,12 +1018,16 @@ async fn run_web_fetch_inner( ); if should_escalate { if !browser_available { - auto_escalation_unavailable = true; + auto_escalation_unavailable = + Some(browser_unavailable_reason.clone()); } else { let remaining = deadline .saturating_duration_since(std::time::Instant::now()); if remaining.as_millis() < 2000 { - auto_escalation_unavailable = true; + auto_escalation_unavailable = Some( + "insufficient remaining call budget for browser rendering" + .to_string(), + ); } else { match tokio::time::timeout( remaining, @@ -1042,8 +1079,15 @@ async fn run_web_fetch_inner( next_action.as_deref(), )); } - Ok(Err(_)) | Err(_) => { - auto_escalation_unavailable = true; + Ok(Err(error)) => { + auto_escalation_unavailable = + Some(format!("browser escalation failed: {error}")); + } + Err(_) => { + auto_escalation_unavailable = Some( + "browser escalation exceeded the call budget" + .to_string(), + ); } } } @@ -1051,15 +1095,33 @@ async fn run_web_fetch_inner( } } #[cfg(not(feature = "browser"))] - if matches!(render_request, RenderRequest::Auto) { + if state.config.fetch.browser.enabled + && matches!(render_request, RenderRequest::Auto) + { let body_bytes = resp.raw_text.as_deref().unwrap_or("").as_bytes(); - if crate::fetch::challenge::detect( + let text_len = resp + .document + .as_ref() + .map(|document| { + document + .blocks + .iter() + .map(|block| block.text.trim().chars().count()) + .sum::() + }) + .or_else(|| { + resp.text.as_deref().map(|text| text.trim().chars().count()) + }) + .unwrap_or(0); + if crate::fetch::classify::browser_rendering_is_warranted( + resp.status, + resp.content_type.as_deref(), resp.title.as_deref(), - &String::from_utf8_lossy(body_bytes), - ) - .is_some() - { - auto_escalation_unavailable = true; + text_len, + body_bytes, + ) { + auto_escalation_unavailable = + Some(browser_unavailable_reason.clone()); } } @@ -1106,7 +1168,9 @@ async fn run_web_fetch_inner( error, escalation_unavailable, } => { - auto_escalation_unavailable |= escalation_unavailable; + if escalation_unavailable { + auto_escalation_unavailable = Some(error.to_string()); + } failure = error; } GatedEscalation::ManualInteraction { @@ -1357,12 +1421,10 @@ async fn run_web_fetch_inner( "link list was truncated; not all links are included".to_string(), )); } - if auto_escalation_unavailable { + if let Some(reason) = auto_escalation_unavailable { structured.push(crate::core::warning::AgentWarning::new( crate::core::warning::WarningCode::BrowserUnavailable, - "browser escalation was needed but rendering is unavailable; see \ - provider_status.browser_capabilities.reason" - .to_string(), + reason, )); } if limit_clamped { diff --git a/src/mcp/tools/web_fetch_escalation.rs b/src/mcp/tools/web_fetch_escalation.rs index 272663ce..65d0fd1a 100644 --- a/src/mcp/tools/web_fetch_escalation.rs +++ b/src/mcp/tools/web_fetch_escalation.rs @@ -52,13 +52,20 @@ pub(crate) async fn escalate_gated_status(request: GatedEscalationRequest<'_>) - deadline, } = request; + let unavailable_reason = if !state.config.fetch.browser.enabled { + Some("browser rendering is disabled in config".to_string()) + } else { + crate::fetch::browser::browser_discovery_reason(&state.browser_discovery_state) + } + .or_else(|| Some("browser rendering is unavailable".to_string())); + match escalate( EscalationRequest { url, status, policy: render_policy, browser_available, - unavailable_reason: None, + unavailable_reason: unavailable_reason.as_deref(), profile_name: used_profile_name, budgets, extract_mode, diff --git a/src/meta/engines/mojeek.rs b/src/meta/engines/mojeek.rs index 88ebed6b..dccedf10 100644 --- a/src/meta/engines/mojeek.rs +++ b/src/meta/engines/mojeek.rs @@ -116,14 +116,7 @@ async fn send_search( .send() .await .map_err(|e| super::map_request_error(ENGINE, e))?; - if !resp.status().is_success() { - return Err(EngineError::BadStatus { - engine: ENGINE, - status: resp.status().as_u16(), - }); - } - let bytes = super::read_bounded_body(resp, ENGINE, MAX_BODY_BYTES).await?; - Ok(String::from_utf8_lossy(&bytes).into_owned()) + super::read_search_body(resp, ENGINE, &SHAPE, MAX_BODY_BYTES, &[]).await } async fn solve_cookie( @@ -1165,4 +1158,105 @@ mod tests { "Max-Age=0 must store nothing" ); } + + const NETWORK_BLOCK_PAGE: &str = r#"403 - Forbidden

403 - Forbidden

Sorry your network appears to be sending automated queries so we can't process your search at this time.

If you are seeing this in error please contact us.

"#; + + #[tokio::test] + async fn network_block_served_with_403_is_blocked_not_a_status_failure() { + use httpmock::prelude::*; + + let _guard = CHALLENGE_TEST_LOCK.lock().await; + pass_cookie_cache().remove(ENGINE); + let before = ledger_stats(); + + let server = MockServer::start(); + let search_mock = server.mock(|when, then| { + when.method(GET).path("/search").query_param("q", "rust"); + then.status(403) + .header("content-type", "text/html") + .body(NETWORK_BLOCK_PAGE); + }); + let challenge_mock = server.mock(|when, then| { + when.method(GET).path("/captcha/challenge"); + then.status(200) + .header("content-type", "application/json") + .body(SOLVABLE_CHALLENGE); + }); + let verify_mock = server.mock(|when, then| { + when.method(POST).path("/captcha/verify"); + then.status(200).header("set-cookie", "chllg=unexpected"); + }); + + let err = search_at( + &test_client(), + &server.url(""), + "rust", + 10, + Duration::from_secs(5), + &ChallengeSection { + enabled: true, + ..ChallengeSection::default() + }, + ) + .await + .expect_err("a network block must not parse as results"); + + match err { + EngineError::Blocked { + engine: "mojeek", + reason, + } => { + assert!(reason.contains("challenge page detected"), "got: {reason}"); + assert!( + reason.contains("your network appears to be sending automated queries"), + "got: {reason}" + ); + assert!(reason.contains("HTTP 403"), "got: {reason}"); + } + other => panic!("expected Blocked, got {other:?}"), + } + assert_eq!(search_mock.hits(), 1); + assert_eq!(challenge_mock.hits(), 0); + assert_eq!(verify_mock.hits(), 0); + + let after = ledger_stats(); + assert_eq!(solves_delta(&before, &after), (0, 0, 0)); + } + + #[tokio::test] + async fn non_success_without_a_marker_stays_a_status_failure() { + use httpmock::prelude::*; + + let _guard = CHALLENGE_TEST_LOCK.lock().await; + pass_cookie_cache().remove(ENGINE); + + let server = MockServer::start(); + let search_mock = server.mock(|when, then| { + when.method(GET).path("/search").query_param("q", "rust"); + then.status(500); + }); + + let err = search_at( + &test_client(), + &server.url(""), + "rust", + 10, + Duration::from_secs(5), + &ChallengeSection::default(), + ) + .await + .expect_err("an unmarked failure must stay a status failure"); + + assert!( + matches!( + err, + EngineError::BadStatus { + engine: "mojeek", + status: 500 + } + ), + "unexpected error: {err:?}" + ); + assert_eq!(search_mock.hits(), 1); + } } diff --git a/src/sdk.rs b/src/sdk.rs index 729d99e7..f2fb8f77 100644 --- a/src/sdk.rs +++ b/src/sdk.rs @@ -211,6 +211,13 @@ impl EggsearchClient { }; result.map_err(SdkError::from) } + + pub async fn close(&self) { + #[cfg(feature = "browser")] + if let Some(lifecycle) = self.state.browser_lifecycle.as_ref() { + lifecycle.close().await; + } + } } fn decode(value: serde_json::Value) -> Result { diff --git a/tests/batch_fetch_retrieval.rs b/tests/batch_fetch_retrieval.rs index 52812759..f42de4f1 100644 --- a/tests/batch_fetch_retrieval.rs +++ b/tests/batch_fetch_retrieval.rs @@ -30,6 +30,17 @@ use eggsearch::meta::mock::{mock_engines, MockEngine}; use eggsearch::meta::MetadataSearchAdapter; fn localhost_state() -> Arc { + let defaults = AppConfig::default(); + localhost_state_with_brief_limits( + defaults.mcp.brief_max_chars, + defaults.fetch.batch_concurrency, + ) +} + +fn localhost_state_with_brief_limits( + brief_max_chars: usize, + batch_concurrency: usize, +) -> Arc { let engines = vec![MockEngine::success("mock_a", vec![])]; let adapter = MetadataSearchAdapter::from_engines(mock_engines(engines), Duration::from_secs(5)); @@ -37,6 +48,8 @@ fn localhost_state() -> Arc { cfg.search.providers.insert("mock_a".to_string(), true); cfg.fetch.allow_localhost = true; cfg.fetch.allow_private_network = true; + cfg.fetch.batch_concurrency = batch_concurrency; + cfg.mcp.brief_max_chars = brief_max_chars; Arc::new(ServerState::with_adapter(cfg, Arc::new(adapter))) } @@ -1581,6 +1594,179 @@ fn locator_helpers_preserve_safety() { )); } +#[tokio::test] +async fn batch_web_budget_uses_projected_payload_and_drops_structure_before_text() { + use httpmock::prelude::*; + + let server = MockServer::start(); + let requested_text = + "The requested passage stays intact across a response projection. ".repeat(24); + let html = format!( + r#"Projection page

{requested_text}

"# + ); + let page = server.mock(|when, then| { + when.method(GET).path("/"); + then.status(200) + .header("content-type", "text/html; charset=utf-8") + .body(html.clone()); + }); + + let mut diagnostic_args = batch_args(vec![web_item(server.url("/"))]); + diagnostic_args.max_chars_per_item = Some(10_000); + diagnostic_args.max_total_chars = Some(50_000); + diagnostic_args.response_detail = Some(eggsearch::mcp::projection::ResponseDetail::Diagnostic); + let diagnostic = run_batch_fetch(localhost_state(), diagnostic_args) + .await + .expect("diagnostic batch"); + let original = diagnostic["results"][0]["response"].clone(); + assert!(original["document"]["blocks"].is_array()); + assert!(original["document"]["chunks"].is_array()); + + let standard = eggsearch::mcp::projection::project( + "web_fetch", + original.clone(), + eggsearch::mcp::projection::ResponseDetail::Standard, + ); + let standard_full_chars = serde_json::to_string(&standard).unwrap().chars().count(); + let mut standard_after_structure = standard.clone(); + let standard_document = standard_after_structure["document"] + .as_object_mut() + .expect("standard document"); + assert!(standard_document.remove("blocks").is_some()); + assert!(standard_document.remove("chunks").is_some()); + let standard_fitted_chars = serde_json::to_string(&standard_after_structure) + .unwrap() + .chars() + .count(); + let standard_cap = standard_fitted_chars + 128; + assert!(standard_full_chars > standard_cap); + + let mut standard_args = batch_args(vec![web_item(server.url("/"))]); + standard_args.max_chars_per_item = Some(10_000); + standard_args.max_total_chars = Some(standard_cap); + standard_args.response_detail = Some(eggsearch::mcp::projection::ResponseDetail::Standard); + let standard_batch = run_batch_fetch(localhost_state(), standard_args) + .await + .expect("standard batch"); + page.assert_hits(2); + let standard_result = &standard_batch["results"][0]; + assert_eq!(standard_result["ok"], true); + assert_eq!(standard_result["response"]["text"], original["text"]); + assert!(standard_result["response"]["document"] + .get("blocks") + .is_none()); + assert!(standard_result["response"]["document"] + .get("chunks") + .is_none()); + assert_eq!(standard_result["truncated"], false); + assert_eq!( + standard_result["degraded_fields"], + serde_json::json!(["document.blocks", "document.chunks"]) + ); + let standard_payload_chars = serde_json::to_string(&standard_result["response"]) + .unwrap() + .chars() + .count() as u64; + assert_eq!( + standard_result["payload_chars"].as_u64(), + Some(standard_payload_chars) + ); + assert_eq!( + standard_batch["total_payload_chars"].as_u64(), + Some(standard_payload_chars) + ); + assert!(standard_payload_chars as usize <= standard_cap); + + let compact = eggsearch::mcp::projection::project( + "web_fetch", + original.clone(), + eggsearch::mcp::projection::ResponseDetail::Compact, + ); + let compact_chars = serde_json::to_string(&compact).unwrap().chars().count(); + let compact_cap = compact_chars + 128; + assert!(serde_json::to_string(&original).unwrap().chars().count() > compact_cap); + + let mut compact_args = batch_args(vec![web_item(server.url("/"))]); + compact_args.max_chars_per_item = Some(10_000); + compact_args.max_total_chars = Some(compact_cap); + compact_args.response_detail = Some(eggsearch::mcp::projection::ResponseDetail::Compact); + let compact_batch = run_batch_fetch(localhost_state(), compact_args) + .await + .expect("compact batch"); + let compact_result = &compact_batch["results"][0]; + assert_eq!(compact_result["ok"], true); + assert_eq!(compact_result["response"]["text"], original["text"]); + assert!(compact_result["response"].get("document").is_none()); + assert!(compact_result["degraded_fields"] + .as_array() + .is_none_or(|fields| fields.is_empty())); + let compact_payload_chars = serde_json::to_string(&compact_result["response"]) + .unwrap() + .chars() + .count() as u64; + assert_eq!( + compact_result["payload_chars"].as_u64(), + Some(compact_payload_chars) + ); + assert_eq!( + compact_batch["total_payload_chars"].as_u64(), + Some(compact_payload_chars) + ); + assert!(compact_payload_chars as usize <= compact_cap); +} + +#[tokio::test] +async fn brief_batch_budget_waits_for_final_projection() { + use httpmock::prelude::*; + + let server = MockServer::start(); + let text = + "A requested passage whose final brief response is intentionally bounded. ".repeat(100); + let html = format!( + r#"Brief budget fixture

{text}

"# + ); + let first = server.mock(|when, then| { + when.method(GET).path("/first"); + then.status(200) + .header("content-type", "text/html; charset=utf-8") + .body(html.clone()); + }); + let second = server.mock(|when, then| { + when.method(GET).path("/second"); + then.status(200) + .header("content-type", "text/html; charset=utf-8") + .body(html.clone()); + }); + + let mut args = batch_args(vec![ + web_item(server.url("/first")), + web_item(server.url("/second")), + ]); + args.max_chars_per_item = Some(10_000); + args.max_total_chars = Some(512); + args.response_detail = Some(eggsearch::mcp::projection::ResponseDetail::Brief); + let result = run_batch_fetch(localhost_state_with_brief_limits(32_000, 1), args) + .await + .expect("brief batch"); + + first.assert_hits(1); + second.assert_hits(1); + assert!( + result["total_payload_chars"].as_u64().unwrap() <= 512, + "{result}" + ); + assert!( + !result["results"].as_array().unwrap().is_empty(), + "brief projection removed every item: {result}" + ); + assert!(result["warnings"] + .as_array() + .unwrap() + .iter() + .filter_map(serde_json::Value::as_str) + .all(|warning| !warning.contains("was skipped"))); +} + #[tokio::test] async fn batch_repo_degradation_drops_structure_before_text() { let dir = tempfile::tempdir().expect("workspace root"); diff --git a/tests/fixtures/engines/README.md b/tests/fixtures/engines/README.md index 134248ce..b7c0047c 100644 --- a/tests/fixtures/engines/README.md +++ b/tests/fixtures/engines/README.md @@ -84,6 +84,37 @@ dropped rather than redacted. No cookie, JWT, challenge id, impression token, parser. Every committed file is under 2 KB; the repository hard ceiling for a fixture is 100 KB. +## Mojeek network-block capture (2026-11-23 UTC) + +The `mojeek` blocked marker was re-confirmed against the *status-bearing* variant of the refusal, +because that is the one this egress receives: + +- `GET https://www.mojeek.com/search?q=…` with the shipped search user agent and + `Accept-Language: en-US,en;q=0.9`; no credential; bounded by `curl --max-time 20 --max-filesize + 2000000` +- `HTTP/1.1 403 Forbidden`, `Content-Length: 363`, `Content-type: text/html; charset=UTF-8`, + `Server: lighttpd/1.4.53` +- Body: `403 - Forbidden` … `

Sorry your network appears to be sending automated + queries so we can't process your search at this time.

`. SHA-256 + `50666d78ab85d7af911166fa712af887dedcf4a2751df8927992a4d253548691`; the echoed query in the + `/about/contact` link was removed before retention. + +The body satisfies `PageMarker::Text("your network appears to be sending automated queries")`, which +is why the four-outcome contract requires the body to be read on a non-success status. `mojeek.rs` +short-circuited to `BadStatus` there, so the marker never ran; M049 routes it through +`read_search_body()`. The captured response is retained in +`plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-network-block-403-capture.json`. + +`https://www.mojeek.com/robots.txt` was read the same day (HTTP 200) and declares `User-agent: *` / +`Disallow: /search`, so the search page is not offered to automated clients at all. + +The page is served per query, not per network. From the same public address, the in-app Chromium +browser received Mojeek's `200` homepage and the `200` ALTCHA wall for `test`, `rust`, +`official website`, `rust programming language`, a long benign sentence, and a held-out question; +only the probe string reproduced the `403`, and it did so from three different client identities, +including a current Chrome identity with matching `sec-ch-ua`/`sec-fetch-*` headers. Controls: +`plans/closure/retrieval-quality-evidence-extension/evidence/mojeek-403-mechanism-controls.json`. + ## Empty-state and block markers Markers are declared as constants next to each parser (`SHAPE` in diff --git a/tests/mcp_projection.rs b/tests/mcp_projection.rs index 8335168c..c06141f9 100644 --- a/tests/mcp_projection.rs +++ b/tests/mcp_projection.rs @@ -741,7 +741,7 @@ fn batch_partial_failure_and_budget_preserved() { } #[test] -fn batch_payload_budget_fields_survive_compact_and_standard() { +fn batch_payload_budget_fields_track_projected_responses() { let payload = json!({ "fetched": 1, "failed": 0, @@ -765,19 +765,97 @@ fn batch_payload_budget_fields_survive_compact_and_standard() { "structured_warnings": [], "telemetry": {"items_requested": 1, "items_completed": 1, "items_failed": 0} }); - for detail in [ResponseDetail::Compact, ResponseDetail::Standard] { + let mut counts = Vec::new(); + for detail in [ + ResponseDetail::Diagnostic, + ResponseDetail::Standard, + ResponseDetail::Compact, + ResponseDetail::Brief, + ] { let projected = project("batch_fetch", payload.clone(), detail); + let mut expected_total = 0u64; + for result in projected["results"].as_array().unwrap() { + let response_chars = serde_json::to_string(&result["response"]) + .unwrap() + .chars() + .count() as u64; + expected_total += response_chars; + assert_eq!( + result["payload_chars"].as_u64(), + Some(response_chars), + "{detail:?}" + ); + assert_eq!(result["degraded_fields"][0], "document", "{detail:?}"); + } assert_eq!( - projected - .get("total_payload_chars") - .and_then(|v| v.as_u64()), - Some(90), + projected["total_payload_chars"].as_u64(), + Some(expected_total), "{detail:?}" ); + counts.push((detail, expected_total)); + } + let compact = counts + .iter() + .find(|(detail, _)| *detail == ResponseDetail::Compact) + .unwrap() + .1; + let standard = counts + .iter() + .find(|(detail, _)| *detail == ResponseDetail::Standard) + .unwrap() + .1; + assert!(compact < standard); +} + +#[test] +fn batch_web_payload_budget_counts_only_projected_fields() { + let payload = json!({ + "fetched": 1, + "failed": 0, + "truncated": false, + "total_chars_returned": 12, + "total_payload_chars": 0, + "results": [{ + "index": 0, + "item_type": "web", + "label": "https://example.com/", + "stable_id": "s1", + "ok": true, + "response": { + "text": "requested text", + "description": "description", + "document": {"kind": "html", "blocks": [{"text": "large duplicated text"}]} + }, + "error": null, + "chars_returned": 12, + "payload_chars": 0, + "degraded_fields": [], + "truncated": false + }], + "warnings": [], + "structured_warnings": [], + "telemetry": {"items_requested": 1, "items_completed": 1, "items_failed": 0} + }); + let standard = project("batch_fetch", payload.clone(), ResponseDetail::Standard); + let compact = project("batch_fetch", payload, ResponseDetail::Compact); + for projected in [&standard, &compact] { let result = &projected["results"][0]; - assert_eq!(result["payload_chars"], 90, "{detail:?}"); - assert_eq!(result["degraded_fields"][0], "document", "{detail:?}"); + let response_chars = serde_json::to_string(&result["response"]) + .unwrap() + .chars() + .count() as u64; + assert_eq!(result["payload_chars"].as_u64(), Some(response_chars)); + assert_eq!( + projected["total_payload_chars"].as_u64(), + Some(response_chars) + ); } + assert!(standard["results"][0]["response"].get("document").is_some()); + assert!(compact["results"][0]["response"].get("document").is_none()); + assert!( + compact["results"][0]["payload_chars"].as_u64().unwrap() + < standard["results"][0]["payload_chars"].as_u64().unwrap() + ); } #[test] diff --git a/tests/static_guards.rs b/tests/static_guards.rs index 7f824097..0eac6243 100644 --- a/tests/static_guards.rs +++ b/tests/static_guards.rs @@ -1907,6 +1907,48 @@ fn tokio_feature_policy_stays_explicit() { } } +#[test] +fn default_features_ship_pdf_and_browser() { + let manifest = env!("CARGO_MANIFEST_DIR"); + let cargo = fs::read_to_string(format!("{manifest}/Cargo.toml")).expect("Cargo.toml readable"); + let default_line = cargo + .lines() + .find(|line| line.trim_start().starts_with("default =")) + .expect("Cargo.toml must declare a default feature set"); + for required in ["pdf", "browser"] { + assert!( + default_line.contains(&format!("\"{required}\"")), + "the default feature set must ship `{required}`: {default_line}" + ); + } + assert!( + !default_line.contains("\"egress\""), + "egress must stay out of the default feature set: {default_line}" + ); + + let config = fs::read_to_string(format!("{manifest}/src/core/config.rs")) + .expect("config source readable"); + let browser_default = config + .split_once("fn default_browser_enabled() -> bool {") + .map(|(_, rest)| rest.chars().take(120).collect::()) + .expect("config must declare default_browser_enabled"); + assert!( + browser_default.contains("cfg!(feature = \"browser\")"), + "browser rendering must default on exactly where the feature is compiled" + ); + + let release = fs::read_to_string(format!("{manifest}/.github/workflows/release-eggpack.yml")) + .expect("generated release workflow readable"); + for line in release.lines() { + if line.contains("'build'") { + assert!( + !line.contains("--no-default-features"), + "release builds must ship the default feature set: {line}" + ); + } + } +} + #[test] fn timeout_overrides_retain_the_shared_fetch_client() { let manifest = env!("CARGO_MANIFEST_DIR");