Skip to content

Measure AI-Ready Choice and visibility - #1665

Open
napetrov wants to merge 8 commits into
intel:mainfrom
napetrov:ai-ready/wp5-choice-scan
Open

napetrov wants to merge 8 commits into
intel:mainfrom
napetrov:ai-ready/wp5-choice-scan

Conversation

@napetrov

@napetrov napetrov commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

Summary

AI-Ready checklist v1.5 actions 8–11.

owner answer key → phrasings × answering models × repeats
                   ├── training-only answer
                   └── Responses web answer + returned sources and citations
independent judge + exact checks → Choice and per-question evidence

dokimi scan choice measures Recall, Rank, Current-Path and No-Retired. It records citations, competitor share, migration prompts, human review IDs and supplied Context7 and DeepWiki update observations. Routes without a completed web search report NOT RUN. Product and component Choice use the same core-question scope.

dokimi scan replay rebuilds the November pilot's historical Choice, using archived toolkit-manager answers and the published sklearnex counts.

Evidence

  • Before, component Choice included migration answers. A fixture with one good core answer and one wrong migration answer gave 5.0 for the component and 10.0 for the product. Both now give 10.0, with the migration answer recorded for the per-question report.

  • pytest tests/test_choice_scan.py tests/test_run_envelope.py checks good and plausible-wrong answers, citations, unavailable routes, credential redaction, the question ID preflight, saved evidence and offline replay.

  • Direct replay on the pilot archive returned sklearnex 6.5 and toolkit-manager 2.1. The available live proxy returned HTTP 403 for the web tool. Search capability and index ages still need a live route and observations.

  • make ci-local reported 0 failed, 38 passed and 16 skipped. The suite passed 36,284 tests, all 20 changed-test repeats passed, and changed-line coverage was 91%. A follow-up CLI test passed with the targeted suite (190 tests) and caught both surviving mutations in isolated reruns. The mutation budget left 62 cases unrun and three inconclusive.

Merge Danger

Door Two-way.

Blast radius Opt-in visibility scans and an extension to the answer-key schema.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
(cherry picked from commit 1f69ba3f6b2409db2816d4855846be7d7d20a848)
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Copilot AI balanced review requested due to automatic review settings December 6, 2026 07:04
@napetrov
napetrov requested a review from a team as a code owner December 6, 2026 07:04
@github-actions

github-actions Bot commented Dec 6, 2026

Copy link
Copy Markdown

CLI interface change detected

This PR changes dokimi's user-facing CLI surface (commands and/or options):

+ added command `dokimi scan`
    + option `--help/-h`
+ added command `dokimi scan choice`
    + option `--answer-key`
    + option `--help/-h`
    + option `--human-sample`
    + option `--json`
    + option `--judge`
    + option `--mode`
    + option `--model`
    + option `--notes`
    + option `--out`
    + option `--reps`
    + option `--web-key-env`
    + option `--web-route`
+ added command `dokimi scan replay`
    + argument `archive`
    + option `--help/-h`
    + option `--json`
    + option `--out`
    + option `--profile`
