Pin evidence JSON files to LF - #711
Merged
Merged
Conversation
Preserve byte-identical raw evidence hashes across Windows and POSIX checkouts by assigning LF normalization only to JSON evidence paths. Add an effective-attribute regression covering nested evidence, binary exclusions, and the known LF/CRLF trace digests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Performance Comparison
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new regression test relies on git and assumes deterministic check-attr behavior; it should skip cleanly when Git/.git is unavailable and guard against system attribute influence/malformed output.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Pins GGUF runtime evidence JSON under testdata/evidence/ to LF line endings via Git attributes, and adds a regression test to ensure both the effective attributes and the raw-hash evidence files remain stable across platform line-ending differences.
Changes:
- Add
.gitattributesrule to forcetestdata/evidence/**/*.jsontotext eol=lf. - Refactor evidence test path handling and add a new regression asserting effective Git attributes and LF-only payload bytes for hashed evidence traces.
File summaries
| File | Description |
|---|---|
src/mobius/integrations/gguf/_draft_runtime_evidence_test.py |
Adds Git-attribute regression and raw LF/CRLF digest assertions for evidence trace payloads. |
.gitattributes |
Pins all JSON under testdata/evidence/ to text eol=lf. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+57
to
+65
| def test_evidence_json_files_are_lf_normalized_for_raw_hashes(tmp_path: Path) -> None: | ||
| global_attributes = tmp_path / "global-attributes" | ||
| global_attributes.touch() | ||
| evidence_json = sorted(_EVIDENCE_DIR.rglob("*.json")) | ||
| future_binary = _EVIDENCE_DIR / "future-evidence.bin" | ||
| attributes = _effective_git_attributes( | ||
| [*evidence_json, future_binary], | ||
| global_attributes=global_attributes, | ||
| ) |
Comment on lines
+32
to
+54
| relative_paths = [path.relative_to(_REPO_ROOT).as_posix() for path in paths] | ||
| result = subprocess.run( | ||
| [ | ||
| "git", | ||
| "-c", | ||
| f"core.attributesFile={global_attributes}", | ||
| "check-attr", | ||
| "-z", | ||
| "text", | ||
| "eol", | ||
| "--", | ||
| *relative_paths, | ||
| ], | ||
| cwd=_REPO_ROOT, | ||
| check=True, | ||
| capture_output=True, | ||
| ) | ||
| fields = result.stdout.decode("utf-8").split("\0") | ||
| assert fields[-1] == "" | ||
| attributes: dict[str, dict[str, str]] = {} | ||
| for path, attribute, value in zip(fields[0::3], fields[1::3], fields[2::3]): | ||
| attributes.setdefault(path, {})[attribute] = value | ||
| return attributes |
Force new trace blobs so existing Windows worktrees refresh the evidence under the LF attribute contract. Preserve parsed JSON semantics, update exact byte hashes, and validate attributes in an isolated repository without global or system attribute influence. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
| env=environment, | ||
| ) | ||
| fields = result.stdout.decode("utf-8").split("\0") | ||
| assert fields.pop() == "" |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
testdata/evidence/, including nested paths, totext eol=lfValidation
lintrunner f --output oneline --all-filesgit diff --checkEvidence identities
bf42e00a181fa54a2fe6da19ae85c0c810b8c58f->b2966dd06ae6daa5f5b764ebd8d12b74f8824d691062e5ed665aeafbcf0d0fb250f9b48c520091ebc4b2ad6b19dbd341518c481f; simulated CRLF:e0e70e909f33ed44aa87da39bab721ebbee0c3e730e2f89dbc509c6683701e429498c417c8a22cf1a387b7dbd801a8701df0cfae->9e02745b6f3b087dbdce4d5fc9d7ff224af0ba6b9d6c6fdb630bc0a040eacc2a2357a2991609ea0d904ff16574a9b55f7d010d55; simulated CRLF:78aa94f24d5f1b9ae020de1ffa5a70c6a30f30ff45eb5310a540cdd2b3d8fab2Follow-up
PR #698 must rebase this fix from
mainbefore its Windows jobs can pass.