Skip to content

ROX-28697: remove GetAll generator#14947

Merged
janisz merged 2 commits intomasterfrom
ROX-28697_remove_get_all
Apr 10, 2025
Merged

ROX-28697: remove GetAll generator#14947
janisz merged 2 commits intomasterfrom
ROX-28697_remove_get_all

Conversation

@janisz
Copy link
Contributor

@janisz janisz commented Apr 10, 2025

Description

GetAll was deprecated and removed. There is no need to keep code generation for it.

  • CHANGELOG update is not needed
  • Documentation is not needed

Testing

  • inspected CI results

Automated testing

  • modified existing tests
  • contributed no automated tests

How I validated my change

CI

Summary by Sourcery

Remove deprecated GetAll generator and related code generation functionality across multiple files

Enhancements:

  • Remove code generation flag and implementation for GetAll method in PostgreSQL stores

Chores:

  • Clean up code generation templates and store interfaces to remove GetAll method

@janisz janisz requested a review from a team as a code owner April 10, 2025 09:25
@janisz janisz requested review from mtodor and rhybrillou and removed request for a team and rhybrillou April 10, 2025 09:25
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Apr 10, 2025

Reviewer's Guide by Sourcery

This pull request removes the deprecated GetAll method from the postgres store implementation. This includes removing the method from the store interface, the generic store implementation, and the generated code. The pull request also removes the flag to generate the GetAll method and removes the tests for the GetAll method.

Updated class diagram for the Store interface

classDiagram
    class Store {
        <<interface>>
        Search(ctx context.Context, q *v1.Query) ([]search.Result, error)
        Walk(ctx context.Context, fn func(obj PT) error) error
        WalkByQuery(ctx context.Context, q *v1.Query, fn func(obj PT) error) error
        Get(ctx context.Context, id string) (PT, bool, error)
        GetByQuery(ctx context.Context, query *v1.Query) ([]*T, error)
        GetIDs(ctx context.Context) ([]string, error)
    }
    note for Store "GetAll method removed"
Loading

File-Level Changes

Change Details Files
Removed the GetAll method from the Store interface and its implementations.
  • Removed the GetAll method from the Store interface in pkg/search/postgres/store.go.
  • Removed the GetAll implementation from the genericStore struct in pkg/search/postgres/store.go.
  • Removed the GetAll method from the generated Store interfaces.
  • Removed the GetAll method from the generated Store implementations.
pkg/search/postgres/store.go
tools/generate-helpers/pg-table-bindings/store.go.tpl
tools/generate-helpers/pg-table-bindings/test/postgres/store.go
tools/generate-helpers/pg-table-bindings/testuuidkey/postgres/store.go
central/authprovider/datastore/internal/store/postgres/store.go
Removed the GetAll function generation flag.
  • Removed the GetAll flag from the command-line arguments.
  • Removed the GetAll property from the properties struct.
  • Removed the GetAll property from the template arguments.
tools/generate-helpers/pg-table-bindings/main.go
Removed tests for the GetAll method.
  • Removed tests for the GetAll method in the generated store tests.
  • Removed the call to GetAll in the TestStore function.
tools/generate-helpers/pg-table-bindings/store_test.go.tpl
central/authprovider/datastore/internal/store/postgres/store_test.go
tools/generate-helpers/pg-table-bindings/test/postgres/store_test.go
tools/generate-helpers/pg-table-bindings/testuuidkey/postgres/store_test.go
Removed the go:generate directive that included the deprecated flag.
  • Removed the --get-all-func flag from the go:generate directive.
central/authprovider/datastore/internal/store/postgres/gen.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@rhacs-bot
Copy link
Contributor

rhacs-bot commented Apr 10, 2025

Images are ready for the commit at 047b9ce.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.8.x-450-g047b9ce972.

@janisz janisz force-pushed the ROX-28697_remove_get_all branch from b0cb3fd to 8999ee3 Compare April 10, 2025 11:11
Signed-off-by: Tomasz Janiszewski <tomek@redhat.com>
@janisz janisz force-pushed the ROX-28697_remove_get_all branch from 8999ee3 to 6719e19 Compare April 10, 2025 11:15
@codecov
Copy link

codecov bot commented Apr 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 48.95%. Comparing base (8e31f7d) to head (047b9ce).
Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #14947      +/-   ##
==========================================
- Coverage   48.96%   48.95%   -0.01%     
==========================================
  Files        2550     2550              
  Lines      187257   187241      -16     
==========================================
- Hits        91684    91662      -22     
- Misses      88322    88328       +6     
  Partials     7251     7251              
Flag Coverage Δ
go-unit-tests 48.95% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Tomasz Janiszewski <tomek@redhat.com>
@janisz janisz merged commit add1683 into master Apr 10, 2025
89 checks passed
@janisz janisz deleted the ROX-28697_remove_get_all branch April 10, 2025 18:05
janisz added a commit that referenced this pull request Apr 14, 2025
Signed-off-by: Tomasz Janiszewski <tomek@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants