Skip to content

feat: auto-register quque job when created via CLI#1017

Merged
almas-x merged 1 commit intomasterfrom
almas/auto-register
Apr 23, 2025
Merged

feat: auto-register quque job when created via CLI#1017
almas-x merged 1 commit intomasterfrom
almas/auto-register

Conversation

@almas-x
Copy link
Contributor

@almas-x almas-x commented Apr 22, 2025

📑 Description

Closes https://github.com/goravel/goravel/issues/

✅ Checks

  • Added test cases for my code

Copilot AI review requested due to automatic review settings April 22, 2025 07:48
@almas-x almas-x requested a review from a team as a code owner April 22, 2025 07:48
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 functionality to automatically register queue jobs when they are created via the CLI. Key changes include updating the job stub to return a new signature string, modifying the job make command to handle an additional signature parameter and perform registration by updating the providers file, and adding a new matcher for jobs in the match package.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
queue/console/job_stubs.go Changed the job stub Signature() return value from "DummyName" to "DummySignature" to align with new stub replacement.
queue/console/job_make_command_test.go Updated tests to verify both job creation and registration behaviors, including handling of warning messages.
queue/console/job_make_command.go Modified to pass an extra signature parameter to the stub population and to update the providers file with job registration.
packages/match/helper_test.go & helper.go Added a new matcher for queue jobs to support the auto-registration functionality.
errors/list.go Added a new error (QueueJobRegisterFailed) for use when job registration fails.
Comments suppressed due to low confidence (1)

queue/console/job_stubs.go:15

  • Ensure that the stub string 'DummySignature' is consistently used with the populateStub method and job generation process to avoid mismatches in the job signature.
return "DummySignature"


ctx.Success("Job created successfully")

if err = modify.GoFile(filepath.Join("app", "providers", "queue_service_provider.go")).
Copy link

Copilot AI Apr 22, 2025

Choose a reason for hiding this comment

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

Consider checking for the existence of 'queue_service_provider.go' prior to applying modifications so that a missing file does not trigger a registration warning in production.

Suggested change
if err = modify.GoFile(filepath.Join("app", "providers", "queue_service_provider.go")).
providerFilePath := filepath.Join("app", "providers", "queue_service_provider.go")
if !file.Exists(providerFilePath) {
ctx.Warning(fmt.Sprintf("File %s does not exist. Skipping job registration.", providerFilePath))
return nil
}
if err = modify.GoFile(providerFilePath).

Copilot uses AI. Check for mistakes.
@almas-x almas-x force-pushed the almas/auto-register branch from 5e2d171 to 36c7174 Compare April 22, 2025 07:49
@codecov
Copy link

codecov bot commented Apr 22, 2025

Codecov Report

Attention: Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.

Project coverage is 70.97%. Comparing base (5e24173) to head (36c7174).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
queue/console/job_make_command.go 91.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1017      +/-   ##
==========================================
+ Coverage   70.92%   70.97%   +0.05%     
==========================================
  Files         170      170              
  Lines       11682    11705      +23     
==========================================
+ Hits         8285     8308      +23     
  Misses       3044     3044              
  Partials      353      353              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@hwbrzzl hwbrzzl left a comment

Choose a reason for hiding this comment

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

Nice 👍

@almas-x almas-x merged commit ee0bc55 into master Apr 23, 2025
13 checks passed
@almas-x almas-x deleted the almas/auto-register branch April 23, 2025 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants