Skip to content

HYPERFLEET-930 - docs: add CLAUDE.md and AGENTS.md#20

Merged
openshift-merge-bot[bot] merged 2 commits into
mainfrom
HYPERFLEET-930
Jun 2, 2026
Merged

HYPERFLEET-930 - docs: add CLAUDE.md and AGENTS.md#20
openshift-merge-bot[bot] merged 2 commits into
mainfrom
HYPERFLEET-930

Conversation

@kuudori
Copy link
Copy Markdown
Contributor

@kuudori kuudori commented May 26, 2026

Summary

  • HYPERFLEET-930

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)

@openshift-ci openshift-ci Bot requested review from Mischulee and mbrudnoy May 26, 2026 16:57
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds AGENTS.md, a new repository-level documentation file for hyperfleet-broker, covering standardized CI verification workflows (make targets), tool versions (golangci-lint), pre-push execution order, and source-of-truth locations for the broker's public API, config, logger, and test infrastructure. The document also captures architectural constraints including subscription ID/pattern semantics, config precedence and debug logging behavior, RabbitMQ vs Google Pub/Sub health-check differences, DLQ naming and auto-create behavior, required Pub/Sub permissions, and integration-test sequencing limitations. A reference to AGENTS.md is added as the first line of CLAUDE.md.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 59.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding two documentation files (CLAUDE.md and AGENTS.md) to the repository.
Description check ✅ Passed The description references the Jira ticket and indicates documentation files are being added, which aligns with the changeset.
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 adds only markdown documentation (AGENTS.md, CLAUDE.md) with no Go code changes. No log statements found containing secrets, passwords, tokens, or credentials.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch HYPERFLEET-930
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch HYPERFLEET-930

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

@hyperfleet-ci-bot
Copy link
Copy Markdown

hyperfleet-ci-bot Bot commented May 26, 2026

Risk Score: 2 — risk/medium

Signal Detail Points
PR size 73 lines +0
Sensitive paths none +0
Test coverage No _test.go files in diff +2

Computed by hyperfleet-risk-scorer

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: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
broker/error_test.go (1)

82-99: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

False-positive paths in error-handling tests

When expectError is false but err != nil, these branches perform no assertion, so the test can pass incorrectly. Add explicit assert.NoError(t, err) in the non-error path before resource checks.

