mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
fix(docs): prevent stale service action counts (#5018)
* fix(docs): prevent stale service action counts * test(docs): validate composite service action counts * fix(docs): clarify action count validation coverage * fix(docs): derive shared tagging route counts * fix(docs): align service action counts
This commit is contained in:
1 parent
db2a67f122
commit
4d980a361f
3 files changed
+210
-29
No files matched your search
+29
-29
@@ -11,7 +11,7 @@ Operation counts are exact. For dispatch-table services (Query and JSON 1.1) eac
|
||||
| Service | Endpoint | Protocol | Supported operations |
|
||||
|---|---|---|---|
|
||||
| [SSM](ssm.md) | `POST /` + `X-Amz-Target: AmazonSSM.*` / `AmazonSSMMessageDeliveryService.*` | JSON 1.1 | 22 |
|
||||
| [SQS](sqs.md) | `POST /` with `Action=` param | Query / JSON | 20 |
|
||||
| [SQS](sqs.md) | `POST /` with `Action=` param | Query / JSON | 23 |
|
||||
| [SNS](sns.md) | `POST /` with `Action=` param | Query / JSON | 17 |
|
||||
| [S3](s3.md) | `/{bucket}/{key}` | REST XML | 58 |
|
||||
| [S3 Vectors](s3vectors.md) | `POST /{OperationName}` | REST JSON | 12 |
|
||||
@@ -22,23 +22,23 @@ Operation counts are exact. For dispatch-table services (Query and JSON 1.1) eac
|
||||
| [Lambda MicroVMs](lambda-microvms.md) | `/2025-09-09/...` + `/2026-04-04/...` | REST JSON | 22 |
|
||||
| [API Gateway v1](api-gateway.md) | `/restapis/...` | REST JSON | 79 |
|
||||
| [API Gateway v2](api-gateway.md#v2) | `/v2/apis/...` | REST JSON | 53 + data-plane |
|
||||
| [IAM](iam.md) | `POST /` with `Action=` param | Query | 76 |
|
||||
| [IAM](iam.md) | `POST /` with `Action=` param | Query | 148 |
|
||||
| [STS](sts.md) | `POST /` with `Action=` param | Query | 7 |
|
||||
| [AWS Sign-In](iam.md#aws-sign-in-login-credentials) | `/v1/authorize`, `/v1/token` | REST JSON | 2 |
|
||||
| [Organizations](organizations.md) | `POST /` + `X-Amz-Target: AWSOrganizationsV20161128.*` | JSON 1.1 | 55 |
|
||||
| [Organizations](organizations.md) | `POST /` + `X-Amz-Target: AWSOrganizationsV20161128.*` | JSON 1.1 | 56 |
|
||||
| [Cognito](cognito.md) | `POST /` + `X-Amz-Target: AWSCognitoIdentityProviderService.*` | JSON 1.1 | 43 |
|
||||
| [Cognito Identity](cognitoidentity.md) | `POST /` + `X-Amz-Target: AWSCognitoIdentityService.*` | JSON 1.1 | 13 |
|
||||
| [Cognito Identity](cognitoidentity.md) | `POST /` + `X-Amz-Target: AWSCognitoIdentityService.*` | JSON 1.1 | 12 |
|
||||
| [Global Accelerator](globalaccelerator.md) | `POST /` + `X-Amz-Target: GlobalAccelerator_V20180706.*` | JSON 1.1 | 22 |
|
||||
| [KMS](kms.md) | `POST /` + `X-Amz-Target: TrentService.*` | JSON 1.1 | 34 |
|
||||
| [KMS](kms.md) | `POST /` + `X-Amz-Target: TrentService.*` | JSON 1.1 | 42 |
|
||||
| [CloudHSM v2](cloudhsmv2.md) | `POST /` + `X-Amz-Target: BaldrApiService.*` | JSON 1.1 | 18 |
|
||||
| [Kinesis](kinesis.md) | `POST /` + `X-Amz-Target: Kinesis_20131202.*` | JSON 1.1 | 24 |
|
||||
| [Managed Service for Apache Flink](kinesisanalytics.md) | `POST /` + `X-Amz-Target: KinesisAnalytics_20180523.*` | JSON 1.1 | 7 |
|
||||
| [Secrets Manager](secrets-manager.md) | `POST /` + `X-Amz-Target: secretsmanager.*` | JSON 1.1 | 16 |
|
||||
| [Step Functions](step-functions.md) | `POST /` + `X-Amz-Target: AmazonStatesService.*` | JSON 1.1 | 19 |
|
||||
| [Kinesis](kinesis.md) | `POST /` + `X-Amz-Target: Kinesis_20131202.*` | JSON 1.1 | 29 |
|
||||
| [Managed Service for Apache Flink](kinesisanalytics.md) | `POST /` + `X-Amz-Target: KinesisAnalytics_20180523.*` | JSON 1.1 | 15 |
|
||||
| [Secrets Manager](secrets-manager.md) | `POST /` + `X-Amz-Target: secretsmanager.*` | JSON 1.1 | 23 |
|
||||
| [Step Functions](step-functions.md) | `POST /` + `X-Amz-Target: AmazonStatesService.*` | JSON 1.1 | 32 |
|
||||
| [SWF](swf.md) | `POST /` + `X-Amz-Target: SimpleWorkflowService.*` | JSON 1.0 | 39 |
|
||||
| [CloudFormation](cloudformation.md) | `POST /` with `Action=` param | Query | 19 |
|
||||
| [CloudFormation](cloudformation.md) | `POST /` with `Action=` param | Query | 35 |
|
||||
| [Cloud Control API](cloudcontrol.md) | `POST /` + `X-Amz-Target: CloudApiService.*` | JSON 1.1 | 5 |
|
||||
| [EventBridge](eventbridge.md) | `POST /` + `X-Amz-Target: AmazonEventBridge.*` | JSON 1.1 | 16 |
|
||||
| [EventBridge](eventbridge.md) | `POST /` + `X-Amz-Target: AmazonEventBridge.*` | JSON 1.1 | 35 |
|
||||
| [EventBridge Scheduler](scheduler.md) | `/schedules/*`, `/schedule-groups/*`, `/tags/*` | REST JSON | 12 |
|
||||
| [EventBridge Pipes](pipes.md) | `/v1/pipes/*` | REST JSON | 7 |
|
||||
| [CloudWatch OAM](oam.md) | REST paths such as `POST /CreateSink` and `POST /CreateLink` | REST JSON | 15 |
|
||||
@@ -52,7 +52,7 @@ Operation counts are exact. For dispatch-table services (Query and JSON 1.1) eac
|
||||
| [IAM Identity Center OIDC](ssooidc.md) | `/client/register`, `/device_authorization`, `/token`, `/token?aws_iam=t`, `/authorize`, `/device` | REST JSON | 4 |
|
||||
| [IAM Identity Center Access Portal](ssoportal.md) | `/assignment/accounts`, `/assignment/roles`, `/federation/credentials`, `/logout` | REST JSON | 4 |
|
||||
| [Identity Store](identitystore.md) | `POST /` + `X-Amz-Target: AWSIdentityStore.*` | JSON 1.1 | 19 |
|
||||
| [Amazon Macie](macie2.md) | `/admin`, `/macie`, `/admin/configuration` | REST JSON | 6 |
|
||||
| [Amazon Macie](macie2.md) | `/admin`, `/macie`, `/admin/configuration` | REST JSON | 8 |
|
||||
| [Amazon Inspector](inspector2.md) | `/delegatedadminaccounts/*`, `/status/batch/get`, `/enable`, `/organizationconfiguration/*` | REST JSON | 7 |
|
||||
| [Amazon Verified Permissions](verifiedpermissions.md) | `POST /` + `X-Amz-Target: VerifiedPermissions.*` | JSON 1.0 | 34 |
|
||||
| [Security Hub](securityhub.md) | `/organization/*`, `/accounts`, `/findingAggregator/*`, `/configurationPolicy*`, `/tags/*` | REST JSON | 22 |
|
||||
@@ -60,31 +60,31 @@ Operation counts are exact. For dispatch-table services (Query and JSON 1.1) eac
|
||||
| [Amazon Connect](connect.md) | `/instance`, `/instance/{instanceId}/*`, `/tags/*` | REST JSON | 15 |
|
||||
| [Amazon AppIntegrations](appintegrations.md) | `/eventIntegrations/*`, `/dataIntegrations/*`, `/tags/*` | REST JSON | 14 |
|
||||
| [Amazon Data Lifecycle Manager](dlm.md) | `/policies`, `/policies/{policyId}`, `/tags/{resourceArn}` | REST JSON | 8 |
|
||||
| [ElastiCache](elasticache.md) | `POST /` with `Action=` param + TCP proxy | Query + RESP | 8 |
|
||||
| [MemoryDB](memorydb.md) | `POST /` + `X-Amz-Target: AmazonMemoryDB.*` + TCP proxy | JSON 1.1 + RESP | 7 |
|
||||
| [RDS](rds.md) | `POST /` with `Action=` param + TCP proxy | Query + wire | 14 |
|
||||
| [ElastiCache](elasticache.md) | `POST /` with `Action=` param + TCP proxy | Query + RESP | 22 |
|
||||
| [MemoryDB](memorydb.md) | `POST /` + `X-Amz-Target: AmazonMemoryDB.*` + TCP proxy | JSON 1.1 + RESP | 13 |
|
||||
| [RDS](rds.md) | `POST /` with `Action=` param + TCP proxy | Query + wire | 86 |
|
||||
| [RDS Data API](rds-data.md) | `/Execute`, `/BeginTransaction`, `/CommitTransaction`, `/RollbackTransaction` | REST JSON | 4 |
|
||||
| [Timestream for InfluxDB](timestream-influxdb.md) | `POST /` + `X-Amz-Target: AmazonTimestreamInfluxDB.*` + InfluxDB container | JSON 1.0 + InfluxDB HTTP | 24 |
|
||||
| [MSK](msk.md) | `/v1/clusters/...`, `/api/v2/clusters/...` + Redpanda broker | REST JSON + Kafka | 8 |
|
||||
| [Amazon MQ](amazonmq.md) | `/v1/brokers/...` + RabbitMQ broker | REST JSON + AMQP | 5 |
|
||||
| [MWAA](mwaa.md) | `/` REST paths for environments + CLI/web proxy | REST JSON | 10 |
|
||||
| [Athena](athena.md) | `POST /` + `X-Amz-Target: AmazonAthena.*` | JSON 1.1 | 4 |
|
||||
| [Athena](athena.md) | `POST /` + `X-Amz-Target: AmazonAthena.*` | JSON 1.1 | 21 |
|
||||
| [Glue](glue.md) | `POST /` + `X-Amz-Target: AWSGlue.*` | JSON 1.1 | 38 |
|
||||
| [Lake Formation](lakeformation.md) | `POST /<Action>` | REST JSON | 16 |
|
||||
| [Neptune](neptune.md) | `POST /` with `Action=` param + Gremlin TCP proxy | Query + WebSocket | 14 |
|
||||
| [DocumentDB](docdb.md) | `POST /` with `Action=` param + MongoDB container | Query + MongoDB wire | 8 |
|
||||
| [DocumentDB](docdb.md) | `POST /` with `Action=` param + MongoDB container | Query + MongoDB wire | 13 |
|
||||
| [DMS](dms.md) | `POST /` + `X-Amz-Target: AmazonDMSv20160101.*` | JSON 1.1 | 6 |
|
||||
| [Redshift](redshift.md) | `POST /` with `Action=` param + PostgreSQL container | Query + PostgreSQL wire (+ CFN) | 29 |
|
||||
| [Redshift](redshift.md) | `POST /` with `Action=` param + PostgreSQL container | Query + PostgreSQL wire (+ CFN) | 35 |
|
||||
| [Redshift Data API](redshift-data.md) | `POST /` + `X-Amz-Target: RedshiftData.*` | JSON 1.1 | 11 |
|
||||
| [Redshift Serverless](redshift-serverless.md) | `POST /` + `X-Amz-Target: RedshiftServerless.*` | JSON 1.1 | 8 |
|
||||
| [EMR](emr.md) | `POST /` + `X-Amz-Target: ElasticMapReduce.*` | JSON 1.1 | 34 |
|
||||
| [EMR Serverless](emr-serverless.md) | `/applications/*`, `/tags/*` | REST JSON | 10 |
|
||||
| [Data Firehose](firehose.md) | `POST /` + `X-Amz-Target: Firehose_20150804.*` | JSON 1.1 | 6 |
|
||||
| [Data Firehose](firehose.md) | `POST /` + `X-Amz-Target: Firehose_20150804.*` | JSON 1.1 | 12 |
|
||||
| [ECS](ecs.md) | `POST /` + `X-Amz-Target: AmazonEC2ContainerServiceV20141113.*` | JSON 1.1 | 58 |
|
||||
| [EFS](efs.md) | `/2015-02-01/...` | REST JSON | 17 |
|
||||
| [EFS](efs.md) | `/2015-02-01/...` | REST JSON | 26 |
|
||||
| [EC2](ec2.md) | `POST /` with `Action=` param | EC2 Query | 78 |
|
||||
| [Lightsail](lightsail.md) | `POST /` + `X-Amz-Target: Lightsail_20161128.*` | JSON 1.1 | 79 local responses; 161 recognized actions |
|
||||
| [ACM](acm.md) | `POST /` + `X-Amz-Target: CertificateManager.*` | JSON 1.1 | 12 |
|
||||
| [ACM](acm.md) | `POST /` + `X-Amz-Target: CertificateManager.*` | JSON 1.1 | 16 |
|
||||
| [ECR](ecr.md) | `POST /` + `X-Amz-Target: AmazonEC2ContainerRegistry_V20150921.*` (control plane) and `/v2/...` (data plane proxied to `registry:2`) | JSON 1.1 + OCI Distribution | 17 |
|
||||
| [Resource Groups Tagging API](resource-groups-tagging.md) | `POST /` + `X-Amz-Target: ResourceGroupsTaggingAPI_20170126.*` | JSON 1.1 | 5 |
|
||||
| [Resource Explorer](resource-explorer.md) | `POST /{OperationName}`, rewritten to `/re2/*` for the four paths S3 Vectors also claims | REST JSON | 32 |
|
||||
@@ -96,14 +96,14 @@ Operation counts are exact. For dispatch-table services (Query and JSON 1.1) eac
|
||||
| [AppSync](appsync.md) | `/v1/apis/...` | REST JSON | 33 |
|
||||
| [Amazon Bedrock](bedrock.md) | `/guardrails`, `/guardrails/{guardrailIdentifier}`, `/tagResource`, `/untagResource`, `/listTagsForResource` | REST JSON | 9 |
|
||||
| [Bedrock Runtime](bedrock-runtime.md) | `/model/{modelId}/converse`, `/model/{modelId}/invoke` | REST JSON | 2 (stub; streaming returns 501) |
|
||||
| [Bedrock AgentCore Control](bedrock-agentcore.md) | `/runtimes/*`, `/gateways/*`, `/memories/*`, `/identities/*`, `/browsers*`, `/browser-profiles*`, `/code-interpreters*`, `/resourcepolicy/*`, `/tags/{resourceArn}` | REST JSON | 61 (+ 3 tagging via shared `/tags/{arn}` route) |
|
||||
| [Bedrock AgentCore Control](bedrock-agentcore.md) | `/runtimes/*`, `/gateways/*`, `/memories/*`, `/identities/*`, `/browsers*`, `/browser-profiles*`, `/code-interpreters*`, `/resourcepolicy/*`, `/tags/{resourceArn}` | REST JSON | 65 (+ 3 tagging via shared `/tags/{arn}` route) |
|
||||
| [Bedrock AgentCore](bedrock-agentcore.md#data-plane-invokeagentruntime) | `/runtimes/{agentRuntimeArn}/invocations` | REST JSON (binary payload) | 1 (canned-response stub) |
|
||||
| [EKS](eks.md) | `/clusters`, `/clusters/{name}`, `/tags/{resourceArn}` | REST JSON | 7 |
|
||||
| [ELB v2](elb.md) | `POST /` with `Action=` param | Query | 34 |
|
||||
| [ELB Classic (v1)](elb-classic.md) | `POST /` with `Action=` and `Version=2012-06-01` | Query | 20 |
|
||||
| [WAF v2](wafv2.md) | `POST /` + `X-Amz-Target: AWSWAF_20190729.*` | JSON 1.1 | 35 |
|
||||
| [Auto Scaling](autoscaling.md) | `POST /` with `Action=` param | Query | 33 |
|
||||
| [Application Auto Scaling](applicationautoscaling.md) | `POST /` + `X-Amz-Target: AnyScaleFrontendService.*` | JSON 1.1 | 9 |
|
||||
| [Application Auto Scaling](applicationautoscaling.md) | `POST /` + `X-Amz-Target: AnyScaleFrontendService.*` | JSON 1.1 | 10 |
|
||||
| [Elastic Beanstalk](elastic-beanstalk.md) | `POST /` with `Action=` or `Operation=` param | Query | 14 |
|
||||
| [CodeBuild](codebuild.md) | `POST /` + `X-Amz-Target: CodeBuild_20161006.*` | JSON 1.1 | 20 |
|
||||
| [AWS Batch](batch.md) | `/v1/...` | REST JSON | 10 |
|
||||
@@ -111,11 +111,11 @@ Operation counts are exact. For dispatch-table services (Query and JSON 1.1) eac
|
||||
| [CodePipeline](codepipeline.md) | `POST /` + `X-Amz-Target: CodePipeline_20150709.*` | JSON 1.1 | 44 |
|
||||
| [AWS Network Firewall](network-firewall.md) | `POST /` + `X-Amz-Target: NetworkFirewall_20201112.*` | JSON 1.0 | 27 |
|
||||
| [AWS Service Catalog](service-catalog.md) | `POST /` + `X-Amz-Target: AWS242ServiceCatalogService.*` | JSON 1.1 | 89 |
|
||||
| [Service Quotas](servicequotas.md) | `POST /` + `X-Amz-Target: ServiceQuotasV20190624.*` | JSON 1.1 | 5 |
|
||||
| [Service Quotas](servicequotas.md) | `POST /` + `X-Amz-Target: ServiceQuotasV20190624.*` | JSON 1.1 | 6 |
|
||||
| [AWS Budgets](budgets.md) | `POST /` + `X-Amz-Target: AWSBudgetServiceGateway.*` | JSON 1.1 | 26 |
|
||||
| [AWS RAM](ram.md) | `POST /{operationname}` (lowercase), `DELETE /deleteresourceshare` | REST JSON | 12 |
|
||||
| [AWS RAM](ram.md) | `POST /{operationname}` (lowercase), `DELETE /deleteresourceshare` | REST JSON | 14 |
|
||||
| [Control Catalog](controlcatalog.md) | `/get-control`, `/list-controls` | REST JSON | 2 |
|
||||
| [AWS Marketplace](marketplace.md) | Marketplace Catalog API | REST JSON | 15 |
|
||||
| [AWS Marketplace](marketplace.md) | Marketplace Catalog API | REST JSON | 56 |
|
||||
| [Control Tower](controltower.md) | `/list-landingzones`, `/get-landingzone`, `/create-landingzone`, `/*-baseline*` | REST JSON | 15 |
|
||||
| [Managed Prometheus (AMP)](managed-prometheus.md) | `/workspaces/*`, `/workspaces/*/rulegroupsnamespaces/*`, `/tags/*` | REST JSON | 13 |
|
||||
| [AWS Backup](backup.md) | `/backup-vaults/*`, `/backup/plans/*`, `/backup-jobs/*`, `/supported-resource-types` | REST JSON | 20 |
|
||||
@@ -123,20 +123,20 @@ Operation counts are exact. For dispatch-table services (Query and JSON 1.1) eac
|
||||
| [CodeGuru Reviewer](codegurureviewer.md) | `/associations`, `/associations/{associationArn}`, `/tags/*` | REST JSON | 7 |
|
||||
| [CodeArtifact](codeartifact.md) | `/v1/domain*`, `/v1/repository*`, `/v1/package/version*`, `/v1/tag*`, `/v1/authorization-token`, `/codeartifact/maven/*`, `/codeartifact/npm/*`, `/codeartifact/pypi/*` | REST JSON | 26 |
|
||||
| [CloudFront](cloudfront.md) | `/2020-05-31/distribution/*`, `/2020-05-31/cache-policy/*`, `/2020-05-31/function/*` | REST XML | 50 |
|
||||
| [Route53](route53.md) | `/2013-04-01/hostedzone/*`, `/2013-04-01/healthcheck/*`, `/2013-04-01/change/*` | REST XML | 25 |
|
||||
| [Route53](route53.md) | `/2013-04-01/hostedzone/*`, `/2013-04-01/healthcheck/*`, `/2013-04-01/change/*` | REST XML | 27 |
|
||||
| [Route 53 Resolver](route53resolver.md) | `POST /` + `X-Amz-Target: Route53Resolver.*` | JSON 1.1 | 18 |
|
||||
| [Amazon SageMaker](sagemaker.md) | `POST /` + `X-Amz-Target: SageMaker.*` | JSON 1.1 | 20 |
|
||||
| [SageMaker Runtime](sagemaker.md#endpoint-hosting) | `/endpoints/{EndpointName}/invocations` | REST (binary payload) | 1 |
|
||||
| [Cloud Map](cloudmap.md) | `POST /` + `X-Amz-Target: Route53AutoNaming_v20170314.*` | JSON 1.1 | 22 |
|
||||
| [AWS Config](config.md) | `POST /` + `X-Amz-Target: StarlingDoveService.*` | JSON 1.1 | 33 |
|
||||
| [CloudTrail](cloudtrail.md) | `POST /` + `X-Amz-Target: com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101.*` | JSON 1.1 | 9 |
|
||||
| [CloudTrail](cloudtrail.md) | `POST /` + `X-Amz-Target: com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101.*` | JSON 1.1 | 14 |
|
||||
| [Textract](textract.md) | `POST /` + `X-Amz-Target: Textract.*` | JSON 1.1 | 6 |
|
||||
| [Comprehend](comprehend.md) | `POST /` + `X-Amz-Target: Comprehend_20171127.*` | JSON 1.1 | 5 |
|
||||
| [Rekognition](rekognition.md) | `POST /` + `X-Amz-Target: RekognitionService.*` | JSON 1.1 | 5 |
|
||||
| [Translate](translate.md) | `POST /` + `X-Amz-Target: AWSShineFrontendService_20170701.*` | JSON 1.1 | 3 |
|
||||
| [Transcribe](transcribe.md) | `POST /` + `X-Amz-Target: Transcribe.*` | JSON 1.1 | 8 |
|
||||
| [Pricing](pricing.md) | `POST /` + `X-Amz-Target: AWSPriceListService.*` | JSON 1.1 | 5 |
|
||||
| [Cost Explorer](ce.md) | `POST /` + `X-Amz-Target: AWSInsightsIndexService.*` | JSON 1.1 | 9 |
|
||||
| [Cost Explorer](ce.md) | `POST /` + `X-Amz-Target: AWSInsightsIndexService.*` | JSON 1.1 | 20 |
|
||||
| [Cost and Usage Reports](cur.md) | `POST /` + `X-Amz-Target: AWSOrigamiServiceGatewayService.*` | JSON 1.1 | 6 |
|
||||
| [BCM Pricing Calculator](bcm-pricing-calculator.md) | `POST /` + `X-Amz-Target: AWSBCMPricingCalculator.*` | JSON 1.0 | 4 |
|
||||
| [BCM Data Exports](bcm-data-exports.md) | `POST /` + `X-Amz-Target: AWSBillingAndCostManagementDataExports.*` | JSON 1.1 | 7 |
|
||||
|
||||
@@ -34,6 +34,11 @@ from dataclasses import dataclass
|
||||
from datetime import date
|
||||
from pathlib import Path
|
||||
|
||||
try:
|
||||
from tools.docs import regen_action_docs
|
||||
except ModuleNotFoundError:
|
||||
import regen_action_docs
|
||||
|
||||
import yaml
|
||||
|
||||
CATALOG_SOURCE = "src/main/java/io/github/hectorvent/floci/core/common/ResolvedServiceCatalog.java"
|
||||
@@ -102,6 +107,122 @@ def extract_matrix_slugs(md_source: str) -> set[str]:
|
||||
table = md_source[start:end]
|
||||
return set(MATRIX_LINK_RE.findall(table))
|
||||
|
||||
def extract_matrix_action_counts(md_source: str) -> dict[str, int]:
|
||||
"""Extract documented operation counts for base service-doc rows.
|
||||
|
||||
Supports both plain numeric counts and composite counts such as
|
||||
``61 (+ 3 tagging ...)``.
|
||||
Rows linking to a document anchor are ignored because the linked
|
||||
document may contain multiple distinct action sections.
|
||||
"""
|
||||
try:
|
||||
start = md_source.index(MATRIX_HEADING)
|
||||
end = md_source.index(MATRIX_END_HEADING, start)
|
||||
except ValueError:
|
||||
raise ValueError(
|
||||
f"{MATRIX_DOC}: could not find '{MATRIX_HEADING}' ... "
|
||||
f"'{MATRIX_END_HEADING}' (has a heading been renamed or reordered?)"
|
||||
) from None
|
||||
|
||||
counts: dict[str, int] = {}
|
||||
|
||||
for line in md_source[start:end].splitlines():
|
||||
match = re.match(
|
||||
r"^\|\s*\[[^\]]+\]\(([a-z0-9][a-z0-9\-]*)\.md"
|
||||
r"(#[^)]*)?\)\s*\|.*\|\s*(\d+)"
|
||||
r"(?:\s*\(\+\s*(\d+)[^)]*\))?\s*\|$",
|
||||
line,
|
||||
)
|
||||
if not match:
|
||||
continue
|
||||
|
||||
slug, anchor, base_count, extra_count = match.groups()
|
||||
|
||||
if anchor:
|
||||
continue
|
||||
|
||||
counts.setdefault(slug, int(base_count))
|
||||
|
||||
return counts
|
||||
|
||||
|
||||
|
||||
def count_generated_actions(md_source: str) -> int | None:
|
||||
"""Count action rows inside a generated action-table marker pair.
|
||||
|
||||
Returns None when the document does not contain a generated action table.
|
||||
"""
|
||||
start_marker = "<!-- floci:actions:start -->"
|
||||
end_marker = "<!-- floci:actions:end -->"
|
||||
|
||||
try:
|
||||
start = md_source.index(start_marker) + len(start_marker)
|
||||
end = md_source.index(end_marker, start)
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
section = md_source[start:end]
|
||||
|
||||
count = 0
|
||||
|
||||
for line in section.splitlines():
|
||||
line = line.strip()
|
||||
|
||||
if not line.startswith("|") or line.count("|") < 3:
|
||||
continue
|
||||
|
||||
# Skip the markdown header/separator rows.
|
||||
if re.match(r"^\|\s*Action\s*\|", line, re.IGNORECASE):
|
||||
continue
|
||||
|
||||
if re.match(r"^\|\s*:?-{3,}", line):
|
||||
continue
|
||||
|
||||
count += 1
|
||||
|
||||
return count
|
||||
|
||||
|
||||
def extract_action_counts(repo_root: Path) -> dict[str, int]:
|
||||
"""Extract mechanically verifiable action counts.
|
||||
Generated service documents are counted from their generated action-table
|
||||
markers. IAM is a deferred non-tabular document, so its Query switch is
|
||||
parsed directly using the same action parser as regen_action_docs.py.
|
||||
Other services without generated action-table markers are intentionally
|
||||
skipped here because their handlers use non-tabular or mixed dispatch
|
||||
patterns that cannot be counted safely by the generic registry parser.
|
||||
"""
|
||||
md_source = (repo_root / MATRIX_DOC).read_text(encoding="utf-8")
|
||||
matrix_counts = extract_matrix_action_counts(md_source)
|
||||
|
||||
counts: dict[str, int] = {}
|
||||
|
||||
# Generated service documents.
|
||||
for slug in matrix_counts:
|
||||
doc_path = repo_root / SERVICES_DIR / f"{slug}.md"
|
||||
|
||||
if not doc_path.exists():
|
||||
continue
|
||||
|
||||
doc_source = doc_path.read_text(encoding="utf-8")
|
||||
generated_count = count_generated_actions(doc_source)
|
||||
|
||||
if generated_count is not None:
|
||||
counts[slug] = generated_count
|
||||
|
||||
# IAM is intentionally non-tabular, so validate it from its handler.
|
||||
iam_source = (
|
||||
repo_root
|
||||
/ "src/main/java/io/github/hectorvent/floci/services/iam/IamQueryHandler.java"
|
||||
)
|
||||
|
||||
counts["iam"] = len(
|
||||
regen_action_docs.extract_switch_actions(
|
||||
iam_source.read_text(encoding="utf-8")
|
||||
)
|
||||
)
|
||||
|
||||
return counts
|
||||
|
||||
def find_unlinked_pages(services_dir: Path, slugs: set[str], facet_pages: set[str]) -> list[str]:
|
||||
"""docs/services pages (by slug) that no matrix row links and no facet entry excuses.
|
||||
@@ -220,11 +341,29 @@ def main(argv: list[str] | None = None) -> int:
|
||||
print(f"error: {exc}", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
try:
|
||||
matrix_action_counts = extract_matrix_action_counts(md_source)
|
||||
source_action_counts = extract_action_counts(repo_root)
|
||||
except (ValueError, OSError) as exc:
|
||||
print(f"error: {exc}", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
undocumented, expired_deferred = find_undocumented(
|
||||
keys, slugs, aliases, deferred, date.today()
|
||||
)
|
||||
|
||||
warnings: list[str] = []
|
||||
|
||||
for slug, documented_count in matrix_action_counts.items():
|
||||
source_count = source_action_counts.get(slug)
|
||||
if source_count is None:
|
||||
continue
|
||||
if documented_count != source_count:
|
||||
warnings.append(
|
||||
f"service '{slug}' documents {documented_count} supported operations "
|
||||
f"in {MATRIX_DOC}, but the action source contains {source_count}; "
|
||||
"update the matrix count"
|
||||
)
|
||||
for d in expired_deferred:
|
||||
warnings.append(
|
||||
f"deferred entry '{d.key}' expired on {d.by.isoformat()} ({d.reason}); "
|
||||
|
||||
@@ -88,6 +88,48 @@ def test_extract_matrix_slugs_strips_anchor():
|
||||
md = "## Service Matrix\n\n| [API Gateway v2](api-gateway.md#v2) | | | 48 |\n\n## Common Setup\n"
|
||||
assert c.extract_matrix_slugs(md) == {"api-gateway"}
|
||||
|
||||
def test_extract_matrix_action_counts():
|
||||
md = """
|
||||
# Services Overview
|
||||
|
||||
## Service Matrix
|
||||
|
||||
| Service | Endpoint | Protocol | Supported operations |
|
||||
|---|---|---|---|
|
||||
| [SSM](ssm.md) | ... | JSON 1.1 | 22 |
|
||||
| [CloudFormation](cloudformation.md) | ... | Query | 19 |
|
||||
| [API Gateway v2](api-gateway.md#v2) | ... | REST JSON | 53 + data-plane |
|
||||
|
||||
## Common Setup
|
||||
"""
|
||||
|
||||
assert c.extract_matrix_action_counts(md) == {
|
||||
"ssm": 22,
|
||||
"cloudformation": 19,
|
||||
}
|
||||
|
||||
|
||||
def test_extract_matrix_action_counts_ignores_links_outside_matrix():
|
||||
md = """
|
||||
# Services Overview
|
||||
|
||||
A link to [SSM](ssm.md) outside the matrix must not be counted.
|
||||
|
||||
## Service Matrix
|
||||
|
||||
| Service | Endpoint | Protocol | Supported operations |
|
||||
|---|---|---|---|
|
||||
| [CloudFormation](cloudformation.md) | ... | Query | 19 |
|
||||
|
||||
## Common Setup
|
||||
|
||||
Another link to [SQS](sqs.md).
|
||||
"""
|
||||
|
||||
assert c.extract_matrix_action_counts(md) == {
|
||||
"cloudformation": 19,
|
||||
}
|
||||
|
||||
|
||||
def test_extract_matrix_slugs_raises_on_missing_heading():
|
||||
# A renamed/reordered heading must fail loudly rather than silently returning an
|
||||
|
||||
Reference in new issue
Block a user