#1692·homebox

Maintenance status filter: /v1/maintenance and /v1/entities/{id}/maintenance disagree on future-dated completions

Author: zcohen-nerdCreated Aug 18, 2026Updated Aug 18, 2026
Labels🕷️ bug

First Check

  • This is not a feature request
  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the documentation, with the integrated search.
  • I already read the docs and didn't find an answer.
  • I can replicate the issue inside the Demo install.

Homebox Version

0.26.2

What is the issue you are experiencing?

Found on v0.26.2 (commit e01dd737238a3fa7e1a6454b37de6c6fc88c86e4) while building a maintenance scheduler against the API.

Same symptom as #484 — entries appearing under "Completed" that aren't completed — which was closed, I think on the assumption a PR had resolved it. It still reproduces on current code, and I have a specific cause for at least this variant.

Behaviour

An entry whose completedDate is in the future is classified differently by the two maintenance endpoints, with the same status filter:

Request Result
GET /v1/entities/{id}/maintenance?status=completed excluded — reported as scheduled
GET /v1/maintenance?status=completed included — reported as completed

Cause

GetAllMaintenance omits the DateGT(time.Now()) clause that the per-entity query applies. The per-entity path appears correct; the global path is missing the guard. If #484 was addressed by fixing one query, it looks like the other was missed.

Reproduction

Today is 2026-08-18.

  1. Create a maintenance entry on any entity with completedDate = 2026-12-25
  2. GET /v1/entities/{id}/maintenance?status=completed — entry absent
  3. GET /v1/maintenance?status=completed — entry present

Impact

Anything reading last-completed from the global endpoint to compute a next-due date will use a date that hasn't happened yet. In my case that produced a next-due four months out for a task that was never performed.

More generally, "is this done" having two answers means a client cannot tell which endpoint is authoritative.

Separately, same endpoint

GET /v1/maintenance returns HTTP 500 when status is omitted, despite Swagger marking it optional. The same parameter on /v1/entities/{id}/maintenance genuinely is optional. The client sees only {"error":"Unknown Error"}; the real cause (error="unknown status") appears only in the server log.

Happy to submit a PR adding the missing clause if that's welcome.

How can the maintainer reproduce the issue?

  1. Pick any item. Create a maintenance entry on it with completedDate set to a date in the future — e.g. 2026-12-25.
  2. GET /api/v1/entities/{id}/maintenance?status=completed — the entry is NOT returned.
  3. GET /api/v1/maintenance?status=completed — the same entry IS returned.

Same entry, same filter, opposite classification.

Cause: GetAllMaintenance omits the DateGT(time.Now()) clause that the per-entity query applies.

Separately: GET /api/v1/maintenance with no status parameter returns HTTP 500, though Swagger marks it optional. The same parameter is genuinely optional on the per-entity endpoint.

Deployment

Docker (Linux)

Database Type

SQLite

OS Architechture

x86_64 (AMD, Intel)

Deployment Details

No response