test: cover the codegen CLI, introspect and the untested render paths - #29
Draft
TomChv wants to merge 1 commit into
Draft
test: cover the codegen CLI, introspect and the untested render paths#29TomChv wants to merge 1 commit into
TomChv wants to merge 1 commit into
Conversation
Coverage was lopsided: the generator sat at 75% while the CLI this stack was built around was at 0% for every subcommand, and three entrypoint render paths had never executed. 56.3% overall, but not where a regression would hurt. The real hole was enums and interfaces. The entrypoint golden happened to use neither, so renderEnumDef, renderEnumMemberCall, renderInterfaceDef and sortedEnumValueKeys had never run — for constructs modules use routinely. Rather than hand-write typedef JSON, the fixture module grew an @EnumType, an interface and a variadic and was rescanned with the real introspector, so the golden still pins the renderer against input it actually receives. The CLI tests cover dispatch and each required-flag error, and run each generator into a temp dir, which also exercises the overlay that writes results to disk. Introspect gets an httptest session: the token goes out as basic auth, only the payload under "data" is written, and a GraphQL errors array fails loudly rather than writing an empty schema — which would otherwise surface much later as bindings with no API in them. The routing check asserts what is otherwise invisible: both paths emit the same file names, so the bundle each module ends up with is the only evidence of which generator ran. Confirmed it fails when the condition is flipped. Coverage is now 70.6%, with the CLI at 80-90% per subcommand. Signed-off-by: Tom Chauveau <tom@dagger.io>
TomChv
force-pushed
the
feat/codegen-test-coverage
branch
from
August 12, 2026 13:57
f8d5ebb to
7f9fc67
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Coverage was lopsided: the generator sat at 75% while the CLI this stack was
built around was at 0% for every subcommand, and three entrypoint render paths
had never executed. 56.3% overall, but not where a regression would hurt.
The real hole was enums and interfaces. The entrypoint golden happened to use
neither, so renderEnumDef, renderEnumMemberCall, renderInterfaceDef and
sortedEnumValueKeys had never run — for constructs modules use routinely.
Rather than hand-write typedef JSON, the fixture module grew an @EnumType, an
interface and a variadic and was rescanned with the real introspector, so the
golden still pins the renderer against input it actually receives.
The CLI tests cover dispatch and each required-flag error, and run each
generator into a temp dir, which also exercises the overlay that writes results
to disk. Introspect gets an httptest session: the token goes out as basic auth,
only the payload under "data" is written, and a GraphQL errors array fails
loudly rather than writing an empty schema — which would otherwise surface much
later as bindings with no API in them.
The routing check asserts what is otherwise invisible: both paths emit the same
file names, so the bundle each module ends up with is the only evidence of
which generator ran. Confirmed it fails when the condition is flipped.
Coverage is now 70.6%, with the CLI at 80-90% per subcommand.
Signed-off-by: Tom Chauveau tom@dagger.io
Stack created with GitHub Stacks CLI • Give Feedback 💬