Skip to content

Fix CI test failure and CommitCommand edit flow validation#15

Merged
naheel0 merged 2 commits intocodefrom
copilot/sub-pr-13
Mar 23, 2026
Merged

Fix CI test failure and CommitCommand edit flow validation#15
naheel0 merged 2 commits intocodefrom
copilot/sub-pr-13

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 23, 2026

Description

Two unresolved CodeRabbit issues causing CI failure and broken UX in the commit workflow.

CI fix (package.json)

  • "test" was hardcoded to exit 1, failing every CI run. Changed to npm run lint (TypeScript type-checking) as a meaningful smoke test until a real test suite is added.

CommitCommand edit flow (CommitCommand.ts)

  • Invalid AI suggestion previously aborted the command entirely — now warns and routes user into the edit flow.
  • Invalid manual edit previously returned to the outer accept/edit/reject loop, where a blank Enter would silently commit the stale AI suggestion. Now keeps prompting within the edit loop until a valid message is entered.
  • Added a defensive null-check before git.commit() since commitMessage is now typed as string | null.
-  if (suggestedValidationError) {
-    logger.error(`Invalid AI commit message ...`);
-    return;  // abort
-  }
+  if (suggestedValidationError) {
+    logger.warn(`Invalid AI commit message: ${suggestedValidationError}`);
+    console.warn(`⚠️ AI returned an invalid message: ${suggestedValidationError}`);
+    // fall through to edit loop
+  }

   if (choice === 'e' || choice === 'edit') {
-    const editedMessage = await rl.question(...);
-    if (editedValidationError) { continue; }  // back to outer loop
+    while (true) {
+      const editedMessage = await rl.question(...);
+      if (!editedValidationError) { commitMessage = editedMessage.trim(); break; }
+      console.error(`❌ Invalid commit message: ${editedValidationError}`);
+    }
     break;
   }

Related Issue

Closes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 📝 Documentation update
  • 🔧 Refactor / internal improvement
  • 🤖 CI/CD or tooling change
  • ⬆️ Dependency update

Checklist

  • I have read the CONTRIBUTING guidelines (if present)
  • My code follows the existing code style
  • I have added or updated tests that cover my changes
  • All existing tests pass locally
  • I have updated the documentation where necessary
  • My changes do not introduce new security vulnerabilities

How Has This Been Tested?

npm run lint and npm run build pass. npm test (now aliased to lint) exits 0. Edit-flow logic verified by code inspection against all input branches.

Screenshots (if applicable)

N/A

Additional Notes

CodeQL scan found 0 alerts.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add new AI-powered commands and features to the CLI Fix CI test failure and CommitCommand edit flow validation Mar 23, 2026
Copilot AI requested a review from jaseel0 March 23, 2026 04:37
@jaseel0 jaseel0 marked this pull request as ready for review March 23, 2026 04:38
@jaseel0 jaseel0 requested a review from naheel0 March 23, 2026 04:44
@naheel0 naheel0 merged commit 9e3f749 into code Mar 23, 2026
2 checks passed
@naheel0 naheel0 deleted the copilot/sub-pr-13 branch March 23, 2026 04:46
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.

3 participants