Skip to content

Fix malformed workspace Git metadata handling - #6

Merged
HarperZ9 merged 1 commit into
mainfrom
codex/sweeper-main-nul-metadata-20260915
Sep 15, 2026
Merged

HarperZ9 merged 1 commit into
mainfrom
codex/sweeper-main-nul-metadata-20260915

Conversation

@HarperZ9

Copy link
Copy Markdown
Owner

This fixes malformed Git metadata handling in workspace scans on the current main implementation.

Before this change, an embedded NUL in a linked-worktree .git gitdir pointer, gitdir backpointer, or commondir value could raise during path resolution before the CLI emitted a workspace matrix. The CLI exited non-zero, but it printed a traceback instead of returning structured JSON.

The metadata path handling now rejects control characters before resolving paths and treats ValueError like other unreadable metadata failures. This preserves the existing linked-worktree authenticity checks on main, including gitdir backpointer validation and common worktrees parent validation. Malformed metadata is reported through coverage.diagnostics as UNVERIFIABLE, while healthy linked worktrees continue to scan normally.

Validation:

  • python -m pytest -q tests/test_workspace.py
  • python -m pytest -q
  • CLI controls for malformed .git, gitdir backpointer, and commondir metadata: exit 1, JSON stdout, workspace_status: UNVERIFIABLE, empty stderr, and no raw control-character path fragments
  • Healthy linked-worktree CLI control: exit 0, one MATCH repository
  • git diff --cached --check -- src/public_surface_sweeper/workspace.py tests/test_workspace.py

@HarperZ9
HarperZ9 merged commit 551894d into main Sep 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant