Skip to content

Reject unequal-length iterables in is_close - #955

Open
remote-controlled-man wants to merge 1 commit into
AnswerDotAI:mainfrom
remote-controlled-man:codex/prflow-d59ebba17d84
Open

remote-controlled-man wants to merge 1 commit into
AnswerDotAI:mainfrom
remote-controlled-man:codex/prflow-d59ebba17d84

Conversation

@remote-controlled-man

Copy link
Copy Markdown

is_close() compares iterable inputs with zip(), so it ignores extra elements. As a result, test_close([1], [1, 999]), comparisons against an empty sequence, and nested length mismatches all pass when they should fail.

Use zip_longest() with a unique missing-value sentinel to reject unmatched elements before the recursive comparison. The change is in the owning notebook and its generated Python module. Scalar, string and array comparisons retain their existing paths.

Regression tests cover unequal lengths in both directions, empty and nested sequences, None values and iterators, alongside valid tolerance comparisons. The initial test_close regression fails on unmodified main and passes with this fix.

Validation on macOS / Python 3.12:

  • Full nbdev-test --n-workers 2 suite: passed.
  • Owning notebook nbdev-test nbs/00_test.ipynb --n-workers 1: passed.
  • Native notebook cleaning and export: passed; regenerating leaves the committed notebook, module and index unchanged.
  • git diff --check: passed.

Prepared with OpenAI Codex.

Copilot AI balanced review requested due to automatic review settings October 31, 2026 17:28

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

This branch has not been deployed

No deployments
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