Skip to content

Add a public RSQL date-window builder (retargeted to date_creation) #34

Description

@baraline

Gap

The date_creation window expression is hand-concatenated at three sites: _statistics.py:394-395,
:521-522, :734-735. There is no tested place where the date grammar lives.

Retarget: date_creation, not date_mod

The originally proposed changed_since(dt) names a field this codebase never filters on -- date_mod
appears only as a sort value. It would deduplicate zero existing call sites.

date_mod is a top-level scalar datetime on GetTicket, so such a filter would very likely work; it is a
legitimate forward-looking capability (incremental sync) with no current in-repo caller. But the helper
that pays for itself today is a date_creation window (ge + end-of-day le), which dedupes all
three sites with no live instance required.

Note rsql_all_filter could already have joined those two clauses -- the duplication is partly
self-inflicted.

Placement

The existing six RSQL helpers live in _async/clients/commons/_filters.py and are all private --
glpi_python_client.__all__ (83 names) contains no filter, escape or rsql name. That module is under
_async/, so it is duplicated into the generated tree; adding a public pure-string API there would make it
un-exportable without picking a tree.

Precedent for a tree-neutral home: GlpiEnum.rsql_equals (models/api_schema/enums.py:33) is tree-neutral,
exported from the root, and its docstring states the intent -- "the helper methods keep RSQL string
generation on the public surface." A new glpi_python_client/rsql.py follows that.

Two side-fixes worth doing here

  • Document the GLPI v2 silent-drop behaviour in _filters.py's module docstring and in the skills. It is
    currently recorded only in _statistics.py:47, :154-155, :739, test_statistics.py:282 and
    integration_tests/test_integration.py:478-480 -- nowhere a filter author would look.
  • Switch the hand-built filters at integration_tests/test_integration.py:205,257 to the helpers.

Not a bug

The unquoted embedded space in the current expressions is accepted by live GLPI 11 (the integration tests
drive it through get_ticket_statistics(default_days=...)). Worth tidying, but do not bill it as a fix.

A module-level function is not gated by test_skill_references.py, which scans dir(GlpiClient).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions