Skip to content

Cache ReadWriteBuckets based on absolute path in appprotoos.ResponseWriter#1124

Merged
bufdev merged 3 commits into
mainfrom
abs-paths-response-writer
Jun 4, 2022
Merged

Cache ReadWriteBuckets based on absolute path in appprotoos.ResponseWriter#1124
bufdev merged 3 commits into
mainfrom
abs-paths-response-writer

Conversation

@bufdev
Copy link
Copy Markdown
Member

@bufdev bufdev commented May 11, 2022

While investigating the feasibility of #1123, I realized that our caching would not work for absolute vs relative paths. This should fix it, but there is a test failure.

--- FAIL: TestInsertionPointMixedPathsFail (0.29s)
    appcmdtesting.go:147:
        	Error Trace:	appcmdtesting.go:147
        	           				protoc_test.go:249
        	           				protoc_test.go:221
        	Error:      	Not equal:
        	           	expected: 1
        	           	actual  : 0
        	Test:       	TestInsertionPointMixedPathsFail
        	Messages:   	

From the comments on the test, I can't figure out what is going on and why this should be failing. @amckinney can you take a quick look?

@bufdev bufdev requested a review from amckinney May 11, 2022 15:23
@amckinney
Copy link
Copy Markdown
Contributor

So that failure is actually valid from a protoc perspective - I discovered this back when we were refactoring all of the insertion point stuff in this PR. I left a comment on the test helper:

// testInsertionPointMixedPathsFail demonstrates that insertion points are only
// able to generate to the same output directory, even if the absolute path points
// to the same place.
func testInsertionPointMixedPathsFail(t *testing.T, runner command.Runner, receiverOut string, writerOut string) {
  ...
}

So the test above SHOULD be failing because this doesn’t actually work:

$ protoc -I proto proto/buf/alpha/image/v1/image.proto --insertion-point-receiver_out=insertion --insertion-point-writer_out=$(pwd)/insertion

With that said, we could just remove this test so that buf alpha protoc actually supports absolute paths (even though protoc doesn't). In that case, we'd actually support more features than protoc, so everything else would still be backwards compatible.

I'll follow-up here by just refactoring the test verifying that mixing the path format (absolute vs. relative) works, then leave another comment justifying it.

@bufdev
Copy link
Copy Markdown
Member Author

bufdev commented Jun 4, 2022

LGTM

@bufdev bufdev merged commit 7c634c1 into main Jun 4, 2022
@bufdev bufdev deleted the abs-paths-response-writer branch June 4, 2022 02:27
Monirul1 pushed a commit to Monirul1/buf that referenced this pull request Apr 30, 2023
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.

2 participants