Skip to content

chore(vdev): only report files modified by cue fmt in check docs - #26725

Open
patrickswedish wants to merge 1 commit into
vectordotdev:masterfrom
patrickswedish:fix/vdev-check-docs-unstaged-edits-26707
Open

patrickswedish wants to merge 1 commit into
vectordotdev:masterfrom
patrickswedish:fix/vdev-check-docs-unstaged-edits-26707

Conversation

@patrickswedish

@patrickswedish patrickswedish commented Oct 17, 2026 •

Copy link
Copy Markdown

Summary

Fixes #26707

Currently, cargo vdev check docs runs ./scripts/cue.sh fmt and then checks git diff --name-only website/cue. When a developer has pre-existing unstaged (or untracked) edits under website/cue that are already properly formatted, git diff --name-only still lists those files and causes cargo vdev check docs to fail with a false formatting error before reaching cue vet.

This change snapshots the contents of the .cue files under website/cue before and after running ./scripts/cue.sh fmt, and only reports files whose contents were actually modified by the formatter.

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Checklist

@patrickswedish
patrickswedish requested a review from a team as a code owner October 17, 2026 17:34
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@github-actions github-actions Bot added the domain: vdev Anything related to the vdev tooling label Oct 17, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-20T20:52:57.192282Z
We couldn’t complete this review. Comment @codex review to try again.
4ec2826 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@patrickswedish

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@pront

pront commented Oct 20, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 25e6918f71

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

.map(String::from)
let mut modified: Vec<String> = after
.into_iter()
.filter(|(path, content)| before.get(path) != Some(content))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Normalize EOLs before comparing formatter snapshots

On Git-for-Windows checkouts with core.autocrlf=true, tracked CUE files begin as CRLF and CUE's formatter emits canonical LF bytes; the documented formatter explicitly warns that ./scripts/cue.sh fmt may "rewrite any files" (docs/DOCUMENTING.md:104-116). The old git diff --name-only compared Git-normalized contents and therefore returned no path for an EOL-only rewrite, but this raw Vec<u8> comparison reports all formatted files and makes exec bail on every fresh checkout even though there is no committable diff. Normalize line endings or compare Git-normalized contents.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed: Added CRLF-to-LF normalization (
ormalize_crlf) to avoid false-positive diffs on checkouts with core.autocrlf=true.

Comment thread vdev/src/commands/check/docs.rs Outdated
}

fn snapshot_cue_files(repo_root: &Path, source_dir: &Path) -> Result<BTreeMap<String, Vec<u8>>> {
let files = cue_files(source_dir)?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Escape the source prefix before globbing snapshots

On a checkout whose absolute path contains a glob metacharacter, such as /work/vector[1], this new snapshot call fails before cue fmt: cue_files interpolates source_dir.display() directly into the pattern at vdev/src/commands/build/docs_json.rs:85-93, so [1] is parsed as a character class and the actual source tree is not selected, usually triggering No CUE sources found. The old Git-diff implementation did not glob the checkout path; escape the literal prefix or walk the tree instead.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed: Replaced globbing with recursive directory walking (collect_cue_files) so paths containing brackets or glob metacharacters are safely traversed without pattern interpolation.

@pront pront added the no-changelog Changes in this PR do not need user-facing explanations in the release changelog label Oct 20, 2026
@patrickswedish
patrickswedish force-pushed the fix/vdev-check-docs-unstaged-edits-26707 branch from 25e6918 to d5ef304 Compare October 20, 2026 20:41
@patrickswedish

patrickswedish commented Oct 20, 2026 •

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA


Updated branch with Codex suggestions addressed:

  • Handled line ending normalization (normalize_crlf) to avoid false-positive snapshot discrepancies on checkouts with core.autocrlf=true.
  • Implemented recursive directory walking (collect_cue_files) to safely support checkout directory paths containing brackets or glob metacharacters.
  • Added changelog fragment changelog.d/26707_vdev_check_docs_unstaged_edits.fix.md.
  • Reverted docs_json.rs to leave it unchanged.

@patrickswedish
patrickswedish force-pushed the fix/vdev-check-docs-unstaged-edits-26707 branch from d5ef304 to 4ec2826 Compare October 20, 2026 20:44

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: vdev Anything related to the vdev tooling no-changelog Changes in this PR do not need user-facing explanations in the release changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vdev: check docs produces false positives on unstaged changes

2 participants