Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ so `weave-core`, `weave-crdt`, `weave-driver`, `weave-cli`, `weave-mcp`,

## Unreleased

### Performance

- Clean edits skip parsing the original source in the parse-regression guard. Results containing syntax errors still compare both versions before deciding whether to reject the edit.

### Fixed

- Crate publishing checks accepted uploads separately from sparse-index availability, waits before publishing dependents, and resumes from the immutable release tag without re-uploading accepted versions.
Expand Down
18 changes: 17 additions & 1 deletion crates/weave-cli/src/edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,13 @@ fn parses_worse(path: &str, before: &str, after: &str) -> Option<String> {
lines.sort_unstable();
lines
};
let (b, a) = (errors(before), errors(after));
// A clean result cannot introduce more parse errors, regardless of the
// original file. Avoid parsing the old source on the common clean path.
let a = errors(after);
if a.is_empty() {
return None;
}
let b = errors(before);
if a.len() <= b.len() {
return None;
}
Expand Down Expand Up @@ -1880,6 +1886,16 @@ fn report(path: &str, before: Option<&str>, after: &str) -> FileReport {

#[cfg(test)]
mod tests {
#[test]
fn clean_parse_guard_preserves_repair_and_rejection() {
let clean = "def f():\n return 1\n";
let broken = "def f(:\n return 1\n";
assert!(super::parses_worse("a.py", clean, clean).is_none());
assert!(super::parses_worse("a.py", broken, clean).is_none());
assert!(super::parses_worse("a.py", clean, broken).is_some());
assert!(super::parses_worse("a.py", broken, broken).is_none());
}

use super::*;

const PY: &str = "import os\n\n\ndef a():\n return 1\n\n\nclass K:\n def m(self):\n return 2\n\n def n(self):\n return 3\n\n\ndef b():\n return a()\n";
Expand Down
Loading