Skip to content

PROP-57 - Add status filter for proplets and jobs#180

Open
JeffMboya wants to merge 14 commits intoabsmach:mainfrom
JeffMboya:feat-57
Open

PROP-57 - Add status filter for proplets and jobs#180
JeffMboya wants to merge 14 commits intoabsmach:mainfrom
JeffMboya:feat-57

Conversation

@JeffMboya
Copy link
Copy Markdown
Contributor

@JeffMboya JeffMboya commented Apr 7, 2026

What type of PR is this?

Feature - status-based filtering for proplets and jobs.

What does this do?

  • GET /proplets?status=active|inactive filters by liveness
  • GET /jobs?status=pending|running|completed|failed filters by state
  • GET /tasks returns 400 if ?status= is passed
  • SDK: ListProplets and ListJobs accept optional status param
  • Invalid status values return 400, not 500

Which issue(s) does this PR fix/relate to?

Have you included tests for your changes?

Yes - service-level and filter-pagination tests added.

Did you document any new/modified features?

No - API is self-describing via query param validation errors.

@JeffMboya JeffMboya changed the title feat(manager): add status filter for proplets and jobs PROP - 57: Add status filter for proplets and jobs Apr 7, 2026
@JeffMboya JeffMboya changed the title PROP - 57: Add status filter for proplets and jobs PROP-57 - Add status filter for proplets and jobs Apr 7, 2026
smithjilks and others added 9 commits April 7, 2026 11:59
EncodeError now maps apiutil.ErrValidation and pkgerrors.ErrInvalidValue
to HTTP 400. Invalid status values in ListProplets and ListJobs wrap
ErrInvalidValue so they propagate through EncodeError as Bad Request
rather than falling through to Internal Server Error.
ListTasks does not support status filtering. The endpoint now rejects
any non-empty status query param with 400 Bad Request instead of
silently ignoring it.
Adds Proplet and PropletPage SDK types, and ListProplets(offset, limit,
status) to the SDK interface and propSDK implementation. Status values
"active" and "inactive" are URL-encoded before being appended to the
query string.
Importing net/url for url.QueryEscape also required renaming the local
url variables in all other SDK task functions to avoid shadowing the
imported package (caught by gocritic importShadow).
Covers: active/inactive filter, invalid status returns error, pagination
with filter applied, Interrupted tasks mapping to the failed filter, and
Scheduled tasks mapping to the running filter.
The error now wraps ErrInvalidValue so the message starts with
"invalid value provided" rather than the old literal prefix.
Add ListByAlive to PropletRepository across all four backends (Postgres,
SQLite, Badger, Memory) so GET /proplets?status= filters at the repo
layer instead of scanning all proplets into memory in the service.

Export proplet.AliveTimeout so the service can compute the liveness
cutoff without duplicating the constant. Remove listAllProplets helper.
Cap the Badger in-process filter scan at 100k entries to prevent
unbounded memory growth. Wrap Postgres ListByAlive in a REPEATABLE READ
transaction so COUNT and SELECT see the same snapshot. Replace the
SQLite batch-loop with a single transactional full-table scan to
eliminate the same COUNT/SELECT divergence risk.
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.

Feature: Enable Filtering of Active and Inactive Entities

2 participants