~ `dokimi runs list` parameters changed:
    ~ changed option `--kind`: choices: ["'agent_run'", "'answer_key'", "'answers'", "'arms'", "'arms_reps'", "'baseline_manifest'", "'catalog_eval'", "'checklist'", "'cli_routes'", "'cross_judge'", "'dashboard'", "'delivery'", "'docling_sources'", "'docs_run'", "'dokimi_config'", "'effective_instructions'", "'eval'", "'eval_controls'", "'eval_coverage'", "'explore_runs'", "'grounding'", "'guidance_reach'", "'headroom'", "'judge_validity'", "'judge_wording'", "'leak'", "'matrix_rollup'", "'need_graph'", "'novelty'", "'novelty_atoms'", "'novelty_retest'", "'opportunities'", "'pairwise'", "'persona_analysis'", "'personas'", "'plan'", "'plugin_delta'", "'question_panel'", "'question_quality'", "'questions'", "'ragas'", "'reach_matrix'", "'redteam'", "'repo_budget'", "'repo_environment'", "'repo_hits_judged'", "'repo_ledger'", "'repo_readiness'", "'report_qa'", "'report_summary'", "'result'", "'run'", "'run_context'", "'security_report'", "'skill_coverage'", "'skill_discovery'", "'skill_evidence'", "'subject_scorecard'", "'task_inspect'", "'task_runs'", "'tool_preference'"] -> ["'agent_run'", "'answer_key'", "'answers'", "'arms'", "'arms_reps'", "'baseline_manifest'", "'catalog_eval'", "'checklist'", "'choice_scan'", "'cli_routes'", "'cross_judge'", "'dashboard'", "'delivery'", "'docling_sources'", "'docs_run'", "'dokimi_config'", "'effective_instructions'", "'eval'", "'eval_controls'", "'eval_coverage'", "'explore_runs'", "'grounding'", "'guidance_reach'", "'headroom'", "'judge_validity'", "'judge_wording'", "'leak'", "'matrix_rollup'", "'need_graph'", "'novelty'", "'novelty_atoms'", "'novelty_retest'", "'opportunities'", "'pairwise'", "'persona_analysis'", "'personas'", "'plan'", "'plugin_delta'", "'question_panel'", "'question_quality'", "'questions'", "'ragas'", "'reach_matrix'", "'redteam'", "'repo_budget'", "'repo_environment'", "'repo_hits_judged'", "'repo_ledger'", "'repo_readiness'", "'report_qa'", "'report_summary'", "'result'", "'run'", "'run_context'", "'security_report'", "'skill_coverage'", "'skill_discovery'", "'skill_evidence'", "'subject_scorecard'", "'task_inspect'", "'task_runs'", "'tool_preference'"]

Updated on every push; the cli-interface-change label is on while the diff is non-empty.

@github-actions github-actions Bot added the cli-interface-change Changes dokimi's user-facing CLI surface label Dec 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved critical defects undermine scoring integrity, permit credential-bearing URLs, and allow replay output to overwrite source archives.

9 open issues
What changed in this PR

9 new findings.

Adds AI-Ready visibility measurements to dokimi, with live recommendation scans and offline replay of November pilot evidence.

Changes:

  • Adds independently judged Choice scores and web-search evidence.
  • Registers scan commands, artifacts and answer-key extensions.
  • Adds documentation and tests for scanning, replay and CLI integration.
File Description
README.md Links visibility guidance.
dokimi/​tests/​test_runs_show.py Checks scan artifact counts.
dokimi/​tests/​test_runs_scan.py Checks scan metadata discovery.
dokimi/​tests/​test_import_architecture.py Registers the scorecard layer.
dokimi/​tests/​test_cli_spend_controls.py Includes paid scans.
dokimi/​tests/​test_cli_routes.py Checks scan routing.
dokimi/​tests/​test_cli_output.py Covers scan output contracts.
dokimi/​tests/​test_choice_scan.py Tests scoring, evidence and replay.
dokimi/​tests/​fixtures/​artifacts/​choice_scan.v1.json Adds representative scan evidence.
dokimi/​tests/​cli_faults.py Supplies scan input fixtures.
dokimi/​dokimi/​scorecard/​web.py Collects web answers and sources.
dokimi/​dokimi/​scorecard/​pilot_choice.py Replays historical Choice evidence.
dokimi/​dokimi/​scorecard/​choice.py Computes scores and visibility reports.
dokimi/​dokimi/​scorecard/​__init__.py Introduces the scorecard package.
dokimi/​dokimi/​schemas/​choice_scan.v1.json Defines scan artifacts.
dokimi/​dokimi/​schemas/​answer_key.v1.json Adds migration prompts and expected terms.
dokimi/​dokimi/​runs/​kinds.py Indexes scan artifacts.
dokimi/​dokimi/​commands/​tools.py Reuses output preflight checks.
dokimi/​dokimi/​commands/​scan_choice.py Implements scan and replay commands.
dokimi/​dokimi/​commands/​_output.py Shares output preflight checks.
dokimi/​dokimi/​cli.py Registers scan commands.
dokimi/​dokimi/​cli_routes.py Declares scan routes and costs.
dokimi/​dokimi/​cli_flags.py Defines visibility flags.
dokimi/​dokimi/​artifacts.py Registers the scan schema.
dokimi/​dokimi/​__init__.py Documents the scorecard package.
dokimi/​docs/​start/​experiments.md Explains visibility scans.
dokimi/​docs/​reference/​cli-interface.json Updates the CLI reference.
dokimi/​changelog.d/​20261124_050000_choice-scan.md Announces scanning and replay.
AGENTS.md Points to scan help.

Review effort: Balanced

web = dict(args.web_route or [])
if any(public_url(url) != url for url in web.values()):
raise InputError("web route URLs must omit credentials, query and fragment")
if args.judge in args.model:
data = replay_choice(args.archive.resolve(), args.profile)
except (ValueError, OSError, TypeError, KeyError) as exc:
raise InputError(f"cannot read Choice pilot archive ({type(exc).__name__})") from exc
_publish(args, data, "scan replay")
answer = self._answer(client, prompt, mode, repeat)
if answer.status != "COMPLETE":
return {**row, "status": answer.status, "reason": answer.reason}
clean_answer = redact(answer.answer, secrets)
if mode == "web":
return responses_search(prompt, client.model, self.web_routes.get(client.provider), self.web_key_env)
try:
return WebAnswer("COMPLETE", answer=client.text(prompt, draw=repeat))

def _published_sklearnex(record: Path) -> dict[str, Any]:
text = record.read_text(encoding="utf-8-sig")
section = text.split("## A1 — scikit-learn-intelex", 1)[-1].split("## A1 — Dokimi", 1)[0]
return None
try:
url = urlsplit(value)
if url.scheme in {"https", "http"} and url.hostname and not url.username:
return WebAnswer("INCONCLUSIVE", "web search completed without an answer")
cited = [a.get("url") for part in content for a in part.get("annotations", []) if a.get("type") == "url_citation"]
retrieved = [source.get("url") for item in searches for source in item.get("action", {}).get("sources", [])]
return WebAnswer("COMPLETE", answer=text, citations=_urls(cited), search_results=_urls(retrieved))
payload = stamp("choice_scan", data)
unavailable = any(payload["scores"][mode]["status"] != "COMPLETE" for mode in getattr(args, "mode", []) or [])
if args.json:
cli_output.emit_leaf(kind, payload, status="partial" if unavailable else "complete")
def _page_coverage(rows: list[dict[str, Any]]) -> dict[str, Any]:
result: dict[str, list[dict[str, Any]]] = {}
for r in rows:
if r["mode"] == "web" and r["status"] == "COMPLETE" and (page := r.get("page")):
@exai-bot

exai-bot commented Dec 6, 2026 •

Copy link
Copy Markdown

🔍 OpenCodeReview found 9 issue(s) in this PR.

CI at 2cc6fb0: 23 passing, 5 skipped.

By label: 8 should fix, 1 not shown by a run

