Skip to content

[kani] Prove sized Ref construction and restoration - #3657

Open
joshlf wants to merge 1 commit into
G3ehtgm3rda6i5wi6h6gwkvlmzeh4sn46from
Glkshhyn2hsme53vnmamjpny6o3s637ys
Open

[kani] Prove sized Ref construction and restoration#3657
joshlf wants to merge 1 commit into
G3ehtgm3rda6i5wi6h6gwkvlmzeh4sn46from
Glkshhyn2hsme53vnmamjpny6o3s637ys

Conversation

@joshlf

@joshlf joshlf commented Sep 7, 2026

Copy link
Copy Markdown
Member

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.


Latest Update: v52 — Compare vs v51

📚 Full Patch History

Links show the diff between the row version and the column version.

Version v51 v50 v49 v48 v47 v46 v45 v44 v43 v42 v41 v40 v39 v38 v37 v36 v35 v34 v33 v32 v31 v30 v29 v28 v27 v26 v25 v24 v23 v22 v21 v20 v19 v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v52 v51 v50 v49 v48 v47 v46 v45 v44 v43 v42 v41 v40 v39 v38 v37 v36 v35 v34 v33 v32 v31 v30 v29 v28 v27 v26 v25 v24 v23 v22 v21 v20 v19 v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v51 v50 Base
v50 v49 Base
v49 v48 Base
v48 v47 Base
v47 v46 Base
v46 v45 Base
v45 v44 Base
v44 v43 Base
v43 v42 Base
v42 v41 Base
v41 v40 Base
v40 v39 Base
v39 v38 Base
v38 v37 Base
v37 v36 Base
v36 v35 Base
v35 v34 Base
v34 v33 Base
v33 v32 Base
v32 v31 Base
v31 v30 Base
v30 v29 Base
v29 v28 Base
v28 v27 Base
v27 v26 Base
v26 v25 Base
v25 v24 Base
v24 v23 Base
v23 v22 Base
v22 v21 Base
v21 v20 Base
v20 v19 Base
v19 v18 Base
v18 v17 Base
v17 v16 Base
v16 v15 Base
v15 v14 Base
v14 v13 Base
v13 v12 Base
v12 v11 Base
v11 v10 Base
v10 v9 Base
v9 v8 Base
v8 v7 Base
v7 v6 Base
v6 v5 Base
v5 v4 Base
v4 v3 Base
v3 v2 Base
v2 v1 Base
v1 Base
⬇️ Download this PR

Branch

git fetch origin refs/heads/Glkshhyn2hsme53vnmamjpny6o3s637ys && git checkout -b pr-Glkshhyn2hsme53vnmamjpny6o3s637ys FETCH_HEAD

Checkout

git fetch origin refs/heads/Glkshhyn2hsme53vnmamjpny6o3s637ys && git checkout FETCH_HEAD

Cherry Pick

git fetch origin refs/heads/Glkshhyn2hsme53vnmamjpny6o3s637ys && git cherry-pick FETCH_HEAD

Pull

git pull origin refs/heads/Glkshhyn2hsme53vnmamjpny6o3s637ys

Stacked PRs enabled by GHerrit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-09-09T17:21:20.526274Z 4086010 Manual request
🔒 Security Review Completed 2026-09-08T21:37:14.032893Z b79d49b Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@google-cla

google-cla Bot commented Sep 7, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@joshlf
joshlf force-pushed the G3ehtgm3rda6i5wi6h6gwkvlmzeh4sn46 branch from 93cdb98 to efa1180 Compare September 7, 2026 17:14
@joshlf
joshlf force-pushed the Glkshhyn2hsme53vnmamjpny6o3s637ys branch 2 times, most recently from a5d27ff to f131f42 Compare September 7, 2026 17:21
@joshlf
joshlf force-pushed the G3ehtgm3rda6i5wi6h6gwkvlmzeh4sn46 branch from efa1180 to d41363c Compare September 7, 2026 17:21
@joshlf
joshlf force-pushed the Glkshhyn2hsme53vnmamjpny6o3s637ys branch from f131f42 to d474119 Compare September 7, 2026 17:47
@joshlf
joshlf force-pushed the G3ehtgm3rda6i5wi6h6gwkvlmzeh4sn46 branch from d41363c to 9742a70 Compare September 7, 2026 17:47
@joshlf
joshlf force-pushed the Glkshhyn2hsme53vnmamjpny6o3s637ys branch from d474119 to 6cc76b9 Compare September 7, 2026 18:13
@joshlf
joshlf force-pushed the G3ehtgm3rda6i5wi6h6gwkvlmzeh4sn46 branch from 9742a70 to 3f9d1cf Compare September 7, 2026 18:13
@codecov-commenter

codecov-commenter commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.89%. Comparing base (6c56d41) to head (4086010).

Additional details and impacted files
@@                        Coverage Diff                         @@
##           G3ehtgm3rda6i5wi6h6gwkvlmzeh4sn46    #3657   +/-   ##
==================================================================
  Coverage                              91.89%   91.89%           
==================================================================
  Files                                     20       20           
  Lines                                   6118     6118           
==================================================================
  Hits                                    5622     5622           
  Misses                                   496      496           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joshlf

joshlf commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

Please review current head 6cc76b955d84bb2fe1112d0cdf59c6ad6d5c0ba3; in particular, challenge the documented proof domain and exclusions, and verify that expected behavior comes from an independent safe Rust, standard-library, language, or explicitly labeled policy oracle.

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 6cc76b955d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 6cc76b955d

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@joshlf
joshlf force-pushed the Glkshhyn2hsme53vnmamjpny6o3s637ys branch from 6cc76b9 to e0bc7fa Compare September 7, 2026 19:04
@joshlf

joshlf commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

Please review current head e0bc7faa9f05ab5eea1286112617cab7b737b57f; in particular, challenge the documented proof domain and exclusions, and verify that expected behavior comes from an independent safe Rust, standard-library, language, or explicitly labeled policy oracle.

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: e0bc7faa9f

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 510e818403

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread zerocopy/src/ref.rs

