Repository navigation
Record unbind history outside StateDB - #7818
shreyas-goenka wants to merge 1 commit into
Conversation
f961619 to
572ef11
Compare
Regression test report ✅Commit: Selected 20 changed tests (limit=20, 3 not selected) 26 tests: regression=16 unreleased=0 coverage=10 failing=0
TestAccept/bundle/deployment/bind/feature_spec/DMS=true/OUTPUT_MODE=recorded: branch ✅ | main (e2048bb) ❌ | latest (v1.28.0) ❌main (e2048bb): latest (v1.28.0): TestAccept/bundle/dms/bind-immutable/DMS=true: branch ✅ | main (e2048bb) ❌ | latest (v1.28.0) ❌main (e2048bb): latest (v1.28.0): same output as main (e2048bb) TestAccept/bundle/dms/bind-unbind/DMS=true: branch ✅ | main (e2048bb) ❌ | latest (v1.28.0) ❌main (e2048bb): latest (v1.28.0): TestAccept/bundle/dms/bind-upload-failure/DMS=true: branch ✅ | main (e2048bb) ❌ | latest (v1.28.0) ❌main (e2048bb): latest (v1.28.0): TestAccept/bundle/dms/unbind-upload-failure/DMS=true: branch ✅ | main (e2048bb) ❌ | latest (v1.28.0) ❌main (e2048bb): latest (v1.28.0): TestAccept/bundle/dms_fault/complete_version/DMS=true: branch ✅ | main (e2048bb) ❌ | latest (v1.28.0) ❌main (e2048bb): latest (v1.28.0): 10 more failure details omitted, see the full report in the run. |
572ef11 to
1ec93c8
Compare
1ec93c8 to
31ef70d
Compare
✅ Integration test reportCommit: 650d05b
Top 3 slowest tests (at least 2 minutes):
|
31ef70d to
6a37f55
Compare
6a37f55 to
2450b54
Compare
2450b54 to
b780176
Compare
b780176 to
69251d6
Compare
69251d6 to
650d05b
Compare
There was a problem hiding this comment.
Automated review at 650d05b. Each finding was verified against the code.
No blocking issues found. 3 non-blocking comment(s) and 1 question(s) below.
This PR records deployment history for bundle deployment unbind. It returns the removed state keys and the committed serial from DeploymentBundle.Unbind, then publishes them as cleared-state operations in a separate binding version, the same way bind records its history. I traced the serial prediction, the empty and missing-key paths and the shadow-feature stamping, and they hold up. What's left is duplicated code with Bind, a comment that doesn't explain the serial bump, and a new test directory that mirrors an existing one. One open question: should DMS be updated before the remote state upload succeeds?
Questions
recordUnbindHistorysends and drains the cleared-state operations as SUCCEEDED beforePushResourcesState(bundle/phases/bind.go:200-205). When the upload fails, the version completes with FAILURE, but DMS has probably already droppedjobs.upload_failed, while the remoteresources.jsonstill binds it (unbind-upload-failure/output.txt). Is that split intended, as with bind? If so, can the test also showbundle-deployments list-resourcesafter the failure? If not, should the operations be recorded only after the push succeeds? (non-blocking)
| return err | ||
| return nil, err | ||
| } | ||
| var configured *bool |
There was a problem hiding this comment.
[nice to have] This block reads configRoot.Experimental.DeploymentHistory and sets FeatureDeploymentHistoryShadow when history is on. It is a copy of lines 116-126 in Bind, so if the rule for when the marker is set changes in one place, bind and unbind will drift apart. Can it move into one helper on DeploymentBundle (or in dstate) that both call?
There was a problem hiding this comment.
🤖 Should fix +1, and the two copies have already drifted. Since this PR was cut, #7817 changed Bind's copy to bundleenv.DeploymentHistoryChoice: an explicit setting wins, otherwise the loaded marker decides (c666673). bundleenv.RecordsDeploymentHistory no longer exists on #7817's branch or on main (#7895). So once this PR is rebased (GitHub already reports a conflict), this line stops compiling:
bundle/direct/bind.go:288:45: undefined: bundleenv.RecordsDeploymentHistory
I checked by cherry-picking this commit onto the current #7817 branch and applying Bind's current rule here. It builds, and ./bundle/direct, ./bundle/phases, TestAccept/bundle/dms, TestAccept/bundle/dms_fault and TestAccept/bundle/deployment/(bind|unbind) pass. The only golden changes are version numbers in dms/bind-unbind and dms/unbind-upload-failure, which come from #7817's max(next, serial) change. Moving the block into one helper that Bind and Unbind both call would stop the next change to this rule from missing one of them. The case without an explicit setting is the one whose code changes, so the earlier suggestion on bind-unbind/script line 33 (run this unbind without DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY) would cover it.
| var metadata *DMSUnbindMetadata | ||
| if b.StateDB.RecordsHistory() { | ||
| metadata = &DMSUnbindMetadata{Serial: b.StateDB.Data.Serial} | ||
| // Finalize commits the removals below as one existing WAL transaction. |
There was a problem hiding this comment.
[nit] The comment doesn't say why the serial only advances when State != nil. The reason is that DeleteState returns early without a WAL entry when Data.State is nil, and otherwise always appends one, even for a missing key. That entry is what makes mergeWalIntoState advance the serial. Something like "Every DeleteState below appends a WAL entry unless State is nil, so Finalize advances the serial by exactly one" would make the ++ read as intended rather than as a guess about Finalize.
| @@ -0,0 +1,15 @@ | |||
| envsubst < databricks.yml.tmpl > databricks.yml | |||
There was a problem hiding this comment.
[nice to have] This script mirrors acceptance/bundle/dms/bind-upload-failure/script almost line for line: the same setup bind, the same fault.py on resources.json, the same musterr, the same //complete check and the same bundle summary projection. Only bind/unbind changes, and test.toml is copied too. .agents/rules/testing.md asks to extend the existing acceptance directory when coverage overlaps. Can the unbind case become an extra titled phase in bind-upload-failure, renamed to cover both?
Sankalp-Mittal
left a comment
There was a problem hiding this comment.
[AI Generated] Review by review-factory (Claude Opus 5.5 + Claude Sonnet 5.5 + Claude Opus 5.5, cross-verified). Only points the reviewers agreed on are posted.
No blocking or major issues found.
| rm -f "$OUT_REQUESTS" | ||
|
|
||
| title "Unbind preserves the shadow history marker and leaves the job intact" | ||
| trace $CLI bundle deployment unbind foo |
There was a problem hiding this comment.
[AI Generated] This unbind runs with DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY=true, so it passes even if Unbind ignored the loaded shadow marker, and no other test covers that. Clear the variable here, like the rebind at line 47?
denik
left a comment
There was a problem hiding this comment.
🤖 Automated review of 650d05b by Opus and Astra (two independent Astra passes plus a devil's-advocate pass; Fable was unavailable this round). Each finding was verified against the code.
Verdict: the unbind history path looks right for this diff. It records the parent and its permissions/grants as cleared-state operations, skips the version when nothing was removed, and fails the version when the state upload fails. It needs a rebase onto #7817 first, and after that Unbind has to follow Bind's new history rule to compile (see the thread on bundle/direct/bind.go).
Readiness:
- Conflicts with its base
out-of-band-bind-history(#7817), which has moved on since this PR was cut. CI, regression and integration results are for the old base, so they'll need to run again after the rebase.
Not posted inline:
bundle/phases/bind.go:238: question, not a defect. The API hasOPERATION_ACTION_TYPE_UNBIND, but unbind is recorded asOPERATION_ACTION_TYPE_UPDATEwith cleared state, so history can't tell an unbind from an update that cleared state. #7817 records bind asUPDATErather thanBINDtoo. Is that deliberate, for example because the service handles those types differently?bundle/phases/bind.go:200: +1 to review-oss-bot's question about publishing the removals beforePushResourcesState. #7817's bind publishes in the same order, so one decision should cover both commands.
| return err | ||
| return nil, err | ||
| } | ||
| var configured *bool |
There was a problem hiding this comment.
🤖 Should fix +1, and the two copies have already drifted. Since this PR was cut, #7817 changed Bind's copy to bundleenv.DeploymentHistoryChoice: an explicit setting wins, otherwise the loaded marker decides (c666673). bundleenv.RecordsDeploymentHistory no longer exists on #7817's branch or on main (#7895). So once this PR is rebased (GitHub already reports a conflict), this line stops compiling:
bundle/direct/bind.go:288:45: undefined: bundleenv.RecordsDeploymentHistory
I checked by cherry-picking this commit onto the current #7817 branch and applying Bind's current rule here. It builds, and ./bundle/direct, ./bundle/phases, TestAccept/bundle/dms, TestAccept/bundle/dms_fault and TestAccept/bundle/deployment/(bind|unbind) pass. The only golden changes are version numbers in dms/bind-unbind and dms/unbind-upload-failure, which come from #7817's max(next, serial) change. Moving the block into one helper that Bind and Unbind both call would stop the next change to this rule from missing one of them. The case without an explicit setting is the one whose code changes, so the earlier suggestion on bind-unbind/script line 33 (run this unbind without DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY) would cover it.
Changes
Record committed
bundle deployment unbindremovals asUPDATEoperations through a separate history loop. Include removed permissions/grants entries and skip versions when nothing was removed.Why
Unbind must clear deployment history while preserving workspace resources and StateDB's existing transaction count. History failures warn; state-upload failures still fail the command and recorded version.
Stacked on #7817.
Tests
This PR was written by Codex.