Repository navigation
Conversation
Regression test report ✅Commit: Selected 1 changed tests (limit=20, 0 not selected) 2 tests: regression=2 unreleased=0 coverage=0 failing=0
TestAccept/bundle/deploy/readplan/fresh-checkout-wheel-wrapper/DMS=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): same output as main (9a14ad6) TestAccept/bundle/deploy/readplan/fresh-checkout-wheel-wrapper/DMS=true: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): |
✅ Integration test reportCommit: e350cab
Top 3 slowest tests (at least 2 minutes):
|
There was a problem hiding this comment.
Automated review at b7d2088. Each finding was verified against the code.
No blocking issues found. 4 non-blocking comment(s) below.
This PR makes bundle deploy --plan keep the previous state's <target>/.internal/ entries (the python_wheel_wrapper notebooks) in the pushed deployment state, and drops the ones this run's sync deleted. A new Sync.Deleted() reports those deletions. The main path is correct and the acceptance test covers the important flows. What's left: withKeptFiles dedups by local path when it should dedup by remote name, so it can write a state the next fresh-checkout deploy can't load. There are also gaps in the unit test and a small inaccuracy in the new deleted field comment.
andrewnester
left a comment
There was a problem hiding this comment.
Holding my approval until the open thread on bundle/deploy/state_update_test.go is settled.
|
/review |
There was a problem hiding this comment.
Automated review at 49a5e87. Each finding was verified against the code.
Not ready yet: 1 blocking issue(s), tagged [blocking].
This PR makes bundle deploy --plan keep the previous state's <target>/.internal entries, such as python_wheel_wrapper notebooks, in the pushed deployment.json. It does this through StateUpdateForSavedPlan, withKeptFiles and a new Sync.Deleted(). The approach works for the wrapper cases the acceptance test covers, but withKeptFiles only dedupes by remote name. If a matching file stops being a notebook, the state lists the same local path twice, and every later deploy from a fresh checkout fails to load the snapshot. There is also one imprecise doc comment.
Questions
File.remoteNamerepeats the rule fromlibs/syncnewSnapshotStateFrom(strip the extension for notebooks) inbundle/deploy, and thetakencheck depends on the two staying identical. Couldlibs/syncexport the helper, or report the remote names it tracks next toDeleted(), so the rule lives in one place? Or is the copy acceptable here? (non-blocking)
| for _, f := range kept { | ||
| // States written by CLI versions <= v0.220.0 on Windows use backslashes. | ||
| f.LocalPath = filepath.ToSlash(f.LocalPath) | ||
| if !taken[f.remoteName()] { |
There was a problem hiding this comment.
[blocking] withKeptFiles only checks remote names, but NewSnapshotState also rejects duplicate local paths (libs/sync/snapshot_state.go:56). Take target dev and src/dev/.internal/x.py, which splitInternalFiles treats as internal. It was deployed as a notebook, then its notebook header was dropped. An apply from a fresh checkout leaves {x.py, is_notebook:true} out of the snapshot, so the sync uploads x.py as a plain file and deletes nothing. Here the kept entry's remote name x doesn't collide with x.py, so it is appended. deployment.json now lists x.py twice, and every later plain deploy from a fresh checkout fails in StatePull with expected only one entry per file. Can you also mark each synced LocalPath as taken and skip kept entries whose local path is already listed? The doc comment on lines 83-85 should then mention both checks.
| type stateUpdate struct{} | ||
| type stateUpdate struct { | ||
| // keepInternalFiles keeps listing the previous state's entries under the | ||
| // target's .internal directory that are not on disk; see StateUpdateForSavedPlan. |
There was a problem hiding this comment.
[nit] The comment says entries are kept when they are "not on disk", but withKeptFiles decides by remote name and by what the sync deleted. Whether the file is on disk doesn't matter: a missing converted.py entry is dropped when a synced converted.ipynb has the same remote name. Maybe: "keeps listing the previous state's entries under the target's .internal directory whose remote name no synced file uses and this run's sync did not delete; see StateUpdateForSavedPlan."
Applying a saved plan from a fresh checkout keeps the remote wrapper notebooks (the build that writes them is skipped), but the pushed deployment state dropped them, so no later deploy deleted them. StatePullForSavedPlan now records the kept entries and StateUpdate lists them again. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Recording the kept entries during the state pull missed applies where the pull did not restore the state (cache kept, or a retry after a failed apply). StateUpdateForSavedPlan now takes the .internal entries from the previous deployment state it already loads. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
When bundle plan and bundle deploy --plan run in one checkout, the apply's sync deletes a wrapper no task needs any more. Re-listing it made every later apply delete it again. Sync now reports the remote names it deleted, and StateUpdateForSavedPlan skips those. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
A kept x.py notebook next to a synced x.ipynb has the same remote name, and a state listing both cannot be restored into a sync snapshot. withKeptFiles now skips kept entries whose remote name a synced file uses or the sync deleted. The unit test covers an internal file that is synced again and a notebook converted to .ipynb. Sync.Deleted() is reset at the start of every run. Co-authored-by: Isaac <no-reply@databricks.com>
errcode was removed on main in #7975. Co-authored-by: Isaac <no-reply@databricks.com>
49a5e87 to
e350cab
Compare
Changes
deploy.StateUpdateForSavedPlan(), used byphases.Deploywhen it applies a saved plan (bundle deploy --plan, andapps deploywith a saved plan). It keeps the previous deployment state's entries under<target>/.internal/that the synced files don't list, unless a synced file has the same remote name (for examplex.ipynbnext to a keptx.py) or this run's file sync deleted them. Plain deploys keep usingStateUpdate()unchanged.libs/sync:Sync.Deleted()returns the remote names the last run deleted (next toFileCounts());files.Uploadstores them inb.DeletedFiles. Without it, planning and applying in one checkout after a wrapper is no longer needed would re-list the wrapper the apply just deleted, and every later apply would report deleting it again.withoutInternalFilesbecomessplitInternalFiles, which returns both halves, so the pull and the update share one matcher.bundle/deploy/readplan/fresh-checkout-wheel-wrapper: the pushed state now lists the wrapper notebook after every apply. New steps: a second apply in the same checkout with its cache kept but no wrapper on disk (plan saved in another directory), a plain deploy from a fresh checkout withpython_wheel_wrapperdisabled, which deletes the wrapper (Files: 1 uploaded, 1 deleted), and plan-and-apply in one checkout after the wrapper is no longer needed (the apply deletes it, the state drops it, the next apply deletes nothing). Badness removed.Why
Since #7988, applying a saved plan from a fresh checkout keeps the remote
python_wheel_wrappernotebooks, because the plan skips the build that writes them and the plan's jobs still run them. But the state file list is built from the local synced files only, so the pusheddeployment.jsondropped the wrapper, and no later deploy could delete it. #7988 listed this under residual risks.Badness note:
Before:
After:
Other build-generated files: the wrapper notebooks are the only build outputs under the synced
.internaldirectory. Built artifacts (wheels, patched wheels) are uploaded as libraries and are not in the state's file list. Synced outputs of build hooks are deleted on apply by design (#7988).Tests
bundle/deploy/readplan/fresh-checkout-wheel-wrapper(both DMS variants). Withphases.Deployusing plainStateUpdate()for saved plans, the three state listings lose the wrapper and the plain deploy leaves it behind (Files: 1 uploaded, 0 deleted, the notebook is still listed). With the deleted-name filter removed, the plan-and-apply step's state still lists the deleted wrapper.TestSplitInternalFiles(renamed fromTestWithoutInternalFiles, also checks the internal half) andTestStateUpdateForSavedPlanKeepsInternalFiles(plain vs saved plan; the internal entry is kept, a removed file is dropped, a re-synced file is listed once, an entry the sync deleted is dropped).TestAccept/bundle/{deploy,python_wheel,artifacts,sync},TestAccept/{apps,pipelines,sync}, theREADPLAN=1runs of the bundle and apps sets, and thebundle,libs/syncandcmd/syncunit tests pass locally.Gaps and risks
libs/syncchange) or regenerating wrappers on apply; both are left for a follow-up.bundle destroyin that checkout, or when the sync deleted the wrapper but writing the local state then failed and the apply is retried. Such an entry only makes a later deploy delete a missing path under the CLI's.internaldirectory, which is ignored.workspace.file_patheven if it changed since the last deploy (already listed in Pull deployment state in bundle deploy --plan #7988).Cloud = false; the change only affects which entries go into the state file, and the testserver serves that file like any workspace file.Dashboard
TestAccept/bundle/deploy/readplan/fresh-checkout-wheel-wrapper (Badness note only, no CI failure).
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.