Label Location Finding
should fix scan_choice.py:81 Protect replay inputs from output collisions before publishing.
should fix web.py:65-66 Impact: truncated web answers can count as completed evidence, affecting Choice, coverage, and the CLI exit code.
should fix web.py:34 Impact: page coverage can pass for the wrong document, and distinct wrong-page evidence can be merged.
should fix choice.py:80 Impact: credentials removed from answer text can still be written to the JSON artifact through URL evidence.
should fix scan_choice.py:53-54 Normalize provider/model routes before checking judge independence.
should fix choice.py:69 Impact: a human Current-Path verdict can be applied to a different answer, silently changing Choice by up to 3 points.
should fix choice.py:87 Impact: a missing training-only answer is graded as completed evidence rather than reducing coverage, potentially producing a numeric...
should fix scan_choice.py:30 Impact: paid scans report cost.calls: 0 and cost.spent_usd: 0.0, so consumers cannot distinguish their spend from an offline replay.
not shown by a run choice.py:61 Impact: paid scans report zero calls and $0 spent in their CLI JSON, making their cost evidence indistinguishable from a free replay.
Test notes (2)
  • dokimi/dokimi/scorecard/choice.py:160: With status = "COMPLETE" if scored and coverage >= 0.7 else "INCONCLUSIVE" if any( changed to status = "COMPLETE" if scored and coverage > 0.7 else "INCONCLUSIVE" if any(, the tests still pass: dokimi/tests/test_choice_scan.py, dokimi/tests/test_cli_output.py, dokimi/tests/test_cli_routes.py, dokimi/tests/test_cli_spend_controls.py, dokimi/tests/test_import_architecture.py, dokimi/tests/test_runs_scan.py. A value exactly at the boundary gives the same result either way here, so no test says which one is meant.
  • dokimi/dokimi/scorecard/pilot_choice.py:58: With return {**row, "checks": {"recall": named is not None, "rank": named is not None and named.start() / max(len(text), 1) < 0.3, changed to return {**row, "checks": {"recall": named is not None, "rank": named is not None and named.start() / max(len(text), 1) <= 0.3,, the tests still pass: dokimi/tests/test_choice_scan.py, dokimi/tests/test_cli_output.py, dokimi/tests/test_cli_routes.py, dokimi/tests/test_cli_spend_controls.py, dokimi/tests/test_import_architecture.py, dokimi/tests/test_runs_scan.py. A value exactly at the boundary gives the same result either way here, so no test says which one is meant.
Review details
  • Commit reviewed: 2cc6fb0 against merge base 19e5222
  • Coverage: 29 files in 5 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 2.13M tokens (1.60M from cache), 2m1s
  • Tool calls: 146 (109 file_read, 21 code_search, 6 code_comment, 5 file_read_diff, 3 file_find, 2 ci_status)
  • Choice scan documentation and project guidance: 4 files
  • Choice scan command and CLI integration: 8 files
  • Choice scorecard implementation and tests: 7 files
  • Choice scan schemas, artifacts, and run integration: 7 files
  • Shared command output handling: 3 files

payload = stamp("choice_scan", data)
unavailable = any(payload["scores"][mode]["status"] != "COMPLETE" for mode in getattr(args, "mode", []) or [])
if args.json:
cli_output.emit_leaf(kind, payload, status="partial" if unavailable else "complete")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · should fix
Impact: paid scans report cost.calls: 0 and cost.spent_usd: 0.0, so consumers cannot distinguish their spend from an offline replay.

Trigger: any successful scan choice --json invocation that calls an answering model and judge.

Evidence: this call supplies no cost; emit_leaf delegates to envelope, whose _zero_cost() explicitly represents a leaf making no model calls. Scan.run() also discards the clients' recorded usage, and web requests bypass that accounting entirely.

Workaround: consult provider billing separately. Track answering, judging and web calls and pass their cost summary here; mark unpriced calls as unpriced rather than free.

Should fix: A run shows it, but the proof replaces part of the code with stand-ins, so the real path was not run.

This proof replaces part of the code with stand-ins (monkeypatch): it shows the code path, not the real dependency or platform.

Shown by running: exit 1 (at the head) · exit 2 (at the merge base, which cannot run it) · exit 0 (at the head with the fix)

python -m pytest -q -p no:randomly -p no:cacheprovider tests/test_review_c8.py

What the proof does: Calls _choice using a stand-in transport returning priced usage records and checks the emitted envelope against the actual answering and judging call count and spend.

The problem shows as the output PAID_CHOICE_REPORTS_ZERO_COST.

Script: dokimi/tests/test_review_c8.py (22 lines).

        cost = document['cost']
>       assert cost['calls'] == len(calls) and cost['spent_usd'] == len(calls) * 0.125, 'PAID_CHOICE_REPORTS_ZERO_COST'
E       AssertionError: PAID_CHOICE_REPORTS_ZERO_COST
E       assert (0 == 60)
E        +  where 60 = len(['choice-answer', 'choice-judge', 'choice-answer', 'choice-judge', 'choice-answer', 'choice-judge', ...])

tests/test_review_c8.py:22: AssertionError
=========================== short test summary info ============================
FAILED tests/test_review_c8.py::test_training_cost_is_reported - AssertionErr...
1 failed in 0.66s

Comment on lines +53 to +54
if args.judge in args.model:
raise InputError("use a different provider/model for the Choice judge")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · should fix
Normalize provider/model routes before checking judge independence.

Trigger: scan choice --answer-key key.json --model google/gemini-2.5-pro --judge gemini/gemini-2.5-pro --mode training.

Evidence: _pair preserves these distinct provider strings, so this comparison passes, but PROVIDER_ALIASES maps both to google-vertex and llm.resolve_model resolves both to vertex_ai/gemini-2.5-pro.

Impact: the answering model grades itself despite the documented independent-judge requirement, and its scores can be published as complete.

Workaround: use genuinely different models and canonical provider names. Compare normalized effective routes before starting calls and add an alias-pair regression test.

Should fix: A run shows it; it was not judged to be met in ordinary use.

This proof replaces part of the code with stand-ins (monkeypatch): it shows the code path, not the real dependency or platform.

Shown by running: exit 1 (at the head) · exit 2 (at the merge base, which cannot run it) · exit 0 (at the head with the fix)

python -m pytest -q -p no:randomly -p no:cacheprovider tests/test_review_c5.py

What the proof does: Uses real route resolution and _choice with a stand-in model transport to check that aliased identical routes are rejected before any calls.

The problem shows as the output ALIASED_SELF_JUDGE_ACCEPTED.

Script: dokimi/tests/test_review_c5.py (24 lines).

        "reason": "no update observation supplied"
      }
    },
    "coverage_pages": {},
    "content_plans": {}
  }
}
=========================== short test summary info ============================
FAILED tests/test_review_c5.py::test_alias_judge_is_rejected - AssertionError...
1 failed in 0.66s

data = replay_choice(args.archive.resolve(), args.profile)
except (ValueError, OSError, TypeError, KeyError) as exc:
raise InputError(f"cannot read Choice pilot archive ({type(exc).__name__})") from exc
_publish(args, data, "scan replay")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · should fix
Protect replay inputs from output collisions before publishing.

Trigger: dokimi scan replay ARCHIVE --profile toolkit-manager --out ARCHIVE/tkm/choice.jsonl (likewise the sklearnex Markdown source).

Evidence: replay_choice reads that file, then _publish calls save_artifact, which replaces existing destinations without a collision check; only _choice currently guards its inputs.

Impact: the command succeeds while destroying the archived evidence, and subsequent replays fail.

Workaround: write output to a separate path. Reject an output resolving to the selected archive source and add regression coverage for both profiles.

Should fix: A run shows it; it was not judged to be met in ordinary use.

Shown by running: exit 1 (at the head) · exit 2 (at the merge base, which cannot run it) · exit 0 (at the head with the fix) · exit 1 (proof 2, at the head) · exit 2 (proof 2, at the merge base, which cannot run it) · exit 0 (proof 2, at the head with the fix)

python -m pytest -q -p no:randomly -p no:cacheprovider tests/test_review_c1_toolkit.py

What the proof does: Calls _replay with its toolkit-manager archive file as the output and checks that the archive remains unchanged and the collision is rejected.

The problem shows as the output REPLAY_ARCHIVE_OVERWRITTEN.

Script: dokimi/tests/test_review_c1_toolkit.py (19 lines).

      "source": "/tmp/pytest-of-root/pytest-0/test_archive_is_preserved0/tkm/choice.jsonl",
      "method": "archived answers",
      "judge": "historical regex rules",
      "observed_at": "2026-11-24"
    }
  }
}
=========================== short test summary info ============================
FAILED tests/test_review_c1_toolkit.py::test_archive_is_preserved - Assertion...
1 failed in 0.67s

