Skip to content

Conversation

@jmikola
Copy link
Member

@jmikola jmikola commented Oct 28, 2025

@jmikola jmikola marked this pull request as ready for review November 3, 2025 04:24
@jmikola jmikola requested a review from a team as a code owner November 3, 2025 04:25
@jmikola jmikola requested review from alcaeus and removed request for a team November 3, 2025 04:25
@GromNaN GromNaN requested a review from Copilot November 11, 2025 21:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements test coverage for binary vector corpus tests as specified in PHPC-2634, including support for FLOAT32, INT8, and PackedBit vector types. The changes provide comprehensive testing for vector encoding, decoding, validation, and edge cases.

Key changes:

  • Added a script to generate PHPT test files from JSON corpus test definitions
  • Generated 26 test files covering various vector types and validation scenarios
  • Implemented prose tests for PackedBit vector behavior with non-zero padded bits

Reviewed Changes

Copilot reviewed 25 out of 26 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scripts/convert-bson-binary-vector-tests.php Script that converts JSON corpus tests into PHPT test files
tests/bson-binary-vector/prose_test-001.phpt Tests encoding PackedBit vectors with non-zero padded bits
tests/bson-binary-vector/prose_test-003.phpt Tests comparison of PackedBit vectors with padding
tests/bson-binary-vector/float32-*.phpt Generated tests for Float32 vector type validation and operations
tests/bson-binary-vector/int8-*.phpt Generated tests for Int8 vector type validation and operations
tests/bson-binary-vector/packed_bit-*.phpt Generated tests for PackedBit vector type validation and operations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


// PackedBit vector with padding:7 and non-zero bits is invalid


Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

[nitpick] Remove extra blank lines (lines 12-13). Only one blank line is needed for separation.

Suggested change

Copilot uses AI. Check for mistakes.
--TEST--
%NAME%
%XFAIL%%SKIPIF%--DESCRIPTION--
Generated by scripts/convert-bson-corpus-tests.php
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

The script name in the generated comment is incorrect. It should reference 'convert-bson-binary-vector-tests.php' instead of 'convert-bson-corpus-tests.php'.

Suggested change
Generated by scripts/convert-bson-corpus-tests.php
Generated by scripts/convert-bson-binary-vector-tests.php

Copilot uses AI. Check for mistakes.
if (isset($case['canonical_bson'])) {
$code .= "throws(function() {\n";
$code .= sprintf(' var_dump(MongoDB\BSON\Document::fromBSON(hex2bin(%s)));', var_export($case['canonical_bson'], true)) . "\n";
$code .= "}, 'MongoDB\Driver\Exception\InvalidArgumentException');";
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

[nitpick] Missing newline character at the end of the string. Add "\n" to maintain consistent formatting with similar statements at lines 169 and 183.

Suggested change
$code .= "}, 'MongoDB\Driver\Exception\InvalidArgumentException');";
$code .= "}, 'MongoDB\Driver\Exception\InvalidArgumentException');" . "\n";

Copilot uses AI. Check for mistakes.
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