Skip to content

Read GLPI 12's empty SLA/OLA reference arrays as none (0.6.9) - #48

Merged
baraline merged 2 commits into
mainfrom
fix/glpi12-empty-ola
Nov 10, 2026
Merged

baraline merged 2 commits into
mainfrom
fix/glpi12-empty-ola

Conversation

@baraline

@baraline baraline commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Problem

GLPI 12.0.1 sends ola_ttr and ola_tto as an empty array, [], on every ticket that has no OLA. Its own v2.3 OpenAPI contract, like GLPI 11, declares a nullable {"id", "name"} object for both fields.

GetTicket types these fields IdNameRef | None, so it refuses the array. Against a GLPI 12 server, get_ticket, and every search that returns such a ticket, raises ValidationError.

Change

  • All six SLA and OLA references of GetTicket go through one before-validator that reads an empty list as None: sla_ttr, sla_tto, sla_level_ttr, ola_ttr, ola_tto and ola_level_ttr.
  • Other values pass through unchanged, so an object and null read as before.
  • The SLA fields are covered too, even though only the OLA fields were seen as []. They share the reference shape, so the same quirk on any of them can't fail a ticket read.
  • Write models are untouched.
  • Version bumped to 0.6.9, with a CHANGELOG entry.

Evidence

Measured against a GLPI 12.0.1 server:

  • Every ticket came back with ola_ttr: [] and ola_tto: [], including tickets that carry an SLA. The SLA fields came back as an object or null.
  • The same reads against GLPI 11.0.8 return null for the OLA fields.
  • An RSQL filter on ola_ttr.id answers HTTP 500 on 12.0.1, so I couldn't observe what a populated OLA looks like there. This change makes no assumption about it.

Tests

  • New tests, parametrised over all six fields:
    • [] reads as None.
    • An object and null read as before.
  • A GLPI 12 ticket shape (an SLA, no OLA) reads correctly.
  • Mutation check: reverting a single field to plain IdNameRef | None fails exactly that field's [] case.
  • A saved GLPI 12 ticket payload validates without any workaround.
  • Local checks all pass:
    • pytest -m "not integration" -W error::RuntimeWarning: 2256 passed, coverage 98.07%
    • ruff check, ruff format --check, strict mypy
    • unasync_build.py --check
    • sphinx -W

🤖 Generated with Claude Code

…ads work against a GLPI 12 server

GLPI 12.0.1 sends `ola_ttr` and `ola_tto` as `[]` on every ticket without an OLA. Its own v2.3 contract, like GLPI 11, declares a nullable `{"id", "name"}` object there. `GetTicket` typed both fields `IdNameRef | None` and refused the array. Every `get_ticket`, and every search that returns a ticket without an OLA, therefore raised `ValidationError` against GLPI 12.

`ola_ttr`, `ola_tto` and `ola_level_ttr` now go through a before-validator that turns an empty list into `None` and passes every other value on unchanged. An OLA object and `null` read as before. The SLA fields are untouched: GLPI 12 still sends them as an object or `null`.

Measured against a GLPI 12.0.1 server:
- Every ticket read came back with `ola_ttr: []` and `ola_tto: []`, including tickets that carry an SLA.
- An RSQL filter on `ola_ttr.id` answers HTTP 500, so a populated OLA's shape on GLPI 12 could not be observed, and this change makes no assumption about it.
- A saved GLPI 12 ticket payload now validates unchanged.

The new test fails on the old model and passes with the fix. The version moves to 0.6.9.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov-commenter

codecov-commenter commented Nov 10, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.06%. Comparing base (af750ee) to head (8e9bd4e).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #48   +/-   ##
=======================================
  Coverage   98.06%   98.06%           
=======================================
  Files          94       94           
  Lines        3719     3726    +7     
=======================================
+ Hits         3647     3654    +7     
  Misses         72       72           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…cket, not only the OLA ones

On GLPI 12.0.1 only `ola_ttr` and `ola_tto` were seen as `[]`. The SLA references (`sla_ttr`, `sla_tto`, `sla_level_ttr`) use the same reference shape, so they now read through the same before-validator, and the same quirk on any of them cannot fail a ticket read. The alias `_OlaRef` is renamed `_LevelAgreementRef`.

The tests are parametrised over all six fields:
- `[]` reads as `None`.
- An object reads as before.
- `null` reads as before.
- A GLPI 12 ticket shape with an SLA and no OLA reads correctly.
Reverting `sla_ttr` alone to plain `IdNameRef | None` fails exactly its own `[]` case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@baraline baraline changed the title Read GLPI 12's empty ola_ttr / ola_tto arrays as no OLA (0.6.9) Read GLPI 12's empty SLA/OLA reference arrays as none (0.6.9) Nov 10, 2026
@baraline
baraline merged commit a07b630 into main Nov 10, 2026
7 checks passed
@baraline
baraline deleted the fix/glpi12-empty-ola branch November 10, 2026 09:47
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