cells = itertools.product(range(1, len(question["phrasings"]) + 1), range(1, self.repeats + 1))
for phrasing, repeat in cells:
rows.append(self._measure(client, judge, mode, question, phrasing, repeat))
return report(self.key["product"], rows, self.human_sample, self.notes)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · not shown by a run
Impact: paid scans report zero calls and $0 spent in their CLI JSON, making their cost evidence indistinguishable from a free replay.

Trigger: run scan choice --mode training --reps 1 --json with a valid ten-question, three-phrasing key and successful answers/judgments.

Evidence: this executes 30 answering calls and 30 judge calls, but discards both clients' usage; _publish supplies no cost to emit_leaf, whose envelope defaults to calls: 0 and spent_usd: 0.0. Web requests are likewise uncounted. Preserve and aggregate usage across all answering clients and the judge, count web requests, and pass the resulting cost to the envelope (mark unpriced calls unknown rather than free).

Workaround: obtain usage from provider billing instead of this output.

Not shown by a run: The proof step did not check this finding.

row = {"question": question["id"], "component": question.get("component"), "migration": question.get("migration"),
"model": f"{client.provider}/{client.model}", "mode": mode, "phrasing": phrasing, "repeat": repeat,
"page": public_url(question.get("page"))}
row["id"] = hashlib.sha256(repr(row).encode()).hexdigest()[:20]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · should fix
Impact: a human Current-Path verdict can be applied to a different answer, silently changing Choice by up to 3 points.

