Skip to content

Conversation

@geertj
Copy link
Contributor

@geertj geertj commented Nov 25, 2025

A wire log captures information about each FUSE request, including name, duration and arguments. File system implementations can also add custom fields. Wire log are useful for understanding application access patterns and troubleshooting performance issues.

Wire logs are serialized in JSON format and can e.g. be loaded and analyzed in a notebook environment.

A wire log captures information about each FUSE request, including name,
duration and arguments. File system implementations can also add custom fields.
Wire log are useful for understanding application access patterns and
troubleshooting performance issues.

Wire logs are serialized in JSON format and can e.g. be loaded and analyzed in
a notebook environment.
ops[entry.Operation] = append(ops[entry.Operation], entry)
}

// 1. initOp
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know that this project unfortunately uses an assertion library for testing, but I do wonder if using cmp.Diff wouldn’t be easier to read here… Can you give that a try please?

Copy link
Contributor Author

@geertj geertj Nov 25, 2025

Choose a reason for hiding this comment

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

I added this as a separate commit. Please have a look. I'm not super convinced this is better because 1/ the structs have many fields that we don't want to compare, so I had to add a "ignoreZeros" filter, and 2/ there are some greater/less than/not nil/zero checks that you still have to do as separate checks (this checks only for equality), 3/ we can't match the overall wirelog record in one go because .Args is a map[string]any that needs to be loaded separately into the correct fuseops.*Op struct.

Copy link
Contributor Author

@geertj geertj Nov 25, 2025

Choose a reason for hiding this comment

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

Related, as a longer term direction, what do you think of removing the other jacobsa/* dependencies or replacing them with more commonly used alternatives? I think this would probably increase the overall maintainability of this code.

Regarding the test framework: A few weeks ago I experimented a bit with two options: moving tests to testify, and implementing light weight custom asserts. I think testify is pretty-much the de-facto standard, which is a big pro. That said, I hated two things about it: the wrong argument order of Equal() (yes, I really think it is wrong :) ), and that assert.* aren't assertions but expectations (in GoogleTest terminology).

Custom asserts are pretty much trivial now that Go has generics (example below). I think you could make a case that they are small enough not to count as a maintenance burden or risk of creating "yet another" test framework. But you'd want to stick to just these simple assertions and not introduce concepts like suites or other complications lke that.

func AssertEq[T comparable](expected, actual T) {
	if expected != actual {
		panic(fmt.Sprintf("assertion failed: expected %v, got %v", expected, actual))
	}
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

I added this as a separate commit. Please have a look. I'm not super convinced this is better because 1/ the structs have many fields that we don't want to compare, so I had to add a "ignoreZeros" filter, and 2/ there are some greater/less than/not nil/zero checks that you still have to do as separate checks (this checks only for equality), 3/ we can't match the overall wirelog record in one go because .Args is a map[string]any that needs to be loaded separately into the correct fuseops.*Op struct.

Okay, that’s fair. Let’s drop that commit for now.

Related, as a longer term direction, what do you think of removing the other jacobsa/* dependencies or replacing them with more commonly used alternatives? I think this would probably increase the overall maintainability of this code.

My personal preference is Google Style, which is to not use any assertion libraries at all: https://google.github.io/styleguide/go/decisions#assertion-libraries

I think a change of that magnitude should be okayed'ed by Aaron. Our agreement is that I help out with maintenance, not that I change the project substantially :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, that’s fair. Let’s drop that commit for now.

I've updated this PR to drop that commit. Anything else before this can be merged?

I will start a separate thread with you/me/Aaron on the assertion library and removing non-standard dependencies.

@stapelberg stapelberg merged commit 4b5f1a8 into jacobsa:master Dec 1, 2025
3 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.

2 participants