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

Improve error positioning of SemanticError #70

Merged
merged 1 commit into from
Dec 14, 2024
Merged

Improve error positioning of SemanticError #70

merged 1 commit into from
Dec 14, 2024

Conversation

dsnet
Copy link
Collaborator

@dsnet dsnet commented Dec 13, 2024

Changes made:

  • Always populate SemanticError.JSONPointer.
  • Export ErrUnknownName to programmatically identify an unknown name.
  • Reduce verbosity of SemanticError.Error method.
  • Apply Hyrum-proofing on a per-process basis, rather than on a per-error.Error method call.
  • Cleanup error wrapping for user-provided method and function calls. Some heuristics were used to provided reasonable position injection into user-provided errors.

errors.go Outdated Show resolved Hide resolved
errors.go Outdated Show resolved Hide resolved
errors.go Outdated Show resolved Hide resolved
@dsnet dsnet force-pushed the semantic-error branch 5 times, most recently from fc4de8d to a37b36b Compare December 13, 2024 21:25
errors.go Outdated Show resolved Hide resolved
errors.go Show resolved Hide resolved
Comment on lines +228 to +231
// The randomization is tied to the Hyrum-proofing already applied
// on map iteration in Go.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is relying on this hyrum-proofing actually hyrum-busting 🤔😂? Seriously though, did we mention this hyrum proofing attempt as a design goal of v2 in the design discussion? I know some protojson users who grumble about this behavior. Not to say that I don't think it's worth doing but, just wondering if there's been any discussion already.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's always easier to remove hyrum proofing than it is to add it.

Personally, I'd be okay with the protobuf module now removing the hyrum proofing 4 years in, but it was necessary during the initial years trying to migrate to the new module and avoid backsliding into bad testing practices.

In a similar way, I think we should still have the hyrum proofing here while the the error output is still in flux. This PR makes significant improvements in finalizing what it might look like, but I'm certain we'll keep making tweaks over the upcoming year or two after initial release.

Changes made:
* Always populate SemanticError.JSONPointer.
* Export ErrUnknownName to programmatically identify an unknown name.
* Reduce verbosity of SemanticError.Error method.
* Apply Hyrum-proofing on a per-process basis,
  rather than on a per-error.Error method call.
* Cleanup error wrapping for user-provided method and function calls.
  Some heuristics were used to provided reasonable position injection
  into user-provided errors.
@dsnet dsnet merged commit 68309eb into master Dec 14, 2024
8 checks passed
@dsnet dsnet deleted the semantic-error branch December 14, 2024 20:06
@ccoVeille
Copy link

Thank you so much for this

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.

4 participants