Repository navigation
feat(artifacts): the run envelope names the dokimi commit that wrote it - #1541
Conversation
…it (intel#1531) A report from a main install said `dokimi_version: 0.2.0`, as one from the v0.2.0 release does, and named no commit, so a reader could not tell which dokimi wrote it. The envelope now carries `dokimi_commit` after `dokimi_version`: the `vcs_info.commit_id` of the installed distribution's PEP 610 `direct_url.json` when it is 40 hex digits, else the HEAD of the git checkout a source tree runs from, else `null`. It is resolved once per process in the new foundation module `dokimi.dokimi_commit`, which also holds the checkout lookup `novelty` provenance's `git_commit()` now calls, so `artifacts` can use it without importing a higher layer. A missing or unusable record is `None`, never an error, and no git process runs when the install record names a commit. Every run-kind schema declares the key as an optional `string | null`, so an artifact written before still validates. `plan_digest` leaves it out with the rest of the envelope, as `headroom` and `novelty view` already do through `ENVELOPE_KEYS`, and `datasets export` rows gain the column. A `--json` document carries it as `summary.dokimi_commit`, and `report summary` shows its first 12 digits above the table and leaves it out of the scalar comparison of two summaries. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
OpenCodeReview: Commit 8a62581 was not reviewed. This PR has reached its review limit (6 reviews). CI at `8a62581`: 6 still running, 20 passing, 3 skipped
To review this commit: re-request review from exai-bot in the Reviewers list. Last review (0ca2406): no findingsOpen threads from the bot: 0 |
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
2 open issues
What changed in this PR
Adds dokimi_commit to run artifacts and CLI JSON output so reports can identify the exact dokimi commit that wrote them (especially for main installs where dokimi_version may match released versions), closing #1531.
Changes:
- Introduces a commit resolver (
dokimi_commit()) that prefers PEP 610direct_url.jsoncommit IDs, otherwise falls back to the source checkout HEAD. - Extends the artifact run envelope and many run-kind schemas to include optional
dokimi_commit(string | null). - Propagates
dokimi_commitinto--jsondocuments andreport summaryoutput; updates tests/docs accordingly.
| File | Description |
|---|---|
| dokimi/dokimi/artifacts.py | Adds dokimi_commit to run envelope keys and writes it for run-kind artifacts. |
| dokimi/dokimi/cli_output.py | Adds summary.dokimi_commit to CLI JSON envelope summary. |
| dokimi/dokimi/dokimi_commit.py | New resolver for dokimi commit via PEP 610 or checkout HEAD. |
| dokimi/dokimi/novelty/provenance.py | Reuses shared source-root/checkout commit lookup for git_commit(). |
| dokimi/dokimi/report/summary.py | Captures per-document commit and renders commit prefixes in markdown summary. |
| dokimi/dokimi/runner/plan.py | Ensures plan_digest ignores dokimi_commit like other envelope fields. |
| dokimi/dokimi/datasets_export.py | Adds dokimi_commit column to exported dataset rows. |
| dokimi/dokimi/commands/headroom.py | Documents that headroom digest excludes the envelope including dokimi_commit. |
| dokimi/dokimi/schemas/cli_output.v1.json | Allows and documents summary.dokimi_commit. |
| dokimi/dokimi/schemas/report_summary.v1.json | Adds optional per-check dokimi_commit field (when present). |
| dokimi/dokimi/schemas/arms.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/answers.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/catalog_eval.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/checklist.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/cross_judge.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/dashboard.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/delivery.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/docling_sources.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/docs_run.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/effective_instructions.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/eval.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/eval_coverage.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/explore_runs.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/grounding.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/guidance_reach.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/headroom.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/judge_validity.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/judge_wording.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/leak.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/matrix_rollup.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/novelty.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/novelty_atoms.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/novelty_retest.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/opportunities.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/pairwise.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/persona_analysis.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/personas.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/plan.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/plugin_delta.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/question_panel.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/question_quality.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/ragas.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/reach_matrix.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/redteam.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/repo_budget.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/repo_environment.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/repo_hits_judged.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/repo_readiness.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/report_qa.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/result.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/run.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/run_context.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/security_report.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/skill_coverage.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/skill_discovery.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/skill_evidence.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/subject_scorecard.v2.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/task_inspect.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/task_runs.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/dokimi/schemas/tool_preference.v1.json | Adds optional envelope key dokimi_commit with strict pattern. |
| dokimi/tests/test_dokimi_commit.py | New tests for commit resolution, repo scan output, and report summary rendering. |
| dokimi/tests/test_eval_writers_save_artifact.py | Updates envelope key order assertions to include dokimi_commit. |
| dokimi/tests/test_import_architecture.py | Registers new foundation-layer module dokimi.dokimi_commit. |
| dokimi/tests/test_novelty_provenance.py | Ensures git_commit() still returns checkout HEAD after refactor. |
| dokimi/tests/test_run_envelope.py | Adds envelope commit tests, schema validation checks, and digest invariants. |
| dokimi/tests/test_runs_rundir.py | Updates run.json expectations to include dokimi_commit. |
| dokimi/tests/test_writers_save_artifact.py | Updates envelope key order assertions to include dokimi_commit. |
| dokimi/tests/test_writers_save_artifact_rest.py | Updates envelope key order assertions to include dokimi_commit. |
| dokimi/docs/benchmarking-and-comparison.md | Documents dokimi_commit semantics and its inclusion/exclusion rules. |
| dokimi/docs/run-directories.md | Documents run.json envelope now includes dokimi_commit. |
| dokimi/docs/skill-novelty.md | Updates analysis_digest description to exclude dokimi_commit. |
| dokimi/changelog.d/20261202_120000_dokimi-commit-in-envelope.md | Changelog entry for new envelope field and propagation points. |
Review effort: Lite
… only the install that runs Settles two review points on intel#1541. A checkout made with `git init --object-format=sha256` has a 64-digit HEAD, which the run-kind and CLI schemas refuse, so `save_artifact` failed on it. The envelope now takes the checkout HEAD only when it is 40 digits; novelty provenance still records the raw HEAD. The PEP 610 record of the installed distribution described the installed package even when a checkout was run in an environment that has another dokimi installed. `install_commit` now reads the record only when the distribution's `dokimi` package is the directory this module was imported from; otherwise the checkout's HEAD is used. 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 #1541 +/- ##
==========================================
- Coverage 96.50% 96.49% -0.01%
==========================================
Files 539 540 +1
Lines 72177 72237 +60
Branches 12445 12451 +6
==========================================
+ Hits 69655 69706 +51
- Misses 1545 1550 +5
- Partials 977 981 +4
🚀 New features to boost your workflow:
|
…raising, and not overridable by a summary Settles the three review threads on intel#1541. A CLI summary can no longer replace dokimi_version or dokimi_commit: envelope() puts them first and drops those two keys from the caller's summary. install_commit() accepts a commit_id only when vcs_info.vcs is "git". The direct_url.json read moves into the guarded block, so a file that is not UTF-8 (UnicodeDecodeError is a ValueError) gives None instead of an exception that stops artifact writing and CLI JSON output. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
main added the agent_run kind after this PR's last head, and its schema declares run_id and dokimi_version but not dokimi_commit, so test_every_run_kind_schema_declares_the_same_envelope[agent_run] failed on the merged tree. The schema now declares the key as every other run kind does. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
napetrov
left a comment
There was a problem hiding this comment.
Change class: ARCHITECTURAL (head efb4625)
- Contract: changed. errors dokimi/dokimi/dokimi_commit.py:79; api dokimi/dokimi/artifacts.py:envelope
- Responsibility: changed. delegate _source_root in dokimi/dokimi/novelty/provenance.py; delegate git_commit in dokimi/dokimi/novelty/provenance.py
- Dependency: none
- Review depth: design read: new dependency/responsibility, ask for rationale
- Coverage gaps: none
1 new must-fix finding. Provenance is carried through the artifact and CLI envelopes. A source archive under a caller Git tree can be stamped with the caller’s commit.
| # | Finding | Severity | Provenance | Evidence |
|---|---|---|---|---|
| 1 | A source archive can stamp the caller’s commit | must-fix | introduced | Reproduced on the head. Compared with the merge base. |
Checked the diff, input edges, and focused offline Linux tests (merged: 512 passed in 19.76s).
…ckout tracks dokimi's pyproject.toml A source archive has no .git, and extracted under another repository it read that repository's HEAD as the commit of dokimi. checkout_commit now requires the checkout to track the pyproject.toml of the dokimi root (git ls-files --error-unmatch) and gives None otherwise; this settles review comment 4776274892 and also corrects novelty's git_commit. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
@napetrov (#1541 (review)): The review body only recaps its single finding, which is the thread 4776274892 above (fixed in 712627c). |
Mutation of changed linesAt 8a62581: 25 caught · 0 missed · 8 inconclusive · 1 timed out · 46 not tried in time This is not a clean result:
Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary. |
napetrov
left a comment
There was a problem hiding this comment.
Change class: ARCHITECTURAL (head 712627c)
- Contract: changed. errors dokimi/dokimi/dokimi_commit.py:83; api dokimi/dokimi/artifacts.py:envelope
- Responsibility: changed. delegate _source_root in dokimi/dokimi/novelty/provenance.py; delegate git_commit in dokimi/dokimi/novelty/provenance.py
- Dependency: none
- Review depth: design read: new dependency/responsibility, ask for rationale
- Coverage gaps: none
0 new must-fix findings. Nothing to fix in this round. The archive probe now returns a null Dokimi commit inside an unrelated checkout. The original finding is fixed.
Checked the diff, input edges, and focused offline Linux tests (merged: 514 passed in 19.94s). The original archive probe uses a real local Git checkout.
- Fixed in
712627c7. The nested source archive now has no commit. Earlier thread
napetrov
left a comment
There was a problem hiding this comment.
Change class: ARCHITECTURAL (head 712627c)
- Contract: changed. errors dokimi/dokimi/dokimi_commit.py:83; api dokimi/dokimi/artifacts.py:envelope
- Responsibility: changed. delegate _source_root in dokimi/dokimi/novelty/provenance.py; delegate git_commit in dokimi/dokimi/novelty/provenance.py
- Dependency: none
- Review depth: design read: new dependency/responsibility, ask for rationale
- Coverage gaps: none
Verified the archive provenance fix and ran 567 focused tests against current main. Required checks and the Linux Python 3.14 source and wheel suites passed. The separate source-checkout CI job was interrupted by runner shutdown.
Conflict in dokimi/dokimi/novelty/provenance.py: main added a `tomllib` import and its own `git_commit` body (an unpinned git env, `process.git_env_unpinned()`), while this branch moved `_source_root` and the checkout lookup into `dokimi_commit.py`. Resolved by keeping the branch's delegation (`source_root`, `checkout_commit`) and dropping the `tomllib` import it no longer needs; the next commit makes `checkout_commit` use main's `git_env_unpinned()`. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…git_env_unpinned Main now has `process.git_env_unpinned()`, the git environment without GIT_DIR and the other repository overrides, which is what `checkout_commit` built by hand. Use it and drop the duplicate (merge-main point of the review of intel#1541); the behaviour is unchanged. `test_git_commit_ignores_an_inherited_git_dir` only asserted that the result differed from the foreign HEAD, which a `None` also satisfies once the checkout must own pyproject.toml. It now runs from a real project checkout and asserts that the project's own HEAD is found with a foreign GIT_DIR set. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
@napetrov (#1541 (review)): No change asked. Re-checked at the merged head: the nested source archive still gives |
@napetrov (#1541 (review)): No change asked. The interrupted source-checkout job is the runner's shutdown (see the |
…t._installed_here Settles the codecov concern: lines 103 and 104 of dokimi_commit.py (the OSError branch of `_installed_here`) ran in no test. The new test makes `locate_file` raise and checks that the install record is not trusted and the checkout's HEAD answers. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
Review points answered at No review of this head yet from exai-bot. |
Main's intel#1541 added dokimi_commit to the run envelope that save_artifact writes, so the saved answers file had a key the in-memory adapter output has not. The test now strips artifacts.ENVELOPE_KEYS instead of naming run_id and dokimi_version. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…ner (#1542) * fix(gate,eval): a judged retrieval miss counts as a miss A question whose context arm got no document is unusable in the trust gate's zero-score fraction and an empty retrieval in the diagnosis only while it is left unjudged. Judged (`eval score --judge-placeholder`, an arms run read through the arms adapter, and `evaluate`/`benchmark` once they answer through ArmRunner, #228 step 4c), its context score is the plain prompt's: a 60 passed the zero check, and a delta of 0 or more was diagnosed `docs_helped`. Count every miss (`retrieval_hit: false`) as unusable in the zero-score fraction, scored or not, and diagnose a judged miss `empty_retrieval` whatever its delta. The thresholds are unchanged. Refs #228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * fix(pipeline): evaluate and benchmark answer and judge through ArmRunner #228 step 4c. `evaluate` and `benchmark run|batch` answered with the Answerer and judged with `Judge.evaluate_answers` (Stack P), and gave other numbers than `arms run` on the same questions. The pipeline now answers each question in a baseline arm and a docs arm through ArmRunner, judges them with the same runner, and writes `answers.v1` and `eval.v1` through the arms adapter (#1148), so their readers stay as they are (`orchestrator/arm_answering.py`). This changes numbers (parity rows D2, D4 prompts, D5 and D9's pairs now shared): ArmRunner's prompts; a question with no document gets a judged plain-prompt answer instead of the unjudged placeholder; the judge sees each arm's whole material. Both files carry method version 4; `answers generate` and `eval score` stay on version 3 until step 6. - The questions answered so far are kept in `<answers stem>.partial.json` (#1004) until the answers file is saved; a crash names the file. - A run-wide stop saves the answers with their `terminated` block and judges nothing, as before. - `--judge-placeholder` on `evaluate`/`benchmark run` has no effect and warns; `--debug-retrieval` copies the docs arm's retrieval counts into `retrieval_metadata`. Test-narrowed: the pipeline no longer reads an answers file back to judge it (the runner that answered judges), so the tests of the stamp it read from one (wrapped, unstamped, malformed, a stale file) have no code left; the pipeline's own stamp is tested in test_the_pipeline_stamps_its_answers_and_eval_with_the_current_version, eval score keeps its stamp tests. Test-narrowed: evaluate writes no placeholder any more, so the tests that it judges one with --judge-placeholder and leaves it unjudged without are replaced by test_evaluate_judges_a_retrieval_miss_with_or_without_the_flag and test_judge_placeholder_flag_has_no_effect_on_the_pipeline_and_says_so. Refs #228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * fix(pipeline): a failed checkpoint save fails its run, not a batch The pipeline's checkpoint was `arms run`'s `_Partial`, whose failed save exits 2. ArmRunner re-raises it, and `benchmark batch` records a failed library only on an Exception: one library whose partial file could not be written ended the whole batch, without its summary. `pipeline_checkpoint` makes the same file with a save that raises an OSError naming it, so `evaluate` fails as it did on an unwritable answers file (exit 1), and `benchmark batch` fails that library and goes on. Refs #228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * fix(pipeline): a failed answers save names the partial file too The note that names `<answers stem>.partial.json` was printed only when answering failed. A failure after every answer was paid for, in the adapter or in writing the answers file, left the partial file unnamed, where `arms run` names it on the same failure. The note now covers everything up to the saved answers file. Refs #228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * fix(eval): eval score warns that a v4 answers file meets the v3 judge `eval score pointwise` stamps the eval with the answers file's method version. On a file `evaluate`/`benchmark` wrote (version 4, judged there through ArmRunner with each arm's whole material), its judge is still `Judge.evaluate_answers` (200-character doc snippets, #228 D5), so two evals of the same answers say 4 with different judge inputs. The stamp stays the answers' own, which is what it records; the command now warns that its scores are not comparable with the run's own eval. Step 6 moves this judge onto the shared stack. Refs #228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * fix(eval): the diagnosis reads a miss as the trust gate does The diagnosis had its own test for a retrieval miss, twice: a doc source of `fallback_none`, `none` or none at all, or no docs. The trust gate reads `retrieval_hit` (`records._retrieval_hit`): a `fallback_none` or `none` doc source, or no `retrieved_docs`. A docs answer with no `doc_source` key was a hit for the gate and a miss for the diagnosis, so a delta of +10 was `empty_retrieval` and a delta of -3 too. One `_missed`, the gate's test, now decides both branches: that answer is `docs_helped` or classified by its relevance. Refs #228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * fix(pipeline): the judge step prints its progress again `Judge.evaluate_answers` printed the judge, a line per question and the averages. Through ArmRunner the step printed "Judging answers..." and then nothing: a long judge step was silent, and a judge failure showed only in the log. The pipeline hands ArmRunner the judge behind a wrapper that prints `[i/n] <question id> ✓ <score>` per judged answer, or ✗ and the reason, after the `Evaluating N answers with judge: P/M` line; the averages over the pairs close the step, as before. ArmRunner (arms run) is unchanged. Refs #228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * fix(gate): a miss with only one arm scored counts in the zero check ArmRunner judges the two arms apart, so a retrieval miss can keep its context score while its baseline judge call fails. Such a row was in neither the both-arms rows nor the unjudged misses, and the zero-score check left it out: 10 scored hits and 3 such misses read 0/10, not 3/13. Count a recorded miss outside the both-arms rows when either arm has a score or the row has an error. Refs #228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * fix(eval): the pipeline's eval names its judge protocol evaluate and benchmark now judge through ArmRunner, which stamps the arms run with judge_context, but the arms adapter dropped it from the eval.v1 file. An eval score re-judgement of the same answers (the v3 judge, 200-char snippets) then carried the same method_version 4 and no protocol either, and model_compare pooled the two. Carry judge_context into the adapted eval and declare it in eval.v1: the pipeline's eval says treatment_material.v1, the re-judgement stays unstamped, and model_compare's judge-protocol check refuses the pair. Refs #228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * test(gate): pin a miss whose baseline answer failed in the zero check A miss whose baseline answer failed keeps its context score and has no error in the eval row (the answers file records it), so only the context-score clause of _unpaired_miss counts it. The test now covers that shape beside the failed baseline judge call. Refs #228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * fix(pipeline): judge progress names the question the runner judged The progress lines of the judge step looked the question id up by its text, so two questions with the same text both printed the last one's id. ArmRunner.judge now takes an on_score callback that gets the record's question id, the arm and the score after each judge call, and the pipeline prints its progress from there instead of wrapping the judge. Refs #228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * test(pipeline): the adapter parity test skips the whole run envelope Main's #1541 added dokimi_commit to the run envelope that save_artifact writes, so the saved answers file had a key the in-memory adapter output has not. The test now strips artifacts.ENVELOPE_KEYS instead of naming run_id and dokimi_version. Refs #228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * fix(pipeline): evaluate and benchmark keep their ask questions The arms adapter left ask questions out of the answers and eval payloads, which #1406 meant for a run whose arms file keeps them. The pipeline saves no arms file, and it drops its checkpoint once the answers file is saved, so an ask question's replies and ask-rubric grades were paid for and lost. Before #228 step 4c the answerer and the judge kept these rows, stamped expected_outcome: ask, and the readers leave them out of the headline. The adapter keeps them so, and the judge step prints how many it left out of its averages, as Judge.evaluate_answers did. Refs #228 Test-narrowed: to_binary keeps ask rows now, so test_to_binary_leaves_ask_questions_out_of_both_payloads is replaced by test_to_binary_keeps_ask_questions_stamped_in_both_payloads and the pipeline test test_an_ask_question_keeps_its_rows_and_stays_out_of_the_averages. Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> --------- Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

Summary
A report from a
maininstall saysdokimi_version: 0.2.0, as one from the v0.2.0 release does, and names no commit, so the artifact does not say which dokimi wrote it or whether two reports are comparable. Onmainat00a761c,dokimi repo scan <tree> --out repo-readiness.json --jsonwrites{"schema_version": "repo_readiness.v1", "run_id": ..., "dokimi_version": "0.2.0", ...}and acli_output.v1document whosesummaryholds onlydokimi_version;git_commit()does not cover it, as it returnsNonefor an installed package.The envelope of every run artifact now carries
dokimi_commitafterdokimi_version: thevcs_info.commit_idof the installed distribution's PEP 610direct_url.jsonwhen itsvcsisgit, it is 40 hex digits and that install is the package that runs (a checkout run in an environment with another dokimi installed does not take the installed one's commit), else the HEAD of the git checkout a source tree runs from when that checkout tracks the tree'spyproject.toml(a source archive extracted under another repository givesnull) and the HEAD is 40 digits (a--object-format=sha256checkout givesnull;noveltyprovenance still records any HEAD), elsenull(an install from an index). A--jsondocument carries it assummary.dokimi_commitandreport summaryshows its first 12 digits, so the job summary ofrepo-eval.ymlnames it too. The issue's other options (a dev version onmain, a VCS-derived version, a line in the workflow) are not taken: the first two change the version every consumer compares or the build backend, the third covers one workflow only.Closes #1531
Changes
dokimi/dokimi_commit.py(new, foundation layer):dokimi_commit()(cached for the process),install_commit()(the PEP 610 record; no file,read_textreturningNone, bad JSON, a file that is not UTF-8, adir_inforecord, avcsother thangit, novcs_info, a non-string or non-40-hexcommit_idandPackageNotFoundErrorare allNone, nothing logged above debug),checkout_commit()(the raw HEAD, found withprocess.git_env_unpinned(); the envelope takes it through_own_checkout_commit(), which keeps only 40 digits) andsource_root();install_commit()also givesNonewhen the distribution'sdokimidirectory is not the one this module was imported from. No subprocess runs when the install record names a commit.novelty/provenance.py:git_commit()keeps its behaviour and output; its checkout lookup moved intocheckout_commit()so thatartifactscan use it without importing a higher layer (noveltyis aboveartifacts).artifacts.py:ENVELOPE_KEYSgainsdokimi_commit;envelope()returns{"run_id", "dokimi_version", "dokimi_commit"}for a run kind, typeddict[str, str | None]. Readers ofENVELOPE_KEYSkeep it out of what they hash or compare:headroomandnovelty_atomsalready do through the constant;runner/plan.py's_UNHASHEDnames it, so a plan'splan_digestdoes not change with the commit.agent_runincluded, whichmainadded after the first head) declaredokimi_commitas an optionalstring | null(40 lower-case hex digits; the pattern ends with(?![\s\S])asrun_id's does). Edited in place: this only widens them, so no schema version changes. The nesteddokimi_versionofcatalog_evalanddocs_runis not an envelope and is untouched.cli_output.v1declaressummary.dokimi_commitandreport_summary.v1an optionaldokimi_commitper check row.cli_output.py: thesummaryof every--jsondocument carriesdokimi_commit; asummaryargument namingdokimi_versionordokimi_commitdoes not replace them.report/summary.py: a row carriesdokimi_commitwhen its document names one; the Markdown showswritten by dokimi commitwith the first 12 digits above the table, and nothing when no document names one.dokimi_commitis left out of the scalar comparison of two summaries, asdokimi_versionis.datasets_export.py: exported rows gain adokimi_commitcolumn (test_datasets_exportrequires everyENVELOPE_KEYSentry in a row).benchmarking-and-comparison.md(the envelope),run-directories.md,skill-novelty.md(analysis_digestleaves it out), theartifacts.pydocstrings. Changelog fragment (Added).test_dokimi_commit.py(the resolver withimportlib.metadata.distributionpatched,repo scanwriting both files,report summary);test_run_envelope.py(key order, null and known commit, schema refusals, the plan digest);test_novelty_provenance.py(git_commit()still gives the checkout's HEAD). Existing tests that pinned the envelope's first three keys now pin the first four:test_run_envelope.py(two),test_writers_save_artifact.py,test_writers_save_artifact_rest.py,test_eval_writers_save_artifact.py,test_runs_rundir.py(also its exactrun.jsonrecord);test_import_architecture.pylists the new module in the foundation layer.Risk
Every run artifact and every
--jsondocument gains adokimi_commitkey (nullfor an install from an index). A reader that checks an exact key list of an artifact sees one more key; one that follows the schemas is unaffected, as the key is never required and files written before still validate. Writers now rungit rev-parse HEADonce per process in a source checkout (the same callnoveltyprovenance makes); an install from a VCS URL or an index runs no subprocess.datasets exportrows gain a column.Five writers that stamp their own
dokimi_versionoutside the envelope (catalog scanrows, the run manifest, scorecards, thecheckerblock, sweep rows) still record no commit, and two of them comparedokimi_versionto decide a--resume: left to #1540, since recording the commit there changes resume behaviour.Merging with open PRs: #1416 and #1190 change the
dokimi.utilsimport lines ofcli_output.pyandartifacts.pyand conflict with this branch incli_output.py; #1249 conflicts withmainalone intest_import_architecture.pyand is its own to rebase. #1527, #1522, #1521, #1515, #1413 and #1406 merge cleanly with this branch.Testing
On a Linux review host, at
8a62581(onmainbadfd39):make ci-local: 38 passed, 0 failed, 16 skipped (docker, micromamba, semgrep, jobs conditional on the PR event or other Python versions). The pytest step: 34510 passed, 28 skipped.dokimi_commit.py103-104, theOSErrorbranch of_installed_here) are covered bytest_an_install_whose_package_directory_cannot_be_located_is_not_the_running_ones, whose distribution'slocate_fileraises; with that handler changed to another exception type in a copy it fails (PermissionError).mainmerged in (one conflict,novelty/provenance.py:main'sgit_commitbody andtomllibimport against the move intodokimi_commit.py; the delegation is kept).checkout_commitnow builds its git environment withmain'sprocess.git_env_unpinned()instead of its own copy.test_git_commit_ignores_an_inherited_git_dirnow runs from a project checkout and asserts that the project's HEAD is found with a foreignGIT_DIRset (it passed before withNoneas well); withprocess.GIT_ENVin a copy it fails.dokimi_commitnull:checkout_commitrequires the checkout to track thepyproject.tomlof dokimi's root.test_a_source_archive_under_another_repository_names_no_commitfails with that check removed in a copy.mainbrought theagent_runkind, whose schema did not declaredokimi_commit:test_every_run_kind_schema_declares_the_same_envelope[agent_run]failed on the merged tree and passes withf3f30f2; with the oldagent_run.v1.jsonrestored in a copy it fails again.main's code (with the new module added so that they import):test_dokimi_commit.py2 failed, 18 passed (KeyError: 'dokimi_commit');test_run_envelope.py58 failed, 95 passed;test_runs_rundir.py1 failed, 66 passed;test_writers_save_artifact.py13 failed, 6 passed;test_writers_save_artifact_rest.py3 failed, 17 passed;test_eval_writers_save_artifact.py6 failed, 5 passed (each on the envelope's key list).null,plan_digesthashing the commit,report summarycomparing it, showing 13 digits, omitting it or always printing the line, the--jsonsummary without it, thearmsschema accepting a newline or refusingnull,datasets exportwithout the column,ENVELOPE_KEYSwithout it, and three ongit_commit()(returnsNone, source root one level off orNone).test_a_sha256_checkout_names_no_commit_but_novelty_still_reads_its_hash, on a realgit init --object-format=sha256repository), and the installed record read without comparing the package directory (test_an_install_of_another_dokimi_is_not_the_running_ones_commit).vcs_infowithvcshg,svnor none still accepted (test_a_record_of_another_vcs_names_no_commit),direct_url.jsonread outside the guard (test_a_record_that_is_not_utf8_gives_none_and_never_raises, whose distribution raisesUnicodeDecodeError), and a caller'ssummarymerged over the two keys (test_a_summary_cannot_override_which_dokimi_wrote_the_document).dokimi repo scan <tree> --out r.json --jsonon a source checkout writesdokimi_commitinr.json, indataand insummary(the checkout's HEAD).pip installfrom a VCS URL (the PEP 610 record is mocked), the Windows and docker legs.Open questions
None.
Revert
A plain revert removes the key from new artifacts and the module. Artifacts already written keep
dokimi_commit; the reverted schemas (additionalProperties: false) would refuse those files, so readers of such files should keep the schema change.Checklist
pytestpassesruff,mypy, and schema checks passAGENTS.md(the author's own diff read and the mutation job run; the REVIEW.md pass is left to the reviewer)raise/exit and test names the doc, contract or issue it traces to.github/.licenserc.yaml)