Skip to content

Fix detection of Golang project layout#435

Open
mmorhun wants to merge 1 commit into
ambient-code:mainfrom
mmorhun:fix-golang-dir-layout
Open

Fix detection of Golang project layout#435
mmorhun wants to merge 1 commit into
ambient-code:mainfrom
mmorhun:fix-golang-dir-layout

Conversation

@mmorhun
Copy link
Copy Markdown

@mmorhun mmorhun commented May 15, 2026

Assisted-by: Claude

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test coverage improvement

Related Issues

Relates to #378

Changes Made

  • Fix the logic of Golang project detection: if go.mod found assume we deal with a Golang project
  • Added tests

Testing

  • Unit tests pass (pytest)
  • Integration tests pass
  • Manual testing performed on a local real repos
  • No new warnings or errors

Checklist

  • My code follows the project's code style
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Additional Notes

Before the fix on an Golang k8s operator:

standard_layout                     ❌ FAIL         0/2 directories (need: 2/2 directories)

After the fix:

standard_layout                     ✅ PASS         100/100 

Summary by CodeRabbit

  • Improvements

    • Improved Go project detection: module-file presence now takes precedence to correctly identify Go layouts in mixed-language repositories.
  • Tests

    • Added unit tests to verify Go-detection precedence and to guard against mixing Go and non-Go layout evidence in mixed repositories.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: d3cf8873-a8dd-4c25-9617-6e0cb1f05fc4

📥 Commits

Reviewing files that changed from the base of the PR and between 984d11e and 58a4921.

📒 Files selected for processing (2)
  • src/agentready/assessors/structure.py
  • tests/unit/test_assessors_structure.py

📝 Walkthrough

Walkthrough

StandardLayoutAssessor.assess() now checks for go.mod module roots early to identify Go projects and route to _assess_go_layout(); tests assert Go evidence (go.mod + cmd/ or internal/) and ensure Go detection wins over large Python directories.

Changes

Go Module Detection

Layer / File(s) Summary
Go module root detection
src/agentready/assessors/structure.py
StandardLayoutAssessor.assess() calls _find_go_module_roots() early to detect Go projects by go.mod location before applying standard-layout directory logic, replacing the prior primary-language-based gate.
Go layout validation tests
tests/unit/test_assessors_structure.py
Two test cases verify the assessor reports Go-specific evidence (go.mod + cmd//internal/) when go.mod is present, and that Go detection dominates even when the repository also contains a large Python source tree.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title does not follow Conventional Commits format; it lacks the required type(scope): structure. Reformat to Conventional Commits: 'fix(assessors): improve Go project layout detection' or similar, including a type prefix and scope.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/unit/test_assessors_structure.py`:
- Around line 908-912: The current assertion using evidence_str is too
permissive; update the check so that when "src/" appears it must be accompanied
by clear Go indicators. Replace the single permissive assert on evidence_str
with logic: if "src/" in evidence_str.lower(): assert "source" not in
evidence_str.lower() and ( "go.mod" in evidence_str.lower() or "module " in
evidence_str.lower() or re.search(r"\bpackage\s+\w+", evidence_str.lower()) ),
otherwise allow evidence_str to omit "src/". This uses the existing evidence_str
variable to ensure "src/" presence actually reflects a Go layout.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 3abdf512-a64f-4f94-b0f6-60dd342d48db

📥 Commits

Reviewing files that changed from the base of the PR and between 312c99a and 984d11e.

📒 Files selected for processing (2)
  • src/agentready/assessors/structure.py
  • tests/unit/test_assessors_structure.py

Comment thread tests/unit/test_assessors_structure.py Outdated
Signed-off-by: Mykola Morhun <[email protected]>
Assisted-by: Claude
@mmorhun mmorhun force-pushed the fix-golang-dir-layout branch from 984d11e to 58a4921 Compare May 15, 2026 08:28
@mmorhun
Copy link
Copy Markdown
Author

mmorhun commented May 15, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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