PoLine search querying non-existing poLine.acqUnitIds

Description

Purpose/Overview:

With simple order line queries such as

/orders/order-lines?query=paymentStatus==Open

mod-orders will try to use poLine.acqUnitIds, which does not exist.

This warning will be visible in mod-orders-storage:

{color:#000000}WARNING: Doing LIKE search without index for po_line.jsonb->>'acqUnitIds', CQL >>> SQL: acqUnitId{color}
{{ s <> [] >>> lower(f_unaccent(po_line.jsonb->>'acqUnitIds')) NOT LIKE lower(f_unaccent('[]'))}}

The issue is in AcquisitionsUnitsService#buildAcqUnitsCqlExprToSearchRecords. The tableAlias argument is not used when an empty list of ids is retrieved.

The issue was introduced in Juniper by .

Consequences of the issue:

  • All matching order lines are returned for a query of a user who is not associated with any acquisition unit, even order lines of an order with an acquisition unit.

  • Potential slowdown of all order line queries

Requirements/Scope:

Fix buildAcqUnitsCqlExprToSearchRecords.

Approach:

Include tableAlias into NO_ACQ_UNIT_ASSIGNED_CQL.

Acceptance criteria:

Check that a user who is not allowed to see an order line because of acquisition units is indeed not seeing it when doing a query for po lines. Also make sure no warning is visible in mod-orders-storage after fixing.

CSP Request Details

None

CSP Rejection Details

None

Potential Workaround

None

Attachments

1

Checklist

hide

TestRail: Results

Activity

Show:

Damien November 17, 2021 at 2:07 PM

Verified there is no warning in BugFest for these queries.

Damien November 16, 2021 at 4:04 PM

The fix does not make any significant performance change, it's just a tiny bit slower with the new version.

Oleksii Petrenko November 15, 2021 at 9:23 AM

Deployed to Kiwi bugfest. Please proceed with verification

Andriy Kundyukov November 12, 2021 at 11:34 AM

Verified on folio-testing. No warnings appeared in logs after making API calls with different simple order line queries.

Damien November 10, 2021 at 4:17 PM

Checked fix with UI using testing VM, and also checked mod-orders-storage logs.

Done

Details

Assignee

Reporter

Priority

Story Points

Sprint

Development Team

Thunderjet

Fix versions

Release

Lotus R1 2022

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs
Created November 8, 2021 at 9:12 PM
Updated November 25, 2021 at 5:26 PM
Resolved November 12, 2021 at 11:49 AM
TestRail: Cases
TestRail: Runs