Skip to content

SED-4417-grid-layout-for-executions-report#118

Open
david-stephan wants to merge 4 commits intomasterfrom
SED-4417-grid-layout-for-executions-report
Open

SED-4417-grid-layout-for-executions-report#118
david-stephan wants to merge 4 commits intomasterfrom
SED-4417-grid-layout-for-executions-report

Conversation

@david-stephan
Copy link
Contributor

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces ObjectId fields to the AbstractTrackedObject class for tracking the specific user IDs responsible for an object's creation and last modification. This enhancement provides more granular user-level auditing capabilities, laying foundational groundwork for improved user management or reporting features.

Highlights

  • User ID Tracking: Added creationUserId and lastModificationUserId fields of type ObjectId to the AbstractTrackedObject class.
  • Accessor Methods: Implemented corresponding getter and setter methods for the newly introduced creationUserId and lastModificationUserId fields.
  • Dependency Import: Imported org.bson.types.ObjectId to support the new user ID fields.
Changelog
  • step-framework-model/src/main/java/step/core/accessors/AbstractTrackedObject.java
    • Imported org.bson.types.ObjectId.
    • Added creationUserId and lastModificationUserId fields.
    • Implemented getter and setter methods for the new user ID fields.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces user ID tracking for object creation and modification in AbstractTrackedObject by adding creationUserId and lastModificationUserId fields of type ObjectId. The changes are straightforward, but there are a couple of points for consideration. Firstly, the use of org.bson.types.ObjectId may impact database portability, particularly for PostgreSQL, and needs careful handling. Secondly, the changes are not accompanied by tests to verify the persistence of the new fields. I've added comments with more details on these points. Also, the PR title 'SED-4417-grid-layout-for-executions-report' does not seem to match the content of the changes, which might cause confusion.


private Date creationDate;
private String creationUser;
private ObjectId creationUserId;

Choose a reason for hiding this comment

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

high

The new field creationUserId (and lastModificationUserId on line 38) uses org.bson.types.ObjectId. This introduces a dependency on the BSON library, which is specific to MongoDB. Given that the project also supports PostgreSQL (as suggested by the step-framework-collections-postgresql module), this could cause issues with persistence on non-MongoDB databases. Please ensure that there is a clear strategy for handling ObjectId types in PostgreSQL, for example, by mapping them to a VARCHAR or UUID type. If this model is intended to be database-agnostic, using a more standard type like java.util.UUID or String for IDs might be a more portable solution.

Comment on lines +76 to +90
public ObjectId getCreationUserId() {
return creationUserId;
}

public void setCreationUserId(ObjectId creationUserId) {
this.creationUserId = creationUserId;
}

public ObjectId getLastModificationUserId() {
return lastModificationUserId;
}

public void setLastModificationUserId(ObjectId lastModificationUserId) {
this.lastModificationUserId = lastModificationUserId;
}

Choose a reason for hiding this comment

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

medium

While these getters and setters are correctly implemented, the pull request does not seem to include any new or updated tests to verify that the creationUserId and lastModificationUserId fields are correctly persisted and retrieved. Adding test coverage for new functionality is crucial for maintaining code quality and preventing future regressions. Please consider adding tests that cover these new fields.


private Date creationDate;
private String creationUser;
private ObjectId creationUserId;
Copy link
Contributor

Choose a reason for hiding this comment

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

@david-stephan Not sure about the introduction of these 2 new fields. Many places in Step refer to the username as the key for the user and I don't think we support its change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jeromecomte Step does support to edit and rename users in the users' admin settings.. This was my comment on the JIRA ticket as reference: "I added the user ID to the tracked object metadata because it is safer to use to verify if the authenticated user is the owner of the layout (otherwise if the user is renamed, the logic wouldn’t work anymore). We have other entities that extends Tracked objects (parameters, AP, resources, alerting rules) but only as information, so I did not touch them (the user IDs will remain null for them)."

Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed, let's use the username as key and implement hooks to change the properties referencing usernames upon username change

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.

2 participants