Skip to content

fix(laravel): ParentField pairs the wrong index for nested wildcard parents #59

Closed

Description

@openbotgit

From Code Review Partner's review of #55 (minor, deferred past 3.0.0): for a parent field like items.0.addresses.*.country, ParentField resolves the wildcard against the wrong index, so a child rule can check against another row's country.

Acceptance: a failing test with nested arrays (two items, two addresses each, different countries) passes after the fix; existing rule tests stay green.

Activity

  1. parsilver commented on Nov 16, 2026

    @parsilver
    Collaborator

    Moving to Ready: the acceptance above is enough to build from, and nothing else touches this rule.

  2. parsilver commented on Nov 16, 2026

    @parsilver
    Collaborator

    Work has started on this, on branch fix/59-parentfield-pairs-wrong-index.

  3. parsilver commented on Nov 16, 2026

    @parsilver
    Collaborator

    In progress. Draft PR #65 has the failing test: three nested cases (a fixed outer index with a wildcard inner, two wildcards, and a parent one level up). The first fails today because the outer index fills the wildcard.

    Plan: pair each * in the parent field with the attribute segment at the same position, the way Laravel lines up wildcard keys, instead of taking numeric segments in order. Invariant: the existing single-level pairing (addresses.*.country) and plain field names keep working. Next: the fix, then the full suite and the quality checks on the changed lines.

  4. added a commit that references this issue on Nov 16, 2026
    35e05ab
  5. parsilver commented on Nov 16, 2026

    @parsilver
    Collaborator

    Ready for review: #65. Parent-field wildcards now pair by depth, so each nested address is checked against its own country. The new nested-array test failed before the fix and passes now. The full suite passes (87 passed, 1 skipped), and phpstan and pint are clean. The PR lists the complexity, duplication and mutation numbers. Waiting on review.

    Notes: there is no Infection or coverage driver on this machine, so the mutation check on this PHP repo was run by hand.

  6. parsilver commented on Nov 16, 2026

    @parsilver
    Collaborator

    Fixed in #65 and released as 3.0.1. CI was green on main, and Composer's metadata serves 3.0.1 (composer require farzai/geonames:^3.0.1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions