Skip to content

Fix documentation errors in Android.Crypto.Hpke (R113, pass 3) - #1991

Merged
jonathanpeppers merged 3 commits into
mainfrom
jonathanpeppers-review-android-crypto-hpke-docs-r113
Nov 28, 2026
Merged

jonathanpeppers merged 3 commits into
mainfrom
jonathanpeppers-review-android-crypto-hpke-docs-r113

Conversation

@jonathanpeppers

@jonathanpeppers jonathanpeppers commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: abbc85c26baa7bfb67eafe24cb339b1c3db94da0

Dimension Assessment Rationale
Change confidence 9/10 ↑ The net diff is 9 one-line transfer param edits, and pinned source lines prove each one.
↑ All XML files in the namespace parse, and git diff --check is clean.
↑ The gemini-4-argon rubber-duck review of this head found no problems.
↓ OpenPublishing.Build and the Copilot review for this head are pending.
Diagnosis confidence 9.5/10 ↑ Object.cs and JNIEnv.cs show that the peer makes its own reference and transfer selects release and registration.
Evidence fit 9/10 ↑ AI added the incorrect text in each fixed channel, and the pinned implementation contradicts it.

Scope

Pass-3 review of the AI-changed documentation in Android.Crypto.Hpke (12 files: 10 type files, ns-Android.Crypto.Hpke.xml, and IHpkeSpi.xml). IHpkeSpi.xml has no AI-changed Docs text.

  • 306 AI-changed channels in total.
  • 306 channels have a personal ledger row with a verdict and a numeric pinned source line: 207 correct, 9 fixed, 90 deferred.
  • The 90 deferred channels are ThresholdClass/ThresholdType/JniPeerMembers boilerplate. Each one still has its own row, checked against the dotnet/android@9bc18c75 generator (ClassInvokers.cs, PeerMembersField.cs) and XAPeerMembers.cs. Per the kickoff, they are not changed here.

Fixes

transfer param on the (IntPtr, JniHandleOwnership) constructors (9 files).

  • Files: AeadParameterSpec, Hpke, KdfParameterSpec, KemParameterSpec, Message, Recipient, Recipient.Builder, Sender, and Sender.Builder.
  • Old text: "Specifies whether ownership of the JNI reference transfers to this instance."
  • All 9 types derive from Java.Lang.Object. In Object.SetHandle, ConstructPeer gets Copy (or CopyAndDoNotRegister), so the peer makes its own reference. After that, JNIEnv.DeleteRef(value, transfer) releases the incoming reference.
  • Evidence: dotnet/android@9bc18c75 src/Mono.Android/Java.Lang/Object.cs:35-38,110-118 and src/Mono.Android/Android.Runtime/JNIEnv.cs:360-372,388-393.
  • New text (same as Fix documentation errors in Android.App.PermissionUI (R060, pass 3) #1941): "Specifies how the runtime handles the JNI reference, including its release and peer registration."

Reverted: Sender.Builder "This value cannot be null."

  • Commit 40a76fd removed this sentence from the applicationInfo and senderKey params. Commit abbc85c restores it.
  • Sender.java:127 declares setApplicationInfo(@NonNull byte[] applicationInfo), and Sender.java:138 declares setSenderKey(@NonNull PrivateKey senderKey). The sentence states this public caller contract. The missing runtime check and the @Nullable parameters on the internal HpkeSpi do not change that contract.
  • Sender+Builder.xml now differs from main only in the transfer param.

Sources: source-37.2_r01.zip (android/crypto/hpke/*.java, com/android/org/conscrypt/HpkeImpl.java, OpenSSLProvider.java), RFC 9180, and dotnet/android@9bc18c75.

Uncertain findings

None.

I examined one item and found no error. KemParameterSpec remarks say "The Conscrypt provider supports DHKEM_X25519_HKDF_SHA256." Conscrypt also registers MLKEM_* and XWING suites (OpenSSLProvider.java:776-791). Those suites have no KemParameterSpec field, and the sentence does not say "only". Thus, the sentence is correct as written.

Checks

  • All XML files in docs/xml/Android.Crypto.Hpke parse.
  • git diff --check origin/main HEAD is clean.
  • Only the error spans changed. BOM, LF line endings, and metadata did not change.
  • No placeholders were added. index.xml did not change.
  • Rubber-duck review of abbc85c with model gemini-4-argon: no findings. Local assistant_usage_events shows 11 rows for sub-agent 3f725511-f3ab-4d85-a722-16046e182080, all with model gemini-4-argon, from 2026-11-28T16:25:51Z to 16:29:01Z.

jonathanpeppers and others added 2 commits November 28, 2026 10:17
Java.Lang.Object peers make their own JNI reference; transfer selects whether the incoming reference is deleted and whether the peer is registered.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sender.Builder.setApplicationInfo and setSenderKey do not null-check, and HpkeSpi.engineInitSender declares both values @nullable.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 28, 2026 16:21
@jonathanpeppers
jonathanpeppers enabled auto-merge (squash) November 28, 2026 16:21

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.

🟢 Approval recommended

No active review issues are reported for this documentation-only update clarifying JNI reference handling and sender-builder parameter nullability.

No open issues 🎉

What changed in this PR

This documentation-only PR corrects parameter descriptions in Android.Crypto.Hpke, aligning them with runtime reference handling and sender-builder null behavior. No API signatures or executable code change.

Changes:

  • Clarifies JNI reference release and peer registration for constructors in nine files, consistent with the wording used in #1941.
  • Removes incorrect non-null restrictions from Sender.Builder.SetApplicationInfo and SetSenderKey.
File Description
docs/​xml/​Android.Crypto.Hpke/​Sender+Builder.xml Corrects JNI handling and two parameter null restrictions.
docs/​xml/​Android.Crypto.Hpke/​Sender.xml Clarifies constructor JNI reference handling.
docs/​xml/​Android.Crypto.Hpke/​Recipient+Builder.xml Clarifies constructor JNI reference handling.
docs/​xml/​Android.Crypto.Hpke/​Recipient.xml Clarifies constructor JNI reference handling.
docs/​xml/​Android.Crypto.Hpke/​Message.xml Clarifies constructor JNI reference handling.
docs/​xml/​Android.Crypto.Hpke/​KemParameterSpec.xml Clarifies constructor JNI reference handling.
docs/​xml/​Android.Crypto.Hpke/​KdfParameterSpec.xml Clarifies constructor JNI reference handling.
docs/​xml/​Android.Crypto.Hpke/​Hpke.xml Clarifies constructor JNI reference handling.
docs/​xml/​Android.Crypto.Hpke/​AeadParameterSpec.xml Clarifies constructor JNI reference handling.

Review effort: Balanced

Sender.java declares setApplicationInfo(@nonnull byte[]) at line 127
and setSenderKey(@nonnull PrivateKey) at line 138. The text "This
value cannot be null." states that public caller contract, so the
earlier removal (40a76fd) was wrong.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

🟢 Approval recommended

There are no active review issues for the JNI reference-handling documentation update.

No open issues 🎉

Review effort: Balanced

@jonathanpeppers

Copy link
Copy Markdown
Member Author

@dalexsoto review

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed the JNI handle-ownership parameter documentation across all nine HPKE types against the runtime reference-handling implementation. No blocking issues found.

@jonathanpeppers
jonathanpeppers merged commit 89498c9 into main Nov 28, 2026
4 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-review-android-crypto-hpke-docs-r113 branch November 28, 2026 16:56
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.

3 participants