History/cache: add search options endpoints and extend project cache#343
Open
ol-nata wants to merge 5 commits into
Open
History/cache: add search options endpoints and extend project cache#343ol-nata wants to merge 5 commits into
ol-nata wants to merge 5 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Info
This PR adds two new
GETendpoints toHistoryViewSetfor populating search option dropdowns on the history page. It also extends the project cache to cover branches, revisions, and labels alongside tags, so thatmetas_search_optionscan serve responses without hitting the database.Overview of changes
Cache
_TagsCacheis 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 pathproject(integer; optional) — project ID to filter resultsResponse data:
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 resultsResponse data:
{ "tags": { "important": ["tag1=val1"], "relevant": ["tag2=val2"], "all": ["tag1=val1", "tag2=val2"] }, "branches": ["branch=main"], "revisions": ["revision=abc123"], "labels": ["label=nightly"] }