Trigger: review an answer ID, then rerun the same scan with --notes while the model returns a different answer (or the phrasing/expected answer changes).

Evidence: this ID hashes only question metadata, before either the prompt or answer is added; _measure then looks up that ID and _grade unconditionally overrides Current-Path with the old boolean.

Workaround: do not reuse human-review notes across live runs. Bind reviews to the actual answer and grading inputs, or apply them to saved evidence without regenerating answers.

Should fix: A run shows it, but the proof replaces part of the code with stand-ins, so the real path was not run.

This proof replaces part of the code with stand-ins (monkeypatch): it shows the code path, not the real dependency or platform.

Shown by running: exit 1 (at the head) · exit 2 (at the merge base, which cannot run it) · exit 0 (at the head with the fix)

python -m pytest -q -p no:randomly -p no:cacheprovider tests/test_review_c6.py

What the proof does: Runs real scans with a stand-in model transport, confirms a matching human review applies, then checks that changing the answer prevents reuse of that review.

The problem shows as the output STALE_HUMAN_REVIEW_OVERRIDES_NEW_ANSWER.

Script: dokimi/tests/test_review_c6.py (21 lines).

        answer[0] = 'Use Example with an obsolete installer.'
        changed = run(notes)['answers'][0]
>       assert changed['checks']['current'] is False, 'STALE_HUMAN_REVIEW_OVERRIDES_NEW_ANSWER'
E       AssertionError: STALE_HUMAN_REVIEW_OVERRIDES_NEW_ANSWER
E       assert True is False

tests/test_review_c6.py:21: AssertionError
=========================== short test summary info ============================
FAILED tests/test_review_c6.py::test_review_does_not_transfer_to_changed_answer
1 failed in 0.64s

