Repository navigation
chore: remove examples and compile docs snippets in CI - #1298
Open
dreamorosi wants to merge 17 commits into
Open
dreamorosi wants to merge 17 commits into
dreamorosi wants to merge 17 commits into
Conversation
The examples duplicated the docs snippets, were not referenced by the docs build, and their CDK app was the largest source of Dependabot alerts. The package publishing workflow now verifies the packed NuGet packages by building the docs snippets against them instead of running example tests, and a new workflow builds the snippets on changes to them or the libraries.
Compile batch, idempotency, JMESPath and metadata examples with invisible scaffolding. Replace obsolete idempotency builder calls and inaccessible batch exceptions. Avoid duplicate JMESPath types in Release.
Wrap top-level-statement regions in namespaces and a static method so they compile in the snippets library. The wrapper's opening line carries a "hidden" snippet marker so the rendered docs stay unchanged. Move the class library and idempotency regions (file-scoped namespaces) into their own files and compile out their [assembly: LambdaSerializer] attributes. Add stand-ins for generated and domain types in Support.cs. Fix docs bugs: missing return in record_metadata, invalid private local functions in error_handling, ProcessPayment call/signature mismatch and void [Idempotent] method, and a testing sample that used internal ConsumerRecords members. Replace the examples/kafka tip with short code generation guidance.
Wrap independent examples in isolated namespaces and supply hidden scaffolding so snippet regions remain recognizable. Update the ASP.NET Core middleware example to use the current library API.
Wrap AppSync Events and Bedrock Agent examples in invisible compile scaffolding and fix outdated response APIs and example types.
Scope duplicate examples to separate namespaces, supply invisible compilation scaffolding, and align examples with the current logging and parameters APIs. Reference AWSSDK.S3 for the custom provider example and alias the logging reference to disambiguate shared console interfaces.
Merge the per-area snippet fixes, always build referenced libraries in Release without transitive references so the snippets see the published package shape, and keep reference attributes when the publish workflow swaps them for packages.
Snippet namespaces under AWS.Lambda.Powertools shadowed the Metrics, Tracing and Idempotency classes and needed aliases. Use Docs.<Area>Snippets instead.
Restore the using directives shown inside regions, using compile-only lines with a hidden snippet marker where a wrapper class or method is needed. Drop the extra md includes that split regions apart. Revert scaffolding artifacts that showed in the docs: partial classes, helper methods added to visible classes, renamed serializer contexts (aliases outside the region instead), stray closing braces, duplicated usings, and mis-indented return statements. Update hl_lines in tracing and logging where added lines moved the highlighted lines.
The listing showed library internals that can't be reproduced in user code. The prose above it already explains what the middleware does.
This was referenced Nov 14, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1298 +/- ##
========================================
Coverage 79.46% 79.46%
========================================
Files 302 302
Lines 12662 12662
Branches 1507 1507
========================================
Hits 10062 10062
Misses 2142 2142
Partials 458 458 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
dreamorosi
marked this pull request as ready for review
November 14, 2026 12:03
This branch has not been deployed
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.



Issue number: closes #1304
Summary
Changes
Removes
examples/and makes the docs snippets the single source of sample code, now compiled in CI.The examples weren't used by the docs build, duplicated what the snippets show, and their CDK app (
examples/Event Handler/BedrockAgentFunction/infra) caused 22 of the repo's open Dependabot alerts and most of the recent Dependabot PRs.Compiling the snippets. None of the 72
.csfiles underdocs/snippetscompiled before this PR.docs/snippets/Snippets.csprojnow builds all of them againstlibraries/src. Most of the diff indocs/snippetsis scaffolding outside the--8<--regions, so the docs don't show it. That includes wrapper types, per-region namespaces andSupport.csstand-ins. Where a wrapper has to open inside a region, it goes on a line marked// --8<-- [start:hidden], which pymdownx.snippets drops. The project always builds the libraries in Release without transitive references, so snippets compile against the same layout as the published packages.Docs bugs found by compiling. Visible changes are limited to
returnstatements,...becoming// ..., and real fixes. Notable ones:Idempotency.Config()/WithConfig/Builder(), which don't exist. It now usesConfigure/WithOptions/UseDynamoDb.ActionGroupInvocationInput/Outputand set read-only response properties. They now useBedrockFunctionRequest/BedrockFunctionResponse.WithText(...).[Idempotent]was on avoidmethod, which throws at runtime.MetricsMiddlewaredoesn't exist. The listing of theUseMetricsimplementation was removed; the prose already explains it.Namespace = ExampleApplicationis now a string, and a missing.Build()was added.loggerFactory.Create(andoggerFactory) are nowLoggerFactory.Create. TheIConsoleWrappertest double was missing members.pdand a missing);are fixed.hl_lineswere adjusted where line positions moved.CI.
examples-tests.ymlis replaced bydocs-snippets.yml. It builds the snippets on PRs that touchdocs/snippets/**orlibraries/src/**.publish-artifacts-examples-tests.ymlis renamed topublish-artifacts.yml. Before publishing to GitHub Packages, it now swaps the snippets' project references for the freshly packed.nupkgs and builds them, instead of running the example tests. I ran this flow locally, and the snippets build against the packed packages.Other cleanup.
examples/removed fromREADME.md,docs/index.md, the batch, bedrock and kafka pages, and three package READMEs.Dockerfile, which built aSimpleLambdaexample that no longer exists.examplesentries frompackage.jsonand.gitignore.User experience
Readers see the same snippets as before, with the fixes above. The standalone sample projects in
examples/are gone; each utility's docs page is now the reference.Checklist
Is this a breaking change?
RFC issue number:
Checklist:
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.