match (result, expected_success) {
(Ok(typed), true) => {
kani::cover!(view.start == 0 && source_len == SIZE);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Document the cover-property observer

Every claimed reachability witness depends on kani::cover! creating a cover property whose satisfaction means this condition is reachable, but the supposedly exact pinned premise list documents kani::any, kani::assume, assertions, and failures without documenting the cover! contract. Add the Kani 0.67 cover semantics to the premise list and map them to these non-vacuity sites so the proof account establishes what the CI-checked cover summaries actually witness.

AGENTS.md reference: zerocopy/AGENTS.md:L67-L73

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Addressed in the current revision. The pinned premise list now records that kani::cover! asks whether an execution reaches the observer with its condition true and that SATISFIED means such an execution was found. Every cover is mapped to that premise and to the fail-closed result checker; the proof account explicitly limits each result to an existential reachability witness rather than an assertion or universal target theorem.

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

Comment thread zerocopy/src/ref.rs
mem::forget(typed);
}
(Err(err), false) => {
kani::cover!(view.start == 0 && source_len == SIZE - 1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Ground the remaining size subtraction

The earlier manual View::len subtraction was removed, but the current revision still introduces fresh usize subtraction in these error-partition covers through SIZE - 1. Premises [12], [24], and [25] establish size observation, equality, and ordering, not subtraction or its overflow behavior, so the supposedly exact audit basis does not establish that these covers denote the intended one-byte-short partition; cite the pinned Rust subtraction semantics and map them to both remaining uses.

AGENTS.md reference: zerocopy/AGENTS.md:L67-L73

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Addressed in the current revision. Both one-byte-short covers now call a shared one_byte_short_of_u32 oracle implemented with SIZE.checked_sub(1).expect(...). The proof account cites usize::checked_sub, maps both uses to it, and explains that expect makes a hypothetical zero-sized premise fail closed under Kani. No unchecked SIZE - 1 reconstruction remains.

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

Comment thread zerocopy/src/ref.rs

kani::cover!(view.start == 0 && source_len == SIZE);
kani::cover!(view.start == SIZE && source_len == SIZE);
kani::cover!(original_value != replacement);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Document inequality in the nontrivial mutation covers

These original_value != replacement witnesses depend on u32::PartialEq::ne and the != operator, while premise [21] records only PartialEq::eq and its use by ==. Consequently, the exact premise map does not ground the classification used to prove that non-idempotent DerefMut and into_mut cases are reachable; add the versioned inequality contract and map it to both covers.

AGENTS.md reference: zerocopy/AGENTS.md:L67-L73

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Addressed in the current revision. The premise list now records Rust’s mapping of != to PartialEq::ne and the applicable primitive u32 operation, and maps it to both non-idempotent mutation covers. The analogous u8 error-replacement cover is documented separately under the same language operation.

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

@joshlf

joshlf commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@codex review

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7fec9e49a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread zerocopy/src/ref.rs
// theorem: `Ref::from_bytes` documents rejection for either invalid size
// or alignment, while this proof also asserts the intended converse.
fn construction_oracle(source: &[u8]) -> bool {
source.len() == SIZE && source.as_ptr().cast::<u32>().is_aligned()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Document Boolean conjunction in the construction oracle

The supposedly exact assertion map grounds the two operands of construction_oracle in length, alignment, and equality premises, but never grounds the && operation that combines them into the success predicate used by all four harnesses. Without the pinned Rust Boolean conjunction contract, the proof account does not establish its central “success iff both checks pass” policy or the mutation-domain assumptions; cite that contract and map it to this oracle.

AGENTS.md reference: zerocopy/AGENTS.md:L67-L73

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Addressed. The construction-oracle proof map now cites Rust 1.93's lazy Boolean && contract and explicitly derives that the oracle succeeds exactly when both the independently grounded length and alignment predicates hold.

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

Comment thread zerocopy/src/ref.rs
Comment on lines +1091 to +1092
if selected.len() != SIZE {
return None;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Map the frame oracle's size guard

All three mutation-frame expectations depend on this if selected.len() != SIZE { return None; } guard selecting the copy path, but the supposedly complete post-mutation frame basis at lines 1291–1293 omits both the [24] usize::ne comparison premise and the conditional/return control-flow premise. The constructor assumption supplies an exact-size input but does not itself establish how this separate oracle guard evaluates, so add those pinned Rust contracts to the frame assertion map.

AGENTS.md reference: zerocopy/AGENTS.md:L67-L73

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Addressed. The frame-oracle account now maps selected.len() != SIZE through the pinned usize inequality contract and the Rust 1.93 conditional-expression and return-expression rules before the copy path is used.

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

Comment thread zerocopy/src/ref.rs Outdated
// or any generic `Ref` or `B` drop behavior.
#[kani::proof]
#[kani::unwind(9)]
fn prove_sized_u32_from_bytes_deref_and_error_restoration() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Split the three target contracts into separate harnesses

This single harness targets Ref::from_bytes classification, immutable Deref, and CastError::into_src restoration/write-through, even though agent_docs/validation.md requires distinct harnesses for different entry points or contracts. Consequently, a dereference or error-accessor regression fails the constructor harness and obscures which contract broke; keep the shared generator and oracles, but move the target-specific assertions into separate constructor, dereference, and restoration harnesses.

AGENTS.md reference: zerocopy/AGENTS.md:L67-L73

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Addressed. The combined harness was split into separate classification, immutable dereference, error-source restoration, mutable dereference, write, and into_mut harnesses. They retain shared input/oracle helpers while each target entry point and contract now fails independently.

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

@joshlf

joshlf commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@codex review

Please review current head 83f461e05eba00250941c8b202bbcf24b0e98132; in particular, challenge the documented proof domain and exclusions, and verify that expected behavior comes from an independent safe Rust, standard-library, language, or explicitly labeled policy oracle.

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@joshlf

joshlf commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@codex review

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 74a3efda9e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@joshlf

joshlf commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@codex review

Please review exact head dfb5ec9d9112954b2a6cbdd3781ae91a9de40395.

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: dfb5ec9d91

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@joshlf

joshlf commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

@codex review

Exact-head review request: 22bbca8

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 22bbca8c14

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@joshlf

joshlf commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

@codex review

Exact-head review request: 78d9d75

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78d9d75b21

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread zerocopy/src/ref.rs
Comment on lines +1805 to +1807
*typed = replacement;
assert_eq!(*typed, replacement);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Account for returned-reference destruction before frame checks

In both prove_sized_u32_into_mut and prove_sized_u32_error_into_src, the returned &mut reference falls out of scope before the backing-buffer frame is checked, so each harness observes the target operation plus destruction of that reference value. Unlike the other frame harnesses, the exact premise/assertion map neither isolates this step nor cites Rust's guarantee that destroying a reference has no storage effect; explicitly document and map that premise, or retain the returned reference in a ManuallyDrop until after the frame observation.

AGENTS.md reference: zerocopy/AGENTS.md:L67-L73

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

Addressed on exact head 408601076d97cd22429eef20009b719e325d773a. The three returned mutable-reference values in the error-restoration, DerefMut, and into_mut harnesses are now placed in ManuallyDrop after their final observation/write and before the outer backing-frame assertion. Premise [42] records this explicit automatic-drop isolation; the comments no longer rely on an unstated general reference-destruction theorem. The wrapper-forgetting boundaries remain in place. This change is also preserved in the downstream direct-construction variant in #3663.

Comment thread zerocopy/src/ref.rs Outdated
if selected.len() != SIZE {
return None;
}
selected.copy_from_slice(&replacement.to_ne_bytes());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Document the array-to-slice coercion in the frame oracle

Every mutation-frame expectation passes &replacement.to_ne_bytes(), whose type is &[u8; 4], to copy_from_slice, whose parameter is &[u8]; the expected frame therefore depends on Rust's array-to-slice unsizing coercion (and the borrowed temporary surviving the call). Premises [3] and [4] establish the produced array and equal-length slice copy but not this bridge, so cite the pinned coercion contract and include it in the post-mutation frame map.

AGENTS.md reference: zerocopy/AGENTS.md:L67-L73

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

Addressed on exact head 408601076d97cd22429eef20009b719e325d773a. The replacement array is now a named replacement_bytes binding before copy_from_slice. The proof explicitly connects the binding scope [32], function-argument coercion site, and array-to-slice unsizing through the shared reference [41]. It no longer needs a borrowed-temporary lifetime argument. The same repair is preserved in #3663.

@joshlf

joshlf commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

@codex review

Exact-head review request: 65cfd71

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 65cfd710a5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread zerocopy/src/ref.rs Outdated
Comment on lines +1332 to +1334
// in the immutable `Deref`, `DerefMut`, and `into_mut` harnesses consume
// [1], [2], [6], [11], [12], [21], and the applicable immutable or mutable
// `Deref` placement policy above. Direct post-target typed comparisons

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add dereference semantics to the typed-value map

The typed-value assertions in all three named harnesses obtain the observed u32 by applying unary * to the returned reference (for example, lines 1631, 1721, and 1804), but this supposedly exact basis omits premise [8], which is the documented language rule connecting that dereference to the referenced location. The direct post-target comparison map below has the same omission. Add [8] to both mappings so the value observations are fully grounded rather than relying only on the zerocopy placement policy and primitive equality.

AGENTS.md reference: zerocopy/AGENTS.md:L67-L73

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

Addressed on exact head 408601076d97cd22429eef20009b719e325d773a. The consumer map now explicitly includes dereference premise [8] for both the source-derived initial typed-value assertions and the direct post-target typed comparisons. This documentation change is preserved in #3663 as well.

Comment thread zerocopy/src/ref.rs Outdated
Comment on lines +1362 to +1363
// importing another as a lemma. The immutable-`Deref` frame additionally
// consumes its placement/value policy above. The separate error-restoration

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge State the immutable Deref non-mutation policy

The immutable-Deref harness checks the entire backing frame after calling Deref::deref, so it will fail if the target returns the correct address and value but also mutates any backing byte as a side effect. The mapped placement/value policy establishes only which referent is returned, not that invoking deref leaves all storage unchanged; explicitly adopt and map immutable-Deref non-mutation as a zerocopy regression policy, or remove this frame assertion from the target-specific harness.

AGENTS.md reference: zerocopy/AGENTS.md:L67-L73

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

Addressed on exact head 408601076d97cd22429eef20009b719e325d773a. The immutable Deref policy and harness scope now expressly require the entire backing byte slice to remain unchanged, and the frame consumer cites that policy. The text identifies this as an adopted zerocopy regression policy, not a guarantee inferred from Rust or the Deref trait. The same qualification is preserved in #3663.

*Authored by an AI agent acting on Josh Liebow-Feeser's behalf.*

gherrit-pr-id: Glkshhyn2hsme53vnmamjpny6o3s637ys
@joshlf

joshlf commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Authored by an AI agent acting on Josh Liebow-Feeser's behalf.

@codex review

Exact-head review request: 4086010

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Provided git ref 408601076d97cd22429eef20009b719e325d773a does not exist
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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