Skip to content

Add tests, improve code quality and support compose lock file#85

Draft
iignatevich wants to merge 1 commit into
mainfrom
add_tests
Draft

Add tests, improve code quality and support compose lock file#85
iignatevich wants to merge 1 commit into
mainfrom
add_tests

Conversation

@iignatevich

Copy link
Copy Markdown
Collaborator
  • Add unit and integration tests for sync logic
  • Add compose lock file support
  • Add make targets: install-bin, test-race, test-integration
  • Improve code quality
  • Fix race condition: use local errR instead of shared err variable in goroutine closure (findResourcesChangeTime)
  • Replace buildHackAuthor sentinel string with explicit overridden bool field in hashStruct
  • Remove dead commented-out code (GetChangedResources, getMapKeys, maxWorkers, list recursion)
  • Add todo comments for operator precedence bug in extractLinesWithVariables and strings.Contains error matching

- Add unit and integration tests for sync logic
- Add compose lock file support
- Add make targets: install-bin, test-race, test-integration
- Improve code quality
- Fix race condition: use local errR instead of shared err variable in goroutine closure (findResourcesChangeTime)
- Replace buildHackAuthor sentinel string with explicit overridden bool field in hashStruct
- Remove dead commented-out code (GetChangedResources, getMapKeys, maxWorkers, list recursion)
- Add todo comments for operator precedence bug in extractLinesWithVariables and strings.Contains error matching
@iignatevich
iignatevich marked this pull request as draft March 23, 2026 09:22
@gemini-code-assist

Copy link
Copy Markdown

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 focuses on bolstering the project's robustness and developer experience. It introduces a thorough testing suite for the synchronization mechanism, integrates modern dependency management with compose lock files, and provides new utility make targets. These changes collectively aim to enhance the stability, predictability, and ease of development within the project.

Highlights

  • Comprehensive Testing: Implemented extensive unit and integration tests for the synchronization logic, significantly improving test coverage and reliability.
  • Compose Lock File Support: Introduced support for compose lock files, enhancing dependency management and ensuring consistent builds.
  • New Make Targets: Added install-bin, test-race, and test-integration make targets to streamline development workflows and testing processes.
  • Code Quality Improvements: Addressed a race condition, replaced a sentinel string with an explicit boolean field, removed dead code, and added TODO comments for future enhancements.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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.

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.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This is an excellent pull request that significantly improves the project's quality and functionality. You've added a comprehensive suite of unit and integration tests, which is a huge step forward for maintainability and stability. The support for compose.lock files is a great enhancement.

The code quality improvements are also very valuable, especially the fix for the race condition in findResourcesChangeTime and the refactoring to remove the buildHackAuthor sentinel string in favor of a clearer overridden boolean flag. The removal of dead code and the addition of new Makefile targets are also welcome changes.

I have one suggestion regarding a bug you've already identified with a @todo comment. I believe it's better to fix it now to prevent potential issues with variable dependency analysis. See my specific comment for details.

Overall, great work on this PR!

// parentheses around the OR condition. Fix: add parentheses around (Contains("{{") || Contains("}}")).
// Before fixing, verify there are no real cases where {{ and }} appear on separate lines
// in Ansible templates (e.g. multiline Jinja2 expressions), as the fix would break those.
if len(line) > 0 && !strings.HasPrefix(line, "#") && strings.Contains(line, "{{") || strings.Contains(line, "}}") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

You've correctly identified an operator precedence bug here. The current logic ... && strings.Contains(line, "{{") || strings.Contains(line, "}}") will incorrectly process commented-out lines if they contain }}, because && has higher precedence than ||. This could lead to incorrect variable dependency analysis.

I recommend fixing this now by adding parentheses as you suggested in the @todo: (strings.Contains(line, "{{") || strings.Contains(line, "}}")).

Regarding your concern about multiline Jinja2 expressions, this change should handle them correctly. It will include any non-comment line that is part of a multiline expression (i.e., contains {{ or }}), which seems to be the desired behavior.

Suggested change
if len(line) > 0 && !strings.HasPrefix(line, "#") && strings.Contains(line, "{{") || strings.Contains(line, "}}") {
if len(line) > 0 && !strings.HasPrefix(line, "#") && (strings.Contains(line, "{{") || strings.Contains(line, "}}")) {

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