Skip to content

tract-harvest-probe: check run inputs against resolved facts; Pow exponent must not grow the base - #1851

Merged
AdaWorldAPI merged 2 commits into
mainfrom
ccr-0161f442-un1mrc
Oct 30, 2026
Merged

AdaWorldAPI merged 2 commits into
mainfrom
ccr-0161f442-un1mrc

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Summary

Fixes the two Codex P2 findings on #1850. The fix was pushed a few minutes after #1850 merged, so it never reached main. This PR carries only that commit (a093d65d2): 3 files in crates/tract-harvest-probe.

  • Run-time inputs are checked against the resolved facts. Plan::run used to accept any value as input. A caller could pass X shaped [2,3]; it reached the rank-1 ReduceSum DO, which admits only rank 1, and was summed flat into a wrong scalar. run now refuses an input unless it is a graph input with the dtype, rank and known dimensions the plan was resolved for (a symbolic dimension accepts any size). It also refuses an attempt to overwrite an initializer.
  • The Pow exponent must not grow the base. guard_pow2 checked only that every exponent element was 2.0. do_pow2 ignores the exponent and returns Mul(x, x), so an exponent that broadcasts wider than the base ([1] ^ [2]) produced the wrong output shape. The WHEN now also requires that broadcasting the exponent against the base leaves the base shape unchanged. It is FALSE otherwise, and UNKNOWN against a symbolic base dimension.

Test plan

  • cargo fmt, cargo clippy --release --all-targets -D warnings
  • cargo test --release --no-fail-fast -- --include-ignored: 22 passed. New: inputs_outside_the_resolved_facts_are_refused and registry::tests::pow2_requires_the_exponent_not_to_grow_the_base.
  • Disable runs: removing either check makes exactly its own test fail.

Generated by Claude Code

…onent must not grow the base

Codex P2 (#1850): run() bound caller inputs without checking the facts
the WHEN guards held on, so X as [2,3] reached the rank-1 ReduceSum DO
and was summed flat. Inputs are now refused unless they are graph inputs
with the resolved dtype, rank and known dims.

Codex P2: guard_pow2 checked only the exponent's values; do_pow2
ignores the exponent, so a broadcasting exponent ([1] ^ [2]) gave the
wrong output shape. WHEN now also requires broadcasting e against x to
leave x's shape unchanged (FALSE, or UNKNOWN for a symbolic base dim).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMMjKnig6MXTd41Lf2v
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b4f2eda2-66df-4863-bcb4-49ff0dcae942
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review October 30, 2026 07:47
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 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 ✅ Completed 2026-10-30T07:48:12.784318Z fee95c2 Draft marked ready
ℹ️ 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.

@AdaWorldAPI
AdaWorldAPI merged commit f2bbd27 into main Oct 30, 2026
10 checks passed
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