Skip to content

Fixed iteration tests#303

Merged
transistive merged 31 commits into
mainfrom
stub-iteration-1
Jul 2, 2026
Merged

Fixed iteration tests#303
transistive merged 31 commits into
mainfrom
stub-iteration-1

Conversation

@p123-stack

Copy link
Copy Markdown
Collaborator

No description provided.

@p123-stack p123-stack marked this pull request as ready for review May 4, 2026 07:25
@transistive transistive changed the base branch from stub-iteration to main May 4, 2026 10:34
Comment thread src/Bolt/BoltConnection.php Outdated
* When one PULL yields RECORD(s) then FAILURE, {@see pull()} defers the {@see Neo4jException} to the next
* {@see BoltResult::fetchResults()} so records are delivered before the error (TestKit pull_2_end_error.script).
*/
private ?Neo4jException $deferredPullFailure = null;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this because of peek? Can you confirm peek is @nothrow against other drivers too? Mention it in the comment here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes — updated the $deferredPullFailure docblock: it’s not peek-only (RECORD+FAILURE in one PULL); peek uses the same path via lazy current(); end-of-stream peek is non-throwing (null), matching official drivers.

/** @var list<int> $ids */
$ids = $path->ids;
/** @var list<int> $indices */
$indices = $path->indices;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this backwards compatible? What happens in a Neo4j 4.4 setting?
Another option is that it is already handled in the bolt library; if so, we need to ensure the minimum version enforces that the Path class has actual indices. Otherwise, this package will break for users.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It’s backwards compatible because our minimum dependency is stefanak-michal/bolt:^7.4, where Path has indices and ids is just a deprecated alias to the same array. So Neo4j 4.4 isn’t an issue here; the only risk would be someone running an older Bolt lib than our constraint. If you want extra safety, we can fall back to ids when indices isn’t present

/**
* Maps driver exceptions to TestKit errorType strings, aligned with other drivers.
*/
final class DriverErrorTypeMapper

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't see this class being used anywhere in testkit-backend. Is this safe to remove?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It wasn't wired up anywhere. DriverErrorResponse still uses get_class($exception), so the mapper was dead code. I've removed DriverErrorTypeMapper and its unit test; no runtime behavior change.

Comment thread src/Bolt/PullResult.php Outdated
*/
private static function normalizeRows(array $rows): array
{
$normalized = [];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The results from the driver are very consistent, why do we need to normalise them?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Removed normalizeRows() — it was only there for Psalm, not runtime. Rows are passed through as-is from $response->content, with types documented at the pull() boundary.

@transistive transistive merged commit f3c3652 into main Jul 2, 2026
16 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