Repository navigation
feat(schema): compare jobs in the drift report - #41
Merged
Merged
Conversation
The drift report now lists the SQL Server Agent and pg_cron jobs that differ between two connections, or exist on only one. Jobs are matched by name (ids differ per server) and compared by a hash of their enabled schedules and steps; enabled state is left out, since a job paused outside production is not drift. A side without the grant to read jobs is named instead of compared. The modal opens a job on each side it exists on, and the MCP compare_objects tool lists jobs with their ids.
A failure to read jobs now names the side in the report instead of failing the object comparison with it. An unnamed pg_cron job is matched by its command, since its id differs per server, and the Agent schedule read is limited to this database's jobs.
A drift report carries names only; reading a job's command is a JOB_VIEW and is audited. An unnamed pg_cron job was shown by its command, which handed that text to any reader of the report. It is now shown as "(unnamed job <id>)" and matched on a separate key, a SHA-256 of its command.
|
🎉 This PR is included in version 2.8.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The drift report ("compare QA with PROD") now covers scheduled jobs as well as procedures, functions, views and triggers. Follow-up to #38, from user feedback asking for SQL jobs in the compare.
getJobDefinitions(server/services/jobs.ts) reads each SQL Server Agent / pg_cron job on the connection's database as text: its enabled schedules, plus each step's name, subsystem and command.getDriftcompares both sides and returns ajobssection withidentical,items(differs/only_left/only_right, with the job id on each side) andunavailable.compare_objectslists jobs with their id per connection, so an agent can follow up withget_job.Decisions
(unnamed job <id>)and matched on a SHA-256 of its command. The report never carries command text, since reading a command is an auditedJOB_VIEW.unavailableand still compares the objects. If neither side has any jobs, thejobssection is left out.Not done (from review)
Verified
npm test: 2429 tests pass, coverage still 100%. Format, lint (0 errors) and typecheck are clean.npm run dev:db(real pg_cron, QA vs PROD):differs;only on QA;vacuum-ordersopened both sides' job tabs.🤖 Generated with Claude Code