Skip to content

fix(encoding): every UTF-8 encode and write names its handler; five commands take a lone surrogate - #1654

Open
antonwolfy wants to merge 4 commits into
intel:mainfrom
antonwolfy:fix/encoding-rule
Open

antonwolfy wants to merge 4 commits into
intel:mainfrom
antonwolfy:fix/encoding-rule

Conversation

@antonwolfy

@antonwolfy antonwolfy commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Five commands encode text as strict UTF-8 where it can hold a lone surrogate (a file or directory name with a byte that is not UTF-8, which Python reads as \udcXX, or a "\ud800" escape in a JSON or YAML file) and end in a UnicodeEncodeError traceback and exit 5 (#1617). On main (4deffc0):

Command Input Result on main
catalog novelty ROOT a skill directory named a\xff exit 5 at commands/catalog_novelty.py:187 (_dirname hashes key.encode('utf-8')) before the first skill
report opportunities FILE a file named a\xff.txt exit 5 at opportunities.py:42 (source_key), nothing on stdout
skill shorten --lexical-only "\ud800" in a span text of the --atoms file exit 5 at commands/novelty.py, --out left at 0 bytes
skill novelty retest "\ud800" in one novelty.json's artifact.ref exit 5, retest.json written, retest.md left at 0 bytes
repo reach --harness bad.yaml a config_files value "\ud800" exit 5 at repos/harness_profile.py:172 (write_config), no reach.json

The class had been fixed one site at a time (#761, #863, #886, #914, #1020, #1101). #1619 turns it into a convention: every UTF-8 .encode(), write_text and write-mode open in the package names its errors= handler, and a check keeps it so. The check found 122 sites at this head: the six sites of the five bugs above (catalog novelty has two) and 116 others, each given the handler of its use (a hash, written or sent text, or a raise a caller turns into a refusal).

Fixes taken for #1617: the two hashes encode with errors="surrogatepass" (valid text gives the same bytes, so no output directory name or opportunity key moves); skill shorten and skill novelty retest write their Markdown with errors="replace", as #1101 did for the report writers; repo reach --harness refuses the profile when it loads (exit 2, naming config_files/<name>) instead of replacing, because the harness would otherwise read a config whose value was silently changed to ?, and a refusal before any spend names the input.

Closes #1617
Closes #1619

The same cause, in a custom profile whose config_files use {config_dir} with a --work-dir that is not UTF-8, is tracked in #1652. data import docling writes the converted Markdown with strict UTF-8 through write_text_atomic; with the converter stubbed to return a lone surrogate it ends in a traceback and exit 5, tracked in #1653.

Changes

  • catalog novelty: _dirname hashes with errors="surrogatepass" (a\xff gets a-d76edf05; accel-tuning keeps accel-tuning-101d2518), and each skill's novelty.md is written with errors="replace". Without the second change the sweep pays for the analysis and then reports the skill as an error row.
  • report opportunities: Opportunity.source_key hashes with errors="surrogatepass" (the keys 991d9233259f5640 and 364e0f3751016560 of valid text are the same on main).
  • skill shorten --lexical-only and skill novelty retest: the Markdown is written with errors="replace"; retest.json is unchanged.
  • repo reach --harness (and repo budget): _check_config_placeholders in repos/harness_profile.py refuses a config_files value with a lone surrogate (a "😀" pair is joined into its character first, here and in write_config, so only an unpaired surrogate is refused), beside the plain-file-name and placeholder refusals; write_config writes with errors="strict", the load being its guard. docs/repo-evaluation-contract.md lists the profile refusals, with the exit code of repo reach, repo budget and repo run.
  • The sweep: 116 sites name their handler, 28 surrogatepass (hashes and digests), 72 replace (written or sent text), 16 strict (the raise is the guard, a caller turns it into a refusal, a row or a note: _check_json_unicode, shadow_for, canonical_json, load_manifest and the like). For valid UTF-8 text every byte any command writes, hashes or sends is unchanged, and no existing test's expected value changed.
  • scripts/check_encoding_errors.py: an AST walk over the package that flags .encode() and .encode(<utf-8>), write_text(..., encoding=<utf-8>) and write-mode open, io.open and <path>.open with no errors; it prints path:line: <call> and one line saying which handler fits which use. A literal *(...), *[...] or **{"key": ...} is read as the arguments it holds (text.encode("utf-8", **{}) is flagged). No baseline, no waiver. Not covered, and its docstring says so: a * or ** of anything else (**options), an encode through a helper, bytes(text, "utf-8"), a non-literal encoding, other codecs and the decoding side.
  • CI: its own Encoding error handlers step in the static job of ci.yml (so make ci-local runs it), a paragraph in CONTRIBUTING.md and a bullet in AGENTS.md.
  • Tests: tests/test_encoding_surrogate_commands.py (one per command, from the issue's repros, and one that runs repo run with the surrogate profile and a --bin that does not exist, so it stops at the profile load with ✗ and exit 1), one in tests/test_catalog_novelty.py, and tests/test_check_encoding_errors.py (its path and line assertions hold on Windows, where a path has a drive prefix). A test in tests/test_memory_lint.py reaches the errors="replace" fallback of the index size in memory/lint.py, used when MEMORY.md cannot be statted.
  • Changelog fragment (Fixed).

Risk

Valid UTF-8 text is encoded, hashed and written as before, for every command. What differs is an input with a lone surrogate: the five commands above no longer exit 5, and repo reach and repo budget exit 2 with Error: <profile>: config_files/<name> is not valid UTF-8 text (a lone surrogate) where a profile holds one (repo run loads the same profile and ends it as it ends every profile refusal, with ✗ <message> and exit 1). A catalog novelty skill directory whose name is not UTF-8 now gets an output directory named from the surrogate-passed hash, and novelty.md shows the name with ?.

The 16 strict sites keep their behaviour exactly. catalog novelty's novelty.md (labelled "handled" in the study of the 93 sites) is replace rather than strict: its caller turns the raise into an error row after the analysis is paid for, which is the failure #1617 asks to remove.

Open PRs: #1559 rewrites the trace writes of run_reach (repos/reach.py lines 561 and 563 here) and adds a field to parse_profile; #1582 touches harness_profile.py and reach.py, and batch_ledger.py lines 111 and 113 are sites here. The edits are the keyword on the line as it stands, so a rebase keeps both changes. Any open PR that adds a new strict encode or write fails the new step once this merges: that is the check working.

Testing

On a Linux review host, at 9d6d010b (on main 4deffc0):

  • make ci-local: 39 passed, 0 failed, 16 skipped (docker and network jobs, jobs that do not run on a PR, semgrep, micromamba, the other Python legs and the fuzz run). 35929 tests passed, 28 skipped. The new step's row: pass 1s ci.yml:static / Encoding error handlers.
  • The repros of Five commands exit 5 when a file name is not UTF-8 or a JSON or YAML value holds a lone surrogate #1617 fail on main and pass here: tests/test_encoding_surrogate_commands.py is 7 failed, 1 passed on main's code (first failure: UnicodeEncodeError: 'utf-8' codec can't encode character '\ud800' at commands/novelty_retest.py; the repo run test reaches the missing --bin and prints ✗ harness executable ... not found instead of the profile refusal; the one that passes pins that a valid profile still loads), and the new test of tests/test_catalog_novelty.py fails at catalog_novelty.py:187.
  • tests/test_check_encoding_errors.py (with the script copied onto main's code) is 1 failed, 41 passed: the check of the package at HEAD fails on the unswept sites.
  • Mutants: 25 breaks of the code these tests cover (a handler turned to strict, replace or ignore, the profile refusal dropped (also failing the repo run test) or made ASCII-only, the check's UTF-8 names, handler argument, write modes, layouts, walk, order and exit code) each fail a test.
  • Mutants of the review round: reading any * or ** as unknown again fails the four literal-pack cases of tests/test_check_encoding_errors.py; checking config_files without joining pairs, and writing them without joining, each fail test_a_profile_config_file_with_a_surrogate_pair_loads_and_is_written_as_the_character; errors="strict" in the index-size fallback fails test_index_size_without_the_file_counts_a_lone_surrogate_as_one_byte with a UnicodeEncodeError.
  • One mutant of the changed lines survives in CI's mutation job: indent=2 to 3 at commands/novelty_run.py:165, a line the sweep only added a keyword to.
  • Merged together with fix/runs-export-unlistable on main 4deffc0: pytest -n auto 35924 passed, 28 skipped, mypy clean, ruff check clean.
  • Not run: Python 3.11, 3.12 and 3.14, semgrep, and Windows (the path assertions of tests/test_check_encoding_errors.py are built from the script's own _shown and split from the right; not run with a drive prefix).

Open questions

None.

Revert

A plain revert restores the five tracebacks (exit 5), drops the check and its CI step, and leaves the sites without a named handler. Nothing is stored: the digests, keys and directory names of valid text are the same before and after, and a directory written for a name that is not UTF-8 stays on disk under its name.

Checklist

  • Tests added/updated and pytest passes
  • ruff, mypy, and schema checks pass
  • Docs updated (or N/A) — see the docs-drift checklist in CONTRIBUTING.md
  • Self-reviewed per "Before opening a PR" in AGENTS.md
  • Each new raise/exit and test names the doc, contract or issue it traces to
  • No ad-hoc run artifacts committed
  • New files carry the SPDX license header (or are exempt in .github/.licenserc.yaml)

…#1617)

`catalog novelty`, `report opportunities`, `skill shorten --lexical-only`, `skill novelty retest` and `repo reach --harness` encoded text as strict UTF-8 where it can hold a lone surrogate (a file name that is not UTF-8, or a `"\ud800"` escape in a JSON or YAML file) and ended in a `UnicodeEncodeError` traceback and exit 5. `skill shorten` and `skill novelty retest` also left an empty output file behind.

The two hashes (`_dirname` of `catalog novelty`, `Opportunity.source_key`) encode with `errors="surrogatepass"`: valid text gives the same bytes, so no output directory name or opportunity key moves. The Markdown of `skill shorten`, `skill novelty retest` and each skill's `novelty.md` in `catalog novelty` is written with `errors="replace"`, so the surrogate is a `?` as in the report writers; `catalog novelty` needs it too, since the sweep would otherwise pay for the analysis and then report the skill as an error row.

`parse_profile` refuses a harness profile whose `config_files` value holds a lone surrogate when it loads, naming `config_files/<name>`: exit 2 in `repo reach` and `repo budget`, where the harness would otherwise read a config with a `?` in it. `write_config` writes with `errors="strict"`, the load being its guard.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…1619)

Strict UTF-8 encoding of text that can hold a lone surrogate (a file name that is not UTF-8, a `"\ud800"` escape in JSON or YAML) ended five commands in a traceback and exit 5 (intel#1617), and it was one of the longest fix series. The rule is now a convention: a `.encode()` or `.encode("utf-8")`, a `write_text(..., encoding="utf-8")` and a write-mode `open(..., encoding="utf-8")` in the package each name `errors=`.

The sweep covers the 116 sites left once the five bugs of intel#1617 are fixed in the commit before: 28 `errors="surrogatepass"`, 72 `errors="replace"` and 16 `errors="strict"`. `surrogatepass` is where the bytes go into a hash or digest: valid text gives the same bytes, so no stored digest, key or directory name changes. `replace` is where the text is written or sent, as the report writers do since intel#1101. `strict` is where the raise is the guard and a caller catches the `UnicodeEncodeError` and turns it into a refusal, a row or a note, so its behaviour is exactly as before. For valid UTF-8 text every byte any command writes, hashes or sends is unchanged.

`scripts/check_encoding_errors.py` walks the package with `ast`, prints each finding as `path:line: <call>` with a closing line that says which handler fits which use, and exits 1; it has no baseline and no waiver. It is its own `Encoding error handlers` step in the `static` job of `ci.yml`, and so a step of `make ci-local`. `tests/test_check_encoding_errors.py` pins each flagged shape, each shape that passes, and that the package at HEAD has no finding. `CONTRIBUTING.md` and `AGENTS.md` say what the check refuses and which handler fits.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…and exit 1; the refusal and the tests name their doc (intel#1617)

`repo run` loads the same profile as `repo reach`, and the contract doc and the fragment say it ends a refusal with `✗` and exit 1, but no test ran it. A new test runs `repo run` with a `config_files` value `"\ud800"` and a `--bin` that does not exist, so it stops at the profile load, and asserts exit 1 and the `✗ ...: config_files/x.json is not valid UTF-8 text` line. On `main`'s code it reaches the missing `--bin` instead.

`docs/repo-evaluation-contract.md` now says `repo run` ends the profile refusal with `✗` and exit 1. The new `ProfileError` in `_check_config_placeholders` names the contract sentence and intel#1617 in a comment, and the tests of `tests/test_encoding_surrogate_commands.py` cite that sentence or the intel#1617 row they check.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
@antonwolfy
antonwolfy requested a review from a team as a code owner December 5, 2026 13:17
@antonwolfy antonwolfy self-assigned this Dec 5, 2026
Copilot AI balanced review requested due to automatic review settings December 5, 2026 13:17
@antonwolfy antonwolfy added the testing-strategy Part of #1595: checks for the bug classes behind our fix series, their sweeps and research label Dec 5, 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

The encoding guard misses literal keyword unpacking, valid surrogate pairs are incorrectly rejected, and Windows path assumptions cause test failures.

4 open issues
What changed in this PR

4 new findings.

This PR fixes lone-surrogate failures in five Dokimi commands and establishes explicit UTF-8 error handling across the package, addressing #1617 and #1619.

Changes:

  • Preserve surrogate-containing hash inputs, replace surrogates in reports, and reject invalid harness configuration text.
  • Specify encoding handlers throughout the package without changing valid UTF-8 output.
  • Add an encoding checker, CI enforcement, regression tests, and contributor guidance.
File Description
dokimi/​tests/​test_encoding_surrogate_commands.py Adds command-level surrogate regressions.
dokimi/​tests/​test_check_encoding_errors.py Tests checker detection and diagnostics.
dokimi/​tests/​test_catalog_novelty.py Tests non-UTF-8 skill directory names.
dokimi/​scripts/​check_encoding_errors.py Adds the encoding-handler checker.
dokimi/​dokimi/​write_probe.py Names the probe’s write handler.
dokimi/​dokimi/​tool_preference.py Specifies hash encoding handlers.
dokimi/​dokimi/​subjects/​evidence_check.py Keeps canonical JSON encoding strict.
dokimi/​dokimi/​skill_coverage.py Specifies skill hash encoding.
dokimi/​dokimi/​runs/​rundir.py Names the run-marker write handler.
dokimi/​dokimi/​runs/​bundle.py Specifies manifest encoding.
dokimi/​dokimi/​runner/​plan.py Specifies plan hash handlers.
dokimi/​dokimi/​runner/​manifest.py Specifies manifest digest encoding.
dokimi/​dokimi/​repos/​workspace.py Keeps bridge writes strict.
dokimi/​dokimi/​repos/​transcript.py Specifies clipped-output byte counting.
dokimi/​dokimi/​repos/​support/​no_background.py Specifies hook-log write handling.
dokimi/​dokimi/​repos/​source.py Specifies Git request encoding.
dokimi/​dokimi/​repos/​skill_reach.py Specifies salt and trace handlers.
dokimi/​dokimi/​repos/​selfcheck.py Specifies self-check output handlers.
dokimi/​dokimi/​repos/​security.py Specifies execution-log encoding.
dokimi/​dokimi/​repos/​runner.py Specifies trace, answer, and lock handlers.
dokimi/​dokimi/​repos/​replay/​merged.py Keeps filename validation strict.
dokimi/​dokimi/​repos/​receipt.py Specifies source digest encoding.
dokimi/​dokimi/​repos/​reach.py Specifies validation and trace handlers.
dokimi/​dokimi/​repos/​l0/​typecheck.py Specifies temporary-file write handlers.
dokimi/​dokimi/​repos/​host.py Specifies host fingerprint encoding.
dokimi/​dokimi/​repos/​harness_profile.py Rejects surrogate-containing configuration values.
dokimi/​dokimi/​repos/​guidance_arms.py Specifies guidance output encoding.
dokimi/​dokimi/​repos/​grading.py Specifies Git configuration writes.
dokimi/​dokimi/​repos/​graders/​typecheck.py Keeps type-check configuration writes strict.
dokimi/​dokimi/​repos/​graders/​main.py Specifies grade and oracle handlers.
dokimi/​dokimi/​repos/​graders/​__init__.py Specifies grader digest encoding.
dokimi/​dokimi/​repos/​batch_ledger.py Specifies execution hash handlers.
dokimi/​dokimi/​report/​json_report.py Specifies JSON report writes.
dokimi/​dokimi/​process_io.py Names JSON and truncation-marker handlers.
dokimi/​dokimi/​plugins.py Specifies plugin hash encoding.
dokimi/​dokimi/​opportunities.py Supports surrogates in opportunity keys.
dokimi/​dokimi/​novelty/​retention.py Specifies retention cache writes.
dokimi/​dokimi/​novelty/​provenance.py Specifies prompt digest encoding.
dokimi/​dokimi/​novelty/​needs.py Specifies prompt-version encoding.
dokimi/​dokimi/​novelty/​grounding.py Specifies grounding source hashes.
dokimi/​dokimi/​novelty/​bundle.py Specifies bundle text hashes.
dokimi/​dokimi/​metrics/​example_runner.py Specifies snippet write handlers.
dokimi/​dokimi/​memory/​lint.py Specifies fallback byte counting.
dokimi/​dokimi/​llm_cli.py Keeps prompt-size encoding strict.
dokimi/​dokimi/​harnesses/​swebench.py Keeps task-file writes strict.
dokimi/​dokimi/​harnesses/​swebench_grade.py Specifies grading output handlers.
dokimi/​dokimi/​harnesses/​solver_stream.py Specifies solver record writes.
dokimi/​dokimi/​harnesses/​skill_treatment.py Specifies plugin metadata writes.
dokimi/​dokimi/​harnesses/​operations.py Keeps UTF-8 validation strict.
dokimi/​dokimi/​harnesses/​network_policy.py Specifies policy-error record writes.
dokimi/​dokimi/​harnesses/​harbor_export.py Specifies export hash and write handlers.
dokimi/​dokimi/​harnesses/​fidelity.py Specifies fixture response encoding.
dokimi/​dokimi/​harnesses/​egress_proxy.py Keeps proxy request encoding strict.
dokimi/​dokimi/​harnesses/​docker_solver.py Specifies solver output handlers.
dokimi/​dokimi/​harnesses/​delivery.py Specifies fixture lookup hashing.
dokimi/​dokimi/​harnesses/​container_agent.py Specifies egress-log writes.
dokimi/​dokimi/​harnesses/​command.py Specifies output byte-count encoding.
dokimi/​dokimi/​harnesses/​benchflow.py Specifies benchmark log writes.
dokimi/​dokimi/​external/​upstream.py Specifies Git and manifest handlers.
dokimi/​dokimi/​eval/​panel.py Specifies panel prompt hashing.
dokimi/​dokimi/​eval/​judge.py Specifies judge prompt hashing.
dokimi/​dokimi/​eval/​ask_outcome.py Specifies rubric hashing.
dokimi/​dokimi/​digest.py Specifies digest metadata encoding.
dokimi/​dokimi/​commands/​tools.py Specifies item export writes.
dokimi/​dokimi/​commands/​subjects.py Specifies matrix configuration writes.
dokimi/​dokimi/​commands/​routing_compare.py Specifies comparison output writes.
dokimi/​dokimi/​commands/​repo_hits.py Specifies hit-sheet writes.
dokimi/​dokimi/​commands/​repair_receipt.py Specifies receipt output writes.
dokimi/​dokimi/​commands/​opportunities.py Keeps JSON Unicode validation strict.
dokimi/​dokimi/​commands/​novelty.py Handles surrogates in shortened Markdown.
dokimi/​dokimi/​commands/​novelty_run.py Specifies panel verdict writes.
dokimi/​dokimi/​commands/​novelty_routing.py Specifies refusal record writes.
dokimi/​dokimi/​commands/​novelty_routing_report.py Specifies routing result writes.
dokimi/​dokimi/​commands/​novelty_retest.py Handles surrogates in retest Markdown.
dokimi/​dokimi/​commands/​novelty_budget.py Specifies complete and partial writes.
dokimi/​dokimi/​commands/​headroom.py Specifies content digest encoding.
dokimi/​dokimi/​commands/​catalog.py Specifies trigger-set export writes.
dokimi/​dokimi/​commands/​catalog_scan.py Specifies scan record rewrites.
dokimi/​dokimi/​commands/​catalog_novelty.py Handles surrogate names and reports.
dokimi/​dokimi/​commands/​catalog_eval.py Specifies checker identity hashing.
dokimi/​dokimi/​agent_run/​runner.py Specifies host transcript writes.
dokimi/​dokimi/​agent_run/​container.py Specifies container trace writes.
dokimi/​dokimi/​agent_run/​adapters.py Specifies adapter configuration writes.
dokimi/​docs/​repo-evaluation-contract.md Documents profile refusals and exit codes.
dokimi/​CONTRIBUTING.md Documents encoding enforcement.
dokimi/​changelog.d/​20261205_100000_lone-surrogate-five-commands.md Records the command fixes.
AGENTS.md Adds encoding-handler guidance.
.github/​workflows/​ci.yml Adds the encoding checker step.

Review effort: Balanced

Comment thread dokimi/dokimi/repos/harness_profile.py Resolved
Comment thread dokimi/scripts/check_encoding_errors.py Resolved
@exai-bot

exai-bot commented Dec 5, 2026 •

Copy link
Copy Markdown

✅ OpenCodeReview: Review complete: 0 finding(s) across 89 selected item(s).

CI at 9d6d010: 28 passing, 4 skipped.

Review details
  • Commit reviewed: 9d6d010 against merge base 4deffc0
  • Coverage: 89 files in 18 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 1.36M tokens (792k from cache), 55s
  • Tool calls: 158 (137 file_read, 12 code_search, 4 local_check_results, 2 ci_status, 2 file_read_diff, 1 file_find)
  • Encoding policy enforcement and contributor guidance: 5 files
  • Surrogate-handling contract and command regression coverage: 3 files
  • Catalog commands and novelty regression tests: 5 files
  • Novelty execution, budgeting, and routing commands: 7 files
  • Novelty evidence and artifact lifecycle: 5 files
  • Opportunity discovery and headroom reporting: 3 files
  • Agent execution and process I/O: 10 files
  • Harness delivery, fidelity, and benchmark grading: 7 files
  • Network isolation and execution security: 4 files
  • Evaluation outcomes, judges, and reporting: 5 files
  • Repository graders and self-checks: 6 files
  • Repository evaluation orchestration and reach: 6 files
  • Repository sources, hosting, and workspaces: 4 files
  • Repository receipts, replay, and transcripts: 4 files
  • Run planning, manifests, and bundled artifacts: 5 files
  • Memory linting and regression tests: 2 files
  • Subject evidence and repository-hit commands: 3 files
  • Tool integration, preferences, and capability probes: 5 files

Comment thread dokimi/scripts/check_encoding_errors.py Resolved
@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Mutation of changed lines

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

At 9d6d010: 54 caught · 1 missed · 17 inconclusive

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/novelty_run.py:165 bump-int 2 → 3 2

Not the whole picture:

  • 200 candidate test files were not run
  • 65 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.

@codecov-commenter

codecov-commenter commented Dec 5, 2026 •

Copy link
Copy Markdown

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

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.49%. Comparing base (4deffc0) to head (9d6d010).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1654      +/-   ##
==========================================
- Coverage   96.49%   96.49%   -0.01%     
==========================================
  Files         569      569              
  Lines       75249    75256       +7     
  Branches    12980    12980              
==========================================
+ Hits        72613    72617       +4     
  Misses       1611     1611              
- Partials     1025     1028       +3     
Files with missing lines Coverage Δ
dokimi/dokimi/agent_run/adapters.py 90.19% <ø> (ø)
dokimi/dokimi/agent_run/container.py 92.30% <100.00%> (ø)
dokimi/dokimi/agent_run/runner.py 86.59% <100.00%> (ø)
dokimi/dokimi/commands/catalog.py 98.69% <100.00%> (ø)
dokimi/dokimi/commands/catalog_eval.py 98.96% <100.00%> (ø)
dokimi/dokimi/commands/catalog_novelty.py 94.20% <100.00%> (+0.44%) ⬆️
dokimi/dokimi/commands/catalog_scan.py 97.34% <100.00%> (ø)
dokimi/dokimi/commands/headroom.py 98.91% <100.00%> (ø)
dokimi/dokimi/commands/novelty.py 98.31% <100.00%> (ø)
dokimi/dokimi/commands/novelty_budget.py 97.35% <100.00%> (ø)
... and 68 more

... and 6 files with indirect coverage changes

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

…irs, cover the index-size fallback

The encoding check read a call with any `*` or `**` as unknown, so `text.encode("utf-8", **{})` passed; a literal `*(...)`, `*[...]` or `**{"key": ...}` is now read as the arguments it holds, and a pack that is not a literal stays unknown.

A profile config file written as a YAML `"😀"` escape is one character, not a lone surrogate: the load check and `write_config` join the pair first, so only an unpaired surrogate is refused.

The check's tests build the expected path with the script's own `_shown` and split the finding line from the right, so a Windows drive prefix does not break them. A test reaches the `errors="replace"` fallback of the memory lint index size, which codecov named.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>

@napetrov napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Change class: CONTRACT (head 9d6d010)

  • Contract: changed. errors dokimi/dokimi/repos/harness_profile.py:240; cli dokimi/dokimi/harnesses/docker_solver.py
  • Responsibility: none
  • Dependency: none
  • Review depth: check the changed surface: callers, docs, tests pin new behaviour
  • Coverage gaps: none

0 blocking, 1 minor.

The encoding sweep prevents the five reported command failures and adds an AST check. Two text writer APIs can still select implicit strict encoding with errors=None and pass the check.

Combined with #1562, the new encoding check fails on the trigger-query JSON writer. Add the appropriate explicit handler to that writer before both can land. The paired merge with #1582 also conflicts in harness_profile.py.

CI on head 9d6d010: 0 failing Actions jobs; merge base 4deffc0 is behind base tip 5225c2a.

Compared the change and input edges against the merge base and checked existing threads and GitHub Actions. Runtime checks used focused Linux tests and local fixtures. Focused tests on the head: head 243 passed in 35.62s.

return (
_is_write_mode(_arg(call, 1 - shift, "mode"))
and _is_utf8(_arg(call, 3 - shift, "encoding"))
and _arg(call, 4 - shift, "errors") is None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: errors=None passes the check and still uses implicit strict encoding

dokimi/scripts/check_encoding_errors.py:132 The same presence check in the write_text branch treats an explicit None as a handler (C7).

How to check: Both Path.write_text and Path.open with UTF-8 and errors=None pass the new checker. For these APIs None selects the default strict handling.
Expected: Flag a literal None for UTF-8 text writes alongside an omitted handler.

@napetrov napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Checked the five encoding fixes, focused Linux tests, and required CI on this head. The errors=None case remains a minor lint gap. Before #1562 lands, add an explicit handler to its trigger-query JSON writer so the combined tree passes the new check.

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

testing-strategy Part of #1595: checks for the bug classes behind our fix series, their sweeps and research

Projects

None yet

5 participants