Skip to content

fix(git): warn on undecodable path bytes - #39

Merged
nia-sg-bot merged 1 commit into
mainfrom
nia/issue-21-undecodable-paths
Aug 29, 2026
Merged

fix(git): warn on undecodable path bytes#39
nia-sg-bot merged 1 commit into
mainfrom
nia/issue-21-undecodable-paths

Conversation

@nia-sg-bot

@nia-sg-bot nia-sg-bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • reject non-UTF-8 Git path bytes before they can leak surrogate escapes into JSON artifacts
  • preserve subsequent valid snapshot records and expose an actionable undecodable_path warning
  • register the warning in the structural schema and cover resolver/schema behavior

Part of #21

Validation

  • python3 -m pytest -q (139 passed)
  • git diff --check

Remaining for #21

  • complete the broader comparison-mode and edge-case fixture coverage described in the parent issue.

Summary by CodeRabbit

  • Bug Fixes

    • Git snapshots now handle filenames that cannot be decoded as UTF-8 without stopping the entire scan.
    • Invalid paths are skipped individually, while valid files continue to appear normally.
    • Added clear undecodable_path warnings without exposing escaped or malformed filenames.
  • Schema

    • Added support for machine-readable undecodable_path warnings in artifact metadata.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8f0a488c-7deb-4e39-96a0-dbf94d9f5ba1

📥 Commits

Reviewing files that changed from the base of the PR and between 5e7a307 and d71cf3c.

📒 Files selected for processing (5)
  • diffgraph/git_snapshot.py
  • diffgraph/schema/diffgraph-v2.schema.json
  • diffgraph/structural.py
  • tests/test_git_snapshot.py
  • tests/test_structural.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

Git path parsing now uses strict UTF-8 decoding. Invalid paths produce undecodable_path warnings and are skipped without stopping parsing. The warning is included in the JSON schema and preserved in structural artifact output.

Changes

Undecodable Git path handling

Layer / File(s) Summary
Git path decoding and scoped skipping
diffgraph/git_snapshot.py, tests/test_git_snapshot.py
Raw diff and untracked paths use strict UTF-8 decoding. Invalid paths produce escaped undecodable_path warnings and are skipped individually. Tests verify that valid files remain in the result.
Warning propagation and validation
diffgraph/structural.py, diffgraph/schema/diffgraph-v2.schema.json, tests/test_structural.py
Structural output preserves undecodable_path warnings. The schema accepts the new code. Tests verify schema-valid output without a file field when none is provided.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to d71cf

The change rejects undecodable Git paths before serialization, emits a structured warning, and preserves valid records; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 4 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: Git now warns when it encounters undecodable path bytes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 4 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch nia/issue-21-undecodable-paths

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nia-sg-bot nia-sg-bot added roadmap Tracked on the public WildestAI roadmap priority:P0 Critical path / blocks a usable product direction:aligned Aligned with the current WildestAI product direction labels Aug 29, 2026
@nia-sg-bot

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@nia-sg-bot
nia-sg-bot merged commit efab7eb into main Aug 29, 2026
4 checks passed
@nia-sg-bot
nia-sg-bot deleted the nia/issue-21-undecodable-paths branch August 29, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

direction:aligned Aligned with the current WildestAI product direction priority:P0 Critical path / blocks a usable product roadmap Tracked on the public WildestAI roadmap

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant