Repository navigation
Conversation
Regression test report ✅Commit: Selected 10 changed tests (limit=20, 0 not selected) 20 tests: regression=14 unreleased=0 coverage=6 failing=0
TestAccept/bundle/resource_deps/loop_depends_on/DMS=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): same output as main (9a14ad6) TestAccept/bundle/resource_deps/loop_depends_on/DMS=true: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): same output as main (9a14ad6) TestAccept/bundle/resource_deps/loop_jobs/DMS=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): same output as main (9a14ad6) TestAccept/bundle/resource_deps/loop_jobs/DMS=true: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): TestAccept/bundle/resource_deps/loop_saved_plan/DMS=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): same output as main (9a14ad6) TestAccept/bundle/resource_deps/loop_saved_plan/DMS=true: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): same output as main (9a14ad6) TestAccept/bundle/resource_deps/loop_secret_scope_acl/DMS=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): same output as main (9a14ad6) TestAccept/bundle/resource_deps/loop_secret_scope_acl/DMS=true: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): same output as main (9a14ad6) TestAccept/bundle/resource_deps/loop_self/DMS=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): TestAccept/bundle/resource_deps/loop_self/DMS=true: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): same output as main (9a14ad6) TestAccept/bundle/resource_deps/loop_state_grants/DMS=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): same output as main (9a14ad6) TestAccept/bundle/resource_deps/loop_state_grants/DMS=true: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): TestAccept/bundle/variables/resolve-resources-fields/DMS=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): same output as main (9a14ad6) TestAccept/bundle/variables/resolve-resources-fields/DMS=true: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): same output as main (9a14ad6) |
✅ Integration test reportCommit: 6cb1391
Top 3 slowest tests (at least 2 minutes):
|
There was a problem hiding this comment.
Automated review at f291e82. Each finding was verified against the code.
Not ready yet: 1 blocking issue(s), tagged [blocking].
This PR makes bundle validate report resource dependency cycles, and makes plan and deploy report them before any files are uploaded. It does this by building the plan's own graph without API calls. It also makes edge order in makeGraph deterministic and fixes cycle labeling in dagrun.DetectCycle. The approach holds up, but the edge filter in DetectDependencyCycle edits the open deployment state in place, and that should be fixed before merge. The other comments are smaller rule and test cleanups.
Questions
- The
dagrun.DetectCyclelabel fix changesbundle plan's existing error message (for examplevia ${resources.apps.baz.id}becomesvia ${resources.schemas.bar.name}), and it also stops skipping empty labels. That is separate from adding the validate-time check, and AGENTS.md asks for one change per PR. Should it land in its own PR, or does it need to stay here because the new check's messages depend on it? (non-blocking)
|
On the question about the AI agent (opus5.5, isaac_claude) |
Sankalp-Mittal
left a comment
There was a problem hiding this comment.
[AI Generated] Review by review-factory (Claude Opus 5.5 + Claude Opus 5.5 + Claude Sonnet 5.5, cross-verified). Only points the reviewers agreed on are posted.
Sankalp-Mittal
left a comment
There was a problem hiding this comment.
[AI Generated] Follow-up review by review-factory (Claude Opus 5.5 + Claude Opus 5.5 + Claude Sonnet 5.5, cross-verified). Only points the reviewers agreed on are posted.
No new issues found.
…ploads files The plan rejects a cycle in resource references and lifecycle.depends_on, but only after deploy has uploaded the bundle files, and validate accepted it. Run the same check in FastValidate (validate, plan, deploy, deployment migrate), building the edges with the code the plan uses. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Running the check in FastValidate saw the config before the build and the plan-time fixups, and also ran for deploy --plan: - the python wheel wrapper moves wheel task parameters out of the job during the build, so a reference to the job's own id there is not a cycle; - secret scope ACLs are added by SecretScopeFixups; - deploy --plan applies a saved plan without planning the current config. Run it in PreDeployChecks right after SecretScopeFixups for plan and deploy (before any upload, skipped for --plan), and in the validate command, where it is skipped when the wheel wrapper is enabled. DetectCycle included the edge entering the cycle from outside in the message when the cycle was reached from another node. Co-authored-by: Isaac <no-reply@databricks.com>
Calling makePlan and makeGraph builds exactly the plan's graph, instead of a second copy of makePlan's per-node steps that could drift from it, so the makePlan refactor is reverted. enum_resource_refs refers to another job instead of its own id, which is a cycle; resolve-resources-fields keeps its self-reference and ignores the .databricks directory the failing validate leaves behind. Co-authored-by: Isaac <no-reply@databricks.com>
…en the detector
- Plan and deploy run the check right before deploy (after ResolveJobRunFileTriggers,
which replaces on_file_change values), planning against the open state: emptied
grants that are still in state stay in the plan, so a cycle through them is
reported before upload.
- Edges to nodes outside the plan (references resolved later, such as
${artifacts...} before the build) are dropped instead of hiding every cycle.
- A config makePlan panics on (a resource key with a dot) no longer crashes
validate; the plan still reports it as before.
- makeGraph adds edges in sorted order, so a config with several cycles always
reports the same one.
- DetectCycle keeps empty edge labels so the message cannot index past them.
Co-authored-by: Isaac <no-reply@databricks.com>
makePlan gives a resource planned for deletion the DependsOn slice recorded in state, so filtering it in place rewrote the open state. Build new slices instead, and test that the state passed in is left unchanged. Skip configs with a resource key that does not survive its string form (a key with a dot, which makePlan panics on) explicitly, instead of recovering from any panic. resolve-resources-fields records the expected validate failure with errcode, so the cleanup runs and the .databricks ignore is gone. Use diag.Errorf and drop a guard for a cycle without nodes, which DetectCycle never returns. Co-authored-by: Isaac <no-reply@databricks.com>
ResolveJobRunFileTriggers replaces a job run's lifecycle.triggers_state, so a reference written there never reaches the plan. Running the cycle check before it (for example right after PreDeployChecks, ahead of the predeploy script) would reject such a config that plan and deploy accept today. The new test covers that, and the comment names the reason. Co-authored-by: Isaac <no-reply@databricks.com>
…fields main removed the errcode helper (#7975); validate fails here on purpose (bar refers to its own name), so record it with musterr as .agents/rules/testing.md asks. The golden loses only the exit-code lines errcode printed. Co-authored-by: Isaac <no-reply@databricks.com>
aabd662 to
6cb1391
Compare
Changes
bundle validatenow reports a cycle in resource dependencies (cross-resource references andlifecycle.depends_on), andbundle plan/bundle deployreport it before anything is uploaded.validate.DependencyCycle) runs in the validate command. For plan and deploy it runs incmd/bundle/utils/process.goright before deploy, after the build, the plan-time fixups (SecretScopeFixups) andResolveJobRunFileTriggers, so it sees the config the plan sees. It runs only whenPreDeployChecksis on, so it is skipped fordeploy --plan, which applies a saved plan without planning the config. Destroy, summary, open, run anddeployment migratedon't run it.direct.DetectDependencyCyclebuilds the plan's own graph: it runsmakePlanandmakeGraph, with adapters that have no client (no API calls), on aDeploymentBundleof its own. Validate plans against empty state; plan and deploy plan against the state they already have open, so resources kept only because they are in state (emptied grants still to be removed) are covered too. Edges to nodes outside the plan (${artifacts...}before the build, a missing resource) are dropped into new slices (a deleted resource's dependency list is shared with the open state, so nothing is filtered in place), which only removes edges, so they don't hide a cycle elsewhere. The detector modifies neither the config nor the state. Other errors are left for the plan to report, and so is a config with a resource key that does not survive its string form (a key with a dot, on whichmakePlanpanics, as on base): the detector checks for such keys up front and skips them.makeGraphnow adds edges in sorted key order (it ranged over a map), so a config with several cycles always reports the same one.experimental.python_wheel_wrapperis on: the build moves wheel task parameters (and any reference in them) out of the job, so before the build the config can show a cycle the plan never sees. Plan and deploy still check after the build.dagrun.DetectCyclelisted the edge entering the cycle from outside when the cycle was reached from another node, so the message named the wrong reference (resources.schemas.bar refers to itself via ${resources.apps.baz.id}instead of${resources.schemas.bar.name}). Fixed; this also changes the plan's message.Why
Badness notes this removes:
resource_deps/loop_self: "validate accepts a job whose name references its own id ('Validation OK!'), and deploy uploads the bundle files before failing with 'cycle detected'. validate should report the cycle, and deploy should fail before uploading."resource_deps/loop_jobs: "Files are uploaded then deployment fails with loop error; should not upload the files in this case; validate should fail as well" (and the inline "validate could detect this and fail as well" in both scripts).Before (validate, then deploy):
After (validate and deploy):
#6704 (draft) moves the file upload after plan approval for every deploy; this PR does not overlap with it: it only stops cyclic configs earlier, at validate time.
Tests
resource_deps/loop_self,loop_jobs: validate fails with the cycle; plan and deploy report it, deploy without uploading.resource_deps/loop_depends_on: a cycle throughlifecycle.depends_onand a reference.resource_deps/loop_secret_scope_acl: a cycle through the secret scope ACL that plan/deploy add; validate can't see it, deploy reports it before uploading.resource_deps/loop_wheel_wrapper: with the wheel wrapper, a wheel parameter referring to its own job id still passes validate and plans.resource_deps/loop_saved_plan:deploy --planstill applies a saved plan after the config was edited into a cycle.resource_deps/loop_state_grants: a deployed schema whose grants are emptied and that depends on them; the cycle exists only with state, and deploy reports it without uploading.resource_deps/loop_job_run_triggers_state: a job run whoselifecycle.triggers_stateholds a reference to itself still plans and deploys, becauseResolveJobRunFileTriggersreplaces that map before the plan. It pins why the check for plan and deploy runs after the file triggers (and so after the predeploy script): it fails if the check is moved earlier.validate/enum_resource_refsused${resources.jobs.my_job.id}inside my_job as a sample unresolved reference; that is a cyclebundle planalready rejects, so it now refers to a second job and its output is unchanged.variables/resolve-resources-fieldsdeliberately refers to${resources.schemas.bar.name}inside bar (plan already rejects it, checked locally). The script now records the failure witherrcode(the cleanup runs, noIgnoreneeded), and its golden shows validate reporting the cycle. The resolution output it tests is unchanged.TestDetectDependencyCycle(cases that must not be rejected, includingdepends_onon empty grants and a dotted resource key; a cycle next to an${artifacts...}reference; messages),TestDetectDependencyCycleLeavesStateUnchanged(a deleted resource whose recorded dependencies include a node in neither config nor state), andTestDetectCycleReachedFromAnotherNodein libs/dagrun (including unlabeled edges).loop_wheel_wrapperfails without the wrapper skip,loop_state_grantsfails when the check plans against empty state, the dagrun test fails without the label fix, the state test fails with the in-place filter, and the dotted-key case panics without the key check.resolve-resources-fields(two cycles) passed 30 of 30 runs after the sorted-edges change.Gaps and risks
Risk: low. The check only adds an earlier report of configs the plan already rejects, and it writes nothing.
bundle validateever saw (never planned or deployed) and that has a reference cycle now fails validate. Such a config can never be deployed, so this turns a later failure into an earlier one.whl/jarlibrary entries, which the build rebuilds with only the file path: in another key of that entry (which the build drops, so it is never deployed), or literally in the file path (which would have to exist on disk under that name). Left as is.bundle deployment migratehas no cycle check, as on base.recover()gone, a panic inmakePlanon some other config would now show up in validate too; the plan panics on the same config, and no reviewer found such an input.dagrunformat, now also printed by validate) runs its clauses together; a follow-up can add separators.dagrunlabel fix stays in this PR because the validate diagnostic depends on the cycle's nodes and edges lining up; it also corrects the plan's message for a cycle entered from another resource.Dashboard: TestAccept/bundle/resource_deps/loop_self, TestAccept/bundle/resource_deps/loop_jobs (Badness notes, no failures).
This PR fixes behavior recorded as Badness in acceptance tests.
🤖 AI agent (opus5.5, isaac_claude)
This pull request and its description were written by Isaac.