Repository navigation
feat(repo): repo tasks authoring builds hidden-test tasks from merged PRs - #425
Conversation
… PRs Settles intel#294: review replay measures guidance for reviewing, while most guidance is read while writing code. `repo tasks authoring` writes one `dokimi:hidden_tests` task per merged pull request of a `gh api graphql` file, with the same input and the same left-out rules as replay. - base: the merge base of headRefOid with mergeCommit^1 (shared with replay in repos/replay/merged.py, with the guidance and eval_dir rule); a fast-forward merge is skipped. - prompt: the PR's title and description without fenced blocks that quote the change, links to its commits or diff, and lines naming a hidden test (counted in prompt_dropped; more than 5 skip the PR), then a fixed instruction that --prompt-file replaces. - hidden/: the test files the PR adds or changes; reference/ and reference_deleted: the rest of its diff, the oracle. - filter: a test file, a change outside the tests, and at most --max-lines (default 400) lines there; public_at is the PR's createdAt, so repo compare flags these tasks as it does replay tasks. Grading: the manifest gets an optional entry_points.test, the repository's test command, with {tests} and a JUnit report at {out}. For dokimi:hidden_tests the framework copies the hidden files into the workspace, runs that command in the grading container and records its exit; the stdlib grader reads the report: pass when every hidden test ran and passed, pass_share beside it. eval check runs null and oracle twice each for these tasks and reports differing runs as flaky (exit 1). Contract §2, §4.3, §4.5 and a new §4.7 document it. Closes intel#294 Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #425 +/- ##
==========================================
+ Coverage 94.99% 95.07% +0.07%
==========================================
Files 366 371 +5
Lines 48636 49150 +514
Branches 8373 8452 +79
==========================================
+ Hits 46204 46729 +525
+ Misses 1539 1535 -4
+ Partials 893 886 -7
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open issues
The contract says a report that is missing or unreadable should fail the run (pass=false) rather… · New{tests}expansion doesn’t match the contract when{tests}appears inside a longer token.… · New Parsing of ISO 8601 timestamps with a trailingZis not supported bydatetime.fromisoformaton… · New
What changed in this PR
Adds infrastructure to generate “authoring” tasks (one per merged PR) and a new built-in grader that runs hidden tests during grading, enabling task creation from real PR history without manual authoring.
Changes:
- Add
repo tasks authoringto builddokimi:hidden_teststasks from merged PRs (prompt sanitization + diff splitting into hidden tests vs oracle). - Introduce
dokimi:hidden_testsgrader and framework support to stage hidden files + runentry_points.testproducing a JUnit report. - Extend manifest schema/validation and
eval checkto support hidden-test tasks (including flaky detection via double-runs).
| File | Description |
|---|---|
| dokimi/tests/test_repo_authoring.py | Adds comprehensive tests for authoring task generation, prompt redaction, manifest rules, and hidden-test grading/selfcheck behavior. |
| dokimi/tests/data/cli_flags_allowlist.txt | Allowlists new CLI flags --prs and --max-lines for the new command. |
| dokimi/dokimi/schemas/repo_manifest.v1.json | Extends schema to allow entry_points.test for hidden test execution. |
| dokimi/dokimi/repos/selfcheck.py | Updates eval check logic to double-run null/oracle for hidden-test tasks and mark flaky. |
| dokimi/dokimi/repos/replay/threads.py | Generalizes PR JSON ingestion to support both replay threads and authoring PR files (body/createdAt). |
| dokimi/dokimi/repos/replay/merged.py | Centralizes merged-PR common logic (merge/head checks, merge base, left-out rules). |
| dokimi/dokimi/repos/replay/history.py | Adds git helpers for authoring pipeline (name-status, numstat, blobs, commit lists). |
| dokimi/dokimi/repos/replay/build.py | Refactors replay builder to use shared merged-PR helpers. |
| dokimi/dokimi/repos/replay/authoring_prs.py | Builds Change objects from merged PRs, including public_at handling. |
| dokimi/dokimi/repos/replay/authoring_prompt.py | Implements prompt redaction (quoted blocks, links/SHAs, test-name leaks) and counters. |
| dokimi/dokimi/repos/replay/authoring.py | Implements authoring task writer: hidden tests/files, oracle reference, filters, and task.json fields. |
| dokimi/dokimi/repos/replay/__init__.py | Updates module docs to cover both replay and authoring paths. |
| dokimi/dokimi/repos/manifest.py | Adds {tests} placeholder handling and validation; requires entry_points.test for hidden-test tasks; validates hidden files exist. |
| dokimi/dokimi/repos/grading.py | Adds framework support to stage hidden files and run entry_points.test before grading hidden-test tasks. |
| dokimi/dokimi/repos/graders/main.py | Registers the new hidden_tests grader/oracle with the built-in grader runner. |
| dokimi/dokimi/repos/graders/hidden_tests.py | New grader that interprets JUnit XML + run record and implements reference-copy + deletes oracle. |
| dokimi/dokimi/repos/graders/__init__.py | Exposes hidden-tests grader in built-in name lists and task-problem validation. |
| dokimi/dokimi/commands/repo_run.py | Adds CLI command implementation and argparse wiring for repo tasks authoring. |
| dokimi/dokimi/cli_routes.py | Exposes new free CLI route repo tasks authoring. |
| dokimi/docs/repo-evaluation-contract.md | Documents manifest entry_points.test, hidden-tests grader semantics, flaky detection, and authoring task generation contract. |
| dokimi/docs/reference/cli-interface.json | Updates CLI surface snapshot to include repo tasks authoring args. |
| dokimi/docs/architecture.md | Documents new authoring task pipeline and hidden-test execution flow. |
| dokimi/changelog.d/20261106_120000_antonwolfy_authoring-tasks.md | Changelog entry for the new command and grader. |
Review effort: Lite
Settles the review point that dokimi:hidden_tests turned a JUnit report it could not stat or read (an OSError, such as a permission the subject's code left on hidden-tests.xml) into a grader error with pass: null. Contract section 4.5 says an unreadable report is a failed run with no test case. The grader now catches OSError around the stat and the read and returns pass false, n_tests 0, with details.report saying why. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
Settles the codecov report on the changed lines no test reached. Each gets a test of what the code does there: - repo tasks authoring skips a PR whose diff is empty, only guidance, a symbolic link, a path git gives that is not UTF-8, or a head with no shared history; a deleted file lands in reference_deleted and a quote of a removed line is dropped; a remote source fetches the PR's head. - the prompt drops a diff block and change links, and keeps other links and hex words that are no commit prefix. - dokimi:hidden_tests: a missing or non-object run record, a report over the size limit, duplicate or uncovered hidden paths, and the oracle on a bad task. - staging: a bad task, a workspace that is no directory, a directory at the hidden path (recorded, the tests not run, stale outputs cleared), and a manifest with no test entry point. - eval check: a second oracle run that cannot run reads "not graded". - review replay: a reviewed revision with no history of the base branch. - History.n_lines_changed of no path is 0, not the whole diff. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
1 open issue
3 resolved since last review
Review effort: Lite
Review point: _stage_hidden copied each hidden file with shutil.copyfile, which writes a new file with the default mode, so a hidden helper that authoring wrote 0o755 (a 100755 blob, as the contract's authoring section says it keeps the mode) reached the workspace as 0o664 and the test command could not run it as written. It now copies with shutil.copy, which also copies the mode bits, as the oracle's copytree of reference/ already does. The contract and the changelog fragment say the mode is kept, and a test stages a 0o755 and a 0o640 file over a 0o777 one and checks both modes. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
@exai-bot /review |
CLI interface change detectedThis PR changes dokimi's user-facing CLI surface (commands and/or options): + added command `dokimi repo tasks authoring`
+ argument `source`
+ option `--cache-dir`
+ option `--force`
+ option `--help/-h`
+ option `--manifest`
+ option `--manifest-file`
+ option `--max-lines`
+ option `--out`
+ option `--prompt-file`
+ option `--prs`Updated on every push; the |
|
Review rounds done at
Declined, with the reason in each thread:
No review of this head yet from Copilot. |
The host-side copy followed a link under hidden/, so any file the dokimi user can read reached the workspace, and a dangling one aborted eval check with no check.json. Such a file is now a grader error, a copy failure too, and repo validate reports a hidden file that is a link. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
…path The lookbehind refused a name after '/', so `tests/test_a.py` for the hidden pkg/tests/test_a.py kept its line, left test_lines low and could miss the more-than-5 skip. A file name after '/' now matches. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
A run that broke the test command (no report, a crashing conftest) graded pass_share null, so repo compare left it out of the mean while the untouched base counted 0; contract 4.2 says excluding such a run favours arms that break workspaces. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
The contract invites reusing the replay file; without body and createdAt it wrote title-only prompts with no public_at and said nothing about the description. A missing body is now a skip with the reason; an empty body is still a PR with no description. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
Main already has a 4.7 (graph tasks from a code index), so after the merge the --prs help and every 4.7 this PR adds would point at the graph section. The authoring section and its references become 4.8. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
…ards Each test fails when its guard alone is removed: a test file the PR deletes is not hidden, authoring writes a 100755 hidden file 0755, and a first oracle grade that cannot run is a broken task, not a crash. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
Keeps both built-in graders (graph and hidden_tests) in NAMES and _MODULES, the table rows of both, and the contract sections as 4.7 graph tasks then 4.8 authoring. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
A test that skips when the change is absent shows nothing, so pass needs every case passed and pass_share counts skips; a task whose oracle run skips a case is broken in eval check. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
|
Pushed to this branch, on top of d449291:
What was run on the merged head: the full suite (16719 passed, 32 skipped; |
xaleryb
left a comment
There was a problem hiding this comment.
Approved at 4353b20: CI green on the merge with main. Our points are fixed with tests: symlinked hidden files are refused, the prompt drops shorter-path test names, pass_share is 0 when no case ran, a PR without a body is skipped, and a skipped hidden case fails the grade so eval check marks an oracle that skips as broken.
napetrov
left a comment
There was a problem hiding this comment.
Three points about where this fits with #41. None of them is about the grader:
- Placement. #94 D11 (#94 (comment)) puts the repository task builders under
eval tasks generate --from replay|graph|history, and--from graphmerged in #399. Could this be--from prswith the same--outand--forceflags, rather than a newrepo tasks authoringleaf? - Section number. #399 took §4.7 ("Graph tasks from a code index"), so this section becomes §4.8 on rebase.
- Follow-up. I'll stack
--from historyon top ofChangeanddokimi:hidden_tests. It mines bug-fix commits and needs noghfile. In a free trial, 55 of 57 mined dokimi commits were valid fail-to-pass, and 7 of 15 on oneDAL. A direct commit has no PR, so couldChange.numberbeint | None, with the prompt's link-dropping keyed on the SHA when it isNone?
|
@napetrov on the three points:
|
Keeps main's repo tasks authoring (intel#425) and novelty and provider changes (intel#418, intel#428). The M3 moves stay: repo tasks replay is a tombstone for eval tasks generate --from replay, and repo tasks authoring is kept. cli-interface.json regenerated with scripts/cli_surface.py dump under the venv. Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>


Summary
Settles #294:
repo tasks replaybuildsdokimi:review_replaytasks, which measure guidance for reviewing, but most guidance is read while writing code, and authoring tasks were written by hand. This addsrepo tasks authoring, which builds one authoring task per merged pull request. It takes the same kind of input and leaves out the same files as review replay, and follows the decisions taken in the issue's comments (merged PRs only, one shared task writer,eval checkdecides, leaked-test lines dropped and counted, all-pass gate plus a passing share, flaky detection,public_at).On
maintoday no command writes such a task. The command needs a way to run the repository's tests on files held out of the workspace, which the manifest could not express until now. Built-in graders cannot start a process (spawns only indokimi.process), so the framework runs the test command itself, and a stdlib grader reads its report.Real output, on dokimi's own history. Five merged PRs, with titles and descriptions from their commit messages:
eval checkon each written task:OK,1/1 ok. Both runs of each step gave the same result:authoring_pr405pass: false(pass_share0.96)pass: trueauthoring_pr395pass: falsepass: trueauthoring_pr393pass: false(pass_share0.99)pass: trueHow these were run: the clone has no
refs/pull/*/head, so each PR's squash commit stood in for itsheadRefOid. A merge commit with that commit's tree and parents (^1, the commit) stood in for itsmergeCommit, sobasewas the commit before the merge.createdAtcame from the commit's author date. Docker was not available, so the self-check ran through the test suite'sFakeRunner, which runs each container's command on the host with the mounts mapped. The manifest gottest: "python3 -m pytest -q -p no:cacheprovider --junitxml={out} {tests}"through--manifest-file.Changes
repo tasks authoring <source> --prs FILE --out DIR [--manifest] [--manifest-file] [--max-lines N] [--prompt-file] [--force] [--cache-dir](commands/repo_run.py,cli_routes.py, CLI snapshot, flag allowlist rows for--prsand--max-lines).repos/replay/authoring.py) takes aChange(base, target, title, description, its source's fields), so a later failure-ledger source (Configuration Effectiveness (agents.md#213): receipt, reach matrix, rule ledger, arms #342) can use the same writer.authoring_prs.pymakes aChangefrom each merged PR.baseis the merge base ofheadRefOidwithmergeCommit^1.hidden/gets the test files the PR adds or changes.hidden_testsis the subset a runner collects by name.reference/andreference_deletedhold the rest of the diff (the oracle).oracle_linesis its size.eval_dirfiles are listed inleft_out_files.patch_filesandpublic_at(the PR'screatedAt) are set too, sorepo compareflags these tasks by the replay rule (feat(repo): repo compare flags replay tasks a guidance revision may have seen #392) with no change tocompare_leak.py.familyisfixwhen the title starts with fix, elsefeature.replay/build.pyintoreplay/merged.py. Replay's behaviour is unchanged.authoring_prompt.py): the title, then the description, then a fixed instruction that--prompt-filereplaces. Three things are dropped from the description and counted inprompt_dropped:test*function or class the PR adds). A PR with more than 5 such lines is skipped.--max-lines(default 400) lines there. A PR that fails it is listed with the reason (contract §4.7 has the table).entry_points.test, which must name{tests}and{out}(a JUnit XML report).{tests}is refused in other entry points. The key is required when a task usesdokimi:hidden_tests(manifest.py,repo_manifest.v1.jsonwidened in place).dokimi:hidden_tests(graders/hidden_tests.py, stdlib, Python 3.8):grading.run_entrycopies the hidden files into the workspace, with their file mode. A file or link there is replaced; a linked directory on the way is refused. It then runs the test command in a grading-like container and records its exit.passis true when the command exited 0 and every case ran and passed. Metrics:n_tests,n_passed,n_failed,n_errors,n_skipped,pass_share,tests_rc,tests_timed_out.OSError), or declares a DOCTYPE fails the run.reference/, reusingdokimi:typecheck's, and deletesreference_deletedthrough no link.eval checkruns null and oracle twice each fordokimi:hidden_teststasks. A task whose two runs of a step differ isflakyand exits 1. Other tasks run as before.Historygainsstatuses,n_lines_changed,blobandcommits.read_threads/load_pull_requeststake the key that marks a PR object.PullRequestgainsbodyandcreated.entry_points.test,{tests}), §4.3 (flaky), §4.5 (the grader), new §4.7 (every flag, field, skip reason and exit code), §9 (example);architecture.md.Risk
merged.py. The existing replay tests pass with their assertions unchanged; one gained a case.repo_manifest.v1gains an optionaltestkey underentry_points. A manifest valid before stays valid. The placeholder{tests}, which no manifest could use before, is now refused outsideentry_points.test.eval checkbehave as before. Onlydokimi:hidden_teststasks get the second runs and theflakyverdict.gradedoes. A run that rewrites its JUnit report is not detected (said in §4.5).graders_digest(), so a pinned batch whose eval dir uses a built-in grader refuses to resume on this version, as with any grader change.Testing
On a Linux review host, at
d449291(onmain25f776e):make ci-local: 30 passed, 0 failed, 7 skipped. The skipped steps: external-catalog-smoke (needs docker),test-latest,docs deployandpip-audit report(job conditions false on a PR), cli-surface packaging (an expression the local runner does not evaluate), conda-forge-deps (no micromamba), semgrep (offline). 16421 tests passed, 11 skipped. Changed-line coverage 100% (547 lines).tests/test_repo_authoring.py(53 tests, no network, fixture git repository built per test):eval check(FakeRunner) passes it: base fails, oracle passes, twice each,pass_share0.0 / 1.0;flaky,0/1 ok; a second oracle run that cannot run readsnot gradedand makes itflaky;mergeCommitor head, an empty diff, guidance only, a symbolic link, a path git gives that is not UTF-8, a head with no shared history;reference_deleted, and a quote of a removed line dropped;--max-linesat and over the limit;eval_dirare left out;public_atwith and without an offset;--force, rewritten with it;✗: missing file, empty file, wrong shape,"number": null;testentry point;testrules, andrepo validateon a missing hidden file.tests/test_repo_replay.py: a reviewed revision with no history of the base branch is skipped with the reason.eval checkrun dropped, the flaky comparison disabled, a non-zero test exit counted as a pass, skipped cases counted inpass_share, the DOCTYPE refusal removed,--max-lines>made>=, the fast-forward skip removed, leaked lines counted but kept. One mutant first survived (leaked lines kept in the prompt); the test was tightened and it fails now. Review round: 30 more, each failing: the grader before the unreadable-report fix, and 29 breaks of the code the new tests cover (each skip and refusal disabled, the report size limit>made>=, removed lines left out of the quote check, the remote fetch dropped, the ungraded second run's reading dropped). Second review round: 2 more, each failing the mode test: the staging before the mode fix (both files staged 0o664), and every staged file forced to 0o755.eval checkwith docker (docker could not be used on this host), so no real image was built or run. The self-check above used the FakeRunner. No realgh api graphqloutput either: the PR file was written by hand from the commits.Revert
Revert the commits. Nothing persisted depends on it except tasks it wrote (
authoring_pr<N>/directories) and a manifest that usesentry_points.test, which the reverted schema would refuse.Checklist
pytestpassesruff,mypy, and schema checks passAGENTS.md.github/.licenserc.yaml)Closes #294