Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shape Closure in Smithy Dafny #628

Open
texastony opened this issue Oct 10, 2024 · 2 comments
Open

Shape Closure in Smithy Dafny #628

texastony opened this issue Oct 10, 2024 · 2 comments

Comments

@texastony
Copy link
Contributor

texastony commented Oct 10, 2024

Issue

Which of the shapes in a Smithy Model path
(--model arguements to the CLI)
are represented by the output of Smithy Dafny
is surprisingly ambiguous.

Is it all the Shapes?
Clearly not, since a subject may depend on another (local) service,
and the dependencies shapes should not be represented in the output,
at least not entirely.

(By not entirely, I mean that they do not need a data structure definition,
but they may need import or conversion logic represented in the output.)

Is it all the Shapes in the namespace?

That seems to be the implied behavior,
but what about nested namespaces?

We have a real world example in the MPL's Key Store.

Is it just all the Shapes in the Service's closure, as the Smithy Spec suggests?

Clearly not,
as we need the "orphaned" shapes.

So what is it?

And how we can write tests that ensure all the output languages,
Dafny included,
behave the same with respect to shape closure.

Related Issues:

@texastony
Copy link
Contributor Author

Tooling to audit

Is there a Smithy CLI tool that can audit
a Model path for shapes outside of the service closure?

If so,
could we run that tool to see all the shapes
that, by Smithy's default behavior,
are ignored?

That... that might be a cheap "something".

Line Coverage

We could add test line coverage behavior to the execution of the "wrapped local service test" target.

Particularly if we can tell the line coverage mechanism to
only measure the "glue" of the MPL,
that would give us some indication of what we might be missing,
AND could be used to improve on the test coverage of the MPL.

@robin-aws
Copy link
Contributor

I agree it makes sense to have this issue separate from #627 at least - that one is about changing smithy-dafny configuration to align better with the Smithy spec and other code generators, but this one can be about clarifying the current behavior and mechanisms related to that.

IMO the current behavior is to generate for all shapes in a given namespace (i.e. the --namespace polymorph CLI option). That might not be true across all languages, but I'd call it a bug if not.

Nested namespaces is a fair question, but FWIW I made --namespace specifiable multiple times as part of #591, so that might be an easy solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants