Skip to content

Conversation

@kevalyq
Copy link
Contributor

@kevalyq kevalyq commented Oct 27, 2025

🤖 Add Dependabot Auto-Merge Workflow

This PR adds automated Dependabot PR merging for PATCH updates to the API repository.

📝 Changes

New File:

  • .github/workflows/dependabot-auto-merge.yml
    • Caller workflow using the reusable workflow from .github repo
    • Phase 1 policy: Auto-merge PATCH updates only
    • Squash merge strategy for cleaner history

🔧 Configuration

phase: "1"           # PATCH only
merge-method: "squash"  # Squash commits

Auto-merge Policy (Phase 1):

  • PATCH updates (1.2.3 → 1.2.4): Auto-merge after CI passes
  • 🔍 MINOR updates (1.2.0 → 1.3.0): Manual review required
  • ⚠️ MAJOR updates (1.x → 2.0.0): Manual review required

🔗 Dependencies

Requires:

✅ Benefits

  • 🚀 Automated updates: No manual intervention for low-risk PATCH updates
  • 🛡️ Risk mitigation: Manual review for potentially breaking changes
  • 📊 Consistency: Same policy across all SecPal repositories
  • 🔄 Maintainability: Changes to policy managed centrally

🧪 Testing

Once PR #75 is merged in .github repo, this workflow will:

  1. Trigger on Dependabot PRs
  2. Parse version numbers from PR title
  3. Auto-merge PATCH updates when CI passes
  4. Add informative comments on all Dependabot PRs

📚 Related

- Use centralized reusable workflow from .github repo
- Phase 1 policy: Auto-merge PATCH updates only
- Squash merge strategy for cleaner history

Requires: SecPal/.github#75 to be merged first

Benefits:
- Automated dependency updates for low-risk PATCH versions
- Manual review for MINOR/MAJOR updates
- Consistent policy across all SecPal repositories
Copilot AI review requested due to automatic review settings October 27, 2025 18:23
Copy link
Contributor

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

This PR adds automated Dependabot dependency management for the API repository, implementing Phase 1 of auto-merge capabilities that only merges PATCH-level updates automatically while requiring manual review for MINOR and MAJOR updates.

Key Changes:

  • Implements a caller workflow that delegates to a centralized reusable workflow in the .github repository
  • Configures Phase 1 auto-merge policy (PATCH updates only) with squash merge strategy
  • Sets up proper concurrency controls to prevent race conditions during auto-merge operations

Addresses Copilot review feedback for stability
@kevalyq kevalyq merged commit adc9fd2 into main Oct 27, 2025
9 checks passed
@kevalyq kevalyq deleted the feat/dependabot-auto-merge branch October 27, 2025 18:37
kevalyq added a commit that referenced this pull request Nov 1, 2025
- TokenRequest: Add 'nullable' to device_name validation (Comment #6)
- AuthController: Extract /me closure to me() method (Comment #5)
- routes/api.php: Replace inline closure with controller route
- AuthTest.php: Replace ALL assertStatus() with specific methods:
  - assertCreated() for 201 responses (7 occurrences)
  - assertUnprocessable() for 422 responses (4 occurrences)
  - assertUnauthorized() for 401 responses (4 occurrences)
  - assertOk() for 200 responses (5 occurrences)
- phpstan.neon: Add new assertion methods to ignore patterns

All 57 tests passing, Pint compliant, PHPStan 0 errors.
kevalyq added a commit that referenced this pull request Nov 1, 2025
* feat: Add Sanctum API token authentication (Issue #50 PR-4)

- Add HasApiTokens trait to User model
- Create personal_access_tokens migration (Sanctum requirement)
- Implement AuthController with token generation, logout, logout-all
- Add public /auth/token endpoint for token generation
- Add protected /auth/logout and /auth/logout-all endpoints
- Add example protected /me endpoint demonstrating auth:sanctum middleware
- Add comprehensive AuthTest with 18 test cases covering:
  * Token generation (valid/invalid credentials, validation, multi-device)
  * Protected endpoint access (authentication required, token validation)
  * Token revocation (single/all tokens, database verification)
  * Security (no sensitive data exposure, token hashing)
- Extend PHPStan ignores for PEST framework test patterns
- All 57 tests passing (140 assertions)
- PHPStan level max: 0 errors
- Pint: PSR-12 compliant

Scope: ~450 LOC (Controller: 77, Migration: 32, Tests: 264, Routes: 17)
Addresses: #50

* fix: Address Copilot review comments

- Extract validation to TokenRequest FormRequest (Laravel best practice)
- Refine PHPStan ignores: specific methods instead of wildcards
- Fix /me endpoint: explicit field selection to prevent sensitive data exposure
- Maintain type safety while supporting PEST framework patterns

Resolves all 4 Copilot review comments from PR #60.

* fix: Address ALL 20 Copilot review comments

- TokenRequest: Add 'nullable' to device_name validation (Comment #6)
- AuthController: Extract /me closure to me() method (Comment #5)
- routes/api.php: Replace inline closure with controller route
- AuthTest.php: Replace ALL assertStatus() with specific methods:
  - assertCreated() for 201 responses (7 occurrences)
  - assertUnprocessable() for 422 responses (4 occurrences)
  - assertUnauthorized() for 401 responses (4 occurrences)
  - assertOk() for 200 responses (5 occurrences)
- phpstan.neon: Add new assertion methods to ignore patterns

All 57 tests passing, Pint compliant, PHPStan 0 errors.

* fix: Address 2 final Copilot review comments (quality gaps)

- Add messages() method to TokenRequest for custom validation messages
  (Laravel best practice: FormRequests should provide user-friendly errors)

- Fix null-safety in AuthTest line 89: first()->name to first()?->name
  (Prevents potential null pointer exception in test assertions)

These issues should have been caught in pre-commit self-review.
Root cause: Mechanical comment fixes without thorough code quality check.

Quality lesson learned: ALWAYS do comprehensive self-review BEFORE push,
not just fix automated comments. Check Laravel conventions, null-safety,
and best practices proactively.
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.

2 participants