Suggested fix
-			if tt.expectError {
+			if tt.expectError {
 				assert.Error(t, err)
 				assert.Nil(t, pub)
 				if tt.errorMsg != "" {
 					assert.Contains(t, err.Error(), tt.errorMsg)
 				}
-			} else if err == nil {
+			} else {
+				assert.NoError(t, err)
 				// If no error expected, verify publisher is created
 				// Note: Some publishers might fail on actual use, but creation should succeed
 				assert.NotNil(t, pub)
 				if pub != nil {
@@
-			if tt.expectError {
+			if tt.expectError {
 				assert.Error(t, err)
 				assert.Nil(t, sub)
 				if tt.errorMsg != "" {
 					assert.Contains(t, err.Error(), tt.errorMsg)
 				}
-			} else if err == nil {
+			} else {
+				assert.NoError(t, err)
 				// If no error expected, verify subscriber is created
 				assert.NotNil(t, sub)
 				if sub != nil {

As per coding guidelines, "the error_test.go “missing rabbitmq url” test is a false-passing test due to conditional assertions—don’t treat it as intended behavior".

Also applies to: 170-187

🤖 Prompt for 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.

In `@broker/error_test.go` around lines 82 - 99, The non-error test path currently
skips assertions when err != nil causing false positives; update the test block
that checks tt.expectError to explicitly assert NoError(t, err) when
tt.expectError is false (i.e., replace the "else if err == nil" branch with an
else that first calls assert.NoError(t, err)), then assert.NotNil(t, pub) and
only after that defer closing pub (so the defer runs after successful creation).
Apply the same change to the other similar block mentioned (lines 170-187) so
both test cases validate err with assert.NoError(t, err) before inspecting or
deferring pub.Close().
🤖 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 @.golangci.yml:
- Around line 70-73: Update the exclusion glob in the golangci config where it
currently lists "examples(/|$)" to the correct singular module name
"example(/|$)" so the example/ module is properly excluded; locate occurrences
of the pattern string "examples(/|$)" in .golangci.yml (including the other
instances referenced around the same block) and replace them with "example(/|$)"
to match the repository layout and ensure lint/format exclusion is effective.

In `@AGENTS.md`:
- Line 35: AGENTS.md states the DLQ topic is hardcoded while README.md still
documents a configurable dead_letter_topic; update the docs to be consistent:
either remove/mark dead_letter_topic as deprecated from README.md and add a
clear note that DLQ is hardcoded in AGENTS.md (including the hardcoded topic
name and any future plan), or if configurability is intended, update AGENTS.md
to explain how dead_letter_topic is honored and point to the config key. Ensure
both files mention the same authoritative behavior and update any other
occurrences (the other doc sections referenced) so README.md and AGENTS.md do
not contradict each other.

In `@broker/error_test.go`:
- Around line 234-241: The test currently only asserts results when expectError
is true or when configMap is empty, leaving the successful non-empty-map case
unasserted; update the assertions in the test for buildConfigFromMap so that
whenever tt.expectError is false (regardless of tt.configMap length) you assert
no error and that cfg is not nil — i.e., in the else branch for expectError add
assert.NoError(t, err) and assert.NotNil(t, cfg) using the existing tt, cfg and
err variables so the “valid map” case is covered.

In `@broker/googlepubsub.go`:
- Around line 22-35: The config struct for Google Pub/Sub removed the
dead_letter_topic field which can cause older configs to be silently ignored;
update the config parsing/validation (e.g., in the code that builds or
unmarshals googlePubSubConfig in broker/googlepubsub.go) to detect the
deprecated key "dead_letter_topic" (and its env-var equivalent, e.g.,
BROKER_GOOGLEPUBSUB_DEAD_LETTER_TOPIC) and fail fast: if that key is present,
return an error that clearly states the field is deprecated, instructs to
migrate to the new DLQ naming scheme (or config entry), and include a migration
hint; ensure this validation runs before normal defaulting logic that sets
{subscriptionID}-dlq so old configs are not silently accepted.

In `@test/integration/broker_leak_test.go`:
- Around line 28-29: This test file is missing the integration build tag, so add
the directive to the top of test/integration/broker_leak_test.go: insert the Go
build constraint lines for integration (the modern "//go:build integration" and
the legacy "// +build integration" on the line immediately before the package
declaration) so the integration suite (tests in this file) is only run when the
"integration" build tag is specified.

In `@test/integration/googlepubsub/googlepubsub_test.go`:
- Around line 11-13: Add the integration build tag to the top of the
googlepubsub_test.go test file so it is only run when integration tests are
selected: place the line //go:build integration (and optionally the legacy //
+build integration) as the very first lines before the package declaration in
test/integration/googlepubsub/googlepubsub_test.go to gate the entire file;
ensure the tag appears above any imports or package statements so test runner
respects the build constraint.

In `@test/integration/rabbitmq/rabbitmq_test.go`:
- Around line 116-120: Add the integration build tag lines at the top of this
test file so it only runs when the "integration" build tag is specified: insert
"//go:build integration" followed by the legacy "// +build integration" and a
blank line before the package declaration in
test/integration/rabbitmq/rabbitmq_test.go; this ensures the tests (including
usage of broker.NewPublisher / NewPublisher) are gated as integration tests.

---

Outside diff comments:
In `@broker/error_test.go`:
- Around line 82-99: The non-error test path currently skips assertions when err
!= nil causing false positives; update the test block that checks tt.expectError
to explicitly assert NoError(t, err) when tt.expectError is false (i.e., replace
the "else if err == nil" branch with an else that first calls assert.NoError(t,
err)), then assert.NotNil(t, pub) and only after that defer closing pub (so the
defer runs after successful creation). Apply the same change to the other
similar block mentioned (lines 170-187) so both test cases validate err with
assert.NoError(t, err) before inspecting or deferring pub.Close().
🪄 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: Central YAML (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: c2a9c9ea-14b0-4c5d-9aef-3ef575fd1bdc

📥 Commits

Reviewing files that changed from the base of the PR and between 995a3d7 and b5c668b.

📒 Files selected for processing (31)
  • .golangci.yml
  • .pre-commit-config.yaml
  • AGENTS.md
  • CLAUDE.md
  • Makefile
  • broker/broker.go
  • broker/cloudevents_test.go
  • broker/config.go
  • broker/config_test.go
  • broker/error_test.go
  • broker/errors.go
  • broker/googlepubsub.go
  • broker/health_test.go
  • broker/metrics.go
  • broker/metrics_test.go
  • broker/options_test.go
  • broker/publisher.go
  • broker/rabbitmq.go
  • broker/subscriber.go
  • example/broker.example.yaml
  • example/cmd/publisher/main.go
  • example/cmd/subscriber/main.go
  • example/googlepubsub/broker.yaml
  • pkg/logger/mock.go
  • test/integration/broker_leak_test.go
  • test/integration/broker_perf_test.go
  • test/integration/common/common.go
  • test/integration/googlepubsub/googlepubsub_test.go
  • test/integration/googlepubsub/setup.go
  • test/integration/rabbitmq/rabbitmq_test.go
  • test/integration/rabbitmq/setup.go

Comment thread .golangci.yml Outdated
Comment thread AGENTS.md
Comment thread broker/error_test.go
Comment thread broker/googlepubsub.go Outdated
Comment thread test/integration/broker_leak_test.go Outdated
Comment thread test/integration/googlepubsub/googlepubsub_test.go Outdated
Comment thread test/integration/rabbitmq/rabbitmq_test.go Outdated
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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
example/googlepubsub/broker.yaml (1)

25-45: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add log_config: true to this broker.yaml example.

This example violates the YAML config requirement to enable config logging for broker.yaml files.

Proposed fix
 subscriber:
   parallelism: 1
+
+log_config: true

As per coding guidelines, **/*.yaml: "Enable log_config: true in broker.yaml (or set LOG_CONFIG=true env var) to log full config as JSON at creation time with passwords masked".

🤖 Prompt for 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.

In `@example/googlepubsub/broker.yaml` around lines 25 - 45, Add the missing
log_config flag to this broker.yaml example by setting log_config: true at the
top-level of the document (next to the existing
dead_letter/deadline/topic/receive settings), so the broker will log the full
config as JSON with secrets masked; update the top-level keys that include
max_outstanding_messages, max_outstanding_bytes, num_goroutines,
create_topic_if_missing, create_subscription_if_missing, and
dead_letter_max_attempts to ensure log_config appears alongside them in the same
root mapping.
example/broker.example.yaml (1)

5-8: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add broker.log_config: true to the example config.

This example still omits log_config, so it doesn’t reflect the repo-required runtime config logging behavior (with masked passwords).

Suggested diff
 broker:
   # Broker type: "rabbitmq" or "googlepubsub"
   type: googlepubsub
+  # Log full broker config as JSON at creation time (passwords are masked)
+  log_config: true

As per coding guidelines, **/*.yaml: "Enable log_config: true in broker.yaml (or set LOG_CONFIG=true env var) to log full config as JSON at creation time with passwords masked".

Also applies to: 55-56

🤖 Prompt for 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.

In `@example/broker.example.yaml` around lines 5 - 8, Add the missing
broker.log_config setting to the example by enabling broker.log_config: true so
the example reflects runtime logging behavior (and mention you can alternatively
set LOG_CONFIG=true); update the broker stanza where broker.type is defined (the
broker: / type: googlepubsub block) and any other broker example blocks (the
other occurrence around the same config) to include broker.log_config: true so
config is logged as JSON with secrets masked at creation time.
🤖 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 `@broker/error_test.go`:
- Around line 88-99: The test branch lets unexpected errors slip by—make the
behavior explicit: where the code checks expectError (variable) and handles err,
replace the loose "else if err == nil" logic with explicit assertions using the
test assert helpers (e.g., assert.NoError(t, err) when expectError == false and
assert.Error(t, err) when expectError == true), then assert pub is not nil and
schedule defer pub.Close() only after the NoError assertion; apply the same
change for the other occurrence referenced (lines around the second block with
pub/Close) so both non-error and error paths are explicitly asserted.

In `@pkg/logger/mock.go`:
- Around line 15-18: The LogEntry type is a mock-only exported struct (LogEntry)
that may imply a stable public API; to avoid this, make it unexported or move it
into a test file: rename LogEntry to logEntry (or move the entire definition
into a _test.go) and update all usages in pkg/logger/mock.go to use the
unexported name (all current usages are keyed so no literal breaks), or relocate
the type into the mock's _test file and adjust imports/usages accordingly to
keep it internal to tests.

---

Outside diff comments:
In `@example/broker.example.yaml`:
- Around line 5-8: Add the missing broker.log_config setting to the example by
enabling broker.log_config: true so the example reflects runtime logging
behavior (and mention you can alternatively set LOG_CONFIG=true); update the
broker stanza where broker.type is defined (the broker: / type: googlepubsub
block) and any other broker example blocks (the other occurrence around the same
config) to include broker.log_config: true so config is logged as JSON with
secrets masked at creation time.

In `@example/googlepubsub/broker.yaml`:
- Around line 25-45: Add the missing log_config flag to this broker.yaml example
by setting log_config: true at the top-level of the document (next to the
existing dead_letter/deadline/topic/receive settings), so the broker will log
the full config as JSON with secrets masked; update the top-level keys that
include max_outstanding_messages, max_outstanding_bytes, num_goroutines,
create_topic_if_missing, create_subscription_if_missing, and
dead_letter_max_attempts to ensure log_config appears alongside them in the same
root mapping.
🪄 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: Central YAML (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 7461e6ae-7249-4004-bcf7-a7934d0e895b

📥 Commits

Reviewing files that changed from the base of the PR and between bf9d405 and 869f067.

📒 Files selected for processing (31)
  • .golangci.yml
  • .pre-commit-config.yaml
  • AGENTS.md
  • Makefile
  • README.md
  • broker/broker.go
  • broker/cloudevents_test.go
  • broker/config.go
  • broker/config_test.go
  • broker/error_test.go
  • broker/errors.go
  • broker/googlepubsub.go
  • broker/health_test.go
  • broker/metrics.go
  • broker/metrics_test.go
  • broker/options_test.go
  • broker/publisher.go
  • broker/rabbitmq.go
  • broker/subscriber.go
  • example/broker.example.yaml
  • example/cmd/publisher/main.go
  • example/cmd/subscriber/main.go
  • example/googlepubsub/broker.yaml
  • pkg/logger/mock.go
  • test/integration/broker_leak_test.go
  • test/integration/broker_perf_test.go
  • test/integration/common/common.go
  • test/integration/googlepubsub/googlepubsub_test.go
  • test/integration/googlepubsub/setup.go
  • test/integration/rabbitmq/rabbitmq_test.go
  • test/integration/rabbitmq/setup.go

Comment thread broker/error_test.go Outdated
Comment thread pkg/logger/mock.go
@kuudori
Copy link
Copy Markdown
Contributor Author

kuudori commented May 27, 2026

/test presubmits-integration

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 `@test/integration/common/common.go`:
- Around line 629-631: The tests currently mutate the caller's configMap
in-place when cfg.BrokerType == broker.BrokerTypeRabbitMQ by setting
configMap["subscriber.parallelism"], which can leak state between tests;
instead, create a shallow copy of the map before modifying it (e.g., newMap :=
make(map[string]string, len(configMap)); copy all entries from configMap into
newMap) and set newMap["subscriber.parallelism"]="6", then pass newMap into the
downstream helper; apply the same non-mutating copy-and-modify fix for the other
occurrence handling subscriber.parallelism so the original configMap remains
unchanged.
🪄 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: Central YAML (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 37be098c-5454-4110-92c0-c7df424dfb5d

📥 Commits

Reviewing files that changed from the base of the PR and between 869f067 and 3fe50fc.

📒 Files selected for processing (1)
  • test/integration/common/common.go

Comment thread test/integration/common/common.go Outdated
@kuudori
Copy link
Copy Markdown
Contributor Author

kuudori commented May 27, 2026

/retest

AGENTS.md contains agent-facing documentation for the broker library:
verification targets, source of truth table, architecture context,
project boundaries, and non-obvious gotchas.

CLAUDE.md imports AGENTS.md via @AGENTS.md.
Google Pub/Sub's Receive() can only be called once per subscriber.
Setting subscriber.parallelism > 1 creates multiple handlers that
compete for the same Receive call, causing "Receive already in
progress" errors and flaky package-level failures in CI.

Only set parallelism > 1 for RabbitMQ in RunCloseWaitsForInFlightMessages
and RunPanicHandler.
@rafabene
Copy link
Copy Markdown
Contributor

rafabene commented Jun 2, 2026

/lgtm

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jun 2, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rafabene

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

The pull request process is described 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

@openshift-ci openshift-ci Bot added the approved label Jun 2, 2026
@openshift-merge-bot openshift-merge-bot Bot merged commit 2dac2ac into main Jun 2, 2026
8 checks passed
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.

2 participants