self.notes.get("human_reviews", {}).get(row["id"]), prompt=row["prompt"])
status = "INCONCLUSIVE" if any(value is None for value in grade.values()) else "COMPLETE"
return {**row, "status": status, "checks": grade, "answer": clean_answer,
"citations": answer.citations, "search_results": answer.search_results,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security · should fix
Impact: credentials removed from answer text can still be written to the JSON artifact through URL evidence.

Trigger: with WEB_TEST_KEY=declared-test-secret, a route returns a citation/source such as https://example.org/declared-test-secret/guide.

Evidence: public_url preserves the path and hostname, these lists are copied without redact, and artifact publication performs no further redaction. Sanitize or discard URLs containing known secrets before they enter the row and derived reports; extend the existing redaction test with a secret in a URL path. The answer-key page field needs the same protection.

Workaround: sanitize provider URLs upstream and do not share affected artifacts.

Should fix: A run shows it; it was not judged to be met in ordinary use.

This proof replaces part of the code with stand-ins (mock): it shows the code path, not the real dependency or platform.

Shown by running: exit 1 (at the head) · exit 1 (at the merge base, which cannot run it) · exit 0 (at the head with the fix)

python proof_c4.py

What the proof does: Runs Scan._measure in web mode with a stubbed route returning a secret-bearing URL and checks the row has no secret.

The problem shows as the output SECRET_LEAKED_IN_ROW.

Script: dokimi/proof_c4.py (26 lines).

SECRET_LEAKED_IN_ROW

if mode == "web":
return responses_search(prompt, client.model, self.web_routes.get(client.provider), self.web_key_env)
try:
return WebAnswer("COMPLETE", answer=client.text(prompt, draw=repeat))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · should fix
Impact: a missing training-only answer is graded as completed evidence rather than reducing coverage, potentially producing a numeric Choice and exit 0 for a run with no usable answers.

Trigger: the provider returns empty/whitespace content, for example when a reasoning model exhausts its token budget before producing text.

Evidence: LLMClient.text() explicitly returns reply or "" and does not raise for empty truncated replies; this branch wraps that value in WebAnswer("COMPLETE"). The web path already treats an empty answer as inconclusive.

Workaround: inspect and exclude empty answer rows manually. Reject blank training replies as INCONCLUSIVE before judging them, and test this case.

Should fix: A run shows it; it was not judged to be met in ordinary use.

Shown by running: exit 1 (at the head) · exit 1 (at the merge base, which cannot run it) · exit 0 (at the head with the fix)

python proof_c7.py

What the proof does: Runs Scan._measure in training mode with a model returning an empty reply and asserts the row is not COMPLETE.

The problem shows as the output EMPTY_ANSWER_COMPLETE.

Script: dokimi/proof_c7.py (20 lines).

EMPTY_ANSWER_COMPLETE

url = urlsplit(value)
if url.scheme in {"https", "http"} and url.hostname and not url.username:
authority = url.netloc
return urlunsplit((url.scheme, authority, url.path, "", ""))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · should fix
Impact: page coverage can pass for the wrong document, and distinct wrong-page evidence can be merged.

Trigger: the key targets https://example.org/docs?page=install, but the returned source and citation are https://example.org/docs?page=legacy.

Evidence: this function maps both to /docs; _measure applies it to the target and _urls applies it to sources/citations, so _page_coverage reports a match. Preserve functional URL identity while removing sensitive parameters, or explicitly reject unsupported query-addressed targets rather than silently matching them.

Workaround: use query-free canonical page URLs.

Should fix: A run shows it; it was not judged to be met in ordinary use.

This proof replaces part of the code with stand-ins (monkeypatch): it shows the code path, not the real dependency or platform.

Shown by running: exit 1 (at the head) · exit 2 (at the merge base, which cannot run it) · exit 0 (at the head with the fix)

python -m pytest -q -p no:randomly -p no:cacheprovider tests/test_review_c3.py

What the proof does: Runs a web scan with stand-in HTTP and judge responses citing the legacy query-addressed document and checks that coverage cannot pass for the install document.

The problem shows as the output WRONG_QUERY_DOCUMENT_PASSES_COVERAGE.

Script: dokimi/tests/test_review_c3.py (25 lines).

        coverage = data['coverage_pages']['install']
>       assert not any(row['pass'] for row in coverage), 'WRONG_QUERY_DOCUMENT_PASSES_COVERAGE'
E       AssertionError: WRONG_QUERY_DOCUMENT_PASSES_COVERAGE
E       assert not True
E        +  where True = any(<generator object test_wrong_query_document_does_not_pass.<locals>.<genexpr> at 0x79f98aca2c20>)

tests/test_review_c3.py:25: AssertionError
=========================== short test summary info ============================
FAILED tests/test_review_c3.py::test_wrong_query_document_does_not_pass - Ass...
1 failed in 0.64s

Comment on lines +65 to +66
def _answer(data: dict[str, Any]) -> WebAnswer:
output = data.get("output", [])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · should fix
Impact: truncated web answers can count as completed evidence, affecting Choice, coverage, and the CLI exit code.

Trigger: an HTTP 200 Responses payload has status: "incomplete" (for example, an output-token limit), a completed search call, and partial output text.

Evidence: _answer checks only the search status and nonempty text before returning COMPLETE; it ignores the response and message completion states.

Fix: Reject incomplete/failed responses as INCONCLUSIVE before grading, and add this payload to the tests.

Workaround: validate response completion in the configured proxy.

Should fix: A run shows it; it was not judged to be met in ordinary use.

Shown by running: exit 1 (at the head) · exit 1 (at the merge base, which cannot run it) · exit 0 (at the head with the fix)

python proof_c2.py

What the proof does: Feeds an incomplete Responses payload to _answer and asserts it is not COMPLETE.

The problem shows as the output INCOMPLETE_COUNTED_AS_COMPLETE.

Script: dokimi/proof_c2.py (11 lines).

INCOMPLETE_COUNTED_AS_COMPLETE

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 86.57143% with 47 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.38%. Comparing base (19e5222) to head (2cc6fb0).

Files with missing lines Patch % Lines
dokimi/dokimi/scorecard/web.py 69.49% 12 Missing and 6 partials ⚠️
dokimi/dokimi/scorecard/choice.py 90.37% 9 Missing and 4 partials ⚠️
dokimi/dokimi/commands/scan_choice.py 86.36% 6 Missing and 6 partials ⚠️
dokimi/dokimi/scorecard/pilot_choice.py 91.11% 2 Missing and 2 partials ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1665      +/-   ##
==========================================
- Coverage   96.44%   96.38%   -0.06%     
==========================================
  Files         585      589       +4     
  Lines       76600    76930     +330     
  Branches    13175    13218      +43     
==========================================
+ Hits        73876    74152     +276     
- Misses       1671     1703      +32     
- Partials     1053     1075      +22     
Files with missing lines Coverage Δ
dokimi/dokimi/__init__.py 100.00% <ø> (ø)
dokimi/dokimi/artifacts.py 96.07% <ø> (ø)
dokimi/dokimi/cli_flags.py 100.00% <ø> (ø)
dokimi/dokimi/cli_routes.py 98.52% <ø> (ø)
dokimi/dokimi/commands/_output.py 100.00% <100.00%> (ø)
dokimi/dokimi/commands/tools.py 96.03% <100.00%> (-0.30%) ⬇️
dokimi/dokimi/runs/kinds.py 100.00% <ø> (ø)
dokimi/dokimi/scorecard/pilot_choice.py 91.11% <91.11%> (ø)
dokimi/dokimi/commands/scan_choice.py 86.36% <86.36%> (ø)
dokimi/dokimi/scorecard/choice.py 90.37% <90.37%> (ø)
... and 1 more

... and 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Dec 6, 2026

Copy link
Copy Markdown

Mutation of changed lines

⚠️ Tests miss 3 of 37 small breaks of the lines this PR changes, and the check was not complete

At 2cc6fb0: 31 caught · 3 missed · 3 inconclusive · 43 not tried in time

Each row is a small deliberate break (a mutant) of a line this PR changes that every test reaching that line still passes. Add a test that fails on it or, if it cannot change behaviour, put # mutation-ok[<operator>]: <reason> at the end of the line or alone on the line above.

Where Operator Change no test notices Tests reaching the line
dokimi/dokimi/commands/scan_choice.py:55 negate-condition args.out → not (args.out) 3
dokimi/dokimi/commands/scan_choice.py:56 delete-statement check_artifact_output(str(args.out)) → pass 1
dokimi/dokimi/commands/scan_choice.py:86 drop-clause not first or not sep or not second → (not first or not second) 3

Not the whole picture:

  • 43 breaks were not tried before the time budget ran out
  • 267 more breaks of covered changed lines were over the limit and not tried
  • 252 candidate test files were not run
  • 89 changed lines were not mutated

Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli-interface-change Changes dokimi's user-facing CLI surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants