Repository navigation
feat: add NewProcessRef constructor and always emit pid - #27
Merged
Merged
Conversation
- Derive the string hash fields from the kernel uint32 hashes. So the process and exe hashes cannot diverge on padding.
- Replace fmt dependency with strconv and strings for hex formatting.
- Drop omitempty from the pid field so a non-zero ref with PID 0 (interrupt context) event is not silently dropped.
There was a problem hiding this comment.
Pull request overview
This PR adds a safer/clearer construction path for ProcessRef, adjusts JSON output to always include pid for non-zero refs (even when pid == 0), and refactors hash key formatting while expanding test coverage around these behaviors.
Changes:
- Added
NewProcessRef(...)to centralizeProcessRefcreation and ensure hash strings match canonical registry key formatting. - Updated
ProcessRefJSON marshaling to always emit"pid"for non-zero refs, and adjustedIsZero()semantics accordingly. - Replaced
hashKey’s%08xformatting with astrconv-based implementation and added equivalence tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/ongoing/summary.go | Adds NewProcessRef, changes pid emission semantics, and introduces ProcessRegistry.Add. |
| pkg/ongoing/summary_test.go | Updates IsZero expectations and adds tests for pid=0 marshaling, NewProcessRef, and registry Add. |
| pkg/ongoing/keys.go | Refactors hashKey implementation to avoid fmt.Sprintf while preserving output format. |
| pkg/ongoing/keys_test.go | Adds additional width cases and a sweep test to ensure hashKey matches %08x behavior (except for zero). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.