---
name: api-coverage-99cb16d3f160
description: Generate AWS API coverage reports comparing winterbaume implementations against official AWS API models, plus Terraform converter coverage at the resource-type and per-attribute levels.
user_invocable: true
---

# API Coverage Report Generator

Three complementary reports live in this skill, each answering a different
"how much do we cover?" question:

1. **AWS API operation coverage** — `generate_coverage.py` writes
   `.agents/docs/API_COVERAGE.md`. Compares winterbaume's implemented
   operations against the official Smithy models under
   `vendor/api-models-aws/`, with moto / floci / kumo / fakecloud numbers
   alongside.
2. **Terraform resource-type coverage** — `generate_terraform_resource_coverage.py`
   writes `.agents/docs/TERRAFORM_RESOURCE_COVERAGE.md`. For each
   winterbaume service, lists how many Terraform `aws_*` resource types
   the converter handles vs how many the AWS provider schema declares
   for that service, plus the missing types per service.
3. **Terraform attribute coverage** — `generate_terraform_converter_coverage.py`
   writes `.agents/docs/TERRAFORM_CONVERTER_COVERAGE.md`. For each
   handled resource type, measures inject% and extract% as the fraction
   of the resource's TF schema attributes the converter touches in each
   direction.

Pick the right report for the question:
- "Do we know about all the IAM resources Terraform supports?" → resource coverage.
- "Does our `aws_iam_role` converter handle all the role's fields?" → attribute coverage.
- "Does winterbaume implement the AWS IAM API operations moto does?" → API operation coverage.

## Instructions

Run the report you need:

```bash
# 1. AWS API operation coverage
python3 .agents/skills/api-coverage/scripts/generate_coverage.py

# 2. Per-service Terraform resource-type coverage
python3 .agents/skills/api-coverage/scripts/generate_terraform_resource_coverage.py

# 3. Per-resource Terraform attribute coverage
python3 .agents/skills/api-coverage/scripts/generate_terraform_converter_coverage.py
```

Each writes to `.agents/docs/<NAME>.md` by default; use `--output PATH` to redirect.

### Prerequisites

`vendor/api-models-aws` must be present as a submodule:

```bash
git submodule update --init vendor/api-models-aws
```

**moto, floci, kumo, and fakecloud do not require submodules.** When `vendor/moto`, `vendor/floci`, `vendor/kumo`, or `vendor/fakecloud` are absent the script fetches the necessary source files directly from GitHub and caches the parsed results under `.agents/skills/api-coverage/cache/` for 7 days. fakecloud is fetched as a single repo tarball ( far cheaper than fetching its ~880 crate source files individually ) and parsed in memory. A `GITHUB_TOKEN` environment variable is optional but raises the unauthenticated rate limit (60 req/hr) to 5 000 req/hr.

To force a cache refresh (e.g. after a new moto/floci/kumo/fakecloud release):

```bash
python3 .agents/skills/api-coverage/scripts/generate_coverage.py --refresh-remote
```

If you prefer local clones (faster, works offline):

```bash
git submodule add https://github.com/getmoto/moto        vendor/moto
git submodule add https://github.com/floci-io/floci      vendor/floci
git submodule add https://github.com/sivchari/kumo       vendor/kumo
git submodule add https://github.com/faiscadev/fakecloud vendor/fakecloud
```

The script prefers a local clone over the cache or a remote fetch when the vendor directory is present.

### What the script does

1. **Parses AWS API models** from `vendor/api-models-aws/models/<model-dir>/service/<version>/<name>.json` (Smithy JSON format, extracting shapes with `"type": "operation"`)
2. **Parses winterbaume implementations** from `crates/winterbaume-*/src/handlers.rs`, detecting operations across all dispatch patterns:
   - awsQuery: `match action { "CreateBucket" => ... }`
   - awsJson: `"ServicePrefix.Operation" => ...` in X-Amz-Target matching
   - REST: comments like `// POST /path - OperationName` and handler method names like `handle_create_email_identity`
3. **Parses moto coverage** from moto's `IMPLEMENTATION_COVERAGE.md` (fetched from GitHub and cached when `vendor/moto` is absent), mapping snake_case operation names back to PascalCase Smithy names
4. **Parses floci coverage** from per-service Markdown docs (`docs/services/*.md`), reading `Category | Operations` tables where operations are comma- or middle-dot-separated PascalCase names. Source: `vendor/floci` if present, otherwise fetched from GitHub and cached for 7 days.
5. **Parses kumo coverage** from Go source files (`internal/service/<name>/*.go`): string literals in `Actions() []string` return values (Query/JSON services) and `handle<Op>` receiver method names (REST services). Source: `vendor/kumo` if present, otherwise fetched from GitHub and cached for 7 days.
6. **Parses fakecloud coverage** from Rust service crates (`crates/fakecloud-*/src/**/*.rs`). Each service impls the `AwsService` trait; the parser pairs each `fn service_name(&self) -> &str` ( the AWS endpoint prefix ) with the `fn supported_actions(&self) -> &[&str]` that follows it in the same file, resolving named `const <NAME>_ACTIONS: &[&str]` slices as needed. Keying on `service_name` rather than the crate name keeps services that share a crate in their own columns ( e.g. iam vs sts, cognito-idp vs cognito-identity ). Source: `vendor/fakecloud` if present, otherwise fetched from GitHub as a single tarball and cached for 7 days.
7. **Parses integration-test coverage** from `crates/winterbaume-*/tests/integration_test.rs`, detecting AWS SDK client method calls and mapping them back to implemented Smithy operations
8. **Parses Terraform E2E coverage** from `crates/winterbaume-e2e-tests/tests/terraform/*.rs`, counting success-oriented terraform tests and distinct terraform resource types per service
9. **Generates the report** with a side-by-side overview table (winterbaume / moto / floci / kumo / fakecloud), integration-test and Terraform E2E summary tables, unimplemented services list, and detailed per-service checklists with `W[x] M[x] F[x] K[x] C[x]` markers ( `C` = fakecloud )

### Maintaining the service mappings

Five mappings are defined in `.agents/skills/api-coverage/scripts/generate_coverage.py`:
- `CRATE_TO_MODEL`: Maps winterbaume crate directory names to api-models-aws model directory names. Add an entry when creating a new service crate.
- `MODEL_TO_MOTO`: Maps api-models-aws model directory names to moto service names as they appear in moto's `IMPLEMENTATION_COVERAGE.md` (only where they differ, e.g., `"config-service": "config"`).
- `FLOCI_STEM_TO_MODEL`: Maps floci service document filename stems to api-models-aws model directory names (only where they differ, e.g., `"cognito": "cognito-identity-provider"`). Add an entry when floci adds a service whose doc filename does not match the model dir name.
- `KUMO_DIR_TO_MODEL`: Maps kumo `internal/service/<name>` directory names to api-models-aws model directory names (only where they differ, e.g., `"elbv2": "elastic-load-balancing-v2"`). Add an entry when kumo adds a service whose directory name does not match the model dir name.
- `FAKECLOUD_SERVICE_TO_MODEL`: Maps fakecloud's `service_name` values ( the AWS endpoint prefix each service impl returns, e.g. `"monitoring"`, `"events"`, `"states"` ) to api-models-aws model directory names (only where they differ, e.g., `"states": "sfn"`, `"logs": "cloudwatch-logs"`). Add an entry when fakecloud adds a service whose endpoint prefix does not match the model dir name. `FAKECLOUD_SKIP_CRATES` lists framework crates ( `fakecloud-core`, `fakecloud-conformance`, ... ) whose `AwsService` impls are empty test doubles and must be ignored.

### Output format

The report is written as Markdown with:
- Overview table: service, model, winterbaume count, moto count, floci count, kumo count, fakecloud count, total, wb%, moto%, floci%, kumo%, fakecloud%
- Overall aggregate stats for winterbaume, moto, floci, kumo, and fakecloud
- Integration-test summary lines plus a per-service integration-test table
- Terraform E2E summary lines plus a per-service Terraform E2E table
- List of AWS services not yet implemented
- Detailed per-service sections with `W[x] M[x] F[x] K[x] C[x]` side-by-side checklists for every operation ( `C` = fakecloud ), plus integration-test and Terraform E2E notes

## Terraform resource-type coverage

`generate_terraform_resource_coverage.py` answers: "for each winterbaume
service, how many of the AWS Terraform provider's resource types do we
actually handle?"

It reads the canonical converter manifest at
`crates/winterbaume-terraform/specs/<service>.toml` (the same specs the
`tf-converter-codegen` tool consumes), extracts each `[[resource]] type`
declaration, and compares the set against the AWS provider schema obtained
via `terraform providers schema -json`. The schema is cached at
`.agents-workspace/tmp/tf-schema/aws_provider_schema.json` (auto-generated
on first run; reused thereafter).

For each service:
- The "service prefix" is the longest common prefix of the handled
  resource types, capped at two underscore-separated segments after
  `aws_` so a 1-handled service doesn't produce an over-narrow prefix.
- Services with heterogeneous resource names ( `ec2` mixes `aws_vpc`,
  `aws_subnet`, `aws_security_group`, etc.; `rds` mixes `aws_db_*` and
  `aws_rds_*`; `elbv2` mixes `aws_lb*` and `aws_alb*` ) use a manual
  override list defined in `PREFIX_OVERRIDES` at the top of the script.
  Add a service to that table if its resources don't share a clean
  common prefix.
- Coverage % = handled / candidates_in_schema, where candidates are
  every schema resource matching the service's prefix(es).

Output sections:
1. A summary header with totals ( schema resources, classified, handled,
   missing ).
2. A table sorted by absolute missing-count desc.
3. Per-service "missing resources" list, suitable for triage and
   converter expansion.
4. ( If applicable ) a list of resources declared in specs but absent
   from the schema — typically typos or resources removed in newer
   provider versions.

## Terraform attribute coverage

`generate_terraform_converter_coverage.py` answers: "for each handled
resource type, how many of its TF schema attributes does the converter
actually touch?"

It greps each migrated converter and the TfModel spec for field-level
references, then computes inject% and extract% per resource. The
`terraform-converter` skill uses these numbers to gate "excellent"
( inject ≥ 60%, extract ≥ 50% ).

## Important Notes

- winterbaume-ses implements SES v2 (sesv2 model), not SES v1
- Only operations that exist in the official model are counted; spurious handler methods are filtered out
- Handler methods preceded by a `// STUB[category]: reason` comment (see `.agents/docs/QUALITY_GATE.md` "Stub Handler Discipline") are **excluded** from the `winterbaume` count and surfaced in a separate `Stubs` column, because they return empty/default responses without real logic. They still satisfy API routing but are not functionally implemented. To restore a stub to the count, remove the `STUB[...]` comment once real logic is added.
- The script also performs **heuristic stub detection** for unannotated drift: a handler whose body is short, contains a default/empty response indicator (`::default()`, `..Default::default()`, `Vec::new()`, `success_empty`, ...), and contains no state-access indicator (`self.backend`, `with_state`, `?;`, `request.body`, ...) is also classified as a stub even if it is missing the canonical `// STUB[<category>]: ...` annotation. The annotated-vs-heuristic split is not reported separately in the table; both flavours appear in the `Stubs` column. If a handler is misclassified, the canonical fix is to either annotate it explicitly or to make its real logic obvious to the heuristic.
- Integration-test coverage is reported against implemented operations only. It is derived from SDK method calls found in `tests/integration_test.rs`, so it is a useful approximation rather than a proof that every behavioural path is covered.
- Terraform E2E coverage is reported separately from API operation coverage. One Terraform resource can exercise multiple API operations, so the E2E metrics are a complementary validation signal rather than an operation-count substitute.


---
Source attribution: moriyoshi
Original project: https://github.com/moriyoshi/winterbaume/blob/69fed1d7fb0eb9a2738ff3274197c7591129c4cb/.agents/skills/api-coverage/SKILL.md
License: Apache-2.0
License information: https://www.apache.org/licenses/LICENSE-2.0
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice


                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.


## Additional upstream notices

api-coverage-99cb16d3f160/DAVEAI-UPSTREAM-NOTICE

Winterbaume
Copyright 2025 Winterbaume contributors

This product includes software developed at
https://github.com/getmoto/moto

=======================================================================
Moto - Mock AWS Services
=======================================================================

Copyright 2012 Steve Pulec

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Winterbaume used moto as a reference implementation for AWS service
mock behaviour and ported many of its Python test cases into Rust
integration tests. The moto source is available at
https://github.com/getmoto/moto.

Moto is written by Steve Pulec with contributions from:

  Zach Smith, Dilshod Tadjibaev, Dan Berglund, Lincoln de Sousa,
  mhock, Ilya Sukhanov, Lucian Branescu Mihaila,
  Konstantinos Koukopoulos, attili, JJ Zeng, Jon Haddad,
  Andres Riancho, Michael Ossareh, JeffMGreg, Hugo Lopes Tavares,
  Chris St. Pierre, Frank Mata, Clint Ecker, Richard Eames,
  Kevin Glisson, Shawn Falkner-Horine, David Baumgold,
  Rory-Finnegan, Bobby Impollonia, Ralfas, Omer Katz,
  Joseph Lawson, Trey Tacon, Peter, Tyler Sanders, Gary Dalton,
  Chris Henry, Mike Fuller, Andy, Mike Grima, Marco Rucci,
  Zack Kourouma, Pior Bastida, Dustin J. Mitchell,
  Jean-Baptiste Barth, Tom Viner, Justin Wiley, Adam Stauffer,
  Guy Templeton, Michael van Tellingen, Jessie Nadler,
  Alex Morken, Clive Li, Jim Shields, William Richard,
  Alex Casalboni, Jon Beilke, Bendeguz Acs, Craig Anderson,
  Robert Lewis, Kyle Jones, Mickaël Schoentgen, Ariel Beck,
  Roman Rader, Bryan Chen, Jonas Bulik, Rita Cheung,
  David Acevedo, Damon Williams

The full contributor list is available at
https://github.com/getmoto/moto/blob/master/AUTHORS.md.

=======================================================================
AWS API Models
=======================================================================

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Winterbaume vendors a snapshot of the official AWS API Smithy models
under vendor/api-models-aws/ to drive its in-tree wire-type and
serialiser code generation. The upstream LICENSE and NOTICE files are
preserved alongside the vendored models. The upstream source is
available at https://github.com/aws/api-models-aws.


# Mega AI Hub resource metadata

Creator / publisher: moriyoshi
Original project: https://github.com/moriyoshi/winterbaume/blob/69fed1d7fb0eb9a2738ff3274197c7591129c4cb/.agents/skills/api-coverage/SKILL.md
Attribution basis: Source repository record

Fields of work: Development & Engineering
Roles: Backend Developer, Data Engineer, DevOps / SRE
Specialties: API, Backend
Tools: AWS, GitHub, Terraform
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: 08438796c86e4e7ec3fe6722a90f6abee2c790592790cfeab96a90a1555cb257
