Repository navigation
Conversation
Co-authored-by: Isaac <no-reply@databricks.com>
Regression test report ✅Commit: Selected 4 changed tests (limit=20, 0 not selected) 8 tests: regression=8 unreleased=0 coverage=0 failing=0
TestAccept/bundle/validate/targets/scalar_rewrite_diagnostic/DMS=: branch ✅ | main (9e5ad79) ❌ | latest (v1.28.0) ❌main (9e5ad79): latest (v1.28.0): same output as main (9e5ad79) TestAccept/bundle/validate/targets/scalar_rewrite_diagnostic/DMS=true: branch ✅ | main (9e5ad79) ❌ | latest (v1.28.0) ❌main (9e5ad79): latest (v1.28.0): same output as main (9e5ad79) TestAccept/bundle/validate/variables/target_timestamp_shorthand/DMS=: branch ✅ | main (9e5ad79) ❌ | latest (v1.28.0) ❌main (9e5ad79): latest (v1.28.0): same output as main (9e5ad79) TestAccept/bundle/validate/variables/target_timestamp_shorthand/DMS=true: branch ✅ | main (9e5ad79) ❌ | latest (v1.28.0) ❌main (9e5ad79): latest (v1.28.0): same output as main (9e5ad79) TestAccept/bundle/variables/environments_shorthand/DMS=: branch ✅ | main (9e5ad79) ❌ | latest (v1.28.0) ❌main (9e5ad79): latest (v1.28.0): same output as main (9e5ad79) TestAccept/bundle/variables/environments_shorthand/DMS=true: branch ✅ | main (9e5ad79) ❌ | latest (v1.28.0) ❌main (9e5ad79): latest (v1.28.0): same output as main (9e5ad79) TestAccept/bundle/variables/target_override_nonstring_type/DMS=: branch ✅ | main (9e5ad79) ❌ | latest (v1.28.0) ❌main (9e5ad79): latest (v1.28.0): TestAccept/bundle/variables/target_override_nonstring_type/DMS=true: branch ✅ | main (9e5ad79) ❌ | latest (v1.28.0) ❌main (9e5ad79): latest (v1.28.0): |
✅ Integration test reportCommit: 97ee686
Top 3 slowest tests (at least 2 minutes):
|
There was a problem hiding this comment.
Automated review at 9bea59d. Each finding was verified against the code.
Not ready yet: 1 open question(s) about a change users could be hurt by.
This PR runs the target variable shorthand rewrite for the deprecated environments key as well as targets. It also accepts unquoted dates as short-form values, avoids the MustString panic on a non-string type, and leaves a non-map targets/environments for normalization to report. The rewrite logic looks right for the cases it targets. Before merging, please settle whether targets: false should still fail, and make the changelog mention the new failure for undefined variables under environments. The new acceptance test also builds its inputs in script, which the testing rules ask to avoid.
Questions
- [blocking] Should a non-map
targets(e.g.targets: false) still fail? Before this PR,bundle validateexited 1. Now it prints a located warning, exits 0 and uses the implicitdefaulttarget (see thescalar_rewrite_diagnosticgolden). The old Badness note only objected to the message and the missing location. Would you keep the located diagnostic but make it an error, or is the downgrade to a warning intended?
Comments outside the changed lines
- [nice to have]
acceptance/bundle/variables/target_override_shorthand_shapes/script: Thetargetsdate case repeats whatacceptance/bundle/validate/variables/target_timestamp_shorthandalready covers. Theenvironmentsoverride cases sit next toacceptance/bundle/variables/environments_shorthand. The testing rules ask to extend the existing directory when coverage overlaps. Could theenvironmentscases go intoenvironments_shorthand, with thetargetsdate case dropped here? Or is there a reason they need their own directory?
|
🤖 Thanks for the review at
The description's "Gaps and risks" now also lists one more case this round found. It behaves like AI agent (opus5.5, isaac_claude) |
|
Heads-up: #7975 removed the To fix: use |
Co-authored-by: Isaac <no-reply@databricks.com>
655d23a to
5f584e4
Compare
83f9ada to
3dd4049
Compare
|
🤖 Agreed, done in 3dd4049, after rebasing the stack on main (#8182 on 39d0695, this PR on top):
The regenerated goldens only drop AI agent (opus5.5, isaac_claude) |
rewriteShorthands rewrote target variable shorthands only under 'targets'. The deprecated 'environments' key is renamed to 'targets' after loading, so its short-form overrides failed normalization and were dropped with a warning. Rewrite both keys. Co-authored-by: Isaac <no-reply@databricks.com>
Rewrite unquoted dates, don't panic on a non-string variable type, and leave a targets or environments value that is not a map to normalization, which reports it at its location, instead of aborting the load. 'environments' was not rewritten before, so it keeps what normalization already applied: maps with 'default' or 'lookup' and non-map variables blocks are left as they were, and only scalars and other values of complex variables are rewritten. Fixes the recorded badness in target_timestamp_shorthand and scalar_rewrite_diagnostic. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Under environments, a map with only variable definition keys, such as
{sensitive: false}, was applied as a definition before. For a complex
variable it is now rewritten to its value. Leave such maps as they were.
Co-authored-by: Isaac <no-reply@databricks.com>
…hapes Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Address review: a scalar targets value (targets: false) failed before this PR, and the fix had turned it into a warning that fell back to the default target. Report it as an error at targets instead. The same holds for a targets sequence whose items have a malformed variables block, so targets keeps the rewrite in any shape. Mention the new undefined-variable failure under environments in the changelog. Commit the inputs of target_override_shorthand_shapes as files, project values with gron.py, and drop its targets date case, which validate/variables/target_timestamp_shorthand already covers. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
errcode was removed from main in #7975. Calls that fail use musterr, calls that succeed run without a wrapper. Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
Automated review at 3dd4049. Each finding was verified against the code.
No blocking issues found. 6 non-blocking comment(s) and 1 question(s) below.
This PR runs the short-form variable override rewrite for the deprecated environments key too, using a narrower "legacy" rule set. It also accepts unquoted dates as short forms, fixes the MustString panic on a non-string type, and reports a scalar targets value at its location. The core fix looks right. Remaining issues: variableDefinitionKeys leaves out value, which breaks the stated goal of keeping what normalization did before; the changelog overstates what the targets diagnostic covers; and there are a few test-convention points.
Questions
- Besides the
environmentsrewrite, this PR changestargetsbehavior in three independent ways: it acceptsKindTimeshort forms, fixes theMustStringpanic, and adds the locatedscalarTargetsError. Each changes its own golden and has its own changelog clause. AGENTS.md asks for one change per PR. Should these go into separate PRs, or do you prefer to keep them together here? (non-blocking)
3dd4049 to
f8ef767
Compare
Derive the keys of a variable definition from the TargetVariable JSON
tags. The hand-written list left out value, so under environments a
complex variable overridden with {value: ...} was read as a value; on
main normalization read it as a definition.
Move the cases of target_override_shorthand_shapes into the existing
tests on the same topic, using withdir and gron.py, and keep the
non-string type cases in target_override_nonstring_type. Add a table test
for isLegacyVariableOverrideDef. Say in the changelog that only a scalar
targets value gets a location.
Co-authored-by: Isaac <no-reply@databricks.com>
|
🤖 On the question of splitting the three
If a human reviewer prefers it, I'll move the located-error change, and the other two if wanted, into a separate PR on top of this one. AI agent (opus5.5, isaac_claude) |
Changes
rewriteShorthandsin bundle/config/root.go rewrites short-form target variable overrides (x: valuetox: {default: value}) before the configuration is normalized. It only looked attargets. The deprecatedenvironmentskey is renamed totargetsonly after loading, so short-form overrides underenvironmentsfailed normalization and were dropped with a warning. The root value was used. The rewrite now also runs forenvironments. As a result, the undefined-variable check (variable x is not defined but is assigned a value) now applies to short-form overrides there too.environmentswas not rewritten at all before, so it keeps what normalization already applied there. Maps withdefaultorlookup, maps with only definition keys (the JSON fields of a target variable:default,lookup,description,sensitive,type,value), andvariablesblocks that are not maps, are left as they were. Only scalars, and other maps given for complex variables, are rewritten. So full-form overrides that thetargetsrules don't recognize keep working as before, for example{default: v, sensitive: false}(also for complex variables) or{sensitive: false}alone (also for complex variables, which keep their root value).Fixed in the shared rewrite, for both keys:
x: 2024-01-01, loaded as a time value) was not treated as a short form and was dropped withexpected map, found time. This was recorded as Badness in acceptance/bundle/validate/variables/target_timestamp_shorthand. The golden now shows the date as the value, and the Badness is removed.typeon the root variable (type: 5) together with a map override panicked inMustString. Now normalization reports the invalid type.targetsvalue that is not a map (targets: false) failed withfailed to rewrite ...: expected a map or sequence, found bool, with no location. It is still an error, now reported at its location (Error: expected map, found bool at targets). This was recorded as Badness in acceptance/bundle/validate/targets/scalar_rewrite_diagnostic. The golden and the script's comment are updated, and the Badness is removed. Atargetssequence keeps going through the rewrite and its errors, as before. A non-mapenvironmentsstays a warning from normalization, as before.Tests:
full-form/case covers theenvironmentsmaps that stay as they were ({default, sensitive},{sensitive},{value}, also for complex variables), with the same values as on main.databricks.ymlper subdirectory: validate/variables/target_timestamp_shorthand has anenvironments/twin of its date case, and validate/targets/scalar_rewrite_diagnostic has the malformed-variablescases undertargets(also in a sequence) andenvironments, andenvironments: falsenext totargets. The non-stringtypecases overlap no existing test, so they are in the new small acceptance/bundle/variables/target_override_nonstring_type (targets/andenvironments/). A table test forisLegacyVariableOverrideDefis in root_test.go. Locally the four tests take about 0.42s per DMS variant in total (0.34s before the cases were moved).Why
This PR was created by analyzing coverage gaps. Coverage: http://go/cli/dashboard/coverage/file/bundle/config/root.go (
rewriteShorthands, which(*Root).MergeTargetOverridesrelies on).A dropped override gives no error: the bundle deploys with the root value of the variable.
environmentsis still accepted: the JSON schema marks it deprecated, but there is no warning at runtime.Test: #8182
Gaps and risks
bundle validateis tested. Every other bundle command uses the same loader.environmentsnow go through the same rewrite as undertargets, including its existing gaps. For example,.infbecomes a default that breaks-o json, as it already does undertargets. Before, it was dropped with a warning.environments, a complex variable overridden with only{sensitive: false}took that map as its value. It is fixed in the last commit and pinned in the second test. Astra then reviewed that head and found no new regression. The review comments on this PR (a non-maptargetshad become a warning that fell back to thedefaulttarget) went through one more round, which found the same problem for atargetssequence. Both are errors again, as on main, and are pinned in the tests. The second review-oss-bot review found a missingvaluekey (a regression underenvironments, fixed, with a test that fails without the fix) and asked for the test layout above. Astra reviewed the final diff after that and found no new regression; its remaining points are the two known gaps below (included files, nested dates).targets, a full-form override withsensitiveis not recognized as full form, and the whole map becomes the default. A complex value that is itself a map with only alookupkey is read as a full definition. Both behave the same before and after this PR.{created: 2024-01-01}) fail withcannot convert struct field to dynamic type "time". Undertargetsthis already happens on main, even in a target that isn't selected. Underenvironmentssuch a value was dropped before, and it now fails the same way. The conversion bug is separate.environments, a complex value (map or sequence) given in an included file whose root declaration is in another file is still dropped with a warning, as before. Each file is normalized before the merge, so the rewrite can't see the variable's type there. Undertargetssuch values are wrapped without knowing the type. Doing the same underenvironmentswould change how other maps there are read, so it is left out. Short-form scalars in included files are fixed.environments, a short-form override in an included file next to a full-form override of the same variable with a different type ({default: old}and42) now fails withcannot merge string with int. Before, the short form was dropped with a warning. The same config undertargetsalready fails this way on main, so this is the existingtargetsbehavior, not a new failure mode.git: ${var.g}override with a complex variable fails withcannot merge map with string, with or without a rootbundle.git. It is the same class as the known limitation recorded in acceptance/bundle/variables/issue_2436: targets are merged before complex variables resolve.🤖 AI agent (opus5.5, isaac_claude)
This pull request and its description were written by Isaac.