Skip to content

History/cache: add search options endpoints and extend project cache#343

Open
ol-nata wants to merge 5 commits into
ts-factory:mainfrom
ol-nata:feat/history
Open

History/cache: add search options endpoints and extend project cache#343
ol-nata wants to merge 5 commits into
ts-factory:mainfrom
ol-nata:feat/history

Conversation

@ol-nata

@ol-nata ol-nata commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Info

This PR adds two new GET endpoints to HistoryViewSet for populating search option dropdowns on the history page. It also extends the project cache to cover branches, revisions, and labels alongside tags, so that metas_search_options can serve responses without hitting the database.

Overview of changes

Cache

_TagsCache is replaced with _MetasCache, which stores tags, branches, revisions, and labels under separate keys. All call sites updated accordingly.

API

GET /bublik/api/v2/history/params_search_options/

Returns available parameter name/value pairs for a given test, for use in search option dropdowns.

Query parameters:

  • test_name (string; required) — test name or full path
  • project (integer; optional) — project ID to filter results

Response data:

["param1=value1", "param1=value2", "param2=value1"]

GET /bublik/api/v2/history/metas_search_options/

Returns available tags, branches, revisions, and labels, for use in search option dropdowns.

Query parameters:

  • project (integer; optional) — project ID to filter results

Response data:

{
    "tags": {
        "important": ["tag1=val1"],
        "relevant": ["tag2=val2"],
        "all": ["tag1=val1", "tag2=val2"]
    },
    "branches": ["branch=main"],
    "revisions": ["revision=abc123"],
    "labels": ["label=nightly"]
}

ol-nata added 5 commits June 27, 2026 02:28
Previously, the tags cache for `project_id=None` relied on
`category__project_id=None` which incorrectly captured tags without
any category via LEFT JOIN, and `category__isnull=True` which excluded
tags categorised in projects from `relevant` and `all`.

For the default context, `important` now uses `project_id__isnull=True`
to correctly match only default categories. `relevant` contains all
tags not in `important`, and `all` contains every tag in the database.

Signed-off-by: Natalia Rybchenko <natalia.rybchenko@oktetlabs.ru>
Previously, tags appearing in a project's runs were excluded from the
project's cache if they had been categorised in another project, since
the uncategorised filter relied on `category__isnull=True`.

The cache is now populated from tags actually appearing in that
project's runs, filtered via a direct JOIN on `MetaResult` and
`TestIterationResult`. Tags not categorised for the project are treated
as uncategorised and included in `relevant` and `all`, regardless of
whether they are categorised in other projects.

Signed-off-by: Natalia Rybchenko <natalia.rybchenko@oktetlabs.ru>
Introduce `_MetasCache` to replace `_TagsCache`, extending the project
cache to cover branches, revisions, and labels alongside tags. All meta
types are stored under separate keys: `important_tags`, `relevant_tags`,
`all_tags`, `branches`, `revisions`, and `labels`.

All call sites updated accordingly: `ProjectCache.tags` replaced with
`ProjectCache.metas`, cache keys renamed to match the new scheme.

Signed-off-by: Natalia Rybchenko <natalia.rybchenko@oktetlabs.ru>
Provide an endpoint for fetching available parameter values for a given
test, optionally filtered by project, to populate search option
dropdowns on the history page.

Signed-off-by: Natalia Rybchenko <natalia.rybchenko@oktetlabs.ru>
Provide an endpoint for fetching available tags, branches, revisions,
and labels, optionally filtered by project, to populate search option
dropdowns on the history page.

Signed-off-by: Natalia Rybchenko <natalia.rybchenko@oktetlabs.ru>
@ol-nata ol-nata changed the title History: add search options endpoints and extend project cache History/cache: add search options endpoints and extend project cache Jul 6, 2026
@ol-nata ol-nata requested a review from okt-limonikas July 6, 2026 19:33
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.

1 participant