Skip to content

liferay/liferay-portal / .claude/skills/pr-check

pr-check

Verified

Check that a PR is ready to be sent for review.

FileKindSize
SKILL.mdskill md36.5 KB
find_modules.shexecutablescript1.4 KB
references/testing.mdmarkdown5.4 KB
select_paths.shexecutablescript2.2 KB
select_validations.shexecutablescript1.1 KB
validations/branch/bean-param-util-getter.mdmarkdown6.6 KB
validations/branch/bnd-content.mdmarkdown15.2 KB
validations/branch/bnd-dsannotations-options.mdmarkdown9.1 KB
validations/branch/cache-field-usage.mdmarkdown13.9 KB
validations/branch/concurrent-mapper-hash-map-usage.mdmarkdown7.5 KB
validations/branch/html-escaping.mdmarkdown2.6 KB
validations/branch/pr-reviewer.mdmarkdown6.6 KB
validations/branch/redundant-assert-message.mdmarkdown13.5 KB
validations/branch/required-configuration-policy.mdmarkdown7.9 KB
validations/branch/service-holder-usage.mdmarkdown8.3 KB
validations/branch/service-registration.mdmarkdown3.7 KB
validations/branch/source-format.mdmarkdown4.1 KB
validations/branch/startup-sync-usage.mdmarkdown10.6 KB
validations/branch/transaction-usage.mdmarkdown4.0 KB
validations/branch/unused-project-dependencies.mdmarkdown18.5 KB
validations/portal/baseline.mdmarkdown14.0 KB
validations/portal/cross-module-compile.mdmarkdown7.9 KB
validations/portal/full-portal-build.mdmarkdown1.4 KB
validations/portal/go-generate.mdmarkdown2.8 KB
validations/portal/go-source-format.mdmarkdown1.9 KB
validations/portal/helm-unit-test-order.mdmarkdown1.4 KB
validations/portal/instance-wrapper-build.mdmarkdown656 B
validations/portal/java-unit-test.mdmarkdown6.7 KB
validations/portal/javascript-unit-test.mdmarkdown7.7 KB
validations/portal/module-registration.mdmarkdown7.8 KB
validations/portal/per-module-compile.mdmarkdown10.4 KB
validations/portal/portlet-title.mdmarkdown1.1 KB
validations/portal/poshi-syntax.mdmarkdown336 B
validations/portal/pql-validation.mdmarkdown516 B
validations/portal/rest-builder.mdmarkdown938 B
validations/portal/service-builder.mdmarkdown1.6 KB
validations/portal/structural-smoke.mdmarkdown3.9 KB
validations/portal/theme-build.mdmarkdown2.0 KB
validations/workspaces/generated-file.mdmarkdown2.5 KB
validations/workspaces/source-format.mdmarkdown2.0 KB
validations/workspaces/workspace-compile.mdmarkdown1.8 KB
validations/workspaces/workspace-java-unit-test.mdmarkdown1.7 KB
validations/workspaces/workspace-javascript-unit-test.mdmarkdown1.9 KB

validations/branch/transaction-usage.md

View on GitHub
# Transaction Usage

Flags new transaction usage in hand written Java, such as `@Transactional`, `Propagation.REQUIRES_NEW`, or `TransactionInvokerUtil`. Improper transaction usage has heavy performance costs, so Shuyang Zhou and the Core Infrastructure team must approve every new case.

## Match

`\.java$`

## Command

This check is static and needs no build. It walks each changed Java file, skips generated files, and reports any newly added transaction usage in the rest. It uses `command grep` so the diff is filtered by the system grep rather than the shell's `grep` wrapper, which some environments route to another tool with its own defaults.

A generated file carries the `@generated` Javadoc marker that Service Builder and the other code generators stamp on every file they produce (for example every `*LocalService` interface). The scan matches it case-insensitively, so the `@Generated` annotation on REST Builder output is covered too. That annotation is machine-written boilerplate, not hand-written transaction code, so any file carrying it is excluded before the transaction scan.

Anchor that match to a Javadoc tag or an annotation rather than searching the whole file for the bare word, or a class that only mentions `@generated` in prose drops out of the scan entirely.

```bash
FINDINGS=$(
	bash "${SKILL_DIR}/select_paths.sh" "${MERGE_BASE}" "${VALIDATION_FILE}" | while IFS= read -r FILE
	do
		[[ -f ${FILE} ]] || continue

		if command grep \
			--extended-regexp \
			--ignore-case \
			--regexp='^[[:space:]]*(\*[[:space:]]*@generated|@generated\()' \
			"${FILE}" > /dev/null
		then
			continue
		fi

		git diff "${MERGE_BASE}...HEAD" -- "${FILE}" \
			| command grep --extended-regexp '^\+' \
			| command grep --extended-regexp --invert-match '^\+\+\+' \
			| command grep \
				--fixed-strings \
				--regexp='@Transactional' \
				--regexp='Propagation.REQUIRES_NEW' \
				--regexp='REQUIRES_NEW_TRANSACTION' \
				--regexp='TransactionCallbackUtil' \
				--regexp='TransactionCommitCallbackUtil' \
				--regexp='TransactionInvokerUtil'
	done
)

printf '%s' "${FINDINGS}"
```

**Judge this from `${FINDINGS}` and never from the exit status**, which carries no verdict in either direction. The loop's status is whatever its last iteration happened to leave behind, so it reports on the diff's last Java file rather than on the diff. A clean branch ends on a `command grep` that matched nothing and exits 1. A branch that adds transaction usage in an early file and ends on a clean one also exits 1. `continue` returns 0, so a diff whose last Java file is generated exits 0 whatever preceded it. Both statuses occur on both verdicts.

Run the loop from `${REPO_ROOT}`. The changed paths are relative to the repository root, so from any directory below it, every file test fails and the check passes without scanning anything.

Use `while read` rather than a `for` over an unquoted substitution, so a path holding whitespace stays one file rather than splitting into several.

When `${FINDINGS}` is empty, the branch adds no new transaction usage, so the validation passes.

Otherwise, resolve the GitHub login of the person running pr-check with `gh api user --jq '.login'` and check it against the whitelist below. The validation passes only when that login is on the whitelist, and fails for everyone else. It also fails when the login cannot be resolved, for example when `gh` is not authenticated, so an unknown initiator never passes. Add one login per line as the roster changes.

```
shuyangzhou
```

When the validation fails, report the message below to the developer and return it as the failure note.

```markdown
**Transaction usage requires Core Infrastructure review.** New transaction code (`@Transactional`, `TransactionInvokerUtil`, etc.) has heavy performance implications and requires additional review. After team review is complete, please send this pull request to @liferay-core-infra and request review from @shuyangzhou. For additional questions, use #t-core-infrastructure on Slack.
```

## Time Estimate

~10-20 sec (static, no build).
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall