Skip to content

feat: add NewProcessRef constructor and always emit pid - #27

Merged
tixxdz merged 4 commits into
mainfrom
pr/tixxdz/07-profile-v2
Jul 22, 2026
Merged

tixxdz merged 4 commits into
mainfrom
pr/tixxdz/07-profile-v2

Conversation

@tixxdz

@tixxdz tixxdz commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

tixxdz added 4 commits July 21, 2026 16:51
- 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.
Copilot AI review requested due to automatic review settings July 22, 2026 21:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 centralize ProcessRef creation and ensure hash strings match canonical registry key formatting.
  • Updated ProcessRef JSON marshaling to always emit "pid" for non-zero refs, and adjusted IsZero() semantics accordingly.
  • Replaced hashKey’s %08x formatting with a strconv-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.

Comment thread pkg/ongoing/summary.go Resolved
@tixxdz
tixxdz merged commit e1ffaa2 into main Jul 22, 2026
2 checks passed
@tixxdz
tixxdz deleted the pr/tixxdz/07-profile-v2 branch July 22, 2026 21:44
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