feat(dq): add DQ rule lifecycle + job observability MCP tools#91
Draft
regmimridul wants to merge 16 commits into
Draft
feat(dq): add DQ rule lifecycle + job observability MCP tools#91regmimridul wants to merge 16 commits into
regmimridul wants to merge 16 commits into
Conversation
# Conflicts: # pkg/tools/register.go
Add tools to manage a DQ rule's full lifecycle and observe job runs:
get_dq_rule, edit_dq_rule, delete_dq_rule (rule CRUD); get_dq_rule_results
(per-run results/breaks); validate_dq_rule + preview_dq_rule_sql (catch a bad
rule before running); get_dq_job_status + get_dq_job_log (observe the run).
Rule/results/validate/preview use the internal DQ monitoring API; job status
uses the public /rest/dq/1.0/jobRuns/{jobRunId}; job log uses the internal
surface (no public log endpoint exists).
Refs: DEV-198734
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Guides the agent through the DQ rule workflow: prepare_create_dq_job for discovery ids, validate_dq_rule BEFORE create_dq_rule (catch bad SQL up front), then run_dq_job and observe via get_dq_job_status / get_dq_job_log / get_dq_rule_results. Documents the PUSHDOWN-only constraint, the FREEFORM_SQL/ SIMPLE_SQL enum, full-replace edit semantics, and destructive delete. Registers it in the collibra/index navigator. Refs: DEV-198734 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Instruct the agent to source a meaningful monitorName from the user (not an opaque auto-name) and, for SIMPLE_SQL rules, to ask for the target columnName. Refs: DEV-198734 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add tools for the DQ rule-template workbench:
- list_dq_rule_templates: list built-in (OOTB) + custom templates with filters
- get_dq_rule_template: read one template by id
- deploy_dq_rule_template: instantiate a template as concrete rules across
job/column targets (bulk), server-resolved dialect SQL, {template}_{column}
naming
Templates use the internal DQ API (/rest/dq/internal/v1/rules/templates). Note:
the DQ service exposes no template/data-type compatibility endpoint, so
incompatible combinations surface as deploy errors rather than being pre-flagged.
Refs: DEV-198734
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- generate_dq_rule_sql: turn a plain-language check into rule SQL via the internal DQ AI endpoint (POST /rest/dq/internal/v1/ai/text2sql). Returns a single SQL string (no separate filter clause); needs edgeSiteId/connectionId. - find_dq_rules: search existing rules (monitors) via the monitoring dashboard (POST /rest/dq/internal/v1/monitoring/monitors/dashboard), filtering by JOB_NAME/COLUMN_NAME/MONITOR_NAME — used for duplicate detection on a column. Both use the internal DQ API. Text2SQL is not in the OAS spec (hand-written client). Refs: DEV-198734 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Multi-turn flow to author DQ rules across many catalog columns: target columns (search or explicit) -> confirm -> define via template (deploy_dq_rule_template) or plain-language (generate_dq_rule_sql) -> validate/preview loop -> job assignment (prepare_create_dq_job/create_dq_job) -> confirm -> bulk execute with partial success, then observe. Reuses find_dq_rules for duplicate detection and edit_asset for catalog associations. Honestly documents current limitations: column search only supports Domain/Community/assetType as structured filters (rest via free-text/explicit); no template/data-type compatibility API; Text2SQL returns a single SQL string. Registers it in the collibra/index navigator. Refs: DEV-198734 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Align the skill with actual tool capabilities: notifications are job-level (create_dq_job), not per-rule (create_dq_rule has no notifications field); tolerance is a breaking-record count, not the ticket's "Tolerance %"; and the template deploy path inherits settings from the template rather than accepting per-target settings. Adds these to the known-limitations list. Refs: DEV-198734 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
In the workbench final-confirmation step, show the chosen template once with its
target columns grouped by job (rule name {template}_{column} per column) instead
of a flat list of template x column pairs. Plain-language path still lists one
entry per rule since each SQL can differ.
Refs: DEV-198734
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…plate Both write tools now enforce a review-before-write gate: confirm=false (default) returns a preview (create_dq_rule echoes the composed rule + SQL; deploy echoes the template id + targets) and writes nothing; confirm=true performs the write. This makes "review the SQL before saving" tool-enforced rather than skill guidance. Updates dq-rules and dq-rule-workbench skills + README to match. Refs: DEV-198734 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Find catalog Column assets by metadata the public REST search can't filter on — Description/Data Type attribute values, a Data Steward role, and relations to a Business Term / Business Rule / Data Element / Data Attribute (by name), AND-combined. Uses the DGC Knowledge Graph API (POST /graphql/knowledgeGraph/v1) with an AssetFilter built and chained via `_and`; relation filters use the OOTB system relation-type public ids (confirmed in pg-dgc). Query shapes verified live against the deployed KG schema. Requires the KG endpoint to be enabled on the instance. Classification-tag filtering is not supported (no KG predicate). Built against the deployed KG schema; other KG versions may differ. Refs: DEV-198734 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Column targeting now uses search_catalog_columns for the metadata filters (description, data type, data-steward role, business term/rule, data element/attribute). Rule 9 rewritten: KG API required, Classification Tags unsupported, timeout on broad lone filters, fallback to search_asset_keyword. Refs: DEV-198734 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@regmimridul do we have tests on the DQ side to ensure these API contracts will not change and will fail if someone modifies? |
Contributor
|
@regmimridul I would have the same comment as here -> #88 (comment) |
| @@ -0,0 +1,124 @@ | |||
| // Package preview_dq_rule_sql implements the preview_dq_rule_sql MCP tool: it | |||
There was a problem hiding this comment.
I recommend not including this endpoint since it returns live client data. I'm not sure if the results get passed into the LLM and we'd need to verify before we can go down this path.
Per PR review feedback (mirrored from PR 88): explain Collibra-coded terms so an LLM with no Collibra knowledge can use the tools. Gloss job/dataset, rule/monitor, jobRunId, edge/edgeSiteId/connectionId, dimensions, backrun, OOTB, tolerance, and FREEFORM_SQL/SIMPLE_SQL in each tool's Description and jsonschema fields, keeping the original terms so they still match. Descriptions/field docs only — no behavior, names, or logic changed. Refs: DEV-198734 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Drop preview_dq_rule_sql: it executed a rule's SQL against the source and returned actual sample rows, which would send live client data into the LLM. validate_dq_rule (validity + message, no row data) remains as the safe pre-flight. Removes the tool package, its client function PreviewDQRuleSQL and DQPreview* types (PreviewRuleRequest kept for validate_dq_rule), the registration, README entry, and skill references. Refs: DEV-198734 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Author
|
@aberkowCollibra @EricWarnerCollibra removed the preview_dq_rule_sql endpoint and updated the PR to use less of Collibra jargon. Will be adding tests to ensure that the API contracts do not change shortly. |
regmimridul
marked this pull request as draft
July 16, 2026 15:24
Per scope decision, drop out-of-scope capabilities: editing/deleting existing rules and triggering/observing job runs. Removes edit_dq_rule, delete_dq_rule, run_dq_job, get_dq_job_status, get_dq_job_log (tool packages), their client functions (EditDQRule/DeleteDQRule from dq_rules_client.go; the whole dq_jobs_client.go), registrations, README entries, and skill references. Kept get_dq_rule_results (read-only; reads results of runs triggered elsewhere). Remaining DQ rule surface: create_dq_rule, get_dq_rule, validate_dq_rule, get_dq_rule_results, find_dq_rules, list/get/deploy templates, generate_dq_rule_sql, search_catalog_columns. Refs: DEV-198734 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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 does this PR do?
Adds MCP tools to author, manage and observe data-quality rules and job runs on an existing DQ job (DEV-198734). Together they cover a rule's full lifecycle: preview/validate → create → read → edit → delete, plus run the job and observe the outcome.
Rule authoring & lifecycle (CRUD)
create_dq_rule— create a rule (monitor) on a job via the DQ monitoring API (POST /rest/dq/internal/v1/monitoring/monitor).monitorTypeisFREEFORM_SQL(full SQL) orSIMPLE_SQL(single-column check); supportsfilterQuery,columnName,dimensions,tolerance, and template linkage. Defaults to active and not suppressed.get_dq_rule— read a single rule's definition (GET /rest/dq/internal/v1/jobs/{jobName}/monitors/rules/{monitorName}).edit_dq_rule— update an existing rule; full-replace, withnewMonitorNameto rename (PUT /rest/dq/internal/v1/monitors/rules).delete_dq_rule— delete a rule from a job (DELETE /rest/dq/internal/v1/jobs/{jobName}/monitors/rules/{monitorName}). Marked destructive.Pre-flight & results
validate_dq_rule— validate a rule's SQL/definition before saving or running, so a malformed rule is caught up front (POST /rest/dq/internal/v1/rules/validate).preview_dq_rule_sql— run the rule's SQL and return sample columns + rows (POST /rest/dq/internal/v1/rules/previewRule).get_dq_rule_results— per-run results after a job run: score, breaking/passing counts, pass/fail, exceptions; paginated (GET /rest/dq/internal/v1/monitoring/rules/{jobName}/{ruleName}).(
validate_dq_rule/preview_dq_rule_sqltakeedgeSiteId/connectionId/schemaName— the discovery output fromprepare_create_dq_job.)Job run & observability
run_dq_job— trigger a run of an existing job, executing its rules (POST /rest/dq/1.0/jobs/{jobName}/run). OptionalrunDate/runDateEnd(dateKindDATE/TIMESTAMP) andbackrunbackfill; defaults to current date/time. Returns thejobRunId.get_dq_job_status— status of a run byjobRunIdvia the public API (GET /rest/dq/1.0/jobRuns/{jobRunId}): run status (RUNNING/FINISHED/FAILED…), activity, score, breaking-monitor count, failure exception.get_dq_job_log— execution log for a run (stages, timings, exceptions). Uses the internal DQ UI surface (GET /rest/dq/internal/v1/job/logs?jobUUID={jobRunId}) — the public DQ API has no log endpoint.All tools validate inputs before any call, surface downstream DQ errors (400/403/404/422) as structured results, and are covered by unit tests. API contracts were taken from the
dq(udq-app) controllers/OAS, not guessed. README updated with all entries.Refs: DEV-198734
✅ Checklist
🤖 Generated with Claude Code