Repository navigation
feat(datasets): record how a dataset was generated and show it on reports #405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rng1995
merged 6 commits into
feat/christopherk/guided-dataset-grounding
from
feat/christopherk/dataset-generation-provenance
Nov 10, 2026
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d39ff06
feat(datasets): record how a dataset was generated and show it on rep…
chrisknvidia 483b350
merge: incorporate dataset grounding CI fixes
chrisknvidia b156fa1
fix(reports): harden dataset generation provenance
chrisknvidia 6661944
merge: incorporate latest origin/main into dataset provenance
chrisknvidia 651ab24
merge: update dataset provenance with grounding base
chrisknvidia 7eb44c7
Merge guided dataset grounding into dataset provenance
chrisknvidia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from collections.abc import Mapping | ||
| from typing import Any | ||
|
|
||
| _GENERATION_MODES = frozenset({"llm", "template", "template_requested", "template_fallback"}) | ||
| _GROUNDING_MODES = frozenset({"skill", "intent", "trace"}) | ||
| _TEMPLATE_WARNING = "cases are generic starters; review before relying on scores" | ||
|
|
||
|
|
||
| def sanitize_generation_record(value: object) -> dict[str, Any] | None: | ||
| if not isinstance(value, Mapping): | ||
| return None | ||
| mode = value.get("mode") | ||
| if not isinstance(mode, str) or mode not in _GENERATION_MODES: | ||
| return None | ||
|
|
||
| record: dict[str, Any] = {"mode": mode} | ||
| grounding = value.get("grounding") | ||
| if isinstance(grounding, str) and grounding in _GROUNDING_MODES: | ||
| record["grounding"] = grounding | ||
| generated_at = value.get("generated_at") | ||
| if isinstance(generated_at, str): | ||
| record["generated_at"] = generated_at | ||
| review_state = value.get("review_state") | ||
| if isinstance(review_state, str) and review_state in {"needs_review", "unreviewed", "reviewed"}: | ||
| record["review_state"] = review_state | ||
| if value.get("refined") is True: | ||
| record["refined"] = True | ||
|
|
||
| fallback_reason = value.get("fallback_reason") | ||
| if isinstance(fallback_reason, str): | ||
| from skillevaluator.evaluation.tier3_findings import sanitize_grader_text | ||
| from skillevaluator.utils.rich_markup import strip_terminal_controls | ||
|
|
||
| safe_reason = " ".join(strip_terminal_controls(sanitize_grader_text(fallback_reason, max_len=256)).split()) | ||
| if safe_reason: | ||
| record["fallback_reason"] = safe_reason | ||
|
|
||
| raw_count = value.get("needs_review_count") | ||
| if isinstance(raw_count, int) and not isinstance(raw_count, bool) and 0 <= raw_count <= 1_000_000_000: | ||
| record["needs_review_count"] = raw_count | ||
|
|
||
| raw_inputs = value.get("inputs") | ||
| if isinstance(raw_inputs, list): | ||
| inputs = [] | ||
| for item in raw_inputs[:32]: | ||
| if not isinstance(item, Mapping): | ||
| continue | ||
| entry: dict[str, str] = {} | ||
| for key in ("kind", "path"): | ||
| field = item.get(key) | ||
| if isinstance(field, str): | ||
| entry[key] = field | ||
| digest = item.get("sha256") | ||
| if isinstance(digest, str): | ||
| entry["sha256"] = digest[:12] | ||
| inputs.append(entry) | ||
| record["inputs"] = inputs | ||
| return record | ||
|
|
||
|
|
||
| def dataset_provenance_display(value: object) -> tuple[str | None, bool]: | ||
| record = sanitize_generation_record(value) | ||
| if record is None: | ||
| return None, False | ||
|
|
||
| mode = record["mode"] | ||
| if mode == "llm": | ||
| grounding = record.get("grounding") | ||
| if grounding not in _GROUNDING_MODES: | ||
| return None, False | ||
| review_state = record.get("review_state", "unknown") | ||
| line = f"Dataset: generated by {grounding} grounding, review state {review_state}" | ||
| is_template = False | ||
| elif mode == "template": | ||
| line = f"Dataset: generated from templates — {_TEMPLATE_WARNING}" | ||
| is_template = True | ||
| else: | ||
| requested_or_fallback = ( | ||
| "requested" | ||
| if mode == "template_requested" | ||
| else f"fallback: {record.get('fallback_reason') or 'LLM generation was unavailable'}" | ||
| ) | ||
| line = f"Dataset: generated from templates ({requested_or_fallback}) — {_TEMPLATE_WARNING}" | ||
| is_template = True | ||
|
|
||
| needs_review = record.get("needs_review_count", 0) | ||
| if needs_review > 0: | ||
| line += f"; {needs_review} cases need review" | ||
| return line, is_template |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.