Open texastony opened 2 weeks ago
In the case of this String,
rather than just removing @required
,
Crypto Tools could replace @required
with @default("")
,
and then let the business logic treat "" as None.
The business logic already is required to assert 3 <= |ddbTableName| <= 255
,
or something like that.
But the Dafny type would not change from string
to Optional<string>
.
This is likely a separate issue, but there is a similar complexity around @extendable
rescues. How can you add new operations to such a shape?
@seebees Excellent point but definitely a separate issue - @default
is an existing Smithy trait that isn't designed to be used for resources or operations in the way you might be thinking. See https://github.com/smithy-lang/smithy-dafny/issues/558
I also cut https://github.com/smithy-lang/smithy-dafny/issues/557 as the breakage described in the example was preventable.
Well, the breakage would have preventable IF and ONLY IF Smithy-Dafny respects @default
...
The breakage would have been caught at the time of removing @required
if smithy diff was run on the change.
Still being able to make the change anyway by also adding @default
depends on smithy-dafny supporting it, true. But at least you would have known before changing MPL that you were going to break consumers.
Evolving Models
In theory, Smithy helps developers avoid Breaking changes.
It does this by publishing tooling and guides that dictate what changes are breaking vs those that are not.
In particular Update structures is of interest.
However, this is not possible for Smithy-Dafny consumers at this time, because Smithy-Dafny does not support the default trait.
Example case
In MPL#594, Crypto Tools removed the
@required
trait from a String,ddbTableName
.This passed all of the MPLs CI, but once Crypto Tools started testing against the DB-ESDK, Crypto Tools realized the Dafny type had subtly changed from
string
toOption<string>
. See DB-ESDK#1313.This is only test code, so Crypto Tools may not be blocked...
But Smithy cannot be fully utilized with out the
@default
trait.