Skip to content

feat(quality/pr6): BDD lifecycle specs + smoke/regression scripts + PR template#117

Merged
seanhanca merged 3 commits into
mainfrom
quality/pr6-bdd-reporting
Feb 17, 2026
Merged

feat(quality/pr6): BDD lifecycle specs + smoke/regression scripts + PR template#117
seanhanca merged 3 commits into
mainfrom
quality/pr6-bdd-reporting

Conversation

@seanhanca
Copy link
Copy Markdown
Contributor

@seanhanca seanhanca commented Feb 17, 2026

Summary

  • Add 15 BDD feature specs covering all 6 lifecycle phases (create→install/uninstall)
  • Add bin/lifecycle-smoke.sh: checks SDK build, UMD bundles, file integrity
  • Add bin/regression-guard.sh: typecheck + test + build for 5 core plugins
  • Add PR review template for quality program with 100-point scorecard

Supersedes #109 (rebuilt from main with clean scope).

Files Changed (4)

  • tests/lifecycle-bdd/plugin-lifecycle.feature.test.ts
  • bin/lifecycle-smoke.sh
  • bin/regression-guard.sh
  • .github/PULL_REQUEST_TEMPLATE/plugin-lifecycle-quality.md

Test Evidence

  • BDD file uses .feature.test.ts naming for vitest auto-discovery
  • Scripts are executable (+x) and CI-invocable
  • PR1 CI job guards skip gracefully when these assets are absent

Regression Impact

  • All new files; no existing code modified
  • Scripts check existing plugins but do not modify them

Made with Cursor

Summary by CodeRabbit

  • Tests

    • Added comprehensive behavior-driven development test suite covering the plugin lifecycle from creation through installation and uninstall.
  • Chores

    • Added standardized PR quality review template for plugin-related changes.
    • Added smoke test and regression guard scripts to enhance ecosystem stability and compatibility validation during development.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Feb 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
naap-platform Ready Ready Preview, Comment Feb 17, 2026 8:35pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 17, 2026

Warning

Rate limit exceeded

@seanhanca has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 31 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

Introduces a plugin lifecycle quality review PR template, smoke test script, regression guard script, and comprehensive BDD test suite covering the entire plugin lifecycle workflow from creation through installation and uninstallation.

Changes

Cohort / File(s) Summary
Documentation & Templates
.github/PULL_REQUEST_TEMPLATE/plugin-lifecycle-quality.md
New PR template providing structured checklist for plugin lifecycle quality reviews, including phase selection, expert review criteria, 100-point quality scorecard with weighted metrics, regression impact statement, and compatibility test evidence.
Build & Quality Scripts
bin/lifecycle-smoke.sh, bin/regression-guard.sh
Two shell scripts performing automated checks: lifecycle-smoke.sh verifies SDK build, core plugin UMD artifacts, and critical file existence with optional build skip; regression-guard.sh performs SDK build, plugin typecheck/test/UMD execution, and structural integrity validation with per-plugin status tracking.
Lifecycle BDD Tests
tests/lifecycle-bdd/plugin-lifecycle.feature.test.ts
Comprehensive BDD test suite exercising plugin lifecycle scenarios: CLI discoverability, plugin creation, packaging, manifest validation, publishing with concurrency handling, CDN serving with MIME types and cache control, and install/uninstall transitions with hook failure handling.

Sequence Diagram(s)

sequenceDiagram
    actor Developer
    participant CLI
    participant Filesystem
    participant Validator
    participant Publisher
    participant CDN
    participant InstallSystem

    Developer->>CLI: Create plugin
    CLI->>Filesystem: Generate scaffold
    Developer->>CLI: Build frontend
    Filesystem->>Filesystem: Produce dist/production
    Developer->>CLI: Package plugin
    Filesystem->>Filesystem: Copy manifest & artifacts
    Validator->>Filesystem: Validate manifest
    Validator->>Validator: Check plugin name
    Developer->>Publisher: Publish to registry
    Publisher->>Publisher: Pre-publish checks
    Publisher->>CDN: Deploy UMD bundle
    Developer->>InstallSystem: Install plugin
    InstallSystem->>InstallSystem: pending → installing
    InstallSystem->>InstallSystem: Run postInstall hook
    InstallSystem->>InstallSystem: installing → installed
    Developer->>InstallSystem: Uninstall plugin
    InstallSystem->>InstallSystem: Run preUninstall hook
    InstallSystem->>Filesystem: Remove plugin artifacts
    InstallSystem->>InstallSystem: Uninstall complete
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

scope/shell, size/L

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes all main changes: BDD lifecycle specs, smoke/regression scripts, and PR template for quality program.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch quality/pr6-bdd-reporting

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

@github-actions github-actions Bot added the size/XL Extra large PR (500+ lines) label Feb 17, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 17, 2026

⚠️ This PR is very large (544 lines changed). Please split it into smaller, focused PRs if possible.

@github-actions github-actions Bot added the scope/infra Infrastructure changes label Feb 17, 2026
@seanhanca seanhanca requested a review from Copilot February 17, 2026 20:25
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds new quality-program assets (BDD-style lifecycle specs, smoke/regression guard scripts, and a PR review template) intended to improve plugin lifecycle validation and reviewer consistency.

Changes:

  • Introduces a new vitest-based “lifecycle BDD” spec file under tests/.
  • Adds two CI-invocable bash scripts for lifecycle smoke checks and regression guarding.
  • Adds a PR template with a checklist and 100-point scoring rubric for lifecycle-quality reviews.

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 3 comments.

File Description
tests/lifecycle-bdd/plugin-lifecycle.feature.test.ts Adds 15 Given/When/Then-style scenarios for lifecycle phases (currently not wired into the Nx test graph and contains a test-order dependency).
bin/lifecycle-smoke.sh Adds a smoke script for SDK build + bundle/file checks (currently skips all core plugins due to build:umd gating).
bin/regression-guard.sh Adds a regression guard matrix + structural checks (currently largely SKIPs core plugin checks and has a PR-description mismatch).
.github/PULL_REQUEST_TEMPLATE/plugin-lifecycle-quality.md Adds a lifecycle-quality PR review template (table formatting issue with leading `

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +79 to +90
it('Given a built frontend, When package runs, Then a ZIP with plugin.json and UMD bundle is produced', async () => {
const pluginDir = path.join(tmpDir, 'bdd-test-plugin');
const prodDir = path.join(pluginDir, 'frontend', 'dist', 'production');
await fs.ensureDir(prodDir);
await fs.writeFile(path.join(prodDir, 'bdd-test-plugin.js'), VALID_UMD);

// Simulate packaging
const pkgDir = path.join(tmpDir, 'pkg');
await fs.ensureDir(pkgDir);
await fs.copy(path.join(pluginDir, 'plugin.json'), path.join(pkgDir, 'plugin.json'));
await fs.copy(prodDir, path.join(pkgDir, 'frontend', 'production'));

Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The packaging scenario copies plugin.json from pluginDir, but this test never creates that file (or reuses a setup hook to ensure it exists). This will fail when the packaging test is run in isolation (e.g., vitest -t "Plugin Packaging"). Consider creating/writing plugin.json as part of this test or adding a shared beforeEach setup that ensures pluginDir/plugin.json exists for every scenario that relies on it.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +12
/**
* Plugin Lifecycle — Behavior-Driven Feature Specs
*
* Given/When/Then scenarios covering the full lifecycle:
* create → build → package → validate → publish → CDN-serve → install → uninstall
*
* These tests are designed to run against a live-ish environment (mocked services
* for the initial CI integration, with a toggle for real-service testing in nightly).
*/

import { describe, it, expect, vi, beforeAll, afterAll, beforeEach } from 'vitest';
import fs from 'fs-extra';
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

This test suite lives under the repo-level tests/ folder, but the workspace test entrypoint is nx run-many --target=test --all and there is no Nx project/package that includes tests/lifecycle-bdd. As a result, these specs are likely not executed in CI or by npm test despite the .test.ts name. Consider moving these tests into an existing Nx project that runs vitest (or creating a dedicated Nx project for tests/ and wiring it into CI).

Copilot uses AI. Check for mistakes.
| Regression safety & backward compat | 20 | ___ | ___ |
| Security & resilience | 15 | ___ | ___ |
| Maintainability & observability | 10 | ___ | ___ |
| **Total** | **100** | | **___** |
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The scorecard table rows start with || (double pipe), which creates an extra empty first column in GitHub-flavored Markdown. If you want a 4-column table, use a single leading | on each row so the columns align as intended.

Suggested change
| **Total** | **100** | | **___** |
| **Total** | **100** | **N/A** | **___** |

Copilot uses AI. Check for mistakes.
seanhanca and others added 3 commits February 17, 2026 12:33
…R template

BDD feature specs (tests/lifecycle-bdd/plugin-lifecycle.feature.ts — 15 tests):
- Given/When/Then scenarios for all 6 lifecycle phases:
  create, package, validate, publish, CDN-serve, install/uninstall
- Covers mount uniqueness, packaging format rejection, manifest validation,
  P2002 concurrent publish, MIME type serving, install/uninstall ordering

Script-driven automation:
- bin/lifecycle-smoke.sh: SDK build check, core plugin UMD existence,
  structural file integrity, health-check invocation
- bin/regression-guard.sh: SDK build + per-core-plugin typecheck/test/UMD,
  structural integrity across all 5 core plugins

Both scripts: exit 1 on any failure, produce pass/fail per-check output,
integrated into the CI lifecycle-tests job added in PR1.

Governance:
- .github/PULL_REQUEST_TEMPLATE/plugin-lifecycle-quality.md: expert review
  checklist, 100-point scoring rubric table, regression impact statement,
  compatibility test evidence, and coverage delta fields

Scope: tests/ + bin/ scripts + PR template only. No production code changed.
Net LOC: ~513 additions | No regression risk.

Co-authored-by: Cursor <cursoragent@cursor.com>
…overy

Vitest's default include pattern requires .test.ts or .spec.ts suffixes.
Rename plugin-lifecycle.feature.ts → plugin-lifecycle.feature.test.ts so
npx vitest run --dir tests/lifecycle-bdd picks it up automatically without
requiring a custom --include flag.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Import and exercise real validateManifest, validatePluginName,
  createDefaultManifest from plugin-sdk
- Add CLI discoverability tests: invoke `naap-plugin --help` and
  `naap-plugin create --help` via execa
- Replace inline value-assertion validation tests with actual SDK calls
- 19 tests pass (2 real CLI, 4 real SDK, rest structural)

Co-authored-by: Cursor <cursoragent@cursor.com>
@seanhanca seanhanca force-pushed the quality/pr6-bdd-reporting branch from 8a93e39 to 15fa124 Compare February 17, 2026 20:33
@seanhanca seanhanca merged commit cc232a3 into main Feb 17, 2026
1 of 2 checks passed
@seanhanca seanhanca deleted the quality/pr6-bdd-reporting branch February 17, 2026 20:33
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: 4

🧹 Nitpick comments (5)
tests/lifecycle-bdd/plugin-lifecycle.feature.test.ts (5)

163-180: Tautological tests — assertions are self-fulfilling.

These tests verify hardcoded values against themselves:

  • Lines 165-168: passed: true is hardcoded, so the "no failures" assertion always passes.
  • Lines 176-178: error.code is set to 'P2002' then immediately checked for 'P2002'.

These tests document expected behavior but don't verify actual publish logic. Consider mocking/stubbing the publish service and testing real error paths.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/lifecycle-bdd/plugin-lifecycle.feature.test.ts` around lines 163 - 180,
The tests use tautological assertions: the "checks" array sets passed: true and
then asserts no failures, and the P2002 case sets error.code to 'P2002' then
asserts it equals 'P2002'; replace these with real assertions by invoking the
actual publish logic (or a mocked publish service) and asserting outcomes—e.g.,
call the publish method and verify that Manifest validation and Version format
checks fail or pass based on FIXTURE_MANIFEST, or mock the
publish/version-create to throw a Prisma P2002 error and assert the HTTP/handler
returns a 409; locate and update the tests around the checks array and the P2002
simulation (variables checks, FIXTURE_MANIFEST, error, isUniqueViolation) to use
real or mocked behavior instead of hardcoded values.

69-96: Tests validate fixture setup, not actual SDK create functionality.

These tests write fixtures to disk and read them back, which validates the test infrastructure but doesn't exercise the actual create command. Consider adding tests that invoke npx tsx cliPath create ... to test real plugin scaffolding behavior.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/lifecycle-bdd/plugin-lifecycle.feature.test.ts` around lines 69 - 96,
The tests in plugin-lifecycle.feature.test.ts only write and read fixture files
(validating test infra) instead of invoking the real CLI create flow; update the
test to actually run the SDK create command by spawning the CLI (e.g., run "npx
tsx <cliPath> create ..." or use the existing cliPath test helper) and assert
the generated project structure and contents (manifest, frontend mount behavior)
rather than writing files directly—modify the relevant test case(s) that
currently manipulate pluginDir/frontend/src and use process spawn or execa to
call the create command, then read and assert files produced by that command
(referencing the test file name, the test case description, and the create CLI
invocation).

154-158: Tautological test — checks a constant defined in the same file.

This test verifies that VALID_UMD (defined at line 32) contains 'mount' and 'exports', but since VALID_UMD is a constant in this file, the test will always pass. Consider testing against actual UMD bundle output from the build process, or testing a real validation function that checks UMD content.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/lifecycle-bdd/plugin-lifecycle.feature.test.ts` around lines 154 - 158,
The test currently asserts that the local constant VALID_UMD contains 'mount'
and 'exports' which is tautological; change the "Given a UMD bundle, When
content is validated, Then mount function presence is checked" test to operate
on real UMD output or the validation logic instead of the constant: either (a)
load or build an actual UMD bundle (from a fixture or the build output) and
assert that its string contains 'mount' and 'exports', or (b) call the real
validation function (e.g., validateUmdContent / validateUmdBundle) with the real
bundle content and assert the function returns the expected result; replace
references to VALID_UMD in this spec with the loaded bundle or the validation
function call.

185-202: Tautological tests — no CDN code exercised.

Both tests define local data structures and verify them inline:

  • mimeMap is defined then immediately checked for known values.
  • isProd && hasHash are both hardcoded to true, so cc always contains 'immutable'.

These serve as documentation of expected behavior but don't test actual CDN serving logic. Consider integration tests that hit real/mocked CDN endpoints.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/lifecycle-bdd/plugin-lifecycle.feature.test.ts` around lines 185 - 202,
The two tests in plugin-lifecycle.feature.test.ts are tautological (they only
assert local values: mimeMap, isProd/hasHash -> cc) and do not exercise CDN
logic; replace them to call the actual CDN/middleware utilities or endpoints
instead of asserting hardcoded locals — e.g., invoke the server route or the
functions that compute MIME type and Cache-Control and assert their responses;
refer to the symbols mimeMap, isProd, hasHash and cc in the diff as the
offending locals to remove, and instead call the real handler or helper (the CDN
route handler or getMimeType/getCacheControl utility) or perform an HTTP request
against a test server or mocked CDN to verify correct MIME and immutable
Cache-Control behavior.

207-243: Tautological tests documenting lifecycle state machine.

These tests construct expected data structures inline and verify them:

  • Line 209-211: Hardcoded transitions array checked for first/last values.
  • Line 215-224: Manually pushed strings checked for ordering.
  • Lines 228-235 and 238-241: Hardcoded flags controlling expected outcomes.

These effectively document the intended state machine behavior but don't exercise real lifecycle code. Consider integration tests that invoke actual install/uninstall handlers and verify database state or hook invocations.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/lifecycle-bdd/plugin-lifecycle.feature.test.ts` around lines 207 - 243,
The current tests in the "Given a published plugin..." / "Given an installed
plugin..." / "Given a postInstall hook failure..." / "Given a preUninstall hook
failure..." specs are tautological and do not exercise the lifecycle logic;
replace them with integration-style tests that invoke the real install/uninstall
handlers (e.g., call your installPlugin/uninstallPlugin or
WorkflowPlugin.install/WorkflowPlugin.uninstall entry points), simulate hook
outcomes (invoke or stub runPreInstall/runPostInstall/runPreUninstall hooks),
and assert observable side effects such as database records via
getInstallationStatus/getInstallationRecord and external effects like
disableWorkflowPlugin and unregisterRoles being called (use spies/mocks where
appropriate); ensure tests assert ordering by checking timestamps or spy call
order rather than comparing hardcoded arrays or boolean flags.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@bin/regression-guard.sh`:
- Around line 65-71: The redirection order in the typecheck command is reversed
(2>&1 >/dev/null) so stderr is not being silenced correctly; update the command
invocation inside the conditional that runs npm run typecheck (the subshell
using (cd "$FRONTEND_DIR" && npm run typecheck ...)) to use the correct combined
redirection >/dev/null 2>&1 so both stdout and stderr are suppressed while
preserving the exit status checked by the if.
- Around line 74-82: The npm test invocation in the conditional uses the wrong
redirect order ("2>&1 >/dev/null") so stderr is redirected to the original
stdout instead of both streams going to /dev/null; update the command in the if
block that runs (cd "$FRONTEND_DIR" && npm test --if-present 2>&1 >/dev/null) to
redirect stdout first and then stderr (e.g., use >/dev/null 2>&1) so both stdout
and stderr from npm test are silenced, leaving the surrounding logic (variables
FRONTEND_DIR, plugin and the pass/fail/skip functions) unchanged.
- Around line 40-44: The shell conditional that runs the plugin-sdk build uses
the wrong redirection order: in the if-statement containing (cd
"$ROOT_DIR/packages/plugin-sdk" && npm run build 2>&1 >/dev/null) stderr is sent
to the terminal because 2>&1 happens before stdout is redirected; update the
build command inside that conditional to redirect stdout first and then stderr
(i.e., use >/dev/null 2>&1) so both stdout and stderr are suppressed when
running the npm run build check.
- Around line 84-93: The npm invocation inside the if block that checks
FRONTEND_DIR currently misorders shell redirections (the subshell condition
using cd "$FRONTEND_DIR" && npm run build:umd ...), causing stderr/stdout
handling to be incorrect; fix it by changing the redirection order so stdout is
redirected first and stderr follows (i.e., redirect stdout to /dev/null then
redirect stderr to the same place) in the subshell command used for the UMD
build check (the line containing npm run build:umd), leaving the surrounding
pass/fail/skip logic and variables like plugin intact.

---

Nitpick comments:
In `@tests/lifecycle-bdd/plugin-lifecycle.feature.test.ts`:
- Around line 163-180: The tests use tautological assertions: the "checks" array
sets passed: true and then asserts no failures, and the P2002 case sets
error.code to 'P2002' then asserts it equals 'P2002'; replace these with real
assertions by invoking the actual publish logic (or a mocked publish service)
and asserting outcomes—e.g., call the publish method and verify that Manifest
validation and Version format checks fail or pass based on FIXTURE_MANIFEST, or
mock the publish/version-create to throw a Prisma P2002 error and assert the
HTTP/handler returns a 409; locate and update the tests around the checks array
and the P2002 simulation (variables checks, FIXTURE_MANIFEST, error,
isUniqueViolation) to use real or mocked behavior instead of hardcoded values.
- Around line 69-96: The tests in plugin-lifecycle.feature.test.ts only write
and read fixture files (validating test infra) instead of invoking the real CLI
create flow; update the test to actually run the SDK create command by spawning
the CLI (e.g., run "npx tsx <cliPath> create ..." or use the existing cliPath
test helper) and assert the generated project structure and contents (manifest,
frontend mount behavior) rather than writing files directly—modify the relevant
test case(s) that currently manipulate pluginDir/frontend/src and use process
spawn or execa to call the create command, then read and assert files produced
by that command (referencing the test file name, the test case description, and
the create CLI invocation).
- Around line 154-158: The test currently asserts that the local constant
VALID_UMD contains 'mount' and 'exports' which is tautological; change the
"Given a UMD bundle, When content is validated, Then mount function presence is
checked" test to operate on real UMD output or the validation logic instead of
the constant: either (a) load or build an actual UMD bundle (from a fixture or
the build output) and assert that its string contains 'mount' and 'exports', or
(b) call the real validation function (e.g., validateUmdContent /
validateUmdBundle) with the real bundle content and assert the function returns
the expected result; replace references to VALID_UMD in this spec with the
loaded bundle or the validation function call.
- Around line 185-202: The two tests in plugin-lifecycle.feature.test.ts are
tautological (they only assert local values: mimeMap, isProd/hasHash -> cc) and
do not exercise CDN logic; replace them to call the actual CDN/middleware
utilities or endpoints instead of asserting hardcoded locals — e.g., invoke the
server route or the functions that compute MIME type and Cache-Control and
assert their responses; refer to the symbols mimeMap, isProd, hasHash and cc in
the diff as the offending locals to remove, and instead call the real handler or
helper (the CDN route handler or getMimeType/getCacheControl utility) or perform
an HTTP request against a test server or mocked CDN to verify correct MIME and
immutable Cache-Control behavior.
- Around line 207-243: The current tests in the "Given a published plugin..." /
"Given an installed plugin..." / "Given a postInstall hook failure..." / "Given
a preUninstall hook failure..." specs are tautological and do not exercise the
lifecycle logic; replace them with integration-style tests that invoke the real
install/uninstall handlers (e.g., call your installPlugin/uninstallPlugin or
WorkflowPlugin.install/WorkflowPlugin.uninstall entry points), simulate hook
outcomes (invoke or stub runPreInstall/runPostInstall/runPreUninstall hooks),
and assert observable side effects such as database records via
getInstallationStatus/getInstallationRecord and external effects like
disableWorkflowPlugin and unregisterRoles being called (use spies/mocks where
appropriate); ensure tests assert ordering by checking timestamps or spy call
order rather than comparing hardcoded arrays or boolean flags.

Comment thread bin/regression-guard.sh
Comment on lines +40 to +44
if (cd "$ROOT_DIR/packages/plugin-sdk" && npm run build 2>&1 >/dev/null); then
pass "packages/plugin-sdk builds"
else
fail "packages/plugin-sdk build failed"
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Incorrect redirect order — stderr escapes to terminal.

The redirect 2>&1 >/dev/null first sends stderr to stdout's current destination (terminal), then redirects stdout to /dev/null. This means error output still appears on the terminal rather than being suppressed. The correct order is >/dev/null 2>&1.

🔧 Proposed fix
-if (cd "$ROOT_DIR/packages/plugin-sdk" && npm run build 2>&1 >/dev/null); then
+if (cd "$ROOT_DIR/packages/plugin-sdk" && npm run build >/dev/null 2>&1); then
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (cd "$ROOT_DIR/packages/plugin-sdk" && npm run build 2>&1 >/dev/null); then
pass "packages/plugin-sdk builds"
else
fail "packages/plugin-sdk build failed"
fi
if (cd "$ROOT_DIR/packages/plugin-sdk" && npm run build >/dev/null 2>&1); then
pass "packages/plugin-sdk builds"
else
fail "packages/plugin-sdk build failed"
fi
🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 40-40: To redirect stdout+stderr, 2>&1 must be last (or use '{ cmd > file; } 2>&1' to clarify).

(SC2069)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bin/regression-guard.sh` around lines 40 - 44, The shell conditional that
runs the plugin-sdk build uses the wrong redirection order: in the if-statement
containing (cd "$ROOT_DIR/packages/plugin-sdk" && npm run build 2>&1 >/dev/null)
stderr is sent to the terminal because 2>&1 happens before stdout is redirected;
update the build command inside that conditional to redirect stdout first and
then stderr (i.e., use >/dev/null 2>&1) so both stdout and stderr are suppressed
when running the npm run build check.

Comment thread bin/regression-guard.sh
Comment on lines +65 to +71
if grep -q '"typecheck"' "$FRONTEND_DIR/package.json" 2>/dev/null; then
if (cd "$FRONTEND_DIR" && npm run typecheck 2>&1 >/dev/null); then
pass "$plugin — typecheck"
else
fail "$plugin — typecheck failed"
fi
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Same redirect order issue.

🔧 Proposed fix
-    if (cd "$FRONTEND_DIR" && npm run typecheck 2>&1 >/dev/null); then
+    if (cd "$FRONTEND_DIR" && npm run typecheck >/dev/null 2>&1); then
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if grep -q '"typecheck"' "$FRONTEND_DIR/package.json" 2>/dev/null; then
if (cd "$FRONTEND_DIR" && npm run typecheck 2>&1 >/dev/null); then
pass "$plugin — typecheck"
else
fail "$plugin — typecheck failed"
fi
fi
if grep -q '"typecheck"' "$FRONTEND_DIR/package.json" 2>/dev/null; then
if (cd "$FRONTEND_DIR" && npm run typecheck >/dev/null 2>&1); then
pass "$plugin — typecheck"
else
fail "$plugin — typecheck failed"
fi
fi
🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 66-66: To redirect stdout+stderr, 2>&1 must be last (or use '{ cmd > file; } 2>&1' to clarify).

(SC2069)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bin/regression-guard.sh` around lines 65 - 71, The redirection order in the
typecheck command is reversed (2>&1 >/dev/null) so stderr is not being silenced
correctly; update the command invocation inside the conditional that runs npm
run typecheck (the subshell using (cd "$FRONTEND_DIR" && npm run typecheck ...))
to use the correct combined redirection >/dev/null 2>&1 so both stdout and
stderr are suppressed while preserving the exit status checked by the if.

Comment thread bin/regression-guard.sh
Comment on lines +74 to +82
if grep -q '"test"' "$FRONTEND_DIR/package.json" 2>/dev/null; then
if (cd "$FRONTEND_DIR" && npm test --if-present 2>&1 >/dev/null); then
pass "$plugin — tests"
else
fail "$plugin — tests failed"
fi
else
skip "$plugin — no test script"
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Same redirect order issue.

🔧 Proposed fix
-    if (cd "$FRONTEND_DIR" && npm test --if-present 2>&1 >/dev/null); then
+    if (cd "$FRONTEND_DIR" && npm test --if-present >/dev/null 2>&1); then
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if grep -q '"test"' "$FRONTEND_DIR/package.json" 2>/dev/null; then
if (cd "$FRONTEND_DIR" && npm test --if-present 2>&1 >/dev/null); then
pass "$plugin — tests"
else
fail "$plugin — tests failed"
fi
else
skip "$plugin — no test script"
fi
if grep -q '"test"' "$FRONTEND_DIR/package.json" 2>/dev/null; then
if (cd "$FRONTEND_DIR" && npm test --if-present >/dev/null 2>&1); then
pass "$plugin — tests"
else
fail "$plugin — tests failed"
fi
else
skip "$plugin — no test script"
fi
🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 75-75: To redirect stdout+stderr, 2>&1 must be last (or use '{ cmd > file; } 2>&1' to clarify).

(SC2069)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bin/regression-guard.sh` around lines 74 - 82, The npm test invocation in the
conditional uses the wrong redirect order ("2>&1 >/dev/null") so stderr is
redirected to the original stdout instead of both streams going to /dev/null;
update the command in the if block that runs (cd "$FRONTEND_DIR" && npm test
--if-present 2>&1 >/dev/null) to redirect stdout first and then stderr (e.g.,
use >/dev/null 2>&1) so both stdout and stderr from npm test are silenced,
leaving the surrounding logic (variables FRONTEND_DIR, plugin and the
pass/fail/skip functions) unchanged.

Comment thread bin/regression-guard.sh
Comment on lines +84 to +93
# UMD build (if configured)
if grep -q '"build:umd"' "$FRONTEND_DIR/package.json" 2>/dev/null; then
if (cd "$FRONTEND_DIR" && npm run build:umd 2>&1 >/dev/null); then
pass "$plugin — UMD build"
else
fail "$plugin — UMD build failed"
fi
else
skip "$plugin — no build:umd script"
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Same redirect order issue.

🔧 Proposed fix
-    if (cd "$FRONTEND_DIR" && npm run build:umd 2>&1 >/dev/null); then
+    if (cd "$FRONTEND_DIR" && npm run build:umd >/dev/null 2>&1); then
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# UMD build (if configured)
if grep -q '"build:umd"' "$FRONTEND_DIR/package.json" 2>/dev/null; then
if (cd "$FRONTEND_DIR" && npm run build:umd 2>&1 >/dev/null); then
pass "$plugin — UMD build"
else
fail "$plugin — UMD build failed"
fi
else
skip "$plugin — no build:umd script"
fi
# UMD build (if configured)
if grep -q '"build:umd"' "$FRONTEND_DIR/package.json" 2>/dev/null; then
if (cd "$FRONTEND_DIR" && npm run build:umd >/dev/null 2>&1); then
pass "$plugin — UMD build"
else
fail "$plugin — UMD build failed"
fi
else
skip "$plugin — no build:umd script"
fi
🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 86-86: To redirect stdout+stderr, 2>&1 must be last (or use '{ cmd > file; } 2>&1' to clarify).

(SC2069)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bin/regression-guard.sh` around lines 84 - 93, The npm invocation inside the
if block that checks FRONTEND_DIR currently misorders shell redirections (the
subshell condition using cd "$FRONTEND_DIR" && npm run build:umd ...), causing
stderr/stdout handling to be incorrect; fix it by changing the redirection order
so stdout is redirected first and stderr follows (i.e., redirect stdout to
/dev/null then redirect stderr to the same place) in the subshell command used
for the UMD build check (the line containing npm run build:umd), leaving the
surrounding pass/fail/skip logic and variables like plugin intact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/infra Infrastructure changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants