Skip to content

Addition of Saving and Loading of Filter Presets#4755

Open
feyruzb wants to merge 36 commits intoEricsson:masterfrom
feyruzb:feat/filter-preset-feature
Open

Addition of Saving and Loading of Filter Presets#4755
feyruzb wants to merge 36 commits intoEricsson:masterfrom
feyruzb:feat/filter-preset-feature

Conversation

@feyruzb
Copy link
Collaborator

@feyruzb feyruzb commented Jan 15, 2026

This PR adds a filter preset feature to CodeChecker. Users can now create, name, save, and reapply filter configurations for analysis results. Changes touch the Thrift API, server, CLI, frontend, database, and docs.

Filter Preset Feature

Thrift API

  • New FilterPreset struct and endpoints: storeFilterPreset, getFilterPreset, deleteFilterPreset, listFilterPreset in report_server.thrift.

Server

  • Handler methods in report_server.py for store/retrieve/list/delete of filter presets.

Database

  • New filter_presets table via Alembic migration (24c9660f82b1_add_filter_presets_table.py) - columns: id, preset_name (unique), report_filter (JSON).

CLI

  • New filter-preset subcommands: list, new, delete.
  • --filter-preset flag on cmd results to pull in a saved preset. Can't be combined with other filter args - the CLI catches this and errors out.
  • list output: json gives full filter detail; csv, plaintext, and table show a condensed summary of which filters are active.

Frontend

  • New PresetMenu.vue component - dropdown for picking and applying presets.
  • ReportFilter.vue updated to handle save/apply/delete with a dialog UI.
image image

Versioning

  • API and package versions bumped to 6.68.0 .

Docs

  • New "Manage filter presets" section in docs/web/user_guide.md with create/list/delete/apply examples.

Tests

  • test_filter_preset.py - API tests for store, list, delete, and edge cases.
  • test_filter_preset_cmd.py - CLI tests covering all subcommands, duplicates, preset application, and conflicting argument validation.

@feyruzb feyruzb self-assigned this Jan 16, 2026
@feyruzb feyruzb added enhancement 🌟 API change 📄 Content of patch changes API! WIP 💣 Work In Progress GUI 🎨 server 🖥️ web 🌍 Related to the web app new feature 👍 New feature request javascript Pull requests that update JavaScript code (used by DependaBot) python Pull requests that update Python code (used by DependaBot) labels Jan 16, 2026
Copy link
Collaborator

@gulyasgergely902 gulyasgergely902 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall good work, I've found only minor issues (even nitpicks) which can be fixed in no time. Please check the TODOs and comments with question marks and make them clear for the future. What I'm missing are the tests for the new functions. Please check them and write tests in the corresponding unit test folders.

export PATH="$HOME/codechecker/build/CodeChecker/bin:$PATH"

echo "CodeChecker rebuild completed successfully!"
echo "You can now use CodeChecker commands." No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a new line to the end of the file, git can complain about missing new lines at the end of any text files.

Copy link
Collaborator Author

@feyruzb feyruzb Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

// if the id is -1 a new preset filter is created
// the filter preset name must be unique.
// An error must be thrown if another preset exists with the same name.
// The encoding of the name must be unicode. (whitespaces allowed?)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this line, "whitespaces allowed?" suggests me that this part is not yet complete. Please decide if either allowed or not and edit the comment accordingly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

// Filter grouping api calls.
//============================================

// Stores the given FilterPreset with the given id
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got a few questions / remarks regarding this part:

  • Does it check the id of the incoming FilterPreset to decide if it exists or not? If so, please modify the first line accordingly (e.g. "If the a preset exists with the given id, it overwrites the name, and all preset values.")
  • Fix the second line to match the first: "If the preset does not exist yet, it creates it with the given id.".
  • The line "if the id is -1 a new preset filter is created" is confusing so if I add -1 as an id, it forcibly creates the filter? And if so, what will be the actual id after creation?
  • Please make all new sentences start with a capital letter and finish with a dot.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

FilterPreset getFilterPreset(1: i64 id)
throws (1: codechecker_api_shared.RequestFailed requestError);

// Removes the filterpreset with the given id
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be written as "FilterPreset" to be uniform to the other comments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

description=description))
return results

# Stores the given FilterPreset with the given id
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest you do the same modifications I've suggested above for the same comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

if preset is None:
return None

# convert ORM to dict for ReportFilter
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# convert ORM to dict for ReportFilter
# Convert ORM to dict for ReportFilter

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

if not token:
return ""

# special case for formatting confirmed bug. IN UI for some reason
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# special case for formatting confirmed bug. IN UI for some reason
# Special case for formatting confirmed bug. IN UI for some reason

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

session.add(preset_entry)
session.commit()
return int(preset_entry.id)
return -1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a terrible thing but some linters may complain about using magic numbers. You could create a const for it either here or in a global file (there might be already a file for status and error codes in codechecker) which you could use as a return value. E.g. FILTER_PRESET_ERROR = -1 or similar.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Delete preset from products list based on preset_id.
"""
self.__require_admin()
LOG.info("deleting filter preset by id")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LOG.info("deleting filter preset by id")
LOG.info("Deleting filter preset by ID")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Returns the FilterPreset identified by id.
"""
self.__require_view()
LOG.info("Returning filter Preset by id")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LOG.info("Returning filter Preset by id")
LOG.info("Returning filter Preset by ID")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@gulyasgergely902
Copy link
Collaborator

One more thing which I've missed: Besides the unit tests, please also write functional tests, for the API too.

@feyruzb feyruzb force-pushed the feat/filter-preset-feature branch 14 times, most recently from 3383a3f to a738d47 Compare February 18, 2026 16:04
@feyruzb feyruzb force-pushed the feat/filter-preset-feature branch 2 times, most recently from e9bf3e3 to 024a4a2 Compare March 16, 2026 17:49
@feyruzb feyruzb force-pushed the feat/filter-preset-feature branch from 024a4a2 to 08900d2 Compare March 16, 2026 18:01
@feyruzb feyruzb changed the title Addition of Saving and Loading of Filter Presets [WIP] Addition of Saving and Loading of Filter Presets Mar 16, 2026
@feyruzb feyruzb removed the WIP 💣 Work In Progress label Mar 16, 2026
@feyruzb feyruzb linked an issue Mar 16, 2026 that may be closed by this pull request
@feyruzb feyruzb force-pushed the feat/filter-preset-feature branch from ab9bbd4 to 288e2e7 Compare March 16, 2026 18:52
@feyruzb feyruzb force-pushed the feat/filter-preset-feature branch 2 times, most recently from 8a0ecce to 4560dd2 Compare March 17, 2026 15:07
@feyruzb feyruzb force-pushed the feat/filter-preset-feature branch 3 times, most recently from c8dfa22 to 29fa58a Compare March 18, 2026 10:47
@feyruzb feyruzb force-pushed the feat/filter-preset-feature branch from 29fa58a to 009748f Compare March 18, 2026 10:53
@feyruzb feyruzb added this to the release 6.28.0 milestone Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API change 📄 Content of patch changes API! enhancement 🌟 GUI 🎨 javascript Pull requests that update JavaScript code (used by DependaBot) new feature 👍 New feature request python Pull requests that update Python code (used by DependaBot) server 🖥️ web 🌍 Related to the web app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Track 'Filter Preset' Feature: Saving and Loading (PR #4755)

3 participants