Skip to content

HYPERFLEET-1141 - docs: polish code-review standards#149

Open
kuudori wants to merge 4 commits into
openshift-hyperfleet:mainfrom
kuudori:HYPERFLEET-1141
Open

HYPERFLEET-1141 - docs: polish code-review standards#149
kuudori wants to merge 4 commits into
openshift-hyperfleet:mainfrom
kuudori:HYPERFLEET-1141

Conversation

@kuudori
Copy link
Copy Markdown
Contributor

@kuudori kuudori commented May 29, 2026

Summary

  • Updates error-handling.md ERR-01 with exception for read-only defer close (resp.Body.Close(),
    rows.Close()) — resolves unresolved PR HYPERFLEET-1073 - docs: add code review standards index #147 nit from @pnguyen44

  • Updates error-handling.md ERR-03 from stdlib-only patterns to framework-agnostic principle ("any
    error-response write")

  • Updates concurrency.md CONC-03 to lead with Go 1.22+ version gate instead of burying it in a Note

  • Updates testing.md TEST-03 exception and Enforcement section to document both integration test separation
    approaches (directory-only and directory-plus-build-tag)

  • HYPERFLEET-1141

Test Plan

  • Unit tests added/updated
  • make test-all passes
  • make lint passes
  • Helm chart changes validated with make test-helm (if applicable)
  • Deployed to a development cluster and verified (if Helm/config changes)
  • E2E tests passed (if cross-component or major changes)

kuudori added 3 commits May 29, 2026 11:05
…aden ERR-03

Add exception for read-only defer close (resp.Body.Close(), rows.Close())
where error is not actionable — MAY use bare defer without blank identifier.
Resolves unresolved PR openshift-hyperfleet#147 nit from pnguyen44.

Broaden ERR-03 from stdlib-only (http.Error, w.WriteHeader) to
framework-agnostic principle covering any error-response write.
Restructure CONC-03 so Go 1.22+ skip is the first thing reviewers
see, not buried in a Note after the MUST. Go 1.22 introduced
per-iteration scoping that eliminates loop variable capture bugs.
…ches

Document that all repos use test/integration/ directory, some additionally
use //go:build integration build tags. Both patterns valid. Reviewers
MUST NOT flag one approach when the project consistently uses the other.
@openshift-ci openshift-ci Bot requested review from ldornele and rh-amarin May 29, 2026 16:18
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 29, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign vkareh for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: df630468-d663-4f8a-ae5a-7b60bfacac98

📥 Commits

Reviewing files that changed from the base of the PR and between b7c39a3 and 424710b.

📒 Files selected for processing (1)
  • hyperfleet/standards/code-review/error-handling.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • hyperfleet/standards/code-review/error-handling.md

📝 Walkthrough

Summary by CodeRabbit

  • Documentation
    • Updated code review standards for concurrency with Go version-specific guidance for loop variable capture.
    • Refined error-handling standards with exceptions for read-only resource cleanup and clarified HTTP error response handling requirements.
    • Clarified integration test recognition using directory placement and build tag patterns.

Walkthrough

This PR updates three HyperFleet Go code review standard documents. The concurrency standard clarifies that CONC-03 (loop variable capture) does not apply to Go 1.22+ projects and requires reviewers to verify go.mod before flagging. The error-handling standard adds an exception permitting bare defer for read-only cleanup and refines ERR-03 to require return after 4xx/5xx error responses only. The testing standard specifies integration test recognition via test/integration/ directory and optional //go:build integration tag, allowing consistent project approaches without reviewer objection.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title directly summarizes the main change: documentation refinements to code-review standards across three files.
Description check ✅ Passed The description is well-related to the changeset, detailing specific updates to three standards files (error-handling, concurrency, testing) with clear rationales.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Sec-02: Secrets In Log Output ✅ Passed PR modifies documentation only; no Go code files exist in repo or were modified. SEC-02 check for secrets in log statements is not applicable.

✏️ 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

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

@kuudori
Copy link
Copy Markdown
Contributor Author

kuudori commented May 29, 2026

/retest

_ = resp.Body.Close() // best-effort cleanup; error already logged by HTTP client
```

**Exception — read-only defer close:** `defer` close calls on read-only resources (e.g., `resp.Body.Close()`, `rows.Close()`) where the error is not actionable MAY use bare `defer` without a blank identifier or comment. This is idiomatic Go for read-only cleanup.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"Read-only resources" is broad enough to be misapplied to db.Close() or conn.Close() where close errors signal data loss. Consider scoping to an explicit safe list (resp.Body.Close(), rows.Close()) and noting the exception does NOT apply to writable resources (files, DB connections, gRPC streams).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right, close errors on writable resources need to be handled.

…rion

Reword defer close exception: criterion is whether resource was written
to and close may flush, not resource type. Read-only file.Close() stays
in exception, but writable file/DB handle close MUST be handled since
it can signal data loss.
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