Skip to content

NO-ISSUE: Add assisted-service-writing-unit-tests agent skill#10123

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift:masterfrom
bluesort:add-skill-writing-unit-tests
Apr 10, 2026
Merged

NO-ISSUE: Add assisted-service-writing-unit-tests agent skill#10123
openshift-merge-bot[bot] merged 1 commit intoopenshift:masterfrom
bluesort:add-skill-writing-unit-tests

Conversation

@bluesort
Copy link
Copy Markdown
Member

Add an assisted-service-writing-unit-tests skill to .cursor/skills and .claude/skills to enforce unit test patterns.

The skill was developed using the TDD methodology from superpowers:writing-skills, including RED phase baseline testing with pressure scenarios (time pressure, authority pressure, exhaustion), GREEN phase skill development with decision flowcharts and rationalization defenses, and REFACTOR phase loophole identification and hardening.

The same writing-skills skill was used to run agents with a variety of generic test creation prompts to confirm that the skill is loaded into context when needed.

As a final test, several established test files not adhering to unit test patterns (such as missing gomock Finish() calls as covered in #10024) were deleted and re-created with the help of this skill. Resulting test files adhered to unit testing patterns more closely than the previous versions.

List all the issues related to this PR

  • New Feature
  • Enhancement
  • Bug fix
  • Tests
  • Documentation
  • CI/CD

What environments does this code impact?

  • Automation (CI, tools, etc)
  • Cloud
  • Operator Managed Deployments
  • None

How was this code tested?

  • assisted-test-infra environment
  • dev-scripts environment
  • Reviewer's test appreciated
  • Waiting for CI to do a full test run
  • Manual (Elaborate on how it was tested)
  • [] No tests needed

Checklist

  • Title and description added to both, commit and PR.
  • Relevant issues have been associated (see CONTRIBUTING guide)
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit-tests (note that code changes require unit-tests)

Reviewers Checklist

  • Are the title and description (in both PR and commit) meaningful and clear?
  • Is there a bug required (and linked) for this change?
  • Should this PR be backported?

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 10, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@bluesort: This pull request explicitly references no jira issue.

Details

In response to this:

Add an assisted-service-writing-unit-tests skill to .cursor/skills and .claude/skills to enforce unit test patterns.

The skill was developed using the TDD methodology from superpowers:writing-skills, including RED phase baseline testing with pressure scenarios (time pressure, authority pressure, exhaustion), GREEN phase skill development with decision flowcharts and rationalization defenses, and REFACTOR phase loophole identification and hardening.

The same writing-skills skill was used to run agents with a variety of generic test creation prompts to confirm that the skill is loaded into context when needed.

As a final test, several established test files not adhering to unit test patterns (such as missing gomock Finish() calls as covered in #10024) were deleted and re-created with the help of this skill. Resulting test files adhered to unit testing patterns more closely than the previous versions.

List all the issues related to this PR

  • New Feature
  • Enhancement
  • Bug fix
  • Tests
  • Documentation
  • CI/CD

What environments does this code impact?

  • Automation (CI, tools, etc)
  • Cloud
  • Operator Managed Deployments
  • None

How was this code tested?

  • assisted-test-infra environment
  • dev-scripts environment
  • Reviewer's test appreciated
  • Waiting for CI to do a full test run
  • Manual (Elaborate on how it was tested)
  • [] No tests needed

Checklist

  • Title and description added to both, commit and PR.
  • Relevant issues have been associated (see CONTRIBUTING guide)
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit-tests (note that code changes require unit-tests)

Reviewers Checklist

  • Are the title and description (in both PR and commit) meaningful and clear?
  • Is there a bug required (and linked) for this change?
  • Should this PR be backported?

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 10, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a3aef0f3-80c3-4d80-a5bb-d3a97a9ca2ed

📥 Commits

Reviewing files that changed from the base of the PR and between 873cefa and 2fa2c7d.

📒 Files selected for processing (3)
  • .claude/skills/assisted-service-writing-unit-tests.md
  • .cursor/skills/assisted-service-writing-unit-tests/SKILL.md
  • CLAUDE.md
✅ Files skipped from review due to trivial changes (2)
  • .claude/skills/assisted-service-writing-unit-tests.md
  • CLAUDE.md

Walkthrough

Added two documentation files introducing standardized unit-test patterns for assisted-service (Ginkgo/Gomega, gomock, PostgreSQL lifecycle, event matchers) and updated CLAUDE.md to reference the new guidance for tests in internal/ and pkg/.

Changes

Cohort / File(s) Summary
Unit test skill files
​.cursor/skills/assisted-service-writing-unit-tests/SKILL.md, ​.claude/skills/assisted-service-writing-unit-tests.md
Added a detailed guide covering gomock controller lifecycle (require ctrl.Finish() in AfterEach), Ginkgo structure, DB lifecycle patterns (suite-shared vs per-test), event matcher usage, table-driven patterns, common mistakes, and a pre-submission checklist.
Documentation reference
CLAUDE.md
Inserted a "Test Patterns" section pointing authors of unit tests in internal/ and pkg/ to the new skill; clarifies scope (unit tests only).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

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

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

@openshift-ci openshift-ci bot requested review from carbonin and danmanor April 10, 2026 14:29
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 10, 2026
@rccrdpccl
Copy link
Copy Markdown
Contributor

/lgtm
/approve

nice ❤️

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 10, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 10, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bluesort, rccrdpccl

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

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 the current code and only fix it if needed.

Inline comments:
In @.cursor/skills/assisted-service-writing-unit-tests/SKILL.md:
- Around line 94-98: The per-test teardown currently couples DB cleanup with
gomock cleanup; split them by making the AfterEach that calls
common.DeleteTestDB(db, dbName) only handle DB teardown and remove the inline
ctrl.Finish() from that block, and if gomock is used in the same scope add a
separate AfterEach that calls ctrl.Finish() (referencing BeforeEach/AfterEach,
common.PrepareTestDB, common.DeleteTestDB, and ctrl.Finish) so tests without
mocks don’t reference an undefined ctrl.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0a58e698-d90f-4ddc-a316-80afa94ad42c

📥 Commits

Reviewing files that changed from the base of the PR and between 9347728 and 873cefa.

📒 Files selected for processing (3)
  • .claude/skills/assisted-service-writing-unit-tests.md
  • .cursor/skills/assisted-service-writing-unit-tests/SKILL.md
  • CLAUDE.md

@bluesort bluesort force-pushed the add-skill-writing-unit-tests branch from 873cefa to 2fa2c7d Compare April 10, 2026 14:50
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Apr 10, 2026
@rccrdpccl
Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 10, 2026
@bluesort
Copy link
Copy Markdown
Member Author

/test ?

@openshift-merge-bot
Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD 9347728 and 2 for PR HEAD 2fa2c7d in total

@bluesort
Copy link
Copy Markdown
Member Author

/test edge-images

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 10, 2026

@bluesort: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit a12e081 into openshift:master Apr 10, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants