Skip to content

Harden value and marshal boundaries with fail-closed contracts#730

Merged
buke merged 3 commits intomainfrom
refact/6
Apr 4, 2026
Merged

Harden value and marshal boundaries with fail-closed contracts#730
buke merged 3 commits intomainfrom
refact/6

Conversation

@buke
Copy link
Copy Markdown
Owner

@buke buke commented Apr 4, 2026

No description provided.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (7245e12) to head (acd3356).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #730   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           16        16           
  Lines         3062      3086   +24     
=========================================
+ Hits          3062      3086   +24     
Files with missing lines Coverage Δ
context.go 100.00% <100.00%> (ø)
marshal.go 100.00% <100.00%> (ø)
value.go 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7245e12...acd3356. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements "fail-closed" semantics across the library's boundary APIs, including Set, Call, Execute, Marshal, and Unmarshal. These changes ensure that operations on invalid, closed, or cross-context objects return controlled errors or no-ops instead of triggering unsafe CGO calls or crashes. The implementation introduces helper methods such as isAlive and belongsTo for Value objects and a centralized ensureMarshalContextAvailable check for Context. Feedback was provided to remove a redundant liveness check in the Unmarshal function, as the condition is already logically covered by the context ownership verification.

@buke
Copy link
Copy Markdown
Owner Author

buke commented Apr 4, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements "fail-closed" semantics across the library's boundary APIs, including Value operations, Marshal/Unmarshal, and the deprecated Context.Invoke method. These changes ensure that operations on closed, nil, or mismatched contexts return safe defaults (such as nil, errors, or no-ops) instead of risking memory corruption or panics during Cgo calls. The PR also introduces helper methods like isAlive and belongsTo to standardize these safety checks and includes comprehensive test coverage for these edge cases. I have no feedback to provide as there were no review comments to assess.

@buke buke merged commit b3c91bc into main Apr 4, 2026
8 checks passed
@buke buke deleted the refact/6 branch April 4, 2026 09:34
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.

1 participant