Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update module github.com/akedrou/textdiff to v0.1.0 #327

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.5

require (
connectrpc.com/connect v1.17.0
github.com/akedrou/textdiff v0.0.0-20230423230343-2ebdcebdccc1
github.com/akedrou/textdiff v0.1.0
github.com/anthropics/anthropic-sdk-go v0.2.0-alpha.4
github.com/auth0/go-jwt-middleware/v2 v2.2.2
github.com/coder/websocket v1.8.12
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
connectrpc.com/connect v1.17.0 h1:W0ZqMhtVzn9Zhn2yATuUokDLO5N+gIuBWMOnsQrfmZk=
connectrpc.com/connect v1.17.0/go.mod h1:0292hj1rnx8oFrStN7cB4jjVBeqs+Yx5yDIC2prWDO8=
github.com/akedrou/textdiff v0.0.0-20230423230343-2ebdcebdccc1 h1:XfKKiQL7irIGI7nfu4a6IKhrgUHvKwhH/AnuHgZy/+U=
github.com/akedrou/textdiff v0.0.0-20230423230343-2ebdcebdccc1/go.mod h1:PJwvxBpzqjdeomc0r8Hgc+xJC7k6z+k371tffCGXR2M=
github.com/akedrou/textdiff v0.1.0 h1:K7nbOVQju7/coCXnJRJ2fsltTwbSvC+M4hKBUJRBRGY=
github.com/akedrou/textdiff v0.1.0/go.mod h1:a9CCC49AKtFTmVDNFHDlCg7V/M7C7QExDAhb2SkL6DQ=
github.com/anthropics/anthropic-sdk-go v0.2.0-alpha.4 h1:TdGQS+RoR4AUO6gqUL74yK1dz/Arrt/WG+dxOj6Yo6A=
github.com/anthropics/anthropic-sdk-go v0.2.0-alpha.4/go.mod h1:GJxtdOs9K4neo8Gg65CjJ7jNautmldGli5/OFNabOoo=
github.com/auth0/go-jwt-middleware/v2 v2.2.2 h1:vrvkFZf72r3Qbt45KLjBG3/6Xq2r3NTixWKu2e8de9I=
Expand Down
6 changes: 5 additions & 1 deletion llm/render_prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,12 @@
}

// Diff the YAML

// `myers.ComputeEdits` is deprecated, but I haven't yet found a good
// alternative that handles multiple diffs in a single file nicely. See the
// `TestDiffLibrary` for an example of what output we're expecting
edits := myers.ComputeEdits(beforeYAML, afterYAML)

Check failure on line 229 in llm/render_prompt.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, depot-ubuntu-24.04)

SA1019: myers.ComputeEdits is deprecated: this implementation is moribund. However, when diffs appear in marker test expectations, they are the particular diffs produced by this implementation. The marker test framework asserts diff(orig, got)==wantDiff, but ideally it would compute got==apply(orig, wantDiff) so that the notation of the diff is immaterial. (staticcheck)
unified, err := textdiff.ToUnified("current", "proposed", beforeYAML, edits)
unified, err := textdiff.ToUnified("current", "proposed", beforeYAML, edits, 3)

if err != nil {
return "", err
Expand Down
10 changes: 9 additions & 1 deletion llm/render_prompt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,16 @@
image: ghcr.io/overmindtech/api-server@sha256:462be60d478b3e86796ce628765ec3f42b6b051b9c91a466ea70f47eebb64a09`

func TestDiffLibrary(t *testing.T) {
edits := myers.ComputeEdits(testBefore, testAfter)

Check failure on line 253 in llm/render_prompt_test.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, depot-ubuntu-24.04)

SA1019: myers.ComputeEdits is deprecated: this implementation is moribund. However, when diffs appear in marker test expectations, they are the particular diffs produced by this implementation. The marker test framework asserts diff(orig, got)==wantDiff, but ideally it would compute got==apply(orig, wantDiff) so that the notation of the diff is immaterial. (staticcheck)
unified, _ := textdiff.ToUnified("name", "name", testBefore, edits)

unified, _ := textdiff.ToUnified("name", "name", testBefore, edits, 3)

// We want the diff to be smart i.e. not to print the whole file twice, but
// instead focus on the two lines that changed (the top and the bottom)
lines := strings.Split(unified, "\n")
if len(lines) > 17 {
t.Errorf("diff is too long: %d lines", len(lines))
}

fmt.Println(fmt.Sprint(unified))
}
Expand Down
Loading