diff --git a/.tekton/compliance-operator-bundle-dev-pull-request.yaml b/.tekton/compliance-operator-bundle-dev-pull-request.yaml index 6c6af00392..defdb8232d 100644 --- a/.tekton/compliance-operator-bundle-dev-pull-request.yaml +++ b/.tekton/compliance-operator-bundle-dev-pull-request.yaml @@ -40,6 +40,20 @@ spec: _Uses `buildah` to create a container image leveraging [trusted artifacts](https://konflux-ci.dev/architecture/ADR/0036-trusted-artifacts.html). It also optionally creates a source image and runs some build-time tests. Information is shared between tasks using OCI artifacts instead of PVCs. EC will pass the [`trusted_task.trusted`](https://conforma.dev/docs/policy/packages/release_trusted_task.html#trusted_task__trusted) policy as long as all data used to build the artifact is generated from trusted tasks. This pipeline is pushed as a Tekton bundle to [quay.io](https://quay.io/repository/konflux-ci/tekton-catalog/pipeline-docker-build-oci-ta?tab=tags)_ + finally: + - name: show-sbom + params: + - name: IMAGE_URL + value: $(tasks.build-image-index.results.IMAGE_URL) + taskRef: + params: + - name: name + value: show-sbom + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-show-sbom:0.1@sha256:04994df487ee886adbe60a8a5866647fbdfd53cc26f7b2554272ba51bf7af29e + - name: kind + value: task + resolver: bundles params: - description: Source Repository URL name: git-url @@ -99,22 +113,6 @@ spec: default: docker type: string description: The format for the resulting image's mediaType. Valid values are oci or docker. - - name: source-date-epoch - type: string - default: '' - description: Sets the image created time and the SOURCE_DATE_EPOCH build argument. On its own, it does not change file timestamps inside the layers (set rewrite-timestamp to "true" for that). Leave empty to keep the actual build time. - - name: rewrite-timestamp - type: string - default: 'false' - description: When "true", clamp file modification times in the image layers to at most source-date-epoch. Does nothing unless source-date-epoch is set. - - name: omit-history - type: string - default: 'false' - description: When "true", omit the build history (history timestamps, layer metadata, etc.) from the resulting image. - - name: enable-package-registry-proxy - default: 'true' - description: Use the package registry proxy when prefetching dependencies - type: string results: - description: "" name: IMAGE_URL @@ -135,7 +133,7 @@ spec: - name: name value: init - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-init:0.4.3@sha256:5f687152ab0661f84830877de93a8ec45cb0b756f71b24ac55133d03a4007936 + value: quay.io/konflux-ci/tekton-catalog/task-init:0.4@sha256:288f3106118edc1d0f0c79a89c960abf5841a4dd8bc3f38feb10527253105b19 - name: kind value: task resolver: bundles @@ -156,7 +154,7 @@ spec: - name: name value: git-clone-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.2.6@sha256:3bcd4c39a346d29617013f4c47d245d38f020cdbf814cf3ce095911c528f5003 + value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.1@sha256:2c388d28651457db60bb90287e7d8c3680303197196e4476878d98d81e8b6dc9 - name: kind value: task resolver: bundles @@ -173,8 +171,6 @@ spec: value: $(params.output-image).prefetch - name: ociArtifactExpiresAfter value: $(params.image-expires-after) - - name: enable-package-registry-proxy - value: $(params.enable-package-registry-proxy) runAfter: - clone-repository taskRef: @@ -182,7 +178,7 @@ spec: - name: name value: prefetch-dependencies-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.10.1@sha256:c09c1c3ced67fb8740b2925a7de09c0810d4e8c8f148d41c21ffe37810d85c62 + value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.3@sha256:2229dbc5e15acc0a6d8aec526465aeb0ad54e269c311ac3d0aba88013845e308 - name: kind value: task resolver: bundles @@ -220,12 +216,6 @@ spec: value: $(tasks.prefetch-dependencies.results.CACHI2_ARTIFACT) - name: BUILDAH_FORMAT value: $(params.buildah-format) - - name: SOURCE_DATE_EPOCH - value: $(params.source-date-epoch) - - name: REWRITE_TIMESTAMP - value: $(params.rewrite-timestamp) - - name: OMIT_HISTORY - value: $(params.omit-history) runAfter: - prefetch-dependencies taskRef: @@ -233,7 +223,7 @@ spec: - name: name value: buildah-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-buildah-oci-ta:0.12.0@sha256:cf32941c77e413818c4ef6b78c2a88d6e6ddc21729767d8f4d316cd293e4a15d + value: quay.io/konflux-ci/tekton-catalog/task-buildah-oci-ta:0.9@sha256:ce89532f0ea6003febc663c8b68779d98eac76b26dee2380a75cb0d485f81428 - name: kind value: task resolver: bundles @@ -241,6 +231,10 @@ spec: params: - name: IMAGE value: $(params.output-image) + - name: COMMIT_SHA + value: $(tasks.clone-repository.results.commit) + - name: IMAGE_EXPIRES_AFTER + value: $(params.image-expires-after) - name: ALWAYS_BUILD_INDEX value: $(params.build-image-index) - name: IMAGES @@ -255,7 +249,7 @@ spec: - name: name value: build-image-index - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.3.1@sha256:c2cda69e681c976dd5b39caf6682d1c8f8c5e5a53a67a22a5b06d4cde773bd10 + value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.2@sha256:c7b0f7e1f743040d99a3532abbdfddc9484f80fd559a75171c97499c3eb5d163 - name: kind value: task resolver: bundles @@ -276,7 +270,7 @@ spec: - name: name value: source-build-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:6bb2697f8f194a6a644b8b861489ce8b1c5ba16a7d55dbd8e66a0c98d06dfc1c + value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:362f0475df00e7dfb5f15dea0481d1b68b287f60411718d70a23da3c059a5613 - name: kind value: task resolver: bundles @@ -298,7 +292,7 @@ spec: - name: name value: deprecated-image-check - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.5@sha256:0ccc688a77e9b7b0b8973c132a1e840844137e77f887be4a0bec8893b0776872 + value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.5@sha256:5ff16b7e6b4a8aa1adb352e74b9f831f77ff97bafd1b89ddb0038d63335f1a67 - name: kind value: task resolver: bundles @@ -320,7 +314,7 @@ spec: - name: name value: clair-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-clair-scan:0.4.0@sha256:dcc6ca58d3ec03d05ce21c03b4f51b58cac9878caa932ad06a9fdf4bc422aaab + value: quay.io/konflux-ci/tekton-catalog/task-clair-scan:0.3@sha256:3fa03be0280f33d7070ea53f26d53e727199737a7a2b9a59a95071ae40a999ac - name: kind value: task resolver: bundles @@ -340,7 +334,7 @@ spec: - name: name value: ecosystem-cert-preflight-checks - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:4619769705d4999e129b779d7699d89d33c47f7ab80d73ad6e3dcd8a6a4e43a7 + value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:b4ac586edea81dcd25dfc17f1bd57899825be2b443e48d572cd05ce058f153bb - name: kind value: task resolver: bundles @@ -368,7 +362,7 @@ spec: - name: name value: sast-snyk-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-snyk-check-oci-ta:0.5@sha256:b78e9c05c5126613eddee53f2f3534a9b86bfca17d903599f2fa465b7938e241 + value: quay.io/konflux-ci/tekton-catalog/task-sast-snyk-check-oci-ta:0.4@sha256:d83becbfefe2aa39971c3d37bdc23489b745e22fd86cf4872455a133f8cb274f - name: kind value: task resolver: bundles @@ -390,7 +384,7 @@ spec: - name: name value: clamav-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.3.1@sha256:53a02326bfb930ca5ef6bfa7a33acca833d57752f34f3cb79255fe2e25e7d217 + value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.3@sha256:9f18b216ce71a66909e7cb17d9b34526c02d73cf12884ba32d1f10614f7b9f5a - name: kind value: task resolver: bundles @@ -416,7 +410,7 @@ spec: - name: name value: sast-shell-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:beb05ae2fad733783b3b17e05871e0eaf527a07c904cf3fb2cb551025007eec1 + value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:6f047f52c04ee6e4d2cb25af46e3ea92b235f6c5e02da540fb7ef0b90718bc0a - name: kind value: task resolver: bundles @@ -442,7 +436,7 @@ spec: - name: name value: sast-unicode-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.4@sha256:d09f717cb84f0699a531773bc498745deef2c006a81918aa73b3be6d2f4778bd + value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.4@sha256:55006815522c57c1f83451dc0cba723ff7427dbac48553538b75cda7bf886d79 - name: kind value: task resolver: bundles @@ -464,7 +458,7 @@ spec: - name: name value: apply-tags - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-apply-tags:0.3@sha256:2dae3c4beaf1070db565c536bc997e93925ae8c0c45dd8da9b4ae5293fd8c592 + value: quay.io/konflux-ci/tekton-catalog/task-apply-tags:0.3@sha256:aa62b41861c09e2e59c69cc6e9a1f740bf0c81e6a1eb03f57f59dfda0f65840e - name: kind value: task resolver: bundles @@ -487,7 +481,7 @@ spec: - name: name value: push-dockerfile-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.3.1@sha256:393b4d0b530c2657b3ff6fec714781f4938b95b699dea2b369442b7664e1cce2 + value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.3@sha256:1bc2d0f26b89259db090a47bb38217c82c05e335d626653d184adf1d196ca131 - name: kind value: task resolver: bundles @@ -504,7 +498,7 @@ spec: - name: name value: rpms-signature-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-rpms-signature-scan:0.2.1@sha256:538a853c4a299216c43258ccc9894215f5440dc0c70c9c99fe22fc9633a8e79d + value: quay.io/konflux-ci/tekton-catalog/task-rpms-signature-scan:0.2@sha256:3d48fa2fcc898bae9ce730a71789c34758a767b44bc36fd24938779deef4ee96 - name: kind value: task resolver: bundles diff --git a/.tekton/compliance-operator-bundle-dev-push.yaml b/.tekton/compliance-operator-bundle-dev-push.yaml index cf98ea8121..3f4e7cae45 100644 --- a/.tekton/compliance-operator-bundle-dev-push.yaml +++ b/.tekton/compliance-operator-bundle-dev-push.yaml @@ -37,6 +37,20 @@ spec: _Uses `buildah` to create a container image leveraging [trusted artifacts](https://konflux-ci.dev/architecture/ADR/0036-trusted-artifacts.html). It also optionally creates a source image and runs some build-time tests. Information is shared between tasks using OCI artifacts instead of PVCs. EC will pass the [`trusted_task.trusted`](https://conforma.dev/docs/policy/packages/release_trusted_task.html#trusted_task__trusted) policy as long as all data used to build the artifact is generated from trusted tasks. This pipeline is pushed as a Tekton bundle to [quay.io](https://quay.io/repository/konflux-ci/tekton-catalog/pipeline-docker-build-oci-ta?tab=tags)_ + finally: + - name: show-sbom + params: + - name: IMAGE_URL + value: $(tasks.build-image-index.results.IMAGE_URL) + taskRef: + params: + - name: name + value: show-sbom + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-show-sbom:0.1@sha256:04994df487ee886adbe60a8a5866647fbdfd53cc26f7b2554272ba51bf7af29e + - name: kind + value: task + resolver: bundles params: - description: Source Repository URL name: git-url @@ -96,22 +110,6 @@ spec: default: docker type: string description: The format for the resulting image's mediaType. Valid values are oci or docker. - - name: source-date-epoch - type: string - default: '' - description: Sets the image created time and the SOURCE_DATE_EPOCH build argument. On its own, it does not change file timestamps inside the layers (set rewrite-timestamp to "true" for that). Leave empty to keep the actual build time. - - name: rewrite-timestamp - type: string - default: 'false' - description: When "true", clamp file modification times in the image layers to at most source-date-epoch. Does nothing unless source-date-epoch is set. - - name: omit-history - type: string - default: 'false' - description: When "true", omit the build history (history timestamps, layer metadata, etc.) from the resulting image. - - name: enable-package-registry-proxy - default: 'true' - description: Use the package registry proxy when prefetching dependencies - type: string results: - description: "" name: IMAGE_URL @@ -132,7 +130,7 @@ spec: - name: name value: init - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-init:0.4.3@sha256:5f687152ab0661f84830877de93a8ec45cb0b756f71b24ac55133d03a4007936 + value: quay.io/konflux-ci/tekton-catalog/task-init:0.4@sha256:288f3106118edc1d0f0c79a89c960abf5841a4dd8bc3f38feb10527253105b19 - name: kind value: task resolver: bundles @@ -153,7 +151,7 @@ spec: - name: name value: git-clone-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.2.6@sha256:3bcd4c39a346d29617013f4c47d245d38f020cdbf814cf3ce095911c528f5003 + value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.1@sha256:2c388d28651457db60bb90287e7d8c3680303197196e4476878d98d81e8b6dc9 - name: kind value: task resolver: bundles @@ -170,8 +168,6 @@ spec: value: $(params.output-image).prefetch - name: ociArtifactExpiresAfter value: $(params.image-expires-after) - - name: enable-package-registry-proxy - value: $(params.enable-package-registry-proxy) runAfter: - clone-repository taskRef: @@ -179,7 +175,7 @@ spec: - name: name value: prefetch-dependencies-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.10.1@sha256:c09c1c3ced67fb8740b2925a7de09c0810d4e8c8f148d41c21ffe37810d85c62 + value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.3@sha256:2229dbc5e15acc0a6d8aec526465aeb0ad54e269c311ac3d0aba88013845e308 - name: kind value: task resolver: bundles @@ -217,12 +213,6 @@ spec: value: $(tasks.prefetch-dependencies.results.CACHI2_ARTIFACT) - name: BUILDAH_FORMAT value: $(params.buildah-format) - - name: SOURCE_DATE_EPOCH - value: $(params.source-date-epoch) - - name: REWRITE_TIMESTAMP - value: $(params.rewrite-timestamp) - - name: OMIT_HISTORY - value: $(params.omit-history) runAfter: - prefetch-dependencies taskRef: @@ -230,7 +220,7 @@ spec: - name: name value: buildah-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-buildah-oci-ta:0.12.0@sha256:cf32941c77e413818c4ef6b78c2a88d6e6ddc21729767d8f4d316cd293e4a15d + value: quay.io/konflux-ci/tekton-catalog/task-buildah-oci-ta:0.9@sha256:ce89532f0ea6003febc663c8b68779d98eac76b26dee2380a75cb0d485f81428 - name: kind value: task resolver: bundles @@ -238,6 +228,10 @@ spec: params: - name: IMAGE value: $(params.output-image) + - name: COMMIT_SHA + value: $(tasks.clone-repository.results.commit) + - name: IMAGE_EXPIRES_AFTER + value: $(params.image-expires-after) - name: ALWAYS_BUILD_INDEX value: $(params.build-image-index) - name: IMAGES @@ -252,7 +246,7 @@ spec: - name: name value: build-image-index - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.3.1@sha256:c2cda69e681c976dd5b39caf6682d1c8f8c5e5a53a67a22a5b06d4cde773bd10 + value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.2@sha256:c7b0f7e1f743040d99a3532abbdfddc9484f80fd559a75171c97499c3eb5d163 - name: kind value: task resolver: bundles @@ -273,7 +267,7 @@ spec: - name: name value: source-build-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:6bb2697f8f194a6a644b8b861489ce8b1c5ba16a7d55dbd8e66a0c98d06dfc1c + value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:362f0475df00e7dfb5f15dea0481d1b68b287f60411718d70a23da3c059a5613 - name: kind value: task resolver: bundles @@ -295,7 +289,7 @@ spec: - name: name value: deprecated-image-check - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.5@sha256:0ccc688a77e9b7b0b8973c132a1e840844137e77f887be4a0bec8893b0776872 + value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.5@sha256:5ff16b7e6b4a8aa1adb352e74b9f831f77ff97bafd1b89ddb0038d63335f1a67 - name: kind value: task resolver: bundles @@ -317,7 +311,7 @@ spec: - name: name value: clair-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-clair-scan:0.4.0@sha256:dcc6ca58d3ec03d05ce21c03b4f51b58cac9878caa932ad06a9fdf4bc422aaab + value: quay.io/konflux-ci/tekton-catalog/task-clair-scan:0.3@sha256:3fa03be0280f33d7070ea53f26d53e727199737a7a2b9a59a95071ae40a999ac - name: kind value: task resolver: bundles @@ -337,7 +331,7 @@ spec: - name: name value: ecosystem-cert-preflight-checks - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:4619769705d4999e129b779d7699d89d33c47f7ab80d73ad6e3dcd8a6a4e43a7 + value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:b4ac586edea81dcd25dfc17f1bd57899825be2b443e48d572cd05ce058f153bb - name: kind value: task resolver: bundles @@ -365,7 +359,7 @@ spec: - name: name value: sast-snyk-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-snyk-check-oci-ta:0.5@sha256:b78e9c05c5126613eddee53f2f3534a9b86bfca17d903599f2fa465b7938e241 + value: quay.io/konflux-ci/tekton-catalog/task-sast-snyk-check-oci-ta:0.4@sha256:d83becbfefe2aa39971c3d37bdc23489b745e22fd86cf4872455a133f8cb274f - name: kind value: task resolver: bundles @@ -387,7 +381,7 @@ spec: - name: name value: clamav-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.3.1@sha256:53a02326bfb930ca5ef6bfa7a33acca833d57752f34f3cb79255fe2e25e7d217 + value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.3@sha256:9f18b216ce71a66909e7cb17d9b34526c02d73cf12884ba32d1f10614f7b9f5a - name: kind value: task resolver: bundles @@ -413,7 +407,7 @@ spec: - name: name value: sast-shell-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:beb05ae2fad733783b3b17e05871e0eaf527a07c904cf3fb2cb551025007eec1 + value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:6f047f52c04ee6e4d2cb25af46e3ea92b235f6c5e02da540fb7ef0b90718bc0a - name: kind value: task resolver: bundles @@ -439,7 +433,7 @@ spec: - name: name value: sast-unicode-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.4@sha256:d09f717cb84f0699a531773bc498745deef2c006a81918aa73b3be6d2f4778bd + value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.4@sha256:55006815522c57c1f83451dc0cba723ff7427dbac48553538b75cda7bf886d79 - name: kind value: task resolver: bundles @@ -464,7 +458,7 @@ spec: - name: name value: apply-tags - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-apply-tags:0.3@sha256:2dae3c4beaf1070db565c536bc997e93925ae8c0c45dd8da9b4ae5293fd8c592 + value: quay.io/konflux-ci/tekton-catalog/task-apply-tags:0.3@sha256:aa62b41861c09e2e59c69cc6e9a1f740bf0c81e6a1eb03f57f59dfda0f65840e - name: kind value: task resolver: bundles @@ -487,7 +481,7 @@ spec: - name: name value: push-dockerfile-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.3.1@sha256:393b4d0b530c2657b3ff6fec714781f4938b95b699dea2b369442b7664e1cce2 + value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.3@sha256:1bc2d0f26b89259db090a47bb38217c82c05e335d626653d184adf1d196ca131 - name: kind value: task resolver: bundles @@ -504,7 +498,7 @@ spec: - name: name value: rpms-signature-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-rpms-signature-scan:0.2.1@sha256:538a853c4a299216c43258ccc9894215f5440dc0c70c9c99fe22fc9633a8e79d + value: quay.io/konflux-ci/tekton-catalog/task-rpms-signature-scan:0.2@sha256:3d48fa2fcc898bae9ce730a71789c34758a767b44bc36fd24938779deef4ee96 - name: kind value: task resolver: bundles diff --git a/.tekton/compliance-operator-dev-pull-request.yaml b/.tekton/compliance-operator-dev-pull-request.yaml index be11d355d9..476acb80ed 100644 --- a/.tekton/compliance-operator-dev-pull-request.yaml +++ b/.tekton/compliance-operator-dev-pull-request.yaml @@ -46,6 +46,20 @@ spec: _Uses `buildah` to create a multi-platform container image leveraging [trusted artifacts](https://konflux-ci.dev/architecture/ADR/0036-trusted-artifacts.html). It also optionally creates a source image and runs some build-time tests. This pipeline requires that the [multi platform controller](https://github.com/konflux-ci/multi-platform-controller) is deployed and configured on your Konflux instance. Information is shared between tasks using OCI artifacts instead of PVCs. EC will pass the [`trusted_task.trusted`](https://conforma.dev/docs/policy/packages/release_trusted_task.html#trusted_task__trusted) policy as long as all data used to build the artifact is generated from trusted tasks. This pipeline is pushed as a Tekton bundle to [quay.io](https://quay.io/repository/konflux-ci/tekton-catalog/pipeline-docker-build-multi-platform-oci-ta?tab=tags)_ + finally: + - name: show-sbom + params: + - name: IMAGE_URL + value: $(tasks.build-image-index.results.IMAGE_URL) + taskRef: + params: + - name: name + value: show-sbom + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-show-sbom:0.1@sha256:04994df487ee886adbe60a8a5866647fbdfd53cc26f7b2554272ba51bf7af29e + - name: kind + value: task + resolver: bundles params: - description: Source Repository URL name: git-url @@ -110,22 +124,6 @@ spec: default: docker type: string description: The format for the resulting image's mediaType. Valid values are oci or docker. - - name: source-date-epoch - type: string - default: '' - description: Sets the image created time and the SOURCE_DATE_EPOCH build argument. On its own, it does not change file timestamps inside the layers (set rewrite-timestamp to "true" for that). Leave empty to keep the actual build time. - - name: rewrite-timestamp - type: string - default: 'false' - description: When "true", clamp file modification times in the image layers to at most source-date-epoch. Does nothing unless source-date-epoch is set. - - name: omit-history - type: string - default: 'false' - description: When "true", omit the build history (history timestamps, layer metadata, etc.) from the resulting image. - - name: enable-package-registry-proxy - default: 'true' - description: Use the package registry proxy when prefetching dependencies - type: string results: - description: "" name: IMAGE_URL @@ -146,7 +144,7 @@ spec: - name: name value: init - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-init:0.4.3@sha256:5f687152ab0661f84830877de93a8ec45cb0b756f71b24ac55133d03a4007936 + value: quay.io/konflux-ci/tekton-catalog/task-init:0.4@sha256:288f3106118edc1d0f0c79a89c960abf5841a4dd8bc3f38feb10527253105b19 - name: kind value: task resolver: bundles @@ -167,7 +165,7 @@ spec: - name: name value: git-clone-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.2.6@sha256:3bcd4c39a346d29617013f4c47d245d38f020cdbf814cf3ce095911c528f5003 + value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.1@sha256:2c388d28651457db60bb90287e7d8c3680303197196e4476878d98d81e8b6dc9 - name: kind value: task resolver: bundles @@ -184,8 +182,6 @@ spec: value: $(params.output-image).prefetch - name: ociArtifactExpiresAfter value: $(params.image-expires-after) - - name: enable-package-registry-proxy - value: $(params.enable-package-registry-proxy) runAfter: - clone-repository taskRef: @@ -193,7 +189,7 @@ spec: - name: name value: prefetch-dependencies-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.10.1@sha256:c09c1c3ced67fb8740b2925a7de09c0810d4e8c8f148d41c21ffe37810d85c62 + value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.3@sha256:2229dbc5e15acc0a6d8aec526465aeb0ad54e269c311ac3d0aba88013845e308 - name: kind value: task resolver: bundles @@ -238,12 +234,6 @@ spec: value: "true" - name: BUILDAH_FORMAT value: $(params.buildah-format) - - name: SOURCE_DATE_EPOCH - value: $(params.source-date-epoch) - - name: REWRITE_TIMESTAMP - value: $(params.rewrite-timestamp) - - name: OMIT_HISTORY - value: $(params.omit-history) runAfter: - prefetch-dependencies taskRef: @@ -251,7 +241,7 @@ spec: - name: name value: buildah-remote-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-buildah-remote-oci-ta:0.12.0@sha256:44c1ca2e823f006ee94e066231b033b191f0f8cee51add1e908138335eba9b30 + value: quay.io/konflux-ci/tekton-catalog/task-buildah-remote-oci-ta:0.9@sha256:a9ca472e297388d6ef8d1f51ee205abee6076aed7c5356ec0df84f14a2e78ad8 - name: kind value: task resolver: bundles @@ -259,6 +249,10 @@ spec: params: - name: IMAGE value: $(params.output-image) + - name: COMMIT_SHA + value: $(tasks.clone-repository.results.commit) + - name: IMAGE_EXPIRES_AFTER + value: $(params.image-expires-after) - name: ALWAYS_BUILD_INDEX value: $(params.build-image-index) - name: IMAGES @@ -273,7 +267,7 @@ spec: - name: name value: build-image-index - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.3.1@sha256:c2cda69e681c976dd5b39caf6682d1c8f8c5e5a53a67a22a5b06d4cde773bd10 + value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.2@sha256:c7b0f7e1f743040d99a3532abbdfddc9484f80fd559a75171c97499c3eb5d163 - name: kind value: task resolver: bundles @@ -294,7 +288,7 @@ spec: - name: name value: source-build-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:6bb2697f8f194a6a644b8b861489ce8b1c5ba16a7d55dbd8e66a0c98d06dfc1c + value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:362f0475df00e7dfb5f15dea0481d1b68b287f60411718d70a23da3c059a5613 - name: kind value: task resolver: bundles @@ -316,7 +310,7 @@ spec: - name: name value: deprecated-image-check - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.5@sha256:0ccc688a77e9b7b0b8973c132a1e840844137e77f887be4a0bec8893b0776872 + value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.5@sha256:5ff16b7e6b4a8aa1adb352e74b9f831f77ff97bafd1b89ddb0038d63335f1a67 - name: kind value: task resolver: bundles @@ -343,7 +337,7 @@ spec: - name: name value: clair-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-clair-scan:0.4.0@sha256:dcc6ca58d3ec03d05ce21c03b4f51b58cac9878caa932ad06a9fdf4bc422aaab + value: quay.io/konflux-ci/tekton-catalog/task-clair-scan:0.3@sha256:3fa03be0280f33d7070ea53f26d53e727199737a7a2b9a59a95071ae40a999ac - name: kind value: task resolver: bundles @@ -363,7 +357,7 @@ spec: - name: name value: ecosystem-cert-preflight-checks - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:4619769705d4999e129b779d7699d89d33c47f7ab80d73ad6e3dcd8a6a4e43a7 + value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:b4ac586edea81dcd25dfc17f1bd57899825be2b443e48d572cd05ce058f153bb - name: kind value: task resolver: bundles @@ -391,7 +385,7 @@ spec: - name: name value: sast-snyk-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-snyk-check-oci-ta:0.5@sha256:b78e9c05c5126613eddee53f2f3534a9b86bfca17d903599f2fa465b7938e241 + value: quay.io/konflux-ci/tekton-catalog/task-sast-snyk-check-oci-ta:0.4@sha256:d83becbfefe2aa39971c3d37bdc23489b745e22fd86cf4872455a133f8cb274f - name: kind value: task resolver: bundles @@ -413,7 +407,7 @@ spec: - name: name value: clamav-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.3.1@sha256:53a02326bfb930ca5ef6bfa7a33acca833d57752f34f3cb79255fe2e25e7d217 + value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.3@sha256:9f18b216ce71a66909e7cb17d9b34526c02d73cf12884ba32d1f10614f7b9f5a - name: kind value: task resolver: bundles @@ -439,7 +433,7 @@ spec: - name: name value: sast-shell-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:beb05ae2fad733783b3b17e05871e0eaf527a07c904cf3fb2cb551025007eec1 + value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:6f047f52c04ee6e4d2cb25af46e3ea92b235f6c5e02da540fb7ef0b90718bc0a - name: kind value: task resolver: bundles @@ -465,7 +459,7 @@ spec: - name: name value: sast-unicode-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.4@sha256:d09f717cb84f0699a531773bc498745deef2c006a81918aa73b3be6d2f4778bd + value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.4@sha256:55006815522c57c1f83451dc0cba723ff7427dbac48553538b75cda7bf886d79 - name: kind value: task resolver: bundles @@ -487,7 +481,7 @@ spec: - name: name value: apply-tags - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-apply-tags:0.3@sha256:2dae3c4beaf1070db565c536bc997e93925ae8c0c45dd8da9b4ae5293fd8c592 + value: quay.io/konflux-ci/tekton-catalog/task-apply-tags:0.3@sha256:aa62b41861c09e2e59c69cc6e9a1f740bf0c81e6a1eb03f57f59dfda0f65840e - name: kind value: task resolver: bundles @@ -510,7 +504,7 @@ spec: - name: name value: push-dockerfile-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.3.1@sha256:393b4d0b530c2657b3ff6fec714781f4938b95b699dea2b369442b7664e1cce2 + value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.3@sha256:1bc2d0f26b89259db090a47bb38217c82c05e335d626653d184adf1d196ca131 - name: kind value: task resolver: bundles @@ -527,7 +521,7 @@ spec: - name: name value: rpms-signature-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-rpms-signature-scan:0.2.1@sha256:538a853c4a299216c43258ccc9894215f5440dc0c70c9c99fe22fc9633a8e79d + value: quay.io/konflux-ci/tekton-catalog/task-rpms-signature-scan:0.2@sha256:3d48fa2fcc898bae9ce730a71789c34758a767b44bc36fd24938779deef4ee96 - name: kind value: task resolver: bundles diff --git a/.tekton/compliance-operator-dev-push.yaml b/.tekton/compliance-operator-dev-push.yaml index 570612632f..c47f4fc71d 100644 --- a/.tekton/compliance-operator-dev-push.yaml +++ b/.tekton/compliance-operator-dev-push.yaml @@ -44,6 +44,20 @@ spec: _Uses `buildah` to create a multi-platform container image leveraging [trusted artifacts](https://konflux-ci.dev/architecture/ADR/0036-trusted-artifacts.html). It also optionally creates a source image and runs some build-time tests. This pipeline requires that the [multi platform controller](https://github.com/konflux-ci/multi-platform-controller) is deployed and configured on your Konflux instance. Information is shared between tasks using OCI artifacts instead of PVCs. EC will pass the [`trusted_task.trusted`](https://conforma.dev/docs/policy/packages/release_trusted_task.html#trusted_task__trusted) policy as long as all data used to build the artifact is generated from trusted tasks. This pipeline is pushed as a Tekton bundle to [quay.io](https://quay.io/repository/konflux-ci/tekton-catalog/pipeline-docker-build-multi-platform-oci-ta?tab=tags)_ + finally: + - name: show-sbom + params: + - name: IMAGE_URL + value: $(tasks.build-image-index.results.IMAGE_URL) + taskRef: + params: + - name: name + value: show-sbom + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-show-sbom:0.1@sha256:04994df487ee886adbe60a8a5866647fbdfd53cc26f7b2554272ba51bf7af29e + - name: kind + value: task + resolver: bundles params: - description: Source Repository URL name: git-url @@ -108,22 +122,6 @@ spec: default: docker type: string description: The format for the resulting image's mediaType. Valid values are oci or docker. - - name: source-date-epoch - type: string - default: '' - description: Sets the image created time and the SOURCE_DATE_EPOCH build argument. On its own, it does not change file timestamps inside the layers (set rewrite-timestamp to "true" for that). Leave empty to keep the actual build time. - - name: rewrite-timestamp - type: string - default: 'false' - description: When "true", clamp file modification times in the image layers to at most source-date-epoch. Does nothing unless source-date-epoch is set. - - name: omit-history - type: string - default: 'false' - description: When "true", omit the build history (history timestamps, layer metadata, etc.) from the resulting image. - - name: enable-package-registry-proxy - default: 'true' - description: Use the package registry proxy when prefetching dependencies - type: string results: - description: "" name: IMAGE_URL @@ -144,7 +142,7 @@ spec: - name: name value: init - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-init:0.4.3@sha256:5f687152ab0661f84830877de93a8ec45cb0b756f71b24ac55133d03a4007936 + value: quay.io/konflux-ci/tekton-catalog/task-init:0.4@sha256:288f3106118edc1d0f0c79a89c960abf5841a4dd8bc3f38feb10527253105b19 - name: kind value: task resolver: bundles @@ -165,7 +163,7 @@ spec: - name: name value: git-clone-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.2.6@sha256:3bcd4c39a346d29617013f4c47d245d38f020cdbf814cf3ce095911c528f5003 + value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.1@sha256:2c388d28651457db60bb90287e7d8c3680303197196e4476878d98d81e8b6dc9 - name: kind value: task resolver: bundles @@ -182,8 +180,6 @@ spec: value: $(params.output-image).prefetch - name: ociArtifactExpiresAfter value: $(params.image-expires-after) - - name: enable-package-registry-proxy - value: $(params.enable-package-registry-proxy) runAfter: - clone-repository taskRef: @@ -191,7 +187,7 @@ spec: - name: name value: prefetch-dependencies-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.10.1@sha256:c09c1c3ced67fb8740b2925a7de09c0810d4e8c8f148d41c21ffe37810d85c62 + value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.3@sha256:2229dbc5e15acc0a6d8aec526465aeb0ad54e269c311ac3d0aba88013845e308 - name: kind value: task resolver: bundles @@ -236,12 +232,6 @@ spec: value: "true" - name: BUILDAH_FORMAT value: $(params.buildah-format) - - name: SOURCE_DATE_EPOCH - value: $(params.source-date-epoch) - - name: REWRITE_TIMESTAMP - value: $(params.rewrite-timestamp) - - name: OMIT_HISTORY - value: $(params.omit-history) runAfter: - prefetch-dependencies taskRef: @@ -249,7 +239,7 @@ spec: - name: name value: buildah-remote-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-buildah-remote-oci-ta:0.12.0@sha256:44c1ca2e823f006ee94e066231b033b191f0f8cee51add1e908138335eba9b30 + value: quay.io/konflux-ci/tekton-catalog/task-buildah-remote-oci-ta:0.9@sha256:a9ca472e297388d6ef8d1f51ee205abee6076aed7c5356ec0df84f14a2e78ad8 - name: kind value: task resolver: bundles @@ -257,6 +247,10 @@ spec: params: - name: IMAGE value: $(params.output-image) + - name: COMMIT_SHA + value: $(tasks.clone-repository.results.commit) + - name: IMAGE_EXPIRES_AFTER + value: $(params.image-expires-after) - name: ALWAYS_BUILD_INDEX value: $(params.build-image-index) - name: IMAGES @@ -271,7 +265,7 @@ spec: - name: name value: build-image-index - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.3.1@sha256:c2cda69e681c976dd5b39caf6682d1c8f8c5e5a53a67a22a5b06d4cde773bd10 + value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.2@sha256:c7b0f7e1f743040d99a3532abbdfddc9484f80fd559a75171c97499c3eb5d163 - name: kind value: task resolver: bundles @@ -292,7 +286,7 @@ spec: - name: name value: source-build-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:6bb2697f8f194a6a644b8b861489ce8b1c5ba16a7d55dbd8e66a0c98d06dfc1c + value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:362f0475df00e7dfb5f15dea0481d1b68b287f60411718d70a23da3c059a5613 - name: kind value: task resolver: bundles @@ -314,7 +308,7 @@ spec: - name: name value: deprecated-image-check - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.5@sha256:0ccc688a77e9b7b0b8973c132a1e840844137e77f887be4a0bec8893b0776872 + value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.5@sha256:5ff16b7e6b4a8aa1adb352e74b9f831f77ff97bafd1b89ddb0038d63335f1a67 - name: kind value: task resolver: bundles @@ -341,7 +335,7 @@ spec: - name: name value: clair-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-clair-scan:0.4.0@sha256:dcc6ca58d3ec03d05ce21c03b4f51b58cac9878caa932ad06a9fdf4bc422aaab + value: quay.io/konflux-ci/tekton-catalog/task-clair-scan:0.3@sha256:3fa03be0280f33d7070ea53f26d53e727199737a7a2b9a59a95071ae40a999ac - name: kind value: task resolver: bundles @@ -361,7 +355,7 @@ spec: - name: name value: ecosystem-cert-preflight-checks - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:4619769705d4999e129b779d7699d89d33c47f7ab80d73ad6e3dcd8a6a4e43a7 + value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:b4ac586edea81dcd25dfc17f1bd57899825be2b443e48d572cd05ce058f153bb - name: kind value: task resolver: bundles @@ -389,7 +383,7 @@ spec: - name: name value: sast-snyk-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-snyk-check-oci-ta:0.5@sha256:b78e9c05c5126613eddee53f2f3534a9b86bfca17d903599f2fa465b7938e241 + value: quay.io/konflux-ci/tekton-catalog/task-sast-snyk-check-oci-ta:0.4@sha256:d83becbfefe2aa39971c3d37bdc23489b745e22fd86cf4872455a133f8cb274f - name: kind value: task resolver: bundles @@ -411,7 +405,7 @@ spec: - name: name value: clamav-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.3.1@sha256:53a02326bfb930ca5ef6bfa7a33acca833d57752f34f3cb79255fe2e25e7d217 + value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.3@sha256:9f18b216ce71a66909e7cb17d9b34526c02d73cf12884ba32d1f10614f7b9f5a - name: kind value: task resolver: bundles @@ -437,7 +431,7 @@ spec: - name: name value: sast-shell-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:beb05ae2fad733783b3b17e05871e0eaf527a07c904cf3fb2cb551025007eec1 + value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:6f047f52c04ee6e4d2cb25af46e3ea92b235f6c5e02da540fb7ef0b90718bc0a - name: kind value: task resolver: bundles @@ -463,7 +457,7 @@ spec: - name: name value: sast-unicode-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.4@sha256:d09f717cb84f0699a531773bc498745deef2c006a81918aa73b3be6d2f4778bd + value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.4@sha256:55006815522c57c1f83451dc0cba723ff7427dbac48553538b75cda7bf886d79 - name: kind value: task resolver: bundles @@ -488,7 +482,7 @@ spec: - name: name value: apply-tags - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-apply-tags:0.3@sha256:2dae3c4beaf1070db565c536bc997e93925ae8c0c45dd8da9b4ae5293fd8c592 + value: quay.io/konflux-ci/tekton-catalog/task-apply-tags:0.3@sha256:aa62b41861c09e2e59c69cc6e9a1f740bf0c81e6a1eb03f57f59dfda0f65840e - name: kind value: task resolver: bundles @@ -511,7 +505,7 @@ spec: - name: name value: push-dockerfile-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.3.1@sha256:393b4d0b530c2657b3ff6fec714781f4938b95b699dea2b369442b7664e1cce2 + value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.3@sha256:1bc2d0f26b89259db090a47bb38217c82c05e335d626653d184adf1d196ca131 - name: kind value: task resolver: bundles @@ -528,7 +522,7 @@ spec: - name: name value: rpms-signature-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-rpms-signature-scan:0.2.1@sha256:538a853c4a299216c43258ccc9894215f5440dc0c70c9c99fe22fc9633a8e79d + value: quay.io/konflux-ci/tekton-catalog/task-rpms-signature-scan:0.2@sha256:3d48fa2fcc898bae9ce730a71789c34758a767b44bc36fd24938779deef4ee96 - name: kind value: task resolver: bundles diff --git a/.tekton/compliance-operator-must-gather-dev-pull-request.yaml b/.tekton/compliance-operator-must-gather-dev-pull-request.yaml index 5af67ae785..ac859de435 100644 --- a/.tekton/compliance-operator-must-gather-dev-pull-request.yaml +++ b/.tekton/compliance-operator-must-gather-dev-pull-request.yaml @@ -46,6 +46,20 @@ spec: _Uses `buildah` to create a multi-platform container image leveraging [trusted artifacts](https://konflux-ci.dev/architecture/ADR/0036-trusted-artifacts.html). It also optionally creates a source image and runs some build-time tests. This pipeline requires that the [multi platform controller](https://github.com/konflux-ci/multi-platform-controller) is deployed and configured on your Konflux instance. Information is shared between tasks using OCI artifacts instead of PVCs. EC will pass the [`trusted_task.trusted`](https://conforma.dev/docs/policy/packages/release_trusted_task.html#trusted_task__trusted) policy as long as all data used to build the artifact is generated from trusted tasks. This pipeline is pushed as a Tekton bundle to [quay.io](https://quay.io/repository/konflux-ci/tekton-catalog/pipeline-docker-build-multi-platform-oci-ta?tab=tags)_ + finally: + - name: show-sbom + params: + - name: IMAGE_URL + value: $(tasks.build-image-index.results.IMAGE_URL) + taskRef: + params: + - name: name + value: show-sbom + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-show-sbom:0.1@sha256:04994df487ee886adbe60a8a5866647fbdfd53cc26f7b2554272ba51bf7af29e + - name: kind + value: task + resolver: bundles params: - description: Source Repository URL name: git-url @@ -110,22 +124,6 @@ spec: default: docker type: string description: The format for the resulting image's mediaType. Valid values are oci or docker. - - name: source-date-epoch - type: string - default: '' - description: Sets the image created time and the SOURCE_DATE_EPOCH build argument. On its own, it does not change file timestamps inside the layers (set rewrite-timestamp to "true" for that). Leave empty to keep the actual build time. - - name: rewrite-timestamp - type: string - default: 'false' - description: When "true", clamp file modification times in the image layers to at most source-date-epoch. Does nothing unless source-date-epoch is set. - - name: omit-history - type: string - default: 'false' - description: When "true", omit the build history (history timestamps, layer metadata, etc.) from the resulting image. - - name: enable-package-registry-proxy - default: 'true' - description: Use the package registry proxy when prefetching dependencies - type: string results: - description: "" name: IMAGE_URL @@ -146,7 +144,7 @@ spec: - name: name value: init - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-init:0.4.3@sha256:5f687152ab0661f84830877de93a8ec45cb0b756f71b24ac55133d03a4007936 + value: quay.io/konflux-ci/tekton-catalog/task-init:0.4@sha256:288f3106118edc1d0f0c79a89c960abf5841a4dd8bc3f38feb10527253105b19 - name: kind value: task resolver: bundles @@ -167,7 +165,7 @@ spec: - name: name value: git-clone-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.2.6@sha256:3bcd4c39a346d29617013f4c47d245d38f020cdbf814cf3ce095911c528f5003 + value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.1@sha256:2c388d28651457db60bb90287e7d8c3680303197196e4476878d98d81e8b6dc9 - name: kind value: task resolver: bundles @@ -184,8 +182,6 @@ spec: value: $(params.output-image).prefetch - name: ociArtifactExpiresAfter value: $(params.image-expires-after) - - name: enable-package-registry-proxy - value: $(params.enable-package-registry-proxy) runAfter: - clone-repository taskRef: @@ -193,7 +189,7 @@ spec: - name: name value: prefetch-dependencies-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.10.1@sha256:c09c1c3ced67fb8740b2925a7de09c0810d4e8c8f148d41c21ffe37810d85c62 + value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.3@sha256:2229dbc5e15acc0a6d8aec526465aeb0ad54e269c311ac3d0aba88013845e308 - name: kind value: task resolver: bundles @@ -238,12 +234,6 @@ spec: value: "true" - name: BUILDAH_FORMAT value: $(params.buildah-format) - - name: SOURCE_DATE_EPOCH - value: $(params.source-date-epoch) - - name: REWRITE_TIMESTAMP - value: $(params.rewrite-timestamp) - - name: OMIT_HISTORY - value: $(params.omit-history) runAfter: - prefetch-dependencies taskRef: @@ -251,7 +241,7 @@ spec: - name: name value: buildah-remote-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-buildah-remote-oci-ta:0.12.0@sha256:44c1ca2e823f006ee94e066231b033b191f0f8cee51add1e908138335eba9b30 + value: quay.io/konflux-ci/tekton-catalog/task-buildah-remote-oci-ta:0.9@sha256:a9ca472e297388d6ef8d1f51ee205abee6076aed7c5356ec0df84f14a2e78ad8 - name: kind value: task resolver: bundles @@ -259,6 +249,10 @@ spec: params: - name: IMAGE value: $(params.output-image) + - name: COMMIT_SHA + value: $(tasks.clone-repository.results.commit) + - name: IMAGE_EXPIRES_AFTER + value: $(params.image-expires-after) - name: ALWAYS_BUILD_INDEX value: $(params.build-image-index) - name: IMAGES @@ -273,7 +267,7 @@ spec: - name: name value: build-image-index - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.3.1@sha256:c2cda69e681c976dd5b39caf6682d1c8f8c5e5a53a67a22a5b06d4cde773bd10 + value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.2@sha256:c7b0f7e1f743040d99a3532abbdfddc9484f80fd559a75171c97499c3eb5d163 - name: kind value: task resolver: bundles @@ -294,7 +288,7 @@ spec: - name: name value: source-build-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:6bb2697f8f194a6a644b8b861489ce8b1c5ba16a7d55dbd8e66a0c98d06dfc1c + value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:362f0475df00e7dfb5f15dea0481d1b68b287f60411718d70a23da3c059a5613 - name: kind value: task resolver: bundles @@ -316,7 +310,7 @@ spec: - name: name value: deprecated-image-check - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.5@sha256:0ccc688a77e9b7b0b8973c132a1e840844137e77f887be4a0bec8893b0776872 + value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.5@sha256:5ff16b7e6b4a8aa1adb352e74b9f831f77ff97bafd1b89ddb0038d63335f1a67 - name: kind value: task resolver: bundles @@ -343,7 +337,7 @@ spec: - name: name value: clair-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-clair-scan:0.4.0@sha256:dcc6ca58d3ec03d05ce21c03b4f51b58cac9878caa932ad06a9fdf4bc422aaab + value: quay.io/konflux-ci/tekton-catalog/task-clair-scan:0.3@sha256:3fa03be0280f33d7070ea53f26d53e727199737a7a2b9a59a95071ae40a999ac - name: kind value: task resolver: bundles @@ -363,7 +357,7 @@ spec: - name: name value: ecosystem-cert-preflight-checks - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:4619769705d4999e129b779d7699d89d33c47f7ab80d73ad6e3dcd8a6a4e43a7 + value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:b4ac586edea81dcd25dfc17f1bd57899825be2b443e48d572cd05ce058f153bb - name: kind value: task resolver: bundles @@ -391,7 +385,7 @@ spec: - name: name value: sast-snyk-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-snyk-check-oci-ta:0.5@sha256:b78e9c05c5126613eddee53f2f3534a9b86bfca17d903599f2fa465b7938e241 + value: quay.io/konflux-ci/tekton-catalog/task-sast-snyk-check-oci-ta:0.4@sha256:d83becbfefe2aa39971c3d37bdc23489b745e22fd86cf4872455a133f8cb274f - name: kind value: task resolver: bundles @@ -413,7 +407,7 @@ spec: - name: name value: clamav-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.3.1@sha256:53a02326bfb930ca5ef6bfa7a33acca833d57752f34f3cb79255fe2e25e7d217 + value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.3@sha256:9f18b216ce71a66909e7cb17d9b34526c02d73cf12884ba32d1f10614f7b9f5a - name: kind value: task resolver: bundles @@ -439,7 +433,7 @@ spec: - name: name value: sast-shell-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:beb05ae2fad733783b3b17e05871e0eaf527a07c904cf3fb2cb551025007eec1 + value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:6f047f52c04ee6e4d2cb25af46e3ea92b235f6c5e02da540fb7ef0b90718bc0a - name: kind value: task resolver: bundles @@ -465,7 +459,7 @@ spec: - name: name value: sast-unicode-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.4@sha256:d09f717cb84f0699a531773bc498745deef2c006a81918aa73b3be6d2f4778bd + value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.4@sha256:55006815522c57c1f83451dc0cba723ff7427dbac48553538b75cda7bf886d79 - name: kind value: task resolver: bundles @@ -487,7 +481,7 @@ spec: - name: name value: apply-tags - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-apply-tags:0.3@sha256:2dae3c4beaf1070db565c536bc997e93925ae8c0c45dd8da9b4ae5293fd8c592 + value: quay.io/konflux-ci/tekton-catalog/task-apply-tags:0.3@sha256:aa62b41861c09e2e59c69cc6e9a1f740bf0c81e6a1eb03f57f59dfda0f65840e - name: kind value: task resolver: bundles @@ -510,7 +504,7 @@ spec: - name: name value: push-dockerfile-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.3.1@sha256:393b4d0b530c2657b3ff6fec714781f4938b95b699dea2b369442b7664e1cce2 + value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.3@sha256:1bc2d0f26b89259db090a47bb38217c82c05e335d626653d184adf1d196ca131 - name: kind value: task resolver: bundles @@ -527,7 +521,7 @@ spec: - name: name value: rpms-signature-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-rpms-signature-scan:0.2.1@sha256:538a853c4a299216c43258ccc9894215f5440dc0c70c9c99fe22fc9633a8e79d + value: quay.io/konflux-ci/tekton-catalog/task-rpms-signature-scan:0.2@sha256:3d48fa2fcc898bae9ce730a71789c34758a767b44bc36fd24938779deef4ee96 - name: kind value: task resolver: bundles diff --git a/.tekton/compliance-operator-must-gather-dev-push.yaml b/.tekton/compliance-operator-must-gather-dev-push.yaml index 5fc35e2486..1afec85271 100644 --- a/.tekton/compliance-operator-must-gather-dev-push.yaml +++ b/.tekton/compliance-operator-must-gather-dev-push.yaml @@ -44,6 +44,20 @@ spec: _Uses `buildah` to create a multi-platform container image leveraging [trusted artifacts](https://konflux-ci.dev/architecture/ADR/0036-trusted-artifacts.html). It also optionally creates a source image and runs some build-time tests. This pipeline requires that the [multi platform controller](https://github.com/konflux-ci/multi-platform-controller) is deployed and configured on your Konflux instance. Information is shared between tasks using OCI artifacts instead of PVCs. EC will pass the [`trusted_task.trusted`](https://conforma.dev/docs/policy/packages/release_trusted_task.html#trusted_task__trusted) policy as long as all data used to build the artifact is generated from trusted tasks. This pipeline is pushed as a Tekton bundle to [quay.io](https://quay.io/repository/konflux-ci/tekton-catalog/pipeline-docker-build-multi-platform-oci-ta?tab=tags)_ + finally: + - name: show-sbom + params: + - name: IMAGE_URL + value: $(tasks.build-image-index.results.IMAGE_URL) + taskRef: + params: + - name: name + value: show-sbom + - name: bundle + value: quay.io/konflux-ci/tekton-catalog/task-show-sbom:0.1@sha256:04994df487ee886adbe60a8a5866647fbdfd53cc26f7b2554272ba51bf7af29e + - name: kind + value: task + resolver: bundles params: - description: Source Repository URL name: git-url @@ -108,22 +122,6 @@ spec: default: docker type: string description: The format for the resulting image's mediaType. Valid values are oci or docker. - - name: source-date-epoch - type: string - default: '' - description: Sets the image created time and the SOURCE_DATE_EPOCH build argument. On its own, it does not change file timestamps inside the layers (set rewrite-timestamp to "true" for that). Leave empty to keep the actual build time. - - name: rewrite-timestamp - type: string - default: 'false' - description: When "true", clamp file modification times in the image layers to at most source-date-epoch. Does nothing unless source-date-epoch is set. - - name: omit-history - type: string - default: 'false' - description: When "true", omit the build history (history timestamps, layer metadata, etc.) from the resulting image. - - name: enable-package-registry-proxy - default: 'true' - description: Use the package registry proxy when prefetching dependencies - type: string results: - description: "" name: IMAGE_URL @@ -144,7 +142,7 @@ spec: - name: name value: init - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-init:0.4.3@sha256:5f687152ab0661f84830877de93a8ec45cb0b756f71b24ac55133d03a4007936 + value: quay.io/konflux-ci/tekton-catalog/task-init:0.4@sha256:288f3106118edc1d0f0c79a89c960abf5841a4dd8bc3f38feb10527253105b19 - name: kind value: task resolver: bundles @@ -165,7 +163,7 @@ spec: - name: name value: git-clone-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.2.6@sha256:3bcd4c39a346d29617013f4c47d245d38f020cdbf814cf3ce095911c528f5003 + value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.1@sha256:2c388d28651457db60bb90287e7d8c3680303197196e4476878d98d81e8b6dc9 - name: kind value: task resolver: bundles @@ -182,8 +180,6 @@ spec: value: $(params.output-image).prefetch - name: ociArtifactExpiresAfter value: $(params.image-expires-after) - - name: enable-package-registry-proxy - value: $(params.enable-package-registry-proxy) runAfter: - clone-repository taskRef: @@ -191,7 +187,7 @@ spec: - name: name value: prefetch-dependencies-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.10.1@sha256:c09c1c3ced67fb8740b2925a7de09c0810d4e8c8f148d41c21ffe37810d85c62 + value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.3@sha256:2229dbc5e15acc0a6d8aec526465aeb0ad54e269c311ac3d0aba88013845e308 - name: kind value: task resolver: bundles @@ -236,12 +232,6 @@ spec: value: "true" - name: BUILDAH_FORMAT value: $(params.buildah-format) - - name: SOURCE_DATE_EPOCH - value: $(params.source-date-epoch) - - name: REWRITE_TIMESTAMP - value: $(params.rewrite-timestamp) - - name: OMIT_HISTORY - value: $(params.omit-history) runAfter: - prefetch-dependencies taskRef: @@ -249,7 +239,7 @@ spec: - name: name value: buildah-remote-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-buildah-remote-oci-ta:0.12.0@sha256:44c1ca2e823f006ee94e066231b033b191f0f8cee51add1e908138335eba9b30 + value: quay.io/konflux-ci/tekton-catalog/task-buildah-remote-oci-ta:0.9@sha256:a9ca472e297388d6ef8d1f51ee205abee6076aed7c5356ec0df84f14a2e78ad8 - name: kind value: task resolver: bundles @@ -257,6 +247,10 @@ spec: params: - name: IMAGE value: $(params.output-image) + - name: COMMIT_SHA + value: $(tasks.clone-repository.results.commit) + - name: IMAGE_EXPIRES_AFTER + value: $(params.image-expires-after) - name: ALWAYS_BUILD_INDEX value: $(params.build-image-index) - name: IMAGES @@ -271,7 +265,7 @@ spec: - name: name value: build-image-index - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.3.1@sha256:c2cda69e681c976dd5b39caf6682d1c8f8c5e5a53a67a22a5b06d4cde773bd10 + value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.2@sha256:c7b0f7e1f743040d99a3532abbdfddc9484f80fd559a75171c97499c3eb5d163 - name: kind value: task resolver: bundles @@ -292,7 +286,7 @@ spec: - name: name value: source-build-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:6bb2697f8f194a6a644b8b861489ce8b1c5ba16a7d55dbd8e66a0c98d06dfc1c + value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:362f0475df00e7dfb5f15dea0481d1b68b287f60411718d70a23da3c059a5613 - name: kind value: task resolver: bundles @@ -314,7 +308,7 @@ spec: - name: name value: deprecated-image-check - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.5@sha256:0ccc688a77e9b7b0b8973c132a1e840844137e77f887be4a0bec8893b0776872 + value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.5@sha256:5ff16b7e6b4a8aa1adb352e74b9f831f77ff97bafd1b89ddb0038d63335f1a67 - name: kind value: task resolver: bundles @@ -341,7 +335,7 @@ spec: - name: name value: clair-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-clair-scan:0.4.0@sha256:dcc6ca58d3ec03d05ce21c03b4f51b58cac9878caa932ad06a9fdf4bc422aaab + value: quay.io/konflux-ci/tekton-catalog/task-clair-scan:0.3@sha256:3fa03be0280f33d7070ea53f26d53e727199737a7a2b9a59a95071ae40a999ac - name: kind value: task resolver: bundles @@ -361,7 +355,7 @@ spec: - name: name value: ecosystem-cert-preflight-checks - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:4619769705d4999e129b779d7699d89d33c47f7ab80d73ad6e3dcd8a6a4e43a7 + value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:b4ac586edea81dcd25dfc17f1bd57899825be2b443e48d572cd05ce058f153bb - name: kind value: task resolver: bundles @@ -389,7 +383,7 @@ spec: - name: name value: sast-snyk-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-snyk-check-oci-ta:0.5@sha256:b78e9c05c5126613eddee53f2f3534a9b86bfca17d903599f2fa465b7938e241 + value: quay.io/konflux-ci/tekton-catalog/task-sast-snyk-check-oci-ta:0.4@sha256:d83becbfefe2aa39971c3d37bdc23489b745e22fd86cf4872455a133f8cb274f - name: kind value: task resolver: bundles @@ -411,7 +405,7 @@ spec: - name: name value: clamav-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.3.1@sha256:53a02326bfb930ca5ef6bfa7a33acca833d57752f34f3cb79255fe2e25e7d217 + value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.3@sha256:9f18b216ce71a66909e7cb17d9b34526c02d73cf12884ba32d1f10614f7b9f5a - name: kind value: task resolver: bundles @@ -437,7 +431,7 @@ spec: - name: name value: sast-shell-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:beb05ae2fad733783b3b17e05871e0eaf527a07c904cf3fb2cb551025007eec1 + value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:6f047f52c04ee6e4d2cb25af46e3ea92b235f6c5e02da540fb7ef0b90718bc0a - name: kind value: task resolver: bundles @@ -463,7 +457,7 @@ spec: - name: name value: sast-unicode-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.4@sha256:d09f717cb84f0699a531773bc498745deef2c006a81918aa73b3be6d2f4778bd + value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.4@sha256:55006815522c57c1f83451dc0cba723ff7427dbac48553538b75cda7bf886d79 - name: kind value: task resolver: bundles @@ -488,7 +482,7 @@ spec: - name: name value: apply-tags - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-apply-tags:0.3@sha256:2dae3c4beaf1070db565c536bc997e93925ae8c0c45dd8da9b4ae5293fd8c592 + value: quay.io/konflux-ci/tekton-catalog/task-apply-tags:0.3@sha256:aa62b41861c09e2e59c69cc6e9a1f740bf0c81e6a1eb03f57f59dfda0f65840e - name: kind value: task resolver: bundles @@ -511,7 +505,7 @@ spec: - name: name value: push-dockerfile-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.3.1@sha256:393b4d0b530c2657b3ff6fec714781f4938b95b699dea2b369442b7664e1cce2 + value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.3@sha256:1bc2d0f26b89259db090a47bb38217c82c05e335d626653d184adf1d196ca131 - name: kind value: task resolver: bundles @@ -528,7 +522,7 @@ spec: - name: name value: rpms-signature-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-rpms-signature-scan:0.2.1@sha256:538a853c4a299216c43258ccc9894215f5440dc0c70c9c99fe22fc9633a8e79d + value: quay.io/konflux-ci/tekton-catalog/task-rpms-signature-scan:0.2@sha256:3d48fa2fcc898bae9ce730a71789c34758a767b44bc36fd24938779deef4ee96 - name: kind value: task resolver: bundles diff --git a/.tekton/compliance-operator-openscap-dev-pull-request.yaml b/.tekton/compliance-operator-openscap-dev-pull-request.yaml index 240555cff9..d50d7b8f77 100644 --- a/.tekton/compliance-operator-openscap-dev-pull-request.yaml +++ b/.tekton/compliance-operator-openscap-dev-pull-request.yaml @@ -115,22 +115,6 @@ spec: default: docker type: string description: The format for the resulting image's mediaType. Valid values are oci or docker. - - name: source-date-epoch - type: string - default: '' - description: Sets the image created time and the SOURCE_DATE_EPOCH build argument. On its own, it does not change file timestamps inside the layers (set rewrite-timestamp to "true" for that). Leave empty to keep the actual build time. - - name: rewrite-timestamp - type: string - default: 'false' - description: When "true", clamp file modification times in the image layers to at most source-date-epoch. Does nothing unless source-date-epoch is set. - - name: omit-history - type: string - default: 'false' - description: When "true", omit the build history (history timestamps, layer metadata, etc.) from the resulting image. - - name: enable-package-registry-proxy - default: 'true' - description: Use the package registry proxy when prefetching dependencies - type: string results: - description: "" name: IMAGE_URL @@ -151,7 +135,7 @@ spec: - name: name value: init - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-init:0.4.3@sha256:5f687152ab0661f84830877de93a8ec45cb0b756f71b24ac55133d03a4007936 + value: quay.io/konflux-ci/tekton-catalog/task-init:0.4@sha256:288f3106118edc1d0f0c79a89c960abf5841a4dd8bc3f38feb10527253105b19 - name: kind value: task resolver: bundles @@ -172,7 +156,7 @@ spec: - name: name value: git-clone-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.2.6@sha256:3bcd4c39a346d29617013f4c47d245d38f020cdbf814cf3ce095911c528f5003 + value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.1@sha256:2c388d28651457db60bb90287e7d8c3680303197196e4476878d98d81e8b6dc9 - name: kind value: task resolver: bundles @@ -189,8 +173,6 @@ spec: value: $(params.output-image).prefetch - name: ociArtifactExpiresAfter value: $(params.image-expires-after) - - name: enable-package-registry-proxy - value: $(params.enable-package-registry-proxy) runAfter: - clone-repository taskRef: @@ -198,7 +180,7 @@ spec: - name: name value: prefetch-dependencies-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.10.1@sha256:c09c1c3ced67fb8740b2925a7de09c0810d4e8c8f148d41c21ffe37810d85c62 + value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.3@sha256:2229dbc5e15acc0a6d8aec526465aeb0ad54e269c311ac3d0aba88013845e308 - name: kind value: task resolver: bundles @@ -245,12 +227,6 @@ spec: value: "true" - name: BUILDAH_FORMAT value: $(params.buildah-format) - - name: SOURCE_DATE_EPOCH - value: $(params.source-date-epoch) - - name: REWRITE_TIMESTAMP - value: $(params.rewrite-timestamp) - - name: OMIT_HISTORY - value: $(params.omit-history) runAfter: - prefetch-dependencies taskRef: @@ -258,7 +234,7 @@ spec: - name: name value: buildah-remote-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-buildah-remote-oci-ta:0.12.0@sha256:44c1ca2e823f006ee94e066231b033b191f0f8cee51add1e908138335eba9b30 + value: quay.io/konflux-ci/tekton-catalog/task-buildah-remote-oci-ta:0.9@sha256:a9ca472e297388d6ef8d1f51ee205abee6076aed7c5356ec0df84f14a2e78ad8 - name: kind value: task resolver: bundles @@ -266,6 +242,10 @@ spec: params: - name: IMAGE value: $(params.output-image) + - name: COMMIT_SHA + value: $(tasks.clone-repository.results.commit) + - name: IMAGE_EXPIRES_AFTER + value: $(params.image-expires-after) - name: ALWAYS_BUILD_INDEX value: $(params.build-image-index) - name: IMAGES @@ -280,7 +260,7 @@ spec: - name: name value: build-image-index - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.3.1@sha256:c2cda69e681c976dd5b39caf6682d1c8f8c5e5a53a67a22a5b06d4cde773bd10 + value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.2@sha256:c7b0f7e1f743040d99a3532abbdfddc9484f80fd559a75171c97499c3eb5d163 - name: kind value: task resolver: bundles @@ -301,7 +281,7 @@ spec: - name: name value: source-build-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:6bb2697f8f194a6a644b8b861489ce8b1c5ba16a7d55dbd8e66a0c98d06dfc1c + value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:362f0475df00e7dfb5f15dea0481d1b68b287f60411718d70a23da3c059a5613 - name: kind value: task resolver: bundles @@ -323,7 +303,7 @@ spec: - name: name value: deprecated-image-check - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.5@sha256:0ccc688a77e9b7b0b8973c132a1e840844137e77f887be4a0bec8893b0776872 + value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.5@sha256:5ff16b7e6b4a8aa1adb352e74b9f831f77ff97bafd1b89ddb0038d63335f1a67 - name: kind value: task resolver: bundles @@ -350,7 +330,7 @@ spec: - name: name value: clair-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-clair-scan:0.4.0@sha256:dcc6ca58d3ec03d05ce21c03b4f51b58cac9878caa932ad06a9fdf4bc422aaab + value: quay.io/konflux-ci/tekton-catalog/task-clair-scan:0.3@sha256:3fa03be0280f33d7070ea53f26d53e727199737a7a2b9a59a95071ae40a999ac - name: kind value: task resolver: bundles @@ -375,7 +355,7 @@ spec: - name: name value: ecosystem-cert-preflight-checks - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:4619769705d4999e129b779d7699d89d33c47f7ab80d73ad6e3dcd8a6a4e43a7 + value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:b4ac586edea81dcd25dfc17f1bd57899825be2b443e48d572cd05ce058f153bb - name: kind value: task resolver: bundles @@ -401,7 +381,7 @@ spec: - name: name value: sast-snyk-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-snyk-check-oci-ta:0.5@sha256:b78e9c05c5126613eddee53f2f3534a9b86bfca17d903599f2fa465b7938e241 + value: quay.io/konflux-ci/tekton-catalog/task-sast-snyk-check-oci-ta:0.4@sha256:d83becbfefe2aa39971c3d37bdc23489b745e22fd86cf4872455a133f8cb274f - name: kind value: task resolver: bundles @@ -428,7 +408,7 @@ spec: - name: name value: clamav-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.3.1@sha256:53a02326bfb930ca5ef6bfa7a33acca833d57752f34f3cb79255fe2e25e7d217 + value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.3@sha256:9f18b216ce71a66909e7cb17d9b34526c02d73cf12884ba32d1f10614f7b9f5a - name: kind value: task resolver: bundles @@ -454,7 +434,7 @@ spec: - name: name value: sast-shell-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:beb05ae2fad733783b3b17e05871e0eaf527a07c904cf3fb2cb551025007eec1 + value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:6f047f52c04ee6e4d2cb25af46e3ea92b235f6c5e02da540fb7ef0b90718bc0a - name: kind value: task resolver: bundles @@ -480,7 +460,7 @@ spec: - name: name value: sast-unicode-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.4@sha256:d09f717cb84f0699a531773bc498745deef2c006a81918aa73b3be6d2f4778bd + value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.4@sha256:55006815522c57c1f83451dc0cba723ff7427dbac48553538b75cda7bf886d79 - name: kind value: task resolver: bundles @@ -502,7 +482,7 @@ spec: - name: name value: apply-tags - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-apply-tags:0.3@sha256:2dae3c4beaf1070db565c536bc997e93925ae8c0c45dd8da9b4ae5293fd8c592 + value: quay.io/konflux-ci/tekton-catalog/task-apply-tags:0.3@sha256:aa62b41861c09e2e59c69cc6e9a1f740bf0c81e6a1eb03f57f59dfda0f65840e - name: kind value: task resolver: bundles @@ -525,7 +505,7 @@ spec: - name: name value: push-dockerfile-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.3.1@sha256:393b4d0b530c2657b3ff6fec714781f4938b95b699dea2b369442b7664e1cce2 + value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.3@sha256:1bc2d0f26b89259db090a47bb38217c82c05e335d626653d184adf1d196ca131 - name: kind value: task resolver: bundles @@ -542,7 +522,7 @@ spec: - name: name value: rpms-signature-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-rpms-signature-scan:0.2.1@sha256:538a853c4a299216c43258ccc9894215f5440dc0c70c9c99fe22fc9633a8e79d + value: quay.io/konflux-ci/tekton-catalog/task-rpms-signature-scan:0.2@sha256:3d48fa2fcc898bae9ce730a71789c34758a767b44bc36fd24938779deef4ee96 - name: kind value: task resolver: bundles diff --git a/.tekton/compliance-operator-openscap-dev-push.yaml b/.tekton/compliance-operator-openscap-dev-push.yaml index f8b9bfa188..716ae2f77b 100644 --- a/.tekton/compliance-operator-openscap-dev-push.yaml +++ b/.tekton/compliance-operator-openscap-dev-push.yaml @@ -113,22 +113,6 @@ spec: default: docker type: string description: The format for the resulting image's mediaType. Valid values are oci or docker. - - name: source-date-epoch - type: string - default: '' - description: Sets the image created time and the SOURCE_DATE_EPOCH build argument. On its own, it does not change file timestamps inside the layers (set rewrite-timestamp to "true" for that). Leave empty to keep the actual build time. - - name: rewrite-timestamp - type: string - default: 'false' - description: When "true", clamp file modification times in the image layers to at most source-date-epoch. Does nothing unless source-date-epoch is set. - - name: omit-history - type: string - default: 'false' - description: When "true", omit the build history (history timestamps, layer metadata, etc.) from the resulting image. - - name: enable-package-registry-proxy - default: 'true' - description: Use the package registry proxy when prefetching dependencies - type: string results: - description: "" name: IMAGE_URL @@ -149,7 +133,7 @@ spec: - name: name value: init - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-init:0.4.3@sha256:5f687152ab0661f84830877de93a8ec45cb0b756f71b24ac55133d03a4007936 + value: quay.io/konflux-ci/tekton-catalog/task-init:0.4@sha256:288f3106118edc1d0f0c79a89c960abf5841a4dd8bc3f38feb10527253105b19 - name: kind value: task resolver: bundles @@ -170,7 +154,7 @@ spec: - name: name value: git-clone-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.2.6@sha256:3bcd4c39a346d29617013f4c47d245d38f020cdbf814cf3ce095911c528f5003 + value: quay.io/konflux-ci/tekton-catalog/task-git-clone-oci-ta:0.1@sha256:2c388d28651457db60bb90287e7d8c3680303197196e4476878d98d81e8b6dc9 - name: kind value: task resolver: bundles @@ -187,8 +171,6 @@ spec: value: $(params.output-image).prefetch - name: ociArtifactExpiresAfter value: $(params.image-expires-after) - - name: enable-package-registry-proxy - value: $(params.enable-package-registry-proxy) runAfter: - clone-repository taskRef: @@ -196,7 +178,7 @@ spec: - name: name value: prefetch-dependencies-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.10.1@sha256:c09c1c3ced67fb8740b2925a7de09c0810d4e8c8f148d41c21ffe37810d85c62 + value: quay.io/konflux-ci/tekton-catalog/task-prefetch-dependencies-oci-ta:0.3@sha256:2229dbc5e15acc0a6d8aec526465aeb0ad54e269c311ac3d0aba88013845e308 - name: kind value: task resolver: bundles @@ -243,12 +225,6 @@ spec: value: "true" - name: BUILDAH_FORMAT value: $(params.buildah-format) - - name: SOURCE_DATE_EPOCH - value: $(params.source-date-epoch) - - name: REWRITE_TIMESTAMP - value: $(params.rewrite-timestamp) - - name: OMIT_HISTORY - value: $(params.omit-history) runAfter: - prefetch-dependencies taskRef: @@ -256,7 +232,7 @@ spec: - name: name value: buildah-remote-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-buildah-remote-oci-ta:0.12.0@sha256:44c1ca2e823f006ee94e066231b033b191f0f8cee51add1e908138335eba9b30 + value: quay.io/konflux-ci/tekton-catalog/task-buildah-remote-oci-ta:0.9@sha256:a9ca472e297388d6ef8d1f51ee205abee6076aed7c5356ec0df84f14a2e78ad8 - name: kind value: task resolver: bundles @@ -264,6 +240,10 @@ spec: params: - name: IMAGE value: $(params.output-image) + - name: COMMIT_SHA + value: $(tasks.clone-repository.results.commit) + - name: IMAGE_EXPIRES_AFTER + value: $(params.image-expires-after) - name: ALWAYS_BUILD_INDEX value: $(params.build-image-index) - name: IMAGES @@ -278,7 +258,7 @@ spec: - name: name value: build-image-index - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.3.1@sha256:c2cda69e681c976dd5b39caf6682d1c8f8c5e5a53a67a22a5b06d4cde773bd10 + value: quay.io/konflux-ci/tekton-catalog/task-build-image-index:0.2@sha256:c7b0f7e1f743040d99a3532abbdfddc9484f80fd559a75171c97499c3eb5d163 - name: kind value: task resolver: bundles @@ -299,7 +279,7 @@ spec: - name: name value: source-build-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:6bb2697f8f194a6a644b8b861489ce8b1c5ba16a7d55dbd8e66a0c98d06dfc1c + value: quay.io/konflux-ci/tekton-catalog/task-source-build-oci-ta:0.3@sha256:362f0475df00e7dfb5f15dea0481d1b68b287f60411718d70a23da3c059a5613 - name: kind value: task resolver: bundles @@ -321,7 +301,7 @@ spec: - name: name value: deprecated-image-check - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.5@sha256:0ccc688a77e9b7b0b8973c132a1e840844137e77f887be4a0bec8893b0776872 + value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.5@sha256:5ff16b7e6b4a8aa1adb352e74b9f831f77ff97bafd1b89ddb0038d63335f1a67 - name: kind value: task resolver: bundles @@ -348,7 +328,7 @@ spec: - name: name value: clair-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-clair-scan:0.4.0@sha256:dcc6ca58d3ec03d05ce21c03b4f51b58cac9878caa932ad06a9fdf4bc422aaab + value: quay.io/konflux-ci/tekton-catalog/task-clair-scan:0.3@sha256:3fa03be0280f33d7070ea53f26d53e727199737a7a2b9a59a95071ae40a999ac - name: kind value: task resolver: bundles @@ -373,7 +353,7 @@ spec: - name: name value: ecosystem-cert-preflight-checks - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:4619769705d4999e129b779d7699d89d33c47f7ab80d73ad6e3dcd8a6a4e43a7 + value: quay.io/konflux-ci/tekton-catalog/task-ecosystem-cert-preflight-checks:0.2@sha256:b4ac586edea81dcd25dfc17f1bd57899825be2b443e48d572cd05ce058f153bb - name: kind value: task resolver: bundles @@ -399,7 +379,7 @@ spec: - name: name value: sast-snyk-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-snyk-check-oci-ta:0.5@sha256:b78e9c05c5126613eddee53f2f3534a9b86bfca17d903599f2fa465b7938e241 + value: quay.io/konflux-ci/tekton-catalog/task-sast-snyk-check-oci-ta:0.4@sha256:d83becbfefe2aa39971c3d37bdc23489b745e22fd86cf4872455a133f8cb274f - name: kind value: task resolver: bundles @@ -426,7 +406,7 @@ spec: - name: name value: clamav-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.3.1@sha256:53a02326bfb930ca5ef6bfa7a33acca833d57752f34f3cb79255fe2e25e7d217 + value: quay.io/konflux-ci/tekton-catalog/task-clamav-scan:0.3@sha256:9f18b216ce71a66909e7cb17d9b34526c02d73cf12884ba32d1f10614f7b9f5a - name: kind value: task resolver: bundles @@ -452,7 +432,7 @@ spec: - name: name value: sast-shell-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:beb05ae2fad733783b3b17e05871e0eaf527a07c904cf3fb2cb551025007eec1 + value: quay.io/konflux-ci/tekton-catalog/task-sast-shell-check-oci-ta:0.1@sha256:6f047f52c04ee6e4d2cb25af46e3ea92b235f6c5e02da540fb7ef0b90718bc0a - name: kind value: task resolver: bundles @@ -478,7 +458,7 @@ spec: - name: name value: sast-unicode-check-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.4@sha256:d09f717cb84f0699a531773bc498745deef2c006a81918aa73b3be6d2f4778bd + value: quay.io/konflux-ci/tekton-catalog/task-sast-unicode-check-oci-ta:0.4@sha256:55006815522c57c1f83451dc0cba723ff7427dbac48553538b75cda7bf886d79 - name: kind value: task resolver: bundles @@ -493,9 +473,6 @@ spec: value: $(tasks.build-image-index.results.IMAGE_URL) - name: IMAGE_DIGEST value: $(tasks.build-image-index.results.IMAGE_DIGEST) - - name: ADDITIONAL_TAGS - value: - - '{{ target_branch }}' runAfter: - build-image-index taskRef: @@ -503,7 +480,7 @@ spec: - name: name value: apply-tags - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-apply-tags:0.3@sha256:2dae3c4beaf1070db565c536bc997e93925ae8c0c45dd8da9b4ae5293fd8c592 + value: quay.io/konflux-ci/tekton-catalog/task-apply-tags:0.3@sha256:aa62b41861c09e2e59c69cc6e9a1f740bf0c81e6a1eb03f57f59dfda0f65840e - name: kind value: task resolver: bundles @@ -526,7 +503,7 @@ spec: - name: name value: push-dockerfile-oci-ta - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.3.1@sha256:393b4d0b530c2657b3ff6fec714781f4938b95b699dea2b369442b7664e1cce2 + value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.3@sha256:1bc2d0f26b89259db090a47bb38217c82c05e335d626653d184adf1d196ca131 - name: kind value: task resolver: bundles @@ -543,7 +520,7 @@ spec: - name: name value: rpms-signature-scan - name: bundle - value: quay.io/konflux-ci/tekton-catalog/task-rpms-signature-scan:0.2.1@sha256:538a853c4a299216c43258ccc9894215f5440dc0c70c9c99fe22fc9633a8e79d + value: quay.io/konflux-ci/tekton-catalog/task-rpms-signature-scan:0.2@sha256:3d48fa2fcc898bae9ce730a71789c34758a767b44bc36fd24938779deef4ee96 - name: kind value: task resolver: bundles diff --git a/CHANGELOG.md b/CHANGELOG.md index da2f6f3673..b68e930901 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -726,7 +726,7 @@ allow for smoother upgrades. `deploy/eks.yaml` file conflicted with various development and build tools that assumed a single Deployment resource in the `deploy/` directory. Please use the Helm chart for - [deploying](https://github.com/openshift/compliance-operator/blob/master/doc/install.md#deploying-with-helm) + [deploying](https://github.com/ComplianceAsCode/compliance-operator/blob/master/doc/install.md#deploying-with-helm) the operator on AWS EKS. @@ -752,10 +752,10 @@ allow for smoother upgrades. compliance content, better enabling operator usage in Hypershift deployments. - You can now install the operator using a Helm chart. This includes support for deploying on OpenShift and AWS EKS. Please see the - [documentation](https://github.com/openshift/compliance-operator/#deploying-with-helm) + [documentation](https://github.com/ComplianceAsCode/compliance-operator/#deploying-with-helm) on how to deploy the operator using Helm. - Introduced a process and guidelines for writing release notes - ([documentation](https://github.com/openshift/compliance-operator/#writing-release-notes)) + ([documentation](https://github.com/ComplianceAsCode/compliance-operator/#writing-release-notes)) ### Fixes diff --git a/Dockerfile.ci b/Dockerfile.ci index 2d2695d68f..0a0bbffc64 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -1,7 +1,7 @@ # Step one: build compliance-operator FROM registry.ci.openshift.org/openshift/release:rhel-9-release-golang-1.25-openshift-4.22 AS builder -WORKDIR /go/src/github.com/openshift/compliance-operator +WORKDIR /go/src/github.com/ComplianceAsCode/compliance-operator ENV GOFLAGS=-mod=vendor @@ -15,7 +15,7 @@ FROM registry.redhat.io/ubi9/ubi-minimal-pqc:latest ENV OPERATOR=/usr/local/bin/compliance-operator # install operator binary -COPY --from=builder /go/src/github.com/openshift/compliance-operator/build/_output/bin/compliance-operator ${OPERATOR} +COPY --from=builder /go/src/github.com/ComplianceAsCode/compliance-operator/build/_output/bin/compliance-operator ${OPERATOR} COPY build/bin/entrypoint /usr/local/bin/entrypoint diff --git a/build/Dockerfile b/build/Dockerfile index a91ee5fb4e..652363236b 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,7 +1,7 @@ # Step one: build compliance-operator -FROM golang:1.25.11 AS builder +FROM golang:1.25.8 AS builder -WORKDIR /go/src/github.com/openshift/compliance-operator +WORKDIR /go/src/github.com/ComplianceAsCode/compliance-operator ENV GOFLAGS=-mod=vendor @@ -26,7 +26,7 @@ FROM registry.access.redhat.com/ubi9/ubi-micro:latest ENV OPERATOR=/usr/local/bin/compliance-operator # install operator binary -COPY --from=builder /go/src/github.com/openshift/compliance-operator/build/_output/bin/compliance-operator ${OPERATOR} +COPY --from=builder /go/src/github.com/ComplianceAsCode/compliance-operator/build/_output/bin/compliance-operator ${OPERATOR} COPY build/bin/entrypoint /usr/local/bin/entrypoint diff --git a/cmd/manager/cel-scanner.go b/cmd/manager/cel-scanner.go index 8a2a65defe..bc7a856f73 100644 --- a/cmd/manager/cel-scanner.go +++ b/cmd/manager/cel-scanner.go @@ -348,41 +348,11 @@ func (c *CelScanner) runPlatformScan() { celVariables = append(celVariables, celVar) } - // Convert SDK results to compliance operator results - evalResultList := []*cmpv1alpha1.ComplianceCheckResult{} - // Cache custom metadata per result so we can merge it with the same - // precedence logic the SCAP/aggregator path uses (operator keys win). - type customMeta struct { - labels map[string]string - annotations map[string]string - } - customMetadataByName := make(map[string]customMeta) - - // Build SDK rule list; produce MANUAL results directly for rules without expressions + // Build SDK rule list, skipping rules with empty expressions sdkRules := make([]scanner.Rule, 0, len(selectedRules)) for _, rw := range selectedRules { if rw.payload.Expression == "" { - // Manual rule — produce CheckResultManual directly, bypass SDK scanner - checkResultName := fmt.Sprintf("%s-%s", c.celConfig.ScanName, utils.IDToDNSFriendlyName(rw.payload.ID)) - cl, ca := utils.GetCustomMetadata(rw.labels, rw.annotations) - customMetadataByName[checkResultName] = customMeta{labels: cl, annotations: ca} - evalResultList = append(evalResultList, &cmpv1alpha1.ComplianceCheckResult{ - TypeMeta: metav1.TypeMeta{ - APIVersion: "compliance.openshift.io/v1alpha1", - Kind: "ComplianceCheckResult", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: checkResultName, - Namespace: c.celConfig.NameSpace, - }, - ID: rw.payload.ID, - Description: rw.payload.Description, - Rationale: rw.payload.Rationale, - Severity: cmpv1alpha1.ComplianceCheckResultSeverity(rw.payload.Severity), - Instructions: rw.payload.Instructions, - Status: cmpv1alpha1.CheckResultManual, - }) - cmdLog.Info("Manual rule — no CEL expression, result is MANUAL", "rule", rw.scannerRule.Identifier()) + cmdLog.Info("Warning: Skipping rule with empty expression", "rule", rw.scannerRule.Identifier()) continue } sdkRules = append(sdkRules, rw.scannerRule) @@ -410,6 +380,16 @@ func (c *CelScanner) runPlatformScan() { for i := range selectedRules { ruleByID[selectedRules[i].scannerRule.Identifier()] = &selectedRules[i] } + + // Convert SDK results to compliance operator results + evalResultList := []*cmpv1alpha1.ComplianceCheckResult{} + // Cache custom metadata per result so we can merge it with the same + // precedence logic the SCAP/aggregator path uses (operator keys win). + type customMeta struct { + labels map[string]string + annotations map[string]string + } + customMetadataByName := make(map[string]customMeta) for _, result := range checkResults { rw, found := ruleByID[result.ID] if !found { @@ -757,8 +737,7 @@ func (c *CelScanner) getCELRulesFromProfile(profileName, namespace string) ([]ce // validateCELRulePayload validates that a RulePayload has the required CEL fields. func (c *CelScanner) validateCELRulePayload(name string, payload *cmpv1alpha1.RulePayload) error { if payload.Expression == "" { - cmdLog.Info("Rule has no CEL expression, treating as manual rule", "rule", name) - return nil + return fmt.Errorf("CEL expression is empty") } if len(payload.Inputs) == 0 { diff --git a/cmd/manager/cel_scanner_test.go b/cmd/manager/cel_scanner_test.go index 9a287fc6b8..89f17bb5b5 100644 --- a/cmd/manager/cel_scanner_test.go +++ b/cmd/manager/cel_scanner_test.go @@ -114,30 +114,35 @@ var _ = Describe("getCELRulesFromProfile", func() { Expect(err.Error()).To(ContainSubstring("not found")) }) - It("accepts CEL rule with empty expression as manual rule", func() { + It("returns error for CEL rule with empty expression", func() { scheme := newTestScheme() profile := &cmpv1alpha1.Profile{ ObjectMeta: metav1.ObjectMeta{Name: "prof", Namespace: "ns"}, ProfilePayload: cmpv1alpha1.ProfilePayload{ - Rules: []cmpv1alpha1.ProfileRule{"manual-rule"}, + Rules: []cmpv1alpha1.ProfileRule{"bad-rule"}, }, } - manualRule := &cmpv1alpha1.Rule{ - ObjectMeta: metav1.ObjectMeta{Name: "manual-rule", Namespace: "ns"}, + badRule := &cmpv1alpha1.Rule{ + ObjectMeta: metav1.ObjectMeta{Name: "bad-rule", Namespace: "ns"}, RulePayload: cmpv1alpha1.RulePayload{ - ID: "manual-rule", + ID: "bad-rule", ScannerType: cmpv1alpha1.ScannerTypeCEL, Expression: "", - Inputs: nil, + Inputs: []cmpv1alpha1.InputPayload{{ + Name: "pods", + KubernetesInputSpec: cmpv1alpha1.KubernetesInputSpec{ + APIVersion: "v1", Resource: "pods", + }, + }}, }, } client := fake.NewClientBuilder().WithScheme(scheme). - WithObjects(profile, manualRule).Build() + WithObjects(profile, badRule).Build() cs = &CelScanner{client: client, scheme: scheme} - rules, err := cs.getCELRulesFromProfile("prof", "ns") - Expect(err).NotTo(HaveOccurred()) - Expect(rules).To(HaveLen(1)) + _, err := cs.getCELRulesFromProfile("prof", "ns") + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(ContainSubstring("invalid Rule")) }) It("returns empty slice when profile has only non-CEL rules", func() { @@ -267,7 +272,7 @@ var _ = Describe("validateCELRulePayload", func() { Expect(cs.validateCELRulePayload("test", payload)).To(Succeed()) }) - It("accepts empty expression as manual rule", func() { + It("rejects empty expression", func() { payload := &cmpv1alpha1.RulePayload{ Expression: "", Inputs: []cmpv1alpha1.InputPayload{{ @@ -278,7 +283,8 @@ var _ = Describe("validateCELRulePayload", func() { }}, } err := cs.validateCELRulePayload("test", payload) - Expect(err).NotTo(HaveOccurred()) + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(ContainSubstring("expression is empty")) }) It("rejects no inputs", func() { diff --git a/coverage-baseline.txt b/coverage-baseline.txt index cdc77c6f4a..4cc3cde3f3 100644 --- a/coverage-baseline.txt +++ b/coverage-baseline.txt @@ -4,7 +4,7 @@ github.com/ComplianceAsCode/compliance-operator/cmd/celctl 45.6 github.com/ComplianceAsCode/compliance-operator/cmd/manager 24.4 github.com/ComplianceAsCode/compliance-operator/pkg/apis/compliance/v1alpha1 7.5 -github.com/ComplianceAsCode/compliance-operator/pkg/celcontent 84.0 +github.com/ComplianceAsCode/compliance-operator/pkg/celcontent 83.3 github.com/ComplianceAsCode/compliance-operator/pkg/controller/common 33.7 github.com/ComplianceAsCode/compliance-operator/pkg/controller/complianceremediation 53.2 github.com/ComplianceAsCode/compliance-operator/pkg/controller/compliancescan 43.8 @@ -14,7 +14,7 @@ github.com/ComplianceAsCode/compliance-operator/pkg/controller/metrics 62.2 github.com/ComplianceAsCode/compliance-operator/pkg/controller/profilebundle 14.5 github.com/ComplianceAsCode/compliance-operator/pkg/controller/scansettingbinding 53.6 github.com/ComplianceAsCode/compliance-operator/pkg/controller/tailoredprofile 59.5 -github.com/ComplianceAsCode/compliance-operator/pkg/profileparser 78.2 +github.com/ComplianceAsCode/compliance-operator/pkg/profileparser 78.1 github.com/ComplianceAsCode/compliance-operator/pkg/utils 67.5 github.com/ComplianceAsCode/compliance-operator/pkg/utils/celvalidation 100.0 github.com/ComplianceAsCode/compliance-operator/pkg/xccdf 50.0 diff --git a/doc/e2e-tests.md b/doc/e2e-tests.md index 8ed414c57e..43ce8482ad 100644 --- a/doc/e2e-tests.md +++ b/doc/e2e-tests.md @@ -36,7 +36,7 @@ And then, you will need to login and push the built image to your repo, for exam `podman push testcontent quay.io/username/content_repo:testcontent` -[1] https://github.com/openshift/compliance-operator/stargazers +[1] https://github.com/ComplianceAsCode/compliance-operator/stargazers [2] https://complianceascode.readthedocs.io/en/latest/manual/developer/02_building_complianceascode.html#installing-build-dependencies Now we have the content image in a public repository on `quay.io/username/content_repo:testcontent`. diff --git a/doc/tutorials/README.md b/doc/tutorials/README.md index 25363d05ce..91a65e8459 100644 --- a/doc/tutorials/README.md +++ b/doc/tutorials/README.md @@ -2,7 +2,7 @@ Lab - Compliance Operator ========================= This workshop provides an introduction to deploying a the -[compliance-operator](https://github.com/openshift/compliance-operator) +[compliance-operator](https://github.com/ComplianceAsCode/compliance-operator) and using it to evaluate the state of compliance with a benchmark. Agenda diff --git a/doc/tutorials/workshop/content/index.md b/doc/tutorials/workshop/content/index.md index 9a321a8f5f..49fde6d354 100644 --- a/doc/tutorials/workshop/content/index.md +++ b/doc/tutorials/workshop/content/index.md @@ -2,7 +2,7 @@ Introduction ============ This workshop provides an introduction to deploying a the -[compliance-operator](https://github.com/openshift/compliance-operator). +[compliance-operator](https://github.com/ComplianceAsCode/compliance-operator). In this lab we'll use the E8 benchmark. This benchmark was chosen as it's fairly lightweight compared to other benchmarks. diff --git a/doc/usage.md b/doc/usage.md index b9d6e17975..9d4e19ab72 100644 --- a/doc/usage.md +++ b/doc/usage.md @@ -3,7 +3,7 @@ Before starting to use the operator, it's worth checking the descriptions of the different custom resources it introduces. These definitions are in the [following -document](https://github.com/openshift/compliance-operator/blob/master/doc/crds.md). +document](https://github.com/ComplianceAsCode/compliance-operator/blob/master/doc/crds.md). The primary interface for the compliance-operator is the `ComplianceSuite` object, representing a set of scans. The `ComplianceSuite` can be defined either manually or with the help of `ScanSetting` and `ScanSettingBinding` @@ -13,7 +13,7 @@ directly as well, it is not recommended. As part of this guide, it's assumed that you have installed the compliance operator in the `openshift-compliance` namespace. You can find more information about installation methods and directions in the [Installation -Guide](https://github.com/openshift/compliance-operator/blob/master/doc/install.md). +Guide](https://github.com/ComplianceAsCode/compliance-operator/blob/master/doc/install.md). After you've installed the operator, set the `NAMESPACE` environment to the namespace you installed the operator. By default, the operator is installed in diff --git a/go.mod b/go.mod index 07fc4f76e7..d5a78acd94 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/ComplianceAsCode/compliance-operator -go 1.25.11 +go 1.25.8 require ( github.com/ComplianceAsCode/compliance-sdk v0.1.1 @@ -9,8 +9,8 @@ require ( github.com/onsi/gomega v1.39.1 github.com/openshift/api v0.0.0-20260521125114-09730f85d883 github.com/openshift/client-go v0.0.0-20260512113608-deb4dc54551a - k8s.io/apimachinery v0.35.7 - k8s.io/client-go v0.35.7 + k8s.io/apimachinery v0.35.5 + k8s.io/client-go v0.35.5 open-cluster-management.io/api v0.15.0 sigs.k8s.io/controller-runtime v0.23.3 ) @@ -27,19 +27,20 @@ require ( github.com/clipperhouse/uax29/v2 v2.7.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-openapi/swag/cmdutils v0.27.1 // indirect - github.com/go-openapi/swag/conv v0.27.1 // indirect - github.com/go-openapi/swag/fileutils v0.27.1 // indirect - github.com/go-openapi/swag/jsonutils v0.27.1 // indirect - github.com/go-openapi/swag/loading v0.27.1 // indirect - github.com/go-openapi/swag/mangling v0.27.1 // indirect - github.com/go-openapi/swag/netutils v0.27.1 // indirect - github.com/go-openapi/swag/stringutils v0.27.1 // indirect - github.com/go-openapi/swag/typeutils v0.27.1 // indirect - github.com/go-openapi/swag/yamlutils v0.27.1 // indirect + github.com/go-openapi/swag/cmdutils v0.25.5 // indirect + github.com/go-openapi/swag/conv v0.25.5 // indirect + github.com/go-openapi/swag/fileutils v0.25.5 // indirect + github.com/go-openapi/swag/jsonname v0.26.1 // indirect + github.com/go-openapi/swag/jsonutils v0.25.5 // indirect + github.com/go-openapi/swag/loading v0.25.5 // indirect + github.com/go-openapi/swag/mangling v0.25.5 // indirect + github.com/go-openapi/swag/netutils v0.25.5 // indirect + github.com/go-openapi/swag/stringutils v0.25.5 // indirect + github.com/go-openapi/swag/typeutils v0.25.5 // indirect + github.com/go-openapi/swag/yamlutils v0.25.5 // indirect github.com/goccy/go-json v0.10.6 // indirect github.com/google/btree v1.1.3 // indirect - github.com/google/cel-go v0.30.0 // indirect + github.com/google/cel-go v0.26.1 // indirect github.com/google/s2a-go v0.1.9 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.16 // indirect github.com/googleapis/gax-go/v2 v2.20.0 // indirect @@ -49,27 +50,28 @@ require ( github.com/olekukonko/errors v1.2.0 // indirect github.com/olekukonko/ll v0.1.8 // indirect github.com/openai/openai-go/v3 v3.28.0 // indirect + github.com/stoewer/go-strcase v1.3.1 // indirect github.com/tidwall/gjson v1.18.0 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect github.com/tidwall/sjson v1.2.5 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 // indirect - go.opentelemetry.io/otel v1.45.0 // indirect - go.opentelemetry.io/otel/metric v1.45.0 // indirect - go.opentelemetry.io/otel/trace v1.45.0 // indirect + go.opentelemetry.io/otel v1.43.0 // indirect + go.opentelemetry.io/otel/metric v1.43.0 // indirect + go.opentelemetry.io/otel/trace v1.43.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect - golang.org/x/crypto v0.54.0 // indirect + golang.org/x/crypto v0.52.0 // indirect google.golang.org/api v0.272.0 // indirect google.golang.org/genai v1.50.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260608224507-4308a22a1bab // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260608224507-4308a22a1bab // indirect google.golang.org/grpc v1.81.1 // indirect - k8s.io/code-generator v0.35.7 // indirect + k8s.io/code-generator v0.35.5 // indirect k8s.io/gengo/v2 v2.0.0-20260408192533-25e2208e0dc3 // indirect sigs.k8s.io/randfill v1.0.0 // indirect - sigs.k8s.io/structured-merge-diff/v6 v6.4.2 // indirect + sigs.k8s.io/structured-merge-diff/v6 v6.3.2 // indirect ) require ( @@ -84,7 +86,7 @@ require ( github.com/dsnet/compress v0.0.1 github.com/evanphx/json-patch v5.9.11+incompatible // indirect github.com/fsnotify/fsnotify v1.10.1 // indirect - github.com/go-logr/logr v1.4.4 + github.com/go-logr/logr v1.4.3 github.com/go-logr/zapr v1.3.0 github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect github.com/google/go-cmp v0.7.0 @@ -115,27 +117,27 @@ require ( github.com/stretchr/testify v1.11.1 go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.28.0 - golang.org/x/mod v0.38.0 - golang.org/x/net v0.57.0 + golang.org/x/mod v0.36.0 + golang.org/x/net v0.55.0 golang.org/x/oauth2 v0.36.0 // indirect - golang.org/x/sys v0.47.0 // indirect - golang.org/x/term v0.45.0 // indirect - golang.org/x/text v0.40.0 // indirect + golang.org/x/sys v0.45.0 // indirect + golang.org/x/term v0.43.0 // indirect + golang.org/x/text v0.37.0 // indirect golang.org/x/time v0.15.0 // indirect gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect - google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af // indirect + google.golang.org/protobuf v1.36.11 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 - k8s.io/api v0.35.7 - k8s.io/apiextensions-apiserver v0.35.7 - k8s.io/apiserver v0.35.7 - k8s.io/component-base v0.35.7 // indirect + k8s.io/api v0.35.5 + k8s.io/apiextensions-apiserver v0.35.5 + k8s.io/apiserver v0.35.5 + k8s.io/component-base v0.35.5 // indirect k8s.io/klog/v2 v2.140.0 // indirect - k8s.io/kube-openapi v0.0.0-20260721132016-d427ff9ee9ad // indirect - k8s.io/pod-security-admission v0.35.7 - k8s.io/utils v0.0.0-20260707023825-cf1189d6abe3 // indirect + k8s.io/kube-openapi v0.0.0-20260603220949-865597e52e25 // indirect + k8s.io/pod-security-admission v0.35.5 + k8s.io/utils v0.0.0-20260507154919-ff6756f316d2 // indirect sigs.k8s.io/controller-tools v0.20.1 sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect sigs.k8s.io/yaml v1.6.0 @@ -158,10 +160,10 @@ require ( github.com/fatih/color v1.19.0 // indirect github.com/fxamacker/cbor/v2 v2.9.2 // indirect github.com/ghodss/yaml v1.0.1-0.20220118164431-d8423dcdf344 // indirect - github.com/go-openapi/jsonpointer v1.0.0 // indirect - github.com/go-openapi/jsonreference v1.0.0 // indirect - github.com/go-openapi/swag v0.27.1 // indirect - github.com/go-openapi/swag/pools v0.27.1 // indirect + github.com/go-openapi/jsonpointer v0.23.1 // indirect + github.com/go-openapi/jsonreference v0.21.6 // indirect + github.com/go-openapi/swag v0.25.5 // indirect + github.com/go-openapi/testify/enable/yaml/v2 v2.4.1 // indirect github.com/gobuffalo/flect v1.0.3 // indirect github.com/google/gnostic-models v0.7.1 // indirect github.com/gookit/color v1.6.1 // indirect @@ -179,11 +181,11 @@ require ( github.com/x448/float16 v0.8.4 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect go4.org v0.0.0-20260112195520-a5071408f32f // indirect - golang.org/x/exp v0.0.0-20260727155853-b88d891fe743 // indirect - golang.org/x/sync v0.22.0 // indirect - golang.org/x/tools v0.48.0 // indirect + golang.org/x/exp v0.0.0-20260603202125-055de637280b // indirect + golang.org/x/sync v0.20.0 // indirect + golang.org/x/tools v0.45.0 // indirect gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect - k8s.io/kube-aggregator v0.35.7 // indirect - k8s.io/kubectl v0.35.7 // indirect + k8s.io/kube-aggregator v0.35.5 // indirect + k8s.io/kubectl v0.35.5 // indirect sigs.k8s.io/kube-storage-version-migrator v0.0.6-0.20230721195810-5c8923c5ff96 // indirect ) diff --git a/go.sum b/go.sum index 37b4592096..d7bdf99846 100644 --- a/go.sum +++ b/go.sum @@ -104,46 +104,46 @@ github.com/fxamacker/cbor/v2 v2.9.2/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj2 github.com/ghodss/yaml v1.0.1-0.20220118164431-d8423dcdf344 h1:Arcl6UOIS/kgO2nW3A65HN+7CMjSDP/gofXL4CZt1V4= github.com/ghodss/yaml v1.0.1-0.20220118164431-d8423dcdf344/go.mod h1:GIjDIg/heH5DOkXY3YJ/wNhfHsQHoXGjl8G8amsYQ1I= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= -github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= -github.com/go-openapi/jsonpointer v1.0.0 h1:kR9tHqY0CtZaOPVFm622dPVNhrvYpwr4uCxgL3h1H8s= -github.com/go-openapi/jsonpointer v1.0.0/go.mod h1:Z3rw7dWu1p9IgitXCFamSlA5lmDiklEB6vkaxcNZW5Y= -github.com/go-openapi/jsonreference v1.0.0 h1:jlmTr6torcd1YgDQvSfNmRtKzYDO4FGBkrAdlAVWnpY= -github.com/go-openapi/jsonreference v1.0.0/go.mod h1:jtwdyGbJk0Xhe5Y+rwtglQP6Sb1WZST4rT32LWB+sv0= -github.com/go-openapi/swag v0.27.1 h1:VotvOLWW8q/EAxB0YdsBBGC8XYyeL1YwBj2ungAGPNg= -github.com/go-openapi/swag v0.27.1/go.mod h1:GTkJPwHfhJp6MWr4/rCh64HVI3Ofu+tcsbfjfHmTxpE= -github.com/go-openapi/swag/cmdutils v0.27.1 h1:I7sYqaWVl5mq0NEmNQkAmFDyNin9ufvMX/p2zwtQaOE= -github.com/go-openapi/swag/cmdutils v0.27.1/go.mod h1:Sm1MVFMkF6guJJ+pQqHnQA3N0j9qALV3NxzDSv6bETM= -github.com/go-openapi/swag/conv v0.27.1 h1:8wi9ZG+olmY1wXphl93EWniPtbSPkXM/feH7FgjsvrU= -github.com/go-openapi/swag/conv v0.27.1/go.mod h1:QbqMivkpKhC3g1B1GGGOJ6ANewI3S62dbzYu3Duowqs= -github.com/go-openapi/swag/fileutils v0.27.1 h1:QQqBSoi5mW4XpU85nS0mLcA+zAE6vLzrb0QkmLKf9oM= -github.com/go-openapi/swag/fileutils v0.27.1/go.mod h1:VvJFZLTZS0AI854gEQz5tk7dBESdLjiNUMSZ/th2ry8= -github.com/go-openapi/swag/jsonutils v0.27.1 h1:SVgK3i4USzCU5mibOOS/l4ea2h9UQXy7J7RNLTjuXjU= -github.com/go-openapi/swag/jsonutils v0.27.1/go.mod h1:tdlEpZqdcQ17uj6J4YdK9vd8It5qWMwjWXOs0tjpRlk= -github.com/go-openapi/swag/jsonutils/fixtures_test v0.27.1 h1:mJu3COL9WEaZVp/Kf2PRMi7tPszPEJfSr/OO75ynCs8= -github.com/go-openapi/swag/jsonutils/fixtures_test v0.27.1/go.mod h1:mofwUWx70wvskwESqRJ//k/9kURmCgyJl5m5Ppoh5kY= -github.com/go-openapi/swag/loading v0.27.1 h1:/DxUgDXKbBX4bcn7r9uEXfJyzN5XpiJmZplzQTjrRCY= -github.com/go-openapi/swag/loading v0.27.1/go.mod h1:jvGh3iA2+zyUUycB5fgJWzeHnhrpvGnJJM0RVE9ZShE= -github.com/go-openapi/swag/mangling v0.27.1 h1:yC9D0HyUE8gbP+BfmGx9+AA89ikwZTMjESK3OnnoaqA= -github.com/go-openapi/swag/mangling v0.27.1/go.mod h1:jtBE2+V+3pILxOR7Vgce+Cwp6A2PgZbvVqfNntbVs0w= -github.com/go-openapi/swag/netutils v0.27.1 h1:mICMFoS82F5TZ4Zy3cqmcQk+BFeCp3Uyq3Np7GI0/qU= -github.com/go-openapi/swag/netutils v0.27.1/go.mod h1:J+WYyFMLtvtCGqa6jLv+YNUmIKI3ZRQRrvfNDMoQoEQ= -github.com/go-openapi/swag/pools v0.27.1 h1:9LeadcMyb2GJCbXX5hVQDbZ2Lq9TL4dCs/nx1j5DO0E= -github.com/go-openapi/swag/pools v0.27.1/go.mod h1:kVQefhSK5RWuRe7BXsL8htgBPAMpN7HDGpGEknqugeE= -github.com/go-openapi/swag/stringutils v0.27.1 h1:ZXePZ0r2p1qSjo8tD3Un4vFj8+FqlCkczxDrJIhYUp8= -github.com/go-openapi/swag/stringutils v0.27.1/go.mod h1:lzRN95CxXmA03XcDWHLOb6nOMcxCqR5rGY0lOgsfRoM= -github.com/go-openapi/swag/typeutils v0.27.1 h1:KSTdFlfnse4r6dP9IrEnwMldjE+zs71UeEB3//PtVXc= -github.com/go-openapi/swag/typeutils v0.27.1/go.mod h1:Srm0xFNRZ1Y+vCxJclo5qzx8aj+1pAKda/YfFPrG0dQ= -github.com/go-openapi/swag/yamlutils v0.27.1 h1:ftxv6xvXb1E3zohUc+okZ9nSqNb9StQX/FXnKZ98sQA= -github.com/go-openapi/swag/yamlutils v0.27.1/go.mod h1:bnxFIB1qewGRiZHypXGZ3fNgf13/0HfRgnS/iZBDrOo= -github.com/go-openapi/testify/enable/yaml/v2 v2.6.0 h1:gGHwAJ0R/5jU8BEGDbfRNR3hL68dAVi84WuOApp29B0= -github.com/go-openapi/testify/enable/yaml/v2 v2.6.0/go.mod h1:tY+St1SGq4NFl0QIqdTY4aEdbChAHxhyB77XQi9iJCo= -github.com/go-openapi/testify/v2 v2.6.0 h1:5PKH2HE7YJ/LuRPQGvSxBRlFXNQhSetBLlGAgUEu3ug= -github.com/go-openapi/testify/v2 v2.6.0/go.mod h1:SgsVHtfooshd0tublTtJ50FPKhujf47YRqauXXOUxfw= +github.com/go-openapi/jsonpointer v0.23.1 h1:1HBACs7XIwR2RcmItfdSFlALhGbe6S92p0ry4d1GWg4= +github.com/go-openapi/jsonpointer v0.23.1/go.mod h1:iWRmZTrGn7XwYhtPt/fvdSFj1OfNBngqRT2UG3BxSqY= +github.com/go-openapi/jsonreference v0.21.6 h1:NZ5nGfnaM1n4I43Xjm1e5/M2GjOwQwndQz22uhxwD+Y= +github.com/go-openapi/jsonreference v0.21.6/go.mod h1:xzbgtQ3ZbWxvET3AxdzCJlJt6vkovbf+IfSPJjD0tUY= +github.com/go-openapi/swag v0.25.5 h1:pNkwbUEeGwMtcgxDr+2GBPAk4kT+kJ+AaB+TMKAg+TU= +github.com/go-openapi/swag v0.25.5/go.mod h1:B3RT6l8q7X803JRxa2e59tHOiZlX1t8viplOcs9CwTA= +github.com/go-openapi/swag/cmdutils v0.25.5 h1:yh5hHrpgsw4NwM9KAEtaDTXILYzdXh/I8Whhx9hKj7c= +github.com/go-openapi/swag/cmdutils v0.25.5/go.mod h1:pdae/AFo6WxLl5L0rq87eRzVPm/XRHM3MoYgRMvG4A0= +github.com/go-openapi/swag/conv v0.25.5 h1:wAXBYEXJjoKwE5+vc9YHhpQOFj2JYBMF2DUi+tGu97g= +github.com/go-openapi/swag/conv v0.25.5/go.mod h1:CuJ1eWvh1c4ORKx7unQnFGyvBbNlRKbnRyAvDvzWA4k= +github.com/go-openapi/swag/fileutils v0.25.5 h1:B6JTdOcs2c0dBIs9HnkyTW+5gC+8NIhVBUwERkFhMWk= +github.com/go-openapi/swag/fileutils v0.25.5/go.mod h1:V3cT9UdMQIaH4WiTrUc9EPtVA4txS0TOmRURmhGF4kc= +github.com/go-openapi/swag/jsonname v0.26.1 h1:VReupaV6WxlAsCn0e4DUfgV6bPmINnPpyJDLqSfNPcE= +github.com/go-openapi/swag/jsonname v0.26.1/go.mod h1:OvdW6BoWoj33pTfi7x9vFrgmT+fk7aw0BRwvCE0YOuc= +github.com/go-openapi/swag/jsonutils v0.25.5 h1:XUZF8awQr75MXeC+/iaw5usY/iM7nXPDwdG3Jbl9vYo= +github.com/go-openapi/swag/jsonutils v0.25.5/go.mod h1:48FXUaz8YsDAA9s5AnaUvAmry1UcLcNVWUjY42XkrN4= +github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.5 h1:SX6sE4FrGb4sEnnxbFL/25yZBb5Hcg1inLeErd86Y1U= +github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.5/go.mod h1:/2KvOTrKWjVA5Xli3DZWdMCZDzz3uV/T7bXwrKWPquo= +github.com/go-openapi/swag/loading v0.25.5 h1:odQ/umlIZ1ZVRteI6ckSrvP6e2w9UTF5qgNdemJHjuU= +github.com/go-openapi/swag/loading v0.25.5/go.mod h1:I8A8RaaQ4DApxhPSWLNYWh9NvmX2YKMoB9nwvv6oW6g= +github.com/go-openapi/swag/mangling v0.25.5 h1:hyrnvbQRS7vKePQPHHDso+k6CGn5ZBs5232UqWZmJZw= +github.com/go-openapi/swag/mangling v0.25.5/go.mod h1:6hadXM/o312N/h98RwByLg088U61TPGiltQn71Iw0NY= +github.com/go-openapi/swag/netutils v0.25.5 h1:LZq2Xc2QI8+7838elRAaPCeqJnHODfSyOa7ZGfxDKlU= +github.com/go-openapi/swag/netutils v0.25.5/go.mod h1:lHbtmj4m57APG/8H7ZcMMSWzNqIQcu0RFiXrPUara14= +github.com/go-openapi/swag/stringutils v0.25.5 h1:NVkoDOA8YBgtAR/zvCx5rhJKtZF3IzXcDdwOsYzrB6M= +github.com/go-openapi/swag/stringutils v0.25.5/go.mod h1:PKK8EZdu4QJq8iezt17HM8RXnLAzY7gW0O1KKarrZII= +github.com/go-openapi/swag/typeutils v0.25.5 h1:EFJ+PCga2HfHGdo8s8VJXEVbeXRCYwzzr9u4rJk7L7E= +github.com/go-openapi/swag/typeutils v0.25.5/go.mod h1:itmFmScAYE1bSD8C4rS0W+0InZUBrB2xSPbWt6DLGuc= +github.com/go-openapi/swag/yamlutils v0.25.5 h1:kASCIS+oIeoc55j28T4o8KwlV2S4ZLPT6G0iq2SSbVQ= +github.com/go-openapi/swag/yamlutils v0.25.5/go.mod h1:Gek1/SjjfbYvM+Iq4QGwa/2lEXde9n2j4a3wI3pNuOQ= +github.com/go-openapi/testify/enable/yaml/v2 v2.4.1 h1:NZOrZmIb6PTv5LTFxr5/mKV/FjbUzGE7E6gLz7vFoOQ= +github.com/go-openapi/testify/enable/yaml/v2 v2.4.1/go.mod h1:r7dwsujEHawapMsxA69i+XMGZrQ5tRauhLAjV/sxg3Q= +github.com/go-openapi/testify/v2 v2.5.1 h1:TMdhCaw8fUNraVSf3Omoob1dO/AzBfhtFAPW0an6sBo= +github.com/go-openapi/testify/v2 v2.5.1/go.mod h1:SgsVHtfooshd0tublTtJ50FPKhujf47YRqauXXOUxfw= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= @@ -167,8 +167,8 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/cel-go v0.30.0 h1:ll54AkzKunWkBn9wSoiUXbFZXYZTkdJGNXTBXUoolGo= -github.com/google/cel-go v0.30.0/go.mod h1:X0bD6iVNR8pkROSOoHVdgTkzmRcosof7WQqCD6wcMc8= +github.com/google/cel-go v0.26.1 h1:iPbVVEdkhTX++hpe3lzSk7D3G3QSYqLGoHOcEio+UXQ= +github.com/google/cel-go v0.26.1/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM= github.com/google/gnostic-models v0.7.1 h1:SisTfuFKJSKM5CPZkffwi6coztzzeYUhc3v4yxLWH8c= github.com/google/gnostic-models v0.7.1/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -325,6 +325,8 @@ github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf h1:pvbZ0lM0XWPBqUKqFU8cmavspvIl9nulOYwdy6IFRRo= github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf/go.mod h1:RJID2RhlZKId02nZ62WenDCkgHFerpIOmW0iT7GKmXM= +github.com/stoewer/go-strcase v1.3.1 h1:iS0MdW+kVTxgMoE1LAZyMiYJFKlOzLooE4MxjirtkAs= +github.com/stoewer/go-strcase v1.3.1/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -363,20 +365,20 @@ go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 h1:7iP2uCb7sGddAr30RRS6xjKy7AZ2JtTOPA3oolgVSw8= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0/go.mod h1:c7hN3ddxs/z6q9xwvfLPk+UHlWRQyaeR1LdgfL/66l0= -go.opentelemetry.io/otel v1.45.0 h1:pdrWmLHofpubmArBv1LgFSv1Z0Ie/ppdZzu+kUN5EeU= -go.opentelemetry.io/otel v1.45.0/go.mod h1:XZxIqPapzEYnhNSScF5DIqXhm/rYi0FzCe2XddAwZfQ= +go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= +go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 h1:tgJ0uaNS4c98WRNUEx5U3aDlrDOI5Rs+1Vifcw4DJ8U= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0/go.mod h1:U7HYyW0zt/a9x5J1Kjs+r1f/d4ZHnYFclhYY2+YbeoE= -go.opentelemetry.io/otel/metric v1.45.0 h1:7Eg1uH7CJ5cXv9is6tnBe1FI6rj1nwUdbFypRm3br/M= -go.opentelemetry.io/otel/metric v1.45.0/go.mod h1:HAPbm1nd3p1PmFH7v2dR+6BjXxw+Lq4a2+pndMAm08s= +go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= +go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY= go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg= go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg= go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw= go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A= -go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOyVhxag= -go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc= +go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A= +go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4= go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= @@ -399,18 +401,18 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= -golang.org/x/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw= -golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk= -golang.org/x/exp v0.0.0-20260727155853-b88d891fe743 h1:ex206bKw+v3K0dm3andkrIF+ijyQKJG1pLgwQ2PYdQM= -golang.org/x/exp v0.0.0-20260727155853-b88d891fe743/go.mod h1:EdfpwwqSu+0Li0mzskwHU6FWDV3t9Q+RZDo3QMUtL3Q= +golang.org/x/crypto v0.52.0 h1:RMs7fP2rXdep0CftQlK8Uf+kibLm7qkCcradZWYz988= +golang.org/x/crypto v0.52.0/go.mod h1:1QgfPxDqh0T2M/elOJtp9RvuR95kVjir0e6/BvEmGbc= +golang.org/x/exp v0.0.0-20260603202125-055de637280b h1:v1uXiEBHo8QA0LiGCo7UgHMzHT4Kdfpl2zmtH5vaP1Q= +golang.org/x/exp v0.0.0-20260603202125-055de637280b/go.mod h1:d2fgXJLVs4dYDHUk5lwMIfzRzSrWCfGZb0ZqeLa/Vcw= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk= -golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40= +golang.org/x/mod v0.36.0 h1:JJjpVx6myfUsUdAzZuOSTTmRE0PfZeNWzzvKrP7amb4= +golang.org/x/mod v0.36.0/go.mod h1:moc6ELqsWcOw5Ef3xVprK5ul/MvtVvkIXLziUOICjUQ= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190228165749-92fc7df08ae7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -425,8 +427,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= -golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= -golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= +golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8= +golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -438,8 +440,8 @@ golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= -golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= +golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -461,8 +463,8 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= -golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY= +golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -472,8 +474,8 @@ golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= -golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0= -golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w= +golang.org/x/term v0.43.0 h1:S4RLU2sB31O/NCl+zFN9Aru9A/Cq2aqKpTZJ6B+DwT4= +golang.org/x/term v0.43.0/go.mod h1:lrhlHNdQJHO+1qVYiHfFKVuVioJIheAc3fBSMFYEIsk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= @@ -483,8 +485,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= -golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= -golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= +golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc= +golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -494,8 +496,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/tools v0.48.0 h1:3+hClM1aLL5mjMKm5ovokw9epgRXPuu2tILgismM6RE= -golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk= +golang.org/x/tools v0.45.0 h1:18qN3FAooORvApf5XjCXgsuayZOEtXf6JK18I3+ONa8= +golang.org/x/tools v0.45.0/go.mod h1:LuUGqqaXcXMEFEruIVJVm5mgDD8vww/z/SR1gQ4uE/0= golang.org/x/tools/go/expect v0.1.1-deprecated h1:jpBZDwmgPhXsKZC6WhL20P4b/wmnpsEAGHaNy0n/rJM= golang.org/x/tools/go/expect v0.1.1-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY= golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated h1:1h2MnaIAIXISqTFKdENegdpAgUXz6NrPEsbIeWaBRvM= @@ -514,10 +516,10 @@ google.golang.org/genai v1.50.0 h1:yHKV/vjoeN9PJ3iF0ur4cBZco4N3Kl7j09rMq7XSoWk= google.golang.org/genai v1.50.0/go.mod h1:A3kkl0nyBjyFlNjgxIwKq70julKbIxpSxqKO5gw/gmk= google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 h1:XzmzkmB14QhVhgnawEVsOn6OFsnpyxNPRY9QV01dNB0= google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7/go.mod h1:L43LFes82YgSonw6iTXTxXUX1OlULt4AQtkik4ULL/I= -google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d h1:FarXi840EJWSHYTN3ERkADbPWjl307+FGrA22KAVjjc= -google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d/go.mod h1:K/+WGbmBY7aNW1HDw1fJnKYo10i0DkAX6pows00dLig= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d h1:IL4hdHzcUv2l/gcg98/Rj3FbtE6axwqslOW8SW0C+S0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/genproto/googleapis/api v0.0.0-20260608224507-4308a22a1bab h1:Foefixyu0l973HSYkX8Etw/fPxAmKRhyMGwuqXFiVI0= +google.golang.org/genproto/googleapis/api v0.0.0-20260608224507-4308a22a1bab/go.mod h1:KdNqO+rCIWgFumrNBSEDlDNrkrQnpkax7Tv1WxNY8V4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260608224507-4308a22a1bab h1:cY0oV1VnAqvaim8VsR8ZyEKAudzbRJMRGwD3W/L7yOw= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260608224507-4308a22a1bab/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= google.golang.org/grpc v1.81.1 h1:VnnIIZ88UzOOKLukQi+ImGz8O1Wdp8nAGGnvOfEIWQQ= google.golang.org/grpc v1.81.1/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -526,8 +528,8 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af h1:+5/Sw3GsDNlEmu7TfklWKPdQ0Ykja5VEmq2i817+jbI= -google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -550,34 +552,34 @@ gopkg.in/yaml.v3 v3.0.0-20191010095647-fc94e3f71652/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.35.7 h1:qzjBIl6HRlZ4TXvVELrWC50d30RZu/uLJFE9efpLgxk= -k8s.io/api v0.35.7/go.mod h1:rXqZY94EWBj+9wVgdVOVS46MtnAEF09khzjCR4EOqiE= -k8s.io/apiextensions-apiserver v0.35.7 h1:0Fj7U6mSPEJKfW2GnjOF1zthG2pIpdL2mj14mUJ3E4w= -k8s.io/apiextensions-apiserver v0.35.7/go.mod h1:sh7EoBfvntnXL6GwaLMhfvlhJpGzTFHSI7AyPQ0YQ1g= -k8s.io/apimachinery v0.35.7 h1:dIMi/gFnUDiASbeBqx1wqLAB8jlNo4kysncMZceV0OM= -k8s.io/apimachinery v0.35.7/go.mod h1:1I6w9iM6v//hXKgxe1g3ybZgcOaJrcYg9sQGtndFrmc= -k8s.io/apiserver v0.35.7 h1:Z9RShd9T1nSEua/j0BQcL4JTP09jZfddR/gNr9AFSO0= -k8s.io/apiserver v0.35.7/go.mod h1:zswr0siixtL3+h07x6Ec/8CUcAcLQ4yUwT6COvKoOYQ= -k8s.io/client-go v0.35.7 h1:UWxdVZcqqCdeip50BKoIcoGryX7WfTE1oQQVolP8HJs= -k8s.io/client-go v0.35.7/go.mod h1:uksk4ZVg/i4PrgsMsludkEe7Cp6v8hJ9wvje+2Ekn+c= -k8s.io/code-generator v0.35.7 h1:3YzZjRIWhHuGGydD4UxsEMz87C9ztk9jQ2/gLbPkyVc= -k8s.io/code-generator v0.35.7/go.mod h1:+WAXCNM6AlQLuSsfowMOWGFVlVKmsWO8VULVDFYMaRs= -k8s.io/component-base v0.35.7 h1:Z2HMAIA0rCFZqaUSEsl3E+TQvDo/sYi8WCpYA2v4AJc= -k8s.io/component-base v0.35.7/go.mod h1:WLgdd3pG6LtuNIH1LtsZ4Jn0EMLk8eOJINuzXcdngIA= +k8s.io/api v0.35.5 h1:BrFeUDGY/LBtlA1R5RoxhlYRHs76RnQBc6xbm/y7hsQ= +k8s.io/api v0.35.5/go.mod h1:xWkFhMnoPZdTAQh95Rlw3zZpUUNVlFHcuESUYd06BWM= +k8s.io/apiextensions-apiserver v0.35.5 h1:HttlJjgsx3ddLsASCqklkKvfBlwUoXma8VLpeMG5YL8= +k8s.io/apiextensions-apiserver v0.35.5/go.mod h1:4xbAgP/jbt8sVHE3H4DfE1gSPLUoSzXrNqhZz1lTHKc= +k8s.io/apimachinery v0.35.5 h1:lbjjjUfVeVqFbiOpyhqZHc8DhiYkWOxSNij7lHx2U8Y= +k8s.io/apimachinery v0.35.5/go.mod h1:NNi1taPOpep0jOj+oRha3mBJPqvi0hGdaV8TCqGQ+cc= +k8s.io/apiserver v0.35.5 h1:ZtFpSEmxf/VmOdbL3bo7hLxyNRorRegqOLmYSW0mxEo= +k8s.io/apiserver v0.35.5/go.mod h1:6NNWFTq/UosCwUmqhQDC+3ApzSx5ekeYMIwzSG+49VU= +k8s.io/client-go v0.35.5 h1:wUrgqVSmFRw75bgSHY7X0G/hZM/QYpV0Hg7SYYOYpFk= +k8s.io/client-go v0.35.5/go.mod h1:Z0mDcAJsX1Y7RQfuQlJipiRtqf8Mhk2VDu1/JvRqdGo= +k8s.io/code-generator v0.35.5 h1:g2ZIw7LCjmX2p5WDjtkVYwmvtx+pDF0Pq1dfgCoHkhQ= +k8s.io/code-generator v0.35.5/go.mod h1:W46pDvFxY2SlphV3MBI/6KDZ2JDMhHXGVgPQXMoYFiM= +k8s.io/component-base v0.35.5 h1:1y1xxfpFNkNi4RMi6bvPNN4aDr9VhOijtEfrqnhPijs= +k8s.io/component-base v0.35.5/go.mod h1:n/+aL98XYINubqIu/Okh6mS/kZT2nMeN4IQkQR4VXRg= k8s.io/gengo/v2 v2.0.0-20260408192533-25e2208e0dc3 h1:3L6PNkMLXkU/pz3jWzaaIUz0Rs2V9h+5O51AeRC7poc= k8s.io/gengo/v2 v2.0.0-20260408192533-25e2208e0dc3/go.mod h1:yvyl3l9E+UxlqOMUULdKTAYB0rEhsmjr7+2Vb/1pCSo= k8s.io/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc= k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0= -k8s.io/kube-aggregator v0.35.7 h1:rWkN1lwBJsE0KJ5J/IJU7HlwHFpGTud8p4+LYgtdnxc= -k8s.io/kube-aggregator v0.35.7/go.mod h1:hD43RFgjTixfRVUuYv9NmKtP6WrSFFSUiB/O62C4jaE= -k8s.io/kube-openapi v0.0.0-20260721132016-d427ff9ee9ad h1:oXImqH8mQNk7PmvzKhmN3ddJoY6OnyM225MXwGHPm0A= -k8s.io/kube-openapi v0.0.0-20260721132016-d427ff9ee9ad/go.mod h1:0/mqHCVhlumdJ3BhCfnjSZQE037nAhNodh1/hK0T8/I= -k8s.io/kubectl v0.35.7 h1:F5RS5J9k88ZUpSMT2oxh7/t7N87oNSNwuZ/RKbeNFkw= -k8s.io/kubectl v0.35.7/go.mod h1:EUQ4ePcLf4w5mz6/hbvMknxhSgQckEzlO3+l9Vo6TpY= -k8s.io/pod-security-admission v0.35.7 h1:sBdUDEfUJoVoCspxwlIfZy+Zgl2rLznzT0GQ7RbGIAQ= -k8s.io/pod-security-admission v0.35.7/go.mod h1:aD2ncFkFJrXTet6TBEHOcI+Dnw+ItYkcP6I4TWNPds0= -k8s.io/utils v0.0.0-20260707023825-cf1189d6abe3 h1:jVkFFVfXdXP74B/zbO3hM3hpSFD0xvhQ5U686DPurkE= -k8s.io/utils v0.0.0-20260707023825-cf1189d6abe3/go.mod h1:M2s5JB1lIYP3jzZdorPLHXIPJzt9vv2muW5a6L9DtNM= +k8s.io/kube-aggregator v0.35.5 h1:oLflHAqh8tEoEcXtrzGhr4hctwhcRr5B1sM+T96N1rs= +k8s.io/kube-aggregator v0.35.5/go.mod h1:L3GflyN8a8CDjej2UxgeGwRiXYuI+aTZ0GE7qssdN2w= +k8s.io/kube-openapi v0.0.0-20260603220949-865597e52e25 h1:mPMaPMpBij2V1Wv/fR+HW124vVGXXvOSS9ver/9yjWs= +k8s.io/kube-openapi v0.0.0-20260603220949-865597e52e25/go.mod h1:V/QaCUYDa+0QpcHhVVc5l99Uz56wEMEXBSj9oCDkNDY= +k8s.io/kubectl v0.35.5 h1:768G/MoK8SlgMObXVukluHewKIf8RW7oJYa2MTDh3fk= +k8s.io/kubectl v0.35.5/go.mod h1:rii0tmjY2HQVPSiurhP/XxlnMmrXbNzjPDTeUY8EOZU= +k8s.io/pod-security-admission v0.35.5 h1:R+FbF2OyANMBYkMFtavHyNVOE82VeewRtLXGdADqkjk= +k8s.io/pod-security-admission v0.35.5/go.mod h1:36iCuuOBK1re5qU1/WGu3JsOytNRUWq/RhdqAG1gU+E= +k8s.io/utils v0.0.0-20260507154919-ff6756f316d2 h1:wU4tMEhLGgIbLvXQb1cfN+EcM0wf7zC6CPF+C79jroc= +k8s.io/utils v0.0.0-20260507154919-ff6756f316d2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= open-cluster-management.io/api v0.15.0 h1:lRee1KOlGHZb2scTA7ff9E9Fxt2hJc7jpkHnaCbvkOU= open-cluster-management.io/api v0.15.0/go.mod h1:9erZEWEn4bEqh0nIX2wA7f/s3KCuFycQdBrPrRzi0QM= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM= @@ -592,7 +594,7 @@ sigs.k8s.io/kube-storage-version-migrator v0.0.6-0.20230721195810-5c8923c5ff96 h sigs.k8s.io/kube-storage-version-migrator v0.0.6-0.20230721195810-5c8923c5ff96/go.mod h1:EOBQyBowOUsd7U4CJnMHNE0ri+zCXyouGdLwC/jZU+I= sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= -sigs.k8s.io/structured-merge-diff/v6 v6.4.2 h1:qdOxHwrl2Kaag1aQEarlYcOA9vSyGCp3CIki3aW8c4Q= -sigs.k8s.io/structured-merge-diff/v6 v6.4.2/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= +sigs.k8s.io/structured-merge-diff/v6 v6.3.2 h1:kwVWMx5yS1CrnFWA/2QHyRVJ8jM6dBA80uLmm0wJkk8= +sigs.k8s.io/structured-merge-diff/v6 v6.3.2/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/images/must-gather/rpms.lock.yaml b/images/must-gather/rpms.lock.yaml index 5c2b6b3d4a..3490083fd9 100644 --- a/images/must-gather/rpms.lock.yaml +++ b/images/must-gather/rpms.lock.yaml @@ -60,13 +60,13 @@ arches: name: pkgconf-pkg-config evr: 1.7.3-10.el9 sourcerpm: pkgconf-1.7.3-10.el9.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/os/Packages/r/rsync-3.2.5-7.el9_8.2.aarch64.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/os/Packages/r/rsync-3.2.5-7.el9_8.aarch64.rpm repoid: rhel-9-for-aarch64-baseos-rpms - size: 425538 - checksum: sha256:1e1fa89a9a4b843862fb9436295f187c55d314a9eb23d4bb8d6b07b2f41ba067 + size: 420142 + checksum: sha256:39ba71d3677854505524df265ed828c7e00f026ecfe83df6ba86c7586588cae7 name: rsync - evr: 3.2.5-7.el9_8.2 - sourcerpm: rsync-3.2.5-7.el9_8.2.src.rpm + evr: 3.2.5-7.el9_8 + sourcerpm: rsync-3.2.5-7.el9_8.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/os/Packages/t/tar-1.34-11.el9.aarch64.rpm repoid: rhel-9-for-aarch64-baseos-rpms size: 904777 @@ -105,12 +105,12 @@ arches: checksum: sha256:4d53718592b298ca7c49665b1f4e7bd32dcb42cad15c89345585da9f20d4fcae name: pkgconf evr: 1.7.3-10.el9 - - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/source/SRPMS/Packages/r/rsync-3.2.5-7.el9_8.2.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/source/SRPMS/Packages/r/rsync-3.2.5-7.el9_8.src.rpm repoid: rhel-9-for-aarch64-baseos-source-rpms - size: 1358189 - checksum: sha256:37d0ee99d570df9eadf8244580dc078258ae4c9833ca3458cb6dc5851a7c37ca + size: 1317820 + checksum: sha256:881675c5bba9391d19536569a133069ffe0dd132468a04b3ea52fb697ebf926f name: rsync - evr: 3.2.5-7.el9_8.2 + evr: 3.2.5-7.el9_8 - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/source/SRPMS/Packages/t/tar-1.34-11.el9.src.rpm repoid: rhel-9-for-aarch64-baseos-source-rpms size: 2294162 @@ -176,13 +176,13 @@ arches: name: pkgconf-pkg-config evr: 1.7.3-10.el9 sourcerpm: pkgconf-1.7.3-10.el9.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/os/Packages/r/rsync-3.2.5-7.el9_8.2.ppc64le.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/os/Packages/r/rsync-3.2.5-7.el9_8.ppc64le.rpm repoid: rhel-9-for-ppc64le-baseos-rpms - size: 459875 - checksum: sha256:5e75716946f15a560fffc57967390adfdfc812d6b85997b9d712f041657cfd1f + size: 453342 + checksum: sha256:0570a89b350ada78d86d87afa90b101a7dc9791e5868b6f33fba00727440cd74 name: rsync - evr: 3.2.5-7.el9_8.2 - sourcerpm: rsync-3.2.5-7.el9_8.2.src.rpm + evr: 3.2.5-7.el9_8 + sourcerpm: rsync-3.2.5-7.el9_8.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/os/Packages/t/tar-1.34-11.el9.ppc64le.rpm repoid: rhel-9-for-ppc64le-baseos-rpms size: 945887 @@ -221,12 +221,12 @@ arches: checksum: sha256:4d53718592b298ca7c49665b1f4e7bd32dcb42cad15c89345585da9f20d4fcae name: pkgconf evr: 1.7.3-10.el9 - - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/source/SRPMS/Packages/r/rsync-3.2.5-7.el9_8.2.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/source/SRPMS/Packages/r/rsync-3.2.5-7.el9_8.src.rpm repoid: rhel-9-for-ppc64le-baseos-source-rpms - size: 1358189 - checksum: sha256:37d0ee99d570df9eadf8244580dc078258ae4c9833ca3458cb6dc5851a7c37ca + size: 1317820 + checksum: sha256:881675c5bba9391d19536569a133069ffe0dd132468a04b3ea52fb697ebf926f name: rsync - evr: 3.2.5-7.el9_8.2 + evr: 3.2.5-7.el9_8 - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/source/SRPMS/Packages/t/tar-1.34-11.el9.src.rpm repoid: rhel-9-for-ppc64le-baseos-source-rpms size: 2294162 @@ -292,13 +292,13 @@ arches: name: pkgconf-pkg-config evr: 1.7.3-10.el9 sourcerpm: pkgconf-1.7.3-10.el9.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/os/Packages/r/rsync-3.2.5-7.el9_8.2.s390x.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/os/Packages/r/rsync-3.2.5-7.el9_8.s390x.rpm repoid: rhel-9-for-s390x-baseos-rpms - size: 427539 - checksum: sha256:d85d04511788214c554ff3068632f9e0edb39c8e7544f0610927f79d76677182 + size: 422461 + checksum: sha256:e937047c63e4f5501bc08aeada17ec184254cdc2d5cd6a1a9e39b6477bf2bb72 name: rsync - evr: 3.2.5-7.el9_8.2 - sourcerpm: rsync-3.2.5-7.el9_8.2.src.rpm + evr: 3.2.5-7.el9_8 + sourcerpm: rsync-3.2.5-7.el9_8.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/os/Packages/t/tar-1.34-11.el9.s390x.rpm repoid: rhel-9-for-s390x-baseos-rpms size: 907745 @@ -337,12 +337,12 @@ arches: checksum: sha256:4d53718592b298ca7c49665b1f4e7bd32dcb42cad15c89345585da9f20d4fcae name: pkgconf evr: 1.7.3-10.el9 - - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/source/SRPMS/Packages/r/rsync-3.2.5-7.el9_8.2.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/source/SRPMS/Packages/r/rsync-3.2.5-7.el9_8.src.rpm repoid: rhel-9-for-s390x-baseos-source-rpms - size: 1358189 - checksum: sha256:37d0ee99d570df9eadf8244580dc078258ae4c9833ca3458cb6dc5851a7c37ca + size: 1317820 + checksum: sha256:881675c5bba9391d19536569a133069ffe0dd132468a04b3ea52fb697ebf926f name: rsync - evr: 3.2.5-7.el9_8.2 + evr: 3.2.5-7.el9_8 - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/source/SRPMS/Packages/t/tar-1.34-11.el9.src.rpm repoid: rhel-9-for-s390x-baseos-source-rpms size: 2294162 @@ -408,13 +408,13 @@ arches: name: pkgconf-pkg-config evr: 1.7.3-10.el9 sourcerpm: pkgconf-1.7.3-10.el9.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/os/Packages/r/rsync-3.2.5-7.el9_8.2.x86_64.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/os/Packages/r/rsync-3.2.5-7.el9_8.x86_64.rpm repoid: rhel-9-for-x86_64-baseos-rpms - size: 430699 - checksum: sha256:73c95e6404602b407a3cced5f1ae769a2c32b5b4ce9d646fc42617941863082c + size: 424707 + checksum: sha256:6c1d064c38e4a3f4bcb756cb9ea0382cccf7a262433c286db45931d114074ff3 name: rsync - evr: 3.2.5-7.el9_8.2 - sourcerpm: rsync-3.2.5-7.el9_8.2.src.rpm + evr: 3.2.5-7.el9_8 + sourcerpm: rsync-3.2.5-7.el9_8.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/os/Packages/t/tar-1.34-11.el9.x86_64.rpm repoid: rhel-9-for-x86_64-baseos-rpms size: 913256 @@ -453,12 +453,12 @@ arches: checksum: sha256:4d53718592b298ca7c49665b1f4e7bd32dcb42cad15c89345585da9f20d4fcae name: pkgconf evr: 1.7.3-10.el9 - - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/source/SRPMS/Packages/r/rsync-3.2.5-7.el9_8.2.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/source/SRPMS/Packages/r/rsync-3.2.5-7.el9_8.src.rpm repoid: rhel-9-for-x86_64-baseos-source-rpms - size: 1358189 - checksum: sha256:37d0ee99d570df9eadf8244580dc078258ae4c9833ca3458cb6dc5851a7c37ca + size: 1317820 + checksum: sha256:881675c5bba9391d19536569a133069ffe0dd132468a04b3ea52fb697ebf926f name: rsync - evr: 3.2.5-7.el9_8.2 + evr: 3.2.5-7.el9_8 - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/source/SRPMS/Packages/t/tar-1.34-11.el9.src.rpm repoid: rhel-9-for-x86_64-baseos-source-rpms size: 2294162 diff --git a/images/openscap/rpms.lock.yaml b/images/openscap/rpms.lock.yaml index 0ea488d468..1847b9a8de 100644 --- a/images/openscap/rpms.lock.yaml +++ b/images/openscap/rpms.lock.yaml @@ -4,27 +4,27 @@ lockfileVendor: redhat arches: - arch: aarch64 packages: - - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/appstream/os/Packages/l/libxslt-1.1.34-14.el9_8.1.aarch64.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/appstream/os/Packages/l/libxslt-1.1.34-14.el9_7.1.aarch64.rpm repoid: rhel-9-for-aarch64-appstream-rpms - size: 251817 - checksum: sha256:c9c423fac638f5cb332c065c2a4d78b969a52e0d8f30b894494062ebf9e7e8aa + size: 251669 + checksum: sha256:2b1fc002c4f57960df438791f7dfb5d4defa964f1afc73c3556451bc7f5ea01c name: libxslt - evr: 1.1.34-14.el9_8.1 - sourcerpm: libxslt-1.1.34-14.el9_8.1.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/appstream/os/Packages/o/openscap-1.3.14-1.el9_8.aarch64.rpm + evr: 1.1.34-14.el9_7.1 + sourcerpm: libxslt-1.1.34-14.el9_7.1.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/appstream/os/Packages/o/openscap-1.3.13-1.el9_7.aarch64.rpm repoid: rhel-9-for-aarch64-appstream-rpms - size: 2129342 - checksum: sha256:90dd623ce6ba147d973f1cc1154c43d040efc9a41b2f96f9c3260e9795133c31 + size: 2118389 + checksum: sha256:8e1c4f093b0fb79481d874ddf1630e325308b641c9dd0992382990a836068abb name: openscap - evr: 1:1.3.14-1.el9_8 - sourcerpm: openscap-1.3.14-1.el9_8.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/appstream/os/Packages/o/openscap-scanner-1.3.14-1.el9_8.aarch64.rpm + evr: 1:1.3.13-1.el9_7 + sourcerpm: openscap-1.3.13-1.el9_7.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/appstream/os/Packages/o/openscap-scanner-1.3.13-1.el9_7.aarch64.rpm repoid: rhel-9-for-aarch64-appstream-rpms - size: 64719 - checksum: sha256:7b83deeb32c5693aeeacc8ca65618cab899e1b1511ce95f957017fad2f78012c + size: 58599 + checksum: sha256:087b1c69daba9756217a681597986ad52272f63024eaddc310e50b5fad586d85 name: openscap-scanner - evr: 1:1.3.14-1.el9_8 - sourcerpm: openscap-1.3.14-1.el9_8.src.rpm + evr: 1:1.3.13-1.el9_7 + sourcerpm: openscap-1.3.13-1.el9_7.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/appstream/os/Packages/x/xmlsec1-1.2.29-13.el9.aarch64.rpm repoid: rhel-9-for-aarch64-appstream-rpms size: 186448 @@ -39,13 +39,13 @@ arches: name: xmlsec1-openssl evr: 1.2.29-13.el9 sourcerpm: xmlsec1-1.2.29-13.el9.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/os/Packages/a/acl-2.4.0-1.el9_8.aarch64.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/os/Packages/a/acl-2.3.1-4.el9.aarch64.rpm repoid: rhel-9-for-aarch64-baseos-rpms - size: 84537 - checksum: sha256:241864fdb68d73b5a63df6269ae0895aec7c08e723fb0506fe446c148c9dad3f + size: 77245 + checksum: sha256:59d24711260ff0e69762fc4e728279b0e7b6ecfdb5a9b8ba01cd96682c679022 name: acl - evr: 2.4.0-1.el9_8 - sourcerpm: acl-2.4.0-1.el9_8.src.rpm + evr: 2.3.1-4.el9 + sourcerpm: acl-2.3.1-4.el9.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/os/Packages/c/cracklib-2.9.6-28.el9.aarch64.rpm repoid: rhel-9-for-aarch64-baseos-rpms size: 102026 @@ -151,13 +151,13 @@ arches: name: libutempter evr: 1.2.1-6.el9 sourcerpm: libutempter-1.2.1-6.el9.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/os/Packages/o/openssl-3.5.5-6.el9_8.aarch64.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/os/Packages/o/openssl-3.5.5-3.el9_8.aarch64.rpm repoid: rhel-9-for-aarch64-baseos-rpms - size: 1541002 - checksum: sha256:9f10be36d0d532c65a3f9a41f7d0cd3190b0b908f60850862cc24cab06cd1101 + size: 1540182 + checksum: sha256:75511f7bb94d241b5c0a30b06cc0acf6a84d24d8c445e5609a41dff594fb53c8 name: openssl - evr: 1:3.5.5-6.el9_8 - sourcerpm: openssl-3.5.5-6.el9_8.src.rpm + evr: 1:3.5.5-3.el9_8 + sourcerpm: openssl-3.5.5-3.el9_8.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/os/Packages/p/pam-1.5.1-28.el9.aarch64.rpm repoid: rhel-9-for-aarch64-baseos-rpms size: 635826 @@ -172,27 +172,27 @@ arches: name: procps-ng evr: 3.3.17-14.el9 sourcerpm: procps-ng-3.3.17-14.el9.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/os/Packages/s/systemd-252-67.el9_8.4.aarch64.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/os/Packages/s/systemd-252-67.el9_8.2.aarch64.rpm repoid: rhel-9-for-aarch64-baseos-rpms - size: 4156431 - checksum: sha256:f49001c208ea0ec7776b2353800f133d3383e72bda8486132dc6822a803aef9f + size: 4155781 + checksum: sha256:2052a9bbb59b77d20fd8e402e5f798d2498792e60e239e56ce963b460cd97c93 name: systemd - evr: 252-67.el9_8.4 - sourcerpm: systemd-252-67.el9_8.4.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/os/Packages/s/systemd-pam-252-67.el9_8.4.aarch64.rpm + evr: 252-67.el9_8.2 + sourcerpm: systemd-252-67.el9_8.2.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/os/Packages/s/systemd-pam-252-67.el9_8.2.aarch64.rpm repoid: rhel-9-for-aarch64-baseos-rpms - size: 266579 - checksum: sha256:e85f1916e5fc35f483282c2de00cb4e1a9a40743e745c00bb66e30e383955d46 + size: 267038 + checksum: sha256:f828175f86e78f6df0dd0a84cb84487b6d731299d948fad360ce073743173492 name: systemd-pam - evr: 252-67.el9_8.4 - sourcerpm: systemd-252-67.el9_8.4.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/os/Packages/s/systemd-rpm-macros-252-67.el9_8.4.noarch.rpm + evr: 252-67.el9_8.2 + sourcerpm: systemd-252-67.el9_8.2.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/os/Packages/s/systemd-rpm-macros-252-67.el9_8.2.noarch.rpm repoid: rhel-9-for-aarch64-baseos-rpms - size: 59475 - checksum: sha256:7d671ec39a7caeb7346be6d5fcb44212545844ced6f4974c4b409fef6a12a891 + size: 60014 + checksum: sha256:40414d69836b9e6b409c63ff8fa3b443321bfe5f5074e1ca90367d215f9b5afc name: systemd-rpm-macros - evr: 252-67.el9_8.4 - sourcerpm: systemd-252-67.el9_8.4.src.rpm + evr: 252-67.el9_8.2 + sourcerpm: systemd-252-67.el9_8.2.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/os/Packages/u/util-linux-2.37.4-25.el9.aarch64.rpm repoid: rhel-9-for-aarch64-baseos-rpms size: 2390152 @@ -208,30 +208,30 @@ arches: evr: 2.37.4-25.el9 sourcerpm: util-linux-2.37.4-25.el9.src.rpm source: - - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/appstream/source/SRPMS/Packages/l/libxslt-1.1.34-14.el9_8.1.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/appstream/source/SRPMS/Packages/l/libxslt-1.1.34-14.el9_7.1.src.rpm repoid: rhel-9-for-aarch64-appstream-source-rpms - size: 3571429 - checksum: sha256:a63ad81bc1461ee56521e3b488b804cf2e43ec2b5dd5e7b3ab4bfe1e8a59d748 + size: 3567277 + checksum: sha256:52dfaf51f4dd59eeaf60b6b0c1a4ef41c83001f29568cd9d3521696ba3e50c3d name: libxslt - evr: 1.1.34-14.el9_8.1 - - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/appstream/source/SRPMS/Packages/o/openscap-1.3.14-1.el9_8.src.rpm + evr: 1.1.34-14.el9_7.1 + - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/appstream/source/SRPMS/Packages/o/openscap-1.3.13-1.el9_7.src.rpm repoid: rhel-9-for-aarch64-appstream-source-rpms - size: 13993305 - checksum: sha256:850491a67daa1831f0364154c4282876c32e3d1216c4e3be3e6ca547086263de + size: 14017583 + checksum: sha256:c2a52d88b8aad4c7b7ce42ccd777e16e6a0248579f4a51d712f463e2ed84de49 name: openscap - evr: 1:1.3.14-1.el9_8 + evr: 1:1.3.13-1.el9_7 - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/appstream/source/SRPMS/Packages/x/xmlsec1-1.2.29-13.el9.src.rpm repoid: rhel-9-for-aarch64-appstream-source-rpms size: 2000140 checksum: sha256:01d2e6c0c4eba0e55811eb91ba1e518d85dd8b4497d420f66d16d89f19328dc7 name: xmlsec1 evr: 1.2.29-13.el9 - - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/source/SRPMS/Packages/a/acl-2.4.0-1.el9_8.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/source/SRPMS/Packages/a/acl-2.3.1-4.el9.src.rpm repoid: rhel-9-for-aarch64-baseos-source-rpms - size: 609918 - checksum: sha256:b140deb68f46517b0093e18969d8fb42a17216064fb2ee5783e9316d786430db + size: 535332 + checksum: sha256:cb449bc6c85e0b50fa0bb98c969ff8481fee40517d8ebec5e28b72e5360fbe1e name: acl - evr: 2.4.0-1.el9_8 + evr: 2.3.1-4.el9 - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/source/SRPMS/Packages/c/cracklib-2.9.6-28.el9.src.rpm repoid: rhel-9-for-aarch64-baseos-source-rpms size: 6416053 @@ -298,12 +298,12 @@ arches: checksum: sha256:e48843d2734fefad084a86165860ea9575bdc53f63bb5845d8807ce9ccb4f914 name: libutempter evr: 1.2.1-6.el9 - - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/source/SRPMS/Packages/o/openssl-3.5.5-6.el9_8.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/source/SRPMS/Packages/o/openssl-3.5.5-3.el9_8.src.rpm repoid: rhel-9-for-aarch64-baseos-source-rpms - size: 53369050 - checksum: sha256:b79f08d2d04536fdb6801b6ba7da7174942d174dd2b7969316402c737689d735 + size: 53324097 + checksum: sha256:6dcf0fd27d46993ee08de288fd4ef2387c4a5cd28925e78c7449403f6459ddbd name: openssl - evr: 1:3.5.5-6.el9_8 + evr: 1:3.5.5-3.el9_8 - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/source/SRPMS/Packages/p/pam-1.5.1-28.el9.src.rpm repoid: rhel-9-for-aarch64-baseos-source-rpms size: 1133226 @@ -316,12 +316,12 @@ arches: checksum: sha256:acfd5c270ba5724a0f5f2a84cc47ee222d6a03095421fddbf6932375ec7d67f0 name: procps-ng evr: 3.3.17-14.el9 - - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/source/SRPMS/Packages/s/systemd-252-67.el9_8.4.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/source/SRPMS/Packages/s/systemd-252-67.el9_8.2.src.rpm repoid: rhel-9-for-aarch64-baseos-source-rpms - size: 45009674 - checksum: sha256:e44181d1de2a135a5507b956d18a9eb11951a35aaa9c15dbc0f144ed8313f732 + size: 45000069 + checksum: sha256:d35c895dc3fabebd933fe61f6d6c7f12c02809e8d0324ecb66acb945525a39d5 name: systemd - evr: 252-67.el9_8.4 + evr: 252-67.el9_8.2 - url: https://cdn.redhat.com/content/dist/rhel9/9/aarch64/baseos/source/SRPMS/Packages/u/util-linux-2.37.4-25.el9.src.rpm repoid: rhel-9-for-aarch64-baseos-source-rpms size: 6291867 @@ -331,27 +331,27 @@ arches: module_metadata: [] - arch: ppc64le packages: - - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/appstream/os/Packages/l/libxslt-1.1.34-14.el9_8.1.ppc64le.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/appstream/os/Packages/l/libxslt-1.1.34-14.el9_7.1.ppc64le.rpm repoid: rhel-9-for-ppc64le-appstream-rpms - size: 272597 - checksum: sha256:21182c0b0ad0d4c797ad743817e62e57ae8166b4a8eb01c636d920600f2aa392 + size: 272058 + checksum: sha256:c07405af5c0110256e0ec1ab4f9a344155d1d0056ab545df729c4291b8292e09 name: libxslt - evr: 1.1.34-14.el9_8.1 - sourcerpm: libxslt-1.1.34-14.el9_8.1.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/appstream/os/Packages/o/openscap-1.3.14-1.el9_8.ppc64le.rpm + evr: 1.1.34-14.el9_7.1 + sourcerpm: libxslt-1.1.34-14.el9_7.1.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/appstream/os/Packages/o/openscap-1.3.13-1.el9_7.ppc64le.rpm repoid: rhel-9-for-ppc64le-appstream-rpms - size: 2215757 - checksum: sha256:b1a4f36c0f95d24747477821da175cee054a334c3453071db7dbefc3d6181768 + size: 2208728 + checksum: sha256:3c14d54fbea543eabc478bbda0ac19fa876c85fd97c57294bf0e1d21b2cca8af name: openscap - evr: 1:1.3.14-1.el9_8 - sourcerpm: openscap-1.3.14-1.el9_8.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/appstream/os/Packages/o/openscap-scanner-1.3.14-1.el9_8.ppc64le.rpm + evr: 1:1.3.13-1.el9_7 + sourcerpm: openscap-1.3.13-1.el9_7.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/appstream/os/Packages/o/openscap-scanner-1.3.13-1.el9_7.ppc64le.rpm repoid: rhel-9-for-ppc64le-appstream-rpms - size: 67497 - checksum: sha256:b06edfb3a6a7a3260e8c3220f92e2608a1283d81c29ba38fc41c26ba8e59285c + size: 61354 + checksum: sha256:781a5d5a0d0c2f113334963806f9f9ac83f6ea3b2396b1e53774252f5d05acb9 name: openscap-scanner - evr: 1:1.3.14-1.el9_8 - sourcerpm: openscap-1.3.14-1.el9_8.src.rpm + evr: 1:1.3.13-1.el9_7 + sourcerpm: openscap-1.3.13-1.el9_7.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/appstream/os/Packages/x/xmlsec1-1.2.29-13.el9.ppc64le.rpm repoid: rhel-9-for-ppc64le-appstream-rpms size: 194901 @@ -366,13 +366,13 @@ arches: name: xmlsec1-openssl evr: 1.2.29-13.el9 sourcerpm: xmlsec1-1.2.29-13.el9.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/os/Packages/a/acl-2.4.0-1.el9_8.ppc64le.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/os/Packages/a/acl-2.3.1-4.el9.ppc64le.rpm repoid: rhel-9-for-ppc64le-baseos-rpms - size: 87243 - checksum: sha256:e8d68d043a1bc11407edf1ed9f482631bbd26720698617ec994208c9c0a056a5 + size: 79564 + checksum: sha256:5abf618a32e0cfd20a2402b5b383e0d8055dd61c958bd1df066f5ab868358b63 name: acl - evr: 2.4.0-1.el9_8 - sourcerpm: acl-2.4.0-1.el9_8.src.rpm + evr: 2.3.1-4.el9 + sourcerpm: acl-2.3.1-4.el9.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/os/Packages/c/cracklib-2.9.6-28.el9.ppc64le.rpm repoid: rhel-9-for-ppc64le-baseos-rpms size: 104055 @@ -485,13 +485,13 @@ arches: name: libutempter evr: 1.2.1-6.el9 sourcerpm: libutempter-1.2.1-6.el9.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/os/Packages/o/openssl-3.5.5-6.el9_8.ppc64le.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/os/Packages/o/openssl-3.5.5-3.el9_8.ppc64le.rpm repoid: rhel-9-for-ppc64le-baseos-rpms - size: 1566179 - checksum: sha256:d207d19541eb62721034fbcf7f8ae046d3862541bc20221bd5cb12262eefe3a0 + size: 1565332 + checksum: sha256:b394162b853910e2e27f1a4397d010a21709b1c466899912c5b5f3d7004b0ac7 name: openssl - evr: 1:3.5.5-6.el9_8 - sourcerpm: openssl-3.5.5-6.el9_8.src.rpm + evr: 1:3.5.5-3.el9_8 + sourcerpm: openssl-3.5.5-3.el9_8.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/os/Packages/p/pam-1.5.1-28.el9.ppc64le.rpm repoid: rhel-9-for-ppc64le-baseos-rpms size: 677440 @@ -506,27 +506,27 @@ arches: name: procps-ng evr: 3.3.17-14.el9 sourcerpm: procps-ng-3.3.17-14.el9.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/os/Packages/s/systemd-252-67.el9_8.4.ppc64le.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/os/Packages/s/systemd-252-67.el9_8.2.ppc64le.rpm repoid: rhel-9-for-ppc64le-baseos-rpms - size: 4435450 - checksum: sha256:bff8fa0817533a53ff5f52d3510b15566af85678685d14d731154806ace4e1d7 + size: 4434428 + checksum: sha256:48ca4d2c55f436c0138a09ff9ffef8fca685fbeb8d6c1a159de556510f966450 name: systemd - evr: 252-67.el9_8.4 - sourcerpm: systemd-252-67.el9_8.4.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/os/Packages/s/systemd-pam-252-67.el9_8.4.ppc64le.rpm + evr: 252-67.el9_8.2 + sourcerpm: systemd-252-67.el9_8.2.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/os/Packages/s/systemd-pam-252-67.el9_8.2.ppc64le.rpm repoid: rhel-9-for-ppc64le-baseos-rpms - size: 294891 - checksum: sha256:cb44a6b99e0deafaad55d75942b67fa6079a1cfbc0929fefeeeea8f8ada6eaf0 + size: 295247 + checksum: sha256:8e3f18348984779110083656d99b3461fca252cb6f7fbcc018a4c4da85cb3d8a name: systemd-pam - evr: 252-67.el9_8.4 - sourcerpm: systemd-252-67.el9_8.4.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/os/Packages/s/systemd-rpm-macros-252-67.el9_8.4.noarch.rpm + evr: 252-67.el9_8.2 + sourcerpm: systemd-252-67.el9_8.2.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/os/Packages/s/systemd-rpm-macros-252-67.el9_8.2.noarch.rpm repoid: rhel-9-for-ppc64le-baseos-rpms - size: 59475 - checksum: sha256:7d671ec39a7caeb7346be6d5fcb44212545844ced6f4974c4b409fef6a12a891 + size: 60014 + checksum: sha256:40414d69836b9e6b409c63ff8fa3b443321bfe5f5074e1ca90367d215f9b5afc name: systemd-rpm-macros - evr: 252-67.el9_8.4 - sourcerpm: systemd-252-67.el9_8.4.src.rpm + evr: 252-67.el9_8.2 + sourcerpm: systemd-252-67.el9_8.2.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/os/Packages/u/util-linux-2.37.4-25.el9.ppc64le.rpm repoid: rhel-9-for-ppc64le-baseos-rpms size: 2426763 @@ -542,30 +542,30 @@ arches: evr: 2.37.4-25.el9 sourcerpm: util-linux-2.37.4-25.el9.src.rpm source: - - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/appstream/source/SRPMS/Packages/l/libxslt-1.1.34-14.el9_8.1.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/appstream/source/SRPMS/Packages/l/libxslt-1.1.34-14.el9_7.1.src.rpm repoid: rhel-9-for-ppc64le-appstream-source-rpms - size: 3571429 - checksum: sha256:a63ad81bc1461ee56521e3b488b804cf2e43ec2b5dd5e7b3ab4bfe1e8a59d748 + size: 3567277 + checksum: sha256:52dfaf51f4dd59eeaf60b6b0c1a4ef41c83001f29568cd9d3521696ba3e50c3d name: libxslt - evr: 1.1.34-14.el9_8.1 - - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/appstream/source/SRPMS/Packages/o/openscap-1.3.14-1.el9_8.src.rpm + evr: 1.1.34-14.el9_7.1 + - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/appstream/source/SRPMS/Packages/o/openscap-1.3.13-1.el9_7.src.rpm repoid: rhel-9-for-ppc64le-appstream-source-rpms - size: 13993305 - checksum: sha256:850491a67daa1831f0364154c4282876c32e3d1216c4e3be3e6ca547086263de + size: 14017583 + checksum: sha256:c2a52d88b8aad4c7b7ce42ccd777e16e6a0248579f4a51d712f463e2ed84de49 name: openscap - evr: 1:1.3.14-1.el9_8 + evr: 1:1.3.13-1.el9_7 - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/appstream/source/SRPMS/Packages/x/xmlsec1-1.2.29-13.el9.src.rpm repoid: rhel-9-for-ppc64le-appstream-source-rpms size: 2000140 checksum: sha256:01d2e6c0c4eba0e55811eb91ba1e518d85dd8b4497d420f66d16d89f19328dc7 name: xmlsec1 evr: 1.2.29-13.el9 - - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/source/SRPMS/Packages/a/acl-2.4.0-1.el9_8.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/source/SRPMS/Packages/a/acl-2.3.1-4.el9.src.rpm repoid: rhel-9-for-ppc64le-baseos-source-rpms - size: 609918 - checksum: sha256:b140deb68f46517b0093e18969d8fb42a17216064fb2ee5783e9316d786430db + size: 535332 + checksum: sha256:cb449bc6c85e0b50fa0bb98c969ff8481fee40517d8ebec5e28b72e5360fbe1e name: acl - evr: 2.4.0-1.el9_8 + evr: 2.3.1-4.el9 - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/source/SRPMS/Packages/c/cracklib-2.9.6-28.el9.src.rpm repoid: rhel-9-for-ppc64le-baseos-source-rpms size: 6416053 @@ -638,12 +638,12 @@ arches: checksum: sha256:e48843d2734fefad084a86165860ea9575bdc53f63bb5845d8807ce9ccb4f914 name: libutempter evr: 1.2.1-6.el9 - - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/source/SRPMS/Packages/o/openssl-3.5.5-6.el9_8.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/source/SRPMS/Packages/o/openssl-3.5.5-3.el9_8.src.rpm repoid: rhel-9-for-ppc64le-baseos-source-rpms - size: 53369050 - checksum: sha256:b79f08d2d04536fdb6801b6ba7da7174942d174dd2b7969316402c737689d735 + size: 53324097 + checksum: sha256:6dcf0fd27d46993ee08de288fd4ef2387c4a5cd28925e78c7449403f6459ddbd name: openssl - evr: 1:3.5.5-6.el9_8 + evr: 1:3.5.5-3.el9_8 - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/source/SRPMS/Packages/p/pam-1.5.1-28.el9.src.rpm repoid: rhel-9-for-ppc64le-baseos-source-rpms size: 1133226 @@ -656,12 +656,12 @@ arches: checksum: sha256:acfd5c270ba5724a0f5f2a84cc47ee222d6a03095421fddbf6932375ec7d67f0 name: procps-ng evr: 3.3.17-14.el9 - - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/source/SRPMS/Packages/s/systemd-252-67.el9_8.4.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/source/SRPMS/Packages/s/systemd-252-67.el9_8.2.src.rpm repoid: rhel-9-for-ppc64le-baseos-source-rpms - size: 45009674 - checksum: sha256:e44181d1de2a135a5507b956d18a9eb11951a35aaa9c15dbc0f144ed8313f732 + size: 45000069 + checksum: sha256:d35c895dc3fabebd933fe61f6d6c7f12c02809e8d0324ecb66acb945525a39d5 name: systemd - evr: 252-67.el9_8.4 + evr: 252-67.el9_8.2 - url: https://cdn.redhat.com/content/dist/rhel9/9/ppc64le/baseos/source/SRPMS/Packages/u/util-linux-2.37.4-25.el9.src.rpm repoid: rhel-9-for-ppc64le-baseos-source-rpms size: 6291867 @@ -671,27 +671,27 @@ arches: module_metadata: [] - arch: s390x packages: - - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/appstream/os/Packages/l/libxslt-1.1.34-14.el9_8.1.s390x.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/appstream/os/Packages/l/libxslt-1.1.34-14.el9_7.1.s390x.rpm repoid: rhel-9-for-s390x-appstream-rpms - size: 247373 - checksum: sha256:fda16d3d4c82029557173dd3133619bab9baa4e83b795730c00d2a67214ecd64 + size: 247051 + checksum: sha256:8b22a204421446c6c45361ee28f5c394da79088a9998676d73c15a81c0225d55 name: libxslt - evr: 1.1.34-14.el9_8.1 - sourcerpm: libxslt-1.1.34-14.el9_8.1.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/appstream/os/Packages/o/openscap-1.3.14-1.el9_8.s390x.rpm + evr: 1.1.34-14.el9_7.1 + sourcerpm: libxslt-1.1.34-14.el9_7.1.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/appstream/os/Packages/o/openscap-1.3.13-1.el9_7.s390x.rpm repoid: rhel-9-for-s390x-appstream-rpms - size: 2126578 - checksum: sha256:3458f3594a0cfa8fd5bbb577b4ce493a5fa30ff2bd7543bdce3b219ea61587da + size: 2115966 + checksum: sha256:05f51d1c239e660e19713dbabae7aab811bb555272b7e5bc86b3503277b4602e name: openscap - evr: 1:1.3.14-1.el9_8 - sourcerpm: openscap-1.3.14-1.el9_8.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/appstream/os/Packages/o/openscap-scanner-1.3.14-1.el9_8.s390x.rpm + evr: 1:1.3.13-1.el9_7 + sourcerpm: openscap-1.3.13-1.el9_7.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/appstream/os/Packages/o/openscap-scanner-1.3.13-1.el9_7.s390x.rpm repoid: rhel-9-for-s390x-appstream-rpms - size: 63325 - checksum: sha256:4bfc367c12a2649ff8983a08374319a39946c6e513471cac9216d678a940546f + size: 57185 + checksum: sha256:ad84afdf0f966c40e4939a8c39575558965c47eb18d780a288e7d26edf048806 name: openscap-scanner - evr: 1:1.3.14-1.el9_8 - sourcerpm: openscap-1.3.14-1.el9_8.src.rpm + evr: 1:1.3.13-1.el9_7 + sourcerpm: openscap-1.3.13-1.el9_7.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/appstream/os/Packages/x/xmlsec1-1.2.29-13.el9.s390x.rpm repoid: rhel-9-for-s390x-appstream-rpms size: 182822 @@ -706,13 +706,13 @@ arches: name: xmlsec1-openssl evr: 1.2.29-13.el9 sourcerpm: xmlsec1-1.2.29-13.el9.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/os/Packages/a/acl-2.4.0-1.el9_8.s390x.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/os/Packages/a/acl-2.3.1-4.el9.s390x.rpm repoid: rhel-9-for-s390x-baseos-rpms - size: 84330 - checksum: sha256:56703b3f1ea101d511db213be4e5bc5e60d640c9b5d2e815d883386fd1ed2f76 + size: 77024 + checksum: sha256:88638fac051b5720b50d694b52172b0f8553376085e868030fb2032fa662b55b name: acl - evr: 2.4.0-1.el9_8 - sourcerpm: acl-2.4.0-1.el9_8.src.rpm + evr: 2.3.1-4.el9 + sourcerpm: acl-2.3.1-4.el9.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/os/Packages/c/cracklib-2.9.6-28.el9.s390x.rpm repoid: rhel-9-for-s390x-baseos-rpms size: 101566 @@ -818,13 +818,13 @@ arches: name: libutempter evr: 1.2.1-6.el9 sourcerpm: libutempter-1.2.1-6.el9.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/os/Packages/o/openssl-3.5.5-6.el9_8.s390x.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/os/Packages/o/openssl-3.5.5-3.el9_8.s390x.rpm repoid: rhel-9-for-s390x-baseos-rpms - size: 1549454 - checksum: sha256:55ace1358d336a4bc54659df2c4f1317d6638e70dbabc95b83a70d29cf6e113d + size: 1548549 + checksum: sha256:6eb661b0b1eafe6959c545666a6a91387e9ff777ff0cb534e9f42423f24996bb name: openssl - evr: 1:3.5.5-6.el9_8 - sourcerpm: openssl-3.5.5-6.el9_8.src.rpm + evr: 1:3.5.5-3.el9_8 + sourcerpm: openssl-3.5.5-3.el9_8.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/os/Packages/p/pam-1.5.1-28.el9.s390x.rpm repoid: rhel-9-for-s390x-baseos-rpms size: 630422 @@ -839,27 +839,27 @@ arches: name: procps-ng evr: 3.3.17-14.el9 sourcerpm: procps-ng-3.3.17-14.el9.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/os/Packages/s/systemd-252-67.el9_8.4.s390x.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/os/Packages/s/systemd-252-67.el9_8.2.s390x.rpm repoid: rhel-9-for-s390x-baseos-rpms - size: 4167506 - checksum: sha256:b2db6892cf6b5e562ebebc828f8b85d709fb9ababf0582492693f3fe75df3be4 + size: 4166795 + checksum: sha256:c0412b9bbe5f913a5361035b0e9c165abbc59820717f1cc91c526b211dbadfea name: systemd - evr: 252-67.el9_8.4 - sourcerpm: systemd-252-67.el9_8.4.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/os/Packages/s/systemd-pam-252-67.el9_8.4.s390x.rpm + evr: 252-67.el9_8.2 + sourcerpm: systemd-252-67.el9_8.2.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/os/Packages/s/systemd-pam-252-67.el9_8.2.s390x.rpm repoid: rhel-9-for-s390x-baseos-rpms - size: 266273 - checksum: sha256:b52f54b47c27177f53e2344b86ac01f0e10482bc5a1dfae988051502d94df6e0 + size: 266658 + checksum: sha256:be317bea5fb09ac83b455a625707614d2a505015c306344f4df7342667fdc06d name: systemd-pam - evr: 252-67.el9_8.4 - sourcerpm: systemd-252-67.el9_8.4.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/os/Packages/s/systemd-rpm-macros-252-67.el9_8.4.noarch.rpm + evr: 252-67.el9_8.2 + sourcerpm: systemd-252-67.el9_8.2.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/os/Packages/s/systemd-rpm-macros-252-67.el9_8.2.noarch.rpm repoid: rhel-9-for-s390x-baseos-rpms - size: 59475 - checksum: sha256:7d671ec39a7caeb7346be6d5fcb44212545844ced6f4974c4b409fef6a12a891 + size: 60014 + checksum: sha256:40414d69836b9e6b409c63ff8fa3b443321bfe5f5074e1ca90367d215f9b5afc name: systemd-rpm-macros - evr: 252-67.el9_8.4 - sourcerpm: systemd-252-67.el9_8.4.src.rpm + evr: 252-67.el9_8.2 + sourcerpm: systemd-252-67.el9_8.2.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/os/Packages/u/util-linux-2.37.4-25.el9.s390x.rpm repoid: rhel-9-for-s390x-baseos-rpms size: 2327681 @@ -875,30 +875,30 @@ arches: evr: 2.37.4-25.el9 sourcerpm: util-linux-2.37.4-25.el9.src.rpm source: - - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/appstream/source/SRPMS/Packages/l/libxslt-1.1.34-14.el9_8.1.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/appstream/source/SRPMS/Packages/l/libxslt-1.1.34-14.el9_7.1.src.rpm repoid: rhel-9-for-s390x-appstream-source-rpms - size: 3571429 - checksum: sha256:a63ad81bc1461ee56521e3b488b804cf2e43ec2b5dd5e7b3ab4bfe1e8a59d748 + size: 3567277 + checksum: sha256:52dfaf51f4dd59eeaf60b6b0c1a4ef41c83001f29568cd9d3521696ba3e50c3d name: libxslt - evr: 1.1.34-14.el9_8.1 - - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/appstream/source/SRPMS/Packages/o/openscap-1.3.14-1.el9_8.src.rpm + evr: 1.1.34-14.el9_7.1 + - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/appstream/source/SRPMS/Packages/o/openscap-1.3.13-1.el9_7.src.rpm repoid: rhel-9-for-s390x-appstream-source-rpms - size: 13993305 - checksum: sha256:850491a67daa1831f0364154c4282876c32e3d1216c4e3be3e6ca547086263de + size: 14017583 + checksum: sha256:c2a52d88b8aad4c7b7ce42ccd777e16e6a0248579f4a51d712f463e2ed84de49 name: openscap - evr: 1:1.3.14-1.el9_8 + evr: 1:1.3.13-1.el9_7 - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/appstream/source/SRPMS/Packages/x/xmlsec1-1.2.29-13.el9.src.rpm repoid: rhel-9-for-s390x-appstream-source-rpms size: 2000140 checksum: sha256:01d2e6c0c4eba0e55811eb91ba1e518d85dd8b4497d420f66d16d89f19328dc7 name: xmlsec1 evr: 1.2.29-13.el9 - - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/source/SRPMS/Packages/a/acl-2.4.0-1.el9_8.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/source/SRPMS/Packages/a/acl-2.3.1-4.el9.src.rpm repoid: rhel-9-for-s390x-baseos-source-rpms - size: 609918 - checksum: sha256:b140deb68f46517b0093e18969d8fb42a17216064fb2ee5783e9316d786430db + size: 535332 + checksum: sha256:cb449bc6c85e0b50fa0bb98c969ff8481fee40517d8ebec5e28b72e5360fbe1e name: acl - evr: 2.4.0-1.el9_8 + evr: 2.3.1-4.el9 - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/source/SRPMS/Packages/c/cracklib-2.9.6-28.el9.src.rpm repoid: rhel-9-for-s390x-baseos-source-rpms size: 6416053 @@ -965,12 +965,12 @@ arches: checksum: sha256:e48843d2734fefad084a86165860ea9575bdc53f63bb5845d8807ce9ccb4f914 name: libutempter evr: 1.2.1-6.el9 - - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/source/SRPMS/Packages/o/openssl-3.5.5-6.el9_8.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/source/SRPMS/Packages/o/openssl-3.5.5-3.el9_8.src.rpm repoid: rhel-9-for-s390x-baseos-source-rpms - size: 53369050 - checksum: sha256:b79f08d2d04536fdb6801b6ba7da7174942d174dd2b7969316402c737689d735 + size: 53324097 + checksum: sha256:6dcf0fd27d46993ee08de288fd4ef2387c4a5cd28925e78c7449403f6459ddbd name: openssl - evr: 1:3.5.5-6.el9_8 + evr: 1:3.5.5-3.el9_8 - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/source/SRPMS/Packages/p/pam-1.5.1-28.el9.src.rpm repoid: rhel-9-for-s390x-baseos-source-rpms size: 1133226 @@ -983,12 +983,12 @@ arches: checksum: sha256:acfd5c270ba5724a0f5f2a84cc47ee222d6a03095421fddbf6932375ec7d67f0 name: procps-ng evr: 3.3.17-14.el9 - - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/source/SRPMS/Packages/s/systemd-252-67.el9_8.4.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/source/SRPMS/Packages/s/systemd-252-67.el9_8.2.src.rpm repoid: rhel-9-for-s390x-baseos-source-rpms - size: 45009674 - checksum: sha256:e44181d1de2a135a5507b956d18a9eb11951a35aaa9c15dbc0f144ed8313f732 + size: 45000069 + checksum: sha256:d35c895dc3fabebd933fe61f6d6c7f12c02809e8d0324ecb66acb945525a39d5 name: systemd - evr: 252-67.el9_8.4 + evr: 252-67.el9_8.2 - url: https://cdn.redhat.com/content/dist/rhel9/9/s390x/baseos/source/SRPMS/Packages/u/util-linux-2.37.4-25.el9.src.rpm repoid: rhel-9-for-s390x-baseos-source-rpms size: 6291867 @@ -998,27 +998,27 @@ arches: module_metadata: [] - arch: x86_64 packages: - - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/appstream/os/Packages/l/libxslt-1.1.34-14.el9_8.1.x86_64.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/appstream/os/Packages/l/libxslt-1.1.34-14.el9_7.1.x86_64.rpm repoid: rhel-9-for-x86_64-appstream-rpms - size: 254411 - checksum: sha256:b702d5bdce34b424959427b728e319b17747a5a1249be5f908264c5cfcbddf38 + size: 254259 + checksum: sha256:d92873a046c78ae6837d8b23deecbfa1d6376b81bf587382e89ed345c1d5bad5 name: libxslt - evr: 1.1.34-14.el9_8.1 - sourcerpm: libxslt-1.1.34-14.el9_8.1.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/appstream/os/Packages/o/openscap-1.3.14-1.el9_8.x86_64.rpm + evr: 1.1.34-14.el9_7.1 + sourcerpm: libxslt-1.1.34-14.el9_7.1.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/appstream/os/Packages/o/openscap-1.3.13-1.el9_7.x86_64.rpm repoid: rhel-9-for-x86_64-appstream-rpms - size: 2163279 - checksum: sha256:b8c196355ff8e9d5fb90f4fda509a81a226ef8bf368aa6bc0ca0a0431f97804e + size: 2147593 + checksum: sha256:d64df72174b8d92e373ba11ae266cde687153e485db9f333276ac33d2218b9e1 name: openscap - evr: 1:1.3.14-1.el9_8 - sourcerpm: openscap-1.3.14-1.el9_8.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/appstream/os/Packages/o/openscap-scanner-1.3.14-1.el9_8.x86_64.rpm + evr: 1:1.3.13-1.el9_7 + sourcerpm: openscap-1.3.13-1.el9_7.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/appstream/os/Packages/o/openscap-scanner-1.3.13-1.el9_7.x86_64.rpm repoid: rhel-9-for-x86_64-appstream-rpms - size: 65040 - checksum: sha256:40e80709084f2a687f24151f17b5238a2471fe20a63610c22bd13019bf3f44d9 + size: 58911 + checksum: sha256:c1b8d19ada54ce1f782e9db07613585c7c98b191d6bcfae9ffb8af397749e33f name: openscap-scanner - evr: 1:1.3.14-1.el9_8 - sourcerpm: openscap-1.3.14-1.el9_8.src.rpm + evr: 1:1.3.13-1.el9_7 + sourcerpm: openscap-1.3.13-1.el9_7.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/appstream/os/Packages/x/xmlsec1-1.2.29-13.el9.x86_64.rpm repoid: rhel-9-for-x86_64-appstream-rpms size: 196578 @@ -1033,13 +1033,13 @@ arches: name: xmlsec1-openssl evr: 1.2.29-13.el9 sourcerpm: xmlsec1-1.2.29-13.el9.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/os/Packages/a/acl-2.4.0-1.el9_8.x86_64.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/os/Packages/a/acl-2.3.1-4.el9.x86_64.rpm repoid: rhel-9-for-x86_64-baseos-rpms - size: 85269 - checksum: sha256:611da2c85401a2f26dba165c0be27b2e62fa71ceb5c392c8f5a9d30c31238d5b + size: 77226 + checksum: sha256:150d7232faa90f84a09268f8998ee32670eef59cba98612aeb996ab75c4dfcc4 name: acl - evr: 2.4.0-1.el9_8 - sourcerpm: acl-2.4.0-1.el9_8.src.rpm + evr: 2.3.1-4.el9 + sourcerpm: acl-2.3.1-4.el9.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/os/Packages/c/cracklib-2.9.6-28.el9.x86_64.rpm repoid: rhel-9-for-x86_64-baseos-rpms size: 102444 @@ -1145,13 +1145,13 @@ arches: name: libutempter evr: 1.2.1-6.el9 sourcerpm: libutempter-1.2.1-6.el9.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/os/Packages/o/openssl-3.5.5-6.el9_8.x86_64.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/os/Packages/o/openssl-3.5.5-3.el9_8.x86_64.rpm repoid: rhel-9-for-x86_64-baseos-rpms - size: 1564334 - checksum: sha256:1c502507f42674119318b66b111448f618efe2767a55edde5fadddcecb47ac64 + size: 1563561 + checksum: sha256:7bfbc78ae617d7d276c4708bbcbce2cd98b88aef0b8155b784f69dcd17d1b0a5 name: openssl - evr: 1:3.5.5-6.el9_8 - sourcerpm: openssl-3.5.5-6.el9_8.src.rpm + evr: 1:3.5.5-3.el9_8 + sourcerpm: openssl-3.5.5-3.el9_8.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/os/Packages/p/pam-1.5.1-28.el9.x86_64.rpm repoid: rhel-9-for-x86_64-baseos-rpms size: 637912 @@ -1166,27 +1166,27 @@ arches: name: procps-ng evr: 3.3.17-14.el9 sourcerpm: procps-ng-3.3.17-14.el9.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/os/Packages/s/systemd-252-67.el9_8.4.x86_64.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/os/Packages/s/systemd-252-67.el9_8.2.x86_64.rpm repoid: rhel-9-for-x86_64-baseos-rpms - size: 4401138 - checksum: sha256:e3cbe70aaa847f1b02bd4ea9470625434c26b25368cbfcb0e9a18de99e3bc1c7 + size: 4397848 + checksum: sha256:fa993eb11a345c8082b75bd989b7f81d9c15232c4424892256ca479f65bbaee1 name: systemd - evr: 252-67.el9_8.4 - sourcerpm: systemd-252-67.el9_8.4.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/os/Packages/s/systemd-pam-252-67.el9_8.4.x86_64.rpm + evr: 252-67.el9_8.2 + sourcerpm: systemd-252-67.el9_8.2.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/os/Packages/s/systemd-pam-252-67.el9_8.2.x86_64.rpm repoid: rhel-9-for-x86_64-baseos-rpms - size: 276960 - checksum: sha256:de8408dbe8ee06afa99fbb914377384774e27b9b337cb3b491a37f84ccca7e9b + size: 277510 + checksum: sha256:8595b54b71be77fafbbbfd5f40d8afd26d489094955979c0cad486e809f99667 name: systemd-pam - evr: 252-67.el9_8.4 - sourcerpm: systemd-252-67.el9_8.4.src.rpm - - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/os/Packages/s/systemd-rpm-macros-252-67.el9_8.4.noarch.rpm + evr: 252-67.el9_8.2 + sourcerpm: systemd-252-67.el9_8.2.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/os/Packages/s/systemd-rpm-macros-252-67.el9_8.2.noarch.rpm repoid: rhel-9-for-x86_64-baseos-rpms - size: 59475 - checksum: sha256:7d671ec39a7caeb7346be6d5fcb44212545844ced6f4974c4b409fef6a12a891 + size: 60014 + checksum: sha256:40414d69836b9e6b409c63ff8fa3b443321bfe5f5074e1ca90367d215f9b5afc name: systemd-rpm-macros - evr: 252-67.el9_8.4 - sourcerpm: systemd-252-67.el9_8.4.src.rpm + evr: 252-67.el9_8.2 + sourcerpm: systemd-252-67.el9_8.2.src.rpm - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/os/Packages/u/util-linux-2.37.4-25.el9.x86_64.rpm repoid: rhel-9-for-x86_64-baseos-rpms size: 2382511 @@ -1202,30 +1202,30 @@ arches: evr: 2.37.4-25.el9 sourcerpm: util-linux-2.37.4-25.el9.src.rpm source: - - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/appstream/source/SRPMS/Packages/l/libxslt-1.1.34-14.el9_8.1.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/appstream/source/SRPMS/Packages/l/libxslt-1.1.34-14.el9_7.1.src.rpm repoid: rhel-9-for-x86_64-appstream-source-rpms - size: 3571429 - checksum: sha256:a63ad81bc1461ee56521e3b488b804cf2e43ec2b5dd5e7b3ab4bfe1e8a59d748 + size: 3567277 + checksum: sha256:52dfaf51f4dd59eeaf60b6b0c1a4ef41c83001f29568cd9d3521696ba3e50c3d name: libxslt - evr: 1.1.34-14.el9_8.1 - - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/appstream/source/SRPMS/Packages/o/openscap-1.3.14-1.el9_8.src.rpm + evr: 1.1.34-14.el9_7.1 + - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/appstream/source/SRPMS/Packages/o/openscap-1.3.13-1.el9_7.src.rpm repoid: rhel-9-for-x86_64-appstream-source-rpms - size: 13993305 - checksum: sha256:850491a67daa1831f0364154c4282876c32e3d1216c4e3be3e6ca547086263de + size: 14017583 + checksum: sha256:c2a52d88b8aad4c7b7ce42ccd777e16e6a0248579f4a51d712f463e2ed84de49 name: openscap - evr: 1:1.3.14-1.el9_8 + evr: 1:1.3.13-1.el9_7 - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/appstream/source/SRPMS/Packages/x/xmlsec1-1.2.29-13.el9.src.rpm repoid: rhel-9-for-x86_64-appstream-source-rpms size: 2000140 checksum: sha256:01d2e6c0c4eba0e55811eb91ba1e518d85dd8b4497d420f66d16d89f19328dc7 name: xmlsec1 evr: 1.2.29-13.el9 - - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/source/SRPMS/Packages/a/acl-2.4.0-1.el9_8.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/source/SRPMS/Packages/a/acl-2.3.1-4.el9.src.rpm repoid: rhel-9-for-x86_64-baseos-source-rpms - size: 609918 - checksum: sha256:b140deb68f46517b0093e18969d8fb42a17216064fb2ee5783e9316d786430db + size: 535332 + checksum: sha256:cb449bc6c85e0b50fa0bb98c969ff8481fee40517d8ebec5e28b72e5360fbe1e name: acl - evr: 2.4.0-1.el9_8 + evr: 2.3.1-4.el9 - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/source/SRPMS/Packages/c/cracklib-2.9.6-28.el9.src.rpm repoid: rhel-9-for-x86_64-baseos-source-rpms size: 6416053 @@ -1292,12 +1292,12 @@ arches: checksum: sha256:e48843d2734fefad084a86165860ea9575bdc53f63bb5845d8807ce9ccb4f914 name: libutempter evr: 1.2.1-6.el9 - - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/source/SRPMS/Packages/o/openssl-3.5.5-6.el9_8.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/source/SRPMS/Packages/o/openssl-3.5.5-3.el9_8.src.rpm repoid: rhel-9-for-x86_64-baseos-source-rpms - size: 53369050 - checksum: sha256:b79f08d2d04536fdb6801b6ba7da7174942d174dd2b7969316402c737689d735 + size: 53324097 + checksum: sha256:6dcf0fd27d46993ee08de288fd4ef2387c4a5cd28925e78c7449403f6459ddbd name: openssl - evr: 1:3.5.5-6.el9_8 + evr: 1:3.5.5-3.el9_8 - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/source/SRPMS/Packages/p/pam-1.5.1-28.el9.src.rpm repoid: rhel-9-for-x86_64-baseos-source-rpms size: 1133226 @@ -1310,12 +1310,12 @@ arches: checksum: sha256:acfd5c270ba5724a0f5f2a84cc47ee222d6a03095421fddbf6932375ec7d67f0 name: procps-ng evr: 3.3.17-14.el9 - - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/source/SRPMS/Packages/s/systemd-252-67.el9_8.4.src.rpm + - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/source/SRPMS/Packages/s/systemd-252-67.el9_8.2.src.rpm repoid: rhel-9-for-x86_64-baseos-source-rpms - size: 45009674 - checksum: sha256:e44181d1de2a135a5507b956d18a9eb11951a35aaa9c15dbc0f144ed8313f732 + size: 45000069 + checksum: sha256:d35c895dc3fabebd933fe61f6d6c7f12c02809e8d0324ecb66acb945525a39d5 name: systemd - evr: 252-67.el9_8.4 + evr: 252-67.el9_8.2 - url: https://cdn.redhat.com/content/dist/rhel9/9/x86_64/baseos/source/SRPMS/Packages/u/util-linux-2.37.4-25.el9.src.rpm repoid: rhel-9-for-x86_64-baseos-source-rpms size: 6291867 diff --git a/images/operator/Dockerfile b/images/operator/Dockerfile index 5356291a5f..7693ada957 100644 --- a/images/operator/Dockerfile +++ b/images/operator/Dockerfile @@ -1,4 +1,4 @@ -FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:v1.25.11 as builder +FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:v1.25.8 as builder WORKDIR /go/src/github.com/ComplianceAsCode/compliance-operator diff --git a/pkg/celcontent/bundler.go b/pkg/celcontent/bundler.go index 1f861078c0..1b25f4bc59 100644 --- a/pkg/celcontent/bundler.go +++ b/pkg/celcontent/bundler.go @@ -142,11 +142,6 @@ func loadRules(dir string) ([]CELRuleContent, error) { if rule.Name == "" { return nil, fmt.Errorf("rule in %s has no name", f) } - if rule.Expression == "" && len(rule.Inputs) == 0 { - // Manual rule — no automated check, skip validation - rules = append(rules, rule) - continue - } if rule.Expression == "" { return nil, fmt.Errorf("rule %q in %s has no expression", rule.Name, f) } diff --git a/pkg/celcontent/bundler_test.go b/pkg/celcontent/bundler_test.go index c83f533610..d0bfbc7e78 100644 --- a/pkg/celcontent/bundler_test.go +++ b/pkg/celcontent/bundler_test.go @@ -313,73 +313,6 @@ func TestBundleFromDirs_MissingFields(t *testing.T) { } } -func TestBundleFromDirs_ManualRule(t *testing.T) { - dir := t.TempDir() - rulesDir := filepath.Join(dir, "rules") - profilesDir := filepath.Join(dir, "profiles") - os.MkdirAll(rulesDir, 0755) - os.MkdirAll(profilesDir, 0755) - - celRuleYAML := `name: cel-rule -id: cel_rule -title: CEL Rule -severity: medium -checkType: Platform -expression: "x.items.size() > 0" -inputs: - - name: x - kubernetesInputSpec: - apiVersion: v1 - resource: pods -` - manualRuleYAML := `name: manual-rule -id: manual_rule -title: Manual Rule -severity: medium -checkType: Platform -` - os.WriteFile(filepath.Join(rulesDir, "cel.yaml"), []byte(celRuleYAML), 0644) - os.WriteFile(filepath.Join(rulesDir, "manual.yaml"), []byte(manualRuleYAML), 0644) - - profileYAML := `name: p -id: p_id -title: P -rules: - - cel-rule - - manual-rule -` - os.WriteFile(filepath.Join(profilesDir, "p.yaml"), []byte(profileYAML), 0644) - - bundle, err := BundleFromDirs(rulesDir, profilesDir) - if err != nil { - t.Fatalf("BundleFromDirs failed: %v", err) - } - if len(bundle.Rules) != 2 { - t.Fatalf("Expected 2 rules (CEL + manual), got %d", len(bundle.Rules)) - } - - ruleMap := make(map[string]CELRuleContent) - for _, r := range bundle.Rules { - ruleMap[r.Name] = r - } - - celRule := ruleMap["cel-rule"] - if celRule.Expression == "" { - t.Error("CEL rule should have expression") - } - if len(celRule.Inputs) == 0 { - t.Error("CEL rule should have inputs") - } - - manualRule := ruleMap["manual-rule"] - if manualRule.Expression != "" { - t.Errorf("Manual rule should have empty expression, got %q", manualRule.Expression) - } - if len(manualRule.Inputs) != 0 { - t.Errorf("Manual rule should have no inputs, got %d", len(manualRule.Inputs)) - } -} - func TestBundleFromDirs_EmptyProfile(t *testing.T) { dir := t.TempDir() rulesDir := filepath.Join(dir, "rules") diff --git a/pkg/profileparser/cel_content.go b/pkg/profileparser/cel_content.go index b247c9fabb..9e4d8eb357 100644 --- a/pkg/profileparser/cel_content.go +++ b/pkg/profileparser/cel_content.go @@ -121,12 +121,10 @@ func ParseCELBundle(celPath string, pb *cmpv1alpha1.ProfileBundle, pcfg *ParserC Instructions: celRule.Instructions, } - // Validate CEL expression at parse time (skip for rules without expressions) - if rulePayload.Expression != "" { - if err := celvalidation.ValidateCELRule(celRule.Name, &rulePayload); err != nil { - errChan <- fmt.Errorf("CEL rule '%s' validation failed: %w", celRule.Name, err) - return - } + // Validate CEL expression at parse time + if err := celvalidation.ValidateCELRule(celRule.Name, &rulePayload); err != nil { + errChan <- fmt.Errorf("CEL rule '%s' validation failed: %w", celRule.Name, err) + return } annotations := map[string]string{ diff --git a/pkg/profileparser/cel_content_test.go b/pkg/profileparser/cel_content_test.go index cb062abc50..a4c05fc688 100644 --- a/pkg/profileparser/cel_content_test.go +++ b/pkg/profileparser/cel_content_test.go @@ -384,92 +384,6 @@ func TestCELBundleCISVMExtension(t *testing.T) { var _ = Describe("ParseCELBundle integration", func() { const pbName = "cel-e2e-pb" - It("accepts manual rules without expressions and creates Rule CRs", func() { - bundleYAML := `rules: - - name: cel-rule - id: cel_rule - title: CEL Rule - description: A rule with CEL checks - rationale: Testing - severity: medium - checkType: Platform - expression: "pods.items.size() > 0" - inputs: - - name: pods - kubernetesInputSpec: - apiVersion: v1 - resource: pods - - name: manual-rule - id: manual_rule - title: Manual Rule - description: A rule without automated checks - rationale: Requires manual verification - severity: medium - checkType: Platform - instructions: Run oc adm policy who-can create vmim -profiles: - - name: test-profile - id: test_profile - title: Test Profile - productType: Platform - rules: - - cel-rule - - manual-rule -` - outPath := filepath.Join(GinkgoT().TempDir(), "manual-bundle.yaml") - Expect(os.WriteFile(outPath, []byte(bundleYAML), 0644)).To(Succeed()) - - pb := &cmpv1alpha1.ProfileBundle{ - ObjectMeta: metav1.ObjectMeta{ - Name: pbName, - Namespace: testNamespace, - }, - } - Expect(client.Create(context.TODO(), pb)).To(Succeed()) - defer client.Delete(context.TODO(), pb) - - pcfg := &ParserConfig{ - Client: client, - Scheme: client.Scheme(), - } - - err := ParseCELBundle(outPath, pb, pcfg) - Expect(err).NotTo(HaveOccurred()) - - // Verify CEL rule CR was created with expression - celRule := &cmpv1alpha1.Rule{} - Expect(client.Get(context.TODO(), types.NamespacedName{ - Name: GetPrefixedName(pbName, "cel-rule"), - Namespace: testNamespace, - }, celRule)).To(Succeed()) - Expect(celRule.RulePayload.Expression).NotTo(BeEmpty()) - Expect(celRule.RulePayload.Inputs).To(HaveLen(1)) - - // Verify manual rule CR was created without expression - manualRule := &cmpv1alpha1.Rule{} - Expect(client.Get(context.TODO(), types.NamespacedName{ - Name: GetPrefixedName(pbName, "manual-rule"), - Namespace: testNamespace, - }, manualRule)).To(Succeed()) - Expect(manualRule.RulePayload.Expression).To(BeEmpty()) - Expect(manualRule.RulePayload.Inputs).To(BeEmpty()) - Expect(manualRule.RulePayload.Instructions).To(ContainSubstring("who-can")) - Expect(manualRule.RulePayload.ScannerType).To(Equal(cmpv1alpha1.ScannerTypeCEL)) - - // Verify profile references both rules - profile := &cmpv1alpha1.Profile{} - Expect(client.Get(context.TODO(), types.NamespacedName{ - Name: GetPrefixedName(pbName, "test-profile"), - Namespace: testNamespace, - }, profile)).To(Succeed()) - Expect(profile.Rules).To(HaveLen(2)) - - // Cleanup - client.Delete(context.TODO(), celRule) - client.Delete(context.TODO(), manualRule) - client.Delete(context.TODO(), profile) - }) - It("creates Rule and Profile CRs from bundler-generated file", func() { outPath := filepath.Join(GinkgoT().TempDir(), "cel-bundle.yaml") Expect(celcontent.BundleToFile(celTestRulesDir, celTestProfilesDir, outPath)).To(Succeed()) diff --git a/vendor/github.com/go-logr/logr/context_noslog.go b/vendor/github.com/go-logr/logr/context_noslog.go index 0a3d1a125e..f012f9a18e 100644 --- a/vendor/github.com/go-logr/logr/context_noslog.go +++ b/vendor/github.com/go-logr/logr/context_noslog.go @@ -1,4 +1,5 @@ //go:build !go1.21 +// +build !go1.21 /* Copyright 2019 The logr Authors. diff --git a/vendor/github.com/go-logr/logr/context_slog.go b/vendor/github.com/go-logr/logr/context_slog.go index c69eb01ba1..065ef0b828 100644 --- a/vendor/github.com/go-logr/logr/context_slog.go +++ b/vendor/github.com/go-logr/logr/context_slog.go @@ -1,4 +1,5 @@ //go:build go1.21 +// +build go1.21 /* Copyright 2019 The logr Authors. diff --git a/vendor/github.com/go-logr/logr/funcr/funcr.go b/vendor/github.com/go-logr/logr/funcr/funcr.go index 7f4996e9e4..b22c57d713 100644 --- a/vendor/github.com/go-logr/logr/funcr/funcr.go +++ b/vendor/github.com/go-logr/logr/funcr/funcr.go @@ -426,7 +426,7 @@ func (f Formatter) colon() byte { } func (f Formatter) pretty(value any) string { - return f.prettyWithFlags(value, 0, 0, 0, nil) + return f.prettyWithFlags(value, 0, 0) } const ( @@ -434,13 +434,7 @@ const ( ) // TODO: This is not fast. Most of the overhead goes here. -// value: The value to render -// flags: Bitmask of flags (see above) -// depth: The current depth of nested structs, slices, arrays, and maps -// ptrDepth: The current depth of including pointer dereferences -// ptrMap: A map of pointers already seen, to avoid infinite recursion (usually -// nil unless ptrDepth is large) -func (f Formatter) prettyWithFlags(value any, flags uint32, depth int, ptrDepth int, ptrMap map[uintptr]bool) string { +func (f Formatter) prettyWithFlags(value any, flags uint32, depth int) string { if depth > f.opts.MaxLogDepth { return `""` } @@ -510,7 +504,7 @@ func (f Formatter) prettyWithFlags(value any, flags uint32, depth int, ptrDepth // arbitrary keys might need escaping buf.WriteString(prettyString(k)) buf.WriteByte(f.colon()) - buf.WriteString(f.prettyWithFlags(v[i+1], 0, depth+1, ptrDepth+1, ptrMap)) + buf.WriteString(f.prettyWithFlags(v[i+1], 0, depth+1)) } if flags&flagRawStruct == 0 { buf.WriteByte('}') @@ -582,7 +576,7 @@ func (f Formatter) prettyWithFlags(value any, flags uint32, depth int, ptrDepth } printComma = true // if we got here, we are rendering a field if fld.Anonymous && fld.Type.Kind() == reflect.Struct && name == "" { - buf.WriteString(f.prettyWithFlags(v.Field(i).Interface(), flags|flagRawStruct, depth+1, ptrDepth+1, ptrMap)) + buf.WriteString(f.prettyWithFlags(v.Field(i).Interface(), flags|flagRawStruct, depth+1)) continue } if name == "" { @@ -591,7 +585,7 @@ func (f Formatter) prettyWithFlags(value any, flags uint32, depth int, ptrDepth // field names can't contain characters which need escaping buf.WriteString(f.quoted(name, false)) buf.WriteByte(f.colon()) - buf.WriteString(f.prettyWithFlags(v.Field(i).Interface(), 0, depth+1, ptrDepth+1, ptrMap)) + buf.WriteString(f.prettyWithFlags(v.Field(i).Interface(), 0, depth+1)) } if flags&flagRawStruct == 0 { buf.WriteByte('}') @@ -618,7 +612,7 @@ func (f Formatter) prettyWithFlags(value any, flags uint32, depth int, ptrDepth buf.WriteByte(f.comma()) } e := v.Index(i) - buf.WriteString(f.prettyWithFlags(e.Interface(), 0, depth+1, ptrDepth+1, ptrMap)) + buf.WriteString(f.prettyWithFlags(e.Interface(), 0, depth+1)) } buf.WriteByte(']') return buf.String() @@ -643,8 +637,7 @@ func (f Formatter) prettyWithFlags(value any, flags uint32, depth int, ptrDepth keystr = prettyString(keystr) } else { // prettyWithFlags will produce already-escaped values - // key depth is unrelated to overall depth - keystr = f.prettyWithFlags(it.Key().Interface(), 0, 0, ptrDepth, ptrMap) + keystr = f.prettyWithFlags(it.Key().Interface(), 0, depth+1) if t.Key().Kind() != reflect.String { // JSON only does string keys. Unlike Go's standard JSON, we'll // convert just about anything to a string. @@ -653,34 +646,16 @@ func (f Formatter) prettyWithFlags(value any, flags uint32, depth int, ptrDepth } buf.WriteString(keystr) buf.WriteByte(f.colon()) - buf.WriteString(f.prettyWithFlags(it.Value().Interface(), 0, depth+1, ptrDepth+1, ptrMap)) + buf.WriteString(f.prettyWithFlags(it.Value().Interface(), 0, depth+1)) i++ } buf.WriteByte('}') return buf.String() - case reflect.Pointer, reflect.Interface: + case reflect.Ptr, reflect.Interface: if v.IsNil() { return "null" } - // Special case: recursive pointers. For normal use we do not want to - // count pointer dereferences as depth, but if we see the same pointer - // again we have a recursion and need to stop. After a large number of - // pointer dereferences we will start tracking pointers to avoid the - // perf hit of doing it in the normal path. - // - // This should not happen accidentally (e.g. json decoding should never - // do this) but we can handle it gracefully. - if ptrMap != nil && ptrMap[uintptr(v.Pointer())] { - depth = f.opts.MaxLogDepth + 1 // force a depth error - } - const maxDepthFactor = 4 // arbitrary, but we want it large enough to not false-alert - if ptrDepth > f.opts.MaxLogDepth*maxDepthFactor && ptrMap == nil { - ptrMap = map[uintptr]bool{} - } - if ptrMap != nil { - ptrMap[(uintptr)(v.Pointer())] = true - } - return f.prettyWithFlags(v.Elem().Interface(), 0, depth, ptrDepth+1, ptrMap) + return f.prettyWithFlags(v.Elem().Interface(), 0, depth) } return fmt.Sprintf(`""`, t.Kind().String()) } @@ -722,7 +697,7 @@ func isEmpty(v reflect.Value) bool { return v.Float() == 0 case reflect.Complex64, reflect.Complex128: return v.Complex() == 0 - case reflect.Interface, reflect.Pointer: + case reflect.Interface, reflect.Ptr: return v.IsNil() } return false diff --git a/vendor/github.com/go-logr/logr/funcr/slogsink.go b/vendor/github.com/go-logr/logr/funcr/slogsink.go index 8b519c91e1..7bd84761e2 100644 --- a/vendor/github.com/go-logr/logr/funcr/slogsink.go +++ b/vendor/github.com/go-logr/logr/funcr/slogsink.go @@ -1,4 +1,5 @@ //go:build go1.21 +// +build go1.21 /* Copyright 2023 The logr Authors. @@ -32,7 +33,7 @@ const extraSlogSinkDepth = 3 // 2 for slog, 1 for SlogSink func (l fnlogger) Handle(_ context.Context, record slog.Record) error { kvList := make([]any, 0, 2*record.NumAttrs()) record.Attrs(func(attr slog.Attr) bool { - kvList = attrToKVs(attr, kvList, l.opts.MaxLogDepth) + kvList = attrToKVs(attr, kvList) return true }) @@ -48,7 +49,7 @@ func (l fnlogger) Handle(_ context.Context, record slog.Record) error { func (l fnlogger) WithAttrs(attrs []slog.Attr) logr.SlogSink { kvList := make([]any, 0, 2*len(attrs)) for _, attr := range attrs { - kvList = attrToKVs(attr, kvList, l.opts.MaxLogDepth) + kvList = attrToKVs(attr, kvList) } l.AddValues(kvList) return &l @@ -60,25 +61,14 @@ func (l fnlogger) WithGroup(name string) logr.SlogSink { } // attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups -// and other details of slog. maxDepth bounds recursion into nested groups so a -// deeply-nested slog.Group cannot exhaust the stack; it is decremented per group -// level and starts at the Formatter's MaxLogDepth (past which the formatter would -// truncate the rendering anyway). -func attrToKVs(attr slog.Attr, kvList []any, maxDepth int) []any { +// and other details of slog. +func attrToKVs(attr slog.Attr, kvList []any) []any { attrVal := attr.Value.Resolve() if attrVal.Kind() == slog.KindGroup { - if maxDepth <= 0 { - // Nesting is too deep to build without risking a stack overflow. - // Stop here; the formatter truncates below MaxLogDepth regardless. - if attr.Key != "" { - kvList = append(kvList, attr.Key, "") - } - return kvList - } groupVal := attrVal.Group() grpKVs := make([]any, 0, 2*len(groupVal)) for _, attr := range groupVal { - grpKVs = attrToKVs(attr, grpKVs, maxDepth-1) + grpKVs = attrToKVs(attr, grpKVs) } if attr.Key == "" { // slog says we have to inline these diff --git a/vendor/github.com/go-logr/logr/sloghandler.go b/vendor/github.com/go-logr/logr/sloghandler.go index befaf5510f..82d1ba4948 100644 --- a/vendor/github.com/go-logr/logr/sloghandler.go +++ b/vendor/github.com/go-logr/logr/sloghandler.go @@ -1,4 +1,5 @@ //go:build go1.21 +// +build go1.21 /* Copyright 2023 The logr Authors. diff --git a/vendor/github.com/go-logr/logr/slogr.go b/vendor/github.com/go-logr/logr/slogr.go index bfe80eb8d6..28a83d0243 100644 --- a/vendor/github.com/go-logr/logr/slogr.go +++ b/vendor/github.com/go-logr/logr/slogr.go @@ -1,4 +1,5 @@ //go:build go1.21 +// +build go1.21 /* Copyright 2023 The logr Authors. diff --git a/vendor/github.com/go-logr/logr/slogr/slogr.go b/vendor/github.com/go-logr/logr/slogr/slogr.go index 933e715b27..36432c56fd 100644 --- a/vendor/github.com/go-logr/logr/slogr/slogr.go +++ b/vendor/github.com/go-logr/logr/slogr/slogr.go @@ -1,4 +1,5 @@ //go:build go1.21 +// +build go1.21 /* Copyright 2023 The logr Authors. diff --git a/vendor/github.com/go-logr/logr/slogsink.go b/vendor/github.com/go-logr/logr/slogsink.go index ab76ea99fe..4060fcbc2b 100644 --- a/vendor/github.com/go-logr/logr/slogsink.go +++ b/vendor/github.com/go-logr/logr/slogsink.go @@ -1,4 +1,5 @@ //go:build go1.21 +// +build go1.21 /* Copyright 2023 The logr Authors. diff --git a/vendor/github.com/go-openapi/jsonpointer/.golangci.yml b/vendor/github.com/go-openapi/jsonpointer/.golangci.yml index 9d2733176e..dc7c96053d 100644 --- a/vendor/github.com/go-openapi/jsonpointer/.golangci.yml +++ b/vendor/github.com/go-openapi/jsonpointer/.golangci.yml @@ -4,10 +4,7 @@ linters: disable: - depguard - funlen - - goconst - godox - - gomodguard - - gomodguard_v2 - exhaustruct - nlreturn - nonamedreturns diff --git a/vendor/github.com/go-openapi/jsonpointer/CONTRIBUTORS.md b/vendor/github.com/go-openapi/jsonpointer/CONTRIBUTORS.md index de0bf5c04b..9990f4a354 100644 --- a/vendor/github.com/go-openapi/jsonpointer/CONTRIBUTORS.md +++ b/vendor/github.com/go-openapi/jsonpointer/CONTRIBUTORS.md @@ -4,21 +4,21 @@ | Total Contributors | Total Contributions | | --- | --- | -| 13 | 132 | +| 13 | 111 | | Username | All Time Contribution Count | All Commits | | --- | --- | --- | -| @fredbi | 83 | | +| @fredbi | 63 | | | @casualjim | 33 | | | @magodo | 3 | | | @youyuanwu | 3 | | -| @alexandear | 2 | | | @gaiaz-iusipov | 1 | | | @gbjk | 1 | | | @gordallott | 1 | | | @ianlancetaylor | 1 | | | @mfleader | 1 | | | @Neo2308 | 1 | | +| @alexandear | 1 | | | @olivierlemasle | 1 | | | @testwill | 1 | | diff --git a/vendor/github.com/go-openapi/jsonpointer/README.md b/vendor/github.com/go-openapi/jsonpointer/README.md index 6e7929c64b..24fbe1bf68 100644 --- a/vendor/github.com/go-openapi/jsonpointer/README.md +++ b/vendor/github.com/go-openapi/jsonpointer/README.md @@ -16,14 +16,6 @@ An implementation of JSON Pointer for golang, which supports go `struct`. ## Announcements -* **2026-07-07** : landing v1.0.0 - * stable API pledge - -* **2026-06-29** : reinsourced external dependency to swag (v0.24.0) - * module `github.com/go-openapi/swag/jsonname` is source directly here, so we no longer have any external dependency - * `jsonname` was never really used by any other package, so it makes sense to deprecate it away from the `swag` family - and retrofit its functionality here. `jsonpointer` no longer get external dependencies, besides test dependencies. - * **2026-04-15** : added support for trailing "-" for arrays (v0.23.0) * this brings full support of [RFC6901][RFC6901] * this is supported for types relying on the reflection-based implemented @@ -38,13 +30,12 @@ An implementation of JSON Pointer for golang, which supports go `struct`. * the default name provider in use is not fully aligned with go JSON stdlib * exposed an option (or global setting) to change the provider that resolves a struct into json keys * the default behavior is not altered + * a new alternate name provider is added (imported from `go-openapi/swag/jsonname`), aligned with JSON stdlib behavior ## Status API is stable and feature-complete. -The project continues to receive regular updates, bug fixes and hygiene maintenance (CI, linting, etc). - ## Import this library in your project ```cmd diff --git a/vendor/github.com/go-openapi/jsonpointer/errors.go b/vendor/github.com/go-openapi/jsonpointer/errors.go index 2ae6e3cfb3..8813474d44 100644 --- a/vendor/github.com/go-openapi/jsonpointer/errors.go +++ b/vendor/github.com/go-openapi/jsonpointer/errors.go @@ -21,15 +21,14 @@ const ( // ErrUnsupportedValueType indicates that a value of the wrong type is being set. ErrUnsupportedValueType pointerError = "only structs, pointers, maps and slices are supported for setting values" - // ErrDashToken indicates use of the RFC 6901 "-" reference token in a context where it cannot be - // resolved. + // ErrDashToken indicates use of the RFC 6901 "-" reference token + // in a context where it cannot be resolved. // - // Per RFC 6901 §4 the "-" token refers to the (nonexistent) element after the last array element. - // It may only be used as the terminal token of a [Pointer.Set] against a slice, where it means - // "append". - // - // Any other use (get, offset, intermediate traversal, non-slice target) is an error condition that - // wraps this sentinel. + // Per RFC 6901 §4 the "-" token refers to the (nonexistent) element + // after the last array element. It may only be used as the terminal + // token of a [Pointer.Set] against a slice, where it means "append". + // Any other use (get, offset, intermediate traversal, non-slice target) + // is an error condition that wraps this sentinel. ErrDashToken pointerError = `the "-" array token cannot be resolved here` //nolint:gosec // G101 false positive: this is a JSON Pointer reference token, not a credential. ) diff --git a/vendor/github.com/go-openapi/jsonpointer/ifaces.go b/vendor/github.com/go-openapi/jsonpointer/ifaces.go index 31359c48fa..1e56ac0442 100644 --- a/vendor/github.com/go-openapi/jsonpointer/ifaces.go +++ b/vendor/github.com/go-openapi/jsonpointer/ifaces.go @@ -5,42 +5,39 @@ package jsonpointer import "reflect" -// JSONPointable is an interface for structs to implement, when they need to customize the json -// pointer process or want to avoid the use of reflection. +// JSONPointable is an interface for structs to implement, +// when they need to customize the json pointer process or want to avoid the use of reflection. type JSONPointable interface { // JSONLookup returns a value pointed at this (unescaped) key. JSONLookup(key string) (any, error) } -// JSONSetable is an interface for structs to implement, when they need to customize the json -// pointer process or want to avoid the use of reflection. +// JSONSetable is an interface for structs to implement, +// when they need to customize the json pointer process or want to avoid the use of reflection. // // # Handling of the RFC 6901 "-" token // -// When a type implementing JSONSetable is the terminal parent of a [Pointer.Set] call, the library -// passes the raw reference token to JSONSet without interpretation. +// When a type implementing JSONSetable is the terminal parent of a [Pointer.Set] +// call, the library passes the raw reference token to JSONSet without +// interpretation. In particular, the RFC 6901 "-" token (which conventionally +// means "append" for arrays, per RFC 6902) is forwarded verbatim as the key +// argument. Implementations that model an array-like container are expected +// to give "-" the append semantics; implementations that do not should return +// an error wrapping [ErrDashToken] (or [ErrPointer]) for clarity. // -// In particular, the RFC 6901 "-" token (which conventionally means "append" for arrays, per RFC -// 6902) is forwarded verbatim as the key argument. -// -// Implementations that model an array-like container are expected to give "-" the append semantics; -// implementations that do not should return an error wrapping [ErrDashToken] (or [ErrPointer]) for -// clarity. -// -// Implementations are responsible for any in-place mutation: the library does not attempt to rebind -// the result of JSONSet into a parent container. +// Implementations are responsible for any in-place mutation: the library does +// not attempt to rebind the result of JSONSet into a parent container. type JSONSetable interface { // JSONSet sets the value pointed at the (unescaped) key. // - // The key may be the RFC 6901 "-" token when the pointer targets a slice-like member; see the - // interface documentation for details. + // The key may be the RFC 6901 "-" token when the pointer targets a + // slice-like member; see the interface documentation for details. JSONSet(key string, value any) error } // NameProvider knows how to resolve go struct fields into json names. // -// The default provider is brought by -// [github.com/go-openapi/jsonpointer/jsonname.DefaultJSONNameProvider]. +// The default provider is brought by [github.com/go-openapi/swag/jsonname.DefaultJSONNameProvider]. type NameProvider interface { // GetGoName gets the go name for a json property name GetGoName(subject any, name string) (string, bool) diff --git a/vendor/github.com/go-openapi/jsonpointer/options.go b/vendor/github.com/go-openapi/jsonpointer/options.go index 223c1e5ff0..d52caab222 100644 --- a/vendor/github.com/go-openapi/jsonpointer/options.go +++ b/vendor/github.com/go-openapi/jsonpointer/options.go @@ -6,7 +6,7 @@ package jsonpointer import ( "sync" - "github.com/go-openapi/jsonpointer/jsonname" + "github.com/go-openapi/swag/jsonname" ) // Option to tune the behavior of a JSON [Pointer]. @@ -25,9 +25,9 @@ var ( // // By default, the default provider is [jsonname.DefaultJSONNameProvider]. // -// It is safe to call concurrently with [Pointer.Get], [Pointer.Set], [GetForToken] and -// [SetForToken]. -// The typical usage is to call it once at initialization time. +// It is safe to call concurrently with [Pointer.Get], [Pointer.Set], +// [GetForToken] and [SetForToken]. The typical usage is to call it once +// at initialization time. // // A nil provider is ignored. func SetDefaultNameProvider(provider NameProvider) { @@ -41,15 +41,16 @@ func SetDefaultNameProvider(provider NameProvider) { defaultOptions.provider = provider } -// UseGoNameProvider sets the [NameProvider] as a package-level default to the alternative provider -// [jsonname.GoNameProvider], that covers a few areas not supported by the default name provider. +// UseGoNameProvider sets the [NameProvider] as a package-level default +// to the alternative provider [jsonname.GoNameProvider], that covers a few areas +// not supported by the default name provider. // // This implementation supports untagged exported fields and embedded types in go struct. // It follows strictly the behavior of the JSON standard library regarding field naming conventions. // -// It is safe to call concurrently with [Pointer.Get], [Pointer.Set], [GetForToken] and -// [SetForToken]. -// The typical usage is to call it once at initialization time. +// It is safe to call concurrently with [Pointer.Get], [Pointer.Set], +// [GetForToken] and [SetForToken]. The typical usage is to call it once +// at initialization time. func UseGoNameProvider() { SetDefaultNameProvider(jsonname.NewGoNameProvider()) } diff --git a/vendor/github.com/go-openapi/jsonpointer/pointer.go b/vendor/github.com/go-openapi/jsonpointer/pointer.go index 05fc863ee6..2369c1827e 100644 --- a/vendor/github.com/go-openapi/jsonpointer/pointer.go +++ b/vendor/github.com/go-openapi/jsonpointer/pointer.go @@ -34,8 +34,7 @@ const ( // // For struct s resolved by reflection, key mappings honor the conventional struct tag `json`. // -// Fields that do not specify a `json` tag, or specify an empty one, or are tagged as `json:"-"` are -// ignored. +// Fields that do not specify a `json` tag, or specify an empty one, or are tagged as `json:"-"` are ignored. // // # Limitations // @@ -62,24 +61,23 @@ func (p *Pointer) Get(document any, opts ...Option) (any, reflect.Kind, error) { return p.get(document, o.provider) } -// Set uses the pointer to set a value from a data type that represent a JSON document. +// Set uses the pointer to set a value from a data type +// that represent a JSON document. // // # Mutation contract // -// Set mutates the provided document in place whenever Go's type system allows it: when document is -// a map, a pointer, or when the targeted value is reached through an addressable ancestor (e.g. a -// struct field traversed via a pointer, a slice element). -// -// Callers that rely on this in-place behavior may continue to ignore the returned document. +// Set mutates the provided document in place whenever Go's type system allows +// it: when document is a map, a pointer, or when the targeted value is reached +// through an addressable ancestor (e.g. a struct field traversed via a pointer, +// a slice element). Callers that rely on this in-place behavior may continue +// to ignore the returned document. // // The returned document is only load-bearing when Set cannot mutate in place. -// -// This happens in one specific case: appending to a top-level slice passed by value (e.g. document -// of type []T rather than *[]T) via the RFC 6901 "-" terminal token. reflect.Append produces a new -// slice header that the library cannot rebind into the caller's variable; the updated document is -// returned instead. -// -// Pass *[]T if you want in-place rebind for that case as well. +// This happens in one specific case: appending to a top-level slice passed by +// value (e.g. document of type []T rather than *[]T) via the RFC 6901 "-" +// terminal token. reflect.Append produces a new slice header that the library +// cannot rebind into the caller's variable; the updated document is returned +// instead. Pass *[]T if you want in-place rebind for that case as well. // // See [ErrDashToken] for the semantics of the "-" token. func (p *Pointer) Set(document any, value any, opts ...Option) (any, error) { @@ -114,23 +112,23 @@ func (p *Pointer) String() string { return pointerSeparator + strings.Join(p.referenceTokens, pointerSeparator) } -// Offset returns the byte offset, in the raw JSON text of document, of the location referenced by -// this pointer's terminal token. -// -// Unlike [Pointer.Get] and [Pointer.Set], which operate on a decoded Go value, Offset operates -// directly on the textual JSON source. +// Offset returns the byte offset, in the raw JSON text of document, of the +// location referenced by this pointer's terminal token. // -// It drives an [encoding/json.Decoder] over the string and stops at the terminal token, returning -// the position at which the decoder was about to read that token. +// Unlike [Pointer.Get] and [Pointer.Set], which operate on a decoded Go value, +// Offset operates directly on the textual JSON source. It drives an +// [encoding/json.Decoder] over the string and stops at the terminal token, +// returning the position at which the decoder was about to read that token. // -// It is primarily intended for tooling that needs to map a pointer back to a region of the original -// source: reporting line/column for validation or parse diagnostics, extracting a sub-document by -// slicing the raw bytes, or highlighting the referenced span in an editor. +// It is primarily intended for tooling that needs to map a pointer back to a +// region of the original source: reporting line/column for validation or +// parse diagnostics, extracting a sub-document by slicing the raw bytes, or +// highlighting the referenced span in an editor. // // # Offset semantics // -// The meaning of the returned offset depends on whether the terminal token addresses an object -// property or an array element: +// The meaning of the returned offset depends on whether the terminal token +// addresses an object property or an array element: // // - Object property: the offset points to the first byte of the key (its // opening quote character), not to the associated value. For example, @@ -185,15 +183,16 @@ func (p *Pointer) Offset(document string) (int64, error) { return skipJSONSeparator(document, offset), nil } -// skipJSONSeparator advances offset past trailing JSON whitespace and at most one value separator -// (comma) in document, so the result points at the first byte of the next JSON token. +// skipJSONSeparator advances offset past trailing JSON whitespace and at most +// one value separator (comma) in document, so the result points at the first +// byte of the next JSON token. // -// The streaming decoder's InputOffset sits right after the most recently consumed token, which -// between values is the comma (or whitespace) — not the following token. -// -// Normalizing here keeps Offset's contract uniform: for both object keys and array elements, and -// regardless of position within the parent container, the returned offset always points at the -// first byte of the addressed token. +// The streaming decoder's InputOffset sits right after the most recently +// consumed token, which between values is the comma (or whitespace) — not +// the following token. Normalizing here keeps Offset's contract uniform: +// for both object keys and array elements, and regardless of position within +// the parent container, the returned offset always points at the first byte +// of the addressed token. func skipJSONSeparator(document string, offset int64) int64 { n := int64(len(document)) for offset < n && isJSONWhitespace(document[offset]) { @@ -280,13 +279,14 @@ func (p *Pointer) set(node, data any, nameProvider NameProvider) (any, error) { return p.setAt(node, p.referenceTokens, data, nameProvider) } -// setAt recursively walks the token list, setting the data at the terminal token and rebinding any -// new child reference (e.g. a slice header returned by an "-" append) into its parent on the way -// back up. +// setAt recursively walks the token list, setting the data at the terminal +// token and rebinding any new child reference (e.g. a slice header returned +// by an "-" append) into its parent on the way back up. // -// Returning the (possibly new) node at each level is what makes append work at any depth without -// requiring the caller to pass a pointer to the containing slice: the new slice header propagates -// up and each parent rebinds it via the appropriate kind-specific setter. +// Returning the (possibly new) node at each level is what makes append work +// at any depth without requiring the caller to pass a pointer to the +// containing slice: the new slice header propagates up and each parent +// rebinds it via the appropriate kind-specific setter. func (p *Pointer) setAt(node any, tokens []string, data any, nameProvider NameProvider) (any, error) { decodedToken := Unescape(tokens[0]) @@ -309,14 +309,15 @@ func (p *Pointer) setAt(node any, tokens []string, data any, nameProvider NamePr // rebindChild writes newChild back into node at decodedToken. // -// For cases where the child was already mutated in place (pointer aliasing, addressable slice -// elements) the rebind is a safe no-op. -// -// For cases where the child was returned by value (map entries holding a slice, slices reached -// through a non-addressable ancestor), the rebind propagates the new value into the parent. +// For cases where the child was already mutated in place (pointer aliasing, +// addressable slice elements) the rebind is a safe no-op. For cases where +// the child was returned by value (map entries holding a slice, slices +// reached through a non-addressable ancestor), the rebind propagates the +// new value into the parent. // -// Parents implementing [JSONPointable] are left alone: they took ownership of the child via -// JSONLookup and did not opt into a JSONSet-based rebind on intermediate tokens. +// Parents implementing [JSONPointable] are left alone: they took ownership +// of the child via JSONLookup and did not opt into a JSONSet-based rebind +// on intermediate tokens. func rebindChild(node any, decodedToken string, newChild any, nameProvider NameProvider) (any, error) { if _, ok := node.(JSONPointable); ok { return node, nil @@ -361,9 +362,9 @@ func rebindChild(node any, decodedToken string, newChild any, nameProvider NameP } } -// assignReflectValue assigns src into dst, unwrapping a pointer when dst expects the pointee type. -// -// This tolerates the pointer-wrapping performed by [typeFromValue] for addressable fields. +// assignReflectValue assigns src into dst, unwrapping a pointer when dst +// expects the pointee type. This tolerates the pointer-wrapping performed +// by [typeFromValue] for addressable fields. func assignReflectValue(dst reflect.Value, src any) { nv := reflect.ValueOf(src) if !nv.IsValid() { @@ -473,8 +474,8 @@ func GetForToken(document any, decodedToken string, opts ...Option) (any, reflec // SetForToken sets a value for a json pointer token 1 level deep. // -// See [Pointer.Set] for the mutation contract, in particular the handling of the RFC 6901 "-" token -// on slices. +// See [Pointer.Set] for the mutation contract, in particular the handling of +// the RFC 6901 "-" token on slices. func SetForToken(document any, decodedToken string, value any, opts ...Option) (any, error) { o := optionsWithDefaults(opts) @@ -585,10 +586,10 @@ func setSingleImpl(node, data any, decodedToken string, nameProvider NameProvide case reflect.Slice: if decodedToken == dashToken { - // RFC 6901 §4 / RFC 6902 append semantics: terminal "-" appends the value to the slice. - // - // We rebind in place when the slice is reachable via an addressable ancestor; otherwise we - // return the new slice header for the parent (or the public Set) to rebind. + // RFC 6901 §4 / RFC 6902 append semantics: terminal "-" appends + // the value to the slice. We rebind in place when the slice is + // reachable via an addressable ancestor; otherwise we return the + // new slice header for the parent (or the public Set) to rebind. value := reflect.ValueOf(data) elemType := rValue.Type().Elem() if !value.Type().AssignableTo(elemType) { @@ -649,8 +650,8 @@ func offsetSingleObject(dec *json.Decoder, decodedToken string) (int64, error) { return offset, nil } - // Consume the associated value. - // Scalars are fully read by a single Token() call; composite values must be drained. + // Consume the associated value. Scalars are fully read by a single + // Token() call; composite values must be drained. tk, err = dec.Token() if err != nil { return 0, err @@ -735,7 +736,10 @@ func drainSingle(dec *json.Decoder) error { return nil } -// JSON pointer encoding: ~0 => ~ ~1 => / ... and vice versa. +// JSON pointer encoding: +// ~0 => ~ +// ~1 => / +// ... and vice versa const ( encRefTok0 = `~0` diff --git a/vendor/github.com/go-openapi/jsonreference/CONTRIBUTORS.md b/vendor/github.com/go-openapi/jsonreference/CONTRIBUTORS.md index d20737c946..3cfbca6a6a 100644 --- a/vendor/github.com/go-openapi/jsonreference/CONTRIBUTORS.md +++ b/vendor/github.com/go-openapi/jsonreference/CONTRIBUTORS.md @@ -4,11 +4,11 @@ | Total Contributors | Total Contributions | | --- | --- | -| 9 | 83 | +| 9 | 79 | | Username | All Time Contribution Count | All Commits | | --- | --- | --- | -| @fredbi | 46 | | +| @fredbi | 42 | | | @casualjim | 25 | | | @youyuanwu | 5 | | | @olivierlemasle | 2 | | diff --git a/vendor/github.com/go-openapi/jsonreference/README.md b/vendor/github.com/go-openapi/jsonreference/README.md index fbd16cf892..43d05b0506 100644 --- a/vendor/github.com/go-openapi/jsonreference/README.md +++ b/vendor/github.com/go-openapi/jsonreference/README.md @@ -14,10 +14,9 @@ An implementation of JSON Reference for golang. + ## Status @@ -106,6 +105,9 @@ Maintainers can cut a new release by either: [doc-url]: https://goswagger.io/go-openapi [godoc-badge]: https://pkg.go.dev/badge/github.com/go-openapi/jsonreference [godoc-url]: http://pkg.go.dev/github.com/go-openapi/jsonreference +[slack-logo]: https://a.slack-edge.com/e6a93c1/img/icons/favicon-32.png +[slack-badge]: https://img.shields.io/badge/slack-blue?link=https%3A%2F%2Fgoswagger.slack.com%2Farchives%2FC04R30YM +[slack-url]: https://goswagger.slack.com/archives/C04R30YMU [discord-badge]: https://img.shields.io/discord/1446918742398341256?logo=discord&label=discord&color=blue [discord-url]: https://discord.gg/FfnFYaC3k5 diff --git a/vendor/github.com/go-openapi/swag/.gitignore b/vendor/github.com/go-openapi/swag/.gitignore index 3ceb596fa2..a0a95a96b3 100644 --- a/vendor/github.com/go-openapi/swag/.gitignore +++ b/vendor/github.com/go-openapi/swag/.gitignore @@ -4,4 +4,4 @@ Godeps .idea *.out .mcp.json -.worktrees +.claude/ diff --git a/vendor/github.com/go-openapi/swag/.golangci.yml b/vendor/github.com/go-openapi/swag/.golangci.yml index 099c0a78c6..126264a6b8 100644 --- a/vendor/github.com/go-openapi/swag/.golangci.yml +++ b/vendor/github.com/go-openapi/swag/.golangci.yml @@ -14,10 +14,7 @@ linters: - gocognit - godot - godox - - goconst - gomoddirectives - - gomodguard - - gomodguard_v2 - gosmopolitan - inamedparam - intrange diff --git a/vendor/github.com/go-openapi/swag/CONTRIBUTORS.md b/vendor/github.com/go-openapi/swag/CONTRIBUTORS.md index 0f0711cd5f..bc76fe820c 100644 --- a/vendor/github.com/go-openapi/swag/CONTRIBUTORS.md +++ b/vendor/github.com/go-openapi/swag/CONTRIBUTORS.md @@ -4,11 +4,11 @@ | Total Contributors | Total Contributions | | --- | --- | -| 24 | 251 | +| 24 | 235 | | Username | All Time Contribution Count | All Commits | | --- | --- | --- | -| @fredbi | 121 | | +| @fredbi | 105 | | | @casualjim | 98 | | | @alexandear | 4 | | | @orisano | 3 | | @@ -33,4 +33,4 @@ | @davidalpert | 1 | | | @Xe | 1 | | - _this file was generated by the [Contributors GitHub Action](https://github.com/github-community-projects/contributors)_ + _this file was generated by the [Contributors GitHub Action](https://github.com/github/contributors)_ diff --git a/vendor/github.com/go-openapi/swag/README.md b/vendor/github.com/go-openapi/swag/README.md index c6c2d21e94..834eb2ffb9 100644 --- a/vendor/github.com/go-openapi/swag/README.md +++ b/vendor/github.com/go-openapi/swag/README.md @@ -34,9 +34,12 @@ You may also use it standalone for your projects. * **2025-12-19** : new community chat on discord * a new discord community channel is available to be notified of changes and support users + * our venerable Slack channel remains open, and will be eventually discontinued on **2026-03-31** You may join the discord community by clicking the invite link on the discord badge (also above). [![Discord Channel][discord-badge]][discord-url] +Or join our Slack channel: [![Slack Channel][slack-logo]![slack-badge]][slack-url] + ## Status API is stable. @@ -67,12 +70,11 @@ Child modules will continue to evolve and some new ones may be added in the futu | `cmdutils` | utilities to work with CLIs || | `conv` | type conversion utilities | convert between values and pointers for any types
convert from string to builtin types (wraps `strconv`)
require `./typeutils` (test dependency)
| | `fileutils` | file utilities | | -| `jsonname` | JSON utilities (deprecated) | infer JSON names from `go` properties
use `github.com/go-openapi/jsonpointer/jsonname` instead | +| `jsonname` | JSON utilities | infer JSON names from `go` properties
| | `jsonutils` | JSON utilities | fast json concatenation
read and write JSON from and to dynamic `go` data structures
~require `github.com/mailru/easyjson`~
| | `loading` | file loading | load from file or http
require `./yamlutils`
| | `mangling` | safe name generation | name mangling for `go`
| | `netutils` | networking utilities | host, port from address
| -| `pools` | utilities to work with sync.Pools | | | `stringutils` | `string` utilities | search in slice (with case-insensitive)
split/join query parameters as arrays
| | `typeutils` | `go` types utilities | check the zero value for any type
safe check for a nil value
| | `yamlutils` | YAML utilities | converting YAML to JSON
loading YAML into a dynamic YAML document
maintaining the original order of keys in YAML objects
require `./jsonutils`
~require `github.com/mailru/easyjson`~
require `go.yaml.in/yaml/v3`
| @@ -169,9 +171,9 @@ on top of which it has been built. ## Other documentation * [All-time contributors](./CONTRIBUTORS.md) -* [Contributing guidelines][contributing-doc-site] -* [Maintainers documentation][maintainers-doc-site] -* [Code style][style-doc-site] +* [Contributing guidelines](.github/CONTRIBUTING.md) +* [Maintainers documentation](docs/MAINTAINERS.md) +* [Code style](docs/STYLE.md) ## Cutting a new release @@ -206,8 +208,11 @@ Maintainers can cut a new release by either: [doc-url]: https://goswagger.io/go-openapi [godoc-badge]: https://pkg.go.dev/badge/github.com/go-openapi/swag [godoc-url]: http://pkg.go.dev/github.com/go-openapi/swag +[slack-logo]: https://a.slack-edge.com/e6a93c1/img/icons/favicon-32.png +[slack-badge]: https://img.shields.io/badge/slack-blue?link=https%3A%2F%2Fgoswagger.slack.com%2Farchives%2FC04R30YM +[slack-url]: https://goswagger.slack.com/archives/C04R30YMU [discord-badge]: https://img.shields.io/discord/1446918742398341256?logo=discord&label=discord&color=blue -[discord-url]: https://discord.gg/FfnFYaC3k5 +[discord-url]: https://discord.gg/twZ9BwT3 [license-badge]: http://img.shields.io/badge/license-Apache%20v2-orange.svg @@ -217,7 +222,3 @@ Maintainers can cut a new release by either: [goversion-url]: https://github.com/go-openapi/swag/blob/master/go.mod [top-badge]: https://img.shields.io/github/languages/top/go-openapi/swag [commits-badge]: https://img.shields.io/github/commits-since/go-openapi/swag/latest - -[contributing-doc-site]: https://go-openapi.github.io/doc-site/contributing/contributing/index.html -[maintainers-doc-site]: https://go-openapi.github.io/doc-site/maintainers/index.html -[style-doc-site]: https://go-openapi.github.io/doc-site/contributing/style/index.html diff --git a/vendor/github.com/go-openapi/swag/SECURITY.md b/vendor/github.com/go-openapi/swag/SECURITY.md index 1fea2c5736..72296a8313 100644 --- a/vendor/github.com/go-openapi/swag/SECURITY.md +++ b/vendor/github.com/go-openapi/swag/SECURITY.md @@ -6,32 +6,14 @@ This policy outlines the commitment and practices of the go-openapi maintainers | Version | Supported | | ------- | ------------------ | -| O.x | :white_check_mark: | - -## Vulnerability checks in place - -This repository uses automated vulnerability scans, at every merged commit and at least once a week. - -We use: - -* [`GitHub CodeQL`][codeql-url] -* [`trivy`][trivy-url] -* [`govulncheck`][govulncheck-url] - -Reports are centralized in github security reports and visible only to the maintainers. +| 0.25.x | :white_check_mark: | ## Reporting a vulnerability If you become aware of a security vulnerability that affects the current repository, -**please report it privately to the maintainers** -rather than opening a publicly visible GitHub issue. - -Please follow the instructions provided by github to [Privately report a security vulnerability][github-guidance-url]. +please report it privately to the maintainers. -> [!NOTE] -> On Github, navigate to the project's "Security" tab then click on "Report a vulnerability". +Please follow the instructions provided by github to +[Privately report a security vulnerability](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability). -[codeql-url]: https://github.com/github/codeql -[trivy-url]: https://trivy.dev/docs/latest/getting-started -[govulncheck-url]: https://go.dev/blog/govulncheck -[github-guidance-url]: https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability +TL;DR: on Github, navigate to the project's "Security" tab then click on "Report a vulnerability". diff --git a/vendor/github.com/go-openapi/swag/go.work b/vendor/github.com/go-openapi/swag/go.work index f1dddc436e..1e537f0749 100644 --- a/vendor/github.com/go-openapi/swag/go.work +++ b/vendor/github.com/go-openapi/swag/go.work @@ -12,10 +12,9 @@ use ( ./loading ./mangling ./netutils - ./pools ./stringutils ./typeutils ./yamlutils ) -go 1.25.0 +go 1.24.0 diff --git a/vendor/github.com/go-openapi/swag/pools/LICENSE b/vendor/github.com/go-openapi/swag/jsonname/LICENSE similarity index 100% rename from vendor/github.com/go-openapi/swag/pools/LICENSE rename to vendor/github.com/go-openapi/swag/jsonname/LICENSE diff --git a/vendor/github.com/go-openapi/jsonpointer/jsonname/doc.go b/vendor/github.com/go-openapi/swag/jsonname/doc.go similarity index 100% rename from vendor/github.com/go-openapi/jsonpointer/jsonname/doc.go rename to vendor/github.com/go-openapi/swag/jsonname/doc.go diff --git a/vendor/github.com/go-openapi/jsonpointer/jsonname/go_name_provider.go b/vendor/github.com/go-openapi/swag/jsonname/go_name_provider.go similarity index 88% rename from vendor/github.com/go-openapi/jsonpointer/jsonname/go_name_provider.go rename to vendor/github.com/go-openapi/swag/jsonname/go_name_provider.go index 5eec18fbfd..adc4426873 100644 --- a/vendor/github.com/go-openapi/jsonpointer/jsonname/go_name_provider.go +++ b/vendor/github.com/go-openapi/swag/jsonname/go_name_provider.go @@ -11,11 +11,11 @@ import ( var _ providerIface = (*GoNameProvider)(nil) -// GoNameProvider resolves json property names to go struct field names following the same rules as -// the standard library's [encoding/json] package. +// GoNameProvider resolves json property names to go struct field names following +// the same rules as the standard library's [encoding/json] package. // -// Contrary to [NameProvider], it considers exported fields without a json tag, and promotes fields -// from anonymous embedded struct types. +// Contrary to [NameProvider], it considers exported fields without a json tag, +// and promotes fields from anonymous embedded struct types. // // Rules (aligned with encoding/json): // @@ -104,9 +104,9 @@ func (n *GoNameProvider) nameIndexFor(tpe reflect.Type) nameIndex { return names } -// fieldEntry captures a candidate field discovered while walking a struct along with the -// indirection path from the root type (used to resolve conflicts by depth in the same way -// encoding/json does). +// fieldEntry captures a candidate field discovered while walking a struct +// along with the indirection path from the root type (used to resolve conflicts +// by depth in the same way encoding/json does). type fieldEntry struct { goName string jsonName string @@ -129,8 +129,6 @@ func buildGoNameIndex(tpe reflect.Type) nameIndex { // collectGoFields walks tpe breadth-first along anonymous struct fields, // reproducing the field selection performed by encoding/json.typeFields. -// -//nolint:gocognit // everything is inlined to help the compiler determine what escapes and what doesn't func collectGoFields(tpe reflect.Type) []fieldEntry { if tpe.Kind() != reflect.Struct { return nil @@ -159,12 +157,12 @@ func collectGoFields(tpe reflect.Type) []fieldEntry { } for _, q := range current { - for i := range q.typ.NumField() { + for i := 0; i < q.typ.NumField(); i++ { sf := q.typ.Field(i) if sf.Anonymous { ft := sf.Type - if ft.Kind() == reflect.Pointer { + if ft.Kind() == reflect.Ptr { ft = ft.Elem() } if !sf.IsExported() && ft.Kind() != reflect.Struct { @@ -182,7 +180,7 @@ func collectGoFields(tpe reflect.Type) []fieldEntry { tagged := jsonName != "" ft := sf.Type - if ft.Kind() == reflect.Pointer { + if ft.Kind() == reflect.Ptr { ft = ft.Elem() } @@ -223,9 +221,9 @@ func collectGoFields(tpe reflect.Type) []fieldEntry { return dominantFields(candidates) } -// dominantFields applies the Go encoding/json conflict resolution rules: at each JSON name, the -// shallowest field wins; at equal depth, a uniquely tagged candidate wins; otherwise all candidates -// for that name are dropped. +// dominantFields applies the Go encoding/json conflict resolution rules: +// at each JSON name, the shallowest field wins; at equal depth, a uniquely +// tagged candidate wins; otherwise all candidates for that name are dropped. func dominantFields(candidates []fieldEntry) []fieldEntry { byName := make(map[string][]fieldEntry, len(candidates)) for _, c := range candidates { @@ -274,14 +272,14 @@ func dominantFields(candidates []fieldEntry) []fieldEntry { return out } -// parseJSONTag returns the name component of a json struct tag and whether it carried any non-name -// option (kept for future-proofing, e.g. "omitempty"). +// parseJSONTag returns the name component of a json struct tag and whether +// it carried any non-name option (kept for future-proofing, e.g. "omitempty"). func parseJSONTag(tag string) (string, string) { if tag == "" { return "", "" } - if before, after, ok := strings.Cut(tag, ","); ok { - return before, after + if idx := strings.IndexByte(tag, ','); idx >= 0 { + return tag[:idx], tag[idx+1:] } return tag, "" diff --git a/vendor/github.com/go-openapi/jsonpointer/jsonname/ifaces.go b/vendor/github.com/go-openapi/swag/jsonname/ifaces.go similarity index 77% rename from vendor/github.com/go-openapi/jsonpointer/jsonname/ifaces.go rename to vendor/github.com/go-openapi/swag/jsonname/ifaces.go index 64871f0d27..812ace5639 100644 --- a/vendor/github.com/go-openapi/jsonpointer/jsonname/ifaces.go +++ b/vendor/github.com/go-openapi/swag/jsonname/ifaces.go @@ -5,11 +5,9 @@ package jsonname import "reflect" -// providerIface is an unexported compile-time contract that every name provider in this package is -// expected to satisfy. -// -// It mirrors the interface declared by the main consumer of this module: -// [github.com/go-openapi/jsonpointer.NameProvider]. +// providerIface is an unexported compile-time contract that every name provider +// in this package is expected to satisfy. +// It mirrors the interface declared by the main consumer of this module: [github.com/go-openapi/jsonpointer.NameProvider]. type providerIface interface { GetGoName(subject any, name string) (string, bool) GetGoNameForType(tpe reflect.Type, name string) (string, bool) diff --git a/vendor/github.com/go-openapi/jsonpointer/jsonname/name_provider.go b/vendor/github.com/go-openapi/swag/jsonname/name_provider.go similarity index 83% rename from vendor/github.com/go-openapi/jsonpointer/jsonname/name_provider.go rename to vendor/github.com/go-openapi/swag/jsonname/name_provider.go index 1bec2406b5..9f5da7a016 100644 --- a/vendor/github.com/go-openapi/jsonpointer/jsonname/name_provider.go +++ b/vendor/github.com/go-openapi/swag/jsonname/name_provider.go @@ -10,12 +10,12 @@ import ( ) // DefaultJSONNameProvider is the default cache for types. -var DefaultJSONNameProvider = NewNameProvider() //nolint:gochecknoglobals // default settings, for backward compatible package-level settings +var DefaultJSONNameProvider = NewNameProvider() var _ providerIface = (*NameProvider)(nil) -// NameProvider represents an object capable of translating from go property names to json property -// names. +// NameProvider represents an object capable of translating from go property names +// to json property names. // // This type is thread-safe. // @@ -30,7 +30,7 @@ type nameIndex struct { goNames map[string]string } -// NewNameProvider creates a new name provider. +// NewNameProvider creates a new name provider func NewNameProvider() *NameProvider { return &NameProvider{ lock: &sync.Mutex{}, @@ -39,7 +39,7 @@ func NewNameProvider() *NameProvider { } func buildnameIndex(tpe reflect.Type, idx, reverseIdx map[string]string) { - for i := range tpe.NumField() { + for i := 0; i < tpe.NumField(); i++ { targetDes := tpe.Field(i) if targetDes.PkgPath != "" { // unexported @@ -73,14 +73,14 @@ func buildnameIndex(tpe reflect.Type, idx, reverseIdx map[string]string) { } func newNameIndex(tpe reflect.Type) nameIndex { - idx := make(map[string]string, tpe.NumField()) - reverseIdx := make(map[string]string, tpe.NumField()) + var idx = make(map[string]string, tpe.NumField()) + var reverseIdx = make(map[string]string, tpe.NumField()) buildnameIndex(tpe, idx, reverseIdx) return nameIndex{jsonNames: idx, goNames: reverseIdx} } -// GetJSONNames gets all the json property names for a type. +// GetJSONNames gets all the json property names for a type func (n *NameProvider) GetJSONNames(subject any) []string { n.lock.Lock() defer n.lock.Unlock() @@ -97,13 +97,13 @@ func (n *NameProvider) GetJSONNames(subject any) []string { return res } -// GetJSONName gets the json name for a go property name. +// GetJSONName gets the json name for a go property name func (n *NameProvider) GetJSONName(subject any, name string) (string, bool) { tpe := reflect.Indirect(reflect.ValueOf(subject)).Type() return n.GetJSONNameForType(tpe, name) } -// GetJSONNameForType gets the json name for a go property name on a given type. +// GetJSONNameForType gets the json name for a go property name on a given type func (n *NameProvider) GetJSONNameForType(tpe reflect.Type, name string) (string, bool) { n.lock.Lock() defer n.lock.Unlock() @@ -115,13 +115,13 @@ func (n *NameProvider) GetJSONNameForType(tpe reflect.Type, name string) (string return nme, ok } -// GetGoName gets the go name for a json property name. +// GetGoName gets the go name for a json property name func (n *NameProvider) GetGoName(subject any, name string) (string, bool) { tpe := reflect.Indirect(reflect.ValueOf(subject)).Type() return n.GetGoNameForType(tpe, name) } -// GetGoNameForType gets the go name for a given type for a json property name. +// GetGoNameForType gets the go name for a given type for a json property name func (n *NameProvider) GetGoNameForType(tpe reflect.Type, name string) (string, bool) { n.lock.Lock() defer n.lock.Unlock() diff --git a/vendor/github.com/go-openapi/swag/jsonname_iface.go b/vendor/github.com/go-openapi/swag/jsonname_iface.go index 443560caad..303a007f6f 100644 --- a/vendor/github.com/go-openapi/swag/jsonname_iface.go +++ b/vendor/github.com/go-openapi/swag/jsonname_iface.go @@ -4,21 +4,21 @@ package swag import ( - "github.com/go-openapi/jsonpointer/jsonname" + "github.com/go-openapi/swag/jsonname" ) // DefaultJSONNameProvider is the default cache for types // -// Deprecated: use [github.com/go-openapi/jsonpointer/jsonname.DefaultJSONNameProvider] instead. +// Deprecated: use [jsonname.DefaultJSONNameProvider] instead. var DefaultJSONNameProvider = jsonname.DefaultJSONNameProvider // NameProvider represents an object capable of translating from go property names // to json property names. // -// Deprecated: use [github.com/go-openapi/jsonpointer/jsonname.NameProvider] instead. +// Deprecated: use [jsonname.NameProvider] instead. type NameProvider = jsonname.NameProvider // NewNameProvider creates a new name provider // -// Deprecated: use [github.com/go-openapi/jsonpointer/jsonname.NewNameProvider] instead. +// Deprecated: use [jsonname.NewNameProvider] instead. func NewNameProvider() *NameProvider { return jsonname.NewNameProvider() } diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/adapter.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/adapter.go index 94185f79c1..0213ff5c29 100644 --- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/adapter.go +++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/adapter.go @@ -5,7 +5,6 @@ package json import ( stdjson "encoding/json" - "fmt" "github.com/go-openapi/swag/jsonutils/adapters/ifaces" "github.com/go-openapi/swag/typeutils" @@ -25,16 +24,11 @@ var ErrStdlib jsonError = "error from the JSON adapter stdlib" var _ ifaces.Adapter = &Adapter{} type Adapter struct { - options } // NewAdapter yields an [ifaces.Adapter] using the standard library. -func NewAdapter(opts ...Option) *Adapter { - var o options - - return &Adapter{ - options: buildOptions(o, opts), - } +func NewAdapter() *Adapter { + return &Adapter{} } func (a *Adapter) Marshal(value any) ([]byte, error) { @@ -46,18 +40,45 @@ func (a *Adapter) Unmarshal(data []byte, value any) error { } func (a *Adapter) OrderedMarshal(value ifaces.Ordered) ([]byte, error) { - w, redeem := poolOfWriters.BorrowWithRedeem() - defer redeem() - w.setBuf() + w := poolOfWriters.Borrow() + defer func() { + poolOfWriters.Redeem(w) + }() + + if typeutils.IsNil(value) { + w.RawString("null") + + return w.BuildBytes() + } + + w.RawByte('{') + first := true + for k, v := range value.OrderedItems() { + if first { + first = false + } else { + w.RawByte(',') + } - a.orderedMarshal(w, value, 1) + w.String(k) + w.RawByte(':') + + switch val := v.(type) { + case ifaces.Ordered: + w.Raw(a.OrderedMarshal(val)) + default: + w.Raw(stdjson.Marshal(v)) + } + } + + w.RawByte('}') return w.BuildBytes() } func (a *Adapter) OrderedUnmarshal(data []byte, value ifaces.SetOrdered) error { var m MapSlice - if err := m.orderedUnmarshalJSON(data, a.maxDepth()); err != nil { + if err := m.OrderedUnmarshalJSON(data); err != nil { return err } @@ -91,43 +112,4 @@ func (a *Adapter) Redeem() { } func (a *Adapter) Reset() { - a.options = options{} -} - -// orderedMarshal writes value to w, tracking the container nesting depth to guard -// against stack overflow on deeply nested structures. -func (a *Adapter) orderedMarshal(w *jwriter, value ifaces.Ordered, depth int) { - if typeutils.IsNil(value) { - w.RawString("null") - - return - } - - if maxDepth := a.maxDepth(); depth > maxDepth { - w.SetErr(fmt.Errorf("maximum nesting depth of %d exceeded: %w", maxDepth, ErrStdlib)) - - return - } - - w.RawByte('{') - first := true - for k, v := range value.OrderedItems() { - if first { - first = false - } else { - w.RawByte(',') - } - - w.String(k) - w.RawByte(':') - - switch val := v.(type) { - case ifaces.Ordered: - a.orderedMarshal(w, val, depth+1) - default: - w.Raw(stdjson.Marshal(v)) - } - } - - w.RawByte('}') } diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/lexer.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/lexer.go index ac81cbc75f..b5aa1c7972 100644 --- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/lexer.go +++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/lexer.go @@ -54,7 +54,7 @@ func (t token) Delim() byte { return 0 } - return byte(r) //nolint:gosec // delimiter runes are single byte + return byte(r) } type tokenKind uint8 @@ -91,13 +91,6 @@ type jlexer struct { // current token next token // started bool - - // depth tracks the current JSON container nesting level, and maxDepth caps it - // to guard against stack-overflow on adversarially deep documents. The standard - // library's streaming [encoding/json.Decoder.Token] API (used here) does not - // enforce the max-depth guard that [encoding/json.Unmarshal] provides, so we do. - depth int - maxDepth int } type bytesReader struct { @@ -137,8 +130,7 @@ var _ io.Reader = &bytesReader{} func newLexer(data []byte) *jlexer { l := &jlexer{ // current: undefToken, - next: undefToken, - maxDepth: defaultMaxNestingDepth, + next: undefToken, } l.buf = &bytesReader{ buf: data, @@ -151,11 +143,7 @@ func newLexer(data []byte) *jlexer { func (l *jlexer) Reset() { l.err = nil l.next = undefToken - l.depth = 0 - l.maxDepth = defaultMaxNestingDepth - l.dec = nil - // leave l.buf alone, since they are replaced at every Borrow - l.buf = nil + // leave l.dec and l.buf alone, since they are replaced at every Borrow } func (l *jlexer) Error() error { @@ -240,21 +228,6 @@ func (l *jlexer) Delim(c byte) { if tok.Delim() != c { l.err = fmt.Errorf("expected delimiter '%q' but got '%q': %w", c, tok.Delim(), ErrStdlib) - - return - } - - // Track container nesting depth centrally: every '{' or '[' opens a level and - // every '}' or ']' closes one. This guards the mutually-recursive unmarshal - // routines (unmarshalObject/unmarshalArray/asInterface) against stack overflow. - switch c { - case '{', '[': - l.depth++ - if l.maxDepth > 0 && l.depth > l.maxDepth { - l.err = fmt.Errorf("maximum nesting depth of %d exceeded: %w", l.maxDepth, ErrStdlib) - } - case '}', ']': - l.depth-- } } @@ -345,12 +318,3 @@ func (l *jlexer) fetchToken() token { return token{Token: jtok} } - -func (l *jlexer) setBuf(data []byte) func() { - rdr, redeemBuf := poolOfReaders.BorrowWithRedeem() - l.buf = rdr - l.buf.buf = data - l.dec = stdjson.NewDecoder(l.buf) // cannot pool, not exposed by the encoding/json API - - return redeemBuf -} diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/options.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/options.go deleted file mode 100644 index f114f1f1a1..0000000000 --- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/options.go +++ /dev/null @@ -1,52 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers -// SPDX-License-Identifier: Apache-2.0 - -package json - -// defaultMaxNestingDepth is the default maximum number of nested JSON containers -// ('{' or '[') that the ordered-JSON marshaler and unmarshaler will process before -// returning an error. -// -// It mirrors the limit enforced by the standard library's [encoding/json] decoder -// (see encoding/json's internal maxNestingDepth), which this adapter would otherwise -// not benefit from since it drives [encoding/json.Decoder.Token] directly. -const defaultMaxNestingDepth = 10000 - -// Option selects options for the stdlib adapter. -type Option func(o options) options - -type options struct { - maxNestingDepth int -} - -func buildOptions(o options, opts []Option) options { - for _, apply := range opts { - o = apply(o) - } - - return o -} - -// maxDepth returns the configured maximum nesting depth, or the default when unset. -func (o options) maxDepth() int { - if o.maxNestingDepth <= 0 { - return defaultMaxNestingDepth - } - - return o.maxNestingDepth -} - -// WithMaxNestingDepth sets the maximum number of nested JSON containers accepted -// when marshaling or unmarshaling ordered JSON. -// -// A value <= 0 selects the default (10,000). -// -// This guards against stack-overflow crashes on deeply nested (possibly adversarial) -// JSON documents or in-memory structures. -func WithMaxNestingDepth(depth int) Option { - return func(o options) options { - o.maxNestingDepth = depth - - return o - } -} diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/ordered_map.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/ordered_map.go index a5a8f4b631..54deef406f 100644 --- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/ordered_map.go +++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/ordered_map.go @@ -70,11 +70,12 @@ func (s MapSlice) MarshalJSON() ([]byte, error) { } func (s MapSlice) OrderedMarshalJSON() ([]byte, error) { - w, redeem := poolOfWriters.BorrowWithRedeem() - defer redeem() - w.setBuf() + w := poolOfWriters.Borrow() + defer func() { + poolOfWriters.Redeem(w) + }() - s.marshalObject(w, 1) + s.marshalObject(w) return w.BuildBytes() // this clones data, so it's okay to redeem the writer and its buffer } @@ -87,38 +88,23 @@ func (s *MapSlice) UnmarshalJSON(data []byte) error { } func (s *MapSlice) OrderedUnmarshalJSON(data []byte) error { - return s.orderedUnmarshalJSON(data, defaultMaxNestingDepth) -} - -func (s *MapSlice) orderedUnmarshalJSON(data []byte, maxDepth int) error { - l, redeem := poolOfLexers.BorrowWithRedeem() - defer redeem() - - redeemBuf := l.setBuf(data) - defer redeemBuf() - - if maxDepth > 0 { - l.maxDepth = maxDepth - } + l := poolOfLexers.Borrow(data) + defer func() { + poolOfLexers.Redeem(l) + }() s.unmarshalObject(l) return l.Error() } -func (s MapSlice) marshalObject(w *jwriter, depth int) { +func (s MapSlice) marshalObject(w *jwriter) { if s == nil { w.RawString("null") return } - if depth > defaultMaxNestingDepth { - w.SetErr(fmt.Errorf("maximum nesting depth of %d exceeded: %w", defaultMaxNestingDepth, ErrStdlib)) - - return - } - w.RawByte('{') if len(s) == 0 { @@ -127,11 +113,11 @@ func (s MapSlice) marshalObject(w *jwriter, depth int) { return } - s[0].marshalJSON(w, depth) + s[0].marshalJSON(w) for i := 1; i < len(s); i++ { w.RawByte(',') - s[i].marshalJSON(w, depth) + s[i].marshalJSON(w) } w.RawByte('}') @@ -176,18 +162,9 @@ type MapItem struct { Value any } -func (s MapItem) marshalJSON(w *jwriter, depth int) { +func (s MapItem) marshalJSON(w *jwriter) { w.String(s.Key) w.RawByte(':') - - // Recurse internally for nested ordered maps so the depth guard is not lost across - // the stdjson.Marshal boundary (which would reset it and re-enable stack overflow). - if nested, ok := s.Value.(MapSlice); ok { - nested.marshalObject(w, depth+1) - - return - } - w.Raw(stdjson.Marshal(s.Value)) } diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/pool.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/pool.go index 2f06b88e80..709b97c304 100644 --- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/pool.go +++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/pool.go @@ -4,15 +4,118 @@ package json import ( + "encoding/json" + "sync" + "github.com/go-openapi/swag/jsonutils/adapters/ifaces" - "github.com/go-openapi/swag/pools" ) +type adaptersPool struct { + sync.Pool +} + +func (p *adaptersPool) Borrow() *Adapter { + return p.Get().(*Adapter) +} + +func (p *adaptersPool) BorrowIface() ifaces.Adapter { + return p.Get().(*Adapter) +} + +func (p *adaptersPool) Redeem(a *Adapter) { + p.Put(a) +} + +type writersPool struct { + sync.Pool +} + +func (p *writersPool) Borrow() *jwriter { + ptr := p.Get() + + jw := ptr.(*jwriter) + jw.Reset() + + return jw +} + +func (p *writersPool) Redeem(w *jwriter) { + p.Put(w) +} + +type lexersPool struct { + sync.Pool +} + +func (p *lexersPool) Borrow(data []byte) *jlexer { + ptr := p.Get() + + l := ptr.(*jlexer) + l.buf = poolOfReaders.Borrow(data) + l.dec = json.NewDecoder(l.buf) // cannot pool, not exposed by the encoding/json API + l.Reset() + + return l +} + +func (p *lexersPool) Redeem(l *jlexer) { + l.dec = nil + discard := l.buf + l.buf = nil + poolOfReaders.Redeem(discard) + p.Put(l) +} + +type readersPool struct { + sync.Pool +} + +func (p *readersPool) Borrow(data []byte) *bytesReader { + ptr := p.Get() + + b := ptr.(*bytesReader) + b.Reset() + b.buf = data + + return b +} + +func (p *readersPool) Redeem(b *bytesReader) { + p.Put(b) +} + var ( - poolOfAdapters = pools.New[Adapter]() - poolOfWriters = pools.NewRedeemable[jwriter]() - poolOfLexers = pools.NewRedeemable[jlexer]() - poolOfReaders = pools.NewRedeemable[bytesReader]() + poolOfAdapters = &adaptersPool{ + Pool: sync.Pool{ + New: func() any { + return NewAdapter() + }, + }, + } + + poolOfWriters = &writersPool{ + Pool: sync.Pool{ + New: func() any { + return newJWriter() + }, + }, + } + + poolOfLexers = &lexersPool{ + Pool: sync.Pool{ + New: func() any { + return newLexer(nil) + }, + }, + } + + poolOfReaders = &readersPool{ + Pool: sync.Pool{ + New: func() any { + return &bytesReader{} + }, + }, + } ) // BorrowAdapter borrows an [Adapter] from the pool, recycling already allocated instances. @@ -21,12 +124,10 @@ func BorrowAdapter() *Adapter { } // BorrowAdapterIface borrows a stdlib [Adapter] and converts it directly -// to [ifaces.Adapter]. -// -// This is useful to avoid further allocations when translating the concrete type into -// an interface. +// to [ifaces.Adapter]. This is useful to avoid further allocations when +// translating the concrete type into an interface. func BorrowAdapterIface() ifaces.Adapter { - return poolOfAdapters.Borrow() + return poolOfAdapters.BorrowIface() } // RedeemAdapter redeems an [Adapter] to the pool, so it may be recycled. diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/register.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/register.go index 0dec85425b..fc8818694e 100644 --- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/register.go +++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/register.go @@ -10,22 +10,14 @@ import ( "github.com/go-openapi/swag/jsonutils/adapters/ifaces" ) -func Register(dispatcher ifaces.Registrar, opts ...Option) { +func Register(dispatcher ifaces.Registrar) { t := reflect.TypeOf(Adapter{}) - var o options - o = buildOptions(o, opts) - dispatcher.RegisterFor( ifaces.RegistryEntry{ - Who: fmt.Sprintf("%s.%s", t.PkgPath(), t.Name()), - What: ifaces.AllCapabilities, - Constructor: func() ifaces.Adapter { - a := BorrowAdapter() - a.options = o - - return a - }, - Support: support, + Who: fmt.Sprintf("%s.%s", t.PkgPath(), t.Name()), + What: ifaces.AllCapabilities, + Constructor: BorrowAdapterIface, + Support: support, }) } diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/writer.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/writer.go index c84e02cd83..dc2325c1a3 100644 --- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/writer.go +++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/writer.go @@ -14,19 +14,15 @@ type jwriter struct { err error } -func (w *jwriter) Reset() { - if w.buf != nil { - w.buf.Reset() - } - w.err = nil +func newJWriter() *jwriter { + buf := make([]byte, 0, sensibleBufferSize) + + return &jwriter{buf: bytes.NewBuffer(buf)} } -// SetErr records the first error encountered while building the JSON output. -func (w *jwriter) SetErr(err error) { - if w.err != nil { - return - } - w.err = err +func (w *jwriter) Reset() { + w.buf.Reset() + w.err = nil } func (w *jwriter) RawString(s string) { @@ -77,12 +73,3 @@ func (w *jwriter) BuildBytes() ([]byte, error) { return bytes.Clone(w.buf.Bytes()), nil } - -func (w *jwriter) setBuf() { - if w.buf != nil { - return - } - - buf := make([]byte, 0, sensibleBufferSize) - w.buf = bytes.NewBuffer(buf) -} diff --git a/vendor/github.com/go-openapi/swag/loading/doc.go b/vendor/github.com/go-openapi/swag/loading/doc.go index 112c49968b..8cf7bcb8b9 100644 --- a/vendor/github.com/go-openapi/swag/loading/doc.go +++ b/vendor/github.com/go-openapi/swag/loading/doc.go @@ -2,28 +2,4 @@ // SPDX-License-Identifier: Apache-2.0 // Package loading provides tools to load a file from http or from a local file system. -// -// # Security -// -// By default, the local loader reads any path the process can access, including absolute -// paths and "file://" URIs (for example "file:///etc/passwd"). Applications that pass -// untrusted input to [LoadFromFileOrHTTP], [JSONDoc] (or to downstream consumers such as -// go-openapi/loads) must confine local loading to a trusted directory. -// -// Use [WithRoot] to do so: it resolves every requested path relative to a chosen directory -// and rejects anything that escapes it, including via symlink. It is built on [os.Root] -// and is therefore safer than passing an [os.DirFS] to [WithFS], which does not block -// symlink escapes. -// -// Remote loading uses a standard [net/http] client. -// By default it follows redirects and performs no destination filtering — exactly like [net/http.DefaultClient]. -// -// A caller-controlled URL may therefore reach internal services or cloud metadata endpoints -// (server-side request forgery). -// -// This package does not, and should not, embed a network policy: -// when the URL may derive from untrusted input, supply a restricted client with -// [WithHTTPClient] whose transport rejects unwanted destinations at dial time — which also -// covers redirects and DNS rebinding. -// See the example on [LoadFromFileOrHTTP]. package loading diff --git a/vendor/github.com/go-openapi/swag/loading/loading.go b/vendor/github.com/go-openapi/swag/loading/loading.go index 0b38ac1e38..269fb74d16 100644 --- a/vendor/github.com/go-openapi/swag/loading/loading.go +++ b/vendor/github.com/go-openapi/swag/loading/loading.go @@ -17,11 +17,7 @@ import ( "strings" ) -// LoadFromFileOrHTTP loads the bytes from a file or a remote http server based on the path passed in. -// -// Security: by default a local path is read with no confinement, so a caller-controlled path -// (including a "file://" URI or an absolute path) may read any file the process can access. -// When the path may derive from untrusted input, confine local loading with [WithRoot]. +// LoadFromFileOrHTTP loads the bytes from a file or a remote http server based on the path passed in func LoadFromFileOrHTTP(pth string, opts ...Option) ([]byte, error) { o := optionsWithDefaults(opts) return LoadStrategy(pth, o.ReadFileFunc(), loadHTTPBytes(opts...), opts...)(pth) @@ -58,14 +54,11 @@ func LoadFromFileOrHTTP(pth string, opts ...Option) ([]byte, error) { // - `file:///c:/folder/file` becomes `C:\folder\file` // - `file://c:/folder/file` is tolerated (without leading `/`) and becomes `c:\folder\file` func LoadStrategy(pth string, local, remote func(string) ([]byte, error), opts ...Option) func(string) ([]byte, error) { - if hasHTTPScheme(pth) { + if strings.HasPrefix(pth, "http") { return remote } o := optionsWithDefaults(opts) _, isEmbedFS := o.fs.(embed.FS) - // any loader backed by an fs.FS or an os.Root consumes forward-slash paths on every - // platform, so it must not go through the windows-native file:// preprocessing below. - isFSBacked := o.fs != nil || o.root != "" return func(p string) ([]byte, error) { upth, err := url.PathUnescape(p) @@ -74,20 +67,14 @@ func LoadStrategy(pth string, local, remote func(string) ([]byte, error), opts . } cpth, hasPrefix := strings.CutPrefix(upth, "file://") - if !hasPrefix || isFSBacked || runtime.GOOS != "windows" { + if !hasPrefix || isEmbedFS || runtime.GOOS != "windows" { // crude processing: trim the file:// prefix. This leaves full URIs with a host with a (mostly) unexpected result // regular file path provided: just normalize slashes if isEmbedFS { - // embed.FS always uses "/" as separator, even on windows, and rejects leading "./" or "/". + // on windows, we need to slash the path if FS is an embed FS. return local(strings.TrimLeft(filepath.ToSlash(cpth), "./")) // remove invalid leading characters for embed FS } - if isFSBacked { - // other fs.FS (e.g. os.DirFS) and os.Root loaders also use "/" on every platform. - // Escaping paths (absolute, "..", escaping symlinks) are rejected by the loader, not rewritten here. - return local(filepath.ToSlash(cpth)) - } - return local(filepath.FromSlash(cpth)) } @@ -126,21 +113,6 @@ func LoadStrategy(pth string, local, remote func(string) ([]byte, error), opts . } } -// hasHTTPScheme reports whether pth is an absolute URL with an http or https scheme, -// selecting the remote loader. The comparison is case-insensitive, as URL schemes are. -// -// Requiring the "://" separator (rather than a bare "http" prefix) avoids misrouting a -// local file whose name merely starts with "http" (e.g. "httpbin.json") to the remote loader. -func hasHTTPScheme(pth string) bool { - for _, scheme := range [...]string{"http://", "https://"} { - if len(pth) >= len(scheme) && strings.EqualFold(pth[:len(scheme)], scheme) { - return true - } - } - - return false -} - func loadHTTPBytes(opts ...Option) func(path string) ([]byte, error) { o := optionsWithDefaults(opts) diff --git a/vendor/github.com/go-openapi/swag/loading/options.go b/vendor/github.com/go-openapi/swag/loading/options.go index 2c12823172..6674ac69e6 100644 --- a/vendor/github.com/go-openapi/swag/loading/options.go +++ b/vendor/github.com/go-openapi/swag/loading/options.go @@ -4,7 +4,6 @@ package loading import ( - "errors" "io/fs" "net/http" "os" @@ -24,8 +23,7 @@ type ( } fileOptions struct { - fs fs.ReadFileFS - root string // when non-empty, local reads are confined to this directory via os.Root + fs fs.ReadFileFS } options struct { @@ -35,20 +33,6 @@ type ( ) func (fo fileOptions) ReadFileFunc() func(string) ([]byte, error) { - if fo.root != "" { - root := fo.root - - return func(name string) ([]byte, error) { - r, err := os.OpenRoot(root) - if err != nil { - return nil, errors.Join(err, ErrLoader) - } - defer func() { _ = r.Close() }() - - return r.ReadFile(name) - } - } - if fo.fs == nil { return os.ReadFile } @@ -103,15 +87,8 @@ func WithHTTPClient(client *http.Client) Option { // By default, the file system is the one provided by the os package. // // For example, this may be set to consume from an embedded file system, or a rooted FS. -// -// WithFS and [WithRoot] are mutually exclusive: the last one applied wins. -// -// Security note: a file system built from [os.DirFS] confines paths but does NOT protect -// against symlinks that escape the root. To load from a directory derived from untrusted -// input, prefer [WithRoot], which is symlink-escape resistant. func WithFS(filesystem fs.FS) Option { return func(o *options) { - o.root = "" // last-wins vs WithRoot if rfs, ok := filesystem.(fs.ReadFileFS); ok { o.fs = rfs @@ -121,28 +98,6 @@ func WithFS(filesystem fs.FS) Option { } } -// WithRoot confines local file loading to dir. -// -// Every requested path is resolved relative to dir, and any path that would escape dir — -// whether through an absolute path, ".." traversal, or a symlink pointing outside dir — is -// rejected. This is built on [os.Root] and is therefore resistant to the symlink escapes -// that a plain [os.DirFS] does not prevent. -// -// WithRoot is the recommended option when loading specs from a location derived from -// untrusted input. It applies to local loading only and has no effect on remote -// (http/https) loading. WithRoot and [WithFS] are mutually exclusive: the last one applied -// wins. -// -// Note: [os.Root] confines path resolution but does not, by itself, protect against -// traversal of mount/bind boundaries, /proc special files, or device files. Point WithRoot -// at a directory that holds only the documents you intend to expose. -func WithRoot(dir string) Option { - return func(o *options) { - o.root = dir - o.fs = nil // last-wins vs WithFS - } -} - type readFileFS struct { fs.FS } diff --git a/vendor/github.com/go-openapi/swag/loading_iface.go b/vendor/github.com/go-openapi/swag/loading_iface.go index 78dadfccdf..27ec3fb8c3 100644 --- a/vendor/github.com/go-openapi/swag/loading_iface.go +++ b/vendor/github.com/go-openapi/swag/loading_iface.go @@ -80,13 +80,11 @@ func YAMLData(path string) (any, error) { // loadingOptionsWithDefaults bridges deprecated default settings that use package-level variables, // with the recommended use of loading.Option. func loadingOptionsWithDefaults(opts []loading.Option) []loading.Option { - const defaultOptions = 3 - o := make([]loading.Option, 0, defaultOptions+len(opts)) - o = append(o, []loading.Option{ + o := []loading.Option{ loading.WithTimeout(LoadHTTPTimeout), loading.WithBasicAuth(LoadHTTPBasicAuthUsername, LoadHTTPBasicAuthPassword), loading.WithCustomHeaders(LoadHTTPCustomHeaders), - }...) + } o = append(o, opts...) return o diff --git a/vendor/github.com/go-openapi/swag/pools/README.md b/vendor/github.com/go-openapi/swag/pools/README.md deleted file mode 100644 index 1966461cb5..0000000000 --- a/vendor/github.com/go-openapi/swag/pools/README.md +++ /dev/null @@ -1 +0,0 @@ -# pools diff --git a/vendor/github.com/go-openapi/swag/pools/debug.go b/vendor/github.com/go-openapi/swag/pools/debug.go deleted file mode 100644 index 94415e989e..0000000000 --- a/vendor/github.com/go-openapi/swag/pools/debug.go +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers -// SPDX-License-Identifier: Apache-2.0 - -package pools - -// TB is the subset of [testing.TB] used by [AssertNoLeaks]. -// -// It is satisfied by *[testing.T] and *[testing.B]. -// -// A local interface is used (rather than importing "testing") so that the -// release build does not pull the testing package — and its flags — into -// production binaries. -type TB interface { - Helper() - Errorf(format string, args ...any) - Logf(format string, args ...any) -} diff --git a/vendor/github.com/go-openapi/swag/pools/debug_off.go b/vendor/github.com/go-openapi/swag/pools/debug_off.go deleted file mode 100644 index 9163d6d60e..0000000000 --- a/vendor/github.com/go-openapi/swag/pools/debug_off.go +++ /dev/null @@ -1,51 +0,0 @@ -//go:build !poolsdebug - -// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers -// SPDX-License-Identifier: Apache-2.0 - -package pools - -// This is the release implementation of the pool instrumentation: it does -// nothing. -// -// tracker is an empty struct, so it adds no field to the pool types and its -// methods inline away to nothing. -// -// Build with -tags poolsdebug to get the instrumented variant (see -// debug_on.go). - -// debugBuild reports whether the pool instrumentation is compiled in (the -// poolsdebug tag). -const debugBuild = false - -// DebugBuild reports whether the pool instrumentation is compiled in (the -// poolsdebug build tag). -// -// It lets a test that must run in both modes skip the parts that are invalid -// under instrumentation — e.g. an allocation-count assertion, since the -// instrumented build allocates a per-borrow tracker. -const DebugBuild = debugBuild - -type tracker[T any] struct{} - -func (tracker[T]) register() {} - -func (tracker[T]) onBorrow(*T) {} - -func (tracker[T]) onRedeem(*T) {} - -func (tracker[T]) borrowRedeemer(_ *T, cached func()) func() { return cached } - -// AssertNoLeaks reports whether every borrowed object has been redeemed across -// all pools. -// -// It is only meaningful in the instrumented build (-tags poolsdebug). -// -// In a release build it is a no-op that always reports true, so the same test -// can run in both modes. -func AssertNoLeaks(TB) bool { return true } - -// ResetTracking clears all recorded borrow/redeem tracking. -// -// This is a no-op in a release build. -func ResetTracking() {} diff --git a/vendor/github.com/go-openapi/swag/pools/debug_on.go b/vendor/github.com/go-openapi/swag/pools/debug_on.go deleted file mode 100644 index 64ccc57d38..0000000000 --- a/vendor/github.com/go-openapi/swag/pools/debug_on.go +++ /dev/null @@ -1,237 +0,0 @@ -//go:build poolsdebug - -// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers -// SPDX-License-Identifier: Apache-2.0 - -package pools - -import ( - "fmt" - "runtime" - "sync" -) - -// This is the instrumented implementation of the pool tracking, enabled with -// -tags poolsdebug. -// -// Each pool carries a tracker that records, per recycled pointer, whether it is -// currently borrowed or redeemed, together with the call sites of the last -// borrow and redeem. -// It panics loudly (with those call sites) when it detects misuse: -// -// - a double redeem (the same object returned to the pool twice — corrupts sync.Pool); -// - for the redeemable pools, a redeem of a stale borrow (the slot was re-borrowed since — the -// ABA case the production atomic guard cannot catch), thanks to a per-borrow generation; -// - a redeem of an object the pool never handed out; -// - a borrow of an object still checked out (a symptom of an earlier double-Put). -// -// Borrowed-but-never-redeemed objects (leaks) are reported by [AssertNoLeaks]. - -// debugBuild reports whether the pool instrumentation is compiled in (the -// poolsdebug tag). -const debugBuild = true - -// DebugBuild reports whether the pool instrumentation is compiled in (the -// poolsdebug build tag). -// -// See the release-build doc for usage. -const DebugBuild = debugBuild - -type trackStatus uint8 - -const ( - trackBorrowed trackStatus = iota + 1 - trackRedeemed -) - -type trackEntry struct { - status trackStatus - gen uint64 // identifies the current borrow, to detect a redeem racing a re-borrow (ABA) - borrowedAt string - redeemedAt string -} - -type tracker[T any] struct { - mu sync.Mutex - entries map[*T]*trackEntry - nextGen uint64 -} - -func (t *tracker[T]) register() { - t.mu.Lock() - if t.entries == nil { - t.entries = make(map[*T]*trackEntry) - } - t.mu.Unlock() - - registerLeakChecker(t) -} - -// markBorrow records a borrow of ptr and returns its generation. -// -// Caller must hold no lock. -func (t *tracker[T]) markBorrow(ptr *T, site string) uint64 { - t.mu.Lock() - defer t.mu.Unlock() - - e := t.entries[ptr] - if e == nil { - e = &trackEntry{} - t.entries[ptr] = e - } else if e.status == trackBorrowed { - panic(fmt.Sprintf( - "pools: borrow of an object still checked out (borrowed at %s); "+ - "this usually means it was redeemed twice earlier", e.borrowedAt)) - } - - t.nextGen++ - e.status = trackBorrowed - e.gen = t.nextGen - e.borrowedAt = site - - return t.nextGen -} - -// markRedeem validates and records a redeem of ptr. gen is the borrow -// generation the caller is redeeming, or 0 to skip the ABA check (plain -// Pool[T], which has no per-borrow token). -func (t *tracker[T]) markRedeem(ptr *T, gen uint64, site string) { - t.mu.Lock() - defer t.mu.Unlock() - - e := t.entries[ptr] - switch { - case e == nil: - panic("pools: redeem of an object this pool never handed out") - case e.status != trackBorrowed: - panic(fmt.Sprintf("pools: double redeem (first redeemed at %s)", e.redeemedAt)) - case gen != 0 && e.gen != gen: - panic(fmt.Sprintf( - "pools: redeem of a stale borrow (the slot was re-borrowed at %s since this borrow); "+ - "a redeem is racing a re-borrow of the same slot (ABA)", e.borrowedAt)) - } - - e.status = trackRedeemed - e.redeemedAt = site -} - -const stackOffset = 3 - -func (t *tracker[T]) onBorrow(ptr *T) { - t.markBorrow(ptr, caller(stackOffset)) -} - -func (t *tracker[T]) onRedeem(ptr *T) { - t.markRedeem(ptr, 0, caller(stackOffset)) -} - -// borrowRedeemer records the borrow and returns a generation-stamped redeemer -// that validates the redeem (catching double-redeem and ABA) before delegating -// to the cached redeemer. -func (t *tracker[T]) borrowRedeemer(ptr *T, cached func()) func() { - gen := t.markBorrow(ptr, caller(stackOffset)) - - return func() { - t.markRedeem(ptr, gen, caller(stackOffset-1)) - cached() - } -} - -func (t *tracker[T]) checkLeaks(tb TB) bool { - t.mu.Lock() - defer t.mu.Unlock() - - ok := true - for _, e := range t.entries { - if e.status != trackRedeemed { - tb.Logf("pools: object borrowed but never redeemed (borrowed at %s)", e.borrowedAt) - ok = false - } - } - - return ok -} - -func (t *tracker[T]) resetTracking() { - t.mu.Lock() - t.entries = make(map[*T]*trackEntry) - t.nextGen = 0 - t.mu.Unlock() -} - -// leakChecker is the build-erased view of a tracker that the global registry -// holds, so trackers of different element types can be checked uniformly. -type leakChecker interface { - checkLeaks(tb TB) bool - resetTracking() -} - -var ( - registryMu sync.Mutex - registry []leakChecker -) - -func registerLeakChecker(c leakChecker) { - registryMu.Lock() - registry = append(registry, c) - registryMu.Unlock() -} - -// AssertNoLeaks reports whether every borrowed object has been redeemed across -// all pools created so far. -// -// It logs the borrow call site of each leaked object and fails tb when any are -// found. -// -// Typical use, with [ResetTracking] to isolate the test from earlier ones: -// -// func TestX(t *testing.T) { -// pools.ResetTracking() -// t.Cleanup(func() { pools.AssertNoLeaks(t) }) -// // ... exercise code that borrows/redeems ... -// } -func AssertNoLeaks(tb TB) bool { - tb.Helper() - registryMu.Lock() - defer registryMu.Unlock() - - ok := true - for _, c := range registry { - if !c.checkLeaks(tb) { - ok = false - } - } - if !ok { - tb.Errorf("pools: leaked pooled objects detected (borrowed but never redeemed)") - } - - return ok -} - -// ResetTracking clears all recorded borrow/redeem tracking across every pool. -// -// Call it at the start of a test so leaks from earlier tests are not attributed -// to it. -func ResetTracking() { - registryMu.Lock() - defer registryMu.Unlock() - - for _, c := range registry { - c.resetTracking() - } -} - -// caller returns "file:line" of the frame skip levels above caller itself. -func caller(skip int) string { - pc, _, _, ok := runtime.Caller(skip) - if !ok { - return "unknown" - } - fn := runtime.FuncForPC(pc) - if fn == nil { - return "unknown" - } - file, line := fn.FileLine(pc) - - return fmt.Sprintf("%s:%d", file, line) -} diff --git a/vendor/github.com/go-openapi/swag/pools/doc.go b/vendor/github.com/go-openapi/swag/pools/doc.go deleted file mode 100644 index 395c24d29a..0000000000 --- a/vendor/github.com/go-openapi/swag/pools/doc.go +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers -// SPDX-License-Identifier: Apache-2.0 - -// Package pools provide utilities to recycle allocated objects. -// -// This package provides: -// -// - a generic [Pool] type that wraps [sync.Pool], -// - a [PoolRedeemable] variant that hands out a cached redeem closure, -// - a [PoolSlice] for recycling slices without juggling pointers. -// -// # Debug build -// -// Building with the "poolsdebug" tag (go test -tags poolsdebug ./...) turns on -// instrumentation that tracks every borrow and redeem and panics on misuse: -// -// - double redeem (including the A -> B -> A case for the redeemable pools), -// - redeem of a foreign object, -// - borrow of an object still checked out -// -// It reports the offending call sites. -// -// [AssertNoLeaks] then reports any object borrowed but never redeemed. -// -// The instrumentation is a no-op with zero overhead when the tag is absent. -package pools diff --git a/vendor/github.com/go-openapi/swag/pools/pools.go b/vendor/github.com/go-openapi/swag/pools/pools.go deleted file mode 100644 index d78ea5790a..0000000000 --- a/vendor/github.com/go-openapi/swag/pools/pools.go +++ /dev/null @@ -1,410 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers -// SPDX-License-Identifier: Apache-2.0 - -package pools - -import ( - "iter" - "slices" - "sync" - "sync/atomic" -) - -// Resettable is an interface for types that want to recycle a clean instance -// from a [Pool]. -// -// When T (or rather *T) implements [Resettable], the pool calls Reset on an -// instance both when it is redeemed and when it is borrowed: -// -// - on redeem, so that no references held by the instance are retained while it sits idle in the -// pool (which would pin a reference graph alive across a GC cycle); -// - on borrow, so that the next borrower receives a clean object regardless of how the instance -// reached the pool. -// -// Reset must be safe to call more than once on the same instance (it runs at -// least twice per cycle). -type Resettable interface { - Reset() -} - -// resetIfResettable calls Reset on v when *T implements [Resettable]. -func resetIfResettable[T any](v *T) { - if r, ok := any(v).(Resettable); ok { - r.Reset() - } -} - -// borrow state of a [redeemable] wrapper, used to detect double-redeem. -const ( - stateIdle uint32 = iota // sitting in the pool (or freshly created), not checked out - stateBorrowed // checked out by a borrower -) - -type redeemable[T any] struct { - inner *T - redeemer func() - // state guards against a double-redeem (the same wrapper Put into the pool - // twice, which would let one object be handed to two borrowers). - // - // It is set to stateBorrowed on borrow and atomically flipped back to - // stateIdle on redeem; a redeem that finds it already idle panics. - state atomic.Uint32 -} - -// redeemPanic is the message raised when a slot is redeemed while already idle. -const redeemPanic = "pools: " + - "double redeem detected (object already returned to the pool); " + - "a borrowed object must be redeemed exactly once" - -// Pool wraps a [sync.Pool] to make it available for any type. -// -// T must be the value type of the pooled object (e.g. Pool[bytes.Buffer]): -// [Pool.Borrow] returns a *T. Using a pointer type as T (e.g. -// Pool[*bytes.Buffer]) would yield a **T and is almost certainly a mistake. -type Pool[T any] struct { - pool sync.Pool - tracker tracker[T] // empty (zero-cost) unless built with the poolsdebug tag -} - -// PoolRedeemable wraps a [sync.Pool] to make it available for any type. -// -// It differs from [Pool] in the way objects are redeemed to the pool: borrowing -// also yields a cached redeem closure, so no closure is allocated at redeem -// time. -type PoolRedeemable[T any] struct { - pool sync.Pool - tracker tracker[redeemable[T]] // empty (zero-cost) unless built with the poolsdebug tag -} - -// New builds a new [Pool] to recycle allocations of type T explicitly using -// [Pool.Redeem] and the allocated pointer. -// -// Freshly allocated instances of type T are set to their zero value; like -// recycled instances they are reset (if [Resettable]) when borrowed, so -// [Pool.Borrow] always yields a clean object. -func New[T any]() *Pool[T] { - p := &Pool[T]{} - p.pool = sync.Pool{ - New: func() any { - return new(T) - }, - } - p.tracker.register() - - return p -} - -// NewRedeemable builds a new redeemable [Pool] to recycle allocations of type -// T, and use the inner redeemer to relinquish objects to the pool. -func NewRedeemable[T any]() *PoolRedeemable[T] { - p := &PoolRedeemable[T]{} - p.pool = sync.Pool{ - New: func() any { - r := &redeemable[T]{inner: new(T)} - r.redeemer = func() { - if !r.state.CompareAndSwap(stateBorrowed, stateIdle) { - panic(redeemPanic) - } - resetIfResettable(r.inner) - p.pool.Put(r) - } - - return r - }, - } - p.tracker.register() - - return p -} - -// Borrow an instance from the pool. -// -// If the type implements [Resettable], the returned instance is reset before -// being handed out, so it is always clean. -func (p *Pool[T]) Borrow() *T { - target := p.pool.Get().(*T) - resetIfResettable(target) - p.tracker.onBorrow(target) - - return target -} - -// Redeem a borrowed instance to the pool. -// -// A nil pointer is ignored (it would otherwise corrupt the pool: a typed-nil -// boxed into an interface is not the nil interface that [sync.Pool.Put] skips). -// -// The instance is reset (if it implements [Resettable]) before being returned -// to the pool. -// After calling Redeem, the caller must drop its reference to ptr: continuing -// to use it is a use-after-redeem bug. -// -// Unlike [PoolRedeemable], this plain pool holds no per-object state, so it -// cannot detect a double-redeem of the same pointer (which corrupts the pool). -// -// Prefer [PoolRedeemable] when you want that guard, or the debug build for full -// tracking. -func (p *Pool[T]) Redeem(ptr *T) { - if ptr == nil { - return - } - p.tracker.onRedeem(ptr) - resetIfResettable(ptr) - p.pool.Put(ptr) -} - -// BorrowWithRedeem borrows an instance from the pool and provides the -// corresponding redeem function. -// -// This is useful for instance to use with defer. -// -// The instance is reset (if it implements [Resettable]) both when borrowed and -// when the returned redeem closure is called. -// After calling the redeem closure, the caller must drop its reference to the -// returned instance. -// -// Calling the redeem closure more than once panics (see [redeemable.state]): a -// borrowed instance must be redeemed exactly once. -func (p *PoolRedeemable[T]) BorrowWithRedeem() (*T, func()) { - container := p.pool.Get().(*redeemable[T]) - container.state.Store(stateBorrowed) - resetIfResettable(container.inner) - - // In release builds borrowRedeemer returns container.redeemer unchanged (zero - // cost). - // Under the poolsdebug tag it returns a generation-stamped wrapper that tracks - // the borrow and detects double-redeem (incl. - // - // ABA), foreign-redeem and leaks. - return container.inner, p.tracker.borrowRedeemer(container, container.redeemer) -} - -// Slice is a struct that wraps a slice []T. -// -// This is useful to borrow and redeem slices from a pool, without having to -// constantly manipulate pointers to the slice. -// -// The wrapper holds the authoritative slice header. -// -// Its mutating methods ([Slice.Append], [Slice.Concat], [Slice.Grow]) return -// the current backing slice for convenience, so it reads as an idiomatic []T. -// -// But the returned slice is only a snapshot of the wrapper's state at that -// moment: if you keep it and grow it yourself with the builtin append and it -// reallocates, the new backing array lives only in your local copy and is NOT -// tracked by the wrapper — it will not be recycled when the wrapper is -// redeemed (and a later borrower would get the old, smaller array). -// -// Rule of thumb: it is fine to read or pass the returned []T to a consumer; but -// if you plan to grow the slice, keep calling the wrapper's methods so the -// growth is tracked and recycled. -type Slice[T any] struct { - length int - inner []T -} - -// Slice returns the inner slice. -// -// Treat the result as a read-only view (for ranging or passing to a consumer), -// valid until the next mutation or redeem. -// To grow or append, use the wrapper methods so the new backing array is -// tracked and recycled (see [Slice]). -func (s *Slice[T]) Slice() []T { - return s.inner -} - -// Grow the inner slice so it can accommodate at least size more elements -// without reallocating, and return the current backing slice. -// -// Growth is tracked by the wrapper, so the enlarged backing array is recycled -// on redeem. -// See [Slice] for the caveat about growing the returned slice yourself. -func (s *Slice[T]) Grow(size int) []T { - s.inner = slices.Grow(s.inner, size) - - return s.inner -} - -func (s *Slice[T]) Len() int { - return len(s.inner) -} - -func (s *Slice[T]) Cap() int { - return cap(s.inner) -} - -// Append elements to the inner slice and return the current backing slice. -// -// This should be preferred to the append builtin if you plan that the slice will -// grow and you want the newly allocated space to be tracked and recycled. -// See [Slice] for the caveat about growing the returned slice yourself. -func (s *Slice[T]) Append(elems ...T) []T { - s.inner = append(s.inner, elems...) - - return s.inner -} - -// Concat another slice to the inner slice and return the current backing slice. -// -// Unlike [slices.Concat], this reuses the inner slice's capacity instead of -// always allocating a fresh backing array. -// See [Slice] for the caveat about growing the returned slice yourself. -func (s *Slice[T]) Concat(slice []T) []T { - s.inner = append(s.inner, slice...) - - return s.inner -} - -// IndexedElems iterates over the inner slice. -func (s *Slice[T]) IndexedElems() iter.Seq2[int, T] { - return func(yield func(int, T) bool) { - for i, elem := range s.inner { - if !yield(i, elem) { - return - } - } - } -} - -// Reset the inner slice to its configured initial length, keeping allocated -// capacity. -// -// All elements are zeroed, so the pool never retains stale element references -// (which would keep a referenced graph alive for slices of pointers) and so a -// [WithLength] slice is handed out clean rather than carrying data from a -// previous borrower. -func (s *Slice[T]) Reset() { - clear(s.inner) - if s.length > cap(s.inner) { - s.inner = slices.Grow(s.inner[:0], s.length) - } - s.inner = s.inner[:s.length] -} - -// Clip removes unused capacity from the inner slice. -func (s *Slice[T]) Clip() { - s.inner = slices.Clip(s.inner) -} - -// resetWithCapacity discards the current backing array and replaces it with a -// fresh one of the configured length and the given capacity. -// -// It is used by a capacity-capped pool to stop recycling an oversized backing -// array (the old array is left for the GC). -func (s *Slice[T]) resetWithCapacity(capacity int) { - s.inner = make([]T, s.length, max(s.length, capacity)) -} - -// PoolSlice is a pool of [Slice[T]]. -// -// [PoolSlice.BorrowWithRedeem] will return an empty inner slice by default. -// This default may be altered using [WithMinimumCapacity]. -// -// Use [PoolSlice.BorrowWithSizeAndRedeem] or [Slice.Grow] to grow the capacity -// of the inner slice. -type PoolSlice[T any] struct { - // redeemable is held as an unexported field rather than embedded, so the - // underlying [PoolRedeemable] and its [sync.Pool] are not part of PoolSlice's - // public surface. - redeemable *PoolRedeemable[Slice[T]] -} - -// PoolSliceOption alters the default settings to allocate new pooled slices -type PoolSliceOption func(*poolSliceOptions) - -type poolSliceOptions struct { - minCapacity int - length int - maxCapacity int -} - -func WithMinimumCapacity(size int) PoolSliceOption { - return func(o *poolSliceOptions) { - o.minCapacity = size - } -} - -// WithMaxCapacity bounds the capacity of recycled slices. -// -// When a borrowed slice has grown past size at redeem time, its (oversized) -// backing array is discarded and replaced with a fresh one sized to the minimum -// capacity, instead of being recycled. -// -// This stops the pool from accumulating large backing arrays after an -// occasional large request, keeping the steady-state memory bounded. -// -// The trade-off: a workload that genuinely needs slices larger than size will -// reallocate on every cycle. -// Set size from the high-water mark you actually expect, not below it. -// A size of 0 (the default) means no cap: grown slices are recycled as-is. -func WithMaxCapacity(size int) PoolSliceOption { - return func(o *poolSliceOptions) { - o.maxCapacity = size - } -} - -// WithLength ensures that the borrowed slices have a fixed given initial -// length. -// -// By default, the borrowed slices are reset to length 0. -func WithLength(size int) PoolSliceOption { - return func(o *poolSliceOptions) { - o.length = size - } -} - -// NewPoolSlice builds a pool to recycle slices of type []T. -func NewPoolSlice[T any](opts ...PoolSliceOption) *PoolSlice[T] { - var o poolSliceOptions - for _, apply := range opts { - apply(&o) - } - - rp := &PoolRedeemable[Slice[T]]{} - rp.pool = sync.Pool{ - New: func() any { - s := &redeemable[Slice[T]]{ - inner: &Slice[T]{ - length: o.length, - inner: make([]T, o.length, max(o.length, o.minCapacity)), - }, - } - - s.redeemer = func() { - if !s.state.CompareAndSwap(stateBorrowed, stateIdle) { - panic(redeemPanic) - } - if o.maxCapacity > 0 && s.inner.Cap() > o.maxCapacity { - s.inner.resetWithCapacity(o.minCapacity) - } else { - s.inner.Reset() - } - rp.pool.Put(s) - } - - return s - }, - } - rp.tracker.register() - - return &PoolSlice[T]{redeemable: rp} -} - -// BorrowWithRedeem returns the slice wrapper and the redeem closure to -// relinquish the allocated wrapper. -// -// The wrapper is reset (elements zeroed, length restored) both on borrow and -// when the redeem closure is called. -// Calling the redeem closure more than once panics. -func (p *PoolSlice[T]) BorrowWithRedeem() (*Slice[T], func()) { - return p.redeemable.BorrowWithRedeem() -} - -// BorrowWithSizeAndRedeem borrows a slice []T from the pool and ensures that -// its capacity is at least the provided size. -func (p *PoolSlice[T]) BorrowWithSizeAndRedeem(size int) (*Slice[T], func()) { - s, redeem := p.BorrowWithRedeem() - s.Grow(size) - - return s, redeem -} diff --git a/vendor/github.com/go-openapi/swag/yamlutils/ordered_map.go b/vendor/github.com/go-openapi/swag/yamlutils/ordered_map.go index 24d951f8de..3daf68dbba 100644 --- a/vendor/github.com/go-openapi/swag/yamlutils/ordered_map.go +++ b/vendor/github.com/go-openapi/swag/yamlutils/ordered_map.go @@ -123,7 +123,7 @@ func (s YAMLMapSlice) MarshalYAML() (any, error) { var nodes []*yaml.Node for _, item := range s { - nn, err := json2yaml(item.Value, 1) + nn, err := json2yaml(item.Value) if err != nil { return nil, err } @@ -153,17 +153,6 @@ func (s YAMLMapSlice) MarshalYAML() (any, error) { // // It implements [yaml.Unmarshaler]. func (s *YAMLMapSlice) UnmarshalYAML(node *yaml.Node) error { - return s.unmarshalYAML(newYAMLWalker(), node, 0) -} - -// unmarshalYAML builds the slice from a [yaml.Node], tracking the recursion depth (against -// stack-overflow) and threading the [yamlWalker] so anchor/alias expansion stays bounded -// across the whole document. -func (s *YAMLMapSlice) unmarshalYAML(w *yamlWalker, node *yaml.Node, depth int) error { - if depth > defaultMaxNestingDepth { - return errMaxNestingDepth - } - if typeutils.IsNil(*s) { // allow to unmarshal with a simple var declaration (nil slice) *s = YAMLMapSlice{} @@ -178,17 +167,13 @@ func (s *YAMLMapSlice) unmarshalYAML(w *yamlWalker, node *yaml.Node, depth int) m = m[:0] for i := 0; i < len(node.Content); i += 2 { - if err := w.account(); err != nil { // account the key node - return err - } - var nmi YAMLMapItem k, err := yamlStringScalarC(node.Content[i]) if err != nil { return fmt.Errorf("unable to decode YAML map key: %w: %w", err, ErrYAML) } nmi.Key = k - v, err := w.node(node.Content[i+1], depth+1) + v, err := yamlNode(node.Content[i+1]) if err != nil { return fmt.Errorf("unable to process YAML map value for key %q: %w: %w", k, err, ErrYAML) } @@ -201,11 +186,7 @@ func (s *YAMLMapSlice) unmarshalYAML(w *yamlWalker, node *yaml.Node, depth int) return nil } -func json2yaml(item any, depth int) (*yaml.Node, error) { - if depth > defaultMaxNestingDepth { - return nil, errMaxNestingDepth - } - +func json2yaml(item any) (*yaml.Node, error) { if typeutils.IsNil(item) { return &yaml.Node{ Kind: yaml.ScalarNode, @@ -215,7 +196,7 @@ func json2yaml(item any, depth int) (*yaml.Node, error) { switch val := item.(type) { case ifaces.Ordered: - return orderedYAML(val, depth) + return orderedYAML(val) case map[string]any: var n yaml.Node @@ -228,7 +209,7 @@ func json2yaml(item any, depth int) (*yaml.Node, error) { for _, k := range keys { v := val[k] - childNode, err := json2yaml(v, depth+1) + childNode, err := json2yaml(v) if err != nil { return nil, err } @@ -244,7 +225,7 @@ func json2yaml(item any, depth int) (*yaml.Node, error) { var n yaml.Node n.Kind = yaml.SequenceNode for i := range val { - childNode, err := json2yaml(val[i], depth+1) + childNode, err := json2yaml(val[i]) if err != nil { return nil, err } @@ -316,11 +297,11 @@ func uintegerNode[T conv.Unsigned](val T) (*yaml.Node, error) { }, nil } -func orderedYAML[T ifaces.Ordered](val T, depth int) (*yaml.Node, error) { +func orderedYAML[T ifaces.Ordered](val T) (*yaml.Node, error) { var n yaml.Node n.Kind = yaml.MappingNode for key, value := range val.OrderedItems() { - childNode, err := json2yaml(value, depth+1) + childNode, err := json2yaml(value) if err != nil { return nil, err } diff --git a/vendor/github.com/go-openapi/swag/yamlutils/yaml.go b/vendor/github.com/go-openapi/swag/yamlutils/yaml.go index d4b5335f6f..e3aff3c2fd 100644 --- a/vendor/github.com/go-openapi/swag/yamlutils/yaml.go +++ b/vendor/github.com/go-openapi/swag/yamlutils/yaml.go @@ -12,99 +12,13 @@ import ( yaml "go.yaml.in/yaml/v3" ) -// defaultMaxNestingDepth caps the recursion depth of the YAML<->JSON transforms to -// guard against stack-overflow on deeply nested (possibly adversarial) input. -// -// It matches the limit enforced by go.yaml.in/yaml/v3's own parser and by -// encoding/json's decoder. -const defaultMaxNestingDepth = 10000 - -// Bounds on YAML anchor/alias expansion. -// -// go.yaml.in/yaml/v3 enforces these when decoding into Go values, but that guard is -// coupled to the library's own tree walk: when we decode into a low-level [yaml.Node] -// (to preserve key order) and expand aliases ourselves in [yamlWalker.node], we bypass -// it. We therefore reproduce it here, with the same constants and ratio schedule as the -// library's decoder (see go.yaml.in/yaml/v3 decode.go, "excessive aliasing"). -const ( - aliasCountThreshold = 100 - decodeCountThreshold = 1000 - - // 400,000 decode operations is ~500kb of dense object declarations, or - // ~5kb of dense object declarations with 10000% alias expansion. - aliasRatioRangeLow = 400000 - // 4,000,000 decode operations is ~5MB of dense object declarations. - aliasRatioRangeHigh = 4000000 - aliasRatioRange = float64(aliasRatioRangeHigh - aliasRatioRangeLow) - - // tolerated share of alias-driven decodes: from aliasRatioSmall (small/medium documents) - // down to aliasRatioLarge (very large ones), interpolated with slope aliasRatioSlope. - aliasRatioSmall = 0.99 - aliasRatioLarge = 0.10 - aliasRatioSlope = aliasRatioSmall - aliasRatioLarge -) - -var ( - // errMaxNestingDepth is returned when a document nests deeper than [defaultMaxNestingDepth]. - errMaxNestingDepth = fmt.Errorf("maximum nesting depth of %d exceeded: %w", defaultMaxNestingDepth, ErrYAML) - - // errExcessiveAliasing is returned when anchor/alias expansion is disproportionate to the - // size of the document, i.e. an "alias bomb". - errExcessiveAliasing = fmt.Errorf("document contains excessive aliasing: %w", ErrYAML) -) - -// allowedAliasRatio scales the tolerated share of alias-driven decode operations from 99% -// for small-to-medium documents down to 10% for very large ones, mirroring go.yaml.in/yaml/v3. -func allowedAliasRatio(decodeCount int) float64 { - switch { - case decodeCount <= aliasRatioRangeLow: - return aliasRatioSmall - case decodeCount >= aliasRatioRangeHigh: - return aliasRatioLarge - default: - return aliasRatioSmall - aliasRatioSlope*(float64(decodeCount-aliasRatioRangeLow)/aliasRatioRange) - } -} - -// yamlWalker carries the state needed to bound a single YAML-tree traversal: -// anchor/alias expansion accounting and cycle detection. -// -// A fresh walker is created per top-level conversion; it is threaded (not copied) through -// the whole recursive walk so its counters accumulate across the entire document. -type yamlWalker struct { - decodeCount int - aliasCount int - aliasDepth int - aliases map[*yaml.Node]bool // anchors currently being expanded, for cycle detection -} - -func newYAMLWalker() *yamlWalker { - return &yamlWalker{aliases: make(map[*yaml.Node]bool)} -} - -// account records one processed node and fails if alias expansion has become excessive. -func (w *yamlWalker) account() error { - w.decodeCount++ - if w.aliasDepth > 0 { - w.aliasCount++ - } - - if w.aliasCount > aliasCountThreshold && - w.decodeCount > decodeCountThreshold && - float64(w.aliasCount)/float64(w.decodeCount) > allowedAliasRatio(w.decodeCount) { - return errExcessiveAliasing - } - - return nil -} - // YAMLToJSON converts a YAML document into JSON bytes. // // Note: a YAML document is the output from a [yaml.Marshaler], e.g a pointer to a [yaml.Node]. // // [YAMLToJSON] is typically called after [BytesToYAMLDoc]. func YAMLToJSON(value any) (json.RawMessage, error) { - jm, err := transformData(value, 0) + jm, err := transformData(value) if err != nil { return nil, err } @@ -130,73 +44,46 @@ func BytesToYAMLDoc(data []byte) (any, error) { return &document, nil } -func (w *yamlWalker) node(root *yaml.Node, depth int) (any, error) { - if depth > defaultMaxNestingDepth { - return nil, errMaxNestingDepth - } - if err := w.account(); err != nil { - return nil, err - } - +func yamlNode(root *yaml.Node) (any, error) { switch root.Kind { case yaml.DocumentNode: - return w.document(root, depth) + return yamlDocument(root) case yaml.SequenceNode: - return w.sequence(root, depth) + return yamlSequence(root) case yaml.MappingNode: - return w.mapping(root, depth) + return yamlMapping(root) case yaml.ScalarNode: return yamlScalar(root) case yaml.AliasNode: - return w.alias(root, depth) + return yamlNode(root.Alias) default: return nil, fmt.Errorf("unsupported YAML node type: %v: %w", root.Kind, ErrYAML) } } -// alias resolves an anchor reference, expanding the anchored subtree. It detects cycles -// (an anchor whose expansion transitively references itself) and accounts the expansion -// against the alias-bomb budget via [yamlWalker.aliasDepth]. -func (w *yamlWalker) alias(node *yaml.Node, depth int) (any, error) { - if node.Alias == nil { - return nil, fmt.Errorf("invalid YAML alias node %q: %w", node.Value, ErrYAML) - } - if w.aliases[node.Alias] { - return nil, fmt.Errorf("anchor %q contains itself: %w", node.Value, ErrYAML) - } - - w.aliases[node.Alias] = true - w.aliasDepth++ - out, err := w.node(node.Alias, depth+1) - w.aliasDepth-- - delete(w.aliases, node.Alias) - - return out, err -} - -func (w *yamlWalker) document(node *yaml.Node, depth int) (any, error) { +func yamlDocument(node *yaml.Node) (any, error) { if len(node.Content) != 1 { return nil, fmt.Errorf("unexpected YAML Document node content length: %d: %w", len(node.Content), ErrYAML) } - return w.node(node.Content[0], depth+1) + return yamlNode(node.Content[0]) } -func (w *yamlWalker) mapping(node *yaml.Node, depth int) (any, error) { +func yamlMapping(node *yaml.Node) (any, error) { const sensibleAllocDivider = 2 // nodes concatenate (key,value) sequences m := make(YAMLMapSlice, len(node.Content)/sensibleAllocDivider) - if err := m.unmarshalYAML(w, node, depth); err != nil { + if err := m.UnmarshalYAML(node); err != nil { return nil, err } return m, nil } -func (w *yamlWalker) sequence(node *yaml.Node, depth int) (any, error) { +func yamlSequence(node *yaml.Node) (any, error) { s := make([]any, 0) for i := range len(node.Content) { - v, err := w.node(node.Content[i], depth+1) + v, err := yamlNode(node.Content[i]) if err != nil { return nil, fmt.Errorf("unable to decode YAML sequence value: %w: %w", err, ErrYAML) } @@ -287,16 +174,12 @@ func format(t any) (string, error) { } } -func transformData(input any, depth int) (out any, err error) { - if depth > defaultMaxNestingDepth { - return nil, errMaxNestingDepth - } - +func transformData(input any) (out any, err error) { switch in := input.(type) { case yaml.Node: - return newYAMLWalker().node(&in, depth) + return yamlNode(&in) case *yaml.Node: - return newYAMLWalker().node(in, depth) + return yamlNode(in) case map[any]any: o := make(YAMLMapSlice, 0, len(in)) for ke, va := range in { @@ -305,7 +188,7 @@ func transformData(input any, depth int) (out any, err error) { return nil, err } - v, ert := transformData(va, depth+1) + v, ert := transformData(va) if ert != nil { return nil, ert } @@ -317,7 +200,7 @@ func transformData(input any, depth int) (out any, err error) { len1 := len(in) o := make([]any, len1) for i := range len1 { - o[i], err = transformData(in[i], depth+1) + o[i], err = transformData(in[i]) if err != nil { return nil, err } diff --git a/vendor/github.com/google/cel-go/cel/BUILD.bazel b/vendor/github.com/google/cel-go/cel/BUILD.bazel index 62a56036a0..c12e4904da 100644 --- a/vendor/github.com/google/cel-go/cel/BUILD.bazel +++ b/vendor/github.com/google/cel-go/cel/BUILD.bazel @@ -10,7 +10,6 @@ go_library( "cel.go", "decls.go", "env.go", - "fieldpaths.go", "folding.go", "inlining.go", "io.go", @@ -22,11 +21,10 @@ go_library( "prompt.go", "validator.go", ], - embedsrcs = ["templates/authoring.tmpl"], + embedsrcs = ["//cel/templates"], importpath = "github.com/google/cel-go/cel", visibility = ["//visibility:public"], deps = [ - "//cel/async:go_default_library", "//checker:go_default_library", "//checker/decls:go_default_library", "//common:go_default_library", @@ -45,7 +43,6 @@ go_library( "//interpreter:go_default_library", "//parser:go_default_library", "@dev_cel_expr//:expr", - "@dev_cel_expr//conformance/proto3:go_default_library", "@org_golang_google_genproto_googleapis_api//expr/v1alpha1:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", "@org_golang_google_protobuf//reflect/protodesc:go_default_library", @@ -66,12 +63,10 @@ go_test( "cel_test.go", "decls_test.go", "env_test.go", - "fieldpaths_test.go", "folding_test.go", "inlining_test.go", "io_test.go", "optimizer_test.go", - "program_async_test.go", "prompt_test.go", "validator_test.go", ], @@ -83,10 +78,8 @@ go_test( ], embedsrcs = [ "//cel/testdata:prompts", - "//cel/testdata:test_fds_with_source_info", ], deps = [ - "//cel/async:go_default_library", "//common/operators:go_default_library", "//common/overloads:go_default_library", "//common/types:go_default_library", @@ -96,7 +89,6 @@ go_test( "//test:go_default_library", "//test/proto2pb:go_default_library", "//test/proto3pb:go_default_library", - "@com_github_google_go_cmp//cmp:go_default_library", "@org_golang_google_genproto_googleapis_api//expr/v1alpha1:go_default_library", "@org_golang_google_protobuf//encoding/prototext:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", @@ -104,8 +96,3 @@ go_test( "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library", ], ) - -exports_files( - ["templates/authoring.tmpl"], - visibility = ["//visibility:public"], -) diff --git a/vendor/github.com/google/cel-go/cel/async/BUILD.bazel b/vendor/github.com/google/cel-go/cel/async/BUILD.bazel deleted file mode 100644 index 85b28bcdb5..0000000000 --- a/vendor/github.com/google/cel-go/cel/async/BUILD.bazel +++ /dev/null @@ -1,35 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") - -package( - licenses = ["notice"], # Apache 2.0 -) - -go_library( - name = "go_default_library", - srcs = [ - "async.go", - ], - importpath = "github.com/google/cel-go/cel/async", - visibility = ["//visibility:public"], - deps = [ - "//common/decls:go_default_library", - "//common/functions:go_default_library", - "//common/types:go_default_library", - "//common/types/ref:go_default_library", - "//interpreter:go_default_library", - ], -) - -go_test( - name = "go_default_test", - srcs = [ - "async_test.go", - ], - deps = [ - ":go_default_library", - "//common/decls:go_default_library", - "//common/functions:go_default_library", - "//common/types:go_default_library", - "//common/types/ref:go_default_library", - ], -) diff --git a/vendor/github.com/google/cel-go/cel/async/async.go b/vendor/github.com/google/cel-go/cel/async/async.go deleted file mode 100644 index a011114bdc..0000000000 --- a/vendor/github.com/google/cel-go/cel/async/async.go +++ /dev/null @@ -1,235 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -// Package async provides helpers for configuring and executing asynchronous CEL functions, -// including drain strategies, retry, timeout, concurrency limiting, and caching wrappers. -package async - -import ( - "context" - "errors" - "time" - - "github.com/google/cel-go/common/decls" - "github.com/google/cel-go/common/functions" - "github.com/google/cel-go/common/types" - "github.com/google/cel-go/common/types/ref" - "github.com/google/cel-go/interpreter" -) - -// Call describes a pending or completed asynchronous function call. -// This interface exposes a safe, read-only view of the internal interpreter state. -type Call = interpreter.AsyncCall - -// Observer provides callbacks for monitoring the lifecycle of asynchronous function calls. -// -// Implementations must be safe for concurrent use: the start and finish callbacks run on different -// goroutines, and finish callbacks for distinct calls may run concurrently. See -// interpreter.AsyncObserver for details. -type Observer = interpreter.AsyncObserver - -// BlockingOp is a blocking asynchronous function operation. -type BlockingOp = functions.BlockingAsyncOp - -// DrainAction dictates what ConcurrentEval should do after inspecting completions. -type DrainAction struct { - // Reevaluate indicates that the AST should be re-evaluated immediately. - // If true, WaitDuration is ignored. - Reevaluate bool - // WaitDuration indicates how long the evaluator should wait for additional - // completions before deciding to re-evaluate. A duration of 0 means wait - // indefinitely (block on the next completion). - WaitDuration time.Duration -} - -// DrainStrategy controls when ConcurrentEval re-evaluates after async completions. -// -// The evaluator consults the strategy each time a completion is received. -type DrainStrategy interface { - // NextAction evaluates the current state of asynchronous evaluation and - // determines the next step. - // - // - completed: The set of completions accumulated in the current batch. - // - active: The number of async calls currently launched but unresolved. - NextAction(completed []Call, active int) DrainAction -} - -// DrainNone returns a strategy that re-evaluates after every single completion. -// This is the default strategy. -func DrainNone() DrainStrategy { - return drainNone{} -} - -type drainNone struct{} - -func (drainNone) NextAction(completed []Call, active int) DrainAction { - return DrainAction{Reevaluate: active == 0 || len(completed) > 0} -} - -// DrainReady returns a strategy that waits for a short duration after the first -// completion to batch any other functions that complete at roughly the same time. -func DrainReady(debounce time.Duration) DrainStrategy { - return drainReady{debounce: debounce} -} - -type drainReady struct { - debounce time.Duration -} - -func (d drainReady) NextAction(completed []Call, active int) DrainAction { - if active == 0 { - return DrainAction{Reevaluate: true} // Nothing left to wait for - } - if len(completed) == 0 { - return DrainAction{Reevaluate: false, WaitDuration: 0} // Wait indefinitely for first - } - return DrainAction{Reevaluate: false, WaitDuration: d.debounce} // Wait for debounce period -} - -// DrainAll returns a strategy that waits for all currently pending calls to -// complete before re-evaluating. -// -// Note: This strategy is optimal for independent async calls, but will over-wait -// if some calls depend on the results of others. -func DrainAll() DrainStrategy { - return drainAll{} -} - -type drainAll struct{} - -func (drainAll) NextAction(completed []Call, active int) DrainAction { - return DrainAction{Reevaluate: active == 0} -} - -// Timeout wraps a BlockingAsyncOp with a per-call timeout. -// -// The timeout is enforced even when the wrapped function ignores its context: the function runs on -// its own goroutine and Timeout selects on the deadline, returning a timeout error when it -// fires. A function that ignores cancellation cannot be forcibly stopped (Go cannot kill a -// goroutine), so its goroutine continues running in the background until it returns on its own; -// only its result is abandoned. This is the recommended way to bound functions that may hang or -// are not under the caller's control. The extra goroutine is incurred only by Timeout-wrapped -// calls, not by async evaluation in general. -func Timeout(fn functions.BlockingAsyncOp, timeout time.Duration) functions.BlockingAsyncOp { - return func(ctx context.Context, args ...ref.Val) ref.Val { - tCtx, cancel := context.WithTimeout(ctx, timeout) - defer cancel() - resCh := make(chan ref.Val, 1) - go func() { resCh <- fn(tCtx, args...) }() - select { - case res := <-resCh: - return res - case <-tCtx.Done(): - return types.NewErr("operation timed out after %v: %v", timeout, tCtx.Err()) - } - } -} - -// TimeoutBinding wraps a BlockingAsyncOp with a per-call timeout and returns an OverloadOpt. -func TimeoutBinding(fn functions.BlockingAsyncOp, timeout time.Duration) decls.OverloadOpt { - return decls.AsyncBinding(Timeout(fn, timeout)) -} - -// RetryOption configures the behavior of RetryBinding. -type RetryOption func(*retryConfig) - -type retryConfig struct { - maxAttempts int - backoff time.Duration -} - -// RetryAttempts sets the maximum number of attempts (including the first one). -func RetryAttempts(attempts int) RetryOption { - return func(c *retryConfig) { - c.maxAttempts = attempts - } -} - -// RetryBackoff sets the fixed backoff duration between attempts. -func RetryBackoff(backoff time.Duration) RetryOption { - return func(c *retryConfig) { - c.backoff = backoff - } -} - -// RetryableError is an interface that errors can implement to signal whether they are retryable. -type RetryableError interface { - error - IsRetryable() bool -} - -// Retry wraps a BlockingAsyncOp with a retry policy. -// It will retry the operation if it returns a types.Err that wraps a RetryableError returning true for IsRetryable. -func Retry(fn functions.BlockingAsyncOp, opts ...RetryOption) functions.BlockingAsyncOp { - config := &retryConfig{ - maxAttempts: 3, - backoff: 100 * time.Millisecond, - } - for _, opt := range opts { - opt(config) - } - - return func(ctx context.Context, args ...ref.Val) ref.Val { - var lastErr ref.Val - var backoff *time.Timer - defer func() { - if backoff != nil { - backoff.Stop() - } - }() - for i := 0; i < config.maxAttempts; i++ { - if i > 0 { - // Reuse a single timer across attempts and stop it on cancellation so the - // pending timer is not left to fire after the call returns. - if backoff == nil { - backoff = time.NewTimer(config.backoff) - } else { - backoff.Reset(config.backoff) - } - select { - case <-backoff.C: - case <-ctx.Done(): - backoff.Stop() - return types.NewErr("operation cancelled during retry: %v", ctx.Err()) - } - } - - res := fn(ctx, args...) - if !types.IsError(res) { - return res - } - - err := res.(*types.Err) - lastErr = res - - if !isRetryable(err) { - return res - } - } - return lastErr - } -} - -// RetryBinding wraps a BlockingAsyncOp with a retry policy and returns an OverloadOpt. -func RetryBinding(fn functions.BlockingAsyncOp, opts ...RetryOption) decls.OverloadOpt { - return decls.AsyncBinding(Retry(fn, opts...)) -} - -func isRetryable(err *types.Err) bool { - var re RetryableError - if errors.As(err, &re) { - return re.IsRetryable() - } - return false -} diff --git a/vendor/github.com/google/cel-go/cel/cel.go b/vendor/github.com/google/cel-go/cel/cel.go index 9ba957a7e3..eb5a9f4cc5 100644 --- a/vendor/github.com/google/cel-go/cel/cel.go +++ b/vendor/github.com/google/cel-go/cel/cel.go @@ -17,24 +17,3 @@ // CEL is a non-Turing complete expression language designed to parse, check, and evaluate // expressions against user-defined environments. package cel - -// Compile is a convenience function that constructs a new Env using the provided EnvOption values, -// compiles the expression string, and plans an executable Program. -// -// Warning: Creating a new environment for every compilation is expensive. Environment setup should be done once -// and shared across expression compilations when the options remain the same. -func Compile(expression string, opts ...EnvOption) (Program, error) { - env, err := NewEnv(opts...) - if err != nil { - return nil, err - } - ast, iss := env.Compile(expression) - if iss.Err() != nil { - return nil, iss.Err() - } - prg, err := env.Program(ast, EvalOptions(OptOptimize)) - if err != nil { - return nil, err - } - return prg, nil -} diff --git a/vendor/github.com/google/cel-go/cel/decls.go b/vendor/github.com/google/cel-go/cel/decls.go index c7c23fd51b..4d4873bd6b 100644 --- a/vendor/github.com/google/cel-go/cel/decls.go +++ b/vendor/github.com/google/cel-go/cel/decls.go @@ -346,32 +346,6 @@ func LateFunctionBinding() OverloadOpt { return decls.LateFunctionBinding() } -// AsyncBinding provides the implementation of an asynchronous overload. The provided function -// is called in its own goroutine with the provided context. The function should block until -// the result is available, and the framework manages goroutine and channel lifecycle. -// -// This follows the same pattern used by gRPC-Go and other major Go frameworks where user -// code is synchronous and the framework manages concurrency. -// -// Context contract: the function MUST return promptly once its context is cancelled. The -// framework cannot forcibly terminate the goroutine running the function, so a function that -// ignores cancellation will leak its goroutine and hold a concurrency slot (see -// AsyncMaxConcurrency) until it returns on its own. For functions that may hang or that are not -// under your control, wrap them with async.TimeoutBinding to bound their runtime. -func AsyncBinding(fn functions.BlockingAsyncOp) OverloadOpt { - return decls.AsyncBinding(fn) -} - -// SingletonAsyncBinding creates a singleton async function definition from a blocking function, -// to be used with all function overloads. The provided function is called in its own goroutine -// with the provided context. -// -// Note, this approach works well if operand is expected to have a specific trait which it implements, -// e.g. traits.ContainerType. Otherwise, prefer per-overload async bindings. -func SingletonAsyncBinding(fn functions.BlockingAsyncOp, traits ...int) FunctionOpt { - return decls.SingletonAsyncBinding(fn, traits...) -} - // OverloadIsNonStrict enables the function to be called with error and unknown argument values. // // Note: do not use this option unless absoluately necessary as it should be an uncommon feature. diff --git a/vendor/github.com/google/cel-go/cel/env.go b/vendor/github.com/google/cel-go/cel/env.go index 784790ba2c..58819e872a 100644 --- a/vendor/github.com/google/cel-go/cel/env.go +++ b/vendor/github.com/google/cel-go/cel/env.go @@ -18,8 +18,6 @@ import ( "errors" "fmt" "math" - "slices" - "strings" "sync" "github.com/google/cel-go/checker" @@ -48,10 +46,6 @@ type Source = common.Source type Ast struct { source Source impl *celast.AST - // loadErr captures an error detected while loading the AST (e.g. an over-deep AST ingested via - // ParsedExprToAst / CheckedExprToAst) so it can be surfaced when the Ast is checked or planned - // instead of recursing into the checker or planner on adversarially deep input. - loadErr error } // NativeRep converts the AST to a Go-native representation. @@ -145,7 +139,6 @@ type Env struct { provider types.Provider features map[int]bool appliedFeatures map[int]bool - limits map[limitID]int libraries map[string]SingletonLibrary validators []ASTValidator costOptions []checker.CostOption @@ -188,16 +181,6 @@ func (e *Env) ToConfig(name string) (*env.Config, error) { conf.AddImports(env.NewImport(typeName)) } - // Serialize features - for featID, enabled := range e.features { - featName, found := featureNameByID(featID) - if !found { - // If the feature isn't named, it isn't intended to be publicly exposed - continue - } - conf.AddFeatures(env.NewFeature(featName, enabled)) - } - libOverloads := map[string][]string{} for libName, lib := range e.libraries { // Track the options which have been configured by a library and @@ -258,7 +241,7 @@ func (e *Env) ToConfig(name string) (*env.Config, error) { fields := e.contextProto.Fields() for i := 0; i < fields.Len(); i++ { field := fields.Get(i) - variable, err := fieldToVariable(field, e.HasFeature(featureJSONFieldNames)) + variable, err := fieldToVariable(field) if err != nil { return nil, fmt.Errorf("could not serialize context field variable %q, reason: %w", field.FullName(), err) } @@ -293,45 +276,16 @@ func (e *Env) ToConfig(name string) (*env.Config, error) { } } - for id, val := range e.limits { - limitName, found := limitNameByID(id) - if !found || val == 0 { - // skip if explicitly defaulted or not supported in config + // Serialize features + for featID, enabled := range e.features { + featName, found := featureNameByID(featID) + if !found { + // If the feature isn't named, it isn't intended to be publicly exposed continue } - conf.AddLimits(env.NewLimit(limitName, val)) + conf.AddFeatures(env.NewFeature(featName, enabled)) } - // Sort repeated fields in config where reasonable to make the export - // stable. - slices.SortFunc(conf.Imports, func(a *env.Import, b *env.Import) int { - return strings.Compare(a.Name, b.Name) - }) - - slices.SortFunc(conf.Extensions, func(a *env.Extension, b *env.Extension) int { - return strings.Compare(a.Name, b.Name) - }) - - slices.SortFunc(conf.Variables, func(a *env.Variable, b *env.Variable) int { - return strings.Compare(a.Name, b.Name) - }) - - slices.SortFunc(conf.Functions, func(a *env.Function, b *env.Function) int { - return strings.Compare(a.Name, b.Name) - }) - - slices.SortFunc(conf.Validators, func(a *env.Validator, b *env.Validator) int { - return strings.Compare(a.Name, b.Name) - }) - - slices.SortFunc(conf.Features, func(a *env.Feature, b *env.Feature) int { - return strings.Compare(a.Name, b.Name) - }) - - slices.SortFunc(conf.Limits, func(a *env.Limit, b *env.Limit) int { - return strings.Compare(a.Name, b.Name) - }) - return conf, nil } @@ -365,7 +319,7 @@ func NewEnv(opts ...EnvOption) (*Env, error) { // See the EnvOption helper functions for the options that can be used to configure the // environment. func NewCustomEnv(opts ...EnvOption) (*Env, error) { - registry, err := types.NewProtoRegistry() + registry, err := types.NewRegistry() if err != nil { return nil, err } @@ -379,7 +333,6 @@ func NewCustomEnv(opts ...EnvOption) (*Env, error) { provider: registry, features: map[int]bool{}, appliedFeatures: map[int]bool{}, - limits: map[limitID]int{}, libraries: map[string]SingletonLibrary{}, validators: []ASTValidator{}, progOpts: []ProgramOption{}, @@ -399,20 +352,6 @@ func NewCustomEnv(opts ...EnvOption) (*Env, error) { // It is possible to have both non-nil Ast and Issues values returned from this call: however, // the mere presence of an Ast does not imply that it is valid for use. func (e *Env) Check(ast *Ast) (*Ast, *Issues) { - // Surface any error recorded while the Ast was loaded (e.g. an over-deep AST rejected by - // ParsedExprToAst / CheckedExprToAst) before recursing into the type checker on it. - if ast != nil && ast.loadErr != nil { - errs := common.NewErrors(ast.Source()) - errs.ReportErrorString(common.NoLocation, ast.loadErr.Error()) - return nil, NewIssuesWithSourceInfo(errs, ast.NativeRep().SourceInfo()) - } - if nodeLimit := e.configuredExpressionNodeLimit(); nodeLimit > 0 && ast != nil && ast.NativeRep() != nil { - if count := celast.NodeCount(ast.NativeRep()); count > nodeLimit { - errs := common.NewErrors(ast.Source()) - errs.ReportErrorString(common.NoLocation, fmt.Sprintf("expression node count exceeds limit: count %d, limit %d", count, nodeLimit)) - return nil, NewIssuesWithSourceInfo(errs, ast.NativeRep().SourceInfo()) - } - } // Construct the internal checker env, erroring if there is an issue adding the declarations. chk, err := e.initChecker() if err != nil { @@ -454,24 +393,6 @@ func (e *Env) Check(ast *Ast) (*Ast, *Issues) { return ast, nil } -// configuredExpressionSizeLimit returns the effective expression size code point limit. -// A zero value means "use the parser default". -func (e *Env) configuredExpressionSizeLimit() int { - if l := e.limits[limitCodePointSize]; l != 0 { - return l - } - return 100_000 -} - -// configuredExpressionNodeLimit returns the effective expression node limit. -// A zero value means "use default". -func (e *Env) configuredExpressionNodeLimit() int { - if l := e.limits[limitExpressionNodeCount]; l != 0 { - return l - } - return 100_000 -} - // Compile combines the Parse and Check phases CEL program compilation to produce an Ast and // associated issues. // @@ -481,11 +402,7 @@ func (e *Env) configuredExpressionNodeLimit() int { // // Note, for parse-only uses of CEL use Parse. func (e *Env) Compile(txt string) (*Ast, *Issues) { - src, err := common.NewTextSourceWithLimit(txt, e.configuredExpressionSizeLimit()) - if err != nil { - return nil, ErrorAsIssues(err) - } - return e.CompileSource(src) + return e.CompileSource(common.NewTextSource(txt)) } // CompileSource combines the Parse and Check phases CEL program compilation to produce an Ast and @@ -580,10 +497,6 @@ func (e *Env) Extend(opts ...EnvOption) (*Env, error) { for k, v := range e.appliedFeatures { appliedFeaturesCopy[k] = v } - limitsCopy := make(map[limitID]int, len(e.limits)) - for k, v := range e.limits { - limitsCopy[k] = v - } funcsCopy := make(map[string]*decls.FunctionDecl, len(e.functions)) for k, v := range e.functions { funcsCopy[k] = v @@ -594,7 +507,6 @@ func (e *Env) Extend(opts ...EnvOption) (*Env, error) { } validatorsCopy := make([]ASTValidator, len(e.validators)) copy(validatorsCopy, e.validators) - costOptsCopy := make([]checker.CostOption, len(e.costOptions)) copy(costOptsCopy, e.costOptions) @@ -607,7 +519,6 @@ func (e *Env) Extend(opts ...EnvOption) (*Env, error) { progOpts: progOptsCopy, adapter: adapter, features: featuresCopy, - limits: limitsCopy, appliedFeatures: appliedFeaturesCopy, libraries: libsCopy, validators: validatorsCopy, @@ -690,10 +601,7 @@ func (e *Env) Validators() []ASTValidator { // This form of Parse creates a Source value for the input `txt` and forwards to the // ParseSource method. func (e *Env) Parse(txt string) (*Ast, *Issues) { - src, err := common.NewTextSourceWithLimit(txt, e.configuredExpressionSizeLimit()) - if err != nil { - return nil, ErrorAsIssues(err) - } + src := common.NewTextSource(txt) return e.ParseSource(src) } @@ -714,12 +622,6 @@ func (e *Env) ParseSource(src Source) (*Ast, *Issues) { // Program generates an evaluable instance of the Ast within the environment (Env). func (e *Env) Program(ast *Ast, opts ...ProgramOption) (Program, error) { - // Surface any error recorded while the Ast was loaded (e.g. an over-deep AST rejected by - // ParsedExprToAst / CheckedExprToAst) rather than recursing into the planner on it. This is a - // cheap field read; the depth traversal itself runs once at conversion time, not here. - if ast != nil && ast.loadErr != nil { - return nil, ast.loadErr - } return e.PlanProgram(ast.NativeRep(), opts...) } @@ -883,35 +785,11 @@ func (e *Env) configure(opts []EnvOption) (*Env, error) { if e.HasFeature(featureIdentEscapeSyntax) { prsrOpts = append(prsrOpts, parser.EnableIdentEscapeSyntax(true)) } - if l := e.limits[limitParseErrorRecovery]; l != 0 { - prsrOpts = append(prsrOpts, parser.ErrorRecoveryLimit(l)) - } - if l := e.limits[limitCodePointSize]; l != 0 { - prsrOpts = append(prsrOpts, parser.ExpressionSizeCodePointLimit(l)) - } - if l := e.limits[limitParseRecursionDepth]; l != 0 { - prsrOpts = append(prsrOpts, parser.MaxRecursionDepth(l)) - } - if l := e.limits[limitExpressionNodeCount]; l != 0 { - prsrOpts = append(prsrOpts, parser.MaxExpressionNodeCount(l)) - } e.prsr, err = parser.NewParser(prsrOpts...) if err != nil { return nil, err } - // Enable JSON field names is using a proto-based *types.Registry - if e.HasFeature(featureJSONFieldNames) { - reg, isReg := e.provider.(*types.Registry) - if !isReg { - return nil, fmt.Errorf("JSONFieldNames() option is only compatible with *types.Registry providers") - } - err := reg.WithJSONFieldNames(true) - if err != nil { - return nil, err - } - } - // Ensure that the checker init happens eagerly rather than lazily. if e.HasFeature(featureEagerlyValidateDeclarations) { _, err := e.initChecker() @@ -930,8 +808,6 @@ func (e *Env) initChecker() (*checker.Env, error) { chkOpts = append(chkOpts, checker.CrossTypeNumericComparisons( e.HasFeature(featureCrossTypeNumericComparisons))) - chkOpts = append(chkOpts, - checker.JSONFieldNames(e.HasFeature(featureJSONFieldNames))) ce, err := checker.NewEnv(e.Container, e.provider, chkOpts...) if err != nil { @@ -1001,16 +877,6 @@ type Issues struct { info *celast.SourceInfo } -// ErrorAsIssues wraps a Golang error into a CEL common error and issue set. -// -// This is a convenience method for early returning from an expression validation call path due to -// internal state or configuration which is unrelated to the source being validated. -func ErrorAsIssues(err error) *Issues { - errs := common.NewErrors(common.NewTextSource("")) - errs.ReportErrorString(common.NoLocation, err.Error()) - return NewIssues(errs) -} - // NewIssues returns an Issues struct from a common.Errors object. func NewIssues(errs *common.Errors) *Issues { return NewIssuesWithSourceInfo(errs, nil) @@ -1119,10 +985,9 @@ func (p *interopCELTypeProvider) FindStructFieldType(structType, fieldName strin return nil, false } return &types.FieldType{ - Type: t, - IsSet: ft.IsSet, - GetFrom: ft.GetFrom, - IsJSONField: ft.IsJSONField, + Type: t, + IsSet: ft.IsSet, + GetFrom: ft.GetFrom, }, true } return nil, false diff --git a/vendor/github.com/google/cel-go/cel/fieldpaths.go b/vendor/github.com/google/cel-go/cel/fieldpaths.go deleted file mode 100644 index 570fce3a46..0000000000 --- a/vendor/github.com/google/cel-go/cel/fieldpaths.go +++ /dev/null @@ -1,163 +0,0 @@ -package cel - -import ( - "slices" - "strings" - - "github.com/google/cel-go/common" - "github.com/google/cel-go/common/types" -) - -// fieldPath represents a selection path to a field from a variable in a CEL environment. -type fieldPath struct { - celType *Type - // path represents the selection path to the field. - path string - description string - isLeaf bool -} - -// Documentation implements the Documentor interface. -func (f *fieldPath) Documentation() *common.Doc { - return common.NewFieldDoc(f.path, f.celType.String(), f.description) -} - -type documentationProvider interface { - // FindStructFieldDescription returns documentation for a field if available. - // Returns false if the field could not be found. - FindStructFieldDescription(typeName, fieldName string) (string, bool) -} - -type backtrack struct { - // provider used to resolve types. - provider types.Provider - // paths of fields that have been visited along the path. - path []string - // types of fields that have been visited along the path. used to avoid cycles. - types []*Type -} - -func (b *backtrack) push(pathStep string, celType *Type) { - b.path = append(b.path, pathStep) - b.types = append(b.types, celType) -} - -func (b *backtrack) pop() { - b.path = b.path[:len(b.path)-1] - b.types = b.types[:len(b.types)-1] -} - -func formatPath(path []string) string { - var buffer strings.Builder - for i, p := range path { - if i == 0 { - buffer.WriteString(p) - continue - } - if strings.HasPrefix(p, "[") { - buffer.WriteString(p) - continue - } - buffer.WriteString(".") - buffer.WriteString(p) - } - return buffer.String() -} - -func (b *backtrack) expandFieldPaths(celType *Type, paths []*fieldPath) []*fieldPath { - if slices.ContainsFunc(b.types[:len(b.types)-1], func(t *Type) bool { return t.String() == celType.String() }) { - // Cycle detected, so stop expanding. - paths[len(paths)-1].isLeaf = false - return paths - } - switch celType.Kind() { - case types.StructKind: - fields, ok := b.provider.FindStructFieldNames(celType.String()) - if !ok { - // Caller added this type to the path, so it must be a leaf. - paths[len(paths)-1].isLeaf = true - return paths - } - for _, field := range fields { - fieldType, ok := b.provider.FindStructFieldType(celType.String(), field) - if !ok { - // Field not found, either hidden or an error. - continue - } - b.push(field, celType) - description := "" - if docProvider, ok := b.provider.(documentationProvider); ok { - description, _ = docProvider.FindStructFieldDescription(celType.String(), field) - } - path := &fieldPath{ - celType: fieldType.Type, - path: formatPath(b.path), - description: description, - isLeaf: false, - } - paths = append(paths, path) - paths = b.expandFieldPaths(fieldType.Type, paths) - b.pop() - } - return paths - case types.MapKind: - if len(celType.Parameters()) != 2 { - // dynamic map, so treat as a leaf. - paths[len(paths)-1].isLeaf = true - return paths - } - mapKeyType := celType.Parameters()[0] - mapValueType := celType.Parameters()[1] - // Add a placeholder for the map key kind (the zero value). - keyIdentifier := "" - switch mapKeyType.Kind() { - case types.StringKind: - keyIdentifier = "[\"\"]" - case types.IntKind: - keyIdentifier = "[0]" - case types.UintKind: - keyIdentifier = "[0u]" - case types.BoolKind: - keyIdentifier = "[false]" - default: - // Caller added this type to the path, so it must be a leaf. - paths[len(paths)-1].isLeaf = true - return paths - } - b.push(keyIdentifier, mapValueType) - defer b.pop() - return b.expandFieldPaths(mapValueType, paths) - case types.ListKind: - if len(celType.Parameters()) != 1 { - // dynamic list, so treat as a leaf. - paths[len(paths)-1].isLeaf = true - return paths - } - listElemType := celType.Parameters()[0] - b.push("[0]", listElemType) - defer b.pop() - return b.expandFieldPaths(listElemType, paths) - default: - paths[len(paths)-1].isLeaf = true - } - - return paths -} - -// fieldPathsForType expands the reachable fields from the given root identifier. -func fieldPathsForType(provider types.Provider, identifier string, celType *Type) []*fieldPath { - b := &backtrack{ - provider: provider, - path: []string{identifier}, - types: []*Type{celType}, - } - paths := []*fieldPath{ - { - celType: celType, - path: identifier, - isLeaf: false, - }, - } - - return b.expandFieldPaths(celType, paths) -} diff --git a/vendor/github.com/google/cel-go/cel/folding.go b/vendor/github.com/google/cel-go/cel/folding.go index 5525f0805e..d1ea6b19db 100644 --- a/vendor/github.com/google/cel-go/cel/folding.go +++ b/vendor/github.com/google/cel-go/cel/folding.go @@ -15,8 +15,6 @@ package cel import ( - "context" - "errors" "fmt" "github.com/google/cel-go/common/ast" @@ -95,18 +93,18 @@ func (opt *constantFoldingOptimizer) Optimize(ctx *OptimizerContext, a *ast.AST) for _, fold := range foldableExprs { // If the expression could be folded because it's a non-strict call, and the // branches are pruned, continue to the next fold. - if fold.Kind() == ast.CallKind && maybePruneBranches(ctx, a, fold) { + if fold.Kind() == ast.CallKind && maybePruneBranches(ctx, fold) { continue } // Late-bound function calls cannot be folded. - if fold.Kind() == ast.CallKind && isLateBoundFunctionCall(ctx, fold) { + if fold.Kind() == ast.CallKind && isLateBoundFunctionCall(ctx, a, fold) { continue } // Otherwise, assume all context is needed to evaluate the expression. err := opt.tryFold(ctx, a, fold) - // Ignore errors for identifiers or subexpressions that cannot be folded, since there is no guarantee that the environment + // Ignore errors for identifiers, since there is no guarantee that the environment // has a value for them. - if err != nil && fold.Kind() != ast.IdentKind && !errors.Is(err, errCannotFold) { + if err != nil && fold.Kind() != ast.IdentKind { ctx.ReportErrorAtID(fold.ID(), "constant-folding evaluation failed: %v", err.Error()) return a } @@ -144,19 +142,24 @@ func (opt *constantFoldingOptimizer) Optimize(ctx *OptimizerContext, a *ast.AST) return a } -var errCannotFold = errors.New("subexpression cannot be folded") - // tryFold attempts to evaluate a sub-expression to a literal. // // If the evaluation succeeds, the input expr value will be modified to become a literal, otherwise // the method will return an error. func (opt *constantFoldingOptimizer) tryFold(ctx *OptimizerContext, a *ast.AST, expr ast.Expr) error { + // Assume all context is needed to evaluate the expression. + subAST := &Ast{ + impl: ast.NewCheckedAST(ast.NewAST(expr, a.SourceInfo()), a.TypeMap(), a.ReferenceMap()), + } + prg, err := ctx.Program(subAST) + if err != nil { + return err + } activation := opt.knownValues if activation == nil { activation = NoVars() } - navExpr := expr.(ast.NavigableExpr) - out, err := evaluateExpr(ctx, a, navExpr, activation) + out, _, err := prg.Eval(activation) if err != nil { return err } @@ -165,31 +168,7 @@ func (opt *constantFoldingOptimizer) tryFold(ctx *OptimizerContext, a *ast.AST, return nil } -func evaluateExpr(ctx *OptimizerContext, a *ast.AST, navigableExpr ast.NavigableExpr, activation Activation) (ref.Val, error) { - partialActivation, err := ctx.PartialVars(activation) - if err != nil { - return nil, err - } - subAST := &Ast{ - impl: ast.NewCheckedAST(ast.NewAST(navigableExpr, a.SourceInfo()), a.TypeMap(), a.ReferenceMap()), - } - prg, err := ctx.Program(subAST) - if err != nil { - return nil, err - } - // Folding will not attempt to call async functions which are all marked as late-bound, - // but the presence of such functions requires the use of `ConcurrentEval` in order to - // avoid an early return error which blocks async functions from running in `Eval` and - // `ContextEval` call paths. - resCh := prg.ConcurrentEval(context.Background(), partialActivation) - res := <-resCh - if res.Err != nil || types.IsUnknown(res.Val) { - return nil, errCannotFold - } - return res.Val, nil -} - -func isLateBoundFunctionCall(ctx *OptimizerContext, expr ast.Expr) bool { +func isLateBoundFunctionCall(ctx *OptimizerContext, a *ast.AST, expr ast.Expr) bool { call := expr.AsCall() function := ctx.Functions()[call.FunctionName()] if function == nil { @@ -202,12 +181,12 @@ func isLateBoundFunctionCall(ctx *OptimizerContext, expr ast.Expr) bool { // a branch can be removed. Evaluation will naturally prune logical and / or calls, // but conditional will not be pruned cleanly, so this is one small area where the // constant folding step reimplements a portion of the evaluator. -func maybePruneBranches(ctx *OptimizerContext, a *ast.AST, expr ast.NavigableExpr) bool { +func maybePruneBranches(ctx *OptimizerContext, expr ast.NavigableExpr) bool { call := expr.AsCall() args := call.Args() switch call.FunctionName() { case operators.LogicalAnd, operators.LogicalOr: - return maybeShortcircuitLogic(ctx, a, call.FunctionName(), args, expr) + return maybeShortcircuitLogic(ctx, call.FunctionName(), args, expr) case operators.Conditional: cond := args[0] truthy := args[1] @@ -228,17 +207,11 @@ func maybePruneBranches(ctx *OptimizerContext, a *ast.AST, expr ast.NavigableExp return true } needle := args[0] - if (needle.Kind() == ast.LiteralKind || isSelfEqualIdent(needle)) && haystack.Kind() == ast.ListKind { - needleIsLit := needle.Kind() == ast.LiteralKind - needleLitVal := needle.AsLiteral() - needleIdentVal := needle.AsIdent() + if needle.Kind() == ast.LiteralKind && haystack.Kind() == ast.ListKind { + needleValue := needle.AsLiteral() list := haystack.AsList() - for _, elem := range list.Elements() { - if needleIsLit && elem.Kind() == ast.LiteralKind && elem.AsLiteral().Equal(needleLitVal) == types.True { - ctx.UpdateExpr(expr, ctx.NewLiteral(types.True)) - return true - } - if !needleIsLit && elem.Kind() == ast.IdentKind && elem.AsIdent() == needleIdentVal { + for _, e := range list.Elements() { + if e.Kind() == ast.LiteralKind && e.AsLiteral().Equal(needleValue) == types.True { ctx.UpdateExpr(expr, ctx.NewLiteral(types.True)) return true } @@ -248,7 +221,7 @@ func maybePruneBranches(ctx *OptimizerContext, a *ast.AST, expr ast.NavigableExp return false } -func maybeShortcircuitLogic(ctx *OptimizerContext, a *ast.AST, function string, args []ast.Expr, expr ast.NavigableExpr) bool { +func maybeShortcircuitLogic(ctx *OptimizerContext, function string, args []ast.Expr, expr ast.NavigableExpr) bool { shortcircuit := types.False skip := types.True if function == operators.LogicalOr { @@ -271,14 +244,10 @@ func maybeShortcircuitLogic(ctx *OptimizerContext, a *ast.AST, function string, } if len(newArgs) == 0 { newArgs = append(newArgs, args[0]) - } - if len(newArgs) == len(args) { - return false + ctx.UpdateExpr(expr, newArgs[0]) + return true } if len(newArgs) == 1 { - if !isBoolType(a, newArgs[0]) { - return false - } ctx.UpdateExpr(expr, newArgs[0]) return true } @@ -286,16 +255,6 @@ func maybeShortcircuitLogic(ctx *OptimizerContext, a *ast.AST, function string, return true } -func isBoolType(a *ast.AST, e ast.Expr) bool { - if a != nil && a.GetType(e.ID()) == types.BoolType { - return true - } - if e.Kind() == ast.LiteralKind && e.AsLiteral().Type() == types.BoolType { - return true - } - return false -} - // pruneOptionalElements works from the bottom up to resolve optional elements within // aggregate literals. // @@ -326,9 +285,9 @@ func pruneOptionalListElements(ctx *OptimizerContext, e ast.Expr) { updatedElems := []ast.Expr{} updatedIndices := []int32{} newOptIndex := -1 - for i, e := range elems { + for _, e := range elems { newOptIndex++ - if !l.IsOptional(int32(i)) { + if !l.IsOptional(int32(newOptIndex)) { updatedElems = append(updatedElems, e) continue } @@ -542,7 +501,7 @@ func (opt *constantFoldingOptimizer) constantExprMatcher(ctx *OptimizerContext, sel := e.AsSelect() // guaranteed to be a navigable value return constantMatcher(sel.Operand().(ast.NavigableExpr)) case ast.IdentKind: - return opt.knownValues != nil && a.ReferenceMap()[e.ID()] != nil && !hasComprehensionVar(e) + return opt.knownValues != nil && a.ReferenceMap()[e.ID()] != nil case ast.ComprehensionKind: if isNestedComprehension(e) { return false @@ -554,15 +513,12 @@ func (opt *constantFoldingOptimizer) constantExprMatcher(ctx *OptimizerContext, nested := e.AsComprehension() vars[nested.AccuVar()] = true vars[nested.IterVar()] = true - if nested.IterVar2() != "" { - vars[nested.IterVar2()] = true - } } if e.Kind() == ast.IdentKind && !vars[e.AsIdent()] { constantExprs = false } // Late-bound function calls cannot be folded. - if e.Kind() == ast.CallKind && isLateBoundFunctionCall(ctx, e) { + if e.Kind() == ast.CallKind && isLateBoundFunctionCall(ctx, a, e) { constantExprs = false } }) @@ -598,33 +554,17 @@ func constantCallMatcher(e ast.NavigableExpr) bool { return true } } - if fnName == operators.Equals || fnName == operators.NotEquals { - if hasComprehensionVar(e) { - return false - } - if isExprConstantOfKind(children[0], types.BoolType) || isExprConstantOfKind(children[1], types.BoolType) { - return true - } - } if fnName == operators.In { - if hasComprehensionVar(e) { - return false - } haystack := children[1] if haystack.Kind() == ast.ListKind && haystack.AsList().Size() == 0 { return true } needle := children[0] - if (needle.Kind() == ast.LiteralKind || isSelfEqualIdent(needle)) && haystack.Kind() == ast.ListKind { - needleIsLit := needle.Kind() == ast.LiteralKind - needleLitVal := needle.AsLiteral() - needleIdentVal := needle.AsIdent() + if needle.Kind() == ast.LiteralKind && haystack.Kind() == ast.ListKind { + needleValue := needle.AsLiteral() list := haystack.AsList() - for _, elem := range list.Elements() { - if needleIsLit && elem.Kind() == ast.LiteralKind && elem.AsLiteral().Equal(needleLitVal) == types.True { - return true - } - if !needleIsLit && elem.Kind() == ast.IdentKind && elem.AsIdent() == needleIdentVal { + for _, e := range list.Elements() { + if e.Kind() == ast.LiteralKind && e.AsLiteral().Equal(needleValue) == types.True { return true } } @@ -639,74 +579,6 @@ func constantCallMatcher(e ast.NavigableExpr) bool { return true } -// isSelfEqualIdent indicates whether the expression is an identifier whose static type -// guarantees that its runtime value is equal to itself. -// -// Matching an identifier against a list element by name only proves list membership when the -// value the name resolves to is self-equal. A double may be NaN, which is not equal to itself, -// and dyn, abstract, and struct types may all hold a NaN at runtime, so the check is limited -// to the scalar types which cannot, and to the aggregate types whose type parameters are -// themselves self-equal. -func isSelfEqualIdent(e ast.Expr) bool { - if e.Kind() != ast.IdentKind { - return false - } - nav, ok := e.(ast.NavigableExpr) - if !ok { - return false - } - return isSelfEqualType(nav.Type()) -} - -// isSelfEqualType indicates whether all runtime values of the given type are equal to themselves. -func isSelfEqualType(t *types.Type) bool { - if t == nil { - return false - } - switch t.Kind() { - case types.BoolKind, types.BytesKind, types.DurationKind, types.IntKind, - types.NullTypeKind, types.StringKind, types.TimestampKind, types.TypeKind, - types.UintKind: - return true - case types.ListKind, types.MapKind: - // Aggregates compare element-wise, so they are self-equal exactly when their type - // parameters are. A list(dyn) or map(string, double) may still contain a NaN. - for _, p := range t.Parameters() { - if !isSelfEqualType(p) { - return false - } - } - return true - default: - return false - } -} - -func isExprConstantOfKind(e ast.Expr, t *types.Type) bool { - return e.Kind() == ast.LiteralKind && e.AsLiteral().Type() == t -} - -func hasComprehensionVar(e ast.NavigableExpr) bool { - idents := ast.MatchDescendants(e, ast.KindMatcher(ast.IdentKind)) - for _, identNode := range idents { - identName := identNode.AsIdent() - curr := identNode - parent, found := curr.Parent() - for found { - if parent.Kind() == ast.ComprehensionKind { - compre := parent.AsComprehension() - if (compre.AccuVar() == identName || compre.IterVar() == identName || compre.IterVar2() == identName) && - curr.ID() != compre.IterRange().ID() && curr.ID() != compre.AccuInit().ID() { - return true - } - } - curr = parent - parent, found = parent.Parent() - } - } - return false -} - func isNestedComprehension(e ast.NavigableExpr) bool { parent, found := e.Parent() for found { diff --git a/vendor/github.com/google/cel-go/cel/inlining.go b/vendor/github.com/google/cel-go/cel/inlining.go index d9a5e89a5f..a4530e19e7 100644 --- a/vendor/github.com/google/cel-go/cel/inlining.go +++ b/vendor/github.com/google/cel-go/cel/inlining.go @@ -178,38 +178,9 @@ func (opt *inliningOptimizer) rewritePresenceExpr(ctx *OptimizerContext, prev, i )) return } - if zeroValExpr, ok := zeroValueExpr(ctx, inlinedType); ok { - ctx.UpdateExpr(prev, - ctx.NewCall(operators.NotEquals, - inlined, zeroValExpr)) - return - } ctx.ReportErrorAtID(prev.ID(), "unable to inline expression type %v into presence test", inlinedType) } -// zeroValueExpr creates an expression representing the empty or zero value for the given type -// Note: bytes, lists, maps, and strings are supported via the `SizerType` trait. -func zeroValueExpr(ctx *OptimizerContext, t *Type) (ast.Expr, bool) { - // Note: bytes, strings, lists, and maps are covered by the "sizer-type" check - switch t.Kind() { - case types.BoolKind: - return ctx.NewLiteral(types.False), true - case types.DoubleKind: - return ctx.NewLiteral(types.Double(0)), true - case types.DurationKind: - return ctx.NewCall(overloads.TypeConvertDuration, ctx.NewLiteral(types.String("0s"))), true - case types.IntKind: - return ctx.NewLiteral(types.IntZero), true - case types.TimestampKind: - return ctx.NewCall(overloads.TypeConvertTimestamp, ctx.NewLiteral(types.Int(0))), true - case types.StructKind: - return ctx.NewStruct(t.TypeName(), []ast.EntryExpr{}), true - case types.UintKind: - return ctx.NewLiteral(types.Uint(0)), true - } - return nil, false -} - // isBindable indicates whether the inlined type can be used within a cel.bind() if the expression // being replaced occurs within a presence test. Value types with a size() method or field selection // support can be bound. @@ -241,43 +212,17 @@ func isBindable(matches []ast.NavigableExpr, inlined ast.Expr, inlinedType *Type // field selection. This may be a future refinement. func (opt *inliningOptimizer) matchVariable(varName string) ast.ExprMatcher { return func(e ast.NavigableExpr) bool { - name, found := maybeAsVariableName(e) - if !found || name != varName { - return false - } - - // Determine whether the variable being referenced has been shadowed by a comprehension - p, hasParent := e.Parent() - for hasParent { - if p.Kind() != ast.ComprehensionKind { - p, hasParent = p.Parent() - continue - } - // If the inline variable name matches any of the comprehension variables at any scope, - // return false as the variable has been shadowed. - compre := p.AsComprehension() - if varName == compre.AccuVar() || varName == compre.IterVar() || varName == compre.IterVar2() { - return false - } - p, hasParent = p.Parent() + if e.Kind() == ast.IdentKind && e.AsIdent() == varName { + return true } - - return true - } -} - -func maybeAsVariableName(e ast.NavigableExpr) (string, bool) { - if e.Kind() == ast.IdentKind { - return e.AsIdent(), true - } - if e.Kind() == ast.SelectKind { - sel := e.AsSelect() - // While the `ToQualifiedName` call could take the select directly, this - // would skip presence tests from possible matches, which we would like - // to include. - if qualName, found := containers.ToQualifiedName(sel.Operand()); found { - return qualName + "." + sel.FieldName(), true + if e.Kind() == ast.SelectKind { + sel := e.AsSelect() + // While the `ToQualifiedName` call could take the select directly, this + // would skip presence tests from possible matches, which we would like + // to include. + qualName, found := containers.ToQualifiedName(sel.Operand()) + return found && qualName+"."+sel.FieldName() == varName } + return false } - return "", false } diff --git a/vendor/github.com/google/cel-go/cel/io.go b/vendor/github.com/google/cel-go/cel/io.go index c991c95c3f..2e611228d9 100644 --- a/vendor/github.com/google/cel-go/cel/io.go +++ b/vendor/github.com/google/cel-go/cel/io.go @@ -52,12 +52,7 @@ func CheckedExprToAstWithSource(checkedExpr *exprpb.CheckedExpr, src Source) (*A if err != nil { return nil, err } - out := &Ast{source: src, impl: checked} - if err := checkLoadedASTDepth(checked); err != nil { - out.loadErr = err - return out, err - } - return out, nil + return &Ast{source: src, impl: checked}, nil } // AstToCheckedExpr converts an Ast to an protobuf CheckedExpr value. @@ -88,26 +83,7 @@ func ParsedExprToAstWithSource(parsedExpr *exprpb.ParsedExpr, src Source) *Ast { src = common.NewInfoSource(parsedExpr.GetSourceInfo()) } e, _ := ast.ProtoToExpr(parsedExpr.GetExpr()) - out := &Ast{source: src, impl: ast.NewAST(e, info)} - // ParsedExprToAstWithSource has no error return, so record an over-depth violation on the Ast - // to be surfaced when it is later checked or planned. - out.loadErr = checkLoadedASTDepth(out.impl) - return out -} - -// checkLoadedASTDepth guards ASTs that enter through the proto conversion helpers -// (ParsedExprToAst / CheckedExprToAst) against nesting deeper than the parser's recursion limit. -// Those entry points bypass the parser, so without this check a deeply nested loaded AST could -// exhaust the Go stack during later checking or planning. It returns a normal error rather than -// risking that overflow; the traversal itself is bounded so it stays safe on the same input. -// -// Embedders that fully control their AST inputs can skip this by building the AST through the -// common/ast package directly instead of these conversion helpers. -func checkLoadedASTDepth(a *ast.AST) error { - if ast.ExceedsDepth(a, defaultMaxASTDepth) { - return fmt.Errorf("input exceeds maximum expression nesting depth: %d", defaultMaxASTDepth) - } - return nil + return &Ast{source: src, impl: ast.NewAST(e, info)} } // AstToParsedExpr converts an Ast to an protobuf ParsedExpr value. diff --git a/vendor/github.com/google/cel-go/cel/library.go b/vendor/github.com/google/cel-go/cel/library.go index 332eb3f170..59a10e81de 100644 --- a/vendor/github.com/google/cel-go/cel/library.go +++ b/vendor/github.com/google/cel-go/cel/library.go @@ -182,6 +182,7 @@ func (lib *stdLibrary) CompileOptions() []EnvOption { if err = lib.subset.Validate(); err != nil { return nil, err } + e.variables = append(e.variables, stdlib.Types()...) for _, fn := range funcs { existing, found := e.functions[fn.Name()] if found { @@ -590,7 +591,7 @@ func (lib *optionalLib) CompileOptions() []EnvOption { // ProgramOptions implements the Library interface method. func (lib *optionalLib) ProgramOptions() []ProgramOption { return []ProgramOption{ - CustomDecoratorV2(decorateOptionalOr), + CustomDecorator(decorateOptionalOr), } } @@ -683,7 +684,7 @@ func EnableErrorOnBadPresenceTest(value bool) EnvOption { return features(featureEnableErrorOnBadPresenceTest, value) } -func decorateOptionalOr(i interpreter.InterpretableV2) (interpreter.InterpretableV2, error) { +func decorateOptionalOr(i interpreter.Interpretable) (interpreter.Interpretable, error) { call, ok := i.(interpreter.InterpretableCall) if !ok { return i, nil @@ -720,8 +721,8 @@ func decorateOptionalOr(i interpreter.InterpretableV2) (interpreter.Interpretabl // the second optional expression is evaluated and returned. type evalOptionalOr struct { id int64 - lhs interpreter.InterpretableV2 - rhs interpreter.InterpretableV2 + lhs interpreter.Interpretable + rhs interpreter.Interpretable } // ID implements the Interpretable interface method. @@ -729,34 +730,27 @@ func (opt *evalOptionalOr) ID() int64 { return opt.id } -func (opt *evalOptionalOr) Exec(frame *interpreter.ExecutionFrame) ref.Val { - // short-circuit lhs. - optLHS := opt.lhs.Exec(frame) - switch val := optLHS.(type) { - case *types.Err, *types.Unknown: - return optLHS - case *types.Optional: - if val.HasValue() { - return optLHS - } - return opt.rhs.Exec(frame) - default: - return types.NoSuchOverloadErr() - } -} - // Eval evaluates the left-hand side optional to determine whether it contains a value, else // proceeds with the right-hand side evaluation. func (opt *evalOptionalOr) Eval(ctx interpreter.Activation) ref.Val { - return opt.Exec(interpreter.AsFrame(ctx)) + // short-circuit lhs. + optLHS := opt.lhs.Eval(ctx) + optVal, ok := optLHS.(*types.Optional) + if !ok { + return optLHS + } + if optVal.HasValue() { + return optVal + } + return opt.rhs.Eval(ctx) } // evalOptionalOrValue selects between an optional or a concrete value. If the optional has a value, // its value is returned, otherwise the alternative value expression is evaluated and returned. type evalOptionalOrValue struct { id int64 - lhs interpreter.InterpretableV2 - rhs interpreter.InterpretableV2 + lhs interpreter.Interpretable + rhs interpreter.Interpretable } // ID implements the Interpretable interface method. @@ -764,27 +758,19 @@ func (opt *evalOptionalOrValue) ID() int64 { return opt.id } -func (opt *evalOptionalOrValue) Exec(frame *interpreter.ExecutionFrame) ref.Val { - // short-circuit lhs. - optLHS := opt.lhs.Exec(frame) - - switch val := optLHS.(type) { - case *types.Err, *types.Unknown: - return optLHS - case *types.Optional: - if val.HasValue() { - return val.GetValue() - } - return opt.rhs.Exec(frame) - default: - return types.NoSuchOverloadErr() - } -} - // Eval evaluates the left-hand side optional to determine whether it contains a value, else // proceeds with the right-hand side evaluation. func (opt *evalOptionalOrValue) Eval(ctx interpreter.Activation) ref.Val { - return opt.Exec(interpreter.AsFrame(ctx)) + // short-circuit lhs. + optLHS := opt.lhs.Eval(ctx) + optVal, ok := optLHS.(*types.Optional) + if !ok { + return optLHS + } + if optVal.HasValue() { + return optVal.GetValue() + } + return opt.rhs.Eval(ctx) } type timeLegacyLibrary struct{} diff --git a/vendor/github.com/google/cel-go/cel/optimizer.go b/vendor/github.com/google/cel-go/cel/optimizer.go index 6e260a93cf..9a2a97a647 100644 --- a/vendor/github.com/google/cel-go/cel/optimizer.go +++ b/vendor/github.com/google/cel-go/cel/optimizer.go @@ -15,7 +15,6 @@ package cel import ( - "fmt" "sort" "github.com/google/cel-go/common" @@ -30,43 +29,17 @@ import ( // passes to ensure that the final optimized output is a valid expression with metadata consistent // with what would have been generated from a parsed and checked expression. // -// Note: source position information is best-effort and incomplete, but optimized expressions +// Note: source position information is best-effort and likely wrong, but optimized expressions // should be suitable for calls to parser.Unparse. type StaticOptimizer struct { optimizers []ASTOptimizer - // If set, Optimize() will use this Source instead of the one from the AST. - sourceOverride *Source } -type OptimizerOption func(*StaticOptimizer) (*StaticOptimizer, error) - // NewStaticOptimizer creates a StaticOptimizer with a sequence of ASTOptimizer's to be applied // to a checked expression. -func NewStaticOptimizer(options ...any) (*StaticOptimizer, error) { - so := &StaticOptimizer{} - var err error - for _, opt := range options { - switch v := opt.(type) { - case ASTOptimizer: - so.optimizers = append(so.optimizers, v) - case OptimizerOption: - so, err = v(so) - if err != nil { - return nil, err - } - default: - return nil, fmt.Errorf("unsupported option: %v", v) - } - } - return so, nil -} - -// OptimizeWithSource overrides the source used by the optimizer. -// Note this will cause the source info from the AST passed to Optimize() to be discarded. -func OptimizeWithSource(source Source) OptimizerOption { - return func(so *StaticOptimizer) (*StaticOptimizer, error) { - so.sourceOverride = &source - return so, nil +func NewStaticOptimizer(optimizers ...ASTOptimizer) *StaticOptimizer { + return &StaticOptimizer{ + optimizers: optimizers, } } @@ -76,21 +49,15 @@ func OptimizeWithSource(source Source) OptimizerOption { func (opt *StaticOptimizer) Optimize(env *Env, a *Ast) (*Ast, *Issues) { // Make a copy of the AST to be optimized. optimized := ast.Copy(a.NativeRep()) - source := a.Source() - sourceInfo := optimized.SourceInfo() - if opt.sourceOverride != nil { - source = *opt.sourceOverride - sourceInfo = ast.NewSourceInfo(*opt.sourceOverride) - } ids := newIDGenerator(ast.MaxID(a.NativeRep())) // Create the optimizer context, could be pooled in the future. - issues := NewIssues(common.NewErrors(source)) + issues := NewIssues(common.NewErrors(a.Source())) baseFac := ast.NewExprFactory() exprFac := &optimizerExprFactory{ idGenerator: ids, fac: baseFac, - sourceInfo: sourceInfo, + sourceInfo: optimized.SourceInfo(), } ctx := &OptimizerContext{ optimizerExprFactory: exprFac, @@ -113,7 +80,7 @@ func (opt *StaticOptimizer) Optimize(env *Env, a *Ast) (*Ast, *Issues) { // Recheck the updated expression for any possible type-agreement or validation errors. parsed := &Ast{ - source: source, + source: a.Source(), impl: ast.NewAST(expr, info)} checked, iss := ctx.Check(parsed) if iss.Err() != nil { @@ -124,7 +91,7 @@ func (opt *StaticOptimizer) Optimize(env *Env, a *Ast) (*Ast, *Issues) { // Return the optimized result. return &Ast{ - source: source, + source: a.Source(), impl: optimized, }, nil } @@ -133,8 +100,6 @@ func (opt *StaticOptimizer) Optimize(env *Env, a *Ast) (*Ast, *Issues) { // that the ids within the expression correspond to the ids within macros. func normalizeIDs(idGen ast.IDGenerator, optimized ast.Expr, info *ast.SourceInfo) { optimized.RenumberIDs(idGen) - info.RenumberIDs(idGen) - if len(info.MacroCalls()) == 0 { return } @@ -295,9 +260,6 @@ func (opt *optimizerExprFactory) CopyASTAndMetadata(a *ast.AST) ast.Expr { for macroID, call := range copyInfo.MacroCalls() { opt.SetMacroCall(macroID, call) } - for id, offset := range copyInfo.OffsetRanges() { - opt.sourceInfo.SetOffsetRange(id, offset) - } return copyExpr } diff --git a/vendor/github.com/google/cel-go/cel/options.go b/vendor/github.com/google/cel-go/cel/options.go index 540ad38ba0..fee67323c8 100644 --- a/vendor/github.com/google/cel-go/cel/options.go +++ b/vendor/github.com/google/cel-go/cel/options.go @@ -24,7 +24,6 @@ import ( "google.golang.org/protobuf/reflect/protoregistry" "google.golang.org/protobuf/types/dynamicpb" - "github.com/google/cel-go/cel/async" "github.com/google/cel-go/checker" "github.com/google/cel-go/common/containers" "github.com/google/cel-go/common/decls" @@ -72,16 +71,12 @@ const ( // Enable escape syntax for field identifiers (`). featureIdentEscapeSyntax - - // Enable accessing fields by JSON names within protobuf messages - featureJSONFieldNames ) var featureIDsToNames = map[int]string{ featureEnableMacroCallTracking: "cel.feature.macro_call_tracking", featureCrossTypeNumericComparisons: "cel.feature.cross_type_numeric_comparisons", featureIdentEscapeSyntax: "cel.feature.backtick_escape_syntax", - featureJSONFieldNames: "cel.feature.json_field_names", } func featureNameByID(id int) (string, bool) { @@ -98,51 +93,6 @@ func featureIDByName(name string) (int, bool) { return 0, false } -// limitID is used as a key for configurable limits. These are options that -// support exporting to YAML environment config. -type limitID int - -const ( - _ = limitID(iota) - // The number of recursive calls permitted in parsing. - limitParseRecursionDepth - // The number of code points permitted in an input expression string. - limitCodePointSize - // The number of attempts to recover from a parse error. - limitParseErrorRecovery - // The maximum nesting depth permitted for ASTs loaded outside the parser. - limitMaxASTDepth - // The maximum number of expression nodes permitted in parsing (including macro expansion). - limitExpressionNodeCount -) - -// defaultMaxASTDepth mirrors the parser's default maxRecursionDepth (250) and -// is applied to ASTs that enter through non-parser ingestion paths (e.g. via -// ParsedExprToAst / CheckedExprToAst) when no explicit limit is configured. -const defaultMaxASTDepth = 250 - -var limitIDsToNames = map[limitID]string{ - limitCodePointSize: "cel.limit.expression_code_points", - limitParseErrorRecovery: "cel.limit.parse_error_recovery", - limitParseRecursionDepth: "cel.limit.parse_recursion_depth", - limitMaxASTDepth: "cel.limit.max_ast_depth", - limitExpressionNodeCount: "cel.limit.expression_node_count", -} - -func limitNameByID(id limitID) (string, bool) { - v, ok := limitIDsToNames[id] - return v, ok -} - -func limitIDByName(name string) (limitID, bool) { - for k, v := range limitIDsToNames { - if v == name { - return k, true - } - } - return limitID(0), false -} - // EnvOption is a functional interface for configuring the environment. type EnvOption func(e *Env) (*Env, error) @@ -325,9 +275,9 @@ func Abbrevs(qualifiedNames ...string) EnvOption { } } -// protoTypeRegistry is an internal-only interface containing the minimum methods required to support +// customTypeRegistry is an internal-only interface containing the minimum methods required to support // custom types. It is a subset of methods from ref.TypeRegistry. -type protoTypeRegistry interface { +type customTypeRegistry interface { RegisterDescriptor(protoreflect.FileDescriptor) error RegisterType(...ref.Type) error } @@ -344,7 +294,7 @@ type protoTypeRegistry interface { // Note: This option must be specified after the CustomTypeProvider option when used together. func Types(addTypes ...any) EnvOption { return func(e *Env) (*Env, error) { - reg, isReg := e.provider.(protoTypeRegistry) + reg, isReg := e.provider.(customTypeRegistry) if !isReg { return nil, fmt.Errorf("custom types not supported by provider: %T", e.provider) } @@ -381,7 +331,7 @@ func Types(addTypes ...any) EnvOption { // extension or by re-using the same EnvOption with another NewEnv() call. func TypeDescs(descs ...any) EnvOption { return func(e *Env) (*Env, error) { - reg, isReg := e.provider.(protoTypeRegistry) + reg, isReg := e.provider.(customTypeRegistry) if !isReg { return nil, fmt.Errorf("custom types not supported by provider: %T", e.provider) } @@ -429,7 +379,7 @@ func TypeDescs(descs ...any) EnvOption { } } -func registerFileSet(reg protoTypeRegistry, fileSet *descpb.FileDescriptorSet) error { +func registerFileSet(reg customTypeRegistry, fileSet *descpb.FileDescriptorSet) error { files, err := protodesc.NewFiles(fileSet) if err != nil { return fmt.Errorf("protodesc.NewFiles(%v) failed: %v", fileSet, err) @@ -437,7 +387,7 @@ func registerFileSet(reg protoTypeRegistry, fileSet *descpb.FileDescriptorSet) e return registerFiles(reg, files) } -func registerFiles(reg protoTypeRegistry, files *protoregistry.Files) error { +func registerFiles(reg customTypeRegistry, files *protoregistry.Files) error { var err error files.RangeFiles(func(fd protoreflect.FileDescriptor) bool { err = reg.RegisterDescriptor(fd) @@ -446,15 +396,6 @@ func registerFiles(reg protoTypeRegistry, files *protoregistry.Files) error { return err } -// JSONFieldNames supports accessing protocol buffer fields by json-name. -// -// Enabling JSON field name support will create a copy of the types.Registry with fields indexed -// by JSON name, and whether JSON name or Proto-style names are supported will be inferred from -// the AST extensions metadata. -func JSONFieldNames(enabled bool) EnvOption { - return features(featureJSONFieldNames, enabled) -} - // ProgramOption is a functional interface for configuring evaluation bindings and behaviors. type ProgramOption func(p *prog) (*prog, error) @@ -468,14 +409,6 @@ func CustomDecorator(dec interpreter.InterpretableDecorator) ProgramOption { } } -// CustomDecoratorV2 appends an InterpreterDecoratorV2 to the program. -func CustomDecoratorV2(dec interpreter.InterpretableDecoratorV2) ProgramOption { - return func(p *prog) (*prog, error) { - p.plannerOptions = append(p.plannerOptions, interpreter.CustomDecoratorV2(dec)) - return p, nil - } -} - // Functions adds function overloads that extend or override the set of CEL built-ins. // // Deprecated: use Function() instead to declare the function, its overload signatures, @@ -590,17 +523,6 @@ func configToEnvOptions(config *env.Config, provider types.Provider, optFactorie envOpts = append(envOpts, Abbrevs(imp.Name)) } - // Configure features and common limits. - for _, feat := range config.Features { - // Note, if a feature is not found, it is skipped as it is possible the feature - // is not intended to be supported publicly. In the future, a refinement of - // to this strategy to report unrecognized features and validators should probably - // be covered as a standard ConfigOptionFactory - if id, found := featureIDByName(feat.Name); found { - envOpts = append(envOpts, features(id, feat.Enabled)) - } - } - // Configure the context variable declaration if config.ContextVariable != nil { typeName := config.ContextVariable.TypeName @@ -642,9 +564,14 @@ func configToEnvOptions(config *env.Config, provider types.Provider, optFactorie envOpts = append(envOpts, FunctionDecls(funcs...)) } - for _, limit := range config.Limits { - if id, found := limitIDByName(limit.Name); found { - envOpts = append(envOpts, setLimit(id, limit.Value)) + // Configure features + for _, feat := range config.Features { + // Note, if a feature is not found, it is skipped as it is possible the feature + // is not intended to be supported publicly. In the future, a refinement of + // to this strategy to report unrecognized features and validators should probably + // be covered as a standard ConfigOptionFactory + if id, found := featureIDByName(feat.Name); found { + envOpts = append(envOpts, features(id, feat.Enabled)) } } @@ -747,47 +674,6 @@ func InterruptCheckFrequency(checkFrequency uint) ProgramOption { } } -// AsyncCallObserver sets the observer for monitoring asynchronous function calls during ConcurrentEval. -func AsyncCallObserver(observer async.Observer) ProgramOption { - return func(p *prog) (*prog, error) { - p.asyncObserver = observer - return p, nil - } -} - -// AsyncCompletionBufferSize sets the size of the buffer for the async completion channel. -// By default, the channel is unbuffered. -func AsyncCompletionBufferSize(size int) ProgramOption { - return func(p *prog) (*prog, error) { - p.asyncCompletionBufferSize = size - return p, nil - } -} - -// AsyncMaxConcurrency sets the maximum number of concurrently launched async calls during -// ConcurrentEval. This bounds the number of in-flight async goroutines, so a wide fan-out (such -// as an async call inside a comprehension over a large list) cannot exhaust memory. -// -// A value of 0 (unset) applies a built-in default bound. A positive value sets an explicit bound. -// A negative value disables the limiter (unbounded launches) and should only be used when -// concurrency is bounded by other means. -func AsyncMaxConcurrency(maxConcurrency int) ProgramOption { - return func(p *prog) (*prog, error) { - p.asyncMaxConcurrency = maxConcurrency - return p, nil - } -} - -// ConcurrentDrainStrategy configures the strategy for when to re-evaluate the program -// during a ConcurrentEval call after receiving asynchronous completion signals. -// By default, the program re-evaluates immediately after every completion. -func ConcurrentDrainStrategy(strategy async.DrainStrategy) ProgramOption { - return func(p *prog) (*prog, error) { - p.drainStrategy = strategy - return p, nil - } -} - // CostEstimatorOptions configure type-check time options for estimating expression cost. func CostEstimatorOptions(costOpts ...checker.CostOption) EnvOption { return func(e *Env) (*Env, error) { @@ -841,11 +727,8 @@ func fieldToCELType(field protoreflect.FieldDescriptor) (*Type, error) { return nil, fmt.Errorf("field %s type %s not implemented", field.FullName(), field.Kind().String()) } -func fieldToVariable(field protoreflect.FieldDescriptor, jsonFieldNames bool) (*decls.VariableDecl, error) { +func fieldToVariable(field protoreflect.FieldDescriptor) (*decls.VariableDecl, error) { name := string(field.Name()) - if jsonFieldNames { - name = field.JSONName() - } if field.IsMap() { mapKey := field.MapKey() mapValue := field.MapValue() @@ -876,8 +759,6 @@ func fieldToVariable(field protoreflect.FieldDescriptor, jsonFieldNames bool) (* // DeclareContextProto returns an option to extend CEL environment with declarations from the given context proto. // Each field of the proto defines a variable of the same name in the environment. // https://github.com/google/cel-spec/blob/master/doc/langdef.md#evaluation-environment -// -// If using JSONFieldNames(), ensure that the option is set before DeclareContextProto is provided. func DeclareContextProto(descriptor protoreflect.MessageDescriptor) EnvOption { return func(e *Env) (*Env, error) { if e.contextProto != nil { @@ -887,10 +768,9 @@ func DeclareContextProto(descriptor protoreflect.MessageDescriptor) EnvOption { e.contextProto = descriptor fields := descriptor.Fields() vars := make([]*decls.VariableDecl, 0, fields.Len()) - jsonFieldNames := e.HasFeature(featureJSONFieldNames) for i := 0; i < fields.Len(); i++ { field := fields.Get(i) - variable, err := fieldToVariable(field, jsonFieldNames) + variable, err := fieldToVariable(field) if err != nil { return nil, err } @@ -909,15 +789,11 @@ func DeclareContextProto(descriptor protoreflect.MessageDescriptor) EnvOption { // // Consider using with `DeclareContextProto` to simplify variable type declarations and publishing when using // protocol buffers. -// -// Use the types.JSONFieldNames(true) option to populate the context proto vars using the JSON field names. -func ContextProtoVars(ctx proto.Message, opts ...types.RegistryOption) (Activation, error) { +func ContextProtoVars(ctx proto.Message) (Activation, error) { if ctx == nil || !ctx.ProtoReflect().IsValid() { return interpreter.EmptyActivation(), nil } - regOpts := []types.RegistryOption{types.ProtoTypeDefs(ctx)} - regOpts = append(regOpts, opts...) - reg, err := types.NewProtoRegistry(regOpts...) + reg, err := types.NewRegistry(ctx) if err != nil { return nil, err } @@ -927,19 +803,15 @@ func ContextProtoVars(ctx proto.Message, opts ...types.RegistryOption) (Activati vars := make(map[string]any, fields.Len()) for i := 0; i < fields.Len(); i++ { field := fields.Get(i) - fieldName := field.TextName() - if reg.JSONFieldNames() { - fieldName = field.JSONName() - } - sft, found := reg.FindStructFieldType(typeName, fieldName) + sft, found := reg.FindStructFieldType(typeName, field.TextName()) if !found { - return nil, fmt.Errorf("no such field: %s", fieldName) + return nil, fmt.Errorf("no such field: %s", field.TextName()) } fieldVal, err := sft.GetFrom(ctx) if err != nil { return nil, err } - vars[fieldName] = fieldVal + vars[field.TextName()] = fieldVal } return NewActivation(vars) } @@ -975,51 +847,22 @@ func features(flag int, enabled bool) EnvOption { } } -func setLimit(id limitID, limit int) EnvOption { - if limit < 0 { - limit = -1 - } - return func(e *Env) (*Env, error) { - e.limits[id] = limit - return e, nil - } -} - // ParserRecursionLimit adjusts the AST depth the parser will tolerate. // Defaults defined in the parser package. func ParserRecursionLimit(limit int) EnvOption { - return setLimit(limitParseRecursionDepth, limit) -} - -// ParserErrorRecoveryLimit sets the number of attemtps the parser will take -// to recover after encountering an error. -func ParserErrorRecoveryLimit(limit int) EnvOption { - return setLimit(limitParseErrorRecovery, limit) + return func(e *Env) (*Env, error) { + e.prsrOpts = append(e.prsrOpts, parser.MaxRecursionDepth(limit)) + return e, nil + } } // ParserExpressionSizeLimit adjusts the number of code points the expression parser is allowed to parse. -// Defaults are defined in the parser package. A negative value means unbounded. +// Defaults defined in the parser package. func ParserExpressionSizeLimit(limit int) EnvOption { - return setLimit(limitCodePointSize, limit) -} - -// ExpressionNodeLimit adjusts the maximum number of expression nodes permitted during parsing -// and checking, including nodes created by macro expansion. Defaults are defined in the parser -// package (100,000). A negative value means unbounded. -func ExpressionNodeLimit(limit int) EnvOption { - return setLimit(limitExpressionNodeCount, limit) -} - -// ExpressionNestingDepthLimit records the maximum nesting depth permitted for ASTs in the -// environment configuration so that the value round-trips through env.Config export/import. -// -// ASTs loaded outside the parser (e.g. via ParsedExprToAst / CheckedExprToAst) bypass the -// parser's recursion limit, so those conversion paths validate nesting depth against the -// parser-matching default (250) to avoid a Go stack overflow during later checking or planning. -// Embedders that fully control their AST inputs and want to skip the check can construct the AST -// through the common/ast package directly rather than the cel conversion helpers. -func ExpressionNestingDepthLimit(limit int) EnvOption { - return setLimit(limitMaxASTDepth, limit) + return func(e *Env) (*Env, error) { + e.prsrOpts = append(e.prsrOpts, parser.ExpressionSizeCodePointLimit(limit)) + return e, nil + } } // EnableHiddenAccumulatorName sets the parser to use the identifier '@result' for accumulators diff --git a/vendor/github.com/google/cel-go/cel/program.go b/vendor/github.com/google/cel-go/cel/program.go index 3a7589a71c..ec3869bdb4 100644 --- a/vendor/github.com/google/cel-go/cel/program.go +++ b/vendor/github.com/google/cel-go/cel/program.go @@ -16,11 +16,9 @@ package cel import ( "context" - "errors" "fmt" - "time" + "sync" - "github.com/google/cel-go/cel/async" "github.com/google/cel-go/common/ast" "github.com/google/cel-go/common/functions" "github.com/google/cel-go/common/types" @@ -54,21 +52,6 @@ type Program interface { // // The output contract for `ContextEval` is otherwise identical to the `Eval` method. ContextEval(context.Context, any) (ref.Val, *EvalDetails, error) - - // ConcurrentEval evaluates the program concurrently, returning a channel that will receive - // the final EvalResult when all asynchronous operations complete, or the context expires. - // - // The vars value may either be an `Activation` or `map[string]any`. - // - // Liveness: ConcurrentEval relies on context cancellation to terminate. If an async function - // never returns and does not honor its context, and the supplied context has no deadline, the - // call will block indefinitely. Always pass a context with a deadline or cancellation. - // - // Error handling is fail-fast: as soon as a re-evaluation pass yields an error, that error is - // returned and any still in-flight async calls are cancelled (their contexts are done) and - // their results discarded. Async functions should therefore be free of unwanted side effects - // on partial evaluation, or guard them with idempotency/cancellation handling. - ConcurrentEval(context.Context, any) <-chan EvalResult } // Activation used to resolve identifiers by name and references by id. @@ -161,13 +144,6 @@ func (ed *EvalDetails) ActualCost() *uint64 { return &cost } -// EvalResult encapsulates the response from a ConcurrentEval call. -type EvalResult struct { - Val ref.Val - EvalDetails *EvalDetails - Err error -} - // prog is the internal implementation of the Program interface. type prog struct { *Env @@ -183,21 +159,11 @@ type prog struct { regexOptimizations []*interpreter.RegexOptimization // Interpretable configured from an Ast and aggregate decorator set based on program options. - interpretable interpreter.InterpretableV2 + interpretable interpreter.Interpretable observable *interpreter.ObservableInterpretable callCostEstimator interpreter.ActualCostEstimator costOptions []interpreter.CostTrackerOption costLimit *uint64 - - // hasAsync indicates the planned expression contains an asynchronous function call, which can - // only be resolved by ConcurrentEval. - hasAsync bool - - // Async evaluation configuration used by ConcurrentEval. - drainStrategy async.DrainStrategy - asyncObserver async.Observer - asyncCompletionBufferSize int - asyncMaxConcurrency int } // newProgram creates a program instance with an environment, an ast, and an optional list of @@ -215,7 +181,6 @@ func newProgram(e *Env, a *ast.AST, opts []ProgramOption) (Program, error) { plannerOptions: []interpreter.PlannerOption{}, dispatcher: disp, costOptions: []interpreter.CostTrackerOption{}, - drainStrategy: async.DrainReady(100 * time.Microsecond), } // Configure the program via the ProgramOption values. @@ -248,28 +213,11 @@ func newProgram(e *Env, a *ast.AST, opts []ProgramOption) (Program, error) { return nil, err } - // Determine whether the environment declares any asynchronous function. Async is a property of - // the binding, so its presence is known from the environment alone, without inspecting the - // program plan. The synchronous entry points (Eval, ContextEval) reject programs from an env - // with async functions; callers needing synchronous evaluation should use a non-async env. - for _, b := range e.functionBindings { - if b.Async != nil { - p.hasAsync = true - break - } - } - // Set the attribute factory after the options have been set. var attrFactory interpreter.AttributeFactory attrFactorOpts := []interpreter.AttrFactoryOption{ interpreter.EnableErrorOnBadPresenceTest(p.HasFeature(featureEnableErrorOnBadPresenceTest)), } - if a.SourceInfo().HasExtension("json_name", ast.NewExtensionVersion(1, 1)) { - if !e.HasFeature(featureJSONFieldNames) { - return nil, errors.New("the AST extension 'json_name' requires the option cel.JSONFieldNames(true)") - } - } - // Configure the type provider, considering whether the AST indicates whether it supports JSON field names if p.evalOpts&OptPartialEval == OptPartialEval { attrFactory = interpreter.NewPartialAttributeFactory(e.Container, e.adapter, e.provider, attrFactorOpts...) } else { @@ -307,16 +255,8 @@ func newProgram(e *Env, a *ast.AST, opts []ProgramOption) (Program, error) { if p.costLimit != nil { costOpts = append(costOpts, interpreter.CostTrackerLimit(*p.costLimit)) } - // Creating a new cost tracker for each evaluation causes significant work that - // needs to be repeated for each evaluation even though the cost tracker is - // mostly read-only once constructed. Therefore it gets constructed - // once now and later a cheap clone is used for each evaluation. - tracker, err := interpreter.NewCostTracker(p.callCostEstimator, costOpts...) - if err != nil { - return nil, fmt.Errorf("construct cost tracker: %w", err) - } trackerFactory := func() (*interpreter.CostTracker, error) { - return tracker.Clone() + return interpreter.NewCostTracker(p.callCostEstimator, costOpts...) } var observers []interpreter.PlannerOption if p.evalOpts&(OptExhaustiveEval|OptTrackState) != 0 { @@ -365,25 +305,23 @@ func (p *prog) Eval(input any) (out ref.Val, det *EvalDetails, err error) { } } }() - // Asynchronous calls cannot be resolved by a single-pass evaluation. Reject before doing any - // work (this also covers ContextEval, which delegates here); ConcurrentEval does not call Eval. - if p.hasAsync { - return nil, nil, errAsyncRequiresConcurrentEval - } // Build a hierarchical activation if there are default vars set. - var frame *interpreter.ExecutionFrame - if f, ok := input.(*interpreter.ExecutionFrame); ok { - frame = f - } else { - frame, err = p.newExecutionFrame(input) - if err != nil { - return nil, nil, err - } - defer frame.Close() + var vars Activation + switch v := input.(type) { + case Activation: + vars = v + case map[string]any: + vars = activationPool.Setup(v) + defer activationPool.Put(vars) + default: + return nil, nil, fmt.Errorf("invalid input, wanted Activation or map[string]any, got: (%T)%v", input, input) + } + if p.defaultVars != nil { + vars = interpreter.NewHierarchicalActivation(p.defaultVars, vars) } if p.observable != nil { det = &EvalDetails{} - out = p.observable.ObserveExec(frame, func(observed any) { + out = p.observable.ObserveEval(vars, func(observed any) { switch o := observed.(type) { case interpreter.EvalState: det.state = o @@ -392,7 +330,7 @@ func (p *prog) Eval(input any) (out ref.Val, det *EvalDetails, err error) { } }) } else { - out = p.interpretable.Exec(frame) + out = p.interpretable.Eval(vars) } // The output of an internal Eval may have a value (`v`) that is a types.Err. This step // translates the CEL value to a Go error response. This interface does not quite match the @@ -408,220 +346,160 @@ func (p *prog) ContextEval(ctx context.Context, input any) (ref.Val, *EvalDetail if ctx == nil { return nil, nil, fmt.Errorf("context can not be nil") } - frame, err := p.newExecutionFrame(input) - if err != nil { - return nil, nil, err - } - defer frame.Close() - frame.SetContext(ctx, p.interruptCheckFrequency) - out, det, errEval := p.Eval(frame) - if errEval != nil && errors.Is(errEval, interpreter.InterruptError{}) { - return out, det, fmt.Errorf("%w: %w", errEval, context.Cause(ctx)) + // Configure the input, making sure to wrap Activation inputs in the special ctxActivation which + // exposes the #interrupted variable and manages rate-limited checks of the ctx.Done() state. + var vars Activation + switch v := input.(type) { + case Activation: + vars = ctxActivationPool.Setup(v, ctx.Done(), p.interruptCheckFrequency) + defer ctxActivationPool.Put(vars) + case map[string]any: + rawVars := activationPool.Setup(v) + defer activationPool.Put(rawVars) + vars = ctxActivationPool.Setup(rawVars, ctx.Done(), p.interruptCheckFrequency) + defer ctxActivationPool.Put(vars) + default: + return nil, nil, fmt.Errorf("invalid input, wanted Activation or map[string]any, got: (%T)%v", input, input) } - return out, det, errEval + return p.Eval(vars) } -// newExecutionFrame creates an ExecutionFrame for the given input without a timeout context. -func (p *prog) newExecutionFrame(input any) (*interpreter.ExecutionFrame, error) { - frame, err := interpreter.NewExecutionFrame(input) - if err != nil { - return nil, err - } - if p.defaultVars != nil { - // Update the frame's activation in place. - frame.Activation = interpreter.NewHierarchicalActivation(p.defaultVars, frame.Activation) - } - - return frame, nil +type ctxEvalActivation struct { + parent Activation + interrupt <-chan struct{} + interruptCheckCount uint + interruptCheckFrequency uint } -// newAsyncFrame creates an ExecutionFrame configured for asynchronous evaluation under the -// given context, wiring the observer and concurrency limit from the program options. -func (p *prog) newAsyncFrame(ctx context.Context, input any) (*interpreter.ExecutionFrame, error) { - frame, err := p.newExecutionFrame(input) - if err != nil { - return nil, err - } - if err := frame.SetContext(ctx, p.interruptCheckFrequency); err != nil { - frame.Close() - return nil, err +// ResolveName implements the Activation interface method, but adds a special #interrupted variable +// which is capable of testing whether a 'done' signal is provided from a context.Context channel. +func (a *ctxEvalActivation) ResolveName(name string) (any, bool) { + if name == "#interrupted" { + a.interruptCheckCount++ + if a.interruptCheckCount%a.interruptCheckFrequency == 0 { + select { + case <-a.interrupt: + return true, true + default: + return nil, false + } + } + return nil, false } - frame.SetAsyncObserver(p.asyncObserver) - frame.SetAsyncMaxConcurrency(resolveAsyncMaxConcurrency(p.asyncMaxConcurrency)) - return frame, nil + return a.parent.ResolveName(name) } -// defaultAsyncMaxConcurrency bounds the number of concurrently launched async calls when the -// program does not configure AsyncMaxConcurrency. It exists so that a wide fan-out (e.g. an async -// call inside a comprehension over a large list) cannot spawn an unbounded number of goroutines. -const defaultAsyncMaxConcurrency = 100 - -// resolveAsyncMaxConcurrency maps the configured concurrency to the effective launch limit: -// - 0 (unset): apply defaultAsyncMaxConcurrency. -// - >0: use the configured value. -// - <0: unlimited (no launch limiter); use only if the caller bounds concurrency another way. -func resolveAsyncMaxConcurrency(configured int) int { - if configured == 0 { - return defaultAsyncMaxConcurrency - } - return configured +func (a *ctxEvalActivation) Parent() Activation { + return a.parent } -// resolveCompletionBufferSize returns the size of the async completion channel. When unset, it -// defaults to the effective launch concurrency so that all in-flight calls can report completion -// without blocking. An unbuffered channel would make a completed call hold its launch slot until -// the evaluator drained it, throttling effective concurrency to the drain rate. -func (p *prog) resolveCompletionBufferSize() int { - if p.asyncCompletionBufferSize > 0 { - return p.asyncCompletionBufferSize - } - limit := resolveAsyncMaxConcurrency(p.asyncMaxConcurrency) - if limit < 0 { - // Unlimited launches: fall back to the default bound for the buffer so it stays finite. - return defaultAsyncMaxConcurrency - } - return limit +func (a *ctxEvalActivation) AsPartialActivation() (interpreter.PartialActivation, bool) { + pa, ok := a.parent.(interpreter.PartialActivation) + return pa, ok } -// ConcurrentEval implements the Program interface. -func (p *prog) ConcurrentEval(ctx context.Context, input any) <-chan EvalResult { - resCh := make(chan EvalResult, 1) - if ctx == nil { - resCh <- EvalResult{Err: errors.New("context can not be nil")} - close(resCh) - return resCh +func newCtxEvalActivationPool() *ctxEvalActivationPool { + return &ctxEvalActivationPool{ + Pool: sync.Pool{ + New: func() any { + return &ctxEvalActivation{} + }, + }, } +} - go func() { - defer close(resCh) - // Ensure concurrent eval handles panic / recovery properly - defer func() { - if r := recover(); r != nil { - switch t := r.(type) { - case interpreter.EvalCancelledError: - resCh <- EvalResult{Err: t} - default: - resCh <- EvalResult{Err: fmt.Errorf("internal error: %v", r)} - } - } - }() +type ctxEvalActivationPool struct { + sync.Pool +} - frame, err := p.newAsyncFrame(ctx, input) - if err != nil { - resCh <- EvalResult{Err: err} - return - } - defer frame.Close() - - // Completions are signaled to this channel as async calls finish. The asyncCallState - // fan-in also selects on ctx.Done(), so the sender will not leak if this loop returns early. - completions := make(chan int64, p.resolveCompletionBufferSize()) - frame.SetCompletions(completions) - - for { - var out ref.Val - var det *EvalDetails - - if p.observable != nil { - det = &EvalDetails{} - out = p.observable.ObserveExec(frame, func(observed any) { - switch o := observed.(type) { - case interpreter.EvalState: - det.state = o - case *interpreter.CostTracker: - det.costTracker = o - } - }) - } else { - out = p.interpretable.Exec(frame) - } +// Setup initializes a pooled Activation with the ability check for context.Context cancellation +func (p *ctxEvalActivationPool) Setup(vars Activation, done <-chan struct{}, interruptCheckRate uint) *ctxEvalActivation { + a := p.Pool.Get().(*ctxEvalActivation) + a.parent = vars + a.interrupt = done + a.interruptCheckCount = 0 + a.interruptCheckFrequency = interruptCheckRate + return a +} - // Communicate errors quickly. - if types.IsError(out) { - var err error = out.(*types.Err) - if errors.Is(err, interpreter.InterruptError{}) { - err = fmt.Errorf("%w: %w", err, context.Cause(ctx)) - } - resCh <- EvalResult{Val: out, EvalDetails: det, Err: err} - return - } +type evalActivation struct { + vars map[string]any + lazyVars map[string]any +} - // A concrete (non-unknown) result is final. - unk, isUnknown := out.(*types.Unknown) - if !isUnknown || !unk.HasUnknownFunction() { - resCh <- EvalResult{Val: out, EvalDetails: det, Err: nil} - return - } +// ResolveName looks up the value of the input variable name, if found. +// +// Lazy bindings may be supplied within the map-based input in either of the following forms: +// - func() any +// - func() ref.Val +// +// The lazy binding will only be invoked once per evaluation. +// +// Values which are not represented as ref.Val types on input may be adapted to a ref.Val using +// the types.Adapter configured in the environment. +func (a *evalActivation) ResolveName(name string) (any, bool) { + v, found := a.vars[name] + if !found { + return nil, false + } + switch obj := v.(type) { + case func() ref.Val: + if resolved, found := a.lazyVars[name]; found { + return resolved, true + } + lazy := obj() + a.lazyVars[name] = lazy + return lazy, true + case func() any: + if resolved, found := a.lazyVars[name]; found { + return resolved, true + } + lazy := obj() + a.lazyVars[name] = lazy + return lazy, true + default: + return obj, true + } +} - // Post-execution dispatch: launch only the async calls required by the unknown result. - frame.DispatchPendingAsyncCalls(unk.IDs()) +// Parent implements the Activation interface +func (a *evalActivation) Parent() Activation { + return nil +} - // The result depends on one or more unresolved async calls. Wait for completions and - // re-evaluate according to the configured drain strategy. - var batch []async.Call +func newEvalActivationPool() *evalActivationPool { + return &evalActivationPool{ + Pool: sync.Pool{ + New: func() any { + return &evalActivation{lazyVars: make(map[string]any)} + }, + }, + } +} - // Wait for at least one completion (or cancellation). - select { - case id := <-completions: - if call := frame.AsyncCall(id); call != nil { - batch = append(batch, call) - } - case <-ctx.Done(): - resCh <- EvalResult{Val: out, EvalDetails: det, Err: ctx.Err()} - return - } +type evalActivationPool struct { + sync.Pool +} - // Accumulate completions and consult the strategy. - var timer *time.Timer - reevaluate := false - for !reevaluate { - active := frame.ActiveAsyncCalls() - action := p.drainStrategy.NextAction(batch, active) - if action.Reevaluate { - break - } - - var timeoutCh <-chan time.Time - if action.WaitDuration > 0 { - if timer == nil { - timer = time.NewTimer(action.WaitDuration) - } else { - if !timer.Stop() { - select { - case <-timer.C: - default: - } - } - timer.Reset(action.WaitDuration) - } - timeoutCh = timer.C - } - - select { - case id := <-completions: - if call := frame.AsyncCall(id); call != nil { - batch = append(batch, call) - } - case <-timeoutCh: - reevaluate = true - case <-ctx.Done(): - if timer != nil { - timer.Stop() - } - resCh <- EvalResult{Val: out, EvalDetails: det, Err: ctx.Err()} - return - } - } - if timer != nil { - timer.Stop() - } - } - }() +// Setup initializes a pooled Activation object with the map input. +func (p *evalActivationPool) Setup(vars map[string]any) *evalActivation { + a := p.Pool.Get().(*evalActivation) + a.vars = vars + return a +} - return resCh +func (p *evalActivationPool) Put(value any) { + a := value.(*evalActivation) + for k := range a.lazyVars { + delete(a.lazyVars, k) + } + p.Pool.Put(a) } -// errAsyncRequiresConcurrentEval is returned by the synchronous entry points (Eval, ContextEval) -// when the expression contains asynchronous function calls, which only ConcurrentEval can resolve. -var errAsyncRequiresConcurrentEval = errors.New( - "expression contains asynchronous function calls; use ConcurrentEval") +var ( + // activationPool is an internally managed pool of Activation values that wrap map[string]any inputs + activationPool = newEvalActivationPool() + + // ctxActivationPool is an internally managed pool of Activation values that expose a special #interrupted variable + ctxActivationPool = newCtxEvalActivationPool() +) diff --git a/vendor/github.com/google/cel-go/cel/prompt.go b/vendor/github.com/google/cel-go/cel/prompt.go index f599348271..929a26f91f 100644 --- a/vendor/github.com/google/cel-go/cel/prompt.go +++ b/vendor/github.com/google/cel-go/cel/prompt.go @@ -23,48 +23,15 @@ import ( "github.com/google/cel-go/common" "github.com/google/cel-go/common/operators" "github.com/google/cel-go/common/overloads" - "github.com/google/cel-go/common/types" ) //go:embed templates/authoring.tmpl var authoringPrompt string -// splitImpl splits a string into a list of strings. -// -// Normalizes extracted comments (trim common prefix whitespace and extra trailing newlines). -func splitImpl(str string) []string { - str = strings.TrimRight(str, " \n\t\r") - out := strings.Split(str, "\n") - if len(out) == 0 { - return nil - } - negative := strings.TrimLeft(out[0], " \t") - lenNegative := len(negative) - lenOut := len(out[0]) - if lenNegative == lenOut { - return out - } - prefix := out[0][:lenOut-lenNegative] - trimmed := make([]string, len(out)) - for i, line := range out { - if line == "" { - trimmed[i] = "" - continue - } - if !strings.HasPrefix(line, prefix) { - return out - } - trimmed[i] = strings.TrimPrefix(line, prefix) - } - - return trimmed -} - // AuthoringPrompt creates a prompt template from a CEL environment for the purpose of AI-assisted authoring. func AuthoringPrompt(env *Env) (*Prompt, error) { funcMap := template.FuncMap{ - "split": splitImpl, - "newlineToSpace": func(str string) string { return strings.ReplaceAll(str, "\n", " ") }, + "split": func(str string) []string { return strings.Split(str, "\n") }, } tmpl := template.New("cel").Funcs(funcMap) tmpl, err := tmpl.Parse(authoringPrompt) @@ -80,17 +47,6 @@ func AuthoringPrompt(env *Env) (*Prompt, error) { }, nil } -// AuthoringPromptWithFieldPaths creates a prompt template from a CEL environment for the purpose of AI-assisted authoring. -// Includes documentation for all of the reachable field paths in the environment. -func AuthoringPromptWithFieldPaths(env *Env) (*Prompt, error) { - p, err := AuthoringPrompt(env) - if err != nil { - return nil, err - } - p.fieldPaths = true - return p, nil -} - // Prompt represents the core components of an LLM prompt based on a CEL environment. // // All fields of the prompt may be overwritten / modified with support for rendering the @@ -108,22 +64,14 @@ type Prompt struct { // tmpl is the text template base-configuration for rendering text. tmpl *template.Template - // fieldPaths is a flag to include reachable field paths in the prompt. - fieldPaths bool - // env reference used to collect variables, functions, and macros available to the prompt. env *Env } -type promptVariable struct { - *common.Doc - FieldPaths []*common.Doc -} - type promptInst struct { *Prompt - Variables []*promptVariable + Variables []*common.Doc Macros []*common.Doc Functions []*common.Doc UserPrompt string @@ -131,36 +79,11 @@ type promptInst struct { // Render renders the user prompt with the associated context from the prompt template // for use with LLM generators. -// -// User-supplied input is passed as template data via the UserPrompt field, which -// Go's text/template renders as a literal string value. Template action delimiters -// such as {{.Persona}} in the user prompt are never evaluated as template directives -// because text/template only executes directives present in the template definition -// itself, not in data values interpolated at render time. func (p *Prompt) Render(userPrompt string) string { var buffer strings.Builder - vars := make([]*promptVariable, len(p.env.Variables())) + vars := make([]*common.Doc, len(p.env.Variables())) for i, v := range p.env.Variables() { - vars[i] = &promptVariable{Doc: v.Documentation()} - if p.fieldPaths && v.Type().Kind() == types.StructKind { - var fieldPaths []*common.Doc - - paths := fieldPathsForType(p.env.CELTypeProvider(), v.Name(), v.Type()) - if len(paths) < 2 { - paths = nil - } else { - // First path is the variable which is already documented. - paths = paths[1:] - } - for _, path := range paths { - fieldPaths = append(fieldPaths, path.Documentation()) - } - - sort.SliceStable(fieldPaths, func(i, j int) bool { - return fieldPaths[i].Name < fieldPaths[j].Name - }) - vars[i].FieldPaths = fieldPaths - } + vars[i] = v.Documentation() } sort.SliceStable(vars, func(i, j int) bool { return vars[i].Name < vars[j].Name @@ -184,8 +107,7 @@ func (p *Prompt) Render(userPrompt string) string { Variables: vars, Macros: macs, Functions: funcs, - UserPrompt: userPrompt, - } + UserPrompt: userPrompt} p.tmpl.Execute(&buffer, inst) return buffer.String() } diff --git a/vendor/github.com/google/cel-go/cel/templates/authoring.tmpl b/vendor/github.com/google/cel-go/cel/templates/authoring.tmpl index a921df9b0e..d0b0133f15 100644 --- a/vendor/github.com/google/cel-go/cel/templates/authoring.tmpl +++ b/vendor/github.com/google/cel-go/cel/templates/authoring.tmpl @@ -1,29 +1,12 @@ -{{define "fieldPath" }} - * path: `{{.Name}}` - type: `{{.Type}}` - {{- if .Description }} - description: -{{range split .Description }} {{.}} -{{end}} -{{- end -}} -{{- end -}} +{{define "variable"}}{{.Name}} is a {{.Type}}{{if .Description}} -{{define "variable" -}} -* name: `{{.Name}}` - type: `{{.Type}}` - {{- if .Description}} - description: -{{range split .Description}} {{.}} -{{end -}} -{{- end -}} -{{- if .FieldPaths }} - attributes: -{{- range .FieldPaths }}{{ template "fieldPath" . }}{{end}} +{{range split .Description}} {{.}} +{{end}} {{- end -}} {{- end -}} {{define "macro" -}} -{{.Name}} macro{{if .Description}} - {{newlineToSpace .Description}} +{{.Name}} macro{{if .Description}} - {{range split .Description}}{{.}} {{end}} {{end}} {{range .Children}}{{range split .Description}} {{.}} {{end}} @@ -39,7 +22,7 @@ {{- end -}} {{define "function" -}} -{{.Name}}{{if .Description}} - {{newlineToSpace .Description}} +{{.Name}}{{if .Description}} - {{range split .Description}}{{.}} {{end}} {{end}} {{range .Children}}{{template "overload" .}}{{end}} {{- end -}} @@ -53,26 +36,25 @@ Only use the following variables, macros, and functions in expressions. {{if .Variables}} Variables: -{{range .Variables -}} -{{template "variable" .}} +{{range .Variables}}* {{template "variable" .}} {{end -}} -{{- end -}} +{{end -}} {{if .Macros}} Macros: {{range .Macros}}* {{template "macro" .}} {{end -}} -{{end -}} +{{end -}} {{if .Functions}} Functions: {{range .Functions}}* {{template "function" .}} {{end -}} -{{- end -}} -{{- end -}} +{{end -}} +{{- end -}} {{.GeneralUsage}} {{.UserPrompt}} diff --git a/vendor/github.com/google/cel-go/cel/validator.go b/vendor/github.com/google/cel-go/cel/validator.go index cb7f4c29ea..952f88f41b 100644 --- a/vendor/github.com/google/cel-go/cel/validator.go +++ b/vendor/github.com/google/cel-go/cel/validator.go @@ -15,7 +15,6 @@ package cel import ( - "context" "fmt" "reflect" "regexp" @@ -26,12 +25,11 @@ import ( ) const ( - durationValidatorName = "cel.validator.duration" - regexValidatorName = "cel.validator.matches" - timestampValidatorName = "cel.validator.timestamp" - homogeneousValidatorName = "cel.validator.homogeneous_literals" - nestingLimitValidatorName = "cel.validator.comprehension_nesting_limit" - bindNestingLimitValidatorName = "cel.validator.bind_nesting_limit" + durationValidatorName = "cel.validator.duration" + regexValidatorName = "cel.validator.matches" + timestampValidatorName = "cel.validator.timestamp" + homogeneousValidatorName = "cel.validator.homogeneous_literals" + nestingLimitValidatorName = "cel.validator.comprehension_nesting_limit" // HomogeneousAggregateLiteralExemptFunctions is the ValidatorConfig key used to configure // the set of function names which are exempt from homogeneous type checks. The expected type @@ -62,23 +60,6 @@ var ( } return nil, fmt.Errorf("invalid validator: %s missing limit", nestingLimitValidatorName) }, - bindNestingLimitValidatorName: func(val *env.Validator) (ASTValidator, error) { - if limit, found := val.ConfigValue("limit"); found { - // In case of protos, config value is of type by google.protobuf.Value, which numeric values are always a double. - if val, isDouble := limit.(float64); isDouble { - if val != float64(int64(val)) { - return nil, fmt.Errorf("invalid validator: %s, limit value is not a whole number: %v", bindNestingLimitValidatorName, limit) - } - return ValidateBindNestingLimit(int(val)), nil - } - - if val, isInt := limit.(int); isInt { - return ValidateBindNestingLimit(val), nil - } - return nil, fmt.Errorf("invalid validator: %s unsupported limit type: %v", bindNestingLimitValidatorName, limit) - } - return nil, fmt.Errorf("invalid validator: %s missing limit", bindNestingLimitValidatorName) - }, durationValidatorName: func(*env.Validator) (ASTValidator, error) { return ValidateDurationLiterals(), nil }, @@ -99,20 +80,12 @@ type ASTValidatorFactory func(*env.Validator) (ASTValidator, error) // ASTValidators configures a set of ASTValidator instances into the target environment. // -// Validators are applied in the order in which they are specified. -// If an ASTValidator with the same name is already configured, it will be replaced. +// Validators are applied in the order in which the are specified and are treated as singletons. +// The same ASTValidator with a given name will not be applied more than once. func ASTValidators(validators ...ASTValidator) EnvOption { return func(e *Env) (*Env, error) { for _, v := range validators { - found := false - for i, existing := range e.validators { - if existing.Name() == v.Name() { - e.validators[i] = v - found = true - break - } - } - if !found { + if !e.HasValidator(v.Name()) { e.validators = append(e.validators, v) } } @@ -259,13 +232,6 @@ func ValidateComprehensionNestingLimit(limit int) ASTValidator { return nestingLimitValidator{limit: limit} } -// ValidateBindNestingLimit ensures that cel.bind() macro nesting does not exceed the specified limit. -// -// This validator can be useful for preventing arbitrarily nested cel.bind() macro calls. -func ValidateBindNestingLimit(limit int) ASTValidator { - return bindNestingLimitValidator{limit: limit} -} - type argChecker func(env *Env, call, arg ast.Expr) error func newFormatValidator(funcName string, argNum int, check argChecker) formatValidator { @@ -318,9 +284,8 @@ func evalCall(env *Env, call, arg ast.Expr) error { if err != nil { return err } - resCh := prg.ConcurrentEval(context.Background(), NoVars()) - res := <-resCh - return res.Err + _, _, err = prg.Eval(NoVars()) + return err } func compileRegex(_ *Env, _, arg ast.Expr) error { @@ -465,7 +430,8 @@ func (v nestingLimitValidator) Validate(e *Env, _ ValidatorConfig, a *ast.AST, i } // When the comprehension has an empty range, continue to the next ancestor // as this comprehension does not have any associated cost. - if isEmptyRangeComprehension(e) { + iterRange := e.AsComprehension().IterRange() + if iterRange.Kind() == ast.ListKind && iterRange.AsList().Size() == 0 { e, hasParent = e.Parent() continue } @@ -479,68 +445,3 @@ func (v nestingLimitValidator) Validate(e *Env, _ ValidatorConfig, a *ast.AST, i } } } - -type bindNestingLimitValidator struct { - limit int -} - -// Name returns the name of the cel.bind nesting limit validator. -func (v bindNestingLimitValidator) Name() string { - return bindNestingLimitValidatorName -} - -// ToConfig converts the ASTValidator to an env.Validator specifying the validator name and the nesting limit -// as an integer value: {"limit": int} -func (v bindNestingLimitValidator) ToConfig() *env.Validator { - return env.NewValidator(v.Name()).SetConfig(map[string]any{"limit": v.limit}) -} - -// Validate implements the ASTValidator interface method. -func (v bindNestingLimitValidator) Validate(e *Env, _ ValidatorConfig, a *ast.AST, iss *Issues) { - root := ast.NavigateAST(a) - comprehensions := ast.MatchDescendants(root, ast.KindMatcher(ast.ComprehensionKind)) - var celBinds []ast.NavigableExpr - for _, comp := range comprehensions { - if isCelBind(comp) { - celBinds = append(celBinds, comp) - } - } - if len(celBinds) <= v.limit { - return - } - for _, comp := range celBinds { - count := 0 - e := comp - hasParent := true - for hasParent { - if isCelBind(e) { - count++ - if count > v.limit { - iss.ReportErrorAtID(comp.ID(), "cel.bind exceeds nesting limit") - break - } - } - e, hasParent = e.Parent() - } - } -} - -func isEmptyRangeComprehension(e ast.NavigableExpr) bool { - if e.Kind() != ast.ComprehensionKind { - return false - } - iterRange := e.AsComprehension().IterRange() - return iterRange.Kind() == ast.ListKind && iterRange.AsList().Size() == 0 -} - -func isCelBind(e ast.NavigableExpr) bool { - if !isEmptyRangeComprehension(e) { - return false - } - compre := e.AsComprehension() - loopCond := compre.LoopCondition() - loopStep := compre.LoopStep() - return compre.IterVar() == unusedIterVar && - loopCond.Kind() == ast.LiteralKind && loopCond.AsLiteral().Value() == false && - loopStep.Kind() == ast.IdentKind && loopStep.AsIdent() == compre.AccuVar() -} diff --git a/vendor/github.com/google/cel-go/checker/checker.go b/vendor/github.com/google/cel-go/checker/checker.go index 42d27a4283..0057c16ccb 100644 --- a/vendor/github.com/google/cel-go/checker/checker.go +++ b/vendor/github.com/google/cel-go/checker/checker.go @@ -19,8 +19,6 @@ package checker import ( "fmt" "reflect" - "slices" - "strings" "github.com/google/cel-go/common" "github.com/google/cel-go/common/ast" @@ -67,15 +65,6 @@ func Check(parsed *ast.AST, source common.Source, env *Env) (*ast.AST, *common.E for id, t := range c.TypeMap() { c.SetType(id, substitute(c.mappings, t, true)) } - // Remove source info for IDs without a corresponding AST node. This can happen because - // check() deletes some nodes while rewriting the AST. For example the Select operand is - // deleted when a variable reference is replaced with a Ident expression. - c.AST.ClearUnusedIDs() - if env.jsonFieldNames { - c.AST.SourceInfo().AddExtension( - ast.NewExtension("json_name", ast.NewExtensionVersion(1, 1), ast.ComponentRuntime), - ) - } return c.AST, errs } @@ -115,15 +104,11 @@ func (c *checker) check(e ast.Expr) { func (c *checker) checkIdent(e ast.Expr) { identName := e.AsIdent() // Check to see if the identifier is declared. - if ident := c.env.resolveSimpleIdent(identName); ident != nil { - name := strings.TrimPrefix(ident.Name(), ".") - if ident.requiresDisambiguation { - name = "." + name - } + if ident := c.env.LookupIdent(identName); ident != nil { c.setType(e, ident.Type()) - c.setReference(e, ast.NewIdentReference(name, ident.Value())) + c.setReference(e, ast.NewIdentReference(ident.Name(), ident.Value())) // Overwrite the identifier with its fully qualified name. - e.SetKindCase(c.NewIdent(e.ID(), name)) + e.SetKindCase(c.NewIdent(e.ID(), ident.Name())) return } @@ -134,22 +119,18 @@ func (c *checker) checkIdent(e ast.Expr) { func (c *checker) checkSelect(e ast.Expr) { sel := e.AsSelect() // Before traversing down the tree, try to interpret as qualified name. - qualifiers, found := c.computeQualifiers(e) + qname, found := containers.ToQualifiedName(e) if found { - ident := c.env.resolveQualifiedIdent(qualifiers...) + ident := c.env.LookupIdent(qname) if ident != nil { // We don't check for a TestOnly expression here since the `found` result is // always going to be false for TestOnly expressions. // Rewrite the node to be a variable reference to the resolved fully-qualified // variable name. - name := ident.Name() - if ident.requiresDisambiguation { - name = "." + name - } c.setType(e, ident.Type()) - c.setReference(e, ast.NewIdentReference(name, ident.Value())) - e.SetKindCase(c.NewIdent(e.ID(), name)) + c.setReference(e, ast.NewIdentReference(ident.Name(), ident.Value())) + e.SetKindCase(c.NewIdent(e.ID(), ident.Name())) return } } @@ -161,29 +142,6 @@ func (c *checker) checkSelect(e ast.Expr) { c.setType(e, substitute(c.mappings, resultType, false)) } -// computeQualifiers computes the qualified names parts of a select expression. -func (c *checker) computeQualifiers(e ast.Expr) ([]string, bool) { - var qualifiers []string - for e.Kind() == ast.SelectKind { - sel := e.AsSelect() - // test only expressions are not considered for qualified name selection. - if sel.IsTestOnly() { - return qualifiers, false - } - // otherwise append the select field name to the qualifier list (reverse order) - qualifiers = append(qualifiers, sel.FieldName()) - e = sel.Operand() - // If the next operand is an identifier, then append it, reverse the name sequence - // and return it to the caller.s - if e.Kind() == ast.IdentKind { - qualifiers = append(qualifiers, e.AsIdent()) - slices.Reverse(qualifiers) - return qualifiers, true - } - } - return qualifiers, false -} - func (c *checker) checkOptSelect(e ast.Expr) { // Collect metadata related to the opt select call packaged by the parser. call := e.AsCall() @@ -276,7 +234,7 @@ func (c *checker) checkCall(e ast.Expr) { // Regular static call with simple name. if !call.IsMemberFunction() { // Check for the existence of the function. - fn := c.env.lookupFunction(fnName) + fn := c.env.LookupFunction(fnName) if fn == nil { c.errors.undeclaredReference(e.ID(), c.location(e), c.env.container.Name(), fnName) c.setType(e, types.ErrorType) @@ -298,7 +256,7 @@ func (c *checker) checkCall(e ast.Expr) { qualifiedPrefix, maybeQualified := containers.ToQualifiedName(target) if maybeQualified { maybeQualifiedName := qualifiedPrefix + "." + fnName - fn := c.env.lookupFunction(maybeQualifiedName) + fn := c.env.LookupFunction(maybeQualifiedName) if fn != nil { // The function name is namespaced and so preserving the target operand would // be an inaccurate representation of the desired evaluation behavior. @@ -311,7 +269,7 @@ func (c *checker) checkCall(e ast.Expr) { // Regular instance call. c.check(target) - fn := c.env.lookupFunction(fnName) + fn := c.env.LookupFunction(fnName) // Function found, attempt overload resolution. if fn != nil { c.resolveOverloadOrError(e, fn, target, args) @@ -483,7 +441,7 @@ func (c *checker) checkCreateStruct(e ast.Expr) { msgVal := e.AsStruct() // Determine the type of the message. resultType := types.ErrorType - ident := c.env.resolveTypeIdent(msgVal.TypeName()) + ident := c.env.LookupIdent(msgVal.TypeName()) if ident == nil { c.errors.undeclaredReference( e.ID(), c.location(e), c.env.container.Name(), msgVal.TypeName()) @@ -723,9 +681,6 @@ func (c *checker) lookupFieldType(exprID int64, structType, fieldName string) (* } if ft, found := c.env.provider.FindStructFieldType(structType, fieldName); found { - if c.env.jsonFieldNames && !ft.IsJSONField { - c.errors.undefinedField(exprID, c.locationByID(exprID), fieldName) - } return ft.Type, found } diff --git a/vendor/github.com/google/cel-go/checker/cost.go b/vendor/github.com/google/cel-go/checker/cost.go index 3d7dd7ec4a..5bc6318ed0 100644 --- a/vendor/github.com/google/cel-go/checker/cost.go +++ b/vendor/github.com/google/cel-go/checker/cost.go @@ -159,11 +159,6 @@ func (se SizeEstimate) Union(size SizeEstimate) SizeEstimate { return result } -// AsCost converts a size estimates to an equivalent cost estimate. -func (se SizeEstimate) AsCost() CostEstimate { - return se.MultiplyByCostFactor(1) -} - // CostEstimate represents an estimated cost range and provides add and multiply operations // that do not overflow. type CostEstimate struct { @@ -791,26 +786,18 @@ func (c *coster) functionCost(e ast.Expr, function, overloadID string, target *A return CallEstimate{CostEstimate: c.sizeOrUnknown(args[1]).MultiplyByCostFactor(1).Add(argCostSum())} } // O(nm) functions - case overloads.Matches, overloads.MatchesString: + case overloads.MatchesString: // https://swtch.com/~rsc/regexp/regexp1.html applies to RE2 implementation supported by CEL - var strNode, regexNode AstNode - if overloadID == overloads.MatchesString && target != nil && len(args) == 1 { - strNode = *target - regexNode = args[0] - } else if overloadID == overloads.Matches && target == nil && len(args) == 2 { - strNode = args[0] - regexNode = args[1] - } - if strNode != nil && regexNode != nil { + if target != nil && len(args) == 1 { // Add one to string length for purposes of cost calculation to prevent product of string and regex to be 0 // in case where string is empty but regex is still expensive. - strCost := c.sizeOrUnknown(strNode).Add(SizeEstimate{Min: 1, Max: 1}).MultiplyByCostFactor(common.StringTraversalCostFactor) + strCost := c.sizeOrUnknown(*target).Add(SizeEstimate{Min: 1, Max: 1}).MultiplyByCostFactor(common.StringTraversalCostFactor) // We don't know how many expressions are in the regex, just the string length (a huge // improvement here would be to somehow get a count the number of expressions in the regex or // how many states are in the regex state machine and use that to measure regex cost). // For now, we're making a guess that each expression in a regex is typically at least 4 chars // in length. - regexCost := c.sizeOrUnknown(regexNode).MultiplyByCostFactor(common.RegexStringLengthCostFactor) + regexCost := c.sizeOrUnknown(args[0]).MultiplyByCostFactor(common.RegexStringLengthCostFactor) return CallEstimate{CostEstimate: strCost.Multiply(regexCost).Add(argCostSum())} } case overloads.ContainsString: diff --git a/vendor/github.com/google/cel-go/checker/env.go b/vendor/github.com/google/cel-go/checker/env.go index 477918c485..d5ac05014e 100644 --- a/vendor/github.com/google/cel-go/checker/env.go +++ b/vendor/github.com/google/cel-go/checker/env.go @@ -74,7 +74,6 @@ type Env struct { declarations *Scopes aggLitElemType aggregateLiteralElementType filteredOverloadIDs map[string]struct{} - jsonFieldNames bool } // NewEnv returns a new *Env with the given parameters. @@ -105,7 +104,6 @@ func NewEnv(container *containers.Container, provider types.Provider, opts ...Op declarations: declarations, aggLitElemType: aggLitElemType, filteredOverloadIDs: filteredOverloadIDs, - jsonFieldNames: envOptions.jsonFieldNames, }, nil } @@ -131,111 +129,45 @@ func (e *Env) AddFunctions(declarations ...*decls.FunctionDecl) error { return formatError(errMsgs) } -// newAttrResolution creates a new attribute resolution value. -func newAttrResolution(ident *decls.VariableDecl, requiresDisambiguation bool) *attributeResolution { - return &attributeResolution{ - VariableDecl: ident, - requiresDisambiguation: requiresDisambiguation, - } -} - -// attributeResolution wraps an existing variable and denotes whether disambiguation is needed -// during variable resolution. -type attributeResolution struct { - *decls.VariableDecl - - // requiresDisambiguation indicates the variable name should be dot-prefixed. - requiresDisambiguation bool -} - -// resolveSimpleIdent determines the resolved attribute for a single identifier. -func (e *Env) resolveSimpleIdent(name string) *attributeResolution { - local := e.lookupLocalIdent(name) - if local != nil && !strings.HasPrefix(name, ".") { - return newAttrResolution(local, false) - } +// LookupIdent returns a Decl proto for typeName as an identifier in the Env. +// Returns nil if no such identifier is found in the Env. +func (e *Env) LookupIdent(name string) *decls.VariableDecl { for _, candidate := range e.container.ResolveCandidateNames(name) { - if ident := e.lookupGlobalIdent(candidate); ident != nil { - return newAttrResolution(ident, local != nil) + if ident := e.declarations.FindIdent(candidate); ident != nil { + return ident } - } - return nil -} -// resolveQualifiedIdent determines the resolved attribute for a qualified identifier. -func (e *Env) resolveQualifiedIdent(qualifiers ...string) *attributeResolution { - if len(qualifiers) == 1 { - return e.resolveSimpleIdent(qualifiers[0]) - } - local := e.lookupLocalIdent(qualifiers[0]) - if local != nil && !strings.HasPrefix(qualifiers[0], ".") { - // this should resolve through a field selection rather than a qualified identifier - return nil - } - // The qualifiers are concatenated together to indicate the qualified name to search - // for as a global identifier. Since select expressions are resolved from leaf to root - // if the fully concatenated string doesn't match a global identifier, indicate that - // no variable was found to continue the traversal up to the next simpler name. - varName := strings.Join(qualifiers, ".") - for _, candidate := range e.container.ResolveCandidateNames(varName) { - if ident := e.lookupGlobalIdent(candidate); ident != nil { - return newAttrResolution(ident, local != nil) + // Next try to import the name as a reference to a message type. If found, + // the declaration is added to the outest (global) scope of the + // environment, so next time we can access it faster. + if t, found := e.provider.FindStructType(candidate); found { + decl := decls.NewVariable(candidate, t) + e.declarations.AddIdent(decl) + return decl } - } - return nil -} -// resolveTypeIdent returns a Decl proto for typeName as an identifier in the Env. -// Returns nil if no such identifier is found in the Env. -func (e *Env) resolveTypeIdent(name string) *decls.VariableDecl { - for _, candidate := range e.container.ResolveCandidateNames(name) { - // Try to import the name as a reference to a message type. if i, found := e.provider.FindIdent(candidate); found { if t, ok := i.(*types.Type); ok { - return decls.NewVariable(candidate, types.NewTypeTypeWithParam(t)) + decl := decls.NewVariable(candidate, types.NewTypeTypeWithParam(t)) + e.declarations.AddIdent(decl) + return decl } } - // Next, try to find the struct type. - if t, found := e.provider.FindStructType(candidate); found { - return decls.NewVariable(candidate, t) - } - } - return nil -} -// lookupLocalIdent finds the variable candidate in a local scope, returning nil if -// the candidate variable name is not a local variable. -func (e *Env) lookupLocalIdent(candidate string) *decls.VariableDecl { - return e.declarations.FindLocalIdent(candidate) -} - -// lookupGlobalIdent finds a candidate variable name in the root scope, returning -// nil if the identifier is not in the global scope. -func (e *Env) lookupGlobalIdent(candidate string) *decls.VariableDecl { - // Try to resolve the global identifier first. - if ident := e.declarations.FindGlobalIdent(candidate); ident != nil { - return ident - } - // Next try to import the name as a reference to a message type. - if i, found := e.provider.FindIdent(candidate); found { - if t, ok := i.(*types.Type); ok { - return decls.NewVariable(candidate, types.NewTypeTypeWithParam(t)) + // Next try to import this as an enum value by splitting the name in a type prefix and + // the enum inside. + if enumValue := e.provider.EnumValue(candidate); enumValue.Type() != types.ErrType { + decl := decls.NewConstant(candidate, types.IntType, enumValue) + e.declarations.AddIdent(decl) + return decl } } - if t, found := e.provider.FindStructType(candidate); found { - return decls.NewVariable(candidate, t) - } - // Next try to import this as an enum value by splitting the name in a type prefix and - // the enum inside. - if enumValue := e.provider.EnumValue(candidate); enumValue.Type() != types.ErrType { - return decls.NewConstant(candidate, types.IntType, enumValue) - } return nil } -// lookupFunction returns a Decl proto for typeName as a function in env. +// LookupFunction returns a Decl proto for typeName as a function in env. // Returns nil if no such function is found in env. -func (e *Env) lookupFunction(name string) *decls.FunctionDecl { +func (e *Env) LookupFunction(name string) *decls.FunctionDecl { for _, candidate := range e.container.ResolveCandidateNames(name) { if fn := e.declarations.FindFunction(candidate); fn != nil { return fn @@ -275,31 +207,12 @@ func (e *Env) setFunction(fn *decls.FunctionDecl) []errorMsg { return errMsgs } -func maybeMergeConstant(a *decls.VariableDecl, b *decls.VariableDecl) (*decls.VariableDecl, errorMsg) { - if b.Value() != nil { - if a.Value() == nil { - return b, "" - } - eq, ok := a.Value().Equal(b.Value()).Value().(bool) - if ok && eq { - return a, "" - } - return nil, constantConflictError(b.Name()) - } - return a, "" -} - // addIdent adds the Decl to the declarations in the Env. // Returns a non-empty errorMsg if the identifier is already declared in the scope. func (e *Env) addIdent(decl *decls.VariableDecl) errorMsg { current := e.declarations.FindIdentInScope(decl.Name()) if current != nil { if current.DeclarationIsEquivalent(decl) { - decl, errMsg := maybeMergeConstant(current, decl) - if errMsg != "" { - return errMsg - } - e.declarations.AddIdent(decl) return "" } return overlappingIdentifierError(decl.Name()) @@ -346,10 +259,6 @@ func (e *Env) exitScope() *Env { // may be accumulated into an error at a later point in execution. type errorMsg string -func constantConflictError(name string) errorMsg { - return errorMsg(fmt.Sprintf("conflicting constant definitions for name '%s'", name)) -} - func overlappingIdentifierError(name string) errorMsg { return errorMsg(fmt.Sprintf("overlapping identifier for name '%s'", name)) } diff --git a/vendor/github.com/google/cel-go/checker/options.go b/vendor/github.com/google/cel-go/checker/options.go index af714323ba..0560c3813c 100644 --- a/vendor/github.com/google/cel-go/checker/options.go +++ b/vendor/github.com/google/cel-go/checker/options.go @@ -18,7 +18,6 @@ type options struct { crossTypeNumericComparisons bool homogeneousAggregateLiterals bool validatedDeclarations *Scopes - jsonFieldNames bool } // Option is a functional option for configuring the type-checker @@ -41,11 +40,3 @@ func ValidatedDeclarations(env *Env) Option { return nil } } - -// JSONFieldNames enables the use of json names instead of the standard protobuf snake_case field names -func JSONFieldNames(enabled bool) Option { - return func(opts *options) error { - opts.jsonFieldNames = enabled - return nil - } -} diff --git a/vendor/github.com/google/cel-go/checker/scopes.go b/vendor/github.com/google/cel-go/checker/scopes.go index 9ae9832e15..8bb73ddb6a 100644 --- a/vendor/github.com/google/cel-go/checker/scopes.go +++ b/vendor/github.com/google/cel-go/checker/scopes.go @@ -15,8 +15,6 @@ package checker import ( - "strings" - "github.com/google/cel-go/common/decls" ) @@ -78,7 +76,6 @@ func (s *Scopes) AddIdent(decl *decls.VariableDecl) { // found. // Note: The search is performed from innermost to outermost. func (s *Scopes) FindIdent(name string) *decls.VariableDecl { - name = strings.TrimPrefix(name, ".") if ident, found := s.scopes.idents[name]; found { return ident } @@ -92,33 +89,12 @@ func (s *Scopes) FindIdent(name string) *decls.VariableDecl { // nil if one does not exist. // Note: The search is only performed on the current scope and does not search outer scopes. func (s *Scopes) FindIdentInScope(name string) *decls.VariableDecl { - name = strings.TrimPrefix(name, ".") if ident, found := s.scopes.idents[name]; found { return ident } return nil } -// FindLocalIdent finds a locally scoped variable with a given name, ignoring the root scope. -func (s *Scopes) FindLocalIdent(name string) *decls.VariableDecl { - if s == nil || s.parent == nil { - return nil - } - if ident := s.FindIdentInScope(name); ident != nil { - return ident - } - return s.parent.FindLocalIdent(name) -} - -// FindGlobalIdent finds an identifier in the global scope, ignoring all local scopes. -func (s *Scopes) FindGlobalIdent(name string) *decls.VariableDecl { - scope := s - for scope.parent != nil { - scope = scope.parent - } - return scope.FindIdentInScope(name) -} - // SetFunction adds the function Decl to the current scope. // Note: Any previous entry for a function in the current scope with the same name is overwritten. func (s *Scopes) SetFunction(fn *decls.FunctionDecl) { @@ -129,7 +105,6 @@ func (s *Scopes) SetFunction(fn *decls.FunctionDecl) { // The search is performed from innermost to outermost. // Returns nil if no such function in Scopes. func (s *Scopes) FindFunction(name string) *decls.FunctionDecl { - name = strings.TrimPrefix(name, ".") if fn, found := s.scopes.functions[name]; found { return fn } diff --git a/vendor/github.com/google/cel-go/common/ast/ast.go b/vendor/github.com/google/cel-go/common/ast/ast.go index c8f8f8a022..62c09cfc64 100644 --- a/vendor/github.com/google/cel-go/common/ast/ast.go +++ b/vendor/github.com/google/cel-go/common/ast/ast.go @@ -16,8 +16,6 @@ package ast import ( - "slices" - "github.com/google/cel-go/common" "github.com/google/cel-go/common/types" "github.com/google/cel-go/common/types/ref" @@ -162,34 +160,6 @@ func MaxID(a *AST) int64 { return visitor.maxID + 1 } -// IDs returns the set of AST node IDs, including macro calls. -func (a *AST) IDs() map[int64]bool { - visitor := make(idVisitor) - PostOrderVisit(a.Expr(), visitor) - for _, call := range a.SourceInfo().MacroCalls() { - PostOrderVisit(call, visitor) - } - return visitor -} - -// NodeCount returns the total number of expression nodes in the AST, including macro calls. -func NodeCount(a *AST) int { - if a == nil { - return 0 - } - return len(a.IDs()) -} - -// ClearUnusedIDs removes IDs not used in the AST or macro calls from SourceInfo. -func (a *AST) ClearUnusedIDs() { - ids := a.IDs() - for id := range a.SourceInfo().OffsetRanges() { - if !ids[id] { - a.SourceInfo().ClearOffsetRange(id) - } - } -} - // Heights computes the heights of all AST expressions and returns a map from expression id to height. func Heights(a *AST) map[int64]int { visitor := make(heightVisitor) @@ -239,11 +209,6 @@ func CopySourceInfo(info *SourceInfo) *SourceInfo { for id, call := range info.macroCalls { callsCopy[id] = defaultFactory.CopyExpr(call) } - var extCopy []Extension - if len(info.extensions) > 0 { - extCopy = make([]Extension, len(info.extensions)) - copy(extCopy, info.extensions) - } return &SourceInfo{ syntax: info.syntax, desc: info.desc, @@ -252,7 +217,6 @@ func CopySourceInfo(info *SourceInfo) *SourceInfo { baseCol: info.baseCol, offsetRanges: rangesCopy, macroCalls: callsCopy, - extensions: extCopy, } } @@ -266,26 +230,6 @@ type SourceInfo struct { baseCol int32 offsetRanges map[int64]OffsetRange macroCalls map[int64]Expr - - // extensions indicate versioned optional features which affect the execution of one or more CEL component. - extensions []Extension -} - -// RenumberIDs performs an in-place update of the expression IDs within the SourceInfo. -func (s *SourceInfo) RenumberIDs(idGen IDGenerator) { - if s == nil { - return - } - oldIDs := []int64{} - for id := range s.offsetRanges { - oldIDs = append(oldIDs, id) - } - slices.Sort(oldIDs) - newRanges := make(map[int64]OffsetRange) - for _, id := range oldIDs { - newRanges[idGen(id)] = s.offsetRanges[id] - } - s.offsetRanges = newRanges } // SyntaxVersion returns the syntax version associated with the text expression. @@ -421,12 +365,6 @@ func (s *SourceInfo) ComputeOffset(line, col int32) int32 { line = s.baseLine + line col = s.baseCol + col } - return s.ComputeOffsetAbsolute(line, col) -} - -// ComputeOffsetAbsolute calculates the 0-based character offset from a 1-based line and 0-based column -// based on the absolute line and column of the SourceInfo. -func (s *SourceInfo) ComputeOffsetAbsolute(line, col int32) int32 { if line == 1 { return col } @@ -437,34 +375,6 @@ func (s *SourceInfo) ComputeOffsetAbsolute(line, col int32) int32 { return offset + col } -// Extensions returns the set of extensions present in the source. -func (s *SourceInfo) Extensions() []Extension { - var extensions []Extension - if s == nil { - return extensions - } - return s.extensions -} - -// HasExtension returns whether the source info contains the extension which satisfies the minimum version requirement. -// -// For an extension to be considered 'present' it must have the same major version as the minVersion and a minor version -// at least as great as the lowest minor version specified. -func (s *SourceInfo) HasExtension(id string, minVersion ExtensionVersion) bool { - for _, ext := range s.Extensions() { - return ext.ID == id && ext.Version.Major == minVersion.Major && ext.Version.Minor >= minVersion.Minor - } - return false -} - -// AddExtension adds an extension record into the SourceInfo. -func (s *SourceInfo) AddExtension(ext Extension) { - if s == nil { - return - } - s.extensions = append(s.extensions, ext) -} - // OffsetRange captures the start and stop positions of a section of text in the input expression. type OffsetRange struct { Start int32 @@ -534,53 +444,6 @@ func (r *ReferenceInfo) Equals(other *ReferenceInfo) bool { return true } -// NewExtension creates an Extension to be recorded on the SourceInfo. -func NewExtension(id string, version ExtensionVersion, components ...ExtensionComponent) Extension { - return Extension{ - ID: id, - Version: version, - Components: components, - } -} - -// Extension represents a versioned, optional feature present in the AST that affects CEL component behavior. -type Extension struct { - // ID indicates the unique name of the extension. - ID string - // Version indicates the major / minor version. - Version ExtensionVersion - // Components enumerates the CEL components affected by the feature. - Components []ExtensionComponent -} - -// NewExtensionVersion creates a new extension version with a major, minor version. -func NewExtensionVersion(major, minor int64) ExtensionVersion { - return ExtensionVersion{Major: major, Minor: minor} -} - -// ExtensionVersion represents a semantic version with a major and minor number. -type ExtensionVersion struct { - // Major version of the extension. - // All versions with the same major number are expected to be compatible with all minor version changes. - Major int64 - - // Minor version of the extension which indicates that some small non-semantic change has been made to - // the extension. - Minor int64 -} - -// ExtensionComponent indicates which CEL component is affected. -type ExtensionComponent int - -const ( - // ComponentParser means the feature affects expression parsing. - ComponentParser ExtensionComponent = iota + 1 - // ComponentTypeChecker means the feature affects type-checking. - ComponentTypeChecker - // ComponentRuntime alters program planning or evaluation of the AST. - ComponentRuntime -) - type maxIDVisitor struct { maxID int64 *baseVisitor @@ -670,13 +533,3 @@ func (hv heightVisitor) maxEntryHeight(entries ...EntryExpr) int { } return max } - -type idVisitor map[int64]bool - -func (v idVisitor) VisitExpr(e Expr) { - v[e.ID()] = true -} - -func (v idVisitor) VisitEntryExpr(e EntryExpr) { - v[e.ID()] = true -} diff --git a/vendor/github.com/google/cel-go/common/ast/conversion.go b/vendor/github.com/google/cel-go/common/ast/conversion.go index 380f8c1181..435d8f6547 100644 --- a/vendor/github.com/google/cel-go/common/ast/conversion.go +++ b/vendor/github.com/google/cel-go/common/ast/conversion.go @@ -27,19 +27,6 @@ import ( structpb "google.golang.org/protobuf/types/known/structpb" ) -var ( - pbComponentMap = map[exprpb.SourceInfo_Extension_Component]ExtensionComponent{ - exprpb.SourceInfo_Extension_COMPONENT_PARSER: ComponentParser, - exprpb.SourceInfo_Extension_COMPONENT_TYPE_CHECKER: ComponentTypeChecker, - exprpb.SourceInfo_Extension_COMPONENT_RUNTIME: ComponentRuntime, - } - componentPBMap = map[ExtensionComponent]exprpb.SourceInfo_Extension_Component{ - ComponentParser: exprpb.SourceInfo_Extension_COMPONENT_PARSER, - ComponentTypeChecker: exprpb.SourceInfo_Extension_COMPONENT_TYPE_CHECKER, - ComponentRuntime: exprpb.SourceInfo_Extension_COMPONENT_RUNTIME, - } -) - // ToProto converts an AST to a CheckedExpr protobouf. func ToProto(ast *AST) (*exprpb.CheckedExpr, error) { refMap := make(map[int64]*exprpb.Reference, len(ast.ReferenceMap())) @@ -547,25 +534,6 @@ func SourceInfoToProto(info *SourceInfo) (*exprpb.SourceInfo, error) { } sourceInfo.MacroCalls[id] = call } - for _, ext := range info.Extensions() { - var components []exprpb.SourceInfo_Extension_Component - for _, c := range ext.Components { - comp, found := componentPBMap[c] - if found { - components = append(components, comp) - } - } - ver := &exprpb.SourceInfo_Extension_Version{ - Major: ext.Version.Major, - Minor: ext.Version.Minor, - } - pbExt := &exprpb.SourceInfo_Extension{ - Id: ext.ID, - Version: ver, - AffectedComponents: components, - } - sourceInfo.Extensions = append(sourceInfo.Extensions, pbExt) - } return sourceInfo, nil } @@ -588,23 +556,6 @@ func ProtoToSourceInfo(info *exprpb.SourceInfo) (*SourceInfo, error) { } sourceInfo.SetMacroCall(id, call) } - for _, pbExt := range info.GetExtensions() { - var components []ExtensionComponent - for _, c := range pbExt.GetAffectedComponents() { - comp, found := pbComponentMap[*c.Enum()] - if found { - components = append(components, comp) - } - } - sourceInfo.AddExtension(NewExtension( - pbExt.GetId(), - NewExtensionVersion( - pbExt.GetVersion().GetMajor(), - pbExt.GetVersion().GetMinor(), - ), - components..., - )) - } return sourceInfo, nil } diff --git a/vendor/github.com/google/cel-go/common/ast/navigable.go b/vendor/github.com/google/cel-go/common/ast/navigable.go index 364edfa3af..13e5777b50 100644 --- a/vendor/github.com/google/cel-go/common/ast/navigable.go +++ b/vendor/github.com/google/cel-go/common/ast/navigable.go @@ -181,29 +181,6 @@ func PreOrderVisit(expr Expr, visitor Visitor) { visit(expr, visitor, preOrder, 0, 0) } -// ExceedsDepth determines whether the AST contains expressions nested deeper than the specified -// maxDepth. The root expression has depth 0, so a maxDepth of 250 permits expressions nested up -// to and including 250 levels deep. -// -// The traversal is bounded: it descends at most maxDepth+1 levels, so it remains safe to call on -// adversarially deep inputs that could otherwise exhaust the Go stack during later checking or -// planning. A non-positive maxDepth disables the check and returns false. -func ExceedsDepth(a *AST, maxDepth int) bool { - if a == nil || maxDepth <= 0 { - return false - } - exceedsDepth := false - visitor := NewExprVisitor(func(e Expr) { - if nav, ok := e.(NavigableExpr); ok && nav.Depth() >= maxDepth { - exceedsDepth = true - } - }) - // Bound the walk to maxDepth+1 levels so it never recurses past the first level that exceeds - // the limit, keeping the check itself safe on the deep inputs it guards against. - visit(NavigateAST(a), visitor, postOrder, 0, maxDepth+1) - return exceedsDepth -} - type visitOrder int const ( diff --git a/vendor/github.com/google/cel-go/common/containers/container.go b/vendor/github.com/google/cel-go/common/containers/container.go index fcfcdfc3f4..fc146b6fc4 100644 --- a/vendor/github.com/google/cel-go/common/containers/container.go +++ b/vendor/github.com/google/cel-go/common/containers/container.go @@ -227,7 +227,7 @@ func Abbrevs(qualifiedNames ...string) ContainerOption { } alias := qn[ind+1:] var err error - c, err = aliasAs("abbreviation", qn, alias, true)(c) + c, err = aliasAs("abbreviation", qn, alias)(c) if err != nil { return nil, err } @@ -236,32 +236,31 @@ func Abbrevs(qualifiedNames ...string) ContainerOption { } } -// Alias associates a name with a user-defined alias. +// Alias associates a fully-qualified name with a user-defined alias. // // In general, Abbrevs is preferred to Alias since the names generated from the Abbrevs option // are more easily traced back to source code. The Alias option is useful for propagating alias // configuration from one Container instance to another, and may also be useful for remapping // poorly chosen protobuf message / package names. +// +// Note: all of the rules that apply to Abbrevs also apply to Alias. func Alias(qualifiedName, alias string) ContainerOption { - return aliasAs("alias", qualifiedName, alias, false) + return aliasAs("alias", qualifiedName, alias) } -func aliasAs(kind, qualifiedName, alias string, requireQualified bool) ContainerOption { +func aliasAs(kind, qualifiedName, alias string) ContainerOption { return func(c *Container) (*Container, error) { if len(alias) == 0 || strings.Contains(alias, ".") { return nil, fmt.Errorf( "%s must be non-empty and simple (not qualified): %s=%s", kind, kind, alias) } - if len(qualifiedName) == 0 { - return nil, fmt.Errorf("%s must refer to a valid name: %s", kind, qualifiedName) - } if qualifiedName[0:1] == "." { return nil, fmt.Errorf("qualified name must not begin with a leading '.': %s", qualifiedName) } ind := strings.LastIndex(qualifiedName, ".") - if ind == len(qualifiedName)-1 || (requireQualified && ind <= 0) { + if ind <= 0 || ind == len(qualifiedName)-1 { return nil, fmt.Errorf("%s must refer to a valid qualified name: %s", kind, qualifiedName) } diff --git a/vendor/github.com/google/cel-go/common/debug/debug.go b/vendor/github.com/google/cel-go/common/debug/debug.go index fbc847f0c1..75f5f0d636 100644 --- a/vendor/github.com/google/cel-go/common/debug/debug.go +++ b/vendor/github.com/google/cel-go/common/debug/debug.go @@ -312,18 +312,3 @@ func (w *debugWriter) removeIndent() { func (w *debugWriter) String() string { return w.buffer.String() } - -type idAdorner struct{} - -func (a *idAdorner) GetMetadata(elem any) string { - e, isExpr := elem.(ast.Expr) - if !isExpr { - return "" - } - return fmt.Sprintf("@id:%d ", e.ID()) -} - -// ToDebugStringWithIDs returns a string representation with AST node IDs. -func ToDebugStringWithIDs(e ast.Expr) string { - return ToAdornedDebugString(e, &idAdorner{}) -} diff --git a/vendor/github.com/google/cel-go/common/decls/decls.go b/vendor/github.com/google/cel-go/common/decls/decls.go index 51cb689e58..a4a51c3f28 100644 --- a/vendor/github.com/google/cel-go/common/decls/decls.go +++ b/vendor/github.com/google/cel-go/common/decls/decls.go @@ -16,7 +16,6 @@ package decls import ( - "context" "fmt" "strings" @@ -271,7 +270,7 @@ func (f *FunctionDecl) AddOverload(overload *OverloadDecl) error { if oID == overload.ID() { if o.SignatureEquals(overload) && o.IsNonStrict() == overload.IsNonStrict() { // Allow redefinition of an overload implementation so long as the signatures match. - if overload.HasBinding() { + if overload.hasBinding() { f.overloads[oID] = overload } // Allow redefinition of the doc string. @@ -304,25 +303,13 @@ func (f *FunctionDecl) OverloadDecls() []*OverloadDecl { return overloads } -// HasSingletonBinding indicates whether the function has a singleton binding definition. -func (f *FunctionDecl) HasSingletonBinding() bool { - if f == nil { - return false - } - return f.singleton != nil -} - // HasLateBinding returns true if the function has late bindings. A function cannot mix late bindings with other bindings. func (f *FunctionDecl) HasLateBinding() bool { if f == nil { return false } - if f.singleton != nil && f.singleton.Async != nil { - return true - } for _, oID := range f.overloadOrdinals { - o := f.overloads[oID] - if o.HasLateBinding() { + if f.overloads[oID].HasLateBinding() { return true } } @@ -341,13 +328,12 @@ func (f *FunctionDecl) Bindings() ([]*functions.Overload, error) { for _, oID := range f.overloadOrdinals { o := f.overloads[oID] hasLateBinding = hasLateBinding || o.HasLateBinding() - if o.HasBinding() { + if o.hasBinding() { overload := &functions.Overload{ Operator: o.ID(), Unary: o.guardedUnaryOp(f.Name(), f.disableTypeGuards), Binary: o.guardedBinaryOp(f.Name(), f.disableTypeGuards), Function: o.guardedFunctionOp(f.Name(), f.disableTypeGuards), - Async: o.guardedAsyncOp(f.Name(), f.disableTypeGuards), OperandTrait: o.OperandTrait(), NonStrict: o.IsNonStrict(), } @@ -368,7 +354,6 @@ func (f *FunctionDecl) Bindings() ([]*functions.Overload, error) { Unary: f.singleton.Unary, Binary: f.singleton.Binary, Function: f.singleton.Function, - Async: f.singleton.Async, OperandTrait: f.singleton.OperandTrait, }, } @@ -387,7 +372,6 @@ func (f *FunctionDecl) Bindings() ([]*functions.Overload, error) { Unary: overloads[0].Unary, Binary: overloads[0].Binary, Function: overloads[0].Function, - Async: overloads[0].Async, NonStrict: overloads[0].NonStrict, OperandTrait: overloads[0].OperandTrait, }), nil @@ -546,30 +530,6 @@ func SingletonFunctionBinding(fn functions.FunctionOp, traits ...int) FunctionOp } } -// SingletonAsyncBinding creates a singleton async function definition to be used with all function overloads. -// The provided function is called in its own goroutine with the provided context. The function should -// block until the result is available, and the framework manages goroutine and channel lifecycle. -// -// Note, this approach works well if operand is expected to have a specific trait which it implements, -// e.g. traits.ContainerType. Otherwise, prefer per-overload async bindings. -func SingletonAsyncBinding(fn functions.BlockingAsyncOp, traits ...int) FunctionOpt { - trait := 0 - for _, t := range traits { - trait = trait | t - } - return func(f *FunctionDecl) (*FunctionDecl, error) { - if f.singleton != nil { - return nil, fmt.Errorf("function already has a singleton binding: %s", f.Name()) - } - f.singleton = &functions.Overload{ - Operator: f.Name(), - Async: wrapAsyncOp(fn), - OperandTrait: trait, - } - return f, nil - } -} - // Overload defines a new global overload with an overload id, argument types, and result type. Through the // use of OverloadOpt options, the overload may also be configured with a binding, an operand trait, and to // be non-strict. @@ -654,8 +614,6 @@ type OverloadDecl struct { binaryOp functions.BinaryOp // functionOp is a catch-all for zero-arity and three-plus arity functions. functionOp functions.FunctionOp - // asyncOp is an asynchronous function binding that returns a channel. - asyncOp functions.AsyncOp } // Examples returns a list of string examples for the overload. @@ -711,7 +669,7 @@ func (o *OverloadDecl) HasLateBinding() bool { if o == nil { return false } - return o.hasLateBinding || o.asyncOp != nil + return o.hasLateBinding } // OperandTrait returns the trait mask of the first operand to the overload call, e.g. @@ -782,9 +740,9 @@ func (o *OverloadDecl) SignatureOverlaps(other *OverloadDecl) bool { return argsOverlap } -// HasBinding indicates whether the overload already has a definition. -func (o *OverloadDecl) HasBinding() bool { - return o != nil && (o.unaryOp != nil || o.binaryOp != nil || o.functionOp != nil || o.asyncOp != nil) +// hasBinding indicates whether the overload already has a definition. +func (o *OverloadDecl) hasBinding() bool { + return o != nil && (o.unaryOp != nil || o.binaryOp != nil || o.functionOp != nil) } // guardedUnaryOp creates an invocation guard around the provided unary operator, if one is defined. @@ -826,22 +784,6 @@ func (o *OverloadDecl) guardedFunctionOp(funcName string, disableTypeGuards bool } } -// guardedAsyncOp creates an invocation guard around the provided async function binding, if one is provided. -func (o *OverloadDecl) guardedAsyncOp(funcName string, disableTypeGuards bool) functions.AsyncOp { - if o.asyncOp == nil { - return nil - } - return func(ctx context.Context, args ...ref.Val) <-chan ref.Val { - if !o.matchesRuntimeSignature(disableTypeGuards, args...) { - ch := make(chan ref.Val, 1) - ch <- MaybeNoSuchOverload(funcName, args...) - close(ch) - return ch - } - return o.asyncOp(ctx, args...) - } -} - // matchesRuntimeUnarySignature indicates whether the argument type is runtime assiganble to the overload's expected argument. func (o *OverloadDecl) matchesRuntimeUnarySignature(disableTypeGuards bool, arg ref.Val) bool { return matchRuntimeArgType(o.IsNonStrict(), disableTypeGuards, o.ArgTypes()[0], arg) && @@ -875,8 +817,6 @@ func matchRuntimeArgType(nonStrict, disableTypeGuards bool, argType *types.Type, if nonStrict && (disableTypeGuards || types.IsUnknownOrError(arg)) { return true } - // Note, early returns and unknown aggregation happen in the interpretable.go file; however, this check is here - // for defense in depth or for scenarios where someone manipulates bindings to offer their own dispatch logic. if types.IsUnknownOrError(arg) { return false } @@ -902,7 +842,7 @@ func OverloadExamples(examples ...string) OverloadOpt { // type-guard which ensures runtime type agreement between the overload signature and runtime argument types. func UnaryBinding(binding functions.UnaryOp) OverloadOpt { return func(o *OverloadDecl) (*OverloadDecl, error) { - if o.HasBinding() { + if o.hasBinding() { return nil, fmt.Errorf("overload already has a binding: %s", o.ID()) } if len(o.ArgTypes()) != 1 { @@ -920,7 +860,7 @@ func UnaryBinding(binding functions.UnaryOp) OverloadOpt { // type-guard which ensures runtime type agreement between the overload signature and runtime argument types. func BinaryBinding(binding functions.BinaryOp) OverloadOpt { return func(o *OverloadDecl) (*OverloadDecl, error) { - if o.HasBinding() { + if o.hasBinding() { return nil, fmt.Errorf("overload already has a binding: %s", o.ID()) } if len(o.ArgTypes()) != 2 { @@ -938,7 +878,7 @@ func BinaryBinding(binding functions.BinaryOp) OverloadOpt { // type-guard which ensures runtime type agreement between the overload signature and runtime argument types. func FunctionBinding(binding functions.FunctionOp) OverloadOpt { return func(o *OverloadDecl) (*OverloadDecl, error) { - if o.HasBinding() { + if o.hasBinding() { return nil, fmt.Errorf("overload already has a binding: %s", o.ID()) } if o.hasLateBinding { @@ -949,45 +889,11 @@ func FunctionBinding(binding functions.FunctionOp) OverloadOpt { } } -// AsyncBinding provides the implementation of an asynchronous overload. The provided function -// is called in its own goroutine with the provided context. The function should block until -// the result is available, and the framework manages goroutine and channel lifecycle. -// -// This follows the same pattern used by gRPC-Go and other major Go frameworks where user -// code is synchronous and the framework manages concurrency. -func AsyncBinding(fn functions.BlockingAsyncOp) OverloadOpt { - return func(o *OverloadDecl) (*OverloadDecl, error) { - if o.HasBinding() { - return nil, fmt.Errorf("overload already has a binding: %s", o.ID()) - } - if o.hasLateBinding { - return nil, fmt.Errorf("overload already has a late binding: %s", o.ID()) - } - o.asyncOp = wrapAsyncOp(fn) - return o, nil - } -} - -// wrapAsyncOp adapts a blocking function into the channel-based AsyncOp used internally. -// -// The blocking function is invoked synchronously and its result delivered on a buffered channel. -// The interpreter always invokes an AsyncOp from a dedicated goroutine, so running the blocking -// call inline here keeps the framework to a single goroutine per async call rather than spawning -// an additional one to bridge blocking-to-channel. -func wrapAsyncOp(fn functions.BlockingAsyncOp) functions.AsyncOp { - return func(ctx context.Context, args ...ref.Val) <-chan ref.Val { - ch := make(chan ref.Val, 1) - ch <- fn(ctx, args...) - close(ch) - return ch - } -} - // LateFunctionBinding indicates that the function has a binding which is not known at compile time. // This is useful for functions which have side-effects or are not deterministically computable. func LateFunctionBinding() OverloadOpt { return func(o *OverloadDecl) (*OverloadDecl, error) { - if o.HasBinding() { + if o.hasBinding() { return nil, fmt.Errorf("overload already has a binding: %s", o.ID()) } o.hasLateBinding = true diff --git a/vendor/github.com/google/cel-go/common/doc.go b/vendor/github.com/google/cel-go/common/doc.go index c10742c284..06eae3642a 100644 --- a/vendor/github.com/google/cel-go/common/doc.go +++ b/vendor/github.com/google/cel-go/common/doc.go @@ -37,8 +37,6 @@ const ( DocMacro // DocExample represents example documentation. DocExample - // DocField represents documentation for a struct field. - DocField ) // Doc holds the documentation details for a specific program element like @@ -165,17 +163,6 @@ func NewExampleDoc(ex string) *Doc { } } -// NewFieldDoc creates a new Doc struct for documenting a struct field. -func NewFieldDoc(name, celType, description string, examples ...*Doc) *Doc { - return &Doc{ - Kind: DocField, - Name: name, - Type: celType, - Description: description, - Children: examples, - } -} - // Documentor is an interface for types that can provide their own documentation. type Documentor interface { // Documentation returns the documentation coded by the DocKind to assist diff --git a/vendor/github.com/google/cel-go/common/env/BUILD.bazel b/vendor/github.com/google/cel-go/common/env/BUILD.bazel index 261da924d4..aebe1e544c 100644 --- a/vendor/github.com/google/cel-go/common/env/BUILD.bazel +++ b/vendor/github.com/google/cel-go/common/env/BUILD.bazel @@ -23,14 +23,12 @@ go_library( name = "go_default_library", srcs = [ "env.go", - "io.go", ], importpath = "github.com/google/cel-go/common/env", deps = [ "//common:go_default_library", "//common/decls:go_default_library", "//common/types:go_default_library", - "@in_yaml_go_yaml_v3//:go_default_library", ], ) @@ -39,7 +37,6 @@ go_test( size = "small", srcs = [ "env_test.go", - "io_test.go", ], data = glob(["testdata/**"]), embed = [":go_default_library"], @@ -48,7 +45,6 @@ go_test( "//common/operators:go_default_library", "//common/overloads:go_default_library", "//common/types:go_default_library", - "@com_github_google_go_cmp//cmp:go_default_library", - "@in_yaml_go_yaml_v3//:go_default_library", + "@in_gopkg_yaml_v3//:go_default_library", ], ) diff --git a/vendor/github.com/google/cel-go/common/env/env.go b/vendor/github.com/google/cel-go/common/env/env.go index 936036ed21..d848860c2c 100644 --- a/vendor/github.com/google/cel-go/common/env/env.go +++ b/vendor/github.com/google/cel-go/common/env/env.go @@ -50,7 +50,6 @@ type Config struct { Functions []*Function `yaml:"functions,omitempty"` Validators []*Validator `yaml:"validators,omitempty"` Features []*Feature `yaml:"features,omitempty"` - Limits []*Limit `yaml:"limits,omitempty"` } // Validate validates the whole configuration is well-formed. @@ -93,11 +92,6 @@ func (c *Config) Validate() error { errs = append(errs, err) } } - for _, limit := range c.Limits { - if err := limit.Validate(); err != nil { - errs = append(errs, err) - } - } for _, val := range c.Validators { if err := val.Validate(); err != nil { errs = append(errs, err) @@ -128,7 +122,7 @@ func (c *Config) AddVariableDecls(vars ...*decls.VariableDecl) *Config { return c.AddVariables(convVars...) } -// AddVariables adds one or more variables to the config. +// AddVariables adds one or more vairables to the config. func (c *Config) AddVariables(vars ...*Variable) *Config { c.Variables = append(c.Variables, vars...) return c @@ -212,12 +206,6 @@ func (c *Config) AddFeatures(feats ...*Feature) *Config { return c } -// AddLimits appends one or more limits to the config. -func (c *Config) AddLimits(limits ...*Limit) *Config { - c.Limits = append(c.Limits, limits...) - return c -} - // NewImport returns a serializable import value from the qualified type name. func NewImport(name string) *Import { return &Import{Name: name} @@ -258,9 +246,7 @@ type Variable struct { // Type represents the type declaration for the variable. // - // When serialized, 'type' is used for shorthand specifier string. - // - // Use GetType() for getting the effective type. + // Deprecated: use the embedded *TypeDesc fields directly. Type *TypeDesc `yaml:"type,omitempty"` // TypeDesc is an embedded set of fields allowing for the specification of the Variable type. @@ -278,9 +264,6 @@ func (v *Variable) Validate() error { if err := v.GetType().Validate(); err != nil { return fmt.Errorf("invalid variable %q: %w", v.Name, err) } - if v.GetType().IsTypeParam { - return fmt.Errorf("invalid variable %q: variables cannot be type parameters", v.Name) - } return nil } @@ -751,29 +734,6 @@ func (feat *Feature) Validate() error { return nil } -// Limit represents a named limit in the CEL environment. This is used to control -// the complexity tolerated before failing parsing, type checking, or planning. -type Limit struct { - Name string `yaml:"name"` - Value int `yaml:"value"` -} - -// NewLimit creates a new limit. -func NewLimit(name string, value int) *Limit { - return &Limit{name, value} -} - -// Validate validates a limit. -func (l *Limit) Validate() error { - if l == nil { - return errors.New("invalid limit: nil") - } - if l.Name == "" { - return errors.New("invalid limit: missing name") - } - return nil -} - // NewTypeDesc describes a simple or complex type with parameters. func NewTypeDesc(typeName string, params ...*TypeDesc) *TypeDesc { return &TypeDesc{TypeName: typeName, Params: params} @@ -836,47 +796,11 @@ func (td *TypeDesc) Validate() error { return fmt.Errorf("invalid type: optional_type expects 1 parameter, got %d", len(td.Params)) } return td.Params[0].Validate() - case "type": - if len(td.Params) == 0 { - return nil - } - if len(td.Params) != 1 { - return fmt.Errorf("invalid type: type expects 0 or 1 parameters, got %d", len(td.Params)) - } - return td.Params[0].Validate() default: } return nil } -func formatSpecifierImpl(td *TypeDesc, sb *strings.Builder) { - if td.IsTypeParam { - sb.WriteRune('~') - sb.WriteString(td.TypeName) - return - } - sb.WriteString(td.TypeName) - l := len(td.Params) - if l < 1 { - return - } - sb.WriteRune('<') - for i, p := range td.Params { - formatSpecifierImpl(p, sb) - if i < l-1 { - sb.WriteString(", ") - } - } - sb.WriteRune('>') -} - -// SpecifierFormat returns the short text representation of the type. e.g. "map" -func (td *TypeDesc) SpecifierFormat() string { - var sb strings.Builder - formatSpecifierImpl(td, &sb) - return sb.String() -} - // AsCELType converts the serializable object to a *types.Type value. func (td *TypeDesc) AsCELType(tp types.Provider) (*types.Type, error) { err := td.Validate() @@ -886,27 +810,6 @@ func (td *TypeDesc) AsCELType(tp types.Provider) (*types.Type, error) { switch td.TypeName { case "dyn": return types.DynType, nil - // short aliases for WKTs - case "duration": - return types.DurationType, nil - case "timestamp": - return types.TimestampType, nil - case "any": - return types.AnyType, nil - case "null", "null_type": - return types.NullType, nil - case "bool_wrapper": - return types.NewNullableType(types.BoolType), nil - case "bytes_wrapper": - return types.NewNullableType(types.BytesType), nil - case "double_wrapper": - return types.NewNullableType(types.DoubleType), nil - case "int_wrapper": - return types.NewNullableType(types.IntType), nil - case "uint_wrapper": - return types.NewNullableType(types.UintType), nil - case "string_wrapper": - return types.NewNullableType(types.StringType), nil case "map": kt, err := td.Params[0].AsCELType(tp) if err != nil { @@ -929,15 +832,6 @@ func (td *TypeDesc) AsCELType(tp types.Provider) (*types.Type, error) { return nil, err } return types.NewOptionalType(et), nil - case "type": - if len(td.Params) == 0 { - return types.TypeType, nil - } - pt, err := td.Params[0].AsCELType(tp) - if err != nil { - return nil, err - } - return types.NewTypeTypeWithParam(pt), nil default: if td.IsTypeParam { return types.NewTypeParamType(td.TypeName), nil @@ -980,15 +874,6 @@ func SerializeTypeDesc(t *types.Type) *TypeDesc { for _, p := range t.Parameters() { params = append(params, SerializeTypeDesc(p)) } - // Special types, these aren't useful for describing environments. - switch t.Kind() { - case types.ErrorKind: - typeName = "*error*" - case types.UnknownKind: - typeName = "*unknown*" - case types.UnspecifiedKind: - typeName = "*unspecified type*" - } return NewTypeDesc(typeName, params...) } diff --git a/vendor/github.com/google/cel-go/common/env/io.go b/vendor/github.com/google/cel-go/common/env/io.go deleted file mode 100644 index ec126f9ce6..0000000000 --- a/vendor/github.com/google/cel-go/common/env/io.go +++ /dev/null @@ -1,271 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package env - -import ( - "errors" - "fmt" - - "go.yaml.in/yaml/v3" -) - -type internalTypeDesc struct { - TypeName string `yaml:"type_name"` - Params []*TypeDesc `yaml:"params,omitempty"` - IsTypeParam bool `yaml:"is_type_param,omitempty"` -} - -// Embedding TypeDesc in variable causes issues with customizing -// unmarshalling / marshalling. Work around with a parallel type. -type internalVariable struct { - Name string `yaml:"name"` - Description string `yaml:"description,omitempty"` - - // Type represents the type declaration for the variable. - Type *TypeDesc `yaml:"type,omitempty"` - - TypeName string `yaml:"type_name"` - Params []*TypeDesc `yaml:"params,omitempty"` - IsTypeParam bool `yaml:"is_type_param,omitempty"` -} - -// UnmarshalYAML implements yaml.Unmarshal -func (v *Variable) UnmarshalYAML(n *yaml.Node) error { - buf := internalVariable{} - err := n.Decode(&buf) - if err != nil { - return err - } - v.Name = buf.Name - v.Description = buf.Description - if buf.TypeName != "" { - v.TypeDesc = &TypeDesc{ - TypeName: buf.TypeName, - Params: buf.Params, - IsTypeParam: buf.IsTypeParam, - } - } else if buf.Type != nil { - v.TypeDesc = buf.Type - } - return nil -} - -// MarshalYAML implements yaml.Marshaler -func (v *Variable) MarshalYAML() (any, error) { - // The presence of an unmarshaller alters the default marshaller behavior so - // provide a simple marshal implementation. - buf := internalVariable{ - Name: v.Name, - Description: v.Description, - } - if t := v.GetType(); t != nil { - buf.TypeName = t.TypeName - buf.Params = t.Params - buf.IsTypeParam = t.IsTypeParam - } - return &buf, nil -} - -// UnmarshalYAML implements yaml.Unmarshaler -func (td *TypeDesc) UnmarshalYAML(n *yaml.Node) error { - if td == nil { - return fmt.Errorf("unexpected Unmarshal for TypeDesc at: %d", n.Line) - } - if n.Kind == yaml.ScalarNode { - o, err := ParseTypeDesc(n.Value) - if err != nil { - return err - } - *td = *o - return nil - } - - if n.Kind != yaml.MappingNode { - return errors.New("unsupported yaml for TypeDesc") - } - - buf := internalTypeDesc{} - err := n.Decode(&buf) - if err != nil { - return err - } - td.TypeName = buf.TypeName - td.Params = buf.Params - td.IsTypeParam = buf.IsTypeParam - return nil -} - -type typeDescParser struct { - text string - pos int - length int -} - -// ParseTypeDesc parses a TypeDesc from the type specifier format: "map" -func ParseTypeDesc(text string) (*TypeDesc, error) { - p := &typeDescParser{text: text, length: len(text)} - res, err := p.parseTypeElem() - if err != nil { - return nil, fmt.Errorf("failed to parse type %q: %v", text, err) - } - p.skipWhitespace() - if p.pos < p.length { - return nil, fmt.Errorf("unexpected character %q at position %d in %q", p.text[p.pos], p.pos, text) - } - return res, nil -} - -func (p *typeDescParser) parseConcreteType() (*TypeDesc, error) { - id, err := p.parseNamespaceIdentifier() - if err != nil { - return nil, err - } - if p.pos < p.length && p.text[p.pos] == '<' { - p.pos++ // consume '<' - var params []*TypeDesc - for { - p.skipWhitespace() - param, err := p.parseTypeElem() - if err != nil { - return nil, err - } - params = append(params, param) - p.skipWhitespace() - if p.pos < p.length && p.text[p.pos] == ',' { - p.pos++ // consume ',' - continue - } - if p.pos < p.length && p.text[p.pos] == '>' { - p.pos++ // consume '>' - break - } - return nil, fmt.Errorf("expected ',' or '>' at position %d", p.pos) - } - return NewTypeDesc(id, params...), nil - } - return NewTypeDesc(id), nil -} - -func (p *typeDescParser) parseTypeElem() (*TypeDesc, error) { - p.skipWhitespace() - if p.pos < p.length && p.text[p.pos] == '~' { - p.pos++ // consume '~' - id, err := p.parseTypeParamIdent() - if err != nil { - return nil, err - } - return NewTypeParam(id), nil - } - return p.parseConcreteType() -} - -func (p *typeDescParser) parseNamespaceIdentifier() (string, error) { - p.skipWhitespace() - var id string - for p.pos < p.length && p.text[p.pos] != '<' { - c := p.text[p.pos] - if c == '.' { - id += "." - p.pos++ // consume '.' - } - ident, err := p.parseIdentifier() - if err != nil { - return "", err - } - id += ident - p.skipWhitespace() - if p.pos < p.length && p.text[p.pos] != '.' { - break - } - } - if id == "" { - return "", fmt.Errorf("missing identifier at position %d", p.pos) - } - return id, nil -} - -func (p *typeDescParser) parseIdentifier() (string, error) { - p.skipWhitespace() - if p.pos >= p.length { - return "", fmt.Errorf("unexpected end of input") - } - start := p.pos - c := p.text[p.pos] - if !isAlpha(c) && c != '_' { - return "", fmt.Errorf("identifier is expected, but %q was found at position %d", c, p.pos) - } - p.pos++ - for p.pos < p.length { - c := p.text[p.pos] - if !isAlphaNumeric(c) && c != '_' { - break - } - p.pos++ - } - return p.text[start:p.pos], nil -} - -func (p *typeDescParser) parseTypeParamIdent() (string, error) { - p.skipWhitespace() - if p.pos >= p.length { - return "", fmt.Errorf("unexpected end of input") - } - c := p.text[p.pos] - if !isAlpha(c) { - return "", fmt.Errorf("invalid type parameter identifier %q at position %d, must be a single character from A-Z", c, p.pos) - } - p.pos++ - if p.pos < p.length && isAlpha(p.text[p.pos]) { - return "", fmt.Errorf("invalid type param, must have a single alphabetic character at position %d", p.pos) - } - return string(c), nil -} - -func (p *typeDescParser) skipWhitespace() { - for p.pos < p.length && p.text[p.pos] == ' ' { - p.pos++ - } -} - -func isAlpha(c byte) bool { - return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') -} - -func isAlphaNumeric(c byte) bool { - return isAlpha(c) || (c >= '0' && c <= '9') -} - -// ConfigFromYAML returns a config from YAML source. -// -// Adds custom parsing logic for normalizing shorthand for specifiying some fields -// in a YAML document (mainly the type-specifier shorthand). -// -// Using yaml.Unmarshal with any implementation should be sufficient for most -// cases. -func ConfigFromYAML(data []byte) (*Config, error) { - c := &Config{} - e := yaml.Unmarshal(data, c) - if e != nil { - return nil, e - } - return c, nil -} - -// ConfigToYAML returns the config serialized to YAML -// -// Provided as a convenience wrapper around a tested YAML Marshaler. -func ConfigToYAML(c *Config) ([]byte, error) { - return yaml.Marshal(c) -} diff --git a/vendor/github.com/google/cel-go/common/functions/functions.go b/vendor/github.com/google/cel-go/common/functions/functions.go index 0c00781d9c..67f4a5944e 100644 --- a/vendor/github.com/google/cel-go/common/functions/functions.go +++ b/vendor/github.com/google/cel-go/common/functions/functions.go @@ -15,11 +15,7 @@ // Package functions defines the standard builtin functions supported by the interpreter package functions -import ( - "context" - - "github.com/google/cel-go/common/types/ref" -) +import "github.com/google/cel-go/common/types/ref" // Overload defines a named overload of a function, indicating an operand trait // which must be present on the first argument to the overload as well as one @@ -45,37 +41,21 @@ type Overload struct { // Binary defines the overload with a BinaryOp implementation. May be nil. Binary BinaryOp - // Function defines the overload with a FunctionOp implementation. May be nil. + // Function defines the overload with a FunctionOp implementation. May be + // nil. Function FunctionOp - // Async defines the overload with an AsyncOp implementation. May be nil. - Async AsyncOp - // NonStrict specifies whether the Overload will tolerate arguments that // are types.Err or types.Unknown. NonStrict bool } // UnaryOp is a function that takes a single value and produces an output. -type UnaryOp func(ref.Val) ref.Val +type UnaryOp func(value ref.Val) ref.Val // BinaryOp is a function that takes two values and produces an output. -type BinaryOp func(ref.Val, ref.Val) ref.Val +type BinaryOp func(lhs ref.Val, rhs ref.Val) ref.Val // FunctionOp is a function with accepts zero or more arguments and produces // a value or error as a result. -type FunctionOp func(...ref.Val) ref.Val - -// AsyncOp is a function that accepts zero or more arguments and produces -// a value or error asynchronously via a channel. -// -// AsyncOp is an internal interface intended for use by CEL to manage goroutines and -// channels associated with async calls. For public API usage, use BlockingAsyncOp. -// Implementers should listen for context cancellation on the provided context for -// resource cleanup. -type AsyncOp func(context.Context, ...ref.Val) <-chan ref.Val - -// BlockingAsyncOp is a function that accepts zero or more arguments and blocks until -// the result is available. When used with AsyncBinding, the framework runs the function -// in its own goroutine and manages channel lifecycle internally. -type BlockingAsyncOp func(context.Context, ...ref.Val) ref.Val +type FunctionOp func(values ...ref.Val) ref.Val diff --git a/vendor/github.com/google/cel-go/common/overloads/overloads.go b/vendor/github.com/google/cel-go/common/overloads/overloads.go index 0e3a724495..9d50f4367b 100644 --- a/vendor/github.com/google/cel-go/common/overloads/overloads.go +++ b/vendor/github.com/google/cel-go/common/overloads/overloads.go @@ -291,6 +291,7 @@ const ( const ( DurationToDuration = "duration_to_duration" StringToDuration = "string_to_duration" + IntToDuration = "int64_to_duration" ) // Convert to dyn diff --git a/vendor/github.com/google/cel-go/common/runes/buffer.go b/vendor/github.com/google/cel-go/common/runes/buffer.go index 58dd33e13e..021198224d 100644 --- a/vendor/github.com/google/cel-go/common/runes/buffer.go +++ b/vendor/github.com/google/cel-go/common/runes/buffer.go @@ -16,7 +16,6 @@ package runes import ( - "fmt" "strings" "unicode/utf8" ) @@ -114,64 +113,45 @@ var _ Buffer = &supplementalBuffer{} var nilBuffer = &emptyBuffer{} -// SizeLimitError indicates that the input exceeded the configured code point limit. -type SizeLimitError struct { - Size int - Limit int -} - -func (e *SizeLimitError) Error() string { - return fmt.Sprintf("expression code point size exceeds limit: size: %d, limit %d", e.Size, e.Limit) -} - // NewBuffer returns an efficient implementation of Buffer for the given text based on the ranges of // the encoded code points contained within. +// +// Code points are represented as an array of byte, uint16, or rune. This approach ensures that +// each index represents a code point by itself without needing to use an array of rune. At first +// we assume all code points are less than or equal to '\u007f'. If this holds true, the +// underlying storage is a byte array containing only ASCII characters. If we encountered a code +// point above this range but less than or equal to '\uffff' we allocate a uint16 array, copy the +// elements of previous byte array to the uint16 array, and continue. If this holds true, the +// underlying storage is a uint16 array containing only Unicode characters in the Basic Multilingual +// Plane. If we encounter a code point above '\uffff' we allocate an rune array, copy the previous +// elements of the byte or uint16 array, and continue. The underlying storage is an rune array +// containing any Unicode character. func NewBuffer(data string) Buffer { - buf, _, _ := newBufferWithLimit(data, false, -1) + buf, _ := newBuffer(data, false) return buf } // NewBufferAndLineOffsets returns an efficient implementation of Buffer for the given text based on // the ranges of the encoded code points contained within, as well as returning the line offsets. +// +// Code points are represented as an array of byte, uint16, or rune. This approach ensures that +// each index represents a code point by itself without needing to use an array of rune. At first +// we assume all code points are less than or equal to '\u007f'. If this holds true, the +// underlying storage is a byte array containing only ASCII characters. If we encountered a code +// point above this range but less than or equal to '\uffff' we allocate a uint16 array, copy the +// elements of previous byte array to the uint16 array, and continue. If this holds true, the +// underlying storage is a uint16 array containing only Unicode characters in the Basic Multilingual +// Plane. If we encounter a code point above '\uffff' we allocate an rune array, copy the previous +// elements of the byte or uint16 array, and continue. The underlying storage is an rune array +// containing any Unicode character. func NewBufferAndLineOffsets(data string) (Buffer, []int32) { - buf, offs, _ := newBufferWithLimit(data, true, -1) - return buf, offs -} - -// NewBufferAndLineOffsetsWithLimit returns an efficient implementation of Buffer for the given text -// and enforces a code point limit while constructing the buffer. -func NewBufferAndLineOffsetsWithLimit(data string, limit int) (Buffer, []int32, error) { - if limit < 0 || len(data) <= limit { - return newBufferWithLimit(data, true, -1) - } - return newBufferWithLimit(data, true, limit) -} - -func countRemainingCodePoints(data string, idx int, count int) int { - for idx < len(data) { - _, s := utf8.DecodeRuneInString(data[idx:]) - idx += s - count++ - } - return count + return newBuffer(data, true) } -func newBufferWithLimit(data string, lines bool, limit int) (Buffer, []int32, error) { +func newBuffer(data string, lines bool) (Buffer, []int32) { if len(data) == 0 { - return nilBuffer, []int32{0}, nil - } - if limit >= 0 && len(data) > limit { - size := countRemainingCodePoints(data, 0, 0) - if size > limit { - return nil, nil, &SizeLimitError{ - Size: size, - Limit: limit, - } - } + return nilBuffer, []int32{0} } - - // The resulting buffers store one element per code point, so the worst case - // element count never exceeds len(data). var ( idx = 0 off int32 = 0 @@ -215,8 +195,7 @@ func newBufferWithLimit(data string, lines bool, limit int) (Buffer, []int32, er } return &asciiBuffer{ arr: buf8, - }, offs, nil - + }, offs copy16: for idx < len(data) { r, s := utf8.DecodeRuneInString(data[idx:]) @@ -243,8 +222,7 @@ copy16: } return &basicBuffer{ arr: buf16, - }, offs, nil - + }, offs copy32: for idx < len(data) { r, s := utf8.DecodeRuneInString(data[idx:]) @@ -260,5 +238,5 @@ copy32: } return &supplementalBuffer{ arr: buf32, - }, offs, nil + }, offs } diff --git a/vendor/github.com/google/cel-go/common/source.go b/vendor/github.com/google/cel-go/common/source.go index 9187e9b5c3..ec79cb5454 100644 --- a/vendor/github.com/google/cel-go/common/source.go +++ b/vendor/github.com/google/cel-go/common/source.go @@ -74,12 +74,6 @@ func NewTextSource(text string) Source { return NewStringSource(text, "") } -// NewTextSourceWithLimit creates a new Source from the input text string while -// enforcing a maximum code point count when needed. -func NewTextSourceWithLimit(text string, limit int) (Source, error) { - return NewStringSourceWithLimit(text, "", limit) -} - // NewStringSource creates a new Source from the given contents and description. func NewStringSource(contents string, description string) Source { // Compute line offsets up front as they are referred to frequently. @@ -91,23 +85,6 @@ func NewStringSource(contents string, description string) Source { } } -// NewStringSourceWithLimit creates a new Source from the given contents and -// description while enforcing a maximum code point count when needed. -func NewStringSourceWithLimit(contents string, description string, limit int) (Source, error) { - if limit < 0 || len(contents) <= limit { - return NewStringSource(contents, description), nil - } - buf, offs, err := runes.NewBufferAndLineOffsetsWithLimit(contents, limit) - if err != nil { - return nil, err - } - return &sourceImpl{ - Buffer: buf, - description: description, - lineOffsets: offs, - }, nil -} - // NewInfoSource creates a new Source from a SourceInfo. func NewInfoSource(info *exprpb.SourceInfo) Source { return &sourceImpl{ diff --git a/vendor/github.com/google/cel-go/common/stdlib/standard.go b/vendor/github.com/google/cel-go/common/stdlib/standard.go index d2313bef1b..4040a4f5c5 100644 --- a/vendor/github.com/google/cel-go/common/stdlib/standard.go +++ b/vendor/github.com/google/cel-go/common/stdlib/standard.go @@ -16,7 +16,6 @@ package stdlib import ( - "math" "strconv" "strings" "time" @@ -311,9 +310,6 @@ func init() { argTypes(types.DurationType, types.DurationType), types.BoolType, decls.OverloadExamples(`duration('1ms') < duration('1s') // true`)), decls.SingletonBinaryBinding(func(lhs, rhs ref.Val) ref.Val { - if isNaN(lhs) || isNaN(rhs) { - return types.False - } cmp := lhs.(traits.Comparer).Compare(rhs) if cmp == types.IntNegOne { return types.True @@ -371,9 +367,6 @@ func init() { argTypes(types.DurationType, types.DurationType), types.BoolType, decls.OverloadExamples(`duration('1ms') <= duration('1s') // true`)), decls.SingletonBinaryBinding(func(lhs, rhs ref.Val) ref.Val { - if isNaN(lhs) || isNaN(rhs) { - return types.False - } cmp := lhs.(traits.Comparer).Compare(rhs) if cmp == types.IntNegOne || cmp == types.IntZero { return types.True @@ -431,9 +424,6 @@ func init() { argTypes(types.DurationType, types.DurationType), types.BoolType, decls.OverloadExamples(`duration('1ms') > duration('1us') // true`)), decls.SingletonBinaryBinding(func(lhs, rhs ref.Val) ref.Val { - if isNaN(lhs) || isNaN(rhs) { - return types.False - } cmp := lhs.(traits.Comparer).Compare(rhs) if cmp == types.IntOne { return types.True @@ -491,9 +481,6 @@ func init() { argTypes(types.DurationType, types.DurationType), types.BoolType, decls.OverloadExamples(`duration('60s') >= duration('1m') // true`)), decls.SingletonBinaryBinding(func(lhs, rhs ref.Val) ref.Val { - if isNaN(lhs) || isNaN(rhs) { - return types.False - } cmp := lhs.(traits.Comparer).Compare(rhs) if cmp == types.IntOne || cmp == types.IntZero { return types.True @@ -618,6 +605,8 @@ func init() { decls.Overload(overloads.DurationToDuration, argTypes(types.DurationType), types.DurationType, decls.OverloadExamples(`duration(duration('1s')) // duration('1s')`), decls.UnaryBinding(identity)), + decls.Overload(overloads.IntToDuration, argTypes(types.IntType), types.DurationType, + decls.UnaryBinding(convertToType(types.DurationType))), decls.Overload(overloads.StringToDuration, argTypes(types.StringType), types.DurationType, decls.OverloadExamples(`duration('1h2m3s') // duration('3723s')`), decls.UnaryBinding(convertToType(types.DurationType)))), @@ -939,11 +928,6 @@ func noBinaryOverrides(rhs, lhs ref.Val) ref.Val { return types.NoSuchOverloadErr() } -func isNaN(val ref.Val) bool { - d, ok := val.(types.Double) - return ok && math.IsNaN(float64(d)) -} - func noFunctionOverrides(args ...ref.Val) ref.Val { return types.NoSuchOverloadErr() } diff --git a/vendor/github.com/google/cel-go/common/types/BUILD.bazel b/vendor/github.com/google/cel-go/common/types/BUILD.bazel index 37d4df4954..7082bc7550 100644 --- a/vendor/github.com/google/cel-go/common/types/BUILD.bazel +++ b/vendor/github.com/google/cel-go/common/types/BUILD.bazel @@ -40,6 +40,7 @@ go_library( "//common/types/pb:go_default_library", "//common/types/ref:go_default_library", "//common/types/traits:go_default_library", + "@com_github_stoewer_go_strcase//:go_default_library", "@dev_cel_expr//:expr", "@org_golang_google_genproto_googleapis_api//expr/v1alpha1:go_default_library", "@org_golang_google_protobuf//encoding/protojson:go_default_library", diff --git a/vendor/github.com/google/cel-go/common/types/bool.go b/vendor/github.com/google/cel-go/common/types/bool.go index 5f1e4573e1..1f9e107392 100644 --- a/vendor/github.com/google/cel-go/common/types/bool.go +++ b/vendor/github.com/google/cel-go/common/types/bool.go @@ -69,7 +69,7 @@ func (b Bool) ConvertToNative(typeDesc reflect.Type) (any, error) { case boolWrapperType: // Convert the bool to a wrapperspb.BoolValue. return wrapperspb.Bool(bool(b)), nil - case JSONValueType: + case jsonValueType: // Return the bool as a new structpb.Value. return structpb.NewBoolValue(bool(b)), nil default: diff --git a/vendor/github.com/google/cel-go/common/types/bytes.go b/vendor/github.com/google/cel-go/common/types/bytes.go index 2eefb5d7f7..b59e1fc208 100644 --- a/vendor/github.com/google/cel-go/common/types/bytes.go +++ b/vendor/github.com/google/cel-go/common/types/bytes.go @@ -44,10 +44,7 @@ func (b Bytes) Add(other ref.Val) ref.Val { if !ok { return ValOrErr(other, "no such overload") } - sum := make([]byte, 0, len(b)+len(otherBytes)) - sum = append(sum, b...) - sum = append(sum, otherBytes...) - return Bytes(sum) + return append(b, otherBytes...) } // Compare implements traits.Comparer interface method by lexicographic ordering. @@ -82,7 +79,7 @@ func (b Bytes) ConvertToNative(typeDesc reflect.Type) (any, error) { case byteWrapperType: // Convert the bytes to a wrapperspb.BytesValue. return wrapperspb.Bytes([]byte(b)), nil - case JSONValueType: + case jsonValueType: // CEL follows the proto3 to JSON conversion by encoding bytes to a string via base64. // The encoding below matches the golang 'encoding/json' behavior during marshaling, // which uses base64.StdEncoding. diff --git a/vendor/github.com/google/cel-go/common/types/double.go b/vendor/github.com/google/cel-go/common/types/double.go index 02abfee2dc..1e7de9d6e1 100644 --- a/vendor/github.com/google/cel-go/common/types/double.go +++ b/vendor/github.com/google/cel-go/common/types/double.go @@ -89,7 +89,7 @@ func (d Double) ConvertToNative(typeDesc reflect.Type) (any, error) { case floatWrapperType: // Convert to a wrapperspb.FloatValue (with truncation). return wrapperspb.Float(float32(d)), nil - case JSONValueType: + case jsonValueType: // Note, there are special cases for proto3 to json conversion that // expect the floating point value to be converted to a NaN, // Infinity, or -Infinity string values, but the jsonpb string diff --git a/vendor/github.com/google/cel-go/common/types/duration.go b/vendor/github.com/google/cel-go/common/types/duration.go index 2207147734..be58d567ed 100644 --- a/vendor/github.com/google/cel-go/common/types/duration.go +++ b/vendor/github.com/google/cel-go/common/types/duration.go @@ -106,7 +106,7 @@ func (d Duration) ConvertToNative(typeDesc reflect.Type) (any, error) { case durationValueType: // Unwrap the CEL value to its underlying proto value. return dpb.New(d.Duration), nil - case JSONValueType: + case jsonValueType: // CEL follows the proto3 to JSON conversion. // Note, using jsonpb would wrap the result in extra double quotes. v := d.ConvertToType(StringType) diff --git a/vendor/github.com/google/cel-go/common/types/err.go b/vendor/github.com/google/cel-go/common/types/err.go index 3216ff1c4a..17ab1a95e5 100644 --- a/vendor/github.com/google/cel-go/common/types/err.go +++ b/vendor/github.com/google/cel-go/common/types/err.go @@ -113,9 +113,6 @@ func ValOrErr(val ref.Val, format string, args ...any) ref.Val { // WrapErr wraps an existing Go error value into a CEL Err value. func WrapErr(err error) ref.Val { - if err, ok := err.(*Err); ok { - return err - } return &Err{error: err} } diff --git a/vendor/github.com/google/cel-go/common/types/int.go b/vendor/github.com/google/cel-go/common/types/int.go index 60d5a71606..0ac1997b70 100644 --- a/vendor/github.com/google/cel-go/common/types/int.go +++ b/vendor/github.com/google/cel-go/common/types/int.go @@ -120,7 +120,7 @@ func (i Int) ConvertToNative(typeDesc reflect.Type) (any, error) { case int64WrapperType: // Convert the value to a wrapperspb.Int64Value. return wrapperspb.Int64(int64(i)), nil - case JSONValueType: + case jsonValueType: // The proto-to-JSON conversion rules would convert all 64-bit integer values to JSON // decimal strings. Because CEL ints might come from the automatic widening of 32-bit // values in protos, the JSON type is chosen dynamically based on the value. diff --git a/vendor/github.com/google/cel-go/common/types/json_value.go b/vendor/github.com/google/cel-go/common/types/json_value.go index 90acfe7df3..13a4efe7ad 100644 --- a/vendor/github.com/google/cel-go/common/types/json_value.go +++ b/vendor/github.com/google/cel-go/common/types/json_value.go @@ -22,9 +22,8 @@ import ( // JSON type constants representing the reflected types of protobuf JSON values. var ( - // JSONValueType describes the protobuf native type for a JSON value. - JSONValueType = reflect.TypeFor[*structpb.Value]() - JSONListType = reflect.TypeFor[*structpb.ListValue]() - JSONStructType = reflect.TypeFor[*structpb.Struct]() - JSONNullType = reflect.TypeFor[structpb.NullValue]() + jsonValueType = reflect.TypeOf(&structpb.Value{}) + jsonListValueType = reflect.TypeOf(&structpb.ListValue{}) + jsonStructType = reflect.TypeOf(&structpb.Struct{}) + jsonNullType = reflect.TypeOf(structpb.NullValue_NULL_VALUE) ) diff --git a/vendor/github.com/google/cel-go/common/types/list.go b/vendor/github.com/google/cel-go/common/types/list.go index 028770ed68..8c023f8910 100644 --- a/vendor/github.com/google/cel-go/common/types/list.go +++ b/vendor/github.com/google/cel-go/common/types/list.go @@ -126,7 +126,16 @@ func (l *baseList) Add(other ref.Val) ref.Val { if !ok { return MaybeNoSuchOverloadErr(other) } - return newConcatList(l.Adapter, l, otherList) + if l.Size() == IntZero { + return other + } + if otherList.Size() == IntZero { + return l + } + return &concatList{ + Adapter: l.Adapter, + prevList: l, + nextList: otherList} } // Contains implements the traits.Container interface method. @@ -144,9 +153,6 @@ func (l *baseList) Contains(elem ref.Val) ref.Val { // ConvertToNative implements the ref.Val interface method. func (l *baseList) ConvertToNative(typeDesc reflect.Type) (any, error) { - if typeDesc == reflect.TypeFor[any]() { - typeDesc = reflect.TypeFor[[]any]() - } // If the underlying list value is assignable to the reflected type return it. if reflect.TypeOf(l.value).AssignableTo(typeDesc) { return l.value, nil @@ -158,19 +164,19 @@ func (l *baseList) ConvertToNative(typeDesc reflect.Type) (any, error) { // Attempt to convert the list to a set of well known protobuf types. switch typeDesc { case anyValueType: - json, err := l.ConvertToNative(JSONListType) + json, err := l.ConvertToNative(jsonListValueType) if err != nil { return nil, err } return anypb.New(json.(proto.Message)) - case JSONValueType, JSONListType: + case jsonValueType, jsonListValueType: jsonValues, err := l.ConvertToNative(reflect.TypeOf([]*structpb.Value{})) if err != nil { return nil, err } jsonList := &structpb.ListValue{Values: jsonValues.([]*structpb.Value)} - if typeDesc == JSONListType { + if typeDesc == jsonListValueType { return jsonList, nil } return structpb.NewListValue(jsonList), nil @@ -344,27 +350,9 @@ func (l *mutableList) ToImmutableList() traits.Lister { // The `Adapter` enables native type to CEL type conversions. type concatList struct { Adapter - value any - prevList traits.Lister - nextList traits.Lister - cachedSize ref.Val -} - -func newConcatList(adapter Adapter, prevList, nextList traits.Lister) ref.Val { - prevSize := prevList.Size().(Int) - nextSize := nextList.Size().(Int) - if prevSize == IntZero { - return nextList.(ref.Val) - } - if nextSize == IntZero { - return prevList.(ref.Val) - } - return &concatList{ - Adapter: adapter, - prevList: prevList, - nextList: nextList, - cachedSize: prevSize.Add(nextSize), - } + value any + prevList traits.Lister + nextList traits.Lister } // Add implements the traits.Adder interface method. @@ -373,7 +361,16 @@ func (l *concatList) Add(other ref.Val) ref.Val { if !ok { return MaybeNoSuchOverloadErr(other) } - return newConcatList(l.Adapter, l, otherList) + if l.Size() == IntZero { + return other + } + if otherList.Size() == IntZero { + return l + } + return &concatList{ + Adapter: l.Adapter, + prevList: l, + nextList: otherList} } // Contains implements the traits.Container interface method. @@ -477,7 +474,7 @@ func (l *concatList) Iterator() traits.Iterator { // Size implements the traits.Sizer interface method. func (l *concatList) Size() ref.Val { - return l.cachedSize + return l.prevList.Size().(Int).Add(l.nextList.Size()) } // String converts the concatenated list to a human-readable string. diff --git a/vendor/github.com/google/cel-go/common/types/map.go b/vendor/github.com/google/cel-go/common/types/map.go index e4d6f76574..b33096197c 100644 --- a/vendor/github.com/google/cel-go/common/types/map.go +++ b/vendor/github.com/google/cel-go/common/types/map.go @@ -19,8 +19,8 @@ import ( "reflect" "sort" "strings" - "unicode" + "github.com/stoewer/go-strcase" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" @@ -156,9 +156,6 @@ func (m *baseMap) Contains(index ref.Val) ref.Val { func (m *baseMap) ConvertToNative(typeDesc reflect.Type) (any, error) { // If the map is already assignable to the desired type return it, e.g. interfaces and // maps with the same key value types. - if typeDesc == reflect.TypeFor[any]() { - typeDesc = reflect.TypeFor[map[any]any]() - } if reflect.TypeOf(m.value).AssignableTo(typeDesc) { return m.value, nil } @@ -167,19 +164,19 @@ func (m *baseMap) ConvertToNative(typeDesc reflect.Type) (any, error) { } switch typeDesc { case anyValueType: - json, err := m.ConvertToNative(JSONStructType) + json, err := m.ConvertToNative(jsonStructType) if err != nil { return nil, err } return anypb.New(json.(proto.Message)) - case JSONValueType, JSONStructType: + case jsonValueType, jsonStructType: jsonEntries, err := m.ConvertToNative(reflect.TypeOf(map[string]*structpb.Value{})) if err != nil { return nil, err } jsonMap := &structpb.Struct{Fields: jsonEntries.(map[string]*structpb.Value)} - if typeDesc == JSONStructType { + if typeDesc == jsonStructType { return jsonMap, nil } return structpb.NewStructValue(jsonMap), nil @@ -229,7 +226,7 @@ func (m *baseMap) ConvertToNative(typeDesc reflect.Type) (any, error) { return nil, fieldName.(*Err) } name := string(fieldName.(String)) - name = upperCamelCase(name) + name = strcase.UpperCamelCase(name) fieldRef := nativeStruct.FieldByName(name) if !fieldRef.IsValid() { return nil, fmt.Errorf("type conversion error, no such field '%s' in type '%v'", name, typeDesc) @@ -706,12 +703,12 @@ func (m *protoMap) ConvertToNative(typeDesc reflect.Type) (any, error) { // maps with the same key value types. switch typeDesc { case anyValueType: - json, err := m.ConvertToNative(JSONStructType) + json, err := m.ConvertToNative(jsonStructType) if err != nil { return nil, err } return anypb.New(json.(proto.Message)) - case JSONValueType, JSONStructType: + case jsonValueType, jsonStructType: jsonEntries, err := m.ConvertToNative(reflect.TypeOf(map[string]*structpb.Value{})) if err != nil { @@ -719,7 +716,7 @@ func (m *protoMap) ConvertToNative(typeDesc reflect.Type) (any, error) { } jsonMap := &structpb.Struct{ Fields: jsonEntries.(map[string]*structpb.Value)} - if typeDesc == JSONStructType { + if typeDesc == jsonStructType { return jsonMap, nil } return structpb.NewStructValue(jsonMap), nil @@ -1039,32 +1036,3 @@ func InsertMapKeyValue(m traits.Mapper, k, v ref.Val) ref.Val { } return NewErr("insert failed: key %v already exists", k) } - -func upperCamelCase(s string) string { - var newStr strings.Builder - s = strings.TrimSpace(s) - var prev rune - for _, curr := range s { - if prev == 0 || isDelim(prev) { - if !isDelim(curr) { - newStr.WriteRune(unicode.ToUpper(curr)) - } - } else if !isDelim(curr) { - if isLower(prev) { - newStr.WriteRune(curr) - } else { - newStr.WriteRune(unicode.ToLower(curr)) - } - } - prev = curr - } - return newStr.String() -} - -func isDelim(r rune) bool { - return r == '_' || r == '-' -} - -func isLower(r rune) bool { - return r >= 'a' && r <= 'z' -} diff --git a/vendor/github.com/google/cel-go/common/types/null.go b/vendor/github.com/google/cel-go/common/types/null.go index 671e1ee5c0..2c0297fe65 100644 --- a/vendor/github.com/google/cel-go/common/types/null.go +++ b/vendor/github.com/google/cel-go/common/types/null.go @@ -45,7 +45,7 @@ func (n Null) ConvertToNative(typeDesc reflect.Type) (any, error) { switch typeDesc.Kind() { case reflect.Int32: switch typeDesc { - case JSONNullType: + case jsonNullType: return structpb.NullValue_NULL_VALUE, nil case nullReflectType: return n, nil @@ -55,18 +55,18 @@ func (n Null) ConvertToNative(typeDesc reflect.Type) (any, error) { case anyValueType: // Convert to a JSON-null before packing to an Any field since the enum value for JSON // null cannot be packed directly. - pb, err := n.ConvertToNative(JSONValueType) + pb, err := n.ConvertToNative(jsonValueType) if err != nil { return nil, err } return anypb.New(pb.(proto.Message)) - case JSONValueType: + case jsonValueType: return structpb.NewNullValue(), nil case boolWrapperType, byteWrapperType, doubleWrapperType, floatWrapperType, int32WrapperType, int64WrapperType, stringWrapperType, uint32WrapperType, uint64WrapperType, durationValueType, timestampValueType, protoIfaceType: return nil, nil - case JSONListType, JSONStructType: + case jsonListValueType, jsonStructType: // skip handling default: if typeDesc.Implements(protoIfaceType) { diff --git a/vendor/github.com/google/cel-go/common/types/object.go b/vendor/github.com/google/cel-go/common/types/object.go index bb2a09e879..776f6954a9 100644 --- a/vendor/github.com/google/cel-go/common/types/object.go +++ b/vendor/github.com/google/cel-go/common/types/object.go @@ -71,7 +71,7 @@ func (o *protoObj) ConvertToNative(typeDesc reflect.Type) (any, error) { return srcPB, nil } return anypb.New(srcPB) - case JSONValueType: + case jsonValueType: // Marshal the proto to JSON first, and then rehydrate as protobuf.Value as there is no // support for direct conversion from proto.Message to protobuf.Value. bytes, err := protojson.Marshal(srcPB) @@ -187,14 +187,8 @@ func (o *protoObj) format(sb *strings.Builder) { if i > 0 { sb.WriteString(", ") } - name := String(field.Name()) - if field.IsExtension() { - name = String(field.FullName()) - fmt.Fprintf(sb, "`%s`: ", name) - } else { - fmt.Fprintf(sb, "%s: ", name) - } - formatTo(sb, o.Get(name)) + sb.WriteString(fmt.Sprintf("%s: ", field.Name())) + formatTo(sb, o.Get(String(field.Name()))) } sb.WriteString("}") } diff --git a/vendor/github.com/google/cel-go/common/types/optional.go b/vendor/github.com/google/cel-go/common/types/optional.go index 0d861823d2..b8685ebf55 100644 --- a/vendor/github.com/google/cel-go/common/types/optional.go +++ b/vendor/github.com/google/cel-go/common/types/optional.go @@ -25,7 +25,7 @@ import ( var ( // OptionalType indicates the runtime type of an optional value. - OptionalType = NewOpaqueType("optional_type", DynType) + OptionalType = NewOpaqueType("optional_type") // OptionalNone is a sentinel value which is used to indicate an empty optional value. OptionalNone = &Optional{} @@ -59,9 +59,6 @@ func (o *Optional) ConvertToNative(typeDesc reflect.Type) (any, error) { if !o.HasValue() { return nil, errors.New("optional.none() dereference") } - if typeDesc == reflect.TypeFor[*Optional]() { - return o, nil - } return o.value.ConvertToNative(typeDesc) } diff --git a/vendor/github.com/google/cel-go/common/types/pb/file.go b/vendor/github.com/google/cel-go/common/types/pb/file.go index 3a8bdf0b24..e323afb1df 100644 --- a/vendor/github.com/google/cel-go/common/types/pb/file.go +++ b/vendor/github.com/google/cel-go/common/types/pb/file.go @@ -32,7 +32,7 @@ func newFileDescription(fileDesc protoreflect.FileDescriptor, pbdb *Db) (*FileDe } types := make(map[string]*TypeDescription) for name, msgType := range metadata.msgTypes { - types[name] = newTypeDescription(name, msgType, pbdb) + types[name] = newTypeDescription(name, msgType, pbdb.extensions) } fileExtMap := make(extensionMap) for typeName, extensions := range metadata.msgExtensionMap { @@ -42,13 +42,12 @@ func newFileDescription(fileDesc protoreflect.FileDescriptor, pbdb *Db) (*FileDe } for _, ext := range extensions { extDesc := dynamicpb.NewExtensionType(ext).TypeDescriptor() - messageExtMap[string(ext.FullName())] = newFieldDescription(extDesc, pbdb.jsonFieldNames) + messageExtMap[string(ext.FullName())] = newFieldDescription(extDesc) } fileExtMap[typeName] = messageExtMap } return &FileDescription{ name: fileDesc.Path(), - desc: fileDesc, types: types, enums: enums, }, fileExtMap @@ -57,7 +56,6 @@ func newFileDescription(fileDesc protoreflect.FileDescriptor, pbdb *Db) (*FileDe // FileDescription holds a map of all types and enum values declared within a proto file. type FileDescription struct { name string - desc protoreflect.FileDescriptor types map[string]*TypeDescription enums map[string]*EnumValueDescription } @@ -70,7 +68,6 @@ func (fd *FileDescription) Copy(pbdb *Db) *FileDescription { } return &FileDescription{ name: fd.name, - desc: fd.desc, types: typesCopy, enums: fd.enums, } @@ -81,11 +78,6 @@ func (fd *FileDescription) GetName() string { return fd.name } -// FileDescriptor returns the proto file descriptor associated with the file representation. -func (fd *FileDescription) FileDescriptor() protoreflect.FileDescriptor { - return fd.desc -} - // GetEnumDescription returns an EnumDescription for a qualified enum value // name declared within the .proto file. func (fd *FileDescription) GetEnumDescription(enumName string) (*EnumValueDescription, bool) { diff --git a/vendor/github.com/google/cel-go/common/types/pb/pb.go b/vendor/github.com/google/cel-go/common/types/pb/pb.go index c6fdfc6957..eadebcb04e 100644 --- a/vendor/github.com/google/cel-go/common/types/pb/pb.go +++ b/vendor/github.com/google/cel-go/common/types/pb/pb.go @@ -42,9 +42,6 @@ type Db struct { files []*FileDescription // extensions contains the mapping between a given type name, extension name and its FieldDescription extensions map[string]map[string]*FieldDescription - - // jsonFieldNames indicates whether json-style names are supported as proto field names. - jsonFieldNames bool } // extensionsMap is a type alias to a map[typeName]map[extensionName]*FieldDescription @@ -84,27 +81,13 @@ func Merge(dstPB, srcPB proto.Message) error { return nil } -// DbOption modifies feature flags enabled on the proto database. -type DbOption func(*Db) *Db - -// JSONFieldNames configures the Db to support proto field accesses by their JSON names. -func JSONFieldNames(enabled bool) DbOption { - return func(db *Db) *Db { - db.jsonFieldNames = enabled - return db - } -} - // NewDb creates a new `pb.Db` with an empty type name to file description map. -func NewDb(opts ...DbOption) *Db { +func NewDb() *Db { pbdb := &Db{ revFileDescriptorMap: make(map[string]*FileDescription), files: []*FileDescription{}, extensions: make(extensionMap), } - for _, o := range opts { - pbdb = o(pbdb) - } // The FileDescription objects in the default db contain lazily initialized TypeDescription // values which may point to the state contained in the DefaultDb irrespective of this shallow // copy; however, the type graph for a field is idempotently computed, and is guaranteed to @@ -117,15 +100,9 @@ func NewDb(opts ...DbOption) *Db { return pbdb } -// JSONFieldNames indicates whether the database is configured for proto field accesses by JSON names. -func (pbdb *Db) JSONFieldNames() bool { - return pbdb.jsonFieldNames -} - // Copy creates a copy of the current database with its own internal descriptor mapping. func (pbdb *Db) Copy() *Db { copy := NewDb() - copy.jsonFieldNames = pbdb.jsonFieldNames for _, fd := range pbdb.files { hasFile := false for _, fd2 := range copy.files { diff --git a/vendor/github.com/google/cel-go/common/types/pb/type.go b/vendor/github.com/google/cel-go/common/types/pb/type.go index 8d7d1b299f..171494f075 100644 --- a/vendor/github.com/google/cel-go/common/types/pb/type.go +++ b/vendor/github.com/google/cel-go/common/types/pb/type.go @@ -40,92 +40,68 @@ type description interface { // newTypeDescription produces a TypeDescription value for the fully-qualified proto type name // with a given descriptor. -func newTypeDescription(typeName string, desc protoreflect.MessageDescriptor, pbdb *Db) *TypeDescription { +func newTypeDescription(typeName string, desc protoreflect.MessageDescriptor, extensions extensionMap) *TypeDescription { msgType := dynamicpb.NewMessageType(desc) msgZero := dynamicpb.NewMessage(desc) fieldMap := map[string]*FieldDescription{} - jsonFieldMap := map[string]*FieldDescription{} fields := desc.Fields() for i := 0; i < fields.Len(); i++ { f := fields.Get(i) - fd := newFieldDescription(f, pbdb.jsonFieldNames) - fieldMap[fd.Name()] = fd - if pbdb.jsonFieldNames { - jsonFieldMap[fd.JSONName()] = fd - } + fieldMap[string(f.Name())] = newFieldDescription(f) } return &TypeDescription{ - typeName: typeName, - desc: desc, - msgType: msgType, - fieldMap: fieldMap, - jsonFieldMap: jsonFieldMap, - extensions: pbdb.extensions, - reflectType: reflectTypeOf(msgZero), - zeroMsg: zeroValueOf(msgZero), - jsonFieldNames: pbdb.jsonFieldNames, + typeName: typeName, + desc: desc, + msgType: msgType, + fieldMap: fieldMap, + extensions: extensions, + reflectType: reflectTypeOf(msgZero), + zeroMsg: zeroValueOf(msgZero), } } // TypeDescription is a collection of type metadata relevant to expression // checking and evaluation. type TypeDescription struct { - typeName string - desc protoreflect.MessageDescriptor - msgType protoreflect.MessageType - fieldMap map[string]*FieldDescription - jsonFieldMap map[string]*FieldDescription - extensions extensionMap - reflectType reflect.Type - zeroMsg proto.Message - // jsonFieldNames indicates if the type's fields are accessible via their JSON names. - jsonFieldNames bool + typeName string + desc protoreflect.MessageDescriptor + msgType protoreflect.MessageType + fieldMap map[string]*FieldDescription + extensions extensionMap + reflectType reflect.Type + zeroMsg proto.Message } // Copy copies the type description with updated references to the Db. func (td *TypeDescription) Copy(pbdb *Db) *TypeDescription { return &TypeDescription{ - typeName: td.typeName, - desc: td.desc, - msgType: td.msgType, - fieldMap: td.fieldMap, - jsonFieldMap: td.jsonFieldMap, - extensions: pbdb.extensions, - reflectType: td.reflectType, - zeroMsg: td.zeroMsg, - jsonFieldNames: td.jsonFieldNames, + typeName: td.typeName, + desc: td.desc, + msgType: td.msgType, + fieldMap: td.fieldMap, + extensions: pbdb.extensions, + reflectType: td.reflectType, + zeroMsg: td.zeroMsg, } } // FieldMap returns a string field name to FieldDescription map. func (td *TypeDescription) FieldMap() map[string]*FieldDescription { - if td.jsonFieldNames { - return td.jsonFieldMap - } return td.fieldMap } // FieldByName returns (FieldDescription, true) if the field name is declared within the type. func (td *TypeDescription) FieldByName(name string) (*FieldDescription, bool) { - if td.jsonFieldNames { - fd, found := td.jsonFieldMap[name] - if found { - return fd, true - } - } - fd, found := td.fieldMap[name] if found { return fd, true } - extFieldMap, found := td.extensions[td.typeName] - if found { - fd, found = extFieldMap[name] - return fd, found + if !found { + return nil, false } - - return nil, false + fd, found = extFieldMap[name] + return fd, found } // MaybeUnwrap accepts a proto message as input and unwraps it to a primitive CEL type if possible. @@ -156,7 +132,7 @@ func (td *TypeDescription) Zero() proto.Message { } // newFieldDescription creates a new field description from a protoreflect.FieldDescriptor. -func newFieldDescription(fieldDesc protoreflect.FieldDescriptor, jsonFieldNames bool) *FieldDescription { +func newFieldDescription(fieldDesc protoreflect.FieldDescriptor) *FieldDescription { var reflectType reflect.Type var zeroMsg proto.Message switch fieldDesc.Kind() { @@ -192,16 +168,15 @@ func newFieldDescription(fieldDesc protoreflect.FieldDescriptor, jsonFieldNames } var keyType, valType *FieldDescription if fieldDesc.IsMap() { - keyType = newFieldDescription(fieldDesc.MapKey(), jsonFieldNames) - valType = newFieldDescription(fieldDesc.MapValue(), jsonFieldNames) + keyType = newFieldDescription(fieldDesc.MapKey()) + valType = newFieldDescription(fieldDesc.MapValue()) } return &FieldDescription{ - desc: fieldDesc, - KeyType: keyType, - ValueType: valType, - reflectType: reflectType, - zeroMsg: zeroValueOf(zeroMsg), - jsonFieldName: jsonFieldNames, + desc: fieldDesc, + KeyType: keyType, + ValueType: valType, + reflectType: reflectType, + zeroMsg: zeroValueOf(zeroMsg), } } @@ -212,10 +187,9 @@ type FieldDescription struct { // ValueType holds the value FieldDescription for map fields. ValueType *FieldDescription - desc protoreflect.FieldDescriptor - reflectType reflect.Type - zeroMsg proto.Message - jsonFieldName bool + desc protoreflect.FieldDescriptor + reflectType reflect.Type + zeroMsg proto.Message } // CheckedType returns the type-definition used at type-check time. @@ -244,14 +218,6 @@ func (fd *FieldDescription) Descriptor() protoreflect.FieldDescriptor { return fd.desc } -// Documentation returns the documentation for the field. -func (fd *FieldDescription) Documentation() string { - if parentFile := fd.desc.ParentFile(); parentFile != nil { - return parentFile.SourceLocations().ByDescriptor(fd.desc).LeadingComments - } - return "" -} - // IsSet returns whether the field is set on the target value, per the proto presence conventions // of proto2 or proto3 accordingly. // @@ -355,20 +321,11 @@ func (fd *FieldDescription) MaybeUnwrapDynamic(msg protoreflect.Message) (any, b return unwrapDynamic(fd, msg) } -// Name returns the snake_case name of the field within the proto-based struct. +// Name returns the CamelCase name of the field within the proto-based struct. func (fd *FieldDescription) Name() string { return string(fd.desc.Name()) } -// JSONName returns the JSON name of the field, if present. -func (fd *FieldDescription) JSONName() string { - jsonName := fd.desc.JSONName() - if len(jsonName) != 0 { - return jsonName - } - return string(fd.desc.Name()) -} - // ProtoKind returns the protobuf reflected kind of the field. func (fd *FieldDescription) ProtoKind() protoreflect.Kind { return fd.desc.Kind() diff --git a/vendor/github.com/google/cel-go/common/types/provider.go b/vendor/github.com/google/cel-go/common/types/provider.go index 1bb2c11ed7..936a4e28b2 100644 --- a/vendor/github.com/google/cel-go/common/types/provider.go +++ b/vendor/github.com/google/cel-go/common/types/provider.go @@ -81,9 +81,6 @@ type FieldType struct { // GetFrom retrieves the field value on the input object, if set. GetFrom ref.FieldGetter - - // IsJSONField - IsJSONField bool } // Registry provides type information for a set of registered types. @@ -96,40 +93,11 @@ type Registry struct { // provider which can create new instances of the provided message or any // message that proto depends upon in its FileDescriptor. func NewRegistry(types ...proto.Message) (*Registry, error) { - return NewProtoRegistry(ProtoTypeDefs(types...)) -} - -// RegistryOption configures the behavior of the registry. -type RegistryOption func(r *Registry) (*Registry, error) - -// JSONFieldNames configures JSON field name support within the protobuf types in the registry. -func JSONFieldNames(enabled bool) RegistryOption { - return func(r *Registry) (*Registry, error) { - err := r.WithJSONFieldNames(enabled) - return r, err - } -} - -// ProtoTypeDefs creates a RegistryOption which registers the individual proto messages with the registry. -func ProtoTypeDefs(types ...proto.Message) RegistryOption { - return func(r *Registry) (*Registry, error) { - for _, msgType := range types { - err := r.RegisterMessage(msgType) - if err != nil { - return nil, err - } - } - return r, nil - } -} - -// NewProtoRegistry creates a proto-based registry with a set of configurable options. -func NewProtoRegistry(opts ...RegistryOption) (*Registry, error) { - r := &Registry{ + p := &Registry{ revTypeMap: make(map[string]*Type), pbdb: pb.NewDb(), } - err := r.RegisterType( + err := p.RegisterType( BoolType, BytesType, DoubleType, @@ -146,19 +114,19 @@ func NewProtoRegistry(opts ...RegistryOption) (*Registry, error) { return nil, err } // This block ensures that the well-known protobuf types are registered by default. - for _, fd := range r.pbdb.FileDescriptions() { - err = r.registerAllTypes(fd) + for _, fd := range p.pbdb.FileDescriptions() { + err = p.registerAllTypes(fd) if err != nil { return nil, err } } - for _, opt := range opts { - r, err = opt(r) + for _, msgType := range types { + err = p.RegisterMessage(msgType) if err != nil { return nil, err } } - return r, nil + return p, nil } // NewEmptyRegistry returns a registry which is completely unconfigured. @@ -181,28 +149,6 @@ func (p *Registry) Copy() *Registry { return copy } -// JSONFieldNames returns whether json field names are enabled in this registry. -func (p *Registry) JSONFieldNames() bool { - return p.pbdb.JSONFieldNames() -} - -// WithJSONFieldNames configures the registry with the JSON field name support enabled or disabled. -func (p *Registry) WithJSONFieldNames(enabled bool) error { - if enabled == p.pbdb.JSONFieldNames() { - return nil - } - newDB := pb.NewDb(pb.JSONFieldNames(enabled)) - files := p.pbdb.FileDescriptions() - for _, fd := range files { - _, err := newDB.RegisterDescriptor(fd.FileDescriptor()) - if err != nil { - return err - } - } - p.pbdb = newDB - return nil -} - // EnumValue returns the numeric value of the given enum value name. func (p *Registry) EnumValue(enumName string) ref.Val { enumVal, found := p.pbdb.DescribeEnum(enumName) @@ -226,11 +172,9 @@ func (p *Registry) FindFieldType(structType, fieldName string) (*ref.FieldType, return nil, false } return &ref.FieldType{ - Type: field.CheckedType(), - IsSet: field.IsSet, - GetFrom: field.GetFrom, - IsJSONField: p.pbdb.JSONFieldNames() && fieldName == field.JSONName(), - }, true + Type: field.CheckedType(), + IsSet: field.IsSet, + GetFrom: field.GetFrom}, true } // FindStructFieldNames returns the set of field names for the given struct type, @@ -262,25 +206,9 @@ func (p *Registry) FindStructFieldType(structType, fieldName string) (*FieldType return nil, false } return &FieldType{ - Type: fieldDescToCELType(field), - IsSet: field.IsSet, - GetFrom: field.GetFrom, - IsJSONField: p.pbdb.JSONFieldNames() && fieldName == field.JSONName(), - }, true -} - -// FindStructFieldDescription returns documentation for a field if available. -// Returns false if the field could not be found. -func (p *Registry) FindStructFieldDescription(structType, fieldName string) (string, bool) { - msgType, found := p.pbdb.DescribeType(structType) - if !found { - return "", false - } - field, found := msgType.FieldByName(fieldName) - if !found { - return "", false - } - return field.Documentation(), true + Type: fieldDescToCELType(field), + IsSet: field.IsSet, + GetFrom: field.GetFrom}, true } // FindIdent takes a qualified identifier name and returns a ref.Val if one exists. @@ -340,8 +268,9 @@ func (p *Registry) NewValue(structType string, fields map[string]ref.Val) ref.Va return NewErr("unknown type '%s'", structType) } msg := td.New() + fieldMap := td.FieldMap() for name, value := range fields { - field, found := td.FieldByName(name) + field, found := fieldMap[name] if !found { return NewErr("no such field: %s", name) } diff --git a/vendor/github.com/google/cel-go/common/types/ref/provider.go b/vendor/github.com/google/cel-go/common/types/ref/provider.go index ed5ab06625..b9820023d6 100644 --- a/vendor/github.com/google/cel-go/common/types/ref/provider.go +++ b/vendor/github.com/google/cel-go/common/types/ref/provider.go @@ -93,9 +93,6 @@ type FieldType struct { // GetFrom retrieves the field value on the input object, if set. GetFrom FieldGetter - - // IsJSONFIeld indicates that the field was accessed via its JSON name. - IsJSONField bool } // FieldTester is used to test field presence on an input object. diff --git a/vendor/github.com/google/cel-go/common/types/string.go b/vendor/github.com/google/cel-go/common/types/string.go index 1335903a7b..8aad4701cc 100644 --- a/vendor/github.com/google/cel-go/common/types/string.go +++ b/vendor/github.com/google/cel-go/common/types/string.go @@ -72,7 +72,7 @@ func (s String) ConvertToNative(typeDesc reflect.Type) (any, error) { case anyValueType: // Primitives must be wrapped before being set on an Any field. return anypb.New(wrapperspb.String(string(s))) - case JSONValueType: + case jsonValueType: // Convert to a protobuf representation of a JSON String. return structpb.NewStringValue(string(s)), nil case stringWrapperType: @@ -122,11 +122,7 @@ func (s String) ConvertToType(typeVal ref.Type) ref.Val { return durationOf(d) } case TimestampType: - str := s.Value().(string) - if !isStrictRFC3339(str) { - return NewErr("invalid RFC 3339 timestamp %q", str) - } - if t, err := time.Parse(time.RFC3339, str); err == nil { + if t, err := time.Parse(time.RFC3339, s.Value().(string)); err == nil { if t.Unix() < minUnixTime || t.Unix() > maxUnixTime { return celErrTimestampOverflow } diff --git a/vendor/github.com/google/cel-go/common/types/timestamp.go b/vendor/github.com/google/cel-go/common/types/timestamp.go index 62a020d970..f7be585916 100644 --- a/vendor/github.com/google/cel-go/common/types/timestamp.go +++ b/vendor/github.com/google/cel-go/common/types/timestamp.go @@ -17,11 +17,9 @@ package types import ( "fmt" "reflect" - "regexp" "strconv" "strings" "time" - "unicode" "github.com/google/cel-go/common/overloads" "github.com/google/cel-go/common/types/ref" @@ -54,79 +52,6 @@ const ( maxUnixTime int64 = 253402300799 ) -// strictRFC3339Pattern gates the strings accepted by the `timestamp()` overload. -// time.Parse accepts inputs that RFC 3339 forbids: a ',' fractional-second -// separator, single-digit time fields, and numeric offsets whose hours exceed -// 23 or minutes exceed 59. Those slip past unnoticed and shift the parsed -// instant, so they are rejected before time.Parse runs. Month and day are held -// to the grammar ranges 01-12 and 01-31; the remaining calendar validation -// (day-of-month vs. month, leap years) is left to time.Parse. -// -// isStrictRFC3339 is the implementation used on the conversion path; the pattern -// is retained as the reference the scan is conformance tested against. -var strictRFC3339Pattern = regexp.MustCompile( - `^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])[Tt]([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d+)?([Zz]|[+-]([01]\d|2[0-3]):[0-5]\d)$`) - -// isStrictRFC3339 reports whether s matches strictRFC3339Pattern, hand-rolled to -// keep the conversion path off the regexp engine and its per-call cost. -func isStrictRFC3339(s string) bool { - // Shortest accepted form is "2006-01-02T15:04:05Z" (20 bytes): a 19-byte - // fixed-width date-time followed by at least a 'Z'/'z' zone. - if len(s) < 20 { - return false - } - // full-date "T" partial-time - if !isYear(s[0:4]) || !isChar(s[4], '-') || !isMonth(s[5:7]) || !isChar(s[7], '-') || !isDay(s[8:10]) || - !isChar(s[10], 't') || - !isHour(s[11:13]) || !isChar(s[13], ':') || !isMinute(s[14:16]) || !isChar(s[16], ':') || !isSecond(s[17:19]) { - return false - } - rest := s[19:] - // optional fractional seconds: "." 1*DIGIT - if rest[0] == '.' { - rest = rest[1:] - n := 0 - for n < len(rest) && isDigit(rest[n]) { - n++ - } - if n == 0 { - return false - } - rest = rest[n:] - } - // time-offset: "Z" or ("+" / "-") time-hour ":" time-minute - if len(rest) == 1 { - return isChar(rest[0], 'z') - } - if len(rest) == 6 && (rest[0] == '+' || rest[0] == '-') { - return isHour(rest[1:3]) && isChar(rest[3], ':') && isMinute(rest[4:6]) - } - return false -} - -func isDigit(c byte) bool { return c >= '0' && c <= '9' } - -// isChar reports whether got is want, case-insensitively; want must be lower case. -func isChar(got, want byte) bool { - g, w := rune(got), rune(want) - return g == w || unicode.ToLower(g) == w -} - -// inRange reports whether s is all decimal digits and its value lies in [lo, hi]. -func inRange(s string, lo, hi uint64) bool { - u, err := strconv.ParseUint(s, 10, 64) - return err == nil && u >= lo && u <= hi -} - -func isYear(s string) bool { return inRange(s, 0, 9999) } -func isMonth(s string) bool { return inRange(s, 1, 12) } -func isDay(s string) bool { return inRange(s, 1, 31) } -func isHour(s string) bool { return inRange(s, 0, 23) } -func isMinute(s string) bool { return inRange(s, 0, 59) } - -// isSecond permits 60 for a leap second. -func isSecond(s string) bool { return inRange(s, 0, 60) } - // Add implements traits.Adder.Add. func (t Timestamp) Add(other ref.Val) ref.Val { switch other.Type() { @@ -166,7 +91,7 @@ func (t Timestamp) ConvertToNative(typeDesc reflect.Type) (any, error) { case anyValueType: // Pack the underlying time as a tpb.Timestamp into an Any value. return anypb.New(tpb.New(t.Time)) - case JSONValueType: + case jsonValueType: // CEL follows the proto3 to JSON conversion which formats as an RFC 3339 encoded JSON // string. v := t.ConvertToType(StringType) @@ -377,9 +302,6 @@ func timeZone(tz ref.Val, visitor timestampVisitor) timestampVisitor { if err != nil { return WrapErr(err) } - if min < 0 || min > 59 { - return WrapErr(fmt.Errorf("timezone offset minutes out of range [0, 59]: %s", val)) - } var offset int if string(val[0]) == "-" { offset = hr*60 - min diff --git a/vendor/github.com/google/cel-go/common/types/uint.go b/vendor/github.com/google/cel-go/common/types/uint.go index 91d5369daa..a93405a134 100644 --- a/vendor/github.com/google/cel-go/common/types/uint.go +++ b/vendor/github.com/google/cel-go/common/types/uint.go @@ -100,7 +100,7 @@ func (i Uint) ConvertToNative(typeDesc reflect.Type) (any, error) { case anyValueType: // Primitives must be wrapped before being set on an Any field. return anypb.New(wrapperspb.UInt64(uint64(i))) - case JSONValueType: + case jsonValueType: // JSON can accurately represent 32-bit uints as floating point values. if i.isJSONSafe() { return structpb.NewNumberValue(float64(i)), nil diff --git a/vendor/github.com/google/cel-go/common/types/unknown.go b/vendor/github.com/google/cel-go/common/types/unknown.go index f43aff18e0..9dd2b25794 100644 --- a/vendor/github.com/google/cel-go/common/types/unknown.go +++ b/vendor/github.com/google/cel-go/common/types/unknown.go @@ -16,7 +16,6 @@ package types import ( "fmt" - "maps" "math" "reflect" "sort" @@ -182,20 +181,6 @@ func (u *Unknown) GetAttributeTrails(id int64) ([]*AttributeTrail, bool) { return trails, found } -// HasUnknownFunction returns whether any of the attribute trails contained within the unknown -// are unspecified. Unspecified attributes typically indicate an unresolved function call -// or operation, rather than a missing variable. -func (u *Unknown) HasUnknownFunction() bool { - for _, trails := range u.attributeTrails { - for _, t := range trails { - if t.variable == "" { - return true - } - } - } - return false -} - // Contains returns true if the input unknown is a subset of the current unknown. func (u *Unknown) Contains(other *Unknown) bool { for id, otherTrails := range other.attributeTrails { @@ -298,7 +283,9 @@ func MergeUnknowns(unk1, unk2 *Unknown) *Unknown { out := &Unknown{ attributeTrails: make(map[int64][]*AttributeTrail, len(unk1.attributeTrails)+len(unk2.attributeTrails)), } - maps.Copy(out.attributeTrails, unk1.attributeTrails) + for id, ats := range unk1.attributeTrails { + out.attributeTrails[id] = ats + } for id, ats := range unk2.attributeTrails { existing, found := out.attributeTrails[id] if !found { diff --git a/vendor/github.com/google/cel-go/interpreter/BUILD.bazel b/vendor/github.com/google/cel-go/interpreter/BUILD.bazel index 40ac2ba696..220e23d475 100644 --- a/vendor/github.com/google/cel-go/interpreter/BUILD.bazel +++ b/vendor/github.com/google/cel-go/interpreter/BUILD.bazel @@ -9,13 +9,11 @@ go_library( name = "go_default_library", srcs = [ "activation.go", - "async.go", "attribute_patterns.go", "attributes.go", "decorators.go", "dispatcher.go", "evalstate.go", - "frame.go", "interpretable.go", "interpreter.go", "optimizations.go", @@ -47,10 +45,8 @@ go_test( name = "go_default_test", srcs = [ "activation_test.go", - "async_test.go", "attribute_patterns_test.go", "attributes_test.go", - "frame_test.go", "interpreter_test.go", "prune_test.go", "runtimecost_test.go", @@ -67,7 +63,6 @@ go_test( "//common/operators:go_default_library", "//common/stdlib:go_default_library", "//common/types:go_default_library", - "//common/types/ref:go_default_library", "//parser:go_default_library", "//test:go_default_library", "//test/proto2pb:go_default_library", diff --git a/vendor/github.com/google/cel-go/interpreter/activation.go b/vendor/github.com/google/cel-go/interpreter/activation.go index bc9296ed4e..dd40619ee1 100644 --- a/vendor/github.com/google/cel-go/interpreter/activation.go +++ b/vendor/github.com/google/cel-go/interpreter/activation.go @@ -110,9 +110,8 @@ func (a *mapActivation) ResolveName(name string) (any, bool) { // hierarchicalActivation which implements Activation and contains a parent and // child activation. type hierarchicalActivation struct { - parent Activation - child Activation - poolAllocated bool + parent Activation + child Activation } // Parent implements the Activation interface method. @@ -128,41 +127,10 @@ func (a *hierarchicalActivation) ResolveName(name string) (any, bool) { return a.parent.ResolveName(name) } -// Unwrap returns the parent activation, stripping the local child scope. -// This allows global disambiguation to skip past locally introduced variables. -func (a *hierarchicalActivation) Unwrap() Activation { - return a.parent -} - -// IsLocalVariable reports whether the variable name is locally bound in the hierarchical activation. -func (a *hierarchicalActivation) IsLocalVariable(name string) bool { - if holder, ok := a.child.(localVariableHolder); ok { - if holder.IsLocalVariable(name) { - return true - } - } - if holder, ok := a.parent.(localVariableHolder); ok { - return holder.IsLocalVariable(name) - } - return false -} - -// AsPartialActivation checks the child first via direct type assertion (to -// avoid recursion through the folder → frame → hierarchicalActivation cycle), -// then walks the parent hierarchy via the free function. -func (a *hierarchicalActivation) AsPartialActivation() (PartialActivation, bool) { - if pv, ok := a.child.(partialActivationConverter); ok { - if p, ok := pv.AsPartialActivation(); ok { - return p, true - } - } - return AsPartialActivation(a.parent) -} - // NewHierarchicalActivation takes two activations and produces a new one which prioritizes // resolution in the child first and parent(s) second. func NewHierarchicalActivation(parent Activation, child Activation) Activation { - return &hierarchicalActivation{parent: parent, child: child, poolAllocated: false} + return &hierarchicalActivation{parent, child} } // NewPartialActivation returns an Activation which contains a list of AttributePattern values diff --git a/vendor/github.com/google/cel-go/interpreter/async.go b/vendor/github.com/google/cel-go/interpreter/async.go deleted file mode 100644 index 4e391196bf..0000000000 --- a/vendor/github.com/google/cel-go/interpreter/async.go +++ /dev/null @@ -1,530 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package interpreter - -import ( - "context" - "encoding/binary" - "fmt" - "hash/fnv" - "math" - "sync" - "sync/atomic" - - "github.com/google/cel-go/common/functions" - "github.com/google/cel-go/common/types" - "github.com/google/cel-go/common/types/ref" -) - -// Async extension function support. -// -// CEL supports `types.Unknown` as a first-class value, and concurrent (async) function execution -// in CEL invokes a stub function which checks for the presence of an existing result which matches -// the function call and call arguments, or which records the 'unexecuted' function and call arguments -// for concurrent execution in a later phase if the result is `types.Unknown` and indicates the -// expression ids of the functions necessary to advance the execution. -// -// This call pattern is repeated iteratively until there are either no more functions to call or no -// progress is made toward resolving the unknowns. - -// AsyncObserver provides callbacks for monitoring the lifecycle of asynchronous function calls. -// -// Implementations must be safe for concurrent use: OnCallStarted is invoked from the evaluator -// goroutine when a call is launched, while OnCallFinished is invoked from the call's own goroutine -// when it completes. The two callbacks therefore run on different goroutines, and OnCallFinished -// callbacks for distinct calls may run concurrently with each other. -type AsyncObserver interface { - // OnCallStarted is called when an asynchronous function is first launched. - OnCallStarted(callID int64, function, overload string, args []ref.Val) - // OnCallFinished is called when an asynchronous function completes. - OnCallFinished(callID int64, function, overload string, res ref.Val) -} - -// AsyncCall describes a pending or completed asynchronous function call. -type AsyncCall interface { - // CallID returns the unique identifier for this async call invocation. - CallID() int64 - // Function returns the name of the function being called. - Function() string - // Overload returns the specific overload ID being invoked. - Overload() string -} - -// evalAsyncFunc is the planned Interpretable for an asynchronous function call. -type evalAsyncFunc struct { - id int64 - function string - overload string - args []InterpretableV2 - impl functions.AsyncOp -} - -// ID implements the Interpretable interface method. -func (fn *evalAsyncFunc) ID() int64 { - return fn.id -} - -// Function returns the name of the function being invoked. -func (fn *evalAsyncFunc) Function() string { - return fn.function -} - -// OverloadID returns the overload id of the function being invoked. -func (fn *evalAsyncFunc) OverloadID() string { - return fn.overload -} - -// Args returns the argument Interpretables for the function call. -func (fn *evalAsyncFunc) Args() []InterpretableV2 { - return fn.args -} - -// Eval implements the Interpretable interface method. -func (fn *evalAsyncFunc) Eval(vars Activation) ref.Val { - return fn.Exec(AsFrame(vars)) -} - -// Exec implements the InterpretableV2 interface method. -func (fn *evalAsyncFunc) Exec(frame *ExecutionFrame) ref.Val { - argVals := make([]ref.Val, len(fn.args)) - var unk *types.Unknown - for i, arg := range fn.args { - argVals[i] = arg.Exec(frame) - if types.IsError(argVals[i]) { - return argVals[i] - } - unk, _ = types.MaybeMergeUnknowns(argVals[i], unk) - } - if unk != nil { - return unk - } - result := frame.ComputeResult(fn.ID(), fn.Function(), fn.OverloadID(), fn.impl, argVals) - return types.LabelErrNode(fn.id, result) -} - -// asyncCallStateTracker manages async call states across re-evaluations of a single program. -type asyncCallStateTracker struct { - mu sync.RWMutex - // calls buckets call states by a composite hash of (node id, overload, string/int/double/uint/bool args). - // A single AST node id may host many concurrently-live calls when it is evaluated inside a - // comprehension (once per element with different arguments), so each bucket may hold more - // than one state. The exact match within a bucket is resolved via asyncCallState.matches, - // which applies CEL's full equality semantics to the arguments. - calls map[uint64][]*asyncCallState - callsByID map[int64]*asyncCallState - nextCallID atomic.Int64 -} - -func newAsyncCallStateTracker() *asyncCallStateTracker { - return &asyncCallStateTracker{ - calls: make(map[uint64][]*asyncCallState), - callsByID: make(map[int64]*asyncCallState), - } -} - -var ( - hashZeroMarker = []byte{0} - hashStringMarker = []byte{'s'} - hashBoolTrueMarker = []byte{'b', 1} - hashBoolFalseMarker = []byte{'b', 0} - hashNumberMarker = []byte{'n'} - hashDefaultMarker = []byte{'x'} -) - -// hashCall computes the composite bucket key for an async call. -// -// Only string, int, double, uint, and bool argument values contribute to the hash. More complex types -// rely on a richer notion of equivalence (e.g. unordered maps, proto equality, custom types) -// that a byte-level hash cannot capture safely, so they are intentionally excluded from the key -// and are instead disambiguated within the bucket by asyncCallState.matches. -func hashCall(id int64, overload string, args []ref.Val) uint64 { - h := fnv.New64a() - var idBuf [8]byte - binary.LittleEndian.PutUint64(idBuf[:], uint64(id)) - h.Write(idBuf[:]) - h.Write([]byte(overload)) - h.Write(hashZeroMarker) - for _, arg := range args { - switch v := arg.(type) { - case types.String: - h.Write(hashStringMarker) - h.Write([]byte(string(v))) - case types.Bool: - if bool(v) { - h.Write(hashBoolTrueMarker) - } else { - h.Write(hashBoolFalseMarker) - } - case types.Int: - h.Write(hashNumberMarker) - var buf [8]byte - binary.LittleEndian.PutUint64(buf[:], math.Float64bits(float64(v))) - h.Write(buf[:]) - case types.Uint: - h.Write(hashNumberMarker) - var buf [8]byte - binary.LittleEndian.PutUint64(buf[:], math.Float64bits(float64(v))) - h.Write(buf[:]) - case types.Double: - h.Write(hashNumberMarker) - if math.IsNaN(float64(v)) { - h.Write([]byte("NaN")) - h.Write(hashZeroMarker) - continue - } - // Normalize -0.0 to 0.0. Go will treat -0.0 as 0.0 at compile time, - // but the function math.Copysign(0.0, -1.0) can be used to test the -0.0 case. - if v == types.Double(0.0) && math.Signbit(float64(v)) { - v = types.Double(0.0) - } - var buf [8]byte - binary.LittleEndian.PutUint64(buf[:], math.Float64bits(float64(v))) - h.Write(buf[:]) - default: - // Value intentionally omitted; bucket membership falls back to matches. - h.Write(hashDefaultMarker) - } - // Separator to avoid cross-argument collisions, e.g. ("a", "bc") vs ("ab", "c"). - h.Write(hashZeroMarker) - } - return h.Sum64() -} - -// findInBucket returns the call state in the bucket matching the same node id and call identity, -// or nil if no match is present. -func findInBucket(bucket []*asyncCallState, id int64, function, overload string, args []ref.Val) *asyncCallState { - for _, acs := range bucket { - if acs.matches(id, function, overload, args) { - return acs - } - } - return nil -} - -// getOrCreate returns the existing call state for the (node id, args) tuple, or registers and -// returns a new one. A newly registered call is assigned a unique callID and counted as pending. -func (t *asyncCallStateTracker) getOrCreate(id int64, function, overload string, argVals []ref.Val, impl functions.AsyncOp, gate *asyncGate) *asyncCallState { - key := hashCall(id, overload, argVals) - - t.mu.RLock() - acs := findInBucket(t.calls[key], id, function, overload, argVals) - t.mu.RUnlock() - if acs != nil { - return acs - } - - t.mu.Lock() - defer t.mu.Unlock() - // Check again in case it was created while waiting for the lock. - if acs := findInBucket(t.calls[key], id, function, overload, argVals); acs != nil { - return acs - } - - // Assign a new unique call ID for this async call. - acs = newAsyncCallState(id, function, overload, argVals, impl) - callID := t.nextCallID.Add(1) - acs.callID = callID - acs.gate = gate - t.calls[key] = append(t.calls[key], acs) - t.callsByID[callID] = acs - return acs -} - -func (t *asyncCallStateTracker) getByID(callID int64) *asyncCallState { - t.mu.RLock() - defer t.mu.RUnlock() - return t.callsByID[callID] -} - -func newAsyncCallState(id int64, function, overload string, argVals []ref.Val, impl functions.AsyncOp) *asyncCallState { - return &asyncCallState{ - id: id, - function: function, - overload: overload, - argVals: argVals, - impl: impl, - } -} - -// asyncCallState tracks the result of a single async function call across multiple re-evaluations. -type asyncCallState struct { - id int64 // AST expression node ID where the call is defined. - callID int64 // Unique incremental tracking ID assigned to this call. - function string - overload string - argVals []ref.Val - impl functions.AsyncOp - - mu sync.RWMutex - started bool - result ref.Val - - gate *asyncGate -} - -// CallID returns the unique identifier for this async call invocation. -func (acs *asyncCallState) CallID() int64 { - return acs.callID -} - -// Function returns the name of the function being called. -func (acs *asyncCallState) Function() string { - return acs.function -} - -// Overload returns the specific overload ID being invoked. -func (acs *asyncCallState) Overload() string { - return acs.overload -} - -// ResultOrUnknown returns the cached result if the call has completed, an Unknown -// with the call ID if pending, or nil if the call has not been started. -func (acs *asyncCallState) ResultOrUnknown() ref.Val { - if acs == nil { - return nil - } - acs.mu.RLock() - defer acs.mu.RUnlock() - if acs.result == nil && acs.started { - return types.NewUnknown(acs.callID, nil) - } - return acs.result -} - -// SetResult sets the completed result for an asynchronous function call. -func (acs *asyncCallState) SetResult(res ref.Val) { - if acs == nil { - return - } - acs.mu.Lock() - defer acs.mu.Unlock() - acs.result = res -} - -// launch returns a call's cached result, or starts the call (subject to the launch limiter) and -// returns an Unknown referencing its callID while the result is pending. -// -// Admission control: when a concurrency semaphore is configured, a launch slot is reserved with a -// non-blocking send. If no slot is free the call is left unstarted and an Unknown is returned; the -// call is retried on a later re-evaluation pass once an in-flight call completes and frees a slot. -// The reservation is non-blocking on purpose — the evaluator runs on a single goroutine, and -// blocking it here while completing calls block on an undrained completion channel would deadlock. -// The slot is held by the launched goroutine and released when it exits, so the number of live -// async goroutines is bounded by the semaphore capacity. -func (t *asyncCallStateTracker) launch(ctx context.Context, acs *asyncCallState, observer AsyncObserver) ref.Val { - if res := acs.ResultOrUnknown(); res != nil { - return res - } - gate := acs.gate - if !gate.TryAcquire() { - return types.NewUnknown(acs.callID, nil) - } - acs.mu.Lock() - if acs.started || acs.result != nil { - // Defensive: the evaluator is single-threaded so this should not happen, but if it does, - // return the reserved slot rather than leak it. - acs.mu.Unlock() - gate.Release() - return types.NewUnknown(acs.callID, nil) - } - acs.started = true - acs.mu.Unlock() - - if observer != nil { - observer.OnCallStarted(acs.callID, acs.function, acs.overload, acs.argVals) - } - go func() { - defer func() { - if observer != nil { - observer.OnCallFinished(acs.callID, acs.function, acs.overload, acs.ResultOrUnknown()) - } - gate.Complete(ctx, acs.callID) - }() - - ch := acs.impl(ctx, acs.argVals...) - // Early terminate with a CEL error when an implementation returns an empty channel. - if ch == nil { - acs.SetResult(types.NewErrFromString( - fmt.Sprintf("function %s returned an empty channel", acs.function))) - return - } - // Wait for the async computation to finish or for the context to be cancelled. - select { - case r, ok := <-ch: - if !ok { - acs.SetResult(types.NewErrFromString( - fmt.Sprintf("function %s returned an empty channel", acs.function))) - return - } - acs.SetResult(r) - case <-ctx.Done(): - // Evaluation context cancelled before the async operation completed. - acs.SetResult(types.WrapErr(context.Cause(ctx))) - } - }() - return types.NewUnknown(acs.callID, nil) -} - -// matches reports whether two call states refer to the same function, overload, and arguments. -func (acs *asyncCallState) matches(id int64, function, overload string, args []ref.Val) bool { - if acs == nil { - return false - } - if acs.id != id || acs.function != function || acs.overload != overload { - return false - } - if len(acs.argVals) != len(args) { - return false - } - for i, v := range acs.argVals { - otherV := args[i] - if types.Equal(v, otherV) == types.True { - continue - } - if n, ok := v.(types.Double); ok { - // Treat NaN as equivalent for the sake of function dispatch equality. - if otherN, ok := otherV.(types.Double); ok && math.IsNaN(float64(n)) && math.IsNaN(float64(otherN)) { - continue - } - } - return false - } - return true -} - -// trackerShrinkThreshold is the entry count above which a released tracker's maps are reallocated -// rather than cleared in place, so the pool does not retain a large backing array indefinitely. -const trackerShrinkThreshold = 1024 - -// asyncCallStateTrackerPool provides a synchronized pool of asyncCallStateTrackers. -type asyncCallTrackerPool struct { - sync.Pool -} - -func (pool *asyncCallTrackerPool) create() *asyncCallStateTracker { - return pool.Get().(*asyncCallStateTracker) -} - -func (pool *asyncCallTrackerPool) release(tracker *asyncCallStateTracker) { - if tracker == nil { - return - } - tracker.mu.Lock() - // Clearing with delete reuses the backing arrays, which is ideal for the common case but pins - // a large allocation in the pool after a wide fan-out (e.g. an async call over a big list). - // Past a threshold, reallocate so the high-water-mark memory is released to the GC instead of - // being retained by the pooled tracker. - if len(tracker.calls) > trackerShrinkThreshold || len(tracker.callsByID) > trackerShrinkThreshold { - tracker.calls = make(map[uint64][]*asyncCallState) - tracker.callsByID = make(map[int64]*asyncCallState) - } else { - for k := range tracker.calls { - delete(tracker.calls, k) - } - for k := range tracker.callsByID { - delete(tracker.callsByID, k) - } - } - tracker.nextCallID.Store(0) - tracker.mu.Unlock() - pool.Pool.Put(tracker) -} - -func newAsyncCallTrackerPool() *asyncCallTrackerPool { - return &asyncCallTrackerPool{ - Pool: sync.Pool{ - New: func() any { - return newAsyncCallStateTracker() - }, - }, - } -} - -var asyncCallStateTrackerPool = newAsyncCallTrackerPool() - -// asyncGate coordinates async call admission control and completion signaling. -type asyncGate struct { - semaphore chan struct{} - completions chan<- int64 - activeCalls atomic.Int32 -} - -func newAsyncGate(maxConcurrency int, completions chan<- int64) *asyncGate { - var sem chan struct{} - if maxConcurrency > 0 { - sem = make(chan struct{}, maxConcurrency) - } - return &asyncGate{ - semaphore: sem, - completions: completions, - } -} - -// TryAcquire attempts to acquire a concurrency slot and increments the active calls count. -func (g *asyncGate) TryAcquire() bool { - if g == nil { - return true - } - if g.semaphore != nil { - select { - case g.semaphore <- struct{}{}: - default: - return false - } - } - g.activeCalls.Add(1) - return true -} - -// Release releases a concurrency slot and decrements the active calls count (used for defensive recovery). -func (g *asyncGate) Release() { - if g == nil { - return - } - if g.semaphore != nil { - select { - case <-g.semaphore: - default: - } - } - g.activeCalls.Add(-1) -} - -// Complete releases a concurrency slot and notifies completions. -func (g *asyncGate) Complete(ctx context.Context, callID int64) { - if g == nil { - return - } - g.Release() - - if g.completions != nil { - // Prioritize context cancellation to prevent racy completion signals. - if ctx.Err() != nil { - return - } - select { - case g.completions <- callID: - case <-ctx.Done(): - } - } -} - -// ActiveCalls returns the number of active asynchronous calls. -func (g *asyncGate) ActiveCalls() int { - if g == nil { - return 0 - } - return int(g.activeCalls.Load()) -} diff --git a/vendor/github.com/google/cel-go/interpreter/attribute_patterns.go b/vendor/github.com/google/cel-go/interpreter/attribute_patterns.go index bbaca52269..7d0759e378 100644 --- a/vendor/github.com/google/cel-go/interpreter/attribute_patterns.go +++ b/vendor/github.com/google/cel-go/interpreter/attribute_patterns.go @@ -16,7 +16,6 @@ package interpreter import ( "fmt" - "strings" "github.com/google/cel-go/common/containers" "github.com/google/cel-go/common/types" @@ -208,19 +207,10 @@ func (fac *partialAttributeFactory) AbsoluteAttribute(id int64, names ...string) // 'maybe' NamespacedAttribute values are produced using the partialAttributeFactory rather than // the base AttributeFactory implementation. func (fac *partialAttributeFactory) MaybeAttribute(id int64, name string) Attribute { - var names []string - // When there's a single name with a dot prefix, it indicates that the 'maybe' attribute is a - // globally namespaced identifier. - if strings.HasPrefix(name, ".") { - names = append(names, name) - } else { - // In all other cases, the candidate names should be inferred. - names = fac.container.ResolveCandidateNames(name) - } return &maybeAttribute{ id: id, attrs: []NamespacedAttribute{ - fac.AbsoluteAttribute(id, names...), + fac.AbsoluteAttribute(id, fac.container.ResolveCandidateNames(name)...), }, adapter: fac.adapter, provider: fac.provider, @@ -255,9 +245,6 @@ func (fac *partialAttributeFactory) matchesUnknownPatterns( patterns := vars.UnknownAttributePatterns() candidateIndices := map[int]struct{}{} for _, variable := range variableNames { - if holder, ok := vars.(localVariableHolder); ok && holder.IsLocalVariable(variable) { - continue - } for i, pat := range patterns { if pat.VariableMatches(variable) { if len(qualifiers) == 0 { diff --git a/vendor/github.com/google/cel-go/interpreter/attributes.go b/vendor/github.com/google/cel-go/interpreter/attributes.go index 26d8eb0f3e..b1b3aacc83 100644 --- a/vendor/github.com/google/cel-go/interpreter/attributes.go +++ b/vendor/github.com/google/cel-go/interpreter/attributes.go @@ -166,17 +166,9 @@ type attrFactory struct { // The namespaceNames represent the names the variable could have based on namespace // resolution rules. func (r *attrFactory) AbsoluteAttribute(id int64, names ...string) NamespacedAttribute { - disambiguateNames := false - for idx, name := range names { - if strings.HasPrefix(name, ".") { - disambiguateNames = true - names[idx] = strings.TrimPrefix(name, ".") - } - } return &absoluteAttribute{ id: id, namespaceNames: names, - disambiguateNames: disambiguateNames, qualifiers: []Qualifier{}, adapter: r.adapter, provider: r.provider, @@ -190,7 +182,7 @@ func (r *attrFactory) AbsoluteAttribute(id int64, names ...string) NamespacedAtt func (r *attrFactory) ConditionalAttribute(id int64, expr Interpretable, t, f Attribute) Attribute { return &conditionalAttribute{ id: id, - expr: adaptToV2(expr), + expr: expr, truthy: t, falsy: f, adapter: r.adapter, @@ -201,19 +193,10 @@ func (r *attrFactory) ConditionalAttribute(id int64, expr Interpretable, t, f At // MaybeAttribute collects variants of unchecked AbsoluteAttribute values which could either be // direct variable accesses or some combination of variable access with qualification. func (r *attrFactory) MaybeAttribute(id int64, name string) Attribute { - var names []string - // When there's a single name with a dot prefix, it indicates that the 'maybe' attribute is a - // globally namespaced identifier. - if strings.HasPrefix(name, ".") { - names = append(names, name) - } else { - // In all other cases, the candidate names should be inferred. - names = r.container.ResolveCandidateNames(name) - } return &maybeAttribute{ id: id, attrs: []NamespacedAttribute{ - r.AbsoluteAttribute(id, names...), + r.AbsoluteAttribute(id, r.container.ResolveCandidateNames(name)...), }, adapter: r.adapter, provider: r.provider, @@ -225,7 +208,7 @@ func (r *attrFactory) MaybeAttribute(id int64, name string) Attribute { func (r *attrFactory) RelativeAttribute(id int64, operand Interpretable) Attribute { return &relativeAttribute{ id: id, - operand: adaptToV2(operand), + operand: operand, qualifiers: []Qualifier{}, adapter: r.adapter, fac: r, @@ -259,13 +242,10 @@ type absoluteAttribute struct { // namespaceNames represent the names the variable could have based on declared container // (package) of the expression. namespaceNames []string - // disambiguateNames indicates whether the namespaceNames require disambiguation with local variables. - disambiguateNames bool - - qualifiers []Qualifier - adapter types.Adapter - provider types.Provider - fac AttributeFactory + qualifiers []Qualifier + adapter types.Adapter + provider types.Provider + fac AttributeFactory errorOnBadPresenceTest bool } @@ -324,34 +304,15 @@ func (a *absoluteAttribute) String() string { // a type, then the result is `nil`, `error` with the error indicating the name of the first // variable searched as missing. func (a *absoluteAttribute) Resolve(vars Activation) (any, error) { - // unwrap any local activations to ensure that we reach the variables provided as input - // to the expression in the event that we need to disambiguate between global and local - // variables. - // - // Presently, only dynamic and constant slot activations created during comprehensions - // support 'unwrapping', which is consistent with how local variables are introduced into CEL. - var inputVars Activation - if a.disambiguateNames { - inputVars = vars - wrapped, ok := inputVars.(activationWrapper) - for ok { - inputVars = wrapped.Unwrap() - wrapped, ok = inputVars.(activationWrapper) - } - } for _, nm := range a.namespaceNames { // If the variable is found, process it. Otherwise, wait until the checks to // determine whether the type is unknown before returning. - v := vars - if a.disambiguateNames { - v = inputVars - } - obj, found := v.ResolveName(nm) + obj, found := vars.ResolveName(nm) if found { if celErr, ok := obj.(*types.Err); ok { - return nil, celErr + return nil, celErr.Unwrap() } - obj, isOpt, err := applyQualifiers(v, obj, a.qualifiers) + obj, isOpt, err := applyQualifiers(vars, obj, a.qualifiers) if err != nil { return nil, err } @@ -384,7 +345,7 @@ func (a *absoluteAttribute) Resolve(vars Activation) (any, error) { type conditionalAttribute struct { id int64 - expr InterpretableV2 + expr Interpretable truthy Attribute falsy Attribute adapter types.Adapter @@ -571,7 +532,7 @@ func (a *maybeAttribute) String() string { type relativeAttribute struct { id int64 - operand InterpretableV2 + operand Interpretable qualifiers []Qualifier adapter types.Adapter fac AttributeFactory @@ -964,11 +925,9 @@ func (q *intQualifier) qualifyInternal(vars Activation, obj any, presenceTest, p } case map[int32]any: isMap = true - if i32 := int32(i); int64(i32) == i { - obj, isKey := o[i32] - if isKey { - return obj, true, nil - } + obj, isKey := o[int32(i)] + if isKey { + return obj, true, nil } case map[int64]any: isMap = true @@ -1091,11 +1050,9 @@ func (q *uintQualifier) qualifyInternal(vars Activation, obj any, presenceTest, return obj, true, nil } case map[uint32]any: - if u32 := uint32(u); uint64(u32) == u { - obj, isKey := o[u32] - if isKey { - return obj, true, nil - } + obj, isKey := o[uint32(u)] + if isKey { + return obj, true, nil } case map[uint64]any: obj, isKey := o[u] @@ -1305,7 +1262,7 @@ func applyQualifiers(vars Activation, obj any, qualifiers []Qualifier) (any, boo if !optObj.HasValue() { return optObj, false, nil } - obj = optObj.GetValue() + obj = optObj.GetValue().Value() } var err error diff --git a/vendor/github.com/google/cel-go/interpreter/decorators.go b/vendor/github.com/google/cel-go/interpreter/decorators.go index 9c973664ac..502db35fc0 100644 --- a/vendor/github.com/google/cel-go/interpreter/decorators.go +++ b/vendor/github.com/google/cel-go/interpreter/decorators.go @@ -25,13 +25,9 @@ import ( // Interpretable expression nodes at construction time. type InterpretableDecorator func(Interpretable) (Interpretable, error) -// InterpretableDecoratorV2 is a functional interface for decorating or replacing -// InterpretableV2 expression nodes at construction time. -type InterpretableDecoratorV2 func(InterpretableV2) (InterpretableV2, error) - // decObserveEval records evaluation state into an EvalState object. -func decObserveEval(observer EvalObserver) InterpretableDecoratorV2 { - return func(i InterpretableV2) (InterpretableV2, error) { +func decObserveEval(observer EvalObserver) InterpretableDecorator { + return func(i Interpretable) (Interpretable, error) { switch inst := i.(type) { case *evalWatch, *evalWatchAttr, *evalWatchConst, *evalWatchConstructor: // these instruction are already watching, return straight-away. @@ -53,8 +49,8 @@ func decObserveEval(observer EvalObserver) InterpretableDecoratorV2 { }, nil default: return &evalWatch{ - InterpretableV2: i, - observer: observer, + Interpretable: i, + observer: observer, }, nil } } @@ -62,8 +58,8 @@ func decObserveEval(observer EvalObserver) InterpretableDecoratorV2 { // decInterruptFolds creates an intepretable decorator which marks comprehensions as interruptable // where the interrupt state is communicated via a hidden variable on the Activation. -func decInterruptFolds() InterpretableDecoratorV2 { - return func(i InterpretableV2) (InterpretableV2, error) { +func decInterruptFolds() InterpretableDecorator { + return func(i Interpretable) (Interpretable, error) { fold, ok := i.(*evalFold) if !ok { return i, nil @@ -74,8 +70,8 @@ func decInterruptFolds() InterpretableDecoratorV2 { } // decDisableShortcircuits ensures that all branches of an expression will be evaluated, no short-circuiting. -func decDisableShortcircuits() InterpretableDecoratorV2 { - return func(i InterpretableV2) (InterpretableV2, error) { +func decDisableShortcircuits() InterpretableDecorator { + return func(i Interpretable) (Interpretable, error) { switch expr := i.(type) { case *evalOr: return &evalExhaustiveOr{ @@ -108,8 +104,8 @@ func decDisableShortcircuits() InterpretableDecoratorV2 { // conditionally precomputing the result. // - build list and map values with constant elements. // - convert 'in' operations to set membership tests if possible. -func decOptimize() InterpretableDecoratorV2 { - return func(i InterpretableV2) (InterpretableV2, error) { +func decOptimize() InterpretableDecorator { + return func(i Interpretable) (Interpretable, error) { switch inst := i.(type) { case *evalList: return maybeBuildListLiteral(i, inst) @@ -128,7 +124,7 @@ func decOptimize() InterpretableDecoratorV2 { } // decRegexOptimizer compiles regex pattern string constants. -func decRegexOptimizer(regexOptimizations ...*RegexOptimization) InterpretableDecoratorV2 { +func decRegexOptimizer(regexOptimizations ...*RegexOptimization) InterpretableDecorator { functionMatchMap := make(map[string]*RegexOptimization) overloadMatchMap := make(map[string]*RegexOptimization) for _, m := range regexOptimizations { @@ -138,7 +134,7 @@ func decRegexOptimizer(regexOptimizations ...*RegexOptimization) InterpretableDe } } - return func(i InterpretableV2) (InterpretableV2, error) { + return func(i Interpretable) (Interpretable, error) { call, ok := i.(InterpretableCall) if !ok { return i, nil @@ -169,7 +165,7 @@ func decRegexOptimizer(regexOptimizations ...*RegexOptimization) InterpretableDe } } -func maybeOptimizeConstUnary(i InterpretableV2, call InterpretableCall) (InterpretableV2, error) { +func maybeOptimizeConstUnary(i Interpretable, call InterpretableCall) (Interpretable, error) { args := call.Args() if len(args) != 1 { return i, nil @@ -185,7 +181,7 @@ func maybeOptimizeConstUnary(i InterpretableV2, call InterpretableCall) (Interpr return NewConstValue(call.ID(), val), nil } -func maybeBuildListLiteral(i InterpretableV2, l *evalList) (InterpretableV2, error) { +func maybeBuildListLiteral(i Interpretable, l *evalList) (Interpretable, error) { for _, elem := range l.elems { _, isConst := elem.(InterpretableConst) if !isConst { @@ -195,7 +191,7 @@ func maybeBuildListLiteral(i InterpretableV2, l *evalList) (InterpretableV2, err return NewConstValue(l.ID(), l.Eval(EmptyActivation())), nil } -func maybeBuildMapLiteral(i InterpretableV2, mp *evalMap) (InterpretableV2, error) { +func maybeBuildMapLiteral(i Interpretable, mp *evalMap) (Interpretable, error) { for idx, key := range mp.keys { _, isConst := key.(InterpretableConst) if !isConst { @@ -213,7 +209,7 @@ func maybeBuildMapLiteral(i InterpretableV2, mp *evalMap) (InterpretableV2, erro // test if the following conditions are true: // - the list is a constant with homogeneous element types. // - the elements are all of primitive type. -func maybeOptimizeSetMembership(i InterpretableV2, inlist InterpretableCall) (InterpretableV2, error) { +func maybeOptimizeSetMembership(i Interpretable, inlist InterpretableCall) (Interpretable, error) { args := inlist.Args() lhs := args[0] rhs := args[1] diff --git a/vendor/github.com/google/cel-go/interpreter/frame.go b/vendor/github.com/google/cel-go/interpreter/frame.go deleted file mode 100644 index 20ab313c8f..0000000000 --- a/vendor/github.com/google/cel-go/interpreter/frame.go +++ /dev/null @@ -1,445 +0,0 @@ -// Copyright 2026 Google LLC -// -// 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. - -package interpreter - -import ( - "context" - "errors" - "fmt" - "sync" - "sync/atomic" - - "github.com/google/cel-go/common/functions" - "github.com/google/cel-go/common/types" - "github.com/google/cel-go/common/types/ref" -) - -// evalContext contains the stateful information needed for a single evaluation. -// -// This state is shared across all frames within a single evaluation, including -// child frames created for comprehension blocks. -type evalContext struct { - // interrupt exposes a callback channel for cancellation. - interrupt <-chan struct{} - - // interruptCheckCount is the number of times the interrupt channel has been checked. - interruptCheckCount atomic.Uint64 - - // interruptCheckFrequency is the frequency at which the interrupt channel is checked. - interruptCheckFrequency uint - - // interrupted indicates whether the evaluation has been interrupted. - interrupted atomic.Bool - - // state provides the context for tracking the evaluation state. - state EvalState - - // costs provides the context for tracking the evaluation costs. - costs *CostTracker - - // ctx is the context for async call implementations to use. - ctx context.Context - - // cancel cancels the context when the evaluation is finished. - cancel context.CancelFunc - - // asyncCalls tracks the state of async call invocations across re-evaluations. - asyncCalls *asyncCallStateTracker - - // gate coordinates async call admission control and completion signaling. - gate *asyncGate - - // observer for monitoring async calls. - observer AsyncObserver -} - -// ExecutionFrame provides the context for a single evaluation of an expression. -// -// The execution frame must not be stored in any fashion as its lifecycle is completely -// controlled by the CEL evaluation process. -type ExecutionFrame struct { - // Activation provides the context for resolving variables by name. - Activation - - // parent provides the context for parent scopes (used for comprehension iterators). - parent *ExecutionFrame - - // ctx provides the shared evaluation state across frames. - ctx *evalContext -} - -// NewExecutionFrame creates a new execution frame from the pool. -func NewExecutionFrame(input any) (*ExecutionFrame, error) { - f := frameStack.Get().(*ExecutionFrame) - switch v := input.(type) { - case Activation: - f.Activation = v - case map[string]any: - f.Activation = activationInput.create(v) - default: - return nil, fmt.Errorf("invalid input, wanted Activation or map[string]any, got: (%T)%v", input, input) - } - return f, nil -} - -// SetContext sets the context for the execution frame. -func (f *ExecutionFrame) SetContext(ctx context.Context, interruptCheckFrequency uint) error { - if f.parent != nil { - return errors.New("SetContext() called on child frame") - } - if f.ctx != nil { - return errors.New("SetContext() called more than once") - } - f.ctx = evalContextPool.Get().(*evalContext) - f.ctx.ctx, f.ctx.cancel = context.WithCancel(ctx) - f.ctx.asyncCalls = asyncCallStateTrackerPool.create() - f.ctx.gate = &asyncGate{} - f.ctx.interrupt = ctx.Done() - f.ctx.interruptCheckFrequency = interruptCheckFrequency - f.ctx.interruptCheckCount.Store(0) - f.ctx.interrupted.Store(false) - return nil -} - -// Close releases the resources held by the execution frame and returns it to the pool. -func (f *ExecutionFrame) Close() { - if f.parent == nil && f.ctx != nil { - if f.ctx.cancel != nil { - f.ctx.cancel() - f.ctx.cancel = nil - } - f.ctx.ctx = nil - f.ctx.gate = nil - asyncCallStateTrackerPool.release(f.ctx.asyncCalls) - f.ctx.asyncCalls = nil - f.ctx.observer = nil - f.ctx.interrupt = nil - f.ctx.state = nil - f.ctx.costs = nil - f.ctx.interrupted.Store(false) - f.ctx.interruptCheckCount.Store(0) - f.ctx.interruptCheckFrequency = 0 - evalContextPool.Put(f.ctx) - } - f.ctx = nil - f.parent = nil - if f.Activation != nil { - switch a := f.Activation.(type) { - case *hierarchicalActivation: - if child, ok := a.child.(*inputActivation); ok { - activationInput.release(child) - } - activationStack.release(a) - case *inputActivation: - activationInput.release(a) - } - f.Activation = nil - frameStack.Put(f) - } -} - -// Push pushes the given activation onto the activation stack and returns the new frame. -// -// This operation is internal to the interpreter and is used to handle comprehension -// scoping. The child frame inherits the shared evalContext from the parent. -func (f *ExecutionFrame) Push(activation Activation) *ExecutionFrame { - child := frameStack.Get().(*ExecutionFrame) - child.parent = f - child.ctx = f.ctx - child.Activation = activationStack.create(f.Activation, activation) - return child -} - -// Pop returns the parent frame, releasing the current frame back to the pool. -func (f *ExecutionFrame) Pop() *ExecutionFrame { - if f.parent == nil { - return f - } - parent := f.parent - activationStack.release(f.Activation) - f.Activation = nil - f.parent = nil - f.ctx = nil - frameStack.Put(f) - return parent -} - -// ResolveName implements the Activation interface by proxying to the internal activation. -func (f *ExecutionFrame) ResolveName(name string) (any, bool) { - return f.Activation.ResolveName(name) -} - -// Parent implements the Activation interface by proxying to the internal activation. -func (f *ExecutionFrame) Parent() Activation { - return f.Activation.Parent() -} - -// AsPartialActivation implements the PartialActivation interface by proxying to the internal activation. -func (f *ExecutionFrame) AsPartialActivation() (PartialActivation, bool) { - return AsPartialActivation(f.Activation) -} - -// Unwrap returns the internal activation. -func (f *ExecutionFrame) Unwrap() Activation { - return f.Activation -} - -// IsLocalVariable reports whether the variable name is locally bound in the frame. -func (f *ExecutionFrame) IsLocalVariable(name string) bool { - if holder, ok := f.Activation.(localVariableHolder); ok { - if holder.IsLocalVariable(name) { - return true - } - } - // Search parent scopes - if f.parent != nil { - return f.parent.IsLocalVariable(name) - } - return false -} - -// CheckInterrupt returns whether the evaluation has been interrupted. -func (f *ExecutionFrame) CheckInterrupt() bool { - if f.ctx == nil { - return false - } - if f.ctx.interrupted.Load() { - return true - } - count := f.ctx.interruptCheckCount.Add(1) - if f.ctx.interruptCheckFrequency > 0 && count%uint64(f.ctx.interruptCheckFrequency) == 0 { - select { - case <-f.ctx.interrupt: - f.ctx.interrupted.Store(true) - return true - default: - return false - } - } - return false -} - -// ComputeResult tracks and computes the result of the given asynchronous function. -// -// The first invocation for a given (node id, args) tuple registers the call state and returns an -// Unknown which references the call's unique callID. Subsequent invocations return the cached -// result once the call has completed. Launching background execution is deferred to post-execution -// dispatch via DispatchPendingAsyncCalls. -func (f *ExecutionFrame) ComputeResult(id int64, function, overload string, impl functions.AsyncOp, argVals []ref.Val) ref.Val { - if f.ctx == nil || f.ctx.asyncCalls == nil { - return types.NewErrWithNodeID(id, "asynchronous function calls require concurrent evaluation and cannot be resolved by a synchronous Eval") - } - t := f.ctx.asyncCalls - acs := t.getOrCreate(id, function, overload, argVals, impl, f.ctx.gate) - if res := acs.ResultOrUnknown(); res != nil { - return res - } - return types.NewUnknown(acs.callID, nil) -} - -// DispatchPendingAsyncCalls launches pending asynchronous calls for the specified required call IDs. -func (f *ExecutionFrame) DispatchPendingAsyncCalls(callIDs []int64) { - if f.ctx == nil || f.ctx.asyncCalls == nil { - return - } - t := f.ctx.asyncCalls - for _, callID := range callIDs { - if acs := t.getByID(callID); acs != nil { - t.launch(f.ctx.ctx, acs, f.ctx.observer) - } - } -} - -// ActiveAsyncCalls returns the number of async function calls that have been launched -// but whose completions have not yet been drained. -func (f *ExecutionFrame) ActiveAsyncCalls() int { - if f.ctx == nil || f.ctx.gate == nil { - return 0 - } - return f.ctx.gate.ActiveCalls() -} - -// AsyncCall returns the state of an async call by its callID, or nil if not found. -func (f *ExecutionFrame) AsyncCall(callID int64) AsyncCall { - if f.ctx == nil || f.ctx.asyncCalls == nil { - return nil - } - acs := f.ctx.asyncCalls.getByID(callID) - if acs == nil { - return nil - } - return acs -} - -// SetCompletions configures a channel to receive callIDs when asynchronous evaluations finish. -func (f *ExecutionFrame) SetCompletions(ch chan<- int64) error { - if f.ctx == nil { - return errors.New("asynchronous evaluation options require the execution frame to have a context configured") - } - f.ctx.gate.completions = ch - return nil -} - -// SetAsyncObserver sets the observer for monitoring asynchronous function calls. -func (f *ExecutionFrame) SetAsyncObserver(observer AsyncObserver) error { - if f.ctx == nil { - return errors.New("asynchronous evaluation options require the execution frame to have a context configured") - } - f.ctx.observer = observer - return nil -} - -// SetAsyncMaxConcurrency sets the maximum concurrency for asynchronous function calls. -// -// A non-positive value indicates that concurrency is unbounded. -func (f *ExecutionFrame) SetAsyncMaxConcurrency(n int) error { - if f.ctx == nil { - return errors.New("asynchronous evaluation options require the execution frame to have a context configured") - } - if n > 0 { - f.ctx.gate.semaphore = make(chan struct{}, n) - } else { - f.ctx.gate.semaphore = nil - } - return nil -} - -// frameStack provides a synchronized pool of ExecutionFrames. -var frameStack = &sync.Pool{ - New: func() any { - return &ExecutionFrame{} - }, -} - -// evalContextPool provides a synchronized pool of evalContexts. -var evalContextPool = &sync.Pool{ - New: func() any { - return &evalContext{} - }, -} - -type activationStackPool struct { - sync.Pool -} - -func (pool *activationStackPool) create(parent, child Activation) Activation { - h := pool.Get().(*hierarchicalActivation) - h.child = child - h.parent = parent - h.poolAllocated = true - return h -} - -func (pool *activationStackPool) release(activation Activation) { - h, ok := activation.(*hierarchicalActivation) - if !ok || !h.poolAllocated { - return - } - h.parent = nil - h.child = nil - pool.Pool.Put(h) -} - -func newActivationStackPool() *activationStackPool { - return &activationStackPool{ - Pool: sync.Pool{ - New: func() any { - return &hierarchicalActivation{} - }, - }, - } -} - -type inputActivation struct { - vars map[string]any - lazyVars map[string]any -} - -// ResolveName looks up the value of the input variable name, if found. -// -// Lazy bindings may be supplied within the map-based input in either of the following forms: -// - func() any -// - func() ref.Val -// -// The lazy binding will only be invoked once per evaluation. -// -// Values which are not represented as ref.Val types on input may be adapted to a ref.Val using -// the types.Adapter configured in the environment. -func (a *inputActivation) ResolveName(name string) (any, bool) { - v, found := a.vars[name] - if !found { - return nil, false - } - switch obj := v.(type) { - case func() ref.Val: - if resolved, found := a.lazyVars[name]; found { - return resolved, true - } - lazy := obj() - a.lazyVars[name] = lazy - return lazy, true - case func() any: - if resolved, found := a.lazyVars[name]; found { - return resolved, true - } - lazy := obj() - a.lazyVars[name] = lazy - return lazy, true - default: - return obj, true - } -} - -// Parent implements the Activation interface -func (a *inputActivation) Parent() Activation { - return nil -} - -func newActivationInputPool() *activationInputPool { - return &activationInputPool{ - Pool: sync.Pool{ - New: func() any { - return &inputActivation{ - lazyVars: make(map[string]any), - } - }, - }, - } -} - -type activationInputPool struct { - sync.Pool -} - -// create initializes a pooled Activation object with the map input. -func (p *activationInputPool) create(vars map[string]any) *inputActivation { - a := p.Pool.Get().(*inputActivation) - a.vars = vars - return a -} - -func (p *activationInputPool) release(value any) { - a := value.(*inputActivation) - for k := range a.lazyVars { - delete(a.lazyVars, k) - } - a.vars = nil - p.Pool.Put(a) -} - -var ( - activationStack = newActivationStackPool() - activationInput = newActivationInputPool() -) diff --git a/vendor/github.com/google/cel-go/interpreter/interpretable.go b/vendor/github.com/google/cel-go/interpreter/interpretable.go index 906c4f805f..96b5a8ffc0 100644 --- a/vendor/github.com/google/cel-go/interpreter/interpretable.go +++ b/vendor/github.com/google/cel-go/interpreter/interpretable.go @@ -26,53 +26,20 @@ import ( "github.com/google/cel-go/common/types/traits" ) -// Interpretable evaluates an Activation and produces a value. +// Interpretable can accept a given Activation and produce a value along with +// an accompanying EvalState which can be used to inspect whether additional +// data might be necessary to complete the evaluation. type Interpretable interface { // ID value corresponding to the expression node. ID() int64 - // Eval evaluates an Activation and produces an output. + // Eval an Activation to produce an output. Eval(activation Activation) ref.Val } -// InterpretableV2 evaluates an ExecutionFrame and produces a value. -// -// The ExecutionFrame should not be stored and should always be passed as the first -// argument to any function as it behaves like Golang's context.Context. -type InterpretableV2 interface { - Interpretable - - // Exec evaluates the expression within the given ExecutionFrame. - Exec(frame *ExecutionFrame) ref.Val -} - -// adaptToV2 adapts a V1 Interpretable implementation to the V2 interface. -// -// This adapter is used to bridge the legacy Interpretable interface to the -// modern InterpretableV2 interface, providing a shim that allows the use of -// both interfaces in the same system. -func adaptToV2(i Interpretable) InterpretableV2 { - switch v := i.(type) { - case InterpretableV2: - return v - default: - return &v1Adapter{Interpretable: v} - } -} - -// v1Adapter handles bridging a V1 Interpretable implementation to the V2 interface. -type v1Adapter struct { - Interpretable -} - -// Exec implements the InterpretableV2 interface method. -func (a *v1Adapter) Exec(f *ExecutionFrame) ref.Val { - return a.Eval(f) -} - // InterpretableConst interface for tracking whether the Interpretable is a constant value. type InterpretableConst interface { - InterpretableV2 + Interpretable // Value returns the constant value of the instruction. Value() ref.Val @@ -80,7 +47,7 @@ type InterpretableConst interface { // InterpretableAttribute interface for tracking whether the Interpretable is an attribute. type InterpretableAttribute interface { - InterpretableV2 + Interpretable // Attr returns the Attribute value. Attr() Attribute @@ -114,7 +81,7 @@ type InterpretableAttribute interface { // InterpretableCall interface for inspecting Interpretable instructions related to function calls. type InterpretableCall interface { - InterpretableV2 + Interpretable // Function returns the function name as it appears in text or mangled operator name as it // appears in the operators.go file. @@ -127,16 +94,16 @@ type InterpretableCall interface { // Args returns the normalized arguments to the function overload. // For receiver-style functions, the receiver target is arg 0. - Args() []InterpretableV2 + Args() []Interpretable } // InterpretableConstructor interface for inspecting Interpretable instructions that initialize a list, map // or struct. type InterpretableConstructor interface { - InterpretableV2 + Interpretable // InitVals returns all the list elements, map key and values or struct field values. - InitVals() []InterpretableV2 + InitVals() []Interpretable // Type returns the type constructed. Type() ref.Type @@ -145,23 +112,18 @@ type InterpretableConstructor interface { // ObservableInterpretable is an Interpretable which supports stateful observation, such as tracing // or cost-tracking. type ObservableInterpretable struct { - InterpretableV2 + Interpretable observers []StatefulObserver } // ID implements the Interpretable method to get the expression id associated with the step. func (oi *ObservableInterpretable) ID() int64 { - return oi.InterpretableV2.ID() -} - -// Exec implements the InterpretableV2 interface method. -func (oi *ObservableInterpretable) Exec(frame *ExecutionFrame) ref.Val { - return oi.ObserveExec(frame, func(any) {}) + return oi.Interpretable.ID() } // Eval proxies to the ObserveEval method while invoking a no-op callback to report the observations. func (oi *ObservableInterpretable) Eval(vars Activation) ref.Val { - return oi.ObserveExec(AsFrame(vars), func(any) {}) + return oi.ObserveEval(vars, func(any) {}) } // ObserveEval evaluates an interpretable and performs per-evaluation state-tracking. @@ -169,65 +131,25 @@ func (oi *ObservableInterpretable) Eval(vars Activation) ref.Val { // This method is concurrency safe and the expectation is that the observer function will use // a switch statement to determine the type of the state which has been reported back from the call. func (oi *ObservableInterpretable) ObserveEval(vars Activation, observer func(any)) ref.Val { - return oi.ObserveExec(AsFrame(vars), observer) -} - -// ObserveExec evaluates an interpretable and performs per-evaluation state-tracking. -// -// This method is concurrency safe and the expectation is that the observer function will use -// a switch statement to determine the type of the state which has been reported back from the call. -func (oi *ObservableInterpretable) ObserveExec(frame *ExecutionFrame, observer func(any)) ref.Val { + var err error // Initialize the state needed for the observers to function. for _, obs := range oi.observers { - state, err := obs.InitState(frame) + vars, err = obs.InitState(vars) if err != nil { return types.WrapErr(err) } // Provide an initial reference to the state to ensure state is available // even in cases of interrupting errors generated during evaluation. - observer(state) + observer(obs.GetState(vars)) } - result := oi.InterpretableV2.Exec(frame) + result := oi.Interpretable.Eval(vars) // Get the state which needs to be reported back as having been observed. for _, obs := range oi.observers { - observer(obs.GetState(frame)) + observer(obs.GetState(vars)) } return result } -// AsFrame promotes an Activation to an ExecutionFrame. -func AsFrame(a Activation) *ExecutionFrame { - if f, ok := a.(*ExecutionFrame); ok { - return f - } - frame := &ExecutionFrame{Activation: a} - // Walk the activation hierarchy to find a parent ExecutionFrame and inherit - // its shared context. - if parent := findFrame(a); parent != nil { - frame.ctx = parent.ctx - } - return frame -} - -// findFrame walks the activation hierarchy via Unwrap and Parent to locate an -// existing ExecutionFrame, if one exists. -func findFrame(a Activation) *ExecutionFrame { - if wrapper, ok := a.(activationWrapper); ok { - unwrapped := wrapper.Unwrap() - if f, ok := unwrapped.(*ExecutionFrame); ok { - return f - } - return findFrame(unwrapped) - } - if p := a.Parent(); p != nil { - if f, ok := p.(*ExecutionFrame); ok { - return f - } - return findFrame(p) - } - return nil -} - // Core Interpretable implementations used during the program planning phase. type evalTestOnly struct { @@ -240,9 +162,9 @@ func (test *evalTestOnly) ID() int64 { return test.id } -// Exec implements the InterpretableV2 interface method. -func (test *evalTestOnly) Exec(frame *ExecutionFrame) ref.Val { - val, err := test.Resolve(frame) +// Eval implements the Interpretable interface method. +func (test *evalTestOnly) Eval(ctx Activation) ref.Val { + val, err := test.Resolve(ctx) // Return an error if the resolve step fails if err != nil { return types.LabelErrNode(test.id, types.WrapErr(err)) @@ -253,11 +175,6 @@ func (test *evalTestOnly) Exec(frame *ExecutionFrame) ref.Val { return test.Adapter().NativeToValue(val) } -// Eval implements the Interpretable interface method. -func (test *evalTestOnly) Eval(ctx Activation) ref.Val { - return test.Exec(AsFrame(ctx)) -} - // AddQualifier appends a qualifier that will always and only perform a presence test. func (test *evalTestOnly) AddQualifier(q Qualifier) (Attribute, error) { cq, ok := q.(ConstantQualifier) @@ -277,7 +194,7 @@ func (q *testOnlyQualifier) Qualify(vars Activation, obj any) (any, error) { if err != nil { return nil, err } - if unk, isUnk := out.(*types.Unknown); isUnk { + if unk, isUnk := out.(types.Unknown); isUnk { return unk, nil } return present, nil @@ -313,11 +230,6 @@ func (cons *evalConst) ID() int64 { return cons.id } -// Exec implements the InterpretableV2 interface method. -func (cons *evalConst) Exec(frame *ExecutionFrame) ref.Val { - return cons.val -} - // Eval implements the Interpretable interface method. func (cons *evalConst) Eval(ctx Activation) ref.Val { return cons.val @@ -330,7 +242,7 @@ func (cons *evalConst) Value() ref.Val { type evalOr struct { id int64 - terms []InterpretableV2 + terms []Interpretable } // ID implements the Interpretable interface method. @@ -338,12 +250,12 @@ func (or *evalOr) ID() int64 { return or.id } -// Exec implements the InterpretableV2 interface method. -func (or *evalOr) Exec(frame *ExecutionFrame) ref.Val { +// Eval implements the Interpretable interface method. +func (or *evalOr) Eval(ctx Activation) ref.Val { var err ref.Val = nil var unk *types.Unknown for _, term := range or.terms { - val := term.Exec(frame) + val := term.Eval(ctx) boolVal, ok := val.(types.Bool) // short-circuit on true. if ok && boolVal == types.True { @@ -371,14 +283,9 @@ func (or *evalOr) Exec(frame *ExecutionFrame) ref.Val { return types.False } -// Eval implements the Interpretable interface method. -func (or *evalOr) Eval(ctx Activation) ref.Val { - return or.Exec(AsFrame(ctx)) -} - type evalAnd struct { id int64 - terms []InterpretableV2 + terms []Interpretable } // ID implements the Interpretable interface method. @@ -386,12 +293,12 @@ func (and *evalAnd) ID() int64 { return and.id } -// Exec implements the InterpretableV2 interface method. -func (and *evalAnd) Exec(frame *ExecutionFrame) ref.Val { +// Eval implements the Interpretable interface method. +func (and *evalAnd) Eval(ctx Activation) ref.Val { var err ref.Val = nil var unk *types.Unknown for _, term := range and.terms { - val := term.Exec(frame) + val := term.Eval(ctx) boolVal, ok := val.(types.Bool) // short-circuit on false. if ok && boolVal == types.False { @@ -419,15 +326,10 @@ func (and *evalAnd) Exec(frame *ExecutionFrame) ref.Val { return types.True } -// Eval implements the Interpretable interface method. -func (and *evalAnd) Eval(ctx Activation) ref.Val { - return and.Exec(AsFrame(ctx)) -} - type evalEq struct { id int64 - lhs InterpretableV2 - rhs InterpretableV2 + lhs Interpretable + rhs Interpretable } // ID implements the Interpretable interface method. @@ -435,30 +337,19 @@ func (eq *evalEq) ID() int64 { return eq.id } -// Exec implements the InterpretableV2 interface method. -func (eq *evalEq) Exec(frame *ExecutionFrame) ref.Val { - lVal := eq.lhs.Exec(frame) - if types.IsError(lVal) { +// Eval implements the Interpretable interface method. +func (eq *evalEq) Eval(ctx Activation) ref.Val { + lVal := eq.lhs.Eval(ctx) + rVal := eq.rhs.Eval(ctx) + if types.IsUnknownOrError(lVal) { return lVal } - rVal := eq.rhs.Exec(frame) - if types.IsError(rVal) { + if types.IsUnknownOrError(rVal) { return rVal } - var unk *types.Unknown - unk, _ = types.MaybeMergeUnknowns(lVal, unk) - unk, _ = types.MaybeMergeUnknowns(rVal, unk) - if unk != nil { - return unk - } return types.Equal(lVal, rVal) } -// Eval implements the Interpretable interface method. -func (eq *evalEq) Eval(ctx Activation) ref.Val { - return eq.Exec(AsFrame(ctx)) -} - // Function implements the InterpretableCall interface method. func (*evalEq) Function() string { return operators.Equals @@ -470,14 +361,14 @@ func (*evalEq) OverloadID() string { } // Args implements the InterpretableCall interface method. -func (eq *evalEq) Args() []InterpretableV2 { - return []InterpretableV2{eq.lhs, eq.rhs} +func (eq *evalEq) Args() []Interpretable { + return []Interpretable{eq.lhs, eq.rhs} } type evalNe struct { id int64 - lhs InterpretableV2 - rhs InterpretableV2 + lhs Interpretable + rhs Interpretable } // ID implements the Interpretable interface method. @@ -485,30 +376,19 @@ func (ne *evalNe) ID() int64 { return ne.id } -// Exec implements the InterpretableV2 interface method. -func (ne *evalNe) Exec(frame *ExecutionFrame) ref.Val { - lVal := ne.lhs.Exec(frame) - if types.IsError(lVal) { +// Eval implements the Interpretable interface method. +func (ne *evalNe) Eval(ctx Activation) ref.Val { + lVal := ne.lhs.Eval(ctx) + rVal := ne.rhs.Eval(ctx) + if types.IsUnknownOrError(lVal) { return lVal } - rVal := ne.rhs.Exec(frame) - if types.IsError(rVal) { + if types.IsUnknownOrError(rVal) { return rVal } - var unk *types.Unknown - unk, _ = types.MaybeMergeUnknowns(lVal, unk) - unk, _ = types.MaybeMergeUnknowns(rVal, unk) - if unk != nil { - return unk - } return types.Bool(types.Equal(lVal, rVal) != types.True) } -// Eval implements the Interpretable interface method. -func (ne *evalNe) Eval(ctx Activation) ref.Val { - return ne.Exec(AsFrame(ctx)) -} - // Function implements the InterpretableCall interface method. func (*evalNe) Function() string { return operators.NotEquals @@ -520,8 +400,8 @@ func (*evalNe) OverloadID() string { } // Args implements the InterpretableCall interface method. -func (ne *evalNe) Args() []InterpretableV2 { - return []InterpretableV2{ne.lhs, ne.rhs} +func (ne *evalNe) Args() []Interpretable { + return []Interpretable{ne.lhs, ne.rhs} } type evalZeroArity struct { @@ -536,14 +416,9 @@ func (zero *evalZeroArity) ID() int64 { return zero.id } -// Exec implements the InterpretableV2 interface method. -func (zero *evalZeroArity) Exec(frame *ExecutionFrame) ref.Val { - return types.LabelErrNode(zero.id, zero.impl()) -} - // Eval implements the Interpretable interface method. func (zero *evalZeroArity) Eval(ctx Activation) ref.Val { - return zero.Exec(AsFrame(ctx)) + return types.LabelErrNode(zero.id, zero.impl()) } // Function implements the InterpretableCall interface method. @@ -557,15 +432,15 @@ func (zero *evalZeroArity) OverloadID() string { } // Args returns the argument to the unary function. -func (zero *evalZeroArity) Args() []InterpretableV2 { - return []InterpretableV2{} +func (zero *evalZeroArity) Args() []Interpretable { + return []Interpretable{} } type evalUnary struct { id int64 function string overload string - arg InterpretableV2 + arg Interpretable trait int impl functions.UnaryOp nonStrict bool @@ -576,9 +451,9 @@ func (un *evalUnary) ID() int64 { return un.id } -// Exec implements the InterpretableV2 interface method. -func (un *evalUnary) Exec(frame *ExecutionFrame) ref.Val { - argVal := un.arg.Exec(frame) +// Eval implements the Interpretable interface method. +func (un *evalUnary) Eval(ctx Activation) ref.Val { + argVal := un.arg.Eval(ctx) // Early return if the argument to the function is unknown or error. strict := !un.nonStrict if strict && types.IsUnknownOrError(argVal) { @@ -597,11 +472,6 @@ func (un *evalUnary) Exec(frame *ExecutionFrame) ref.Val { return types.NewErrWithNodeID(un.id, "no such overload: %s", un.function) } -// Eval implements the Interpretable interface method. -func (un *evalUnary) Eval(ctx Activation) ref.Val { - return un.Exec(AsFrame(ctx)) -} - // Function implements the InterpretableCall interface method. func (un *evalUnary) Function() string { return un.function @@ -613,16 +483,16 @@ func (un *evalUnary) OverloadID() string { } // Args returns the argument to the unary function. -func (un *evalUnary) Args() []InterpretableV2 { - return []InterpretableV2{un.arg} +func (un *evalUnary) Args() []Interpretable { + return []Interpretable{un.arg} } type evalBinary struct { id int64 function string overload string - lhs InterpretableV2 - rhs InterpretableV2 + lhs Interpretable + rhs Interpretable trait int impl functions.BinaryOp nonStrict bool @@ -633,23 +503,18 @@ func (bin *evalBinary) ID() int64 { return bin.id } -// Exec implements the InterpretableV2 interface method. -func (bin *evalBinary) Exec(frame *ExecutionFrame) ref.Val { - lVal := bin.lhs.Exec(frame) +// Eval implements the Interpretable interface method. +func (bin *evalBinary) Eval(ctx Activation) ref.Val { + lVal := bin.lhs.Eval(ctx) + rVal := bin.rhs.Eval(ctx) + // Early return if any argument to the function is unknown or error. strict := !bin.nonStrict - if strict && types.IsError(lVal) { - return lVal - } - rVal := bin.rhs.Exec(frame) - if strict && types.IsError(rVal) { - return rVal - } if strict { - var unk *types.Unknown - unk, _ = types.MaybeMergeUnknowns(lVal, unk) - unk, _ = types.MaybeMergeUnknowns(rVal, unk) - if unk != nil { - return unk + if types.IsUnknownOrError(lVal) { + return lVal + } + if types.IsUnknownOrError(rVal) { + return rVal } } // If the implementation is bound and the argument value has the right traits required to @@ -665,11 +530,6 @@ func (bin *evalBinary) Exec(frame *ExecutionFrame) ref.Val { return types.NewErrWithNodeID(bin.id, "no such overload: %s", bin.function) } -// Eval implements the Interpretable interface method. -func (bin *evalBinary) Eval(ctx Activation) ref.Val { - return bin.Exec(AsFrame(ctx)) -} - // Function implements the InterpretableCall interface method. func (bin *evalBinary) Function() string { return bin.function @@ -681,22 +541,22 @@ func (bin *evalBinary) OverloadID() string { } // Args returns the argument to the unary function. -func (bin *evalBinary) Args() []InterpretableV2 { - return []InterpretableV2{bin.lhs, bin.rhs} +func (bin *evalBinary) Args() []Interpretable { + return []Interpretable{bin.lhs, bin.rhs} } type evalVarArgs struct { id int64 function string overload string - args []InterpretableV2 + args []Interpretable trait int impl functions.FunctionOp nonStrict bool } // NewCall creates a new call Interpretable. -func NewCall(id int64, function, overload string, args []InterpretableV2, impl functions.FunctionOp) InterpretableCall { +func NewCall(id int64, function, overload string, args []Interpretable, impl functions.FunctionOp) InterpretableCall { return &evalVarArgs{ id: id, function: function, @@ -711,23 +571,17 @@ func (fn *evalVarArgs) ID() int64 { return fn.id } -// Exec implements the InterpretableV2 interface method. -func (fn *evalVarArgs) Exec(frame *ExecutionFrame) ref.Val { +// Eval implements the Interpretable interface method. +func (fn *evalVarArgs) Eval(ctx Activation) ref.Val { argVals := make([]ref.Val, len(fn.args)) + // Early return if any argument to the function is unknown or error. strict := !fn.nonStrict - var unk *types.Unknown for i, arg := range fn.args { - argVals[i] = arg.Exec(frame) - if strict { - if types.IsError(argVals[i]) { - return argVals[i] - } - unk, _ = types.MaybeMergeUnknowns(argVals[i], unk) + argVals[i] = arg.Eval(ctx) + if strict && types.IsUnknownOrError(argVals[i]) { + return argVals[i] } } - if strict && unk != nil { - return unk - } // If the implementation is bound and the argument value has the right traits required to // invoke it, then call the implementation. arg0 := argVals[0] @@ -742,11 +596,6 @@ func (fn *evalVarArgs) Exec(frame *ExecutionFrame) ref.Val { return types.NewErrWithNodeID(fn.id, "no such overload: %s %d", fn.function, fn.id) } -// Eval implements the Interpretable interface method. -func (fn *evalVarArgs) Eval(ctx Activation) ref.Val { - return fn.Exec(AsFrame(ctx)) -} - // Function implements the InterpretableCall interface method. func (fn *evalVarArgs) Function() string { return fn.function @@ -758,13 +607,13 @@ func (fn *evalVarArgs) OverloadID() string { } // Args returns the argument to the unary function. -func (fn *evalVarArgs) Args() []InterpretableV2 { +func (fn *evalVarArgs) Args() []Interpretable { return fn.args } type evalList struct { id int64 - elems []InterpretableV2 + elems []Interpretable optionals []bool hasOptionals bool adapter types.Adapter @@ -775,44 +624,31 @@ func (l *evalList) ID() int64 { return l.id } -// Exec implements the InterpretableV2 interface method. -func (l *evalList) Exec(frame *ExecutionFrame) ref.Val { +// Eval implements the Interpretable interface method. +func (l *evalList) Eval(ctx Activation) ref.Val { elemVals := make([]ref.Val, 0, len(l.elems)) - var unk *types.Unknown + // If any argument is unknown or error early terminate. for i, elem := range l.elems { - elemVal := elem.Exec(frame) - if types.IsError(elemVal) { + elemVal := elem.Eval(ctx) + if types.IsUnknownOrError(elemVal) { return elemVal } - unk, _ = types.MaybeMergeUnknowns(elemVal, unk) if l.hasOptionals && l.optionals[i] { - if types.IsUnknown(elemVal) { - // skip optional checks for unknown values as they aren't fully resolved yet. - } else { - optVal, ok := elemVal.(*types.Optional) - if !ok { - return types.LabelErrNode(l.id, invalidOptionalElementInit(elemVal)) - } - if !optVal.HasValue() { - continue - } - elemVal = optVal.GetValue() + optVal, ok := elemVal.(*types.Optional) + if !ok { + return types.LabelErrNode(l.id, invalidOptionalElementInit(elemVal)) } + if !optVal.HasValue() { + continue + } + elemVal = optVal.GetValue() } elemVals = append(elemVals, elemVal) } - if unk != nil { - return unk - } - return types.NewRefValList(l.adapter, elemVals) + return l.adapter.NativeToValue(elemVals) } -// Eval implements the Interpretable interface method. -func (l *evalList) Eval(ctx Activation) ref.Val { - return l.Exec(AsFrame(ctx)) -} - -func (l *evalList) InitVals() []InterpretableV2 { +func (l *evalList) InitVals() []Interpretable { return l.elems } @@ -822,8 +658,8 @@ func (l *evalList) Type() ref.Type { type evalMap struct { id int64 - keys []InterpretableV2 - vals []InterpretableV2 + keys []Interpretable + vals []Interpretable optionals []bool hasOptionals bool adapter types.Adapter @@ -834,24 +670,20 @@ func (m *evalMap) ID() int64 { return m.id } -// Exec implements the InterpretableV2 interface method. -func (m *evalMap) Exec(frame *ExecutionFrame) ref.Val { - entries := make(map[ref.Val]ref.Val, len(m.keys)) - var unk *types.Unknown +// Eval implements the Interpretable interface method. +func (m *evalMap) Eval(ctx Activation) ref.Val { + entries := make(map[ref.Val]ref.Val) + // If any argument is unknown or error early terminate. for i, key := range m.keys { - keyVal := key.Exec(frame) - if types.IsError(keyVal) { + keyVal := key.Eval(ctx) + if types.IsUnknownOrError(keyVal) { return keyVal } - unk, _ = types.MaybeMergeUnknowns(keyVal, unk) - - valVal := m.vals[i].Exec(frame) - if types.IsError(valVal) { + valVal := m.vals[i].Eval(ctx) + if types.IsUnknownOrError(valVal) { return valVal } - unk, _ = types.MaybeMergeUnknowns(valVal, unk) - - if m.hasOptionals && m.optionals[i] && !types.IsUnknown(valVal) { + if m.hasOptionals && m.optionals[i] { optVal, ok := valVal.(*types.Optional) if !ok { return types.LabelErrNode(m.id, invalidOptionalEntryInit(keyVal, valVal)) @@ -864,22 +696,14 @@ func (m *evalMap) Exec(frame *ExecutionFrame) ref.Val { } entries[keyVal] = valVal } - if unk != nil { - return unk - } - return types.NewRefValMap(m.adapter, entries) -} - -// Eval implements the Interpretable interface method. -func (m *evalMap) Eval(ctx Activation) ref.Val { - return m.Exec(AsFrame(ctx)) + return m.adapter.NativeToValue(entries) } -func (m *evalMap) InitVals() []InterpretableV2 { +func (m *evalMap) InitVals() []Interpretable { if len(m.keys) != len(m.vals) { return nil } - result := make([]InterpretableV2, len(m.keys)+len(m.vals)) + result := make([]Interpretable, len(m.keys)+len(m.vals)) idx := 0 for i, k := range m.keys { v := m.vals[i] @@ -899,7 +723,7 @@ type evalObj struct { id int64 typeName string fields []string - vals []InterpretableV2 + vals []Interpretable optionals []bool hasOptionals bool provider types.Provider @@ -910,17 +734,16 @@ func (o *evalObj) ID() int64 { return o.id } -// Exec implements the InterpretableV2 interface method. -func (o *evalObj) Exec(frame *ExecutionFrame) ref.Val { - fieldVals := make(map[string]ref.Val, len(o.fields)) - var unk *types.Unknown +// Eval implements the Interpretable interface method. +func (o *evalObj) Eval(ctx Activation) ref.Val { + fieldVals := make(map[string]ref.Val) + // If any argument is unknown or error early terminate. for i, field := range o.fields { - val := o.vals[i].Exec(frame) - if types.IsError(val) { + val := o.vals[i].Eval(ctx) + if types.IsUnknownOrError(val) { return val } - unk, _ = types.MaybeMergeUnknowns(val, unk) - if o.hasOptionals && o.optionals[i] && !types.IsUnknown(val) { + if o.hasOptionals && o.optionals[i] { optVal, ok := val.(*types.Optional) if !ok { return types.LabelErrNode(o.id, invalidOptionalEntryInit(field, val)) @@ -933,19 +756,11 @@ func (o *evalObj) Exec(frame *ExecutionFrame) ref.Val { } fieldVals[field] = val } - if unk != nil { - return unk - } return types.LabelErrNode(o.id, o.provider.NewValue(o.typeName, fieldVals)) } -// Eval implements the Interpretable interface method. -func (o *evalObj) Eval(ctx Activation) ref.Val { - return o.Exec(AsFrame(ctx)) -} - // InitVals implements the InterpretableConstructor interface method. -func (o *evalObj) InitVals() []InterpretableV2 { +func (o *evalObj) InitVals() []Interpretable { return o.vals } @@ -959,11 +774,11 @@ type evalFold struct { accuVar string iterVar string iterVar2 string - iterRange InterpretableV2 - accu InterpretableV2 - cond InterpretableV2 - step InterpretableV2 - result InterpretableV2 + iterRange Interpretable + accu Interpretable + cond Interpretable + step Interpretable + result Interpretable adapter types.Adapter // note an exhaustive fold will ensure that all branches are evaluated @@ -978,13 +793,13 @@ func (fold *evalFold) ID() int64 { return fold.id } -// Exec implements the InterpretableV2 interface method. -func (fold *evalFold) Exec(frame *ExecutionFrame) ref.Val { +// Eval implements the Interpretable interface method. +func (fold *evalFold) Eval(ctx Activation) ref.Val { // Initialize the folder interface - f := newFolder(fold, frame) + f := newFolder(fold, ctx) defer releaseFolder(f) - foldRange := fold.iterRange.Exec(frame) + foldRange := fold.iterRange.Eval(ctx) if types.IsUnknownOrError(foldRange) { return foldRange } @@ -1009,19 +824,14 @@ func (fold *evalFold) Exec(frame *ExecutionFrame) ref.Val { return f.foldIterable(iterable) } -// Eval implements the Interpretable interface method. -func (fold *evalFold) Eval(ctx Activation) ref.Val { - return fold.Exec(AsFrame(ctx)) -} - // Optional Interpretable implementations that specialize, subsume, or extend the core evaluation // plan via decorators. // evalSetMembership is an Interpretable implementation which tests whether an input value // exists within the set of map keys used to model a set. type evalSetMembership struct { - inst InterpretableV2 - arg InterpretableV2 + inst Interpretable + arg Interpretable valueSet map[ref.Val]ref.Val } @@ -1030,9 +840,9 @@ func (e *evalSetMembership) ID() int64 { return e.inst.ID() } -// Exec implements the InterpretableV2 interface method. -func (e *evalSetMembership) Exec(frame *ExecutionFrame) ref.Val { - val := e.arg.Exec(frame) +// Eval implements the Interpretable interface method. +func (e *evalSetMembership) Eval(ctx Activation) ref.Val { + val := e.arg.Eval(ctx) if types.IsUnknownOrError(val) { return val } @@ -1042,28 +852,18 @@ func (e *evalSetMembership) Exec(frame *ExecutionFrame) ref.Val { return types.False } -// Eval implements the Interpretable interface method. -func (e *evalSetMembership) Eval(ctx Activation) ref.Val { - return e.Exec(AsFrame(ctx)) -} - // evalWatch is an Interpretable implementation that wraps the execution of a given // expression so that it may observe the computed value and send it to an observer. type evalWatch struct { - InterpretableV2 + Interpretable observer EvalObserver } -// Exec implements the InterpretableV2 interface method. -func (e *evalWatch) Exec(frame *ExecutionFrame) ref.Val { - val := e.InterpretableV2.Exec(frame) - e.observer(frame, e.ID(), e.InterpretableV2, val) - return val -} - // Eval implements the Interpretable interface method. func (e *evalWatch) Eval(vars Activation) ref.Val { - return e.Exec(AsFrame(vars)) + val := e.Interpretable.Eval(vars) + e.observer(vars, e.ID(), e.Interpretable, val) + return val } // evalWatchAttr describes a watcher of an InterpretableAttribute Interpretable. @@ -1118,16 +918,11 @@ func (e *evalWatchAttr) AddQualifier(q Qualifier) (Attribute, error) { return e, err } -// Exec implements the InterpretableV2 interface method. -func (e *evalWatchAttr) Exec(frame *ExecutionFrame) ref.Val { - val := e.InterpretableAttribute.Exec(frame) - e.observer(frame, e.ID(), e.InterpretableAttribute, val) - return val -} - // Eval implements the Interpretable interface method. func (e *evalWatchAttr) Eval(vars Activation) ref.Val { - return e.Exec(AsFrame(vars)) + val := e.InterpretableAttribute.Eval(vars) + e.observer(vars, e.ID(), e.InterpretableAttribute, val) + return val } // evalWatchConstQual observes the qualification of an object using a constant boolean, int, @@ -1254,22 +1049,17 @@ type evalWatchConst struct { observer EvalObserver } -// Exec implements the InterpretableV2 interface method. -func (e *evalWatchConst) Exec(frame *ExecutionFrame) ref.Val { - val := e.Value() - e.observer(frame, e.ID(), e.InterpretableConst, val) - return val -} - // Eval implements the Interpretable interface method. func (e *evalWatchConst) Eval(vars Activation) ref.Val { - return e.Exec(AsFrame(vars)) + val := e.Value() + e.observer(vars, e.ID(), e.InterpretableConst, val) + return val } // evalExhaustiveOr is just like evalOr, but does not short-circuit argument evaluation. type evalExhaustiveOr struct { id int64 - terms []InterpretableV2 + terms []Interpretable } // ID implements the Interpretable interface method. @@ -1277,13 +1067,13 @@ func (or *evalExhaustiveOr) ID() int64 { return or.id } -// Exec implements the InterpretableV2 interface method. -func (or *evalExhaustiveOr) Exec(frame *ExecutionFrame) ref.Val { +// Eval implements the Interpretable interface method. +func (or *evalExhaustiveOr) Eval(ctx Activation) ref.Val { var err ref.Val = nil var unk *types.Unknown isTrue := false for _, term := range or.terms { - val := term.Exec(frame) + val := term.Eval(ctx) boolVal, ok := val.(types.Bool) // flag the result as true if ok && boolVal == types.True { @@ -1313,15 +1103,10 @@ func (or *evalExhaustiveOr) Exec(frame *ExecutionFrame) ref.Val { return types.False } -// Eval implements the Interpretable interface method. -func (or *evalExhaustiveOr) Eval(ctx Activation) ref.Val { - return or.Exec(AsFrame(ctx)) -} - // evalExhaustiveAnd is just like evalAnd, but does not short-circuit argument evaluation. type evalExhaustiveAnd struct { id int64 - terms []InterpretableV2 + terms []Interpretable } // ID implements the Interpretable interface method. @@ -1329,13 +1114,13 @@ func (and *evalExhaustiveAnd) ID() int64 { return and.id } -// Exec implements the InterpretableV2 interface method. -func (and *evalExhaustiveAnd) Exec(frame *ExecutionFrame) ref.Val { +// Eval implements the Interpretable interface method. +func (and *evalExhaustiveAnd) Eval(ctx Activation) ref.Val { var err ref.Val = nil var unk *types.Unknown isFalse := false for _, term := range and.terms { - val := term.Exec(frame) + val := term.Eval(ctx) boolVal, ok := val.(types.Bool) // short-circuit on false. if ok && boolVal == types.False { @@ -1365,11 +1150,6 @@ func (and *evalExhaustiveAnd) Exec(frame *ExecutionFrame) ref.Val { return types.True } -// Eval implements the Interpretable interface method. -func (and *evalExhaustiveAnd) Eval(ctx Activation) ref.Val { - return and.Exec(AsFrame(ctx)) -} - // evalExhaustiveConditional is like evalConditional, but does not short-circuit argument // evaluation. type evalExhaustiveConditional struct { @@ -1383,11 +1163,11 @@ func (cond *evalExhaustiveConditional) ID() int64 { return cond.id } -// Exec implements the InterpretableV2 interface method. -func (cond *evalExhaustiveConditional) Exec(frame *ExecutionFrame) ref.Val { - cVal := cond.attr.expr.Exec(frame) - tVal, tErr := cond.attr.truthy.Resolve(frame) - fVal, fErr := cond.attr.falsy.Resolve(frame) +// Eval implements the Interpretable interface method. +func (cond *evalExhaustiveConditional) Eval(ctx Activation) ref.Val { + cVal := cond.attr.expr.Eval(ctx) + tVal, tErr := cond.attr.truthy.Resolve(ctx) + fVal, fErr := cond.attr.falsy.Resolve(ctx) cBool, ok := cVal.(types.Bool) if !ok { return types.ValOrErr(cVal, "no such overload") @@ -1404,11 +1184,6 @@ func (cond *evalExhaustiveConditional) Exec(frame *ExecutionFrame) ref.Val { return cond.adapter.NativeToValue(fVal) } -// Eval implements the Interpretable interface method. -func (cond *evalExhaustiveConditional) Eval(ctx Activation) ref.Val { - return cond.Exec(AsFrame(ctx)) -} - // evalAttr evaluates an Attribute value. type evalAttr struct { adapter types.Adapter @@ -1440,20 +1215,15 @@ func (a *evalAttr) Adapter() types.Adapter { return a.adapter } -// Exec implements the InterpretableV2 interface method. -func (a *evalAttr) Exec(frame *ExecutionFrame) ref.Val { - v, err := a.attr.Resolve(frame) +// Eval implements the Interpretable interface method. +func (a *evalAttr) Eval(ctx Activation) ref.Val { + v, err := a.attr.Resolve(ctx) if err != nil { return types.LabelErrNode(a.ID(), types.WrapErr(err)) } return a.adapter.NativeToValue(v) } -// Eval implements the Interpretable interface method. -func (a *evalAttr) Eval(ctx Activation) ref.Val { - return a.Exec(AsFrame(ctx)) -} - // Qualify proxies to the Attribute's Qualify method. func (a *evalAttr) Qualify(vars Activation, obj any) (any, error) { return a.attr.Qualify(vars, obj) @@ -1479,7 +1249,7 @@ type evalWatchConstructor struct { } // InitVals implements the InterpretableConstructor InitVals function. -func (c *evalWatchConstructor) InitVals() []InterpretableV2 { +func (c *evalWatchConstructor) InitVals() []Interpretable { return c.constructor.InitVals() } @@ -1493,16 +1263,11 @@ func (c *evalWatchConstructor) ID() int64 { return c.constructor.ID() } -// Exec implements the InterpretableV2 interface method. -func (c *evalWatchConstructor) Exec(frame *ExecutionFrame) ref.Val { - val := c.constructor.Exec(frame) - c.observer(frame, c.ID(), c.constructor, val) - return val -} - // Eval implements the Interpretable Eval function. func (c *evalWatchConstructor) Eval(vars Activation) ref.Val { - return c.Exec(AsFrame(vars)) + val := c.constructor.Eval(vars) + c.observer(vars, c.ID(), c.constructor, val) + return val } func invalidOptionalEntryInit(field any, value ref.Val) ref.Val { @@ -1514,10 +1279,10 @@ func invalidOptionalElementInit(value ref.Val) ref.Val { } // newFolder creates or initializes a pooled folder instance. -func newFolder(eval *evalFold, frame *ExecutionFrame) *folder { +func newFolder(eval *evalFold, ctx Activation) *folder { f := folderPool.Get().(*folder) f.evalFold = eval - f.frame = frame.Push(f) + f.activation = ctx return f } @@ -1538,7 +1303,7 @@ func releaseFolder(f *folder) { // cel.bind or cel.@block. type folder struct { *evalFold - frame *ExecutionFrame + activation Activation // fold state objects. accuVal ref.Val @@ -1557,16 +1322,16 @@ func (f *folder) foldIterable(iterable traits.Iterable) ref.Val { for it.HasNext() == types.True { f.iterVar1Val = it.Next() - cond := f.cond.Exec(f.frame) + cond := f.cond.Eval(f) condBool, ok := cond.(types.Bool) if f.interrupted || (!f.exhaustive && ok && condBool != types.True) { return f.evalResult() } // Update the accumulation value and check for eval interuption. - f.accuVal = f.step.Exec(f.frame) + f.accuVal = f.step.Eval(f) f.initialized = true - if f.interruptable && f.frame.CheckInterrupt() { + if f.interruptable && checkInterrupt(f.activation) { f.interrupted = true return f.evalResult() } @@ -1583,16 +1348,16 @@ func (f *folder) FoldEntry(key, val any) bool { // Terminate evaluation if evaluation is interrupted or the condition is not true and exhaustive // eval is not enabled. - cond := f.cond.Exec(f.frame) + cond := f.cond.Eval(f) condBool, ok := cond.(types.Bool) if f.interrupted || (!f.exhaustive && ok && condBool != types.True) { return false } // Update the accumulation value and check for eval interuption. - f.accuVal = f.step.Exec(f.frame) + f.accuVal = f.step.Eval(f) f.initialized = true - if f.interruptable && f.frame.CheckInterrupt() { + if f.interruptable && checkInterrupt(f.activation) { f.interrupted = true return false } @@ -1606,7 +1371,7 @@ func (f *folder) ResolveName(name string) (any, bool) { if name == f.accuVar { if !f.initialized { f.initialized = true - initVal := f.accu.Exec(f.frame.parent) + initVal := f.accu.Eval(f.activation) if !f.exhaustive { if l, isList := initVal.(traits.Lister); isList && l.Size() == types.IntZero { initVal = types.NewMutableList(f.adapter) @@ -1631,43 +1396,18 @@ func (f *folder) ResolveName(name string) (any, bool) { return f.iterVar2Val, true } } - return f.frame.parent.ResolveName(name) + return f.activation.ResolveName(name) } // Parent returns the activation embedded into the folder. func (f *folder) Parent() Activation { - return f.frame.parent -} - -// Unwrap returns the parent activation, thus omitting access to local state -func (f *folder) Unwrap() Activation { - return f.frame.parent -} - -// IsLocalVariable reports whether the variable name is locally bound by the folder scope. -func (f *folder) IsLocalVariable(name string) bool { - if name == f.accuVar { - return true - } - if !f.computeResult && (name == f.iterVar || name == f.iterVar2) { - return true - } - parent := f.Parent() - if parent == nil { - return false - } - if varHolder, ok := parent.(localVariableHolder); ok { - if varHolder.IsLocalVariable(name) { - return true - } - } - return false + return f.activation } // UnknownAttributePatterns implements the PartialActivation interface returning the unknown patterns // if they were provided to the input activation, or an empty set if the proxied activation is not partial. func (f *folder) UnknownAttributePatterns() []*AttributePattern { - if pv, ok := f.frame.parent.Activation.(partialActivationConverter); ok { + if pv, ok := f.activation.(partialActivationConverter); ok { if partial, isPartial := pv.AsPartialActivation(); isPartial { return partial.UnknownAttributePatterns() } @@ -1676,7 +1416,7 @@ func (f *folder) UnknownAttributePatterns() []*AttributePattern { } func (f *folder) AsPartialActivation() (PartialActivation, bool) { - if pv, ok := f.frame.parent.Activation.(partialActivationConverter); ok { + if pv, ok := f.activation.(partialActivationConverter); ok { if _, isPartial := pv.AsPartialActivation(); isPartial { return f, true } @@ -1688,9 +1428,9 @@ func (f *folder) AsPartialActivation() (PartialActivation, bool) { func (f *folder) evalResult() ref.Val { f.computeResult = true if f.interrupted { - return types.WrapErr(InterruptError{}) + return types.NewErr("operation interrupted") } - res := f.result.Exec(f.frame) + res := f.result.Eval(f) // Convert a mutable list or map to an immutable one if the comprehension has generated a list or // map as a result. if !types.IsUnknownOrError(res) && f.mutableValue { @@ -1707,8 +1447,7 @@ func (f *folder) evalResult() ref.Val { // reset clears any state associated with folder evaluation. func (f *folder) reset() { f.evalFold = nil - f.frame.Pop() - f.frame = nil + f.activation = nil f.accuVal = nil f.iterVar1Val = nil f.iterVar2Val = nil @@ -1719,18 +1458,9 @@ func (f *folder) reset() { f.computeResult = false } -// InterruptError is a specialized error type used to signal that program evaluation should check -// whether a context cancellation is responsible for the error. -type InterruptError struct{} - -// Error returns operation interrupted. -func (InterruptError) Error() string { - return "operation interrupted" -} - -// Is returns whether two errors are interrupt errors. -func (ie InterruptError) Is(target error) bool { - return target.Error() == ie.Error() +func checkInterrupt(a Activation) bool { + stop, found := a.ResolveName("#interrupted") + return found && stop == true } var ( diff --git a/vendor/github.com/google/cel-go/interpreter/interpreter.go b/vendor/github.com/google/cel-go/interpreter/interpreter.go index ef13ab9226..be57e74392 100644 --- a/vendor/github.com/google/cel-go/interpreter/interpreter.go +++ b/vendor/github.com/google/cel-go/interpreter/interpreter.go @@ -29,11 +29,11 @@ import ( // PlannerOption configures the program plan options during interpretable setup. type PlannerOption func(*planner) (*planner, error) -// Interpreter generates a new InterpretableV2 from a checked or unchecked expression. +// Interpreter generates a new Interpretable from a checked or unchecked expression. type Interpreter interface { - // NewInterpretable creates an InterpretableV2 from a checked expression and an + // NewInterpretable creates an Interpretable from a checked expression and an // optional list of PlannerOption values. - NewInterpretable(exprAST *ast.AST, opts ...PlannerOption) (InterpretableV2, error) + NewInterpretable(exprAST *ast.AST, opts ...PlannerOption) (Interpretable, error) } // EvalObserver is a functional interface that accepts an expression id and an observed value. @@ -43,16 +43,16 @@ type EvalObserver func(vars Activation, id int64, programStep any, value ref.Val // StatefulObserver observes evaluation while tracking or utilizing stateful behavior. type StatefulObserver interface { - // InitState configures stateful metadata on the execution frame. - InitState(*ExecutionFrame) (any, error) + // InitState configures stateful metadata on the activation. + InitState(Activation) (Activation, error) - // GetState retrieves the stateful metadata from the execution frame. - GetState(*ExecutionFrame) any + // GetState retrieves the stateful metadata from the activation. + GetState(Activation) any // Observe passes the activation and relevant evaluation metadata to the observer. - // The observe method is expected to do the equivalent of GetState(AsFrame(activation)) + // The observe method is expected to do the equivalent of GetState(vars) in order // to find the metadata that needs to be updated upon invocation. - Observe(Activation, int64, any, ref.Val) + Observe(vars Activation, id int64, programStep any, value ref.Val) } // EvalCancelledError represents a cancelled program evaluation operation. @@ -106,17 +106,46 @@ func EvalStateObserver(opts ...evalStateOption) PlannerOption { } } -// activationWrapper identifies an object carrying local variables which should not be exposed to the user -// Activations used for such purposes can be unwrapped to return the activation which omits local state. -type activationWrapper interface { - // Unwrap returns the Activation which omits local state. - Unwrap() Activation +// evalStateConverter identifies an object which is convertible to an EvalState instance. +type evalStateConverter interface { + asEvalState() EvalState } -// localVariableHolder identifies an Activation scope that holds local variables and supports testing -// whether a variable name is local to this scope. -type localVariableHolder interface { - IsLocalVariable(name string) bool +// evalStateActivation hides state in the Activation in a manner not accessible to expressions. +type evalStateActivation struct { + vars Activation + state EvalState +} + +// ResolveName proxies variable lookups to the backing activation. +func (esa evalStateActivation) ResolveName(name string) (any, bool) { + return esa.vars.ResolveName(name) +} + +// Parent proxies parent lookups to the backing activation. +func (esa evalStateActivation) Parent() Activation { + return esa.vars +} + +// AsPartialActivation supports conversion to a partial activation in order to detect unknown attributes. +func (esa evalStateActivation) AsPartialActivation() (PartialActivation, bool) { + return AsPartialActivation(esa.vars) +} + +// asEvalState implements the evalStateConverter method. +func (esa evalStateActivation) asEvalState() EvalState { + return esa.state +} + +// asEvalState walks the Activation hierarchy and returns the first EvalState found, if present. +func asEvalState(vars Activation) (EvalState, bool) { + if conv, ok := vars.(evalStateConverter); ok { + return conv.asEvalState(), true + } + if vars.Parent() != nil { + return asEvalState(vars.Parent()) + } + return nil, false } // evalStateFactory holds a reference to a factory function that produces an EvalState instance. @@ -124,54 +153,32 @@ type evalStateFactory struct { factory func() EvalState } -// InitState produces an EvalState instance and bundles it into the ExecutionFrame in a way which is +// InitState produces an EvalState instance and bundles it into the Activation in a way which is // not visible to expression evaluation. -func (et *evalStateFactory) InitState(frame *ExecutionFrame) (any, error) { - if frame.ctx != nil && frame.ctx.state != nil { - return frame.ctx.state, nil - } +func (et *evalStateFactory) InitState(vars Activation) (Activation, error) { state := et.factory() - if frame.ctx == nil { - frame.ctx = evalContextPool.Get().(*evalContext) - } - frame.ctx.state = state - return state, nil + return evalStateActivation{vars: vars, state: state}, nil } // GetState extracts the EvalState from the Activation. -func (et *evalStateFactory) GetState(frame *ExecutionFrame) any { - if frame.ctx == nil { - return nil +func (et *evalStateFactory) GetState(vars Activation) any { + if state, found := asEvalState(vars); found { + return state } - return frame.ctx.state + return nil } // Observe records the evaluation state for a given expression node and program step. func (et *evalStateFactory) Observe(vars Activation, id int64, programStep any, val ref.Val) { - frame := AsFrame(vars) - if frame.ctx == nil || frame.ctx.state == nil { + state, found := asEvalState(vars) + if !found { return } - frame.ctx.state.SetValue(id, val) + state.SetValue(id, val) } // CustomDecorator configures a custom interpretable decorator for the program. func CustomDecorator(dec InterpretableDecorator) PlannerOption { - return func(p *planner) (*planner, error) { - dec2 := func(i InterpretableV2) (InterpretableV2, error) { - legacy, err := dec(i) - if err != nil { - return nil, err - } - return adaptToV2(legacy), nil - } - p.decorators = append(p.decorators, dec2) - return p, nil - } -} - -// CustomDecoratorV2 configures a custom V2 interpretable decorator for the program. -func CustomDecoratorV2(dec InterpretableDecoratorV2) PlannerOption { return func(p *planner) (*planner, error) { p.decorators = append(p.decorators, dec) return p, nil @@ -184,7 +191,7 @@ func CustomDecoratorV2(dec InterpretableDecoratorV2) PlannerOption { // provided to the decorator. This decorator is not thread-safe, and the EvalState // must be reset between Eval() calls. func ExhaustiveEval() PlannerOption { - return CustomDecoratorV2(decDisableShortcircuits()) + return CustomDecorator(decDisableShortcircuits()) } // InterruptableEval annotates comprehension loops with information that indicates they @@ -193,13 +200,13 @@ func ExhaustiveEval() PlannerOption { // The custom activation is currently managed higher up in the stack within the 'cel' package // and should not require any custom support on behalf of callers. func InterruptableEval() PlannerOption { - return CustomDecoratorV2(decInterruptFolds()) + return CustomDecorator(decInterruptFolds()) } // Optimize will pre-compute operations such as list and map construction and optimize // call arguments to set membership tests. The set of optimizations will increase over time. func Optimize() PlannerOption { - return CustomDecoratorV2(decOptimize()) + return CustomDecorator(decOptimize()) } // RegexOptimization provides a way to replace an InterpretableCall for a regex function when the @@ -224,7 +231,7 @@ type RegexOptimization struct { // CompileRegexConstants compiles regex pattern string constants at program creation time and reports any regex pattern // compile errors. func CompileRegexConstants(regexOptimizations ...*RegexOptimization) PlannerOption { - return CustomDecoratorV2(decRegexOptimizer(regexOptimizations...)) + return CustomDecorator(decRegexOptimizer(regexOptimizations...)) } type exprInterpreter struct { @@ -250,10 +257,10 @@ func NewInterpreter(dispatcher Dispatcher, attrFactory: attrFactory} } -// NewInterpretable implements the Interpreter interface method. +// NewIntepretable implements the Interpreter interface method. func (i *exprInterpreter) NewInterpretable( checked *ast.AST, - opts ...PlannerOption) (InterpretableV2, error) { + opts ...PlannerOption) (Interpretable, error) { p := newPlanner(i.dispatcher, i.provider, i.adapter, i.attrFactory, i.container, checked) var err error for _, o := range opts { diff --git a/vendor/github.com/google/cel-go/interpreter/planner.go b/vendor/github.com/google/cel-go/interpreter/planner.go index 396a9803fc..f0e0d43054 100644 --- a/vendor/github.com/google/cel-go/interpreter/planner.go +++ b/vendor/github.com/google/cel-go/interpreter/planner.go @@ -43,7 +43,7 @@ func newPlanner(disp Dispatcher, container: cont, refMap: exprAST.ReferenceMap(), typeMap: exprAST.TypeMap(), - decorators: make([]InterpretableDecoratorV2, 0), + decorators: make([]InterpretableDecorator, 0), observers: make([]StatefulObserver, 0), } } @@ -57,34 +57,27 @@ type planner struct { container *containers.Container refMap map[int64]*ast.ReferenceInfo typeMap map[int64]*types.Type - decorators []InterpretableDecoratorV2 + decorators []InterpretableDecorator observers []StatefulObserver } -type planBuilder struct { - *planner - - localVars map[string]int -} - // Plan implements the interpretablePlanner interface. This implementation of the Plan method also // applies decorators to each Interpretable generated as part of the overall plan. Decorators are // useful for layering functionality into the evaluation that is not natively understood by CEL, // such as state-tracking, expression re-write, and possibly efficient thread-safe memoization of // repeated expressions. -func (p *planner) Plan(expr ast.Expr) (InterpretableV2, error) { - pb := &planBuilder{planner: p, localVars: make(map[string]int)} - i, err := pb.plan(expr) +func (p *planner) Plan(expr ast.Expr) (Interpretable, error) { + i, err := p.plan(expr) if err != nil { return nil, err } if len(p.observers) == 0 { return i, nil } - return &ObservableInterpretable{InterpretableV2: i, observers: p.observers}, nil + return &ObservableInterpretable{Interpretable: i, observers: p.observers}, nil } -func (p *planBuilder) plan(expr ast.Expr) (InterpretableV2, error) { +func (p *planner) plan(expr ast.Expr) (Interpretable, error) { switch expr.Kind() { case ast.CallKind: return p.decorate(p.planCall(expr)) @@ -109,7 +102,7 @@ func (p *planBuilder) plan(expr ast.Expr) (InterpretableV2, error) { // decorate applies the InterpretableDecorator functions to the given Interpretable. // Both the Interpretable and error generated by a Plan step are accepted as arguments // for convenience. -func (p *planBuilder) decorate(i InterpretableV2, err error) (InterpretableV2, error) { +func (p *planner) decorate(i Interpretable, err error) (Interpretable, error) { if err != nil { return nil, err } @@ -123,26 +116,20 @@ func (p *planBuilder) decorate(i InterpretableV2, err error) (InterpretableV2, e } // planIdent creates an Interpretable that resolves an identifier from an Activation. -func (p *planBuilder) planIdent(expr ast.Expr) (InterpretableV2, error) { +func (p *planner) planIdent(expr ast.Expr) (Interpretable, error) { // Establish whether the identifier is in the reference map. if identRef, found := p.refMap[expr.ID()]; found { return p.planCheckedIdent(expr.ID(), identRef) } // Create the possible attribute list for the unresolved reference. ident := expr.AsIdent() - if p.isLocalVar(ident) { - return &evalAttr{ - adapter: p.adapter, - attr: p.attrFactory.AbsoluteAttribute(expr.ID(), ident), - }, nil - } return &evalAttr{ adapter: p.adapter, attr: p.attrFactory.MaybeAttribute(expr.ID(), ident), }, nil } -func (p *planBuilder) planCheckedIdent(id int64, identRef *ast.ReferenceInfo) (InterpretableV2, error) { +func (p *planner) planCheckedIdent(id int64, identRef *ast.ReferenceInfo) (Interpretable, error) { // Plan a constant reference if this is the case for this simple identifier. if identRef.Value != nil { return NewConstValue(id, identRef.Value), nil @@ -171,7 +158,7 @@ func (p *planBuilder) planCheckedIdent(id int64, identRef *ast.ReferenceInfo) (I // a) selects a field from a map or proto. // b) creates a field presence test for a select within a has() macro. // c) resolves the select expression to a namespaced identifier. -func (p *planBuilder) planSelect(expr ast.Expr) (InterpretableV2, error) { +func (p *planner) planSelect(expr ast.Expr) (Interpretable, error) { // If the Select id appears in the reference map from the CheckedExpr proto then it is either // a namespaced identifier or enum value. if identRef, found := p.refMap[expr.ID()]; found { @@ -227,7 +214,7 @@ func (p *planBuilder) planSelect(expr ast.Expr) (InterpretableV2, error) { // planCall creates a callable Interpretable while specializing for common functions and invocation // patterns. Specifically, conditional operators &&, ||, ?:, and (in)equality functions result in // optimized Interpretable values. -func (p *planBuilder) planCall(expr ast.Expr) (InterpretableV2, error) { +func (p *planner) planCall(expr ast.Expr) (Interpretable, error) { call := expr.AsCall() target, fnName, oName := p.resolveFunction(expr) argCount := len(call.Args()) @@ -237,7 +224,7 @@ func (p *planBuilder) planCall(expr ast.Expr) (InterpretableV2, error) { offset++ } - args := make([]InterpretableV2, argCount) + args := make([]Interpretable, argCount) if target != nil { arg, err := p.plan(target) if err != nil { @@ -281,10 +268,6 @@ func (p *planBuilder) planCall(expr ast.Expr) (InterpretableV2, error) { if fnDef == nil { fnDef, _ = p.disp.FindOverload(fnName) } - // Async overloads are planned into an evalAsyncFunc regardless of arity. - if fnDef != nil && fnDef.Async != nil { - return p.planCallAsync(expr, fnName, oName, fnDef, args) - } switch argCount { case 0: return p.planCallZero(expr, fnName, oName, fnDef) @@ -307,29 +290,11 @@ func (p *planBuilder) planCall(expr ast.Expr) (InterpretableV2, error) { } } -// planCallAsync generates an asynchronous callable Interpretable. -func (p *planBuilder) planCallAsync(expr ast.Expr, - function string, - overload string, - impl *functions.Overload, - args []InterpretableV2) (InterpretableV2, error) { - if impl == nil || impl.Async == nil { - return nil, fmt.Errorf("no such overload: %s()", function) - } - return &evalAsyncFunc{ - id: expr.ID(), - function: function, - overload: overload, - args: args, - impl: impl.Async, - }, nil -} - // planCallZero generates a zero-arity callable Interpretable. -func (p *planBuilder) planCallZero(expr ast.Expr, +func (p *planner) planCallZero(expr ast.Expr, function string, overload string, - impl *functions.Overload) (InterpretableV2, error) { + impl *functions.Overload) (Interpretable, error) { if impl == nil || impl.Function == nil { return nil, fmt.Errorf("no such overload: %s()", function) } @@ -342,11 +307,11 @@ func (p *planBuilder) planCallZero(expr ast.Expr, } // planCallUnary generates a unary callable Interpretable. -func (p *planBuilder) planCallUnary(expr ast.Expr, +func (p *planner) planCallUnary(expr ast.Expr, function string, overload string, impl *functions.Overload, - args []InterpretableV2) (InterpretableV2, error) { + args []Interpretable) (Interpretable, error) { var fn functions.UnaryOp var trait int var nonStrict bool @@ -370,11 +335,11 @@ func (p *planBuilder) planCallUnary(expr ast.Expr, } // planCallBinary generates a binary callable Interpretable. -func (p *planBuilder) planCallBinary(expr ast.Expr, +func (p *planner) planCallBinary(expr ast.Expr, function string, overload string, impl *functions.Overload, - args []InterpretableV2) (InterpretableV2, error) { + args []Interpretable) (Interpretable, error) { var fn functions.BinaryOp var trait int var nonStrict bool @@ -399,11 +364,11 @@ func (p *planBuilder) planCallBinary(expr ast.Expr, } // planCallVarArgs generates a variable argument callable Interpretable. -func (p *planBuilder) planCallVarArgs(expr ast.Expr, +func (p *planner) planCallVarArgs(expr ast.Expr, function string, overload string, impl *functions.Overload, - args []InterpretableV2) (InterpretableV2, error) { + args []Interpretable) (Interpretable, error) { var fn functions.FunctionOp var trait int var nonStrict bool @@ -427,7 +392,7 @@ func (p *planBuilder) planCallVarArgs(expr ast.Expr, } // planCallEqual generates an equals (==) Interpretable. -func (p *planBuilder) planCallEqual(expr ast.Expr, args []InterpretableV2) (InterpretableV2, error) { +func (p *planner) planCallEqual(expr ast.Expr, args []Interpretable) (Interpretable, error) { return &evalEq{ id: expr.ID(), lhs: args[0], @@ -436,7 +401,7 @@ func (p *planBuilder) planCallEqual(expr ast.Expr, args []InterpretableV2) (Inte } // planCallNotEqual generates a not equals (!=) Interpretable. -func (p *planBuilder) planCallNotEqual(expr ast.Expr, args []InterpretableV2) (InterpretableV2, error) { +func (p *planner) planCallNotEqual(expr ast.Expr, args []Interpretable) (Interpretable, error) { return &evalNe{ id: expr.ID(), lhs: args[0], @@ -445,7 +410,7 @@ func (p *planBuilder) planCallNotEqual(expr ast.Expr, args []InterpretableV2) (I } // planCallLogicalAnd generates a logical and (&&) Interpretable. -func (p *planBuilder) planCallLogicalAnd(expr ast.Expr, args []InterpretableV2) (InterpretableV2, error) { +func (p *planner) planCallLogicalAnd(expr ast.Expr, args []Interpretable) (Interpretable, error) { return &evalAnd{ id: expr.ID(), terms: args, @@ -453,7 +418,7 @@ func (p *planBuilder) planCallLogicalAnd(expr ast.Expr, args []InterpretableV2) } // planCallLogicalOr generates a logical or (||) Interpretable. -func (p *planBuilder) planCallLogicalOr(expr ast.Expr, args []InterpretableV2) (InterpretableV2, error) { +func (p *planner) planCallLogicalOr(expr ast.Expr, args []Interpretable) (Interpretable, error) { return &evalOr{ id: expr.ID(), terms: args, @@ -461,7 +426,7 @@ func (p *planBuilder) planCallLogicalOr(expr ast.Expr, args []InterpretableV2) ( } // planCallConditional generates a conditional / ternary (c ? t : f) Interpretable. -func (p *planBuilder) planCallConditional(expr ast.Expr, args []InterpretableV2) (InterpretableV2, error) { +func (p *planner) planCallConditional(expr ast.Expr, args []Interpretable) (Interpretable, error) { cond := args[0] t := args[1] var tAttr Attribute @@ -489,7 +454,7 @@ func (p *planBuilder) planCallConditional(expr ast.Expr, args []InterpretableV2) // planCallIndex either extends an attribute with the argument to the index operation, or creates // a relative attribute based on the return of a function call or operation. -func (p *planBuilder) planCallIndex(expr ast.Expr, args []InterpretableV2, optional bool) (InterpretableV2, error) { +func (p *planner) planCallIndex(expr ast.Expr, args []Interpretable, optional bool) (Interpretable, error) { op := args[0] ind := args[1] opType := p.typeMap[op.ID()] @@ -524,7 +489,7 @@ func (p *planBuilder) planCallIndex(expr ast.Expr, args []InterpretableV2, optio } // planCreateList generates a list construction Interpretable. -func (p *planBuilder) planCreateList(expr ast.Expr) (InterpretableV2, error) { +func (p *planner) planCreateList(expr ast.Expr) (Interpretable, error) { list := expr.AsList() optionalIndices := list.OptionalIndices() elements := list.Elements() @@ -535,7 +500,7 @@ func (p *planBuilder) planCreateList(expr ast.Expr) (InterpretableV2, error) { } optionals[index] = true } - elems := make([]InterpretableV2, len(elements)) + elems := make([]Interpretable, len(elements)) for i, elem := range elements { elemVal, err := p.plan(elem) if err != nil { @@ -553,12 +518,12 @@ func (p *planBuilder) planCreateList(expr ast.Expr) (InterpretableV2, error) { } // planCreateStruct generates a map or object construction Interpretable. -func (p *planBuilder) planCreateMap(expr ast.Expr) (InterpretableV2, error) { +func (p *planner) planCreateMap(expr ast.Expr) (Interpretable, error) { m := expr.AsMap() entries := m.Entries() optionals := make([]bool, len(entries)) - keys := make([]InterpretableV2, len(entries)) - vals := make([]InterpretableV2, len(entries)) + keys := make([]Interpretable, len(entries)) + vals := make([]Interpretable, len(entries)) hasOptionals := false for i, e := range entries { entry := e.AsMapEntry() @@ -587,7 +552,7 @@ func (p *planBuilder) planCreateMap(expr ast.Expr) (InterpretableV2, error) { } // planCreateObj generates an object construction Interpretable. -func (p *planBuilder) planCreateStruct(expr ast.Expr) (InterpretableV2, error) { +func (p *planner) planCreateStruct(expr ast.Expr) (Interpretable, error) { obj := expr.AsStruct() typeName, defined := p.resolveTypeName(obj.TypeName()) if !defined { @@ -596,7 +561,7 @@ func (p *planBuilder) planCreateStruct(expr ast.Expr) (InterpretableV2, error) { objFields := obj.Fields() optionals := make([]bool, len(objFields)) fields := make([]string, len(objFields)) - vals := make([]InterpretableV2, len(objFields)) + vals := make([]Interpretable, len(objFields)) hasOptionals := false for i, f := range objFields { field := f.AsStructField() @@ -621,7 +586,7 @@ func (p *planBuilder) planCreateStruct(expr ast.Expr) (InterpretableV2, error) { } // planComprehension generates an Interpretable fold operation. -func (p *planBuilder) planComprehension(expr ast.Expr) (InterpretableV2, error) { +func (p *planner) planComprehension(expr ast.Expr) (Interpretable, error) { fold := expr.AsComprehension() accu, err := p.plan(fold.AccuInit()) if err != nil { @@ -631,7 +596,6 @@ func (p *planBuilder) planComprehension(expr ast.Expr) (InterpretableV2, error) if err != nil { return nil, err } - p.pushLocalVars(fold.AccuVar(), fold.IterVar(), fold.IterVar2()) cond, err := p.plan(fold.LoopCondition()) if err != nil { return nil, err @@ -640,12 +604,10 @@ func (p *planBuilder) planComprehension(expr ast.Expr) (InterpretableV2, error) if err != nil { return nil, err } - p.popLocalVars(fold.IterVar(), fold.IterVar2()) result, err := p.plan(fold.Result()) if err != nil { return nil, err } - p.popLocalVars(fold.AccuVar()) return &evalFold{ id: expr.ID(), accuVar: fold.AccuVar(), @@ -661,13 +623,13 @@ func (p *planBuilder) planComprehension(expr ast.Expr) (InterpretableV2, error) } // planConst generates a constant valued Interpretable. -func (p *planBuilder) planConst(expr ast.Expr) (InterpretableV2, error) { +func (p *planner) planConst(expr ast.Expr) (Interpretable, error) { return NewConstValue(expr.ID(), expr.AsLiteral()), nil } // resolveTypeName takes a qualified string constructed at parse time, applies the proto // namespace resolution rules to it in a scan over possible matching types in the TypeProvider. -func (p *planBuilder) resolveTypeName(typeName string) (string, bool) { +func (p *planner) resolveTypeName(typeName string) (string, bool) { for _, qualifiedTypeName := range p.container.ResolveCandidateNames(typeName) { if _, found := p.provider.FindStructType(qualifiedTypeName); found { return qualifiedTypeName, true @@ -684,7 +646,7 @@ func (p *planBuilder) resolveTypeName(typeName string) (string, bool) { // - The target expression may only consist of ident and select expressions. // - The function is declared in the environment using its fully-qualified name. // - The fully-qualified function name matches the string serialized target value. -func (p *planBuilder) resolveFunction(expr ast.Expr) (ast.Expr, string, string) { +func (p *planner) resolveFunction(expr ast.Expr) (ast.Expr, string, string) { // Note: similar logic exists within the `checker/checker.go`. If making changes here // please consider the impact on checker.go and consolidate implementations or mirror code // as appropriate. @@ -725,7 +687,7 @@ func (p *planBuilder) resolveFunction(expr ast.Expr) (ast.Expr, string, string) // namespaced identifiers must be stripped, as all declarations already use fully-qualified // names. This stripping behavior is handled automatically by the ResolveCandidateNames // call. - return target, strings.TrimPrefix(fnName, "."), "" + return target, stripLeadingDot(fnName), "" } // Handle the situation where the function target actually indicates a qualified function name. @@ -748,7 +710,7 @@ func (p *planBuilder) resolveFunction(expr ast.Expr) (ast.Expr, string, string) // relativeAttr indicates that the attribute in this case acts as a qualifier and as such needs to // be observed to ensure that it's evaluation value is properly recorded for state tracking. -func (p *planBuilder) relativeAttr(id int64, eval InterpretableV2, opt bool) (InterpretableAttribute, error) { +func (p *planner) relativeAttr(id int64, eval Interpretable, opt bool) (InterpretableAttribute, error) { eAttr, ok := eval.(InterpretableAttribute) if !ok { eAttr = &evalAttr{ @@ -771,7 +733,7 @@ func (p *planBuilder) relativeAttr(id int64, eval InterpretableV2, opt bool) (In // toQualifiedName converts an expression AST into a qualified name if possible, with a boolean // 'found' value that indicates if the conversion is successful. -func (p *planBuilder) toQualifiedName(operand ast.Expr) (string, bool) { +func (p *planner) toQualifiedName(operand ast.Expr) (string, bool) { // If the checker identified the expression as an attribute by the type-checker, then it can't // possibly be part of qualified name in a namespace. _, isAttr := p.refMap[operand.ID()] @@ -797,35 +759,9 @@ func (p *planBuilder) toQualifiedName(operand ast.Expr) (string, bool) { return "", false } -func (p *planBuilder) pushLocalVars(names ...string) { - for _, name := range names { - if name == "" { - continue - } - if cnt, found := p.localVars[name]; found { - p.localVars[name] = cnt + 1 - } else { - p.localVars[name] = 1 - } +func stripLeadingDot(name string) string { + if strings.HasPrefix(name, ".") { + return name[1:] } -} - -func (p *planBuilder) popLocalVars(names ...string) { - for _, name := range names { - if name == "" { - continue - } - if cnt, found := p.localVars[name]; found { - if cnt == 1 { - delete(p.localVars, name) - } else { - p.localVars[name] = cnt - 1 - } - } - } -} - -func (p *planBuilder) isLocalVar(name string) bool { - _, found := p.localVars[name] - return found + return name } diff --git a/vendor/github.com/google/cel-go/interpreter/runtimecost.go b/vendor/github.com/google/cel-go/interpreter/runtimecost.go index 81e4ef63c4..6c44cd7986 100644 --- a/vendor/github.com/google/cel-go/interpreter/runtimecost.go +++ b/vendor/github.com/google/cel-go/interpreter/runtimecost.go @@ -62,6 +62,48 @@ func CostObserver(opts ...costTrackPlanOption) PlannerOption { } } +// costTrackerConverter identifies an object which is convertible to a CostTracker instance. +type costTrackerConverter interface { + asCostTracker() *CostTracker +} + +// costTrackActivation hides state in the Activation in a manner not accessible to expressions. +type costTrackActivation struct { + vars Activation + costTracker *CostTracker +} + +// ResolveName proxies variable lookups to the backing activation. +func (cta costTrackActivation) ResolveName(name string) (any, bool) { + return cta.vars.ResolveName(name) +} + +// Parent proxies parent lookups to the backing activation. +func (cta costTrackActivation) Parent() Activation { + return cta.vars +} + +// AsPartialActivation supports conversion to a partial activation in order to detect unknown attributes. +func (cta costTrackActivation) AsPartialActivation() (PartialActivation, bool) { + return AsPartialActivation(cta.vars) +} + +// asCostTracker implements the costTrackerConverter method. +func (cta costTrackActivation) asCostTracker() *CostTracker { + return cta.costTracker +} + +// asCostTracker walks the Activation hierarchy and returns the first cost tracker found, if present. +func asCostTracker(vars Activation) (*CostTracker, bool) { + if conv, ok := vars.(costTrackerConverter); ok { + return conv.asCostTracker(), true + } + if vars.Parent() != nil { + return asCostTracker(vars.Parent()) + } + return nil, false +} + // costTrackerFactory holds a factory for producing new CostTracker instances on each Eval call. type costTrackerFactory struct { factory func() (*CostTracker, error) @@ -69,40 +111,27 @@ type costTrackerFactory struct { // InitState produces a CostTracker and bundles it into an Activation in a way which is not visible // to expression evaluation. -func (ct *costTrackerFactory) InitState(frame *ExecutionFrame) (any, error) { - if frame.ctx != nil && frame.ctx.costs != nil { - return frame.ctx.costs, nil - } +func (ct *costTrackerFactory) InitState(vars Activation) (Activation, error) { tracker, err := ct.factory() if err != nil { return nil, err } - if frame.ctx == nil { - frame.ctx = evalContextPool.Get().(*evalContext) - } - frame.ctx.costs = tracker - return tracker, nil + return costTrackActivation{vars: vars, costTracker: tracker}, nil } // GetState extracts the CostTracker from the Activation. -func (ct *costTrackerFactory) GetState(frame *ExecutionFrame) any { - if frame == nil || frame.ctx == nil { - return nil +func (ct *costTrackerFactory) GetState(vars Activation) any { + if tracker, found := asCostTracker(vars); found { + return tracker } - return frame.ctx.costs + return nil } // Observe computes the incremental cost of each step and records it into the CostTracker associated // with the evaluation. func (ct *costTrackerFactory) Observe(vars Activation, id int64, programStep any, val ref.Val) { - frame := AsFrame(vars) - state := ct.GetState(frame) - if state == nil { - return - } - tracker, ok := state.(*CostTracker) - if !ok { - // The state is configured with CostTrackFactory so this shouldn't happen. + tracker, found := asCostTracker(vars) + if !found { return } switch t := programStep.(type) { @@ -236,19 +265,6 @@ type CostTracker struct { stack refValStack } -// Clone makes a shallow copy of the tracker. -// The different clones can be used independently from -// each other. -func (c *CostTracker) Clone() (*CostTracker, error) { - tracker := &CostTracker{ - Estimator: c.Estimator, - overloadTrackers: c.overloadTrackers, - Limit: c.Limit, - presenceTestHasCost: c.presenceTestHasCost, - } - return tracker, nil -} - // ActualCost returns the runtime cost func (c *CostTracker) ActualCost() uint64 { return c.cost @@ -260,7 +276,7 @@ func (c *CostTracker) costCall(call InterpretableCall, args []ref.Val, result re if tracker, found := c.overloadTrackers[call.OverloadID()]; found { callCost := tracker(args, result) if callCost != nil { - cost = safeAdd(cost, *callCost) + cost += *callCost return cost } } @@ -268,7 +284,7 @@ func (c *CostTracker) costCall(call InterpretableCall, args []ref.Val, result re if c.Estimator != nil { callCost := c.Estimator.CallCost(call.Function(), call.OverloadID(), args, result) if callCost != nil { - cost = safeAdd(cost, *callCost) + cost += *callCost return cost } } @@ -276,14 +292,12 @@ func (c *CostTracker) costCall(call InterpretableCall, args []ref.Val, result re // if user has their own implementation of ActualCostEstimator, make sure to cover the mapping between overloadId and cost calculation switch call.OverloadID() { // O(n) functions - case overloads.StartsWithString, overloads.EndsWithString: - cost = safeAdd(cost, uint64(math.Ceil(float64(actualSize(args[1]))*common.StringTraversalCostFactor))) - case overloads.StringToBytes, overloads.BytesToString, overloads.ExtQuoteString, overloads.ExtFormatString: - cost = safeAdd(cost, uint64(math.Ceil(float64(actualSize(args[0]))*common.StringTraversalCostFactor))) + case overloads.StartsWithString, overloads.EndsWithString, overloads.StringToBytes, overloads.BytesToString, overloads.ExtQuoteString, overloads.ExtFormatString: + cost += uint64(math.Ceil(float64(actualSize(args[0])) * common.StringTraversalCostFactor)) case overloads.InList: // If a list is composed entirely of constant values this is O(1), but we don't account for that here. // We just assume all list containment checks are O(n). - cost = safeAdd(cost, actualSize(args[1])) + cost += actualSize(args[1]) // O(min(m, n)) functions case overloads.LessString, overloads.GreaterString, overloads.LessEqualsString, overloads.GreaterEqualsString, overloads.LessBytes, overloads.GreaterBytes, overloads.LessEqualsBytes, overloads.GreaterEqualsBytes, @@ -293,14 +307,17 @@ func (c *CostTracker) costCall(call InterpretableCall, args []ref.Val, result re // of 1. lhsSize := actualSize(args[0]) rhsSize := actualSize(args[1]) - minSize := min(rhsSize, lhsSize) - cost = safeAdd(cost, uint64(math.Ceil(float64(minSize)*common.StringTraversalCostFactor))) + minSize := lhsSize + if rhsSize < minSize { + minSize = rhsSize + } + cost += uint64(math.Ceil(float64(minSize) * common.StringTraversalCostFactor)) // O(m+n) functions case overloads.AddString, overloads.AddBytes: // In the worst case scenario, we would need to reallocate a new backing store and copy both operands over. - cost = safeAdd(cost, uint64(math.Ceil(float64(actualSize(args[0])+actualSize(args[1]))*common.StringTraversalCostFactor))) + cost += uint64(math.Ceil(float64(actualSize(args[0])+actualSize(args[1])) * common.StringTraversalCostFactor)) // O(nm) functions - case overloads.Matches, overloads.MatchesString: + case overloads.MatchesString: // https://swtch.com/~rsc/regexp/regexp1.html applies to RE2 implementation supported by CEL // Add one to string length for purposes of cost calculation to prevent product of string and regex to be 0 // in case where string is empty but regex is still expensive. @@ -311,11 +328,11 @@ func (c *CostTracker) costCall(call InterpretableCall, args []ref.Val, result re // For now, we're making a guess that each expression in a regex is typically at least 4 chars // in length. regexCost := uint64(math.Ceil(float64(actualSize(args[1])) * common.RegexStringLengthCostFactor)) - cost = safeAdd(cost, strCost*regexCost) + cost += strCost * regexCost case overloads.ContainsString: strCost := uint64(math.Ceil(float64(actualSize(args[0])) * common.StringTraversalCostFactor)) substrCost := uint64(math.Ceil(float64(actualSize(args[1])) * common.StringTraversalCostFactor)) - cost = safeAdd(cost, strCost*substrCost) + cost += strCost * substrCost default: // The following operations are assumed to have O(1) complexity. @@ -325,7 +342,7 @@ func (c *CostTracker) costCall(call InterpretableCall, args []ref.Val, result re // - Computing the size of strings, byte sequences, lists and maps. // - Logical operations and all operators on fixed width scalars (comparisons, equality) // - Any functions that don't have a declared cost either here or in provided ActualCostEstimator. - cost = safeAdd(cost, 1) + cost++ } return cost @@ -380,7 +397,7 @@ func (s *refValStack) drop(ids ...int64) { // the stack. // WARNING: It is possible for multiple expressions with the same ID to exist (due to how macros are implemented) so it's // possible that a dropped ID will remain on the stack. They should be removed when IDs on the stack are popped. -func (s *refValStack) dropArgs(args []InterpretableV2) ([]ref.Val, bool) { +func (s *refValStack) dropArgs(args []Interpretable) ([]ref.Val, bool) { result := make([]ref.Val, len(args)) argloop: for nIdx := len(args) - 1; nIdx >= 0; nIdx-- { @@ -396,21 +413,3 @@ argloop: } return result, true } - -func safeAdd(x, y uint64, rest ...uint64) uint64 { - if y > 0 && x > math.MaxUint64-y { - return math.MaxUint64 - } - next := x + y - if len(rest) == 0 { - return next - } - return safeAdd(next, rest[0], rest[1:]...) -} - -func safeMul(x, y uint64) uint64 { - if y != 0 && x > math.MaxUint64/y { - return math.MaxUint64 - } - return x * y -} diff --git a/vendor/github.com/google/cel-go/parser/helper.go b/vendor/github.com/google/cel-go/parser/helper.go index 84bef80d5f..c13296dd5c 100644 --- a/vendor/github.com/google/cel-go/parser/helper.go +++ b/vendor/github.com/google/cel-go/parser/helper.go @@ -45,10 +45,6 @@ func (p *parserHelper) getSourceInfo() *ast.SourceInfo { return p.sourceInfo } -func (p *parserHelper) expressionCount() int64 { - return p.nextID - 1 -} - func (p *parserHelper) newLiteral(ctx any, value ref.Val) ast.Expr { return p.exprFactory.NewLiteral(p.newID(ctx), value) } @@ -163,7 +159,7 @@ func (p *parserHelper) id(ctx any) int64 { offset.Start = p.sourceInfo.ComputeOffset(int32(c.GetLine()), int32(c.GetColumn())) offset.Stop = offset.Start + int32(len(c.GetText())) case common.Location: - offset.Start = p.sourceInfo.ComputeOffsetAbsolute(int32(c.Line()), int32(c.Column())) + offset.Start = p.sourceInfo.ComputeOffset(int32(c.Line()), int32(c.Column())) offset.Stop = offset.Start case ast.OffsetRange: offset = c diff --git a/vendor/github.com/google/cel-go/parser/options.go b/vendor/github.com/google/cel-go/parser/options.go index 281021f122..4eb30f83e0 100644 --- a/vendor/github.com/google/cel-go/parser/options.go +++ b/vendor/github.com/google/cel-go/parser/options.go @@ -22,7 +22,6 @@ type options struct { errorRecoveryTokenLookaheadLimit int errorRecoveryLimit int expressionSizeCodePointLimit int - maxExpressionNodeCount int macros map[string]Macro populateMacroCalls bool enableOptionalSyntax bool @@ -98,18 +97,6 @@ func ExpressionSizeCodePointLimit(expressionSizeCodePointLimit int) Option { } } -// MaxExpressionNodeCount limits the maximum number of expression nodes that may be emitted by the parser, -// including nodes created by macro expansion. -func MaxExpressionNodeCount(limit int) Option { - return func(opts *options) error { - if limit < -1 { - return fmt.Errorf("max expression node count must be greater than or equal to -1: %d", limit) - } - opts.maxExpressionNodeCount = limit - return nil - } -} - // Macros adds the given macros to the parser. func Macros(macros ...Macro) Option { return func(opts *options) error { diff --git a/vendor/github.com/google/cel-go/parser/parser.go b/vendor/github.com/google/cel-go/parser/parser.go index 338233543d..b5ec73ec64 100644 --- a/vendor/github.com/google/cel-go/parser/parser.go +++ b/vendor/github.com/google/cel-go/parser/parser.go @@ -42,7 +42,6 @@ type Parser struct { func NewParser(opts ...Option) (*Parser, error) { p := &Parser{} p.enableHiddenAccumulatorName = true - p.enableIdentEscapeSyntax = true for _, opt := range opts { if err := opt(&p.options); err != nil { return nil, err @@ -72,12 +71,6 @@ func NewParser(opts ...Option) (*Parser, error) { if p.expressionSizeCodePointLimit == -1 { p.expressionSizeCodePointLimit = int((^uint(0)) >> 1) } - if p.maxExpressionNodeCount == 0 { - p.maxExpressionNodeCount = 100_000 - } - if p.maxExpressionNodeCount == -1 { - p.maxExpressionNodeCount = int((^uint(0)) >> 1) - } // Bool is false by default, so populateMacroCalls will be false by default return p, nil } @@ -108,7 +101,6 @@ func (p *Parser) Parse(source common.Source) (*ast.AST, *common.Errors) { helper: newParserHelper(source, fac), macros: p.macros, maxRecursionDepth: p.maxRecursionDepth, - maxExpressionNodeCount: p.maxExpressionNodeCount, errorReportingLimit: p.errorReportingLimit, errorRecoveryLimit: p.errorRecoveryLimit, errorRecoveryLookaheadTokenLimit: p.errorRecoveryTokenLookaheadLimit, @@ -326,7 +318,6 @@ type parser struct { recursionDepth int errorReports int maxRecursionDepth int - maxExpressionNodeCount int errorReportingLimit int errorRecoveryLimit int errorRecoveryLookaheadTokenLimit int @@ -972,21 +963,11 @@ func (p *parser) expandMacro(exprID int64, function string, target ast.Expr, arg return nil, false } } - if int(p.helper.expressionCount()) > p.maxExpressionNodeCount { - loc := p.helper.getLocation(exprID) - p.helper.deleteID(exprID) - return p.reportError(loc, "expression count exceeds limit of %d while expanding macro '%s'", p.maxExpressionNodeCount, function), true - } eh := exprHelperPool.Get().(*exprHelper) defer exprHelperPool.Put(eh) eh.parserHelper = p.helper eh.id = exprID expr, err := macro.Expander()(eh, target, args) - if int(p.helper.expressionCount()) > p.maxExpressionNodeCount { - loc := p.helper.getLocation(exprID) - p.helper.deleteID(exprID) - return p.reportError(loc, "expression count exceeds limit of %d while expanding macro '%s'", p.maxExpressionNodeCount, function), true - } // An error indicates that the macro was matched, but the arguments were not well-formed. if err != nil { loc := err.Location diff --git a/vendor/github.com/google/cel-go/parser/unparser.go b/vendor/github.com/google/cel-go/parser/unparser.go index d503a450e9..ffd5b18e47 100644 --- a/vendor/github.com/google/cel-go/parser/unparser.go +++ b/vendor/github.com/google/cel-go/parser/unparser.go @@ -297,7 +297,7 @@ func (un *unparser) visitConstVal(val ref.Val) error { // represent the float using the minimum required digits d := strconv.FormatFloat(float64(val), 'g', -1, 64) un.str.WriteString(d) - if !strings.ContainsAny(d, ".eE") { + if !strings.Contains(d, ".") { un.str.WriteString(".0") } case types.Int: diff --git a/vendor/github.com/stoewer/go-strcase/.gitignore b/vendor/github.com/stoewer/go-strcase/.gitignore new file mode 100644 index 0000000000..db5247b944 --- /dev/null +++ b/vendor/github.com/stoewer/go-strcase/.gitignore @@ -0,0 +1,17 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +vendor +doc + +# Temporary files +*~ +*.swp + +# Editor and IDE config +.idea +*.iml +.vscode diff --git a/vendor/github.com/stoewer/go-strcase/.golangci.yml b/vendor/github.com/stoewer/go-strcase/.golangci.yml new file mode 100644 index 0000000000..0e75d86ae0 --- /dev/null +++ b/vendor/github.com/stoewer/go-strcase/.golangci.yml @@ -0,0 +1,19 @@ +version: "2" + +linters: + enable: + - dupl + - goconst + - gocyclo + - godox + - gosec + - lll + - misspell + - prealloc + - staticcheck + - unconvert + - unparam + +formatters: + enable: + - gofmt diff --git a/vendor/github.com/stoewer/go-strcase/LICENSE b/vendor/github.com/stoewer/go-strcase/LICENSE new file mode 100644 index 0000000000..a105a3819a --- /dev/null +++ b/vendor/github.com/stoewer/go-strcase/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017, Adrian Stoewer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/stoewer/go-strcase/README.md b/vendor/github.com/stoewer/go-strcase/README.md new file mode 100644 index 0000000000..84a640e714 --- /dev/null +++ b/vendor/github.com/stoewer/go-strcase/README.md @@ -0,0 +1,50 @@ +[![GH Actions](https://github.com/stoewer/go-strcase/actions/workflows/lint-test.yml/badge.svg?branch=master)](https://github.com/stoewer/go-strcase/actions) +[![codecov](https://codecov.io/github/stoewer/go-strcase/branch/master/graph/badge.svg?token=c0UokYnop5)](https://codecov.io/github/stoewer/go-strcase) +[![GoDoc](https://godoc.org/github.com/stoewer/go-strcase?status.svg)](https://pkg.go.dev/github.com/stoewer/go-strcase) +--- + +Go strcase +========== + +The package `strcase` converts between different kinds of naming formats such as camel case +(`CamelCase`), snake case (`snake_case`) or kebab case (`kebab-case`). +The package is designed to work only with strings consisting of standard ASCII letters. +Unicode is currently not supported. + +Versioning and stability +------------------------ + +Although the master branch is supposed to remain always backward compatible, the repository +contains version tags in order to support vendoring tools. +The tag names follow semantic versioning conventions and have the following format `v1.0.0`. +This package supports Go modules introduced with version 1.11. + +Example +------- + +```go +import "github.com/stoewer/go-strcase" + +var snake = strcase.SnakeCase("CamelCase") +``` + +Dependencies +------------ + +### Build dependencies + +* none + +### Test dependencies + +* `github.com/stretchr/testify` + +Run linters and unit tests +-------------------------- + +To run the static code analysis, linters and tests use the following commands: + +``` +golangci-lint run --config .golangci.yml ./... +go test ./... +``` diff --git a/vendor/github.com/stoewer/go-strcase/camel.go b/vendor/github.com/stoewer/go-strcase/camel.go new file mode 100644 index 0000000000..7a9bec7c10 --- /dev/null +++ b/vendor/github.com/stoewer/go-strcase/camel.go @@ -0,0 +1,43 @@ +// Copyright (c) 2017, A. Stoewer +// All rights reserved. + +package strcase + +import ( + "strings" +) + +// UpperCamelCase converts a string into camel case starting with a upper case letter. +func UpperCamelCase(s string) string { + return camelCase(s, true) +} + +// LowerCamelCase converts a string into camel case starting with a lower case letter. +func LowerCamelCase(s string) string { + return camelCase(s, false) +} + +func camelCase(s string, upper bool) string { + s = strings.TrimSpace(s) + buffer := make([]rune, 0, len(s)) + + stringIter(s, func(prev, curr, next rune) { + if !isDelimiter(curr) { + if isDelimiter(prev) || (upper && prev == 0) { + buffer = append(buffer, toUpper(curr)) + } else if isLower(prev) { + buffer = append(buffer, curr) + } else if isUpper(prev) && isUpper(curr) && isLower(next) { + // Assume a case like "R" for "XRequestId" + buffer = append(buffer, curr) + } else if isUpper(curr) && isDigit(prev) { + // Preserve uppercase letters after numbers + buffer = append(buffer, curr) + } else { + buffer = append(buffer, toLower(curr)) + } + } + }) + + return string(buffer) +} diff --git a/vendor/github.com/stoewer/go-strcase/doc.go b/vendor/github.com/stoewer/go-strcase/doc.go new file mode 100644 index 0000000000..3e441ca3ef --- /dev/null +++ b/vendor/github.com/stoewer/go-strcase/doc.go @@ -0,0 +1,8 @@ +// Copyright (c) 2017, A. Stoewer +// All rights reserved. + +// Package strcase converts between different kinds of naming formats such as camel case +// (CamelCase), snake case (snake_case) or kebab case (kebab-case). The package is designed +// to work only with strings consisting of standard ASCII letters. Unicode is currently not +// supported. +package strcase diff --git a/vendor/github.com/stoewer/go-strcase/helper.go b/vendor/github.com/stoewer/go-strcase/helper.go new file mode 100644 index 0000000000..96e79d6e13 --- /dev/null +++ b/vendor/github.com/stoewer/go-strcase/helper.go @@ -0,0 +1,77 @@ +// Copyright (c) 2017, A. Stoewer +// All rights reserved. + +package strcase + +// isLower checks if a character is lower case. More precisely it evaluates if it is +// in the range of ASCII character 'a' to 'z'. +func isLower(ch rune) bool { + return ch >= 'a' && ch <= 'z' +} + +// toLower converts a character in the range of ASCII characters 'A' to 'Z' to its lower +// case counterpart. Other characters remain the same. +func toLower(ch rune) rune { + if ch >= 'A' && ch <= 'Z' { + return ch + 32 + } + return ch +} + +// isLower checks if a character is upper case. More precisely it evaluates if it is +// in the range of ASCII characters 'A' to 'Z'. +func isUpper(ch rune) bool { + return ch >= 'A' && ch <= 'Z' +} + +// toLower converts a character in the range of ASCII characters 'a' to 'z' to its lower +// case counterpart. Other characters remain the same. +func toUpper(ch rune) rune { + if ch >= 'a' && ch <= 'z' { + return ch - 32 + } + return ch +} + +// isSpace checks if a character is some kind of whitespace. +func isSpace(ch rune) bool { + return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r' +} + +// isDigit checks if a character is a digit. More precisely it evaluates if it is +// in the range of ASCII characters '0' to '9'. +func isDigit(ch rune) bool { + return ch >= '0' && ch <= '9' +} + +// isDelimiter checks if a character is some kind of whitespace or '_' or '-'. +func isDelimiter(ch rune) bool { + return ch == '-' || ch == '_' || isSpace(ch) +} + +// iterFunc is a callback that is called fro a specific position in a string. Its arguments are the +// rune at the respective string position as well as the previous and the next rune. If curr is at the +// first position of the string prev is zero. If curr is at the end of the string next is zero. +type iterFunc func(prev, curr, next rune) + +// stringIter iterates over a string, invoking the callback for every single rune in the string. +func stringIter(s string, callback iterFunc) { + var prev rune + var curr rune + for _, next := range s { + if curr == 0 { + prev = curr + curr = next + continue + } + + callback(prev, curr, next) + + prev = curr + curr = next + } + + if len(s) > 0 { + callback(prev, curr, 0) + } +} diff --git a/vendor/github.com/stoewer/go-strcase/kebab.go b/vendor/github.com/stoewer/go-strcase/kebab.go new file mode 100644 index 0000000000..e9a6487579 --- /dev/null +++ b/vendor/github.com/stoewer/go-strcase/kebab.go @@ -0,0 +1,14 @@ +// Copyright (c) 2017, A. Stoewer +// All rights reserved. + +package strcase + +// KebabCase converts a string into kebab case. +func KebabCase(s string) string { + return delimiterCase(s, '-', false) +} + +// UpperKebabCase converts a string into kebab case with capital letters. +func UpperKebabCase(s string) string { + return delimiterCase(s, '-', true) +} diff --git a/vendor/github.com/stoewer/go-strcase/snake.go b/vendor/github.com/stoewer/go-strcase/snake.go new file mode 100644 index 0000000000..1b216e20cf --- /dev/null +++ b/vendor/github.com/stoewer/go-strcase/snake.go @@ -0,0 +1,58 @@ +// Copyright (c) 2017, A. Stoewer +// All rights reserved. + +package strcase + +import ( + "strings" +) + +// SnakeCase converts a string into snake case. +func SnakeCase(s string) string { + return delimiterCase(s, '_', false) +} + +// UpperSnakeCase converts a string into snake case with capital letters. +func UpperSnakeCase(s string) string { + return delimiterCase(s, '_', true) +} + +// delimiterCase converts a string into snake_case or kebab-case depending on the delimiter passed +// as second argument. When upperCase is true the result will be UPPER_SNAKE_CASE or UPPER-KEBAB-CASE. +func delimiterCase(s string, delimiter rune, upperCase bool) string { + s = strings.TrimSpace(s) + buffer := make([]rune, 0, len(s)+3) + + adjustCase := toLower + if upperCase { + adjustCase = toUpper + } + + var prev rune + var curr rune + for _, next := range s { + if isDelimiter(curr) { + if !isDelimiter(prev) { + buffer = append(buffer, delimiter) + } + } else if isUpper(curr) { + if isLower(prev) || (isUpper(prev) && isLower(next)) { + buffer = append(buffer, delimiter) + } + buffer = append(buffer, adjustCase(curr)) + } else if curr != 0 { + buffer = append(buffer, adjustCase(curr)) + } + prev = curr + curr = next + } + + if len(s) > 0 { + if isUpper(curr) && isLower(prev) && prev != 0 { + buffer = append(buffer, delimiter) + } + buffer = append(buffer, adjustCase(curr)) + } + + return string(buffer) +} diff --git a/vendor/go.opentelemetry.io/otel/.golangci.yml b/vendor/go.opentelemetry.io/otel/.golangci.yml index 8a7f1ec5d9..db1f55101c 100644 --- a/vendor/go.opentelemetry.io/otel/.golangci.yml +++ b/vendor/go.opentelemetry.io/otel/.golangci.yml @@ -96,9 +96,9 @@ linters: - "!**/exporters/zipkin/**" deny: - pkg: go.opentelemetry.io/otel/semconv - desc: "Use go.opentelemetry.io/otel/semconv/v1.43.0 instead. If a newer semconv version has been released, update the depguard rule." + desc: "Use go.opentelemetry.io/otel/semconv/v1.40.0 instead. If a newer semconv version has been released, update the depguard rule." allow: - - go.opentelemetry.io/otel/semconv/v1.43.0 + - go.opentelemetry.io/otel/semconv/v1.40.0 gocritic: disabled-checks: - appendAssign @@ -134,16 +134,13 @@ linters: strconcat: true revive: confidence: 0.01 - enable-all-rules: false - enable-default-rules: true - max-open-files: 2048 rules: - name: blank-imports - name: bool-literal-in-expr - name: constant-logical-expr - name: context-as-argument arguments: - - allow-types-before: '*testing.T' + - allowTypesBefore: '*testing.T' disabled: true - name: context-keys-type - name: deep-exit @@ -155,7 +152,7 @@ linters: - name: duplicated-imports - name: early-return arguments: - - preserve-scope + - preserveScope - name: empty-block - name: empty-lines - name: error-naming @@ -164,7 +161,7 @@ linters: - name: errorf - name: exported arguments: - - say-repetitive-instead-of-stutters + - sayRepetitiveInsteadOfStutters - name: flag-parameter - name: identical-branches - name: if-return @@ -172,12 +169,11 @@ linters: - name: increment-decrement - name: indent-error-flow arguments: - - preserve-scope + - preserveScope - name: package-comments - name: range - name: range-val-in-closure - name: range-val-address - - name: receiver-naming - name: redefines-builtin-id - name: string-format arguments: @@ -187,7 +183,7 @@ linters: - name: struct-tag - name: superfluous-else arguments: - - preserve-scope + - preserveScope - name: time-equal - name: unconditional-recursion - name: unexported-return diff --git a/vendor/go.opentelemetry.io/otel/.lycheeignore b/vendor/go.opentelemetry.io/otel/.lycheeignore index df0d328bf8..994b677df7 100644 --- a/vendor/go.opentelemetry.io/otel/.lycheeignore +++ b/vendor/go.opentelemetry.io/otel/.lycheeignore @@ -11,17 +11,3 @@ http://4.3.2.1:78/user/123 file:///home/runner/work/opentelemetry-go/opentelemetry-go/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/dns:/:4317 # URL works, but it has blocked link checkers. https://dl.acm.org/doi/10.1145/198429.198435 -https://pkg.go.dev/google.golang.org/grpc.*internal/resolver -https://golang.org/src/crypto/tls/generate_cert.go -https://github.com/grpc/grpc/blob/.*/doc/naming.md -https://github.com/open-telemetry/opentelemetry-specification/blob/.* -# Fake domains used in otlp options_test.go tests -https?://env\.endpoint.* -https?://env\.metrics\.endpoint.* -https?://env_metrics_endpoint.* -https?://env\.traces\.endpoint.* -https?://env_traces_endpoint.* -https?://someendpoint.* -https?://overrode\.by\.signal\.specific.* -https?://overrode_by_signal_specific.* -https?://proxy\.com.* diff --git a/vendor/go.opentelemetry.io/otel/AGENTS.md b/vendor/go.opentelemetry.io/otel/AGENTS.md deleted file mode 100644 index 02db715284..0000000000 --- a/vendor/go.opentelemetry.io/otel/AGENTS.md +++ /dev/null @@ -1,112 +0,0 @@ -# Agent Guide for opentelemetry-go - -This file contains active, task-oriented instructions for autonomous and semi-autonomous coding agents working in this repository. - -Before starting any task, read `.github/copilot-instructions.md`, `CONTRIBUTING.md`, and this file. -Treat `.github/copilot-instructions.md` as global passive guidance for every task, including docs-only and review-only work. - -## Core expectations - -- Preserve OpenTelemetry specification compliance, API stability, and idiomatic Go. -- Prefer minimal, surgical changes over broad refactors or speculative cleanup. -- Read the package you are editing and match its existing naming, option types, error handling, comments, tests, and concurrency patterns. -- Keep public APIs backward compatible unless the task explicitly requires a breaking change. -- Keep telemetry resilient and loosely coupled. Do not introduce behavior that can unexpectedly interfere with host applications. -- Inspect boundaries carefully: input validation, resource limits, cancellation, shutdown, error propagation, concurrency, and memory growth. -- Prefer fail-safe behavior and explicit invariants over implicit assumptions. -- Keep dependencies minimal and justified. -- Preserve host-application safety: telemetry should not panic, block indefinitely, or amplify attacker-controlled input. -- Be conservative on hot paths. Avoid unnecessary allocations, reflection, interface churn, blocking, global state, and high-cardinality telemetry. -- Write comments only for intent, invariants, and non-obvious constraints. Do not add comments that restate the code. - -## Default workflow - -For new features and behavior changes, use this order unless the task explicitly says otherwise: - -1. Read the relevant package, its tests, and any package docs or `README.md`. -2. Add or update a failing unit test that captures the required behavior or regression. -3. Implement the smallest change that makes the test pass. -4. Refactor only after the behavior is locked in, and only if the refactor keeps the diff focused. -5. If the changed code is on a hot path or performance-sensitive, inspect existing benchmarks and run them. Add a benchmark if coverage is missing. -6. Update documentation artifacts as needed while the context is fresh. Follow the documentation and changelog conventions below for the specific updates required. -7. Run `make precommit` each time before considering the work complete. - -For docs-only, test-only, or review-only tasks, still start with the required repository guidance above, then skip the workflow steps that do not apply while keeping the same discipline around scope, verification, and repository conventions. - -## Verification - -- Use `make` as the canonical repository verification command. The default target is `precommit`. -- `make precommit` is the expected final verification step for linting, generation, README checks, module checks, and tests. -- During iteration, targeted commands are fine for fast feedback, but do not stop there if the task changes code. -- If you touch performance-sensitive code, run focused benchmarks and compare the results using `benchstat` in addition to `make`. - -## Documentation and changelog - -- Non-internal, non-test packages should have Go doc comments, usually in `doc.go`. -- Non-internal, non-test, non-documentation packages should also have a `README.md` with at least a title and a `pkg.go.dev` badge. -- Prefer examples over long code snippets in GoDoc when practical. -- Keep docs aligned with actual behavior. Do not leave stale comments, stale examples, or stale package documentation behind. -- For user-visible changes, update `CHANGELOG.md` under the appropriate `Added`, `Changed`, `Deprecated`, `Fixed`, or `Removed` section within `## [Unreleased]`. - - Always put the PR number at the end of the line (e.g., `(#1234)`), NOT the issue number. - - If the PR number is not yet known, omit it until the PR is created, then update the changelog entry before merging. - - Always use references to the go module that is updated (e.g., `go.opentelemetry.io/otel/sdk/metric`), instead of just the path (e.g., `sdk/metric`). - -## Repository habits - -- Prefer focused diffs. Avoid drive-by cleanup. -- Follow existing option patterns and exported API conventions instead of inventing new abstractions. -- Generated files are checked in. If your change affects generation, keep generated output up to date. -- Prefer fast local search tools such as `rg` when exploring the repository. -- When changing behavior, make the invariants explicit in tests. - -## Personas - -### Feature Agent - -Use this persona for new behavior, new API surface, or spec-driven feature work. - -- Start with a failing unit test. -- Confirm the expected behavior against the spec, existing package behavior, and public API compatibility. -- Implement the smallest viable change. -- Update GoDoc, examples, `README.md`, and `CHANGELOG.md` when the change is user-visible. -- If the feature touches a hot path, check benchmarks and add one if the coverage is missing. - -### Refactoring Agent - -Use this persona when improving structure without intentionally changing behavior. - -- Treat behavior preservation as the default contract. -- Add or tighten tests before moving code if current behavior is not already pinned down. -- Avoid broad rewrites, clever abstractions, or package-wide cleanup unless explicitly requested. -- If a refactor touches a hot path, benchmark before and after. -- Keep API shape, semantics, concurrency guarantees, and failure modes unchanged unless the task says otherwise. - -### Test Agent - -Use this persona when adding missing coverage, reproducing bugs, or hardening regressions. - -- Reproduce the bug or missing behavior with the smallest failing test you can. -- Prefer testing public behavior and externally visible invariants. -- Add targeted regression tests before changing production code. -- Only change production code when it is required to make the tested behavior correct or testable. -- Keep tests deterministic, readable, and aligned with package patterns. - -### Performance Agent - -Use this persona for hot-path work, allocation reduction, or throughput and latency improvements. - -- Benchmark first to establish a baseline. -- Prefer changes that reduce allocations, copying, interface churn, and unnecessary synchronization. -- Do not trade away correctness, spec compliance, or API stability for micro-optimizations. -- Add or update benchmarks when performance-sensitive coverage is missing. -- If you materially change a hot path, capture before-and-after results, preferably with `benchstat`. - -### Review Agent - -Use this persona when asked to review code, patches, or pull requests. - -- Lead with findings, not summaries. -- Order findings by severity and include precise file and line references when available. -- Focus on correctness, spec compliance, API compatibility, concurrency safety, resilience, performance regressions, missing tests, missing benchmarks, documentation gaps, and changelog gaps. -- Call out when a diff is broader than necessary. -- If you find no issues, say that explicitly and note any residual risks or verification gaps. diff --git a/vendor/go.opentelemetry.io/otel/CHANGELOG.md b/vendor/go.opentelemetry.io/otel/CHANGELOG.md index 2db588ea27..20edda4418 100644 --- a/vendor/go.opentelemetry.io/otel/CHANGELOG.md +++ b/vendor/go.opentelemetry.io/otel/CHANGELOG.md @@ -11,169 +11,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm -## [1.45.0/0.67.0/0.21.0/0.0.18] - 2026-08-03 - -### Added - -- Add experimental observability metrics to `BatchProcessor` in `go.opentelemetry.io/otel/sdk/log`. (#7124) -- Add the experimental `WithUnsafeAttributes` no-copy attribute option to `go.opentelemetry.io/otel/metric/x` for future performance improvements. This API is a work in progress. (#8251) -- Add `Map` and `MapValue` functions for the new `MAP` attribute type in `go.opentelemetry.io/otel/attribute`. (#8445) -- Support `MAP` attributes in `go.opentelemetry.io/otel/exporters/otlp/otlptrace`. (#8453) -- Support `MAP` attributes in `go.opentelemetry.io/otel/exporters/otlp/otlplog`. (#8453) -- Support `MAP` attributes in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#8453) -- Support `MAP` attributes in `go.opentelemetry.io/otel/exporters/zipkin`. (#8453) -- Apply `AttributeValueLengthLimit` recursively to values contained in `attribute.MAP` attributes in `go.opentelemetry.io/otel/sdk/trace`. (#8454) -- Remove duplicate keys from `attribute.MAP` values in `go.opentelemetry.io/otel/sdk/resource` using last-value-wins semantics. (#8471) -- Remove duplicate keys by default from `attribute.MAP` values in instrumentation scope attributes in `go.opentelemetry.io/otel/sdk/log` using last-value-wins semantics. (#8471) -- Remove duplicate keys by default from `attribute.MAP` values in span, event, link, and instrumentation scope attributes in `go.opentelemetry.io/otel/sdk/trace` using last-value-wins semantics. (#8471) -- Remove duplicate keys by default from `attribute.MAP` values in measurement and instrumentation scope attributes in `go.opentelemetry.io/otel/sdk/metric` using last-value-wins semantics. (#8471) -- Extend `WithAllowKeyDuplication` in `go.opentelemetry.io/otel/sdk/log` to disable duplicate-key removal in `attribute.MAP` values for instrumentation scope attributes. (#8471) -- Add the `go.opentelemetry.io/otel/semconv/v1.42.0` package. - The package contains semantic conventions from the `v1.42.0` version of the OpenTelemetry Semantic Conventions. - See the [migration documentation](./semconv/v1.42.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.41.0`. (#8484) -- Add `WithoutPanicRecording` as a `TracerProviderOption` in `go.opentelemetry.io/otel/sdk/trace` to disable exception event recording for panics. (#8532) -- Add the `go.opentelemetry.io/otel/semconv/v1.43.0` package. - The package contains semantic conventions from the `v1.43.0` version of the OpenTelemetry Semantic Conventions. - See the [migration documentation](./semconv/v1.43.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.42.0`. (#8628) - -### Changed - -- `HistogramReservoir` in `go.opentelemetry.io/otel/sdk/metric/exemplar` now uses a time-unbiased sampling algorithm for exemplars. (#8306) -- ⚠️ **Breaking Change:** Use `go.opentelemetry.io/otel/attribute.Value` and `go.opentelemetry.io/otel/attribute.KeyValue` for log bodies and attributes in `go.opentelemetry.io/otel/log`, `go.opentelemetry.io/otel/log/logtest`, `go.opentelemetry.io/otel/sdk/log`, and `go.opentelemetry.io/otel/sdk/log/logtest`. (#8490) -- Encode log bodies and attributes as `go.opentelemetry.io/otel/attribute.Value` JSON in `go.opentelemetry.io/otel/exporters/stdout/stdoutlog`. (#8490) -- Improve the performance of hashing `BOOLSLICE`, `INT64SLICE`, `FLOAT64SLICE`, and `STRINGSLICE` attribute values by avoiding reflection for short slices in `go.opentelemetry.io/otel/attribute`. (#8511) -- ⚠️ **Breaking Change:** `WithEndpointURL` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` no longer appends the default signal path when an endpoint URL has no path, making the behavior consistent with `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` and with setting the endpoint through `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT`. If the URL has no path component, the root path (`/`) is used. Use `WithEndpointURL(url.JoinPath(endpoint, "/v1/metrics"))` to preserve the previous behavior. (#8538) -- ⚠️ **Breaking Change:** `WithEndpointURL` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` no longer appends the default signal path when an endpoint URL has no path, making the behavior consistent with `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` and with setting the endpoint through `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`. If the URL has no path component, the root path (`/`) is used. Use `WithEndpointURL(url.JoinPath(endpoint, "/v1/traces"))` to preserve the previous behavior. (#8538) - -### Deprecated - -- Deprecate `WithExportBufferSize` in `go.opentelemetry.io/otel/sdk/log`. The option remains available for source compatibility but no longer affects behavior; `BatchProcessor` no longer maintains a separate export-request buffer. (#8620) - -### Removed - -- ⚠️ **Breaking Change:** Remove `Kind`, `Value`, `KeyValue`, their constructors, and attribute conversion helpers from `go.opentelemetry.io/otel/log`. (#8490) -- ⚠️ **Breaking Change:** Remove the `AttributeValueLengthLimit` and `AttributeCountLimit` fields from `RecordFactory` in `go.opentelemetry.io/otel/sdk/log/logtest`; records produced by the factory now keep attribute limits disabled so test code can append exact attributes. (#8556) - -### Fixed - -- Apply TLS certificates configured through environment variables to gRPC connections in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. -- Prevent panics in `go.opentelemetry.io/otel/bridge/opentracing` when OpenTracing baggage is propagated concurrently with `Span.SetBaggageItem`. -- Fix an off-by-one error in `FixedSizeReservoir` in `go.opentelemetry.io/otel/sdk/metric/exemplar` that prevented the first exemplar from being sampled after the reservoir was filled. (#8309) -- Interpret HTTP `Retry-After` header values as seconds instead of nanoseconds when retrying OTLP HTTP exports in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`, `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`, and `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#8383) -- Fix a memory leak in the `Reservoir` implementation in `go.opentelemetry.io/otel/sdk/metric/exemplar`, where storing the full `context.Context` pinned large objects such as gRPC transport buffers. (#8389) -- Prevent a non-empty attribute set whose computed hash is zero from collapsing to an empty set in `go.opentelemetry.io/otel/attribute`. (#8402) -- Fix histogram data point reuse in `go.opentelemetry.io/otel/sdk/metric` aggregation to avoid leaking stale sum, minimum, and maximum values when they are disabled in subsequent collections. (#8403) -- Avoid preallocating scope attributes when they are disabled in `go.opentelemetry.io/otel/exporters/prometheus`. (#8404) -- Support HTTP-date values in the HTTP `Retry-After` header when retrying OTLP HTTP exports in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`, `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`, and `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#8417) -- Reduce histogram heap allocations by reusing `BucketCounts` and `Exemplars` slices across `Collect` cycles in the cumulative histogram aggregation in `go.opentelemetry.io/otel/sdk/metric`. (#8428) -- Fix `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` self-observability to record `error.type` on the operation-duration histogram when the `exportedSpans` metric is disabled. (#8432) -- Stop including trace exporter endpoint configuration in internal logs from `go.opentelemetry.io/otel/sdk/trace`, `go.opentelemetry.io/otel/exporters/otlp/otlptrace`, `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`, `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`, and `go.opentelemetry.io/otel/exporters/zipkin`. (#8438) -- Fix invalid error formatting for out-of-range JSON code values in `go.opentelemetry.io/otel/codes`. (#8497) -- Clarify in `go.opentelemetry.io/otel/log` that `Logger.Enabled` should be checked for every log emission because its result may change over time. (#8565) -- Preserve user-provided exception attributes while independently deriving missing exception message and type attributes in `go.opentelemetry.io/otel/sdk/log`. (#8566) -- Make `WithAttributeCountLimit(0)` and `OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT=0` discard all log record attributes in `go.opentelemetry.io/otel/sdk/log`. (#8570) -- Clarify that the `Record` methods of `Float64Histogram` and `Int64Histogram` in `go.opentelemetry.io/otel/metric` expect non-negative values. (#8574) -- Clarify in `go.opentelemetry.io/otel/log` that `LoggerProvider` implementations should retain an empty `Logger` name instead of replacing it with a default. (#8587) -- Ensure that the built-in processors in `go.opentelemetry.io/otel/sdk/log` call exporter `ForceFlush` during `Shutdown`. (#8599) -- Prevent processor operations in `go.opentelemetry.io/otel/sdk/log` from overlapping with processor shutdown or running after `LoggerProvider` shutdown. (#8608) -- Prevent `BatchProcessor` in `go.opentelemetry.io/otel/sdk/log` from busy-spinning under exporter backpressure and serialize dequeue, export, force-flush, and shutdown work in one worker. (#8620) -- Make `BatchProcessor` in `go.opentelemetry.io/otel/sdk/log` return errors encountered while draining records during `ForceFlush` and `Shutdown`, while continuing to attempt later batches as long as the request context remains valid. (#8620) -- Keep the default `BatchProcessor` maximum export batch size in `go.opentelemetry.io/otel/sdk/log` at or below the configured maximum queue size. (#8620) - -## [1.44.0/0.66.0/0.20.0/0.0.17] 2026-05-27 - -### Added - -- Add `ByteSlice` and `ByteSliceValue` functions for new `BYTESLICE` attribute type in `go.opentelemetry.io/otel/attribute`. (#7948) -- Apply attribute value limit to the `KindBytes` attribute type in `go.opentelemetry.io/otel/sdk/log`. (#7990) -- Apply attribute value limit to the `BYTESLICE` attribute type in `go.opentelemetry.io/otel/sdk/trace`. (#7990) -- Support `BYTESLICE` attributes in `go.opentelemetry.io/otel/trace`. (#8153) -- Support `BYTESLICE` attributes in `go.opentelemetry.io/otel/exporters/otlp/otlptrace`. (#8153) -- Support `BYTESLICE` attributes in `go.opentelemetry.io/otel/exporters/otlp/otlplog`. (#8153) -- Support `BYTESLICE` attributes in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#8153) -- Support `BYTESLICE` attributes in `go.opentelemetry.io/otel/exporters/zipkin`. (#8153) -- Add `String` method for `Value` type in `go.opentelemetry.io/otel/attribute`. (#8142) -- Add `Slice` and `SliceValue` functions for new `SLICE` attribute type in `go.opentelemetry.io/otel/attribute`. (#8166) -- Support `SLICE` attributes in `go.opentelemetry.io/otel/exporters/otlp/otlptrace`. (#8216) -- Support `SLICE` attributes in `go.opentelemetry.io/otel/exporters/otlp/otlplog`. (#8216) -- Support `SLICE` attributes in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#8216) -- Support `SLICE` attributes in `go.opentelemetry.io/otel/exporters/zipkin`. (#8216) -- Apply `AttributeValueLengthLimit` to `attribute.SLICE` type attribute values in `go.opentelemetry.io/otel/sdk/trace`, recursively truncating contained string values. (#8217) -- Add `Error` field on `Record` type in `go.opentelemetry.io/otel/log/logtest`. (#8148) -- Add `WithMaxRequestSize` option in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#8157) -- Add `WithMaxRequestSize` option in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#8157) -- Add `WithMaxRequestSize` option in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#8157) -- Add `WithMaxRequestSize` option in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#8157) -- Add `WithMaxRequestSize` option in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. (#8157) -- Add `WithMaxRequestSize` option in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#8157) -- Add `Settable` to `go.opentelemetry.io/otel/metric/x` to allow reusing attribute options. (#8178) -- Add experimental support for splitting metric data across multiple batches in `go.opentelemetry.io/otel/sdk/metric`. - Set `OTEL_GO_X_METRIC_EXPORT_BATCH_SIZE=` to enable for all periodic readers. - See `go.opentelemetry.io/otel/sdk/metric/internal/x` for feature documentation. (#8071) -- Add experimental self-observability metrics in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. - Enable with `OTEL_GO_X_OBSERVABILITY=true` environment variable. - See `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/x` for feature documentation. (#8192) -- Add experimental self-observability metrics in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. - Enable with `OTEL_GO_X_OBSERVABILITY=true` environment variable. - See `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/x` for feature documentation. (#8194) -- Add experimental self-observability metrics in `go.opentelemetry.io/otel/exporters/stdout/stdoutlog`. - Enable with `OTEL_GO_X_OBSERVABILITY=true` environment variable. - See `go.opentelemetry.io/otel/stdout/stdoutlog/internal/x` for feature documentation. (#8263) -- Add `WithDefaultAttributes` to `go.opentelemetry.io/otel/metric/x` to support setting default attributes on instruments. (#8135) -- Add `go.opentelemetry.io/otel/semconv/v1.41.0` package. - The package contains semantic conventions from the `v1.41.0` version of the OpenTelemetry Semantic Conventions. - See the [migration documentation](./semconv/v1.41.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.40.0`. (#8324) -- Add Observable variants of instruments to `go.opentelemetry.io/otel/semconv/v1.41.0` package. (#8350) -- Generate explicit histogram bucket boundaries from weaver configuration for HTTP and RPC duration instruments in `go.opentelemetry.io/otel/semconv/v1.41.0`. (#8002) - -### Changed - -- ⚠️ **Breaking Change:** `go.opentelemetry.io/otel/sdk/metric` now applies a default cardinality limit of 2000 to comply with the Metrics SDK specification recommendation. - New attribute sets are dropped when the cardinality limit is reached. The measurement of these sets are aggregated into a special attribute set containing `attribute.Bool("otel.metric.overflow", true)`. - This can break users who relied on the previous unlimited default. - Set `WithCardinalityLimit(0)` or the deprecated `OTEL_GO_X_CARDINALITY_LIMIT=0` environment variable to preserve unlimited cardinality. - Note that support for `OTEL_GO_X_CARDINALITY_LIMIT` may be removed in a future release. (#8247) -- `ErrorType` in `go.opentelemetry.io/otel/semconv` now unwraps errors created with `fmt.Errorf` when deriving the `error.type` attribute. (#8133) -- `go.opentelemetry.io/otel/sdk/log` now unwraps error chains created with `fmt.Errorf` when deriving the `error.type` attribute from errors on log records. (#8133) -- `Set.MarshalLog` method in `go.opentelemetry.io/otel/attribute` now uses `Value.String` formatting following the [OpenTelemetry AnyValue representation for non-OTLP protocols](https://opentelemetry.io/docs/specs/otel/common/#anyvalue). (#8169) -- Optimize `go.opentelemetry.io/otel/sdk/metric` to return a drop reservoir and short-circuit `Offer` calls to the exemplar reservoir when `exemplar.AlwaysOffFilter` is configured. (#8211) (#8267) -- Optimize `go.opentelemetry.io/otel/sdk/metric` to return a drop reservoir for asynchronous instruments when `exemplar.TraceBasedFilter` is configured. (#8286) - -### Deprecated - -- Deprecate `Value.Emit` method in `go.opentelemetry.io/otel/attribute`. - Use `Value.String` instead. (#8176) - -### Fixed - -- Limit OTLP request size to 64 MiB by default in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. - The limit applies before compression, oversized requests are treated as non-retryable errors, and the limit can be configured with the new `WithMaxRequestSize` option. (#8157, #8365) -- Limit OTLP request size to 64 MiB by default in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. - The limit applies before compression, oversized requests are treated as non-retryable errors, and the limit can be configured with the new `WithMaxRequestSize` option. (#8157, #8365) -- Limit OTLP request size to 64 MiB by default in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. - The limit applies before compression, oversized requests are treated as non-retryable errors, and the limit can be configured with the new `WithMaxRequestSize` option. (#8157, #8365) -- Limit OTLP request size to 64 MiB by default in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. - The limit applies before compression, oversized requests are treated as non-retryable errors, and the limit can be configured with the new `WithMaxRequestSize` option. (#8157, #8365) -- Limit OTLP request size to 64 MiB by default in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. - The limit applies before compression, oversized requests are treated as non-retryable errors, and the limit can be configured with the new `WithMaxRequestSize` option. (#8157, #8365) -- Limit OTLP request size to 64 MiB by default in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. - The limit applies before compression, oversized requests are treated as non-retryable errors, and the limit can be configured with the new `WithMaxRequestSize` option. (#8157, #8365) -- Fix gzipped request body replay on redirect in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#8135) -- Fix gzipped request body replay on redirect in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#8152) -- `go.opentelemetry.io/otel/exporters/prometheus` now uses `Value.String` formatting for label values following the [OpenTelemetry AnyValue representation for non-OTLP protocols](https://opentelemetry.io/docs/specs/otel/common/#anyvalue). (#8170) -- Propagate errors from the exporter when calling `Shutdown` on `BatchSpanProcessor` in `go.opentelemetry.io/otel/sdk/trace`. (#8197) -- Fix stale status code reporting on self-observability metrics in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` and `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#8226) -- Fix a concurrent `Collect` data race and potential panic in `go.opentelemetry.io/otel/exporters/prometheus` when `WithResourceAsConstantLabels` option is used. (#8227) -- Fix race condition in `FixedSizeReservoir` in `go.opentelemetry.io/otel/sdk/metric/exemplar` by reverting #7447. (#8249) -- Fix `FixedSizeReservoir` in `go.opentelemetry.io/otel/sdk/metric/exemplar` to safely handle zero size. - A capacity check in the constructor initializes the reservoir safely and skips initialization for zero-cap; early returns in `Offer()` and `Collect()` ensure no-op behavior. (#8295) -- Fix counting of spans and logs in self-observability metrics in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`, `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`, `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`, and `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#8254) -- Drop conflicting scope attributes named `name`, `version`, or `schema_url` from metric labels in `go.opentelemetry.io/otel/exporters/prometheus`, preserving the dedicated `otel_scope_name`, `otel_scope_version`, and `otel_scope_schema_url` labels. (#8264) -- Close schema files opened by `ParseFile` in `go.opentelemetry.io/otel/schema/v1.0` and `go.opentelemetry.io/otel/schema/v1.1`. ([GHSA-995v-fvrw-c78m](https://github.com/open-telemetry/opentelemetry-go/security/advisories/GHSA-995v-fvrw-c78m)) -- Enforce the 8192-byte baggage size limit during extraction/parsing, changing behavior when the limit is exceeded in `go.opentelemetry.io/otel/baggage` and `go.opentelemetry.io/otel/propagation`. (#8222) -- Fix `go.opentelemetry.io/otel/semconv/v1.41.0` to include `Attr*` helper methods for required attributes on observable instruments. (#8361) -- Limit baggage extraction error reporting in `go.opentelemetry.io/otel/propagation` to prevent malformed or oversized baggage headers from flooding logs. ([GHSA-5wrp-cwcj-q835](https://github.com/open-telemetry/opentelemetry-go/security/advisories/GHSA-5wrp-cwcj-q835)) - ## [1.43.0/0.65.0/0.19.0] 2026-04-02 ### Added @@ -3782,9 +3619,7 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.45.0...HEAD -[1.45.0/0.67.0/0.21.0/0.0.18]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.45.0 -[1.44.0/0.66.0/0.20.0/0.0.17]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.44.0 +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.43.0...HEAD [1.43.0/0.65.0/0.19.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.43.0 [1.42.0/0.64.0/0.18.0/0.0.16]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.42.0 [1.41.0/0.63.0/0.17.0/0.0.15]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.41.0 diff --git a/vendor/go.opentelemetry.io/otel/CLAUDE.md b/vendor/go.opentelemetry.io/otel/CLAUDE.md deleted file mode 100644 index dd3c4594fc..0000000000 --- a/vendor/go.opentelemetry.io/otel/CLAUDE.md +++ /dev/null @@ -1,3 +0,0 @@ -# Instructions for Claude Code - -@AGENTS.md diff --git a/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md index 2aba71e196..12de3607a3 100644 --- a/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md +++ b/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md @@ -8,16 +8,8 @@ repo for information on this and other language SIGs. See the [public meeting notes](https://docs.google.com/document/d/1E5e7Ld0NuU1iVvf-42tOBpu2VBBLYnh73GJuITGJTTU/edit) for a summary description of past meetings. To request edit access, -join the meeting or get in touch on the -[#otel-go](https://cloud-native.slack.com/archives/C01NPAXACKT) -channel on CNCF Slack. If you are new to the CNCF Slack community, -you can [create an account](https://slack.cncf.io/). - -The meeting is open for all to join. We invite everyone to join our -meeting, regardless of your experience level. Whether you're a -seasoned OpenTelemetry developer, just starting your journey, or -simply curious about the work we do, you're more than welcome to -participate! +join the meeting or get in touch on +[Slack](https://cloud-native.slack.com/archives/C01NPAXACKT). ## Development @@ -754,8 +746,8 @@ Encapsulate setup in constructor functions, ensuring clear ownership and scope: import ( "errors" - semconv "go.opentelemetry.io/otel/semconv/v1.43.0" - "go.opentelemetry.io/otel/semconv/v1.43.0/otelconv" + semconv "go.opentelemetry.io/otel/semconv/v1.40.0" + "go.opentelemetry.io/otel/semconv/v1.40.0/otelconv" ) type SDKComponent struct { @@ -816,11 +808,11 @@ func (c *Component) initObservability() { #### Performance -When observability is disabled or the instrument is not `Enabled`, there should be little to no overhead. +When observability is disabled there should be little to no overhead. ```go func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) error { - if e.inst != nil && e.inst.Enabled(ctx) { + if e.inst != nil { attrs := expensiveOperation() e.inst.recordSpanInflight(ctx, int64(len(spans)), attrs...) } @@ -837,7 +829,7 @@ func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) } func (i *instrumentation) recordSpanInflight(ctx context.Context, count int64, attrs ...attribute.KeyValue) { - if i == nil || i.inflight == nil || !i.inflight.Enabled(ctx) { + if i == nil || i.inflight == nil { return } i.inflight.Add(ctx, count, metric.WithAttributes(attrs...)) @@ -873,12 +865,8 @@ var ( ) func (i *instrumentation) record(ctx context.Context, value int64, baseAttrs ...attribute.KeyValue) { - if !i.counter.Enabled(ctx) { - return - } attrs := attrPool.Get().(*[]attribute.KeyValue) defer func() { - clear(*attrs) // Clear references to strings/etc to let GC collect them. *attrs = (*attrs)[:0] // Reset. attrPool.Put(attrs) }() @@ -889,7 +877,6 @@ func (i *instrumentation) record(ctx context.Context, value int64, baseAttrs ... addOpt := addOptPool.Get().(*[]metric.AddOption) defer func() { - clear(*addOpt) *addOpt = (*addOpt)[:0] addOptPool.Put(addOpt) }() @@ -1020,20 +1007,16 @@ Ensure observability measurements receive the correct context, especially for tr ```go func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) error { // Use the provided context for observability measurements - if e.inst.Enabled(ctx) { - e.inst.recordSpanExportStarted(ctx, len(spans)) - } + e.inst.recordSpanExportStarted(ctx, len(spans)) err := e.doExport(ctx, spans) - if e.inst.Enabled(ctx) { - if err != nil { - e.inst.recordSpanExportFailed(ctx, len(spans), err) - } else { - e.inst.recordSpanExportSucceeded(ctx, len(spans)) - } + if err != nil { + e.inst.recordSpanExportFailed(ctx, len(spans), err) + } else { + e.inst.recordSpanExportSucceeded(ctx, len(spans)) } - + return err } ``` @@ -1056,7 +1039,7 @@ func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) All observability metrics should follow the [OpenTelemetry Semantic Conventions for SDK metrics](https://github.com/open-telemetry/semantic-conventions/blob/1cf2476ae5e518225a766990a28a6d5602bd5a30/docs/otel/sdk-metrics.md). -Use the metric semantic conventions convenience package [otelconv](./semconv/v1.43.0/otelconv/metric.go). +Use the metric semantic conventions convenience package [otelconv](./semconv/v1.40.0/otelconv/metric.go). ##### Component Identification @@ -1126,68 +1109,6 @@ func TestObservability(t *testing.T) { Test order should not affect results. Ensure that any global state (e.g. component ID counters) is reset between tests. -### Experimental Features - -To support the development of new features in the specification, we use the following patterns to implement in-development features without adding new public artifacts in stable modules. - -#### Experimental behavior with no API artifacts - -Features that change behavior without changing the API (e.g., exemplar collection, auto-generation of identifiers) are implemented behind a feature gate. -The implementation resides in an `/internal/x` package and is activated through environment variables with the `OTEL_GO_X_` prefix (e.g., `OTEL_GO_X_OBSERVABILITY`). -The feature must be documented in a `README.md` file in the `/internal/x` package. - -#### Experimental methods on SDK-only interfaces - -Features that require new methods on SDK interfaces are defined as a new interface in an experimental module (e.g., `go.opentelemetry.io/otel/sdk/x`). -The SDK uses type assertions (without importing the unstable package) to check if passing types implement these experimental interfaces. -The SDK must not depend on the experimental module. - -#### Experimental structs, functions, or interfaces - -Features that don't need any changes to the existing stable package are implemented in an experimental module (e.g., `go.opentelemetry.io/otel/sdk/x`). - -#### Experimental signals and components - -New telemetry signals (e.g., Logs before stabilization) and components (e.g. bridges) are hosted in new, unstable modules (e.g., `go.opentelemetry.io/otel/log` before 1.0.0). -The package should have the final name it will use once stabilized (i.e. not `/x`), and is released at a v0.x.y version to indicate it is not stable. -Most new components are hosted in [opentelemetry-go-contrib](https://github.com/open-telemetry/opentelemetry-go-contrib). - -#### Experimental options for API or SDK functions - -Experimental Options functions are implemented in an experimental module (e.g., `go.opentelemetry.io/otel/sdk/x`). -The return type of the Option function must embed the option's type (e.g. `metric.InstrumentOption`), and have an `Experimental()` method to prevent the API from panicking when the option is used. -The SDK uses type assertions (without importing the unstable package) to check if passing types implement these experimental interfaces. -The SDK must not depend on the experimental module. - -For example: - -```go -type myOption struct { - // Embed the stable option type. - metric.InstrumentOption - value string -} - -// Experimental prevents the API from panicking when the option is used. -func (o myOption) Experimental() {} - -// The SDK can use type assertions to use this function. -func (o myOption) Value() string { return o.value } - -func WithMyOption(value string) metric.InstrumentOption { - return myOption{value: value} -} -``` - -#### Not Supported - -The following kinds of experimental features are **not currently supported** on stable interfaces: - -- Experimental methods on API interfaces -- Experimental fields for API or SDK exported structs - -In some cases forks or long-lived branches may be used for prototyping these features. - ## Approvers and Maintainers ### Maintainers diff --git a/vendor/go.opentelemetry.io/otel/Makefile b/vendor/go.opentelemetry.io/otel/Makefile index d4711257df..42466f2d6a 100644 --- a/vendor/go.opentelemetry.io/otel/Makefile +++ b/vendor/go.opentelemetry.io/otel/Makefile @@ -10,7 +10,6 @@ ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} GO = go TIMEOUT = 60 -GO_VERSION := $(shell awk '/^go [0-9]/ {print $$2; exit}' go.mod) # User to run as in docker images. DOCKER_USER=$(shell id -u):$(shell id -g) @@ -20,7 +19,7 @@ DEPENDENCIES_DOCKERFILE=./dependencies.Dockerfile .PHONY: precommit ci precommit: generate toolchain-check license-check misspell go-mod-tidy golangci-lint-fix verify-readmes verify-mods test-default -ci: generate toolchain-check license-check lint verify-readmes verify-mods build test-default check-clean-work-tree test-coverage +ci: generate toolchain-check license-check lint vanity-import-check verify-readmes verify-mods build test-default check-clean-work-tree test-coverage # Tools @@ -60,6 +59,9 @@ $(TOOLS)/gocovmerge: PACKAGE=github.com/wadey/gocovmerge STRINGER = $(TOOLS)/stringer $(TOOLS)/stringer: PACKAGE=golang.org/x/tools/cmd/stringer +PORTO = $(TOOLS)/porto +$(TOOLS)/porto: PACKAGE=github.com/jcchavezs/porto/cmd/porto + GOTMPL = $(TOOLS)/gotmpl $(GOTMPL): PACKAGE=go.opentelemetry.io/build-tools/gotmpl @@ -70,7 +72,7 @@ GOVULNCHECK = $(TOOLS)/govulncheck $(TOOLS)/govulncheck: PACKAGE=golang.org/x/vuln/cmd/govulncheck .PHONY: tools -tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(VERIFYREADMES) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) $(GORELEASE) +tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(VERIFYREADMES) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) $(GORELEASE) # Virtualized python tools via docker @@ -108,7 +110,7 @@ $(CODESPELL): PACKAGE=codespell # Generate .PHONY: generate -generate: go-generate +generate: go-generate vanity-import-fix .PHONY: go-generate go-generate: $(OTEL_GO_MOD_DIRS:%=go-generate/%) @@ -118,10 +120,14 @@ go-generate/%: $(STRINGER) $(GOTMPL) && cd $(DIR) \ && PATH="$(TOOLS):$${PATH}" $(GO) generate ./... +.PHONY: vanity-import-fix +vanity-import-fix: $(PORTO) + @$(PORTO) --include-internal -w . + # Generate go.work file for local development. .PHONY: go-work go-work: $(CROSSLINK) - $(CROSSLINK) work --root=$(shell pwd) --go=$(GO_VERSION) + $(CROSSLINK) work --root=$(shell pwd) --go=1.22.7 # Build @@ -185,16 +191,8 @@ benchmark: $(OTEL_GO_MOD_DIRS:%=benchmark/%) benchmark/%: cd $* && $(GO) test -run='^$$' -bench=. $(ARGS) ./... -# sdk/metric is split into two shards to work around CodSpeed limitations. -# See https://github.com/CodSpeedHQ/codspeed-go/issues/56 -BENCHMARK_SHARDS := $(filter-out ./sdk/metric,$(OTEL_GO_MOD_DIRS)) ./sdk/metric/root ./sdk/metric/internal -benchmark/./sdk/metric/root: - cd ./sdk/metric && $(GO) test -run='^$$' -bench=. $(ARGS) . ./exemplar/... -benchmark/./sdk/metric/internal: - cd ./sdk/metric && $(GO) test -run='^$$' -bench=. $(ARGS) ./internal/... - print-sharded-benchmarks: - @echo $(BENCHMARK_SHARDS) | jq -cR 'split(" ")' + @echo $(OTEL_GO_MOD_DIRS) | jq -cR 'split(" ")' .PHONY: golangci-lint golangci-lint-fix golangci-lint-fix: ARGS=--fix @@ -222,6 +220,10 @@ go-mod-tidy/%: crosslink .PHONY: lint lint: misspell go-mod-tidy golangci-lint +.PHONY: vanity-import-check +vanity-import-check: $(PORTO) + @$(PORTO) --include-internal -l . || ( echo "(run: make vanity-import-fix)"; exit 1 ) + .PHONY: misspell misspell: $(MISSPELL) @$(MISSPELL) -w $(ALL_DOCS) diff --git a/vendor/go.opentelemetry.io/otel/README.md b/vendor/go.opentelemetry.io/otel/README.md index ce97e9a251..16a72004c0 100644 --- a/vendor/go.opentelemetry.io/otel/README.md +++ b/vendor/go.opentelemetry.io/otel/README.md @@ -113,10 +113,3 @@ All officially supported exporters for the OpenTelemetry project are contained i ## Contributing See the [contributing documentation](CONTRIBUTING.md). - -### Emeritus - -- [Alex Kats](https://github.com/akats7), Triager - -For more information about the emeritus role, see the -[community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#emeritus-maintainerapprovertriager). diff --git a/vendor/go.opentelemetry.io/otel/attribute/doc.go b/vendor/go.opentelemetry.io/otel/attribute/doc.go index c543f2ca6a..eef51ebc2a 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/doc.go +++ b/vendor/go.opentelemetry.io/otel/attribute/doc.go @@ -2,4 +2,4 @@ // SPDX-License-Identifier: Apache-2.0 // Package attribute provides key and value attributes. -package attribute +package attribute // import "go.opentelemetry.io/otel/attribute" diff --git a/vendor/go.opentelemetry.io/otel/attribute/encoder.go b/vendor/go.opentelemetry.io/otel/attribute/encoder.go index 413e7a185b..771dd69c55 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/encoder.go +++ b/vendor/go.opentelemetry.io/otel/attribute/encoder.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package attribute +package attribute // import "go.opentelemetry.io/otel/attribute" import ( "bytes" @@ -105,9 +105,7 @@ func (d *defaultAttrEncoder) Encode(iter Iterator) string { if keyValue.Value.Type() == STRING { copyAndEscape(buf, keyValue.Value.AsString()) } else { - _, _ = buf.WriteString( - keyValue.Value.Emit(), - ) //nolint:staticcheck // Preserve the existing default encoder output. + _, _ = buf.WriteString(keyValue.Value.Emit()) } } return buf.String() diff --git a/vendor/go.opentelemetry.io/otel/attribute/filter.go b/vendor/go.opentelemetry.io/otel/attribute/filter.go index 6dab64f5d7..624ebbe381 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/filter.go +++ b/vendor/go.opentelemetry.io/otel/attribute/filter.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package attribute +package attribute // import "go.opentelemetry.io/otel/attribute" // Filter supports removing certain attributes from attribute sets. When // the filter returns true, the attribute will be kept in the filtered diff --git a/vendor/go.opentelemetry.io/otel/attribute/hash.go b/vendor/go.opentelemetry.io/otel/attribute/hash.go index f651eb13d9..b09caaa6d7 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/hash.go +++ b/vendor/go.opentelemetry.io/otel/attribute/hash.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package attribute +package attribute // import "go.opentelemetry.io/otel/attribute" import ( "fmt" @@ -27,9 +27,6 @@ const ( int64SliceID uint64 = 3762322556277578591 // "_[]int64" (little endian) float64SliceID uint64 = 7308324551835016539 // "[]double" (little endian) stringSliceID uint64 = 7453010373645655387 // "[]string" (little endian) - byteSliceID uint64 = 6874028470941080415 // "_[]byte_" (little endian) - sliceID uint64 = 7883494272577650031 // "__slice_" (little endian) - mapID uint64 = 6872316492666199903 // "__map___" (little endian) emptyID uint64 = 7305809155345288421 // "__empty_" (little endian) ) @@ -39,201 +36,58 @@ func hashKVs(kvs []KeyValue) uint64 { for _, kv := range kvs { h = hashKV(h, kv) } - sum := h.Sum64() - // Remap 0 to a non-zero value for non-empty input because hash == 0 is a reserved sentinel (treated as empty/invalid). - const remappedZeroHash uint64 = 1 - if sum == 0 && len(kvs) > 0 { - return remappedZeroHash - } - return sum + return h.Sum64() } // hashKV returns the xxHash64 hash of kv with h as the base. func hashKV(h xxhash.Hash, kv KeyValue) xxhash.Hash { h = h.String(string(kv.Key)) - return hashValue(h, kv.Value) -} -func hashValue(h xxhash.Hash, v Value) xxhash.Hash { - switch v.Type() { + switch kv.Value.Type() { case BOOL: h = h.Uint64(boolID) - h = h.Uint64(v.numeric) + h = h.Uint64(kv.Value.numeric) case INT64: h = h.Uint64(int64ID) - h = h.Uint64(v.numeric) + h = h.Uint64(kv.Value.numeric) case FLOAT64: h = h.Uint64(float64ID) // Assumes numeric stored with math.Float64bits. - h = h.Uint64(v.numeric) + h = h.Uint64(kv.Value.numeric) case STRING: h = h.Uint64(stringID) - h = h.String(v.stringly) + h = h.String(kv.Value.stringly) case BOOLSLICE: h = h.Uint64(boolSliceID) - switch vals := v.slice.(type) { - case [0]bool: - case [1]bool: - h = h.Bool(vals[0]) - case [2]bool: - h = h.Bool(vals[0]) - h = h.Bool(vals[1]) - case [3]bool: - h = h.Bool(vals[0]) - h = h.Bool(vals[1]) - h = h.Bool(vals[2]) - default: - rv := reflect.ValueOf(v.slice) - for i := 0; i < rv.Len(); i++ { - h = h.Bool(rv.Index(i).Bool()) - } + rv := reflect.ValueOf(kv.Value.slice) + for i := 0; i < rv.Len(); i++ { + h = h.Bool(rv.Index(i).Bool()) } case INT64SLICE: h = h.Uint64(int64SliceID) - switch vals := v.slice.(type) { - case [0]int64: - case [1]int64: - h = h.Int64(vals[0]) - case [2]int64: - h = h.Int64(vals[0]) - h = h.Int64(vals[1]) - case [3]int64: - h = h.Int64(vals[0]) - h = h.Int64(vals[1]) - h = h.Int64(vals[2]) - default: - rv := reflect.ValueOf(v.slice) - for i := 0; i < rv.Len(); i++ { - h = h.Int64(rv.Index(i).Int()) - } + rv := reflect.ValueOf(kv.Value.slice) + for i := 0; i < rv.Len(); i++ { + h = h.Int64(rv.Index(i).Int()) } case FLOAT64SLICE: h = h.Uint64(float64SliceID) - switch vals := v.slice.(type) { - case [0]float64: - case [1]float64: - h = h.Float64(vals[0]) - case [2]float64: - h = h.Float64(vals[0]) - h = h.Float64(vals[1]) - case [3]float64: - h = h.Float64(vals[0]) - h = h.Float64(vals[1]) - h = h.Float64(vals[2]) - default: - rv := reflect.ValueOf(v.slice) - for i := 0; i < rv.Len(); i++ { - h = h.Float64(rv.Index(i).Float()) - } + rv := reflect.ValueOf(kv.Value.slice) + for i := 0; i < rv.Len(); i++ { + h = h.Float64(rv.Index(i).Float()) } case STRINGSLICE: h = h.Uint64(stringSliceID) - switch vals := v.slice.(type) { - case [0]string: - case [1]string: - h = h.String(vals[0]) - case [2]string: - h = h.String(vals[0]) - h = h.String(vals[1]) - case [3]string: - h = h.String(vals[0]) - h = h.String(vals[1]) - h = h.String(vals[2]) - default: - rv := reflect.ValueOf(v.slice) - for i := 0; i < rv.Len(); i++ { - h = h.String(rv.Index(i).String()) - } - } - case BYTESLICE: - h = h.Uint64(byteSliceID) - h = h.String(v.stringly) - case SLICE: - h = h.Uint64(sliceID) - switch vals := v.slice.(type) { - case [0]Value: - // No values to hash, but the type identifier is still hashed above. - case [1]Value: - h = hashValue(h, vals[0]) - case [2]Value: - h = hashValue(h, vals[0]) - h = hashValue(h, vals[1]) - case [3]Value: - h = hashValue(h, vals[0]) - h = hashValue(h, vals[1]) - h = hashValue(h, vals[2]) - case [4]Value: - h = hashValue(h, vals[0]) - h = hashValue(h, vals[1]) - h = hashValue(h, vals[2]) - h = hashValue(h, vals[3]) - case [5]Value: - h = hashValue(h, vals[0]) - h = hashValue(h, vals[1]) - h = hashValue(h, vals[2]) - h = hashValue(h, vals[3]) - h = hashValue(h, vals[4]) - default: - rv := reflect.ValueOf(v.slice) - for i := 0; i < rv.Len(); i++ { - h = hashValue(h, rv.Index(i).Interface().(Value)) - } - } - case MAP: - h = h.Uint64(mapID) - switch vals := v.slice.(type) { - case [0]KeyValue: - // No values to hash, but the type identifier is still hashed above. - case [1]KeyValue: - h = h.String(string(vals[0].Key)) - h = hashValue(h, vals[0].Value) - case [2]KeyValue: - h = h.String(string(vals[0].Key)) - h = hashValue(h, vals[0].Value) - h = h.String(string(vals[1].Key)) - h = hashValue(h, vals[1].Value) - case [3]KeyValue: - h = h.String(string(vals[0].Key)) - h = hashValue(h, vals[0].Value) - h = h.String(string(vals[1].Key)) - h = hashValue(h, vals[1].Value) - h = h.String(string(vals[2].Key)) - h = hashValue(h, vals[2].Value) - case [4]KeyValue: - h = h.String(string(vals[0].Key)) - h = hashValue(h, vals[0].Value) - h = h.String(string(vals[1].Key)) - h = hashValue(h, vals[1].Value) - h = h.String(string(vals[2].Key)) - h = hashValue(h, vals[2].Value) - h = h.String(string(vals[3].Key)) - h = hashValue(h, vals[3].Value) - case [5]KeyValue: - h = h.String(string(vals[0].Key)) - h = hashValue(h, vals[0].Value) - h = h.String(string(vals[1].Key)) - h = hashValue(h, vals[1].Value) - h = h.String(string(vals[2].Key)) - h = hashValue(h, vals[2].Value) - h = h.String(string(vals[3].Key)) - h = hashValue(h, vals[3].Value) - h = h.String(string(vals[4].Key)) - h = hashValue(h, vals[4].Value) - default: - rv := reflect.ValueOf(v.slice) - for i := 0; i < rv.Len(); i++ { - kv := rv.Index(i).Interface().(KeyValue) - h = h.String(string(kv.Key)) - h = hashValue(h, kv.Value) - } + rv := reflect.ValueOf(kv.Value.slice) + for i := 0; i < rv.Len(); i++ { + h = h.String(rv.Index(i).String()) } case EMPTY: h = h.Uint64(emptyID) default: // Logging is an alternative, but using the internal logger here // causes an import cycle so it is not done. - val := v.AsInterface() - msg := fmt.Sprintf("unknown value type: %[1]v (%[1]T)", val) + v := kv.Value.AsInterface() + msg := fmt.Sprintf("unknown value type: %[1]v (%[1]T)", v) panic(msg) } return h diff --git a/vendor/go.opentelemetry.io/otel/attribute/internal/attribute.go b/vendor/go.opentelemetry.io/otel/attribute/internal/attribute.go index ec4a5f07fa..d9f51fa2d7 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/internal/attribute.go +++ b/vendor/go.opentelemetry.io/otel/attribute/internal/attribute.go @@ -5,7 +5,7 @@ Package attribute provide several helper functions for some commonly used logic of processing attributes. */ -package attribute +package attribute // import "go.opentelemetry.io/otel/attribute/internal" import ( "reflect" diff --git a/vendor/go.opentelemetry.io/otel/attribute/internal/xxhash/xxhash.go b/vendor/go.opentelemetry.io/otel/attribute/internal/xxhash/xxhash.go index c851179cca..113a978383 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/internal/xxhash/xxhash.go +++ b/vendor/go.opentelemetry.io/otel/attribute/internal/xxhash/xxhash.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Package xxhash provides a wrapper around the xxhash library for attribute hashing. -package xxhash +package xxhash // import "go.opentelemetry.io/otel/attribute/internal/xxhash" import ( "encoding/binary" diff --git a/vendor/go.opentelemetry.io/otel/attribute/iterator.go b/vendor/go.opentelemetry.io/otel/attribute/iterator.go index 1afd00ff08..8df6249f02 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/iterator.go +++ b/vendor/go.opentelemetry.io/otel/attribute/iterator.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package attribute +package attribute // import "go.opentelemetry.io/otel/attribute" // Iterator allows iterating over the set of attributes in order, sorted by // key. diff --git a/vendor/go.opentelemetry.io/otel/attribute/key.go b/vendor/go.opentelemetry.io/otel/attribute/key.go index 6403191c27..80a9e5643f 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/key.go +++ b/vendor/go.opentelemetry.io/otel/attribute/key.go @@ -1,16 +1,16 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package attribute +package attribute // import "go.opentelemetry.io/otel/attribute" // Key represents the key part in key-value pairs. It's a string. The // allowed character set in the key depends on the use of the key. type Key string -// Bool returns a [KeyValue] for a bool value. +// Bool creates a KeyValue instance with a BOOL Value. // -// If creating both a key and value at the same time, use the package-level -// [Bool] function. +// If creating both a key and value at the same time, use the provided +// convenience function instead -- Bool(name, value). func (k Key) Bool(v bool) KeyValue { return KeyValue{ Key: k, @@ -18,15 +18,10 @@ func (k Key) Bool(v bool) KeyValue { } } -// BoolSlice returns a [KeyValue] for a []bool value. +// BoolSlice creates a KeyValue instance with a BOOLSLICE Value. // -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. -// -// If creating both a key and value at the same time, use the package-level -// [BoolSlice] function. +// If creating both a key and value at the same time, use the provided +// convenience function instead -- BoolSlice(name, value). func (k Key) BoolSlice(v []bool) KeyValue { return KeyValue{ Key: k, @@ -34,12 +29,10 @@ func (k Key) BoolSlice(v []bool) KeyValue { } } -// Int returns a [KeyValue] for an int value. -// -// It is provided as a convenience for [Key.Int64]. +// Int creates a KeyValue instance with an INT64 Value. // -// If creating both a key and value at the same time, use the package-level [Int] -// function. +// If creating both a key and value at the same time, use the provided +// convenience function instead -- Int(name, value). func (k Key) Int(v int) KeyValue { return KeyValue{ Key: k, @@ -47,17 +40,10 @@ func (k Key) Int(v int) KeyValue { } } -// IntSlice returns a [KeyValue] for a []int value. -// -// It is provided as a convenience for [Key.Int64Slice]. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. +// IntSlice creates a KeyValue instance with an INT64SLICE Value. // -// If creating both a key and value at the same time, use the package-level -// [IntSlice] function. +// If creating both a key and value at the same time, use the provided +// convenience function instead -- IntSlice(name, value). func (k Key) IntSlice(v []int) KeyValue { return KeyValue{ Key: k, @@ -65,10 +51,10 @@ func (k Key) IntSlice(v []int) KeyValue { } } -// Int64 returns a [KeyValue] for an int64 value. +// Int64 creates a KeyValue instance with an INT64 Value. // -// If creating both a key and value at the same time, use the package-level -// [Int64] function. +// If creating both a key and value at the same time, use the provided +// convenience function instead -- Int64(name, value). func (k Key) Int64(v int64) KeyValue { return KeyValue{ Key: k, @@ -76,15 +62,10 @@ func (k Key) Int64(v int64) KeyValue { } } -// Int64Slice returns a [KeyValue] for a []int64 value. +// Int64Slice creates a KeyValue instance with an INT64SLICE Value. // -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. -// -// If creating both a key and value at the same time, use the package-level -// [Int64Slice] function. +// If creating both a key and value at the same time, use the provided +// convenience function instead -- Int64Slice(name, value). func (k Key) Int64Slice(v []int64) KeyValue { return KeyValue{ Key: k, @@ -92,10 +73,10 @@ func (k Key) Int64Slice(v []int64) KeyValue { } } -// Float64 returns a [KeyValue] for a float64 value. +// Float64 creates a KeyValue instance with a FLOAT64 Value. // -// If creating both a key and value at the same time, use the package-level -// [Float64] function. +// If creating both a key and value at the same time, use the provided +// convenience function instead -- Float64(name, value). func (k Key) Float64(v float64) KeyValue { return KeyValue{ Key: k, @@ -103,15 +84,10 @@ func (k Key) Float64(v float64) KeyValue { } } -// Float64Slice returns a [KeyValue] for a []float64 value. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. +// Float64Slice creates a KeyValue instance with a FLOAT64SLICE Value. // -// If creating both a key and value at the same time, use the package-level -// [Float64Slice] function. +// If creating both a key and value at the same time, use the provided +// convenience function instead -- Float64(name, value). func (k Key) Float64Slice(v []float64) KeyValue { return KeyValue{ Key: k, @@ -119,10 +95,10 @@ func (k Key) Float64Slice(v []float64) KeyValue { } } -// String returns a [KeyValue] for a string value. +// String creates a KeyValue instance with a STRING Value. // -// If creating both a key and value at the same time, use the package-level -// [String] function. +// If creating both a key and value at the same time, use the provided +// convenience function instead -- String(name, value). func (k Key) String(v string) KeyValue { return KeyValue{ Key: k, @@ -130,15 +106,10 @@ func (k Key) String(v string) KeyValue { } } -// StringSlice returns a [KeyValue] for a []string value. +// StringSlice creates a KeyValue instance with a STRINGSLICE Value. // -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. -// -// If creating both a key and value at the same time, use the package-level -// [StringSlice] function. +// If creating both a key and value at the same time, use the provided +// convenience function instead -- StringSlice(name, value). func (k Key) StringSlice(v []string) KeyValue { return KeyValue{ Key: k, @@ -146,59 +117,6 @@ func (k Key) StringSlice(v []string) KeyValue { } } -// ByteSlice returns a [KeyValue] for a []byte value. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. -// -// If creating both a key and value at the same time, use the package-level -// [ByteSlice] function. -func (k Key) ByteSlice(v []byte) KeyValue { - return KeyValue{ - Key: k, - Value: ByteSliceValue(v), - } -} - -// Slice returns a [KeyValue] for a []Value value. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. -// -// If creating both a key and value at the same time, use the package-level -// [Slice] function. -func (k Key) Slice(v ...Value) KeyValue { - return KeyValue{ - Key: k, - Value: SliceValue(v...), - } -} - -// Map returns a [KeyValue] for a []KeyValue value. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. -// -// Users should avoid providing duplicate keys; many receivers handle maps -// containing duplicate keys unpredictably. -// -// The order of v is not preserved. -// -// If creating both a key and value at the same time, use the package-level [Map] -// function. -func (k Key) Map(v ...KeyValue) KeyValue { - return KeyValue{ - Key: k, - Value: MapValue(v...), - } -} - // Defined reports whether the key is not empty. func (k Key) Defined() bool { return len(k) != 0 diff --git a/vendor/go.opentelemetry.io/otel/attribute/kv.go b/vendor/go.opentelemetry.io/otel/attribute/kv.go index c4f0dd9281..0cc368018b 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/kv.go +++ b/vendor/go.opentelemetry.io/otel/attribute/kv.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package attribute +package attribute // import "go.opentelemetry.io/otel/attribute" import ( "fmt" @@ -18,120 +18,56 @@ func (kv KeyValue) Valid() bool { return kv.Key.Defined() } -// Bool returns a [KeyValue] for a bool value. +// Bool creates a KeyValue with a BOOL Value type. func Bool(k string, v bool) KeyValue { return Key(k).Bool(v) } -// BoolSlice returns a [KeyValue] for a []bool value. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. +// BoolSlice creates a KeyValue with a BOOLSLICE Value type. func BoolSlice(k string, v []bool) KeyValue { return Key(k).BoolSlice(v) } -// Int returns a [KeyValue] for an int value. -// -// It is provided as a convenience for [Int64]. +// Int creates a KeyValue with an INT64 Value type. func Int(k string, v int) KeyValue { return Key(k).Int(v) } -// IntSlice returns a [KeyValue] for a []int value. -// -// It is provided as a convenience for [Int64Slice]. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. +// IntSlice creates a KeyValue with an INT64SLICE Value type. func IntSlice(k string, v []int) KeyValue { return Key(k).IntSlice(v) } -// Int64 returns a [KeyValue] for an int64 value. +// Int64 creates a KeyValue with an INT64 Value type. func Int64(k string, v int64) KeyValue { return Key(k).Int64(v) } -// Int64Slice returns a [KeyValue] for a []int64 value. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. +// Int64Slice creates a KeyValue with an INT64SLICE Value type. func Int64Slice(k string, v []int64) KeyValue { return Key(k).Int64Slice(v) } -// Float64 returns a [KeyValue] for a float64 value. +// Float64 creates a KeyValue with a FLOAT64 Value type. func Float64(k string, v float64) KeyValue { return Key(k).Float64(v) } -// Float64Slice returns a [KeyValue] for a []float64 value. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. +// Float64Slice creates a KeyValue with a FLOAT64SLICE Value type. func Float64Slice(k string, v []float64) KeyValue { return Key(k).Float64Slice(v) } -// String returns a [KeyValue] for a string value. +// String creates a KeyValue with a STRING Value type. func String(k, v string) KeyValue { return Key(k).String(v) } -// StringSlice returns a [KeyValue] for a []string value. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. +// StringSlice creates a KeyValue with a STRINGSLICE Value type. func StringSlice(k string, v []string) KeyValue { return Key(k).StringSlice(v) } -// ByteSlice returns a [KeyValue] for a []byte value. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. -func ByteSlice(k string, v []byte) KeyValue { - return Key(k).ByteSlice(v) -} - -// Slice returns a [KeyValue] for a []Value value. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. -func Slice(k string, v ...Value) KeyValue { - return Key(k).Slice(v...) -} - -// Map returns a [KeyValue] for a []KeyValue value. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. -// -// Users should avoid providing duplicate keys; many receivers handle maps -// containing duplicate keys unpredictably. -// -// The order of v is not preserved. -func Map(k string, v ...KeyValue) KeyValue { - return Key(k).Map(v...) -} - // Stringer creates a new key-value pair with a passed name and a string // value generated by the passed Stringer interface. func Stringer(k string, v fmt.Stringer) KeyValue { diff --git a/vendor/go.opentelemetry.io/otel/attribute/rawhelpers.go b/vendor/go.opentelemetry.io/otel/attribute/rawhelpers.go index 939e46f907..5791c6e7aa 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/rawhelpers.go +++ b/vendor/go.opentelemetry.io/otel/attribute/rawhelpers.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package attribute +package attribute // import "go.opentelemetry.io/otel/attribute" import ( "math" diff --git a/vendor/go.opentelemetry.io/otel/attribute/set.go b/vendor/go.opentelemetry.io/otel/attribute/set.go index 87d6f96200..6572c98b12 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/set.go +++ b/vendor/go.opentelemetry.io/otel/attribute/set.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package attribute +package attribute // import "go.opentelemetry.io/otel/attribute" import ( "cmp" @@ -401,7 +401,7 @@ func computeDataFixed(kvs []KeyValue) any { func computeDataReflect(kvs []KeyValue) any { at := reflect.New(reflect.ArrayOf(len(kvs), keyValueType)).Elem() for i, keyValue := range kvs { - *at.Index(i).Addr().Interface().(*KeyValue) = keyValue + *(at.Index(i).Addr().Interface().(*KeyValue)) = keyValue } return at.Interface() } @@ -415,7 +415,7 @@ func (l *Set) MarshalJSON() ([]byte, error) { func (l Set) MarshalLog() any { kvs := make(map[string]string) for _, kv := range l.ToSlice() { - kvs[string(kv.Key)] = kv.Value.String() + kvs[string(kv.Key)] = kv.Value.Emit() } return kvs } diff --git a/vendor/go.opentelemetry.io/otel/attribute/type_string.go b/vendor/go.opentelemetry.io/otel/attribute/type_string.go index ab5da22887..6c04448d6f 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/type_string.go +++ b/vendor/go.opentelemetry.io/otel/attribute/type_string.go @@ -17,14 +17,11 @@ func _() { _ = x[INT64SLICE-6] _ = x[FLOAT64SLICE-7] _ = x[STRINGSLICE-8] - _ = x[BYTESLICE-9] - _ = x[SLICE-10] - _ = x[MAP-11] } -const _Type_name = "EMPTYBOOLINT64FLOAT64STRINGBOOLSLICEINT64SLICEFLOAT64SLICESTRINGSLICEBYTESLICESLICEMAP" +const _Type_name = "EMPTYBOOLINT64FLOAT64STRINGBOOLSLICEINT64SLICEFLOAT64SLICESTRINGSLICE" -var _Type_index = [...]uint8{0, 5, 9, 14, 21, 27, 36, 46, 58, 69, 78, 83, 86} +var _Type_index = [...]uint8{0, 5, 9, 14, 21, 27, 36, 46, 58, 69} func (i Type) String() string { idx := int(i) - 0 diff --git a/vendor/go.opentelemetry.io/otel/attribute/value.go b/vendor/go.opentelemetry.io/otel/attribute/value.go index 07a0353a1e..db04b1326c 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/value.go +++ b/vendor/go.opentelemetry.io/otel/attribute/value.go @@ -1,29 +1,22 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package attribute +package attribute // import "go.opentelemetry.io/otel/attribute" import ( - "cmp" - "encoding/base64" "encoding/json" "fmt" - "math" - "reflect" - "slices" "strconv" - "strings" - "unicode/utf8" attribute "go.opentelemetry.io/otel/attribute/internal" ) //go:generate stringer -type=Type -// Type describes the kind of data a [Value] holds. +// Type describes the type of the data Value holds. type Type int // nolint: revive // redefines builtin Type. -// Value represents the value in key-value pairs. +// Value represents the value part in key-value pairs. // // Note that the zero value is a valid empty value. type Value struct { @@ -34,40 +27,31 @@ type Value struct { } const ( - // EMPTY identifies a Value with no data. + // EMPTY is used for a Value with no value set. EMPTY Type = iota - // BOOL identifies a Value containing a bool. + // BOOL is a boolean Type Value. BOOL - // INT64 identifies a Value containing an int64. + // INT64 is a 64-bit signed integral Type Value. INT64 - // FLOAT64 identifies a Value containing a float64. + // FLOAT64 is a 64-bit floating point Type Value. FLOAT64 - // STRING identifies a Value containing a string. + // STRING is a string Type Value. STRING - // BOOLSLICE identifies a Value containing a []bool. + // BOOLSLICE is a slice of booleans Type Value. BOOLSLICE - // INT64SLICE identifies a Value containing a []int64. + // INT64SLICE is a slice of 64-bit signed integral numbers Type Value. INT64SLICE - // FLOAT64SLICE identifies a Value containing a []float64. + // FLOAT64SLICE is a slice of 64-bit floating point numbers Type Value. FLOAT64SLICE - // STRINGSLICE identifies a Value containing a []string. + // STRINGSLICE is a slice of strings Type Value. STRINGSLICE - // BYTESLICE identifies a Value containing a []byte. - BYTESLICE - // SLICE identifies a Value containing a []Value. - SLICE - // MAP identifies a Value containing a []KeyValue representation of a map. - // - // Note that MAP values may contain duplicate keys if duplicate keys are - // provided when creating the value. - MAP // INVALID is used for a Value with no value set. // // Deprecated: Use EMPTY instead as an empty value is a valid value. INVALID = EMPTY ) -// BoolValue returns a [Value] for a bool value. +// BoolValue creates a BOOL Value. func BoolValue(v bool) Value { return Value{ vtype: BOOL, @@ -75,31 +59,17 @@ func BoolValue(v bool) Value { } } -// BoolSliceValue returns a [Value] for a []bool value. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. +// BoolSliceValue creates a BOOLSLICE Value. func BoolSliceValue(v []bool) Value { return Value{vtype: BOOLSLICE, slice: attribute.SliceValue(v)} } -// IntValue returns a [Value] for an int value. -// -// It is provided as a convenience for [Int64Value]. +// IntValue creates an INT64 Value. func IntValue(v int) Value { return Int64Value(int64(v)) } -// IntSliceValue returns a [Value] for a []int value. -// -// It is provided as a convenience for [Int64SliceValue]. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. +// IntSliceValue creates an INT64SLICE Value. func IntSliceValue(v []int) Value { val := Value{vtype: INT64SLICE} @@ -125,7 +95,7 @@ func IntSliceValue(v []int) Value { return val } -// Int64Value returns a [Value] for an int64 value. +// Int64Value creates an INT64 Value. func Int64Value(v int64) Value { return Value{ vtype: INT64, @@ -133,17 +103,12 @@ func Int64Value(v int64) Value { } } -// Int64SliceValue returns a [Value] for a []int64 value. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. +// Int64SliceValue creates an INT64SLICE Value. func Int64SliceValue(v []int64) Value { return Value{vtype: INT64SLICE, slice: attribute.SliceValue(v)} } -// Float64Value returns a [Value] for a float64 value. +// Float64Value creates a FLOAT64 Value. func Float64Value(v float64) Value { return Value{ vtype: FLOAT64, @@ -151,17 +116,12 @@ func Float64Value(v float64) Value { } } -// Float64SliceValue returns a [Value] for a []float64 value. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. +// Float64SliceValue creates a FLOAT64SLICE Value. func Float64SliceValue(v []float64) Value { return Value{vtype: FLOAT64SLICE, slice: attribute.SliceValue(v)} } -// StringValue returns a [Value] for a string value. +// StringValue creates a STRING Value. func StringValue(v string) Value { return Value{ vtype: STRING, @@ -169,55 +129,12 @@ func StringValue(v string) Value { } } -// StringSliceValue returns a [Value] for a []string value. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. +// StringSliceValue creates a STRINGSLICE Value. func StringSliceValue(v []string) Value { return Value{vtype: STRINGSLICE, slice: attribute.SliceValue(v)} } -// ByteSliceValue returns a [Value] for a []byte value. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. -func ByteSliceValue(v []byte) Value { - return Value{ - vtype: BYTESLICE, - stringly: string(v), - } -} - -// SliceValue returns a [Value] for a []Value value. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. -func SliceValue(v ...Value) Value { - return Value{vtype: SLICE, slice: sliceValue(v)} -} - -// MapValue returns a [Value] for a []KeyValue value. -// -// Note that many observability backends are not optimized to query, index, or -// aggregate complex attribute values. Complex values may also carry -// additional performance overhead. Prefer primitive values when -// possible. -// -// Users should avoid providing duplicate keys; many receivers handle maps -// containing duplicate keys unpredictably. -// -// The order of v is not preserved. -func MapValue(v ...KeyValue) Value { - return Value{vtype: MAP, slice: mapValue(v)} -} - -// Type returns v's type. +// Type returns a type of the Value. func (v Value) Type() Type { return v.vtype } @@ -298,106 +215,6 @@ func (v Value) asStringSlice() []string { return attribute.AsSlice[string](v.slice) } -// AsSlice returns the []Value value. Make sure that the Value's type is -// SLICE. -func (v Value) AsSlice() []Value { - if v.vtype != SLICE { - return nil - } - return v.asSlice() -} - -func (v Value) asSlice() []Value { - switch vals := v.slice.(type) { - case [0]Value: - return []Value{} - case [1]Value: - return []Value{vals[0]} - case [2]Value: - return []Value{vals[0], vals[1]} - case [3]Value: - return []Value{vals[0], vals[1], vals[2]} - case [4]Value: - return []Value{vals[0], vals[1], vals[2], vals[3]} - case [5]Value: - return []Value{vals[0], vals[1], vals[2], vals[3], vals[4]} - default: - return asValueSliceReflect(v.slice) - } -} - -func asValueSliceReflect(v any) []Value { - rv := reflect.ValueOf(v) - if !rv.IsValid() || rv.Kind() != reflect.Array || rv.Type().Elem() != reflect.TypeFor[Value]() { - return nil - } - cpy := make([]Value, rv.Len()) - if len(cpy) > 0 { - _ = reflect.Copy(reflect.ValueOf(cpy), rv) - } - return cpy -} - -// AsMap returns the []KeyValue value. Make sure that the Value's type is -// MAP. -// -// The returned slice is sorted by key and may differ from the order -// provided when creating the map value. -// -// The returned slice may contain duplicate keys if duplicate keys were -// provided when creating the map value. Callers should not assume the returned -// keys are unique. -func (v Value) AsMap() []KeyValue { - if v.vtype != MAP { - return nil - } - return v.asMap() -} - -func (v Value) asMap() []KeyValue { - switch vals := v.slice.(type) { - case [0]KeyValue: - return []KeyValue{} - case [1]KeyValue: - return []KeyValue{vals[0]} - case [2]KeyValue: - return []KeyValue{vals[0], vals[1]} - case [3]KeyValue: - return []KeyValue{vals[0], vals[1], vals[2]} - case [4]KeyValue: - return []KeyValue{vals[0], vals[1], vals[2], vals[3]} - case [5]KeyValue: - return []KeyValue{vals[0], vals[1], vals[2], vals[3], vals[4]} - default: - return asKeyValueSliceReflect(v.slice) - } -} - -func asKeyValueSliceReflect(v any) []KeyValue { - rv := reflect.ValueOf(v) - if !rv.IsValid() || rv.Kind() != reflect.Array || rv.Type().Elem() != reflect.TypeFor[KeyValue]() { - return nil - } - cpy := make([]KeyValue, rv.Len()) - if len(cpy) > 0 { - _ = reflect.Copy(reflect.ValueOf(cpy), rv) - } - return cpy -} - -// AsByteSlice returns the bytes value. Make sure that the Value's type -// is BYTESLICE. -func (v Value) AsByteSlice() []byte { - if v.vtype != BYTESLICE { - return nil - } - return v.asByteSlice() -} - -func (v Value) asByteSlice() []byte { - return []byte(v.stringly) -} - type unknownValueType struct{} // AsInterface returns Value's data as any. @@ -419,64 +236,13 @@ func (v Value) AsInterface() any { return v.stringly case STRINGSLICE: return v.asStringSlice() - case BYTESLICE: - return v.asByteSlice() - case SLICE: - return v.asSlice() - case MAP: - return v.asMap() case EMPTY: return nil } return unknownValueType{} } -// String returns a string representation of Value using the -// [OpenTelemetry AnyValue representation for non-OTLP protocols] rules. -// -// Strings are returned as-is without JSON quoting, booleans and integers use -// JSON literals, floating-point values use JSON numbers except that NaN and -// ±Inf are rendered as NaN, Infinity, and -Infinity, byte slices are -// base64-encoded, empty values are the empty string, slices are encoded as JSON -// arrays, and maps are encoded as JSON objects. String, byte, and special -// floating-point values inside arrays and maps are encoded as JSON strings, and -// empty values inside arrays and maps are encoded as null. -// -// [OpenTelemetry AnyValue representation for non-OTLP protocols]: https://opentelemetry.io/docs/specs/otel/common/#anyvalue-representation-for-non-otlp-protocols -func (v Value) String() string { - switch v.Type() { - case BOOL: - return strconv.FormatBool(v.AsBool()) - case BOOLSLICE: - return formatBoolSliceValue(v.slice) - case INT64: - return strconv.FormatInt(v.AsInt64(), 10) - case INT64SLICE: - return formatInt64SliceValue(v.slice) - case FLOAT64: - return formatFloat64(v.AsFloat64()) - case FLOAT64SLICE: - return formatFloat64SliceValue(v.slice) - case STRING: - return v.stringly - case STRINGSLICE: - return formatStringSliceValue(v.slice) - case BYTESLICE: - return formatByteSlice(v.stringly) - case SLICE: - return formatValueSliceValue(v.slice) - case MAP: - return formatMapValue(v.slice) - case EMPTY: - return "" - default: - return "unknown" - } -} - // Emit returns a string representation of Value's data. -// -// Deprecated: Use [Value.String] instead. func (v Value) Emit() string { switch v.Type() { case BOOLSLICE: @@ -507,12 +273,6 @@ func (v Value) Emit() string { return string(j) case STRING: return v.stringly - case BYTESLICE: - return formatByteSlice(v.stringly) - case SLICE: - return formatValueSliceValue(v.slice) - case MAP: - return formatMapValue(v.slice) case EMPTY: return "" default: @@ -520,758 +280,6 @@ func (v Value) Emit() string { } } -const ( - jsonArrayBracketsLen = len("[]") - boolArrayElemMaxLen = len("false") - int64ArrayElemMaxLen = len("-9223372036854775808") - float64ArrayElemMaxLen = len("-1.7976931348623157e+308") - commaLen = len(",") -) - -func sliceValue(v []Value) any { - switch len(v) { - case 0: - return [0]Value{} - case 1: - return [1]Value{v[0]} - case 2: - return [2]Value{v[0], v[1]} - case 3: - return [3]Value{v[0], v[1], v[2]} - case 4: - return [4]Value{v[0], v[1], v[2], v[3]} - case 5: - return [5]Value{v[0], v[1], v[2], v[3], v[4]} - default: - return sliceValueReflect(v) - } -} - -func sliceValueReflect(v []Value) any { - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeFor[Value]())).Elem() - reflect.Copy(cp, reflect.ValueOf(v)) - return cp.Interface() -} - -func mapValue(v []KeyValue) any { - switch len(v) { - case 0: - return [0]KeyValue{} - case 1: - return [1]KeyValue{v[0]} - case 2: - vals := [2]KeyValue{v[0], v[1]} - sortKeyValues(vals[:]) - return vals - case 3: - vals := [3]KeyValue{v[0], v[1], v[2]} - sortKeyValues(vals[:]) - return vals - case 4: - vals := [4]KeyValue{v[0], v[1], v[2], v[3]} - sortKeyValues(vals[:]) - return vals - case 5: - vals := [5]KeyValue{v[0], v[1], v[2], v[3], v[4]} - sortKeyValues(vals[:]) - return vals - default: - return mapValueReflect(v) - } -} - -func mapValueReflect(v []KeyValue) any { - cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeFor[KeyValue]())).Elem() - reflect.Copy(cp, reflect.ValueOf(v)) - vals := cp.Slice(0, len(v)).Interface().([]KeyValue) - sortKeyValues(vals) - return cp.Interface() -} - -func sortKeyValues(vals []KeyValue) { - slices.SortStableFunc(vals, func(a, b KeyValue) int { - return cmp.Compare(a.Key, b.Key) - }) -} - -func formatBoolSliceValue(v any) string { - switch vals := v.(type) { - case [0]bool: - return "[]" - case [1]bool: - return formatBoolSlice(vals[:]) - case [2]bool: - return formatBoolSlice(vals[:]) - case [3]bool: - return formatBoolSlice(vals[:]) - default: - return formatBoolSliceReflect(v) - } -} - -func formatBoolSlice(vals []bool) string { - var b strings.Builder - appendBoolSlice(&b, vals) - return b.String() -} - -func formatBoolSliceReflect(v any) string { - var b strings.Builder - appendBoolSliceReflect(&b, reflect.ValueOf(v)) - return b.String() -} - -func appendBoolSliceValue(dst *strings.Builder, v any) { - switch vals := v.(type) { - case [0]bool: - _, _ = dst.WriteString("[]") - case [1]bool: - appendBoolSlice(dst, vals[:]) - case [2]bool: - appendBoolSlice(dst, vals[:]) - case [3]bool: - appendBoolSlice(dst, vals[:]) - default: - appendBoolSliceReflect(dst, reflect.ValueOf(v)) - } -} - -func appendBoolSlice(dst *strings.Builder, vals []bool) { - dst.Grow(jsonArrayBracketsLen + len(vals)*(boolArrayElemMaxLen+commaLen)) - _ = dst.WriteByte('[') - for i, val := range vals { - if i > 0 { - _ = dst.WriteByte(',') - } - if val { - _, _ = dst.WriteString("true") - } else { - _, _ = dst.WriteString("false") - } - } - _ = dst.WriteByte(']') -} - -func appendBoolSliceReflect(dst *strings.Builder, rv reflect.Value) { - dst.Grow(jsonArrayBracketsLen + rv.Len()*(boolArrayElemMaxLen+commaLen)) - _ = dst.WriteByte('[') - for i := 0; i < rv.Len(); i++ { - if i > 0 { - _ = dst.WriteByte(',') - } - if rv.Index(i).Bool() { - _, _ = dst.WriteString("true") - } else { - _, _ = dst.WriteString("false") - } - } - _ = dst.WriteByte(']') -} - -func formatInt64SliceValue(v any) string { - switch vals := v.(type) { - case [0]int64: - return "[]" - case [1]int64: - return formatInt64Slice(vals[:]) - case [2]int64: - return formatInt64Slice(vals[:]) - case [3]int64: - return formatInt64Slice(vals[:]) - default: - return formatInt64SliceReflect(v) - } -} - -func formatInt64Slice(vals []int64) string { - var b strings.Builder - appendInt64Slice(&b, vals) - return b.String() -} - -func formatInt64SliceReflect(v any) string { - var b strings.Builder - appendInt64SliceReflect(&b, reflect.ValueOf(v)) - return b.String() -} - -func appendInt64SliceValue(dst *strings.Builder, v any) { - switch vals := v.(type) { - case [0]int64: - _, _ = dst.WriteString("[]") - case [1]int64: - appendInt64Slice(dst, vals[:]) - case [2]int64: - appendInt64Slice(dst, vals[:]) - case [3]int64: - appendInt64Slice(dst, vals[:]) - default: - appendInt64SliceReflect(dst, reflect.ValueOf(v)) - } -} - -func appendInt64Slice(dst *strings.Builder, vals []int64) { - dst.Grow(jsonArrayBracketsLen + len(vals)*(int64ArrayElemMaxLen+commaLen)) - _ = dst.WriteByte('[') - - var buf [int64ArrayElemMaxLen]byte - for i, val := range vals { - if i > 0 { - _ = dst.WriteByte(',') - } - out := strconv.AppendInt(buf[:0], val, 10) - _, _ = dst.Write(out) - } - - _ = dst.WriteByte(']') -} - -func appendInt64SliceReflect(dst *strings.Builder, rv reflect.Value) { - dst.Grow(jsonArrayBracketsLen + rv.Len()*(int64ArrayElemMaxLen+commaLen)) - _ = dst.WriteByte('[') - - var scratch [int64ArrayElemMaxLen]byte - for i := 0; i < rv.Len(); i++ { - if i > 0 { - _ = dst.WriteByte(',') - } - out := strconv.AppendInt(scratch[:0], rv.Index(i).Int(), 10) - _, _ = dst.Write(out) - } - - _ = dst.WriteByte(']') -} - -func formatFloat64(v float64) string { - switch { - case math.IsNaN(v): - return "NaN" - case math.IsInf(v, 1): - return "Infinity" - case math.IsInf(v, -1): - return "-Infinity" - default: - return strconv.FormatFloat(v, 'g', -1, 64) - } -} - -func formatFloat64SliceValue(v any) string { - switch vals := v.(type) { - case [0]float64: - return "[]" - case [1]float64: - return formatFloat64Slice(vals[:]) - case [2]float64: - return formatFloat64Slice(vals[:]) - case [3]float64: - return formatFloat64Slice(vals[:]) - default: - return formatFloat64SliceReflect(v) - } -} - -func formatFloat64Slice(vals []float64) string { - var b strings.Builder - appendFloat64Slice(&b, vals) - return b.String() -} - -func formatFloat64SliceReflect(v any) string { - var b strings.Builder - appendFloat64SliceReflect(&b, reflect.ValueOf(v)) - return b.String() -} - -func appendFloat64SliceValue(dst *strings.Builder, v any) { - switch vals := v.(type) { - case [0]float64: - _, _ = dst.WriteString("[]") - case [1]float64: - appendFloat64Slice(dst, vals[:]) - case [2]float64: - appendFloat64Slice(dst, vals[:]) - case [3]float64: - appendFloat64Slice(dst, vals[:]) - default: - appendFloat64SliceReflect(dst, reflect.ValueOf(v)) - } -} - -func appendFloat64Slice(dst *strings.Builder, vals []float64) { - dst.Grow(jsonArrayBracketsLen + len(vals)*(float64ArrayElemMaxLen+commaLen)) - _ = dst.WriteByte('[') - - var buf [float64ArrayElemMaxLen]byte - for i, val := range vals { - if i > 0 { - _ = dst.WriteByte(',') - } - - switch { - case math.IsNaN(val): - _, _ = dst.WriteString(`"NaN"`) - case math.IsInf(val, 1): - _, _ = dst.WriteString(`"Infinity"`) - case math.IsInf(val, -1): - _, _ = dst.WriteString(`"-Infinity"`) - default: - out := strconv.AppendFloat(buf[:0], val, 'g', -1, 64) - _, _ = dst.Write(out) - } - } - - _ = dst.WriteByte(']') -} - -func appendFloat64SliceReflect(dst *strings.Builder, rv reflect.Value) { - dst.Grow(jsonArrayBracketsLen + rv.Len()*(float64ArrayElemMaxLen+commaLen)) - _ = dst.WriteByte('[') - - var scratch [float64ArrayElemMaxLen]byte - for i := 0; i < rv.Len(); i++ { - if i > 0 { - _ = dst.WriteByte(',') - } - val := rv.Index(i).Float() - switch { - case math.IsNaN(val): - _, _ = dst.WriteString(`"NaN"`) - case math.IsInf(val, 1): - _, _ = dst.WriteString(`"Infinity"`) - case math.IsInf(val, -1): - _, _ = dst.WriteString(`"-Infinity"`) - default: - out := strconv.AppendFloat(scratch[:0], val, 'g', -1, 64) - _, _ = dst.Write(out) - } - } - - _ = dst.WriteByte(']') -} - -func formatStringSliceValue(v any) string { - switch vals := v.(type) { - case [0]string: - return "[]" - case [1]string: - return formatStringSlice(vals[:]) - case [2]string: - return formatStringSlice(vals[:]) - case [3]string: - return formatStringSlice(vals[:]) - default: - return formatStringSliceReflect(v) - } -} - -func formatStringSlice(vals []string) string { - var b strings.Builder - appendStringSlice(&b, vals) - return b.String() -} - -func formatStringSliceReflect(v any) string { - var b strings.Builder - appendStringSliceReflect(&b, reflect.ValueOf(v)) - return b.String() -} - -func appendStringSliceValue(dst *strings.Builder, v any) { - switch vals := v.(type) { - case [0]string: - _, _ = dst.WriteString("[]") - case [1]string: - appendStringSlice(dst, vals[:]) - case [2]string: - appendStringSlice(dst, vals[:]) - case [3]string: - appendStringSlice(dst, vals[:]) - default: - appendStringSliceReflect(dst, reflect.ValueOf(v)) - } -} - -func appendStringSlice(dst *strings.Builder, vals []string) { - size := jsonArrayBracketsLen - for _, val := range vals { - size += len(val) + commaLen + 2 // Account for JSON string quotes and comma. - } - - dst.Grow(size) - _ = dst.WriteByte('[') - for i, val := range vals { - if i > 0 { - _ = dst.WriteByte(',') - } - appendJSONString(dst, val) - } - _ = dst.WriteByte(']') -} - -func appendStringSliceReflect(dst *strings.Builder, rv reflect.Value) { - size := jsonArrayBracketsLen - for i := 0; i < rv.Len(); i++ { - size += len(rv.Index(i).String()) + commaLen + 2 // Account for JSON string quotes and comma. - } - - dst.Grow(size) - _ = dst.WriteByte('[') - for i := 0; i < rv.Len(); i++ { - if i > 0 { - _ = dst.WriteByte(',') - } - appendJSONString(dst, rv.Index(i).String()) - } - _ = dst.WriteByte(']') -} - -func formatByteSlice(v string) string { - var b strings.Builder - appendBase64(&b, v) - return b.String() -} - -func formatValueSliceValue(v any) string { - switch vals := v.(type) { - case [0]Value: - return "[]" - case [1]Value: - return formatValueSlice(vals[:]) - case [2]Value: - return formatValueSlice(vals[:]) - case [3]Value: - return formatValueSlice(vals[:]) - case [4]Value: - return formatValueSlice(vals[:]) - case [5]Value: - return formatValueSlice(vals[:]) - default: - return formatValueSliceReflect(v) - } -} - -func formatValueSlice(vals []Value) string { - var b strings.Builder - appendValueSlice(&b, vals) - return b.String() -} - -func formatValueSliceReflect(v any) string { - var b strings.Builder - appendValueSliceReflect(&b, reflect.ValueOf(v)) - return b.String() -} - -func formatMapValue(v any) string { - switch vals := v.(type) { - case [0]KeyValue: - return "{}" - case [1]KeyValue: - return formatMap(vals[:]) - case [2]KeyValue: - return formatMap(vals[:]) - case [3]KeyValue: - return formatMap(vals[:]) - case [4]KeyValue: - return formatMap(vals[:]) - case [5]KeyValue: - return formatMap(vals[:]) - default: - return formatMapReflect(v) - } -} - -func formatMap(vals []KeyValue) string { - var b strings.Builder - appendMap(&b, vals) - return b.String() -} - -func formatMapReflect(v any) string { - var b strings.Builder - appendMapReflect(&b, reflect.ValueOf(v)) - return b.String() -} - -func appendValueSliceValue(dst *strings.Builder, v any) { - switch vals := v.(type) { - case [0]Value: - _, _ = dst.WriteString("[]") - case [1]Value: - appendValueSlice(dst, vals[:]) - case [2]Value: - appendValueSlice(dst, vals[:]) - case [3]Value: - appendValueSlice(dst, vals[:]) - case [4]Value: - appendValueSlice(dst, vals[:]) - case [5]Value: - appendValueSlice(dst, vals[:]) - default: - appendValueSliceReflect(dst, reflect.ValueOf(v)) - } -} - -func appendValueSlice(dst *strings.Builder, vals []Value) { - // Estimate 10 bytes per value for small values and commas. - dst.Grow(jsonArrayBracketsLen + len(vals)*commaLen + len(vals)*10) - _ = dst.WriteByte('[') - for i, val := range vals { - if i > 0 { - _ = dst.WriteByte(',') - } - appendJSONValue(dst, val) - } - _ = dst.WriteByte(']') -} - -func appendValueSliceReflect(dst *strings.Builder, rv reflect.Value) { - // Estimate 10 bytes per value for small values and commas. - dst.Grow(jsonArrayBracketsLen + rv.Len()*commaLen + rv.Len()*10) - _ = dst.WriteByte('[') - for i := 0; i < rv.Len(); i++ { - if i > 0 { - _ = dst.WriteByte(',') - } - appendJSONValue(dst, rv.Index(i).Interface().(Value)) - } - _ = dst.WriteByte(']') -} - -func appendMapValue(dst *strings.Builder, v any) { - switch vals := v.(type) { - case [0]KeyValue: - _, _ = dst.WriteString("{}") - case [1]KeyValue: - appendMap(dst, vals[:]) - case [2]KeyValue: - appendMap(dst, vals[:]) - case [3]KeyValue: - appendMap(dst, vals[:]) - case [4]KeyValue: - appendMap(dst, vals[:]) - case [5]KeyValue: - appendMap(dst, vals[:]) - default: - appendMapReflect(dst, reflect.ValueOf(v)) - } -} - -func appendMap(dst *strings.Builder, vals []KeyValue) { - // Estimate 32 bytes per value for small values, plus key quotes, colon, - // and commas. Escaped keys and larger values grow the builder as needed. - size := len("{}") + len(vals)*commaLen + len(vals)*32 - for _, val := range vals { - size += len(val.Key) + len(`"":`) - } - - dst.Grow(size) - _ = dst.WriteByte('{') - for i, val := range vals { - if i > 0 { - _ = dst.WriteByte(',') - } - appendJSONString(dst, string(val.Key)) - _ = dst.WriteByte(':') - appendJSONValue(dst, val.Value) - } - _ = dst.WriteByte('}') -} - -func appendMapReflect(dst *strings.Builder, rv reflect.Value) { - // Estimate 32 bytes per value for small values, plus key quotes, colon, - // and commas. Escaped keys and larger values grow the builder as needed. - size := len("{}") + rv.Len()*commaLen + rv.Len()*32 - for i := 0; i < rv.Len(); i++ { - size += len(rv.Index(i).Field(0).String()) + len(`"":`) - } - - dst.Grow(size) - _ = dst.WriteByte('{') - for i := 0; i < rv.Len(); i++ { - if i > 0 { - _ = dst.WriteByte(',') - } - val := rv.Index(i).Interface().(KeyValue) - appendJSONString(dst, string(val.Key)) - _ = dst.WriteByte(':') - appendJSONValue(dst, val.Value) - } - _ = dst.WriteByte('}') -} - -func appendJSONValue(dst *strings.Builder, v Value) { - switch v.Type() { - case BOOL: - if v.AsBool() { - _, _ = dst.WriteString("true") - } else { - _, _ = dst.WriteString("false") - } - case BOOLSLICE: - appendBoolSliceValue(dst, v.slice) - case INT64: - var buf [int64ArrayElemMaxLen]byte - out := strconv.AppendInt(buf[:0], v.AsInt64(), 10) - _, _ = dst.Write(out) - case INT64SLICE: - appendInt64SliceValue(dst, v.slice) - case FLOAT64: - val := v.AsFloat64() - switch { - case math.IsNaN(val): - appendJSONString(dst, "NaN") - case math.IsInf(val, 1): - appendJSONString(dst, "Infinity") - case math.IsInf(val, -1): - appendJSONString(dst, "-Infinity") - default: - var buf [float64ArrayElemMaxLen]byte - out := strconv.AppendFloat(buf[:0], val, 'g', -1, 64) - _, _ = dst.Write(out) - } - case FLOAT64SLICE: - appendFloat64SliceValue(dst, v.slice) - case STRING: - appendJSONString(dst, v.stringly) - case STRINGSLICE: - appendStringSliceValue(dst, v.slice) - case BYTESLICE: - _ = dst.WriteByte('"') - appendBase64(dst, v.stringly) - _ = dst.WriteByte('"') - case SLICE: - appendValueSliceValue(dst, v.slice) - case MAP: - appendMapValue(dst, v.slice) - case EMPTY: - _, _ = dst.WriteString("null") - default: - appendJSONString(dst, "unknown") - } -} - -// appendJSONString appends s to dst as a JSON string literal. -// -// This is adapted from the Go standard library's encoding/json -// [appendString implementation]. It keeps the same escaping behavior we need -// here, but writes directly into a strings.Builder and intentionally does not -// apply HTML escaping because the OpenTelemetry non-OTLP AnyValue representation -// only requires JSON array string encoding. We inline this instead of using -// encoding/json so slice formatting avoids allocations and reflection. -// -// [appendString implementation]: https://github.com/golang/go/blob/3b5954c6349d31465dca409b45ab6597e0942d9f/src/encoding/json/encode.go#L998-L1064 -func appendJSONString(dst *strings.Builder, s string) { - const hex = "0123456789abcdef" // For escaping bytes to hex. - - _ = dst.WriteByte('"') - start := 0 - - for i := 0; i < len(s); { - if c := s[i]; c < utf8.RuneSelf { - if c >= 0x20 && c != '\\' && c != '"' { - i++ - continue - } - - if start < i { - _, _ = dst.WriteString(s[start:i]) - } - - switch c { - case '\\', '"': - _ = dst.WriteByte('\\') - _ = dst.WriteByte(c) - case '\b': - _, _ = dst.WriteString(`\b`) - case '\f': - _, _ = dst.WriteString(`\f`) - case '\n': - _, _ = dst.WriteString(`\n`) - case '\r': - _, _ = dst.WriteString(`\r`) - case '\t': - _, _ = dst.WriteString(`\t`) - default: - _, _ = dst.WriteString(`\u00`) - _ = dst.WriteByte(hex[c>>4]) - _ = dst.WriteByte(hex[c&0x0f]) - } - - i++ - start = i - continue - } - - r, size := utf8.DecodeRuneInString(s[i:]) - if r == utf8.RuneError && size == 1 { - if start < i { - _, _ = dst.WriteString(s[start:i]) - } - // Match encoding/json by replacing invalid UTF-8 with U+FFFD. - _, _ = dst.WriteString(`\ufffd`) - i++ - start = i - continue - } - - if r == '\u2028' || r == '\u2029' { - if start < i { - _, _ = dst.WriteString(s[start:i]) - } - // Escape JSONP-sensitive separators unconditionally, like encoding/json. - _, _ = dst.WriteString(`\u202`) - _ = dst.WriteByte(hex[r&0x0f]) - i += size - start = i - continue - } - - i += size - } - - if start < len(s) { - _, _ = dst.WriteString(s[start:]) - } - _ = dst.WriteByte('"') -} - -// This is adapted from the Go standard library's encoding/base64 -// [Encoding.Encode implementation]. It keeps the same encoding behavior we need -// here, but writes directly into a strings.Builder. We inline this instead of using -// encoding/base64 to avoid allocations. -// -// [Encoding.Encode implementation]: https://github.com/golang/go/blob/3b5954c6349d31465dca409b45ab6597e0942d9f/src/encoding/base64/base64.go#L139-L189 -func appendBase64(dst *strings.Builder, s string) { - const encode = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" - - dst.Grow(base64.StdEncoding.EncodedLen(len(s))) - - i := 0 - for ; i+2 < len(s); i += 3 { - n := uint32(s[i])<<16 | uint32(s[i+1])<<8 | uint32(s[i+2]) - _ = dst.WriteByte(encode[n>>18&0x3f]) - _ = dst.WriteByte(encode[n>>12&0x3f]) - _ = dst.WriteByte(encode[n>>6&0x3f]) - _ = dst.WriteByte(encode[n&0x3f]) - } - - switch len(s) - i { - case 1: - n := uint32(s[i]) << 16 - _ = dst.WriteByte(encode[n>>18&0x3f]) - _ = dst.WriteByte(encode[n>>12&0x3f]) - _ = dst.WriteByte('=') - _ = dst.WriteByte('=') - case 2: - n := uint32(s[i])<<16 | uint32(s[i+1])<<8 - _ = dst.WriteByte(encode[n>>18&0x3f]) - _ = dst.WriteByte(encode[n>>12&0x3f]) - _ = dst.WriteByte(encode[n>>6&0x3f]) - _ = dst.WriteByte('=') - } -} - // MarshalJSON returns the JSON encoding of the Value. func (v Value) MarshalJSON() ([]byte, error) { var jsonVal struct { diff --git a/vendor/go.opentelemetry.io/otel/baggage/baggage.go b/vendor/go.opentelemetry.io/otel/baggage/baggage.go index 25c739d082..878ffbe43a 100644 --- a/vendor/go.opentelemetry.io/otel/baggage/baggage.go +++ b/vendor/go.opentelemetry.io/otel/baggage/baggage.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package baggage +package baggage // import "go.opentelemetry.io/otel/baggage" import ( "errors" @@ -14,10 +14,6 @@ import ( ) const ( - maxParseErrors = 5 - - // W3C Baggage specification limits. - // https://www.w3.org/TR/baggage/#limits maxMembers = 64 maxBytesPerBaggageString = 8192 @@ -497,15 +493,9 @@ func New(members ...Member) (Baggage, error) { // from the W3C Baggage specification which allows duplicate list-members, but // conforms to the OpenTelemetry Baggage specification. // -// If the raw baggage-string exceeds the maximum allowed bytes (8192), an -// empty Baggage and an error are returned. -// -// Otherwise, members are parsed left-to-right and accumulated until one of -// the following conditions is reached, at which point parsing stops and an -// error is returned alongside the partial result: -// - accepting the next member would cause the encoded baggage to exceed -// 8192 bytes, or -// - the baggage already contains 64 distinct keys. +// If the baggage-string exceeds the maximum allowed members (64) or bytes +// (8192), members are dropped until the limits are satisfied and an error is +// returned along with the partial result. // // Invalid members are skipped and the error is returned along with the // partial result containing the valid members. @@ -514,14 +504,9 @@ func Parse(bStr string) (Baggage, error) { return Baggage{}, nil } - if n := len(bStr); n > maxBytesPerBaggageString { - return Baggage{}, fmt.Errorf("%w: %d", errBaggageBytes, n) - } - b := make(baggage.List) sizes := make(map[string]int) // Track per-key byte sizes var totalBytes int - var parseErrors int var truncateErr error for memberStr := range strings.SplitSeq(bStr, listDelimiter) { // Check member count limit. @@ -532,10 +517,7 @@ func Parse(bStr string) (Baggage, error) { m, err := parseMember(memberStr) if err != nil { - parseErrors++ - if parseErrors <= maxParseErrors { - truncateErr = errors.Join(truncateErr, err) - } + truncateErr = errors.Join(truncateErr, err) continue // skip invalid member, keep processing } @@ -571,10 +553,6 @@ func Parse(bStr string) (Baggage, error) { totalBytes = newTotalBytes } - if dropped := parseErrors - maxParseErrors; dropped > 0 { - truncateErr = errors.Join(truncateErr, fmt.Errorf("and %d more invalid member(s)", dropped)) - } - if len(b) == 0 { return Baggage{}, truncateErr } diff --git a/vendor/go.opentelemetry.io/otel/baggage/context.go b/vendor/go.opentelemetry.io/otel/baggage/context.go index 4d09b59aad..a572461a05 100644 --- a/vendor/go.opentelemetry.io/otel/baggage/context.go +++ b/vendor/go.opentelemetry.io/otel/baggage/context.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package baggage +package baggage // import "go.opentelemetry.io/otel/baggage" import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/baggage/doc.go b/vendor/go.opentelemetry.io/otel/baggage/doc.go index 74d3a8709f..b51d87cab7 100644 --- a/vendor/go.opentelemetry.io/otel/baggage/doc.go +++ b/vendor/go.opentelemetry.io/otel/baggage/doc.go @@ -6,4 +6,4 @@ Package baggage provides functionality for storing and retrieving baggage items in Go context. For propagating the baggage, see the go.opentelemetry.io/otel/propagation package. */ -package baggage +package baggage // import "go.opentelemetry.io/otel/baggage" diff --git a/vendor/go.opentelemetry.io/otel/codes/codes.go b/vendor/go.opentelemetry.io/otel/codes/codes.go index 9355545a8c..d48847ed86 100644 --- a/vendor/go.opentelemetry.io/otel/codes/codes.go +++ b/vendor/go.opentelemetry.io/otel/codes/codes.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package codes +package codes // import "go.opentelemetry.io/otel/codes" import ( "encoding/json" @@ -81,7 +81,7 @@ func (c *Code) UnmarshalJSON(b []byte) error { case float64: if ci, err := strconv.ParseUint(string(b), 10, 32); err == nil { if ci >= maxCode { - return fmt.Errorf("invalid code: %d", ci) + return fmt.Errorf("invalid code: %q", ci) } *c = Code(ci) // nolint: gosec // Bit size of 32 check above. diff --git a/vendor/go.opentelemetry.io/otel/codes/doc.go b/vendor/go.opentelemetry.io/otel/codes/doc.go index 1073f65439..ee8db448b8 100644 --- a/vendor/go.opentelemetry.io/otel/codes/doc.go +++ b/vendor/go.opentelemetry.io/otel/codes/doc.go @@ -7,4 +7,4 @@ Package codes defines the canonical error codes used by OpenTelemetry. It conforms to [the OpenTelemetry specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/api.md#set-status). */ -package codes +package codes // import "go.opentelemetry.io/otel/codes" diff --git a/vendor/go.opentelemetry.io/otel/dependencies.Dockerfile b/vendor/go.opentelemetry.io/otel/dependencies.Dockerfile index 20eecba40d..7a9b3c0559 100644 --- a/vendor/go.opentelemetry.io/otel/dependencies.Dockerfile +++ b/vendor/go.opentelemetry.io/otel/dependencies.Dockerfile @@ -1,4 +1,4 @@ # This is a renovate-friendly source of Docker images. FROM python:3.13.6-slim-bullseye@sha256:e98b521460ee75bca92175c16247bdf7275637a8faaeb2bcfa19d879ae5c4b9a AS python -FROM otel/weaver:v0.25.1@sha256:9ad46ca9cd4fa5974b121f886aa3e9946a8ef8ea905001a96c018d21f9db87ca AS weaver +FROM otel/weaver:v0.22.1@sha256:33ae522ae4b71c1c562563c1d81f46aa0f79f088a0873199143a1f11ac30e5c9 AS weaver FROM avtodev/markdown-lint:v1@sha256:6aeedc2f49138ce7a1cd0adffc1b1c0321b841dc2102408967d9301c031949ee AS markdown diff --git a/vendor/go.opentelemetry.io/otel/doc.go b/vendor/go.opentelemetry.io/otel/doc.go index 92b7a0566e..921f85961a 100644 --- a/vendor/go.opentelemetry.io/otel/doc.go +++ b/vendor/go.opentelemetry.io/otel/doc.go @@ -22,4 +22,4 @@ To read more about logs, see go.opentelemetry.io/otel/log. To read more about propagation, see go.opentelemetry.io/otel/propagation and go.opentelemetry.io/otel/baggage. */ -package otel +package otel // import "go.opentelemetry.io/otel" diff --git a/vendor/go.opentelemetry.io/otel/error_handler.go b/vendor/go.opentelemetry.io/otel/error_handler.go index 06fd49da2b..67414c71e0 100644 --- a/vendor/go.opentelemetry.io/otel/error_handler.go +++ b/vendor/go.opentelemetry.io/otel/error_handler.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package otel +package otel // import "go.opentelemetry.io/otel" // ErrorHandler handles irremediable events. type ErrorHandler interface { diff --git a/vendor/go.opentelemetry.io/otel/handler.go b/vendor/go.opentelemetry.io/otel/handler.go index 1f45ea3883..07623b6791 100644 --- a/vendor/go.opentelemetry.io/otel/handler.go +++ b/vendor/go.opentelemetry.io/otel/handler.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package otel +package otel // import "go.opentelemetry.io/otel" import ( "go.opentelemetry.io/otel/internal/global" diff --git a/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go b/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go index cbeb14fcd8..b4f85f44a9 100644 --- a/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go +++ b/vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go @@ -10,7 +10,7 @@ this need this package would not need to exist and the `go.opentelemetry.io/otel/baggage` package would be the singular place where W3C baggage is handled. */ -package baggage +package baggage // import "go.opentelemetry.io/otel/internal/baggage" // List is the collection of baggage members. The W3C allows for duplicates, // but OpenTelemetry does not, therefore, this is represented as a map. diff --git a/vendor/go.opentelemetry.io/otel/internal/baggage/context.go b/vendor/go.opentelemetry.io/otel/internal/baggage/context.go index f3bece1652..3aea9c491f 100644 --- a/vendor/go.opentelemetry.io/otel/internal/baggage/context.go +++ b/vendor/go.opentelemetry.io/otel/internal/baggage/context.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package baggage +package baggage // import "go.opentelemetry.io/otel/internal/baggage" import "context" diff --git a/vendor/go.opentelemetry.io/otel/internal/errorhandler/errorhandler.go b/vendor/go.opentelemetry.io/otel/internal/errorhandler/errorhandler.go index de294461c7..3f0ab31312 100644 --- a/vendor/go.opentelemetry.io/otel/internal/errorhandler/errorhandler.go +++ b/vendor/go.opentelemetry.io/otel/internal/errorhandler/errorhandler.go @@ -5,7 +5,7 @@ // // This package has no OTel dependencies, allowing it to be imported by any // package in the module without creating import cycles. -package errorhandler +package errorhandler // import "go.opentelemetry.io/otel/internal/errorhandler" import ( "errors" diff --git a/vendor/go.opentelemetry.io/otel/internal/global/handler.go b/vendor/go.opentelemetry.io/otel/internal/global/handler.go index 6fb8034f8a..77d0425f54 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/handler.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/handler.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Package global provides the OpenTelemetry global API. -package global +package global // import "go.opentelemetry.io/otel/internal/global" import ( "go.opentelemetry.io/otel/internal/errorhandler" diff --git a/vendor/go.opentelemetry.io/otel/internal/global/instruments.go b/vendor/go.opentelemetry.io/otel/internal/global/instruments.go index 4db3fdcde7..55255cddfc 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/instruments.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/instruments.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package global +package global // import "go.opentelemetry.io/otel/internal/global" import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go b/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go index 8e1327354a..86d7f4ba08 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package global +package global // import "go.opentelemetry.io/otel/internal/global" import ( "log" diff --git a/vendor/go.opentelemetry.io/otel/internal/global/meter.go b/vendor/go.opentelemetry.io/otel/internal/global/meter.go index 48be49037d..50043d669b 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/meter.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/meter.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package global +package global // import "go.opentelemetry.io/otel/internal/global" import ( "container/list" diff --git a/vendor/go.opentelemetry.io/otel/internal/global/propagator.go b/vendor/go.opentelemetry.io/otel/internal/global/propagator.go index 90c462ef0d..38560ff991 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/propagator.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/propagator.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package global +package global // import "go.opentelemetry.io/otel/internal/global" import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/internal/global/state.go b/vendor/go.opentelemetry.io/otel/internal/global/state.go index f8fcb82bcb..225c9e5015 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/state.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/state.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package global +package global // import "go.opentelemetry.io/otel/internal/global" import ( "errors" diff --git a/vendor/go.opentelemetry.io/otel/internal/global/trace.go b/vendor/go.opentelemetry.io/otel/internal/global/trace.go index 45899f8c01..bf5cf3119b 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/trace.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/trace.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package global +package global // import "go.opentelemetry.io/otel/internal/global" /* This file contains the forwarding implementation of the TracerProvider used as diff --git a/vendor/go.opentelemetry.io/otel/internal_logging.go b/vendor/go.opentelemetry.io/otel/internal_logging.go index 3f6b7b10dd..6de7f2e4d8 100644 --- a/vendor/go.opentelemetry.io/otel/internal_logging.go +++ b/vendor/go.opentelemetry.io/otel/internal_logging.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package otel +package otel // import "go.opentelemetry.io/otel" import ( "github.com/go-logr/logr" diff --git a/vendor/go.opentelemetry.io/otel/metric.go b/vendor/go.opentelemetry.io/otel/metric.go index 30dbb41188..527d9aec86 100644 --- a/vendor/go.opentelemetry.io/otel/metric.go +++ b/vendor/go.opentelemetry.io/otel/metric.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package otel +package otel // import "go.opentelemetry.io/otel" import ( "go.opentelemetry.io/otel/internal/global" diff --git a/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go index 11e5b282f3..466812d343 100644 --- a/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go +++ b/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package metric +package metric // import "go.opentelemetry.io/otel/metric" import ( "context" @@ -51,9 +51,6 @@ type Float64ObservableCounterConfig struct { func NewFloat64ObservableCounterConfig(opts ...Float64ObservableCounterOption) Float64ObservableCounterConfig { var config Float64ObservableCounterConfig for _, o := range opts { - if _, ok := o.(experimentalOption); ok { - continue - } config = o.applyFloat64ObservableCounter(config) } return config @@ -114,9 +111,6 @@ func NewFloat64ObservableUpDownCounterConfig( ) Float64ObservableUpDownCounterConfig { var config Float64ObservableUpDownCounterConfig for _, o := range opts { - if _, ok := o.(experimentalOption); ok { - continue - } config = o.applyFloat64ObservableUpDownCounter(config) } return config @@ -174,9 +168,6 @@ type Float64ObservableGaugeConfig struct { func NewFloat64ObservableGaugeConfig(opts ...Float64ObservableGaugeOption) Float64ObservableGaugeConfig { var config Float64ObservableGaugeConfig for _, o := range opts { - if _, ok := o.(experimentalOption); ok { - continue - } config = o.applyFloat64ObservableGauge(config) } return config diff --git a/vendor/go.opentelemetry.io/otel/metric/asyncint64.go b/vendor/go.opentelemetry.io/otel/metric/asyncint64.go index f5577b0c51..66c971bd8a 100644 --- a/vendor/go.opentelemetry.io/otel/metric/asyncint64.go +++ b/vendor/go.opentelemetry.io/otel/metric/asyncint64.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package metric +package metric // import "go.opentelemetry.io/otel/metric" import ( "context" @@ -50,9 +50,6 @@ type Int64ObservableCounterConfig struct { func NewInt64ObservableCounterConfig(opts ...Int64ObservableCounterOption) Int64ObservableCounterConfig { var config Int64ObservableCounterConfig for _, o := range opts { - if _, ok := o.(experimentalOption); ok { - continue - } config = o.applyInt64ObservableCounter(config) } return config @@ -113,9 +110,6 @@ func NewInt64ObservableUpDownCounterConfig( ) Int64ObservableUpDownCounterConfig { var config Int64ObservableUpDownCounterConfig for _, o := range opts { - if _, ok := o.(experimentalOption); ok { - continue - } config = o.applyInt64ObservableUpDownCounter(config) } return config @@ -173,9 +167,6 @@ type Int64ObservableGaugeConfig struct { func NewInt64ObservableGaugeConfig(opts ...Int64ObservableGaugeOption) Int64ObservableGaugeConfig { var config Int64ObservableGaugeConfig for _, o := range opts { - if _, ok := o.(experimentalOption); ok { - continue - } config = o.applyInt64ObservableGauge(config) } return config diff --git a/vendor/go.opentelemetry.io/otel/metric/config.go b/vendor/go.opentelemetry.io/otel/metric/config.go index 31a5da8170..e42dd6e70a 100644 --- a/vendor/go.opentelemetry.io/otel/metric/config.go +++ b/vendor/go.opentelemetry.io/otel/metric/config.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package metric +package metric // import "go.opentelemetry.io/otel/metric" import ( "slices" @@ -42,18 +42,11 @@ type MeterOption interface { applyMeter(MeterConfig) MeterConfig } -type experimentalOption interface { - Experimental() -} - // NewMeterConfig creates a new MeterConfig and applies // all the given options. func NewMeterConfig(opts ...MeterOption) MeterConfig { var config MeterConfig for _, o := range opts { - if _, ok := o.(experimentalOption); ok { - continue - } config = o.applyMeter(config) } return config diff --git a/vendor/go.opentelemetry.io/otel/metric/doc.go b/vendor/go.opentelemetry.io/otel/metric/doc.go index 235e81f3a6..f153745b00 100644 --- a/vendor/go.opentelemetry.io/otel/metric/doc.go +++ b/vendor/go.opentelemetry.io/otel/metric/doc.go @@ -24,10 +24,10 @@ all instruments fall into two overlapping logical categories: asynchronous or synchronous, and int64 or float64. All synchronous instruments ([Int64Counter], [Int64UpDownCounter], -[Int64Histogram], [Int64Gauge], [Float64Counter], [Float64UpDownCounter], -[Float64Histogram], and [Float64Gauge]) are used to measure the operation and -performance of source code during the source code execution. These instruments -only make measurements when the source code they instrument is run. +[Int64Histogram], [Float64Counter], [Float64UpDownCounter], and +[Float64Histogram]) are used to measure the operation and performance of source +code during the source code execution. These instruments only make measurements +when the source code they instrument is run. All asynchronous instruments ([Int64ObservableCounter], [Int64ObservableUpDownCounter], [Int64ObservableGauge], @@ -50,11 +50,9 @@ incrementally increase in value. UpDownCounters ([Int64UpDownCounter], values that can increase and decrease. When more information needs to be conveyed about all the synchronous measurements made during a collection cycle, a Histogram ([Int64Histogram] and [Float64Histogram]) should be used. Finally, -when just the most recent measurement needs to be conveyed, a Gauge -([Int64Gauge], [Float64Gauge], [Int64ObservableGauge], and -[Float64ObservableGauge]) should be used: the synchronous variants record an -instantaneous value at a specific point in code, while the observable variants -sample the value via a callback once per collection cycle. +when just the most recent measurement needs to be conveyed about an +asynchronous measurement, a Gauge ([Int64ObservableGauge] and +[Float64ObservableGauge]) should be used. See the [OpenTelemetry documentation] for more information about instruments and their intended use. @@ -82,11 +80,11 @@ Measurements are made by recording values and information about the values with an instrument. How these measurements are recorded depends on the instrument. Measurements for synchronous instruments ([Int64Counter], [Int64UpDownCounter], -[Int64Histogram], [Int64Gauge], [Float64Counter], [Float64UpDownCounter], -[Float64Histogram], and [Float64Gauge]) are recorded using the instrument -methods directly. All counter instruments have an Add method that is used to -measure an increment value, and all histogram and synchronous gauge -instruments have a Record method to measure a data point. +[Int64Histogram], [Float64Counter], [Float64UpDownCounter], and +[Float64Histogram]) are recorded using the instrument methods directly. All +counter instruments have an Add method that is used to measure an increment +value, and all histogram instruments have a Record method to measure a data +point. Asynchronous instruments ([Int64ObservableCounter], [Int64ObservableUpDownCounter], [Int64ObservableGauge], @@ -109,31 +107,6 @@ respectively): If the criteria are not met, use the RegisterCallback method of the [Meter] that created the instrument to register a [Callback]. -# Avoiding Expensive Computations - -All synchronous instruments provide an Enabled method that reports whether the -instrument will process measurements for the given context. When no SDK is -registered or the instrument is otherwise disabled, Enabled returns false. This -can be used to avoid expensive measurement work when a measurement will not be -recorded: - - if counter.Enabled(ctx) { - counter.Add(ctx, 1, metric.WithAttributes(expensiveAttributes()...)) - } - -This is especially valuable when computing attributes is expensive. -[WithAttributes] performs non-trivial work on every call to build an -[attribute.Set] from the provided attributes, and that work is wasted if the -measurement is not recorded. - -For performance sensitive code where the same attribute set is used repeatedly, -prefer [WithAttributeSet]. It accepts a pre-built [attribute.Set], letting you -pay the construction cost once and reuse it across many measurements: - - attrs := attribute.NewSet(attribute.String("key", "val")) - // ... later, on each call: - counter.Add(ctx, 1, metric.WithAttributeSet(attrs)) - # API Implementations This package does not conform to the standard Go versioning policy, all of its @@ -201,4 +174,4 @@ fully implement all the API interfaces when a user updates their API. [OpenTelemetry documentation]: https://opentelemetry.io/docs/concepts/signals/metrics/ [GetMeterProvider]: https://pkg.go.dev/go.opentelemetry.io/otel#GetMeterProvider */ -package metric +package metric // import "go.opentelemetry.io/otel/metric" diff --git a/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go b/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go index 10f361b5bf..1a9dc68093 100644 --- a/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go +++ b/vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go @@ -11,7 +11,7 @@ // the API package). // // [OpenTelemetry metric API]: https://pkg.go.dev/go.opentelemetry.io/otel/metric -package embedded +package embedded // import "go.opentelemetry.io/otel/metric/embedded" // MeterProvider is embedded in // [go.opentelemetry.io/otel/metric.MeterProvider]. diff --git a/vendor/go.opentelemetry.io/otel/metric/instrument.go b/vendor/go.opentelemetry.io/otel/metric/instrument.go index e8c1c96cb1..9f48d5f117 100644 --- a/vendor/go.opentelemetry.io/otel/metric/instrument.go +++ b/vendor/go.opentelemetry.io/otel/metric/instrument.go @@ -1,11 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package metric +package metric // import "go.opentelemetry.io/otel/metric" -import ( - "go.opentelemetry.io/otel/attribute" -) +import "go.opentelemetry.io/otel/attribute" // Observable is used as a grouping mechanism for all instruments that are // updated within a Callback. @@ -230,9 +228,6 @@ type AddConfig struct { func NewAddConfig(opts []AddOption) AddConfig { config := AddConfig{attrs: *attribute.EmptySet()} for _, o := range opts { - if _, ok := o.(experimentalOption); ok { - continue - } config = o.applyAdd(config) } return config @@ -258,9 +253,6 @@ type RecordConfig struct { func NewRecordConfig(opts []RecordOption) RecordConfig { config := RecordConfig{attrs: *attribute.EmptySet()} for _, o := range opts { - if _, ok := o.(experimentalOption); ok { - continue - } config = o.applyRecord(config) } return config @@ -286,9 +278,6 @@ type ObserveConfig struct { func NewObserveConfig(opts []ObserveOption) ObserveConfig { config := ObserveConfig{attrs: *attribute.EmptySet()} for _, o := range opts { - if _, ok := o.(experimentalOption); ok { - continue - } config = o.applyObserve(config) } return config @@ -310,10 +299,6 @@ type attrOpt struct { set attribute.Set } -func (o *attrOpt) Set(set attribute.Set) { - o.set = set -} - // mergeSets returns the union of keys between a and b. Any duplicate keys will // use the value associated with b. func mergeSets(a, b attribute.Set) attribute.Set { @@ -326,7 +311,7 @@ func mergeSets(a, b attribute.Set) attribute.Set { return attribute.NewSet(merged...) } -func (o *attrOpt) applyAdd(c AddConfig) AddConfig { +func (o attrOpt) applyAdd(c AddConfig) AddConfig { switch { case o.set.Len() == 0: case c.attrs.Len() == 0: @@ -337,7 +322,7 @@ func (o *attrOpt) applyAdd(c AddConfig) AddConfig { return c } -func (o *attrOpt) applyRecord(c RecordConfig) RecordConfig { +func (o attrOpt) applyRecord(c RecordConfig) RecordConfig { switch { case o.set.Len() == 0: case c.attrs.Len() == 0: @@ -348,7 +333,7 @@ func (o *attrOpt) applyRecord(c RecordConfig) RecordConfig { return c } -func (o *attrOpt) applyObserve(c ObserveConfig) ObserveConfig { +func (o attrOpt) applyObserve(c ObserveConfig) ObserveConfig { switch { case o.set.Len() == 0: case c.attrs.Len() == 0: @@ -365,14 +350,8 @@ func (o *attrOpt) applyObserve(c ObserveConfig) ObserveConfig { // If multiple WithAttributeSet or WithAttributes options are passed the // attributes will be merged together in the order they are passed. Attributes // with duplicate keys will use the last value passed. -// -// Experimental: The returned option may implement -// [go.opentelemetry.io/otel/metric/x.Settable][attribute.Set], which can be -// used to replace the option's attribute set and reuse the option without -// additional allocations. This behavior is experimental and may be changed or -// removed in a future release without notice. func WithAttributeSet(attributes attribute.Set) MeasurementOption { - return &attrOpt{set: attributes} + return attrOpt{set: attributes} } // WithAttributes converts attributes into an attribute Set and sets the Set to @@ -390,14 +369,8 @@ func WithAttributeSet(attributes attribute.Set) MeasurementOption { // // See [WithAttributeSet] for information about how multiple WithAttributes are // merged. -// -// Experimental: The returned option may implement -// [go.opentelemetry.io/otel/metric/x.Settable][[]attribute.KeyValue], which can be -// used to replace the option's attributes and reuse the option without -// additional allocations. This behavior is experimental and may be changed or -// removed in a future release without notice. func WithAttributes(attributes ...attribute.KeyValue) MeasurementOption { cp := make([]attribute.KeyValue, len(attributes)) copy(cp, attributes) - return &attrOpt{set: attribute.NewSet(cp...)} + return attrOpt{set: attribute.NewSet(cp...)} } diff --git a/vendor/go.opentelemetry.io/otel/metric/meter.go b/vendor/go.opentelemetry.io/otel/metric/meter.go index 70ff4c7318..5606ec4bd9 100644 --- a/vendor/go.opentelemetry.io/otel/metric/meter.go +++ b/vendor/go.opentelemetry.io/otel/metric/meter.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package metric +package metric // import "go.opentelemetry.io/otel/metric" import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/metric/noop/noop.go b/vendor/go.opentelemetry.io/otel/metric/noop/noop.go index 80c0f2f229..634e73aee0 100644 --- a/vendor/go.opentelemetry.io/otel/metric/noop/noop.go +++ b/vendor/go.opentelemetry.io/otel/metric/noop/noop.go @@ -10,7 +10,7 @@ // This implementation can be embedded in other implementations of the // OpenTelemetry metric API. Doing so will mean the implementation defaults to // no operation for methods it does not implement. -package noop +package noop // import "go.opentelemetry.io/otel/metric/noop" import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go b/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go index 2770ac2dcb..abb3051d7f 100644 --- a/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go +++ b/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package metric +package metric // import "go.opentelemetry.io/otel/metric" import ( "context" @@ -51,9 +51,6 @@ type Float64CounterConfig struct { func NewFloat64CounterConfig(opts ...Float64CounterOption) Float64CounterConfig { var config Float64CounterConfig for _, o := range opts { - if _, ok := o.(experimentalOption); ok { - continue - } config = o.applyFloat64Counter(config) } return config @@ -119,9 +116,6 @@ type Float64UpDownCounterConfig struct { func NewFloat64UpDownCounterConfig(opts ...Float64UpDownCounterOption) Float64UpDownCounterConfig { var config Float64UpDownCounterConfig for _, o := range opts { - if _, ok := o.(experimentalOption); ok { - continue - } config = o.applyFloat64UpDownCounter(config) } return config @@ -158,8 +152,6 @@ type Float64Histogram interface { // Record adds an additional value to the distribution. // - // The incr value is expected to be non-negative. - // // Use the WithAttributeSet (or, if performance is not a concern, // the WithAttributes) option to include measurement attributes. // @@ -190,9 +182,6 @@ type Float64HistogramConfig struct { func NewFloat64HistogramConfig(opts ...Float64HistogramOption) Float64HistogramConfig { var config Float64HistogramConfig for _, o := range opts { - if _, ok := o.(experimentalOption); ok { - continue - } config = o.applyFloat64Histogram(config) } return config @@ -262,9 +251,6 @@ type Float64GaugeConfig struct { func NewFloat64GaugeConfig(opts ...Float64GaugeOption) Float64GaugeConfig { var config Float64GaugeConfig for _, o := range opts { - if _, ok := o.(experimentalOption); ok { - continue - } config = o.applyFloat64Gauge(config) } return config diff --git a/vendor/go.opentelemetry.io/otel/metric/syncint64.go b/vendor/go.opentelemetry.io/otel/metric/syncint64.go index c8a739c90d..5bbfaf0397 100644 --- a/vendor/go.opentelemetry.io/otel/metric/syncint64.go +++ b/vendor/go.opentelemetry.io/otel/metric/syncint64.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package metric +package metric // import "go.opentelemetry.io/otel/metric" import ( "context" @@ -51,9 +51,6 @@ type Int64CounterConfig struct { func NewInt64CounterConfig(opts ...Int64CounterOption) Int64CounterConfig { var config Int64CounterConfig for _, o := range opts { - if _, ok := o.(experimentalOption); ok { - continue - } config = o.applyInt64Counter(config) } return config @@ -119,9 +116,6 @@ type Int64UpDownCounterConfig struct { func NewInt64UpDownCounterConfig(opts ...Int64UpDownCounterOption) Int64UpDownCounterConfig { var config Int64UpDownCounterConfig for _, o := range opts { - if _, ok := o.(experimentalOption); ok { - continue - } config = o.applyInt64UpDownCounter(config) } return config @@ -158,8 +152,6 @@ type Int64Histogram interface { // Record adds an additional value to the distribution. // - // The incr value is expected to be non-negative. - // // Use the WithAttributeSet (or, if performance is not a concern, // the WithAttributes) option to include measurement attributes. // @@ -190,9 +182,6 @@ type Int64HistogramConfig struct { func NewInt64HistogramConfig(opts ...Int64HistogramOption) Int64HistogramConfig { var config Int64HistogramConfig for _, o := range opts { - if _, ok := o.(experimentalOption); ok { - continue - } config = o.applyInt64Histogram(config) } return config @@ -262,9 +251,6 @@ type Int64GaugeConfig struct { func NewInt64GaugeConfig(opts ...Int64GaugeOption) Int64GaugeConfig { var config Int64GaugeConfig for _, o := range opts { - if _, ok := o.(experimentalOption); ok { - continue - } config = o.applyInt64Gauge(config) } return config diff --git a/vendor/go.opentelemetry.io/otel/propagation.go b/vendor/go.opentelemetry.io/otel/propagation.go index 05e9b11ceb..2fd9497338 100644 --- a/vendor/go.opentelemetry.io/otel/propagation.go +++ b/vendor/go.opentelemetry.io/otel/propagation.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package otel +package otel // import "go.opentelemetry.io/otel" import ( "go.opentelemetry.io/otel/internal/global" diff --git a/vendor/go.opentelemetry.io/otel/propagation/baggage.go b/vendor/go.opentelemetry.io/otel/propagation/baggage.go index 9d7ef7c89d..2ecca3fed1 100644 --- a/vendor/go.opentelemetry.io/otel/propagation/baggage.go +++ b/vendor/go.opentelemetry.io/otel/propagation/baggage.go @@ -1,13 +1,10 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package propagation +package propagation // import "go.opentelemetry.io/otel/propagation" import ( "context" - "errors" - "fmt" - "sync" "go.opentelemetry.io/otel/baggage" "go.opentelemetry.io/otel/internal/errorhandler" @@ -16,18 +13,11 @@ import ( const ( baggageHeader = "baggage" - maxParseErrors = 5 - // W3C Baggage specification limits. // https://www.w3.org/TR/baggage/#limits - maxMembers = 64 - maxBytesPerBaggageString = 8192 + maxMembers = 64 ) -// handleExtractErrOnce limits error reporting for attacker-controlled baggage headers -// to one process-wide emission, preventing repeated extraction from flooding logs. -var handleExtractErrOnce sync.Once - // Baggage is a propagator that supports the W3C Baggage format. // // This propagates user-defined baggage associated with a trace. The complete @@ -67,9 +57,7 @@ func extractSingleBaggage(parent context.Context, carrier TextMapCarrier) contex bag, err := baggage.Parse(bStr) if err != nil { - handleExtractErrOnce.Do(func() { - errorhandler.GetErrorHandler().Handle(err) - }) + errorhandler.GetErrorHandler().Handle(err) } if bag.Len() == 0 { return parent @@ -84,60 +72,24 @@ func extractMultiBaggage(parent context.Context, carrier ValuesGetter) context.C } var members []baggage.Member - var totalBytes int - var parseErrors int - var truncateErr error - for i, bStr := range bVals { - if i > 0 { - totalBytes++ // comma separator between combined header values + for _, bStr := range bVals { + currBag, err := baggage.Parse(bStr) + if err != nil { + errorhandler.GetErrorHandler().Handle(err) } - totalBytes += len(bStr) - if totalBytes > maxBytesPerBaggageString { - // Per the W3C Baggage spec, the byte limit applies to the - // combination of all baggage headers, not each header - // individually. Mirror the single-header behavior of - // reporting the error and returning the parent context - // with no baggage attached. - handleExtractErrOnce.Do(func() { - errorhandler.GetErrorHandler().Handle(fmt.Errorf( - "baggage: aggregate header size %d exceeds %d byte limit", - totalBytes, - maxBytesPerBaggageString, - )) - }) - return parent + if currBag.Len() == 0 { + continue } - - // If members exceed the limit, stop parsing baggage. - if len(members) <= maxMembers { - currBag, err := baggage.Parse(bStr) - if err != nil { - parseErrors++ - if parseErrors <= maxParseErrors { - truncateErr = errors.Join(truncateErr, err) - } - } - if currBag.Len() == 0 { - continue - } - members = append(members, currBag.Members()...) + members = append(members, currBag.Members()...) + if len(members) >= maxMembers { + break } } - if dropped := parseErrors - maxParseErrors; dropped > 0 { - truncateErr = errors.Join(truncateErr, fmt.Errorf("and %d more error(s)", dropped)) - } - b, err := baggage.New(members...) if err != nil { - truncateErr = errors.Join(truncateErr, err) + errorhandler.GetErrorHandler().Handle(err) } - if truncateErr != nil { - handleExtractErrOnce.Do(func() { - errorhandler.GetErrorHandler().Handle(truncateErr) - }) - } - if b.Len() == 0 { return parent } diff --git a/vendor/go.opentelemetry.io/otel/propagation/doc.go b/vendor/go.opentelemetry.io/otel/propagation/doc.go index 6e2bbbb18f..33a3baf15f 100644 --- a/vendor/go.opentelemetry.io/otel/propagation/doc.go +++ b/vendor/go.opentelemetry.io/otel/propagation/doc.go @@ -10,4 +10,4 @@ package is the W3C Trace Context encoding (https://www.w3.org/TR/trace-context/), and W3C Baggage (https://www.w3.org/TR/baggage/). */ -package propagation +package propagation // import "go.opentelemetry.io/otel/propagation" diff --git a/vendor/go.opentelemetry.io/otel/propagation/propagation.go b/vendor/go.opentelemetry.io/otel/propagation/propagation.go index a3891fbe75..0a32c59aa3 100644 --- a/vendor/go.opentelemetry.io/otel/propagation/propagation.go +++ b/vendor/go.opentelemetry.io/otel/propagation/propagation.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package propagation +package propagation // import "go.opentelemetry.io/otel/propagation" import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/propagation/trace_context.go b/vendor/go.opentelemetry.io/otel/propagation/trace_context.go index ffaa903039..11f404deb7 100644 --- a/vendor/go.opentelemetry.io/otel/propagation/trace_context.go +++ b/vendor/go.opentelemetry.io/otel/propagation/trace_context.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package propagation +package propagation // import "go.opentelemetry.io/otel/propagation" import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/requirements.txt b/vendor/go.opentelemetry.io/otel/requirements.txt index b2666ab483..7c541dee79 100644 --- a/vendor/go.opentelemetry.io/otel/requirements.txt +++ b/vendor/go.opentelemetry.io/otel/requirements.txt @@ -1 +1 @@ -codespell==2.4.3 +codespell==2.4.2 diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/attribute_group.go b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/attribute_group.go index d20ad49ef8..b6b27498f2 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/attribute_group.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/attribute_group.go @@ -3,7 +3,7 @@ // Code generated from semantic convention specification. DO NOT EDIT. -package semconv +package semconv // import "go.opentelemetry.io/otel/semconv/v1.37.0" import "go.opentelemetry.io/otel/attribute" @@ -1447,11 +1447,9 @@ func AWSExtendedRequestID(val string) attribute.KeyValue { // AWSKinesisStreamName returns an attribute KeyValue conforming to the // "aws.kinesis.stream_name" semantic conventions. It represents the name of the // AWS Kinesis [stream] the request refers to. Corresponds to the `--stream-name` -// -// parameter of the Kinesis [describe-stream] operation. +// parameter of the Kinesis [describe-stream] operation. // // [stream]: https://docs.aws.amazon.com/streams/latest/dev/introduction.html -// // [describe-stream]: https://docs.aws.amazon.com/cli/latest/reference/kinesis/describe-stream.html func AWSKinesisStreamName(val string) attribute.KeyValue { return AWSKinesisStreamNameKey.String(val) @@ -1461,8 +1459,7 @@ func AWSKinesisStreamName(val string) attribute.KeyValue { // "aws.lambda.invoked_arn" semantic conventions. It represents the full invoked // ARN as provided on the `Context` passed to the function ( // `Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` -// -// applicable). +// applicable). func AWSLambdaInvokedARN(val string) attribute.KeyValue { return AWSLambdaInvokedARNKey.String(val) } @@ -2638,8 +2635,7 @@ func CloudRegion(val string) attribute.KeyValue { // "cloud.resource_id" semantic conventions. It represents the cloud // provider-specific native identifier of the monitored cloud resource (e.g. an // [ARN] on AWS, a [fully qualified resource ID] on Azure, a [full resource name] -// -// on GCP). +// on GCP). // // [ARN]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html // [fully qualified resource ID]: https://learn.microsoft.com/rest/api/resources/resources/get-by-id @@ -15194,4 +15190,4 @@ func ZOSSmfID(val string) attribute.KeyValue { // to which the z/OS system belongs too. func ZOSSysplexName(val string) attribute.KeyValue { return ZOSSysplexNameKey.String(val) -} +} \ No newline at end of file diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/doc.go index b67c64b961..1110103210 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/doc.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/doc.go @@ -6,4 +6,4 @@ // OpenTelemetry semantic conventions are agreed standardized naming // patterns for OpenTelemetry things. This package represents the v1.37.0 // version of the OpenTelemetry semantic conventions. -package semconv +package semconv // import "go.opentelemetry.io/otel/semconv/v1.37.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/error_type.go b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/error_type.go index 719241429b..267979c051 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/error_type.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/error_type.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package semconv +package semconv // import "go.opentelemetry.io/otel/semconv/v1.37.0" import ( "reflect" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/exception.go index 3fe84aae0a..e67469a4f6 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/exception.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/exception.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package semconv +package semconv // import "go.opentelemetry.io/otel/semconv/v1.37.0" const ( // ExceptionEventName is the name of the Span event representing an exception. diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/schema.go index 0009b185b9..f8a0b70441 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/schema.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/schema.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package semconv +package semconv // import "go.opentelemetry.io/otel/semconv/v1.37.0" // SchemaURL is the schema URL that matches the version of the semantic conventions // that this package defines. Semconv packages starting from v1.4.0 must declare diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/attribute_group.go b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/attribute_group.go index 0d6e205f13..080365fc19 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/attribute_group.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/attribute_group.go @@ -3,7 +3,7 @@ // Code generated from semantic convention specification. DO NOT EDIT. -package semconv +package semconv // import "go.opentelemetry.io/otel/semconv/v1.39.0" import "go.opentelemetry.io/otel/attribute" @@ -1493,11 +1493,9 @@ func AWSExtendedRequestID(val string) attribute.KeyValue { // AWSKinesisStreamName returns an attribute KeyValue conforming to the // "aws.kinesis.stream_name" semantic conventions. It represents the name of the // AWS Kinesis [stream] the request refers to. Corresponds to the `--stream-name` -// -// parameter of the Kinesis [describe-stream] operation. +// parameter of the Kinesis [describe-stream] operation. // // [stream]: https://docs.aws.amazon.com/streams/latest/dev/introduction.html -// // [describe-stream]: https://docs.aws.amazon.com/cli/latest/reference/kinesis/describe-stream.html func AWSKinesisStreamName(val string) attribute.KeyValue { return AWSKinesisStreamNameKey.String(val) @@ -1507,8 +1505,7 @@ func AWSKinesisStreamName(val string) attribute.KeyValue { // "aws.lambda.invoked_arn" semantic conventions. It represents the full invoked // ARN as provided on the `Context` passed to the function ( // `Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` -// -// applicable). +// applicable). func AWSLambdaInvokedARN(val string) attribute.KeyValue { return AWSLambdaInvokedARNKey.String(val) } @@ -2684,8 +2681,7 @@ func CloudRegion(val string) attribute.KeyValue { // "cloud.resource_id" semantic conventions. It represents the cloud // provider-specific native identifier of the monitored cloud resource (e.g. an // [ARN] on AWS, a [fully qualified resource ID] on Azure, a [full resource name] -// -// on GCP). +// on GCP). // // [ARN]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html // [fully qualified resource ID]: https://learn.microsoft.com/rest/api/resources/resources/get-by-id @@ -16240,4 +16236,4 @@ func ZOSSmfID(val string) attribute.KeyValue { // to which the z/OS system belongs too. func ZOSSysplexName(val string) attribute.KeyValue { return ZOSSysplexNameKey.String(val) -} +} \ No newline at end of file diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/doc.go index 063df62fb4..852362ef77 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/doc.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/doc.go @@ -6,4 +6,4 @@ // OpenTelemetry semantic conventions are agreed standardized naming // patterns for OpenTelemetry things. This package represents the v1.39.0 // version of the OpenTelemetry semantic conventions. -package semconv +package semconv // import "go.opentelemetry.io/otel/semconv/v1.39.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/error_type.go b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/error_type.go index 719241429b..84cf636a72 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/error_type.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/error_type.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package semconv +package semconv // import "go.opentelemetry.io/otel/semconv/v1.39.0" import ( "reflect" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/exception.go index 3fe84aae0a..7b688ecc33 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/exception.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/exception.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package semconv +package semconv // import "go.opentelemetry.io/otel/semconv/v1.39.0" const ( // ExceptionEventName is the name of the Span event representing an exception. diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/httpconv/metric.go b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/httpconv/metric.go index fa67d19717..d6ad8735a9 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/httpconv/metric.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/httpconv/metric.go @@ -26,9 +26,11 @@ var ( // with. type ErrorTypeAttr string -// ErrorTypeOther is a fallback error value to be used when the instrumentation -// doesn't define a custom value. -var ErrorTypeOther ErrorTypeAttr = "_OTHER" +var ( + // ErrorTypeOther is a fallback error value to be used when the instrumentation + // doesn't define a custom value. + ErrorTypeOther ErrorTypeAttr = "_OTHER" +) // ConnectionStateAttr is an attribute conforming to the http.connection.state // semantic conventions. It represents the state of the HTTP connection in the @@ -1262,12 +1264,13 @@ func (ServerRequestBodySize) Description() string { // // All additional attrs passed are included in the recorded value. // +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +// // The size of the request payload body in bytes. This is the number of bytes // transferred excluding headers and is often, but not always, present as the // [Content-Length] header. For requests using transport encoding, this should be // the compressed size. // -// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 // [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length func (m ServerRequestBodySize) Record( ctx context.Context, @@ -1635,12 +1638,13 @@ func (ServerResponseBodySize) Description() string { // // All additional attrs passed are included in the recorded value. // +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +// // The size of the response payload body in bytes. This is the number of bytes // transferred excluding headers and is often, but not always, present as the // [Content-Length] header. For requests using transport encoding, this should be // the compressed size. // -// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 // [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length func (m ServerResponseBodySize) Record( ctx context.Context, diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/schema.go index 3e9b6afdd9..e1a199d89b 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/schema.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/schema.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package semconv +package semconv // import "go.opentelemetry.io/otel/semconv/v1.39.0" // SchemaURL is the schema URL that matches the version of the semantic conventions // that this package defines. Semconv packages starting from v1.4.0 must declare diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/MIGRATION.md b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/MIGRATION.md new file mode 100644 index 0000000000..e246b1692d --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/MIGRATION.md @@ -0,0 +1,27 @@ + +# Migration from v1.39.0 to v1.40.0 + +The `go.opentelemetry.io/otel/semconv/v1.40.0` package should be a drop-in replacement for `go.opentelemetry.io/otel/semconv/v1.39.0` with the following exceptions. + +## Removed + +The following declarations have been removed. +Refer to the [OpenTelemetry Semantic Conventions documentation] for deprecation instructions. + +If the type is not listed in the documentation as deprecated, it has been removed in this version due to lack of applicability or use. +If you use any of these non-deprecated declarations in your Go application, please [open an issue] describing your use-case. + +- `ErrorMessage` +- `ErrorMessageKey` +- `RPCMessageCompressedSize` +- `RPCMessageCompressedSizeKey` +- `RPCMessageID` +- `RPCMessageIDKey` +- `RPCMessageTypeKey` +- `RPCMessageTypeReceived` +- `RPCMessageTypeSent` +- `RPCMessageUncompressedSize` +- `RPCMessageUncompressedSizeKey` + +[OpenTelemetry Semantic Conventions documentation]: https://github.com/open-telemetry/semantic-conventions +[open an issue]: https://github.com/open-telemetry/opentelemetry-go/issues/new?template=Blank+issue diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/README.md b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/README.md new file mode 100644 index 0000000000..c51b7fb7b0 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/README.md @@ -0,0 +1,3 @@ +# Semconv v1.40.0 + +[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/semconv/v1.40.0)](https://pkg.go.dev/go.opentelemetry.io/otel/semconv/v1.40.0) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/attribute_group.go b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/attribute_group.go similarity index 90% rename from vendor/go.opentelemetry.io/otel/semconv/v1.43.0/attribute_group.go rename to vendor/go.opentelemetry.io/otel/semconv/v1.40.0/attribute_group.go index 770388dfc6..ee6b1f79d6 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/attribute_group.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/attribute_group.go @@ -3,7 +3,7 @@ // Code generated from semantic convention specification. DO NOT EDIT. -package semconv +package semconv // import "go.opentelemetry.io/otel/semconv/v1.40.0" import "go.opentelemetry.io/otel/attribute" @@ -22,7 +22,7 @@ const ( // [Activity lifecycle callbacks], and from which the `OS identifiers` are // derived. // - // [Activity lifecycle callbacks]: https://developer.android.com/guide/components/activities/activity-lifecycle#lifecycle-callbacks + // [Activity lifecycle callbacks]: https://developer.android.com/guide/components/activities/activity-lifecycle#lc AndroidAppStateKey = attribute.Key("android.app.state") // AndroidOSAPILevelKey is the attribute Key conforming to the @@ -87,24 +87,6 @@ const ( // "9f2b833506aa6973a92fde9733e6271f", "my-app-1.0.0-code-123" AppBuildIDKey = attribute.Key("app.build_id") - // AppCrashIDKey is the attribute Key conforming to the "app.crash.id" semantic - // conventions. It represents a unique identifier representing an instance of an - // end-user facing app crash. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "083d3d2d-9a0e-47f8-be3d-bc3c5538ba38" - // Note: Its value MAY be meaningful and be used as a reference for telemetry - // and metadata recorded by - // the same instrumentation (e.g. it is an ID generated by an external source - // that captured the crash). - // It MAY come from a source external to the instrumentation such that it can be - // used to look up additional - // data from other sources as well as facilitate deduplication. - AppCrashIDKey = attribute.Key("app.crash.id") - // AppInstallationIDKey is the attribute Key conforming to the // "app.installation.id" semantic conventions. It represents a unique identifier // representing the installation of an application on a specific device. @@ -270,13 +252,6 @@ func AppBuildID(val string) attribute.KeyValue { return AppBuildIDKey.String(val) } -// AppCrashID returns an attribute KeyValue conforming to the "app.crash.id" -// semantic conventions. It represents a unique identifier representing an -// instance of an end-user facing app crash. -func AppCrashID(val string) attribute.KeyValue { - return AppCrashIDKey.String(val) -} - // AppInstallationID returns an attribute KeyValue conforming to the // "app.installation.id" semantic conventions. It represents a unique identifier // representing the installation of an application on a specific device. @@ -975,7 +950,7 @@ const ( // of the [AWS Lambda EvenSource Mapping]. An event source is mapped to a lambda // function. It's contents are read by Lambda and used to trigger a function. // This isn't available in the lambda execution context or the lambda runtime - // environment. This is going to be populated by the AWS SDK for each language + // environtment. This is going to be populated by the AWS SDK for each language // when that UUID is present. Some of these operations are // Create/Delete/Get/List/Update EventSourceMapping. // @@ -1211,7 +1186,7 @@ const ( // AWSSecretsmanagerSecretARNKey is the attribute Key conforming to the // "aws.secretsmanager.secret.arn" semantic conventions. It represents the ARN - // of the Secret stored in the Secrets Manager. + // of the Secret stored in the Secrets Mangger. // // Type: string // RequirementLevel: Recommended @@ -1540,7 +1515,7 @@ func AWSLambdaInvokedARN(val string) attribute.KeyValue { // of the [AWS Lambda EvenSource Mapping]. An event source is mapped to a lambda // function. It's contents are read by Lambda and used to trigger a function. // This isn't available in the lambda execution context or the lambda runtime -// environment. This is going to be populated by the AWS SDK for each language +// environtment. This is going to be populated by the AWS SDK for each language // when that UUID is present. Some of these operations are // Create/Delete/Get/List/Update EventSourceMapping. // @@ -1634,7 +1609,7 @@ func AWSS3UploadID(val string) attribute.KeyValue { // AWSSecretsmanagerSecretARN returns an attribute KeyValue conforming to the // "aws.secretsmanager.secret.arn" semantic conventions. It represents the ARN of -// the Secret stored in the Secrets Manager. +// the Secret stored in the Secrets Mangger. func AWSSecretsmanagerSecretARN(val string) attribute.KeyValue { return AWSSecretsmanagerSecretARNKey.String(val) } @@ -1769,19 +1744,6 @@ const ( // Examples: 1000, 1002 AzureCosmosDBResponseSubStatusCodeKey = attribute.Key("azure.cosmosdb.response.sub_status_code") - // AzureResourceGroupNameKey is the attribute Key conforming to the - // "azure.resource_group.name" semantic conventions. It represents the name of - // the Azure [resource group] the resource belongs to. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "my-resource-group", "rg-myapp-prod" - // - // [resource group]: https://learn.microsoft.com/azure/azure-resource-manager/management/manage-resource-groups-portal - AzureResourceGroupNameKey = attribute.Key("azure.resource_group.name") - // AzureResourceProviderNamespaceKey is the attribute Key conforming to the // "azure.resource_provider.namespace" semantic conventions. It represents the // [Azure Resource Provider Namespace] as recognized by the client. @@ -1846,15 +1808,6 @@ func AzureCosmosDBResponseSubStatusCode(val int) attribute.KeyValue { return AzureCosmosDBResponseSubStatusCodeKey.Int(val) } -// AzureResourceGroupName returns an attribute KeyValue conforming to the -// "azure.resource_group.name" semantic conventions. It represents the name of -// the Azure [resource group] the resource belongs to. -// -// [resource group]: https://learn.microsoft.com/azure/azure-resource-manager/management/manage-resource-groups-portal -func AzureResourceGroupName(val string) attribute.KeyValue { - return AzureResourceGroupNameKey.String(val) -} - // AzureResourceProviderNamespace returns an attribute KeyValue conforming to the // "azure.resource_provider.namespace" semantic conventions. It represents the // [Azure Resource Provider Namespace] as recognized by the client. @@ -1918,19 +1871,6 @@ const ( // [UA client hints API]: https://wicg.github.io/ua-client-hints/#interface BrowserBrandsKey = attribute.Key("browser.brands") - // BrowserDocumentURLFullKey is the attribute Key conforming to the - // "browser.document.url.full" semantic conventions. It represents the absolute - // URL of the current browser document according to [RFC3986]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "https://www.example.com/search?q=OpenTelemetry#SemConv" - // - // [RFC3986]: https://www.rfc-editor.org/rfc/rfc3986 - BrowserDocumentURLFullKey = attribute.Key("browser.document.url.full") - // BrowserLanguageKey is the attribute Key conforming to the "browser.language" // semantic conventions. It represents the preferred language of the user using // the browser. @@ -1993,15 +1933,6 @@ func BrowserBrands(val ...string) attribute.KeyValue { return BrowserBrandsKey.StringSlice(val) } -// BrowserDocumentURLFull returns an attribute KeyValue conforming to the -// "browser.document.url.full" semantic conventions. It represents the absolute -// URL of the current browser document according to [RFC3986]. -// -// [RFC3986]: https://www.rfc-editor.org/rfc/rfc3986 -func BrowserDocumentURLFull(val string) attribute.KeyValue { - return BrowserDocumentURLFullKey.String(val) -} - // BrowserLanguage returns an attribute KeyValue conforming to the // "browser.language" semantic conventions. It represents the preferred language // of the user using the browser. @@ -2176,7 +2107,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "BUILD", "RUN", "SYNC" CICDPipelineActionNameKey = attribute.Key("cicd.pipeline.action.name") @@ -2187,7 +2118,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "Build and Test", "Lint", "Deploy Go Project", // "deploy_to_environment" @@ -2199,9 +2130,9 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // - // Examples: "success", "failure", "timeout", "skip" + // Examples: "success", "failure", "timeout", "skipped" CICDPipelineResultKey = attribute.Key("cicd.pipeline.result") // CICDPipelineRunIDKey is the attribute Key conforming to the @@ -2210,7 +2141,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "120912" CICDPipelineRunIDKey = attribute.Key("cicd.pipeline.run.id") @@ -2221,7 +2152,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "pending", "executing", "finalizing" CICDPipelineRunStateKey = attribute.Key("cicd.pipeline.run.state") @@ -2233,7 +2164,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: // "https://github.com/open-telemetry/semantic-conventions/actions/runs/9753949763?pr=1075" @@ -2249,7 +2180,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "Run GoLang Linter", "Go Build", "go-test", "deploy_binary" // @@ -2262,14 +2193,9 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "12097" - // Note: For a given pipeline run and task, the `cicd.pipeline.task.run.id` MUST - // be unique within that run. For the same task across different runs of the - // same pipeline, the `cicd.pipeline.task.run.id` MAY remain the same, enabling - // correlation of `cicd.pipeline.task.run.result` values across multiple - // pipeline runs. CICDPipelineTaskRunIDKey = attribute.Key("cicd.pipeline.task.run.id") // CICDPipelineTaskRunResultKey is the attribute Key conforming to the @@ -2278,9 +2204,9 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // - // Examples: "success", "failure", "timeout", "skip" + // Examples: "success", "failure", "timeout", "skipped" CICDPipelineTaskRunResultKey = attribute.Key("cicd.pipeline.task.run.result") // CICDPipelineTaskRunURLFullKey is the attribute Key conforming to the @@ -2290,7 +2216,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: // "https://github.com/open-telemetry/semantic-conventions/actions/runs/9753949763/job/26920038674?pr=1075" @@ -2304,52 +2230,52 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "build", "test", "deploy" CICDPipelineTaskTypeKey = attribute.Key("cicd.pipeline.task.type") // CICDSystemComponentKey is the attribute Key conforming to the // "cicd.system.component" semantic conventions. It represents the name of a - // component of the CI/CD system. + // component of the CICD system. // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "controller", "scheduler", "agent" CICDSystemComponentKey = attribute.Key("cicd.system.component") // CICDWorkerIDKey is the attribute Key conforming to the "cicd.worker.id" // semantic conventions. It represents the unique identifier of a worker within - // a CI/CD system. + // a CICD system. // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "abc123", "10.0.1.2", "controller" CICDWorkerIDKey = attribute.Key("cicd.worker.id") // CICDWorkerNameKey is the attribute Key conforming to the "cicd.worker.name" - // semantic conventions. It represents the name of a worker within a CI/CD + // semantic conventions. It represents the name of a worker within a CICD // system. // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "agent-abc", "controller", "Ubuntu LTS" CICDWorkerNameKey = attribute.Key("cicd.worker.name") // CICDWorkerStateKey is the attribute Key conforming to the "cicd.worker.state" - // semantic conventions. It represents the state of a CI/CD worker / agent. + // semantic conventions. It represents the state of a CICD worker / agent. // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // - // Examples: "available", "busy", "offline" + // Examples: "idle", "busy", "down" CICDWorkerStateKey = attribute.Key("cicd.worker.state") // CICDWorkerURLFullKey is the attribute Key conforming to the @@ -2359,7 +2285,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "https://cicd.example.org/worker/abc123" // @@ -2421,21 +2347,21 @@ func CICDPipelineTaskRunURLFull(val string) attribute.KeyValue { // CICDSystemComponent returns an attribute KeyValue conforming to the // "cicd.system.component" semantic conventions. It represents the name of a -// component of the CI/CD system. +// component of the CICD system. func CICDSystemComponent(val string) attribute.KeyValue { return CICDSystemComponentKey.String(val) } // CICDWorkerID returns an attribute KeyValue conforming to the "cicd.worker.id" // semantic conventions. It represents the unique identifier of a worker within a -// CI/CD system. +// CICD system. func CICDWorkerID(val string) attribute.KeyValue { return CICDWorkerIDKey.String(val) } // CICDWorkerName returns an attribute KeyValue conforming to the // "cicd.worker.name" semantic conventions. It represents the name of a worker -// within a CI/CD system. +// within a CICD system. func CICDWorkerName(val string) attribute.KeyValue { return CICDWorkerNameKey.String(val) } @@ -2453,39 +2379,39 @@ func CICDWorkerURLFull(val string) attribute.KeyValue { // Enum values for cicd.pipeline.action.name var ( // The pipeline run is executing a build. - // Stability: release_candidate + // Stability: development CICDPipelineActionNameBuild = CICDPipelineActionNameKey.String("BUILD") // The pipeline run is executing. - // Stability: release_candidate + // Stability: development CICDPipelineActionNameRun = CICDPipelineActionNameKey.String("RUN") // The pipeline run is executing a sync. - // Stability: release_candidate + // Stability: development CICDPipelineActionNameSync = CICDPipelineActionNameKey.String("SYNC") ) // Enum values for cicd.pipeline.result var ( // The pipeline run finished successfully. - // Stability: release_candidate + // Stability: development CICDPipelineResultSuccess = CICDPipelineResultKey.String("success") // The pipeline run did not finish successfully, eg. due to a compile error or a // failing test. Such failures are usually detected by non-zero exit codes of // the tools executed in the pipeline run. - // Stability: release_candidate + // Stability: development CICDPipelineResultFailure = CICDPipelineResultKey.String("failure") - // The pipeline run failed due to an error in the CI/CD system, eg. due to the + // The pipeline run failed due to an error in the CICD system, eg. due to the // worker being killed. - // Stability: release_candidate + // Stability: development CICDPipelineResultError = CICDPipelineResultKey.String("error") // A timeout caused the pipeline run to be interrupted. - // Stability: release_candidate + // Stability: development CICDPipelineResultTimeout = CICDPipelineResultKey.String("timeout") // The pipeline run was cancelled, eg. by a user manually cancelling the // pipeline run. - // Stability: release_candidate + // Stability: development CICDPipelineResultCancellation = CICDPipelineResultKey.String("cancellation") // The pipeline run was skipped, eg. due to a precondition not being met. - // Stability: release_candidate + // Stability: development CICDPipelineResultSkip = CICDPipelineResultKey.String("skip") ) @@ -2495,66 +2421,66 @@ var ( // the execution of the run starts (eg. time spent in a queue, provisioning // agents, creating run resources). // - // Stability: release_candidate + // Stability: development CICDPipelineRunStatePending = CICDPipelineRunStateKey.String("pending") // The executing state spans the execution of any run tasks (eg. build, test). - // Stability: release_candidate + // Stability: development CICDPipelineRunStateExecuting = CICDPipelineRunStateKey.String("executing") // The finalizing state spans from when the run has finished executing (eg. // cleanup of run resources). - // Stability: release_candidate + // Stability: development CICDPipelineRunStateFinalizing = CICDPipelineRunStateKey.String("finalizing") ) // Enum values for cicd.pipeline.task.run.result var ( // The task run finished successfully. - // Stability: release_candidate + // Stability: development CICDPipelineTaskRunResultSuccess = CICDPipelineTaskRunResultKey.String("success") // The task run did not finish successfully, eg. due to a compile error or a // failing test. Such failures are usually detected by non-zero exit codes of // the tools executed in the task run. - // Stability: release_candidate + // Stability: development CICDPipelineTaskRunResultFailure = CICDPipelineTaskRunResultKey.String("failure") - // The task run failed due to an error in the CI/CD system, eg. due to the - // worker being killed. - // Stability: release_candidate + // The task run failed due to an error in the CICD system, eg. due to the worker + // being killed. + // Stability: development CICDPipelineTaskRunResultError = CICDPipelineTaskRunResultKey.String("error") // A timeout caused the task run to be interrupted. - // Stability: release_candidate + // Stability: development CICDPipelineTaskRunResultTimeout = CICDPipelineTaskRunResultKey.String("timeout") // The task run was cancelled, eg. by a user manually cancelling the task run. - // Stability: release_candidate + // Stability: development CICDPipelineTaskRunResultCancellation = CICDPipelineTaskRunResultKey.String("cancellation") // The task run was skipped, eg. due to a precondition not being met. - // Stability: release_candidate + // Stability: development CICDPipelineTaskRunResultSkip = CICDPipelineTaskRunResultKey.String("skip") ) // Enum values for cicd.pipeline.task.type var ( // build - // Stability: release_candidate + // Stability: development CICDPipelineTaskTypeBuild = CICDPipelineTaskTypeKey.String("build") // test - // Stability: release_candidate + // Stability: development CICDPipelineTaskTypeTest = CICDPipelineTaskTypeKey.String("test") // deploy - // Stability: release_candidate + // Stability: development CICDPipelineTaskTypeDeploy = CICDPipelineTaskTypeKey.String("deploy") ) // Enum values for cicd.worker.state var ( - // The worker is not performing work for the CI/CD system. It is available to - // the CI/CD system to perform work on (online / idle). - // Stability: release_candidate + // The worker is not performing work for the CICD system. It is available to the + // CICD system to perform work on (online / idle). + // Stability: development CICDWorkerStateAvailable = CICDWorkerStateKey.String("available") - // The worker is performing work for the CI/CD system. - // Stability: release_candidate + // The worker is performing work for the CICD system. + // Stability: development CICDWorkerStateBusy = CICDWorkerStateKey.String("busy") - // The worker is not available to the CI/CD system (disconnected / down). - // Stability: release_candidate + // The worker is not available to the CICD system (disconnected / down). + // Stability: development CICDWorkerStateOffline = CICDWorkerStateKey.String("offline") ) @@ -2613,9 +2539,7 @@ const ( // RequirementLevel: Recommended // Stability: Development // - // Examples: "111111111111", "opentelemetry", - // "22222222-2222-2222-2222-222222222222" - // Note: For Azure, this is the subscription ID. + // Examples: "111111111111", "opentelemetry" CloudAccountIDKey = attribute.Key("cloud.account.id") // CloudAvailabilityZoneKey is the attribute Key conforming to the @@ -3507,7 +3431,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "a3bf90e006b2" // @@ -3543,7 +3467,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "gcr.io/opentelemetry/operator" ContainerImageNameKey = attribute.Key("container.image.name") @@ -3554,7 +3478,7 @@ const ( // // Type: string[] // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: // "example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb", @@ -3573,7 +3497,7 @@ const ( // // Type: string[] // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "v1.27.1", "3.5.7-0" // @@ -3594,7 +3518,7 @@ const ( // ContainerRuntimeDescriptionKey is the attribute Key conforming to the // "container.runtime.description" semantic conventions. It represents a // description about the runtime which could include, for example details about - // the CRI/API version being used or other customizations. + // the CRI/API version being used or other customisations. // // Type: string // RequirementLevel: Recommended @@ -3725,7 +3649,7 @@ func ContainerName(val string) attribute.KeyValue { // ContainerRuntimeDescription returns an attribute KeyValue conforming to the // "container.runtime.description" semantic conventions. It represents a // description about the runtime which could include, for example details about -// the CRI/API version being used or other customizations. +// the CRI/API version being used or other customisations. func ContainerRuntimeDescription(val string) attribute.KeyValue { return ContainerRuntimeDescriptionKey.String(val) } @@ -3762,7 +3686,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "user", "system" CPUModeKey = attribute.Key("cpu.mode") @@ -3778,26 +3702,29 @@ func CPULogicalNumber(val int) attribute.KeyValue { // Enum values for cpu.mode var ( // User - // Stability: release_candidate + // Stability: development CPUModeUser = CPUModeKey.String("user") // System - // Stability: release_candidate + // Stability: development CPUModeSystem = CPUModeKey.String("system") // Nice - // Stability: release_candidate + // Stability: development CPUModeNice = CPUModeKey.String("nice") // Idle - // Stability: release_candidate + // Stability: development CPUModeIdle = CPUModeKey.String("idle") // IO Wait - // Stability: release_candidate + // Stability: development CPUModeIOWait = CPUModeKey.String("iowait") // Interrupt - // Stability: release_candidate + // Stability: development CPUModeInterrupt = CPUModeKey.String("interrupt") // Steal - // Stability: release_candidate + // Stability: development CPUModeSteal = CPUModeKey.String("steal") + // Kernel + // Stability: development + CPUModeKernel = CPUModeKey.String("kernel") ) // Namespace: db @@ -3871,46 +3798,15 @@ const ( // DBOperationBatchSizeKey is the attribute Key conforming to the // "db.operation.batch.size" semantic conventions. It represents the number of - // database operations included in a batch operation. + // queries included in a batch operation. // // Type: int // RequirementLevel: Recommended // Stability: Stable // // Examples: 2, 3, 4 - // Note: Except for empty batch requests described below, a batch operation - // contains two - // or more database operations explicitly submitted as separate operations in a - // single - // client call, protocol message, or database command. - // - // Requests to batch APIs that contain only one operation SHOULD be modeled as - // single - // operations, not as batch operations. - // - // A database call is not a batch operation solely because one operation accepts - // multiple operands, such as keys, rows, documents, points, or other data - // elements, - // including Redis [`MGET`] with - // multiple keys. - // - // In batch APIs that execute the same parameterized operation with parameter - // sets, - // each parameter set represents one database operation for determining whether - // the - // request is a batch operation. Requests with only one parameter set SHOULD be - // modeled - // as single operations, not as batch operations. - // - // `db.operation.batch.size` SHOULD be set to the number of operations in the - // batch. - // It SHOULD NOT be set for non-batch operations. - // - // A request to execute a batch operation with no operations SHOULD also be - // treated - // as a batch operation, and `db.operation.batch.size` SHOULD be set to `0`. - // - // [`MGET`]: https://redis.io/docs/latest/commands/mget/ + // Note: Operations are only considered batches when they contain two or more + // operations, and so `db.operation.batch.size` SHOULD never be `1`. DBOperationBatchSizeKey = attribute.Key("db.operation.batch.size") // DBOperationNameKey is the attribute Key conforming to the "db.operation.name" @@ -4079,7 +3975,7 @@ func DBNamespace(val string) attribute.KeyValue { // DBOperationBatchSize returns an attribute KeyValue conforming to the // "db.operation.batch.size" semantic conventions. It represents the number of -// database operations included in a batch operation. +// queries included in a batch operation. func DBOperationBatchSize(val int) attribute.KeyValue { return DBOperationBatchSizeKey.Int(val) } @@ -4364,9 +4260,9 @@ const ( // "deployment.environment.name" semantic conventions. It represents the name of // the [deployment environment] (aka deployment tier). // - // Type: Enum + // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Development // // Examples: "staging", "production" // Note: `deployment.environment.name` does not affect the uniqueness @@ -4416,6 +4312,15 @@ const ( DeploymentStatusKey = attribute.Key("deployment.status") ) +// DeploymentEnvironmentName returns an attribute KeyValue conforming to the +// "deployment.environment.name" semantic conventions. It represents the name of +// the [deployment environment] (aka deployment tier). +// +// [deployment environment]: https://wikipedia.org/wiki/Deployment_environment +func DeploymentEnvironmentName(val string) attribute.KeyValue { + return DeploymentEnvironmentNameKey.String(val) +} + // DeploymentID returns an attribute KeyValue conforming to the "deployment.id" // semantic conventions. It represents the id of the deployment. func DeploymentID(val string) attribute.KeyValue { @@ -4429,22 +4334,6 @@ func DeploymentName(val string) attribute.KeyValue { return DeploymentNameKey.String(val) } -// Enum values for deployment.environment.name -var ( - // Production environment - // Stability: stable - DeploymentEnvironmentNameProduction = DeploymentEnvironmentNameKey.String("production") - // Staging environment - // Stability: stable - DeploymentEnvironmentNameStaging = DeploymentEnvironmentNameKey.String("staging") - // Testing environment - // Stability: stable - DeploymentEnvironmentNameTest = DeploymentEnvironmentNameKey.String("test") - // Development environment - // Stability: stable - DeploymentEnvironmentNameDevelopment = DeploymentEnvironmentNameKey.String("development") -) - // Enum values for deployment.status var ( // failed @@ -4610,7 +4499,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "read" DiskIODirectionKey = attribute.Key("disk.io.direction") @@ -4619,10 +4508,10 @@ const ( // Enum values for disk.io.direction var ( // read - // Stability: release_candidate + // Stability: development DiskIODirectionRead = DiskIODirectionKey.String("read") // write - // Stability: release_candidate + // Stability: development DiskIODirectionWrite = DiskIODirectionKey.String("write") ) @@ -4756,12 +4645,6 @@ const ( // When `error.type` is set to a type (e.g., an exception type), its // canonical class name identifying the type within the artifact SHOULD be used. // - // If the recorded error type is a wrapper that is not meaningful for - // failure classification, instrumentation MAY use the type of the inner - // error instead. For example, in Go, errors created with `fmt.Errorf` - // using `%w` MAY be unwrapped when the wrapper type does not help - // classify the failure. - // // Instrumentations SHOULD document the list of errors they report. // // The cardinality of `error.type` within one instrumentation library SHOULD be @@ -4835,11 +4718,6 @@ const ( // Stability: Stable // // Examples: "java.net.ConnectException", "OSError" - // Note: If the recorded exception type is a wrapper that is not meaningful for - // failure classification, instrumentation MAY use the type of the inner - // exception instead. For example, in Go, errors created with `fmt.Errorf` - // using `%w` MAY be unwrapped when the wrapper type does not help - // classify the failure. ExceptionTypeKey = attribute.Key("exception.type") ) @@ -5595,45 +5473,6 @@ const ( // Examples: "256383" FileInodeKey = attribute.Key("file.inode") - // FileLockMechanismKey is the attribute Key conforming to the - // "file.lock.mechanism" semantic conventions. It represents the lock mechanism - // such as noted by [POSIX]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "POSIX", "FLOCK", "DELEG", "LEASE" - // - // [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html - FileLockMechanismKey = attribute.Key("file.lock.mechanism") - - // FileLockModeKey is the attribute Key conforming to the "file.lock.mode" - // semantic conventions. It represents the mode of lock or operation such as - // documented by [POSIX]. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "ADVISORY", "MANDATORY", "BREAKING", "ACTIVE", "BREAKER" - // - // [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html - FileLockModeKey = attribute.Key("file.lock.mode") - - // FileLockTypeKey is the attribute Key conforming to the "file.lock.type" - // semantic conventions. It represents the lock type as represented by i.e. - // [POSIX]'s l_type. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "read" - // - // [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html - FileLockTypeKey = attribute.Key("file.lock.type") - // FileModeKey is the attribute Key conforming to the "file.mode" semantic // conventions. It represents the mode of the file in octal representation. // @@ -5790,24 +5629,6 @@ func FileInode(val string) attribute.KeyValue { return FileInodeKey.String(val) } -// FileLockMechanism returns an attribute KeyValue conforming to the -// "file.lock.mechanism" semantic conventions. It represents the lock mechanism -// such as noted by [POSIX]. -// -// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html -func FileLockMechanism(val string) attribute.KeyValue { - return FileLockMechanismKey.String(val) -} - -// FileLockMode returns an attribute KeyValue conforming to the "file.lock.mode" -// semantic conventions. It represents the mode of lock or operation such as -// documented by [POSIX]. -// -// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html -func FileLockMode(val string) attribute.KeyValue { - return FileLockModeKey.String(val) -} - // FileMode returns an attribute KeyValue conforming to the "file.mode" semantic // conventions. It represents the mode of the file in octal representation. func FileMode(val string) attribute.KeyValue { @@ -5862,16 +5683,6 @@ func FileSymbolicLinkTargetPath(val string) attribute.KeyValue { return FileSymbolicLinkTargetPathKey.String(val) } -// Enum values for file.lock.type -var ( - // read - // Stability: development - FileLockTypeRead = FileLockTypeKey.String("read") - // write - // Stability: development - FileLockTypeWrite = FileLockTypeKey.String("write") -) - // Namespace: gcp const ( // GCPAppHubApplicationContainerKey is the attribute Key conforming to the @@ -6318,13 +6129,6 @@ func GCPGCEInstanceHostname(val string) attribute.KeyValue { return GCPGCEInstanceHostnameKey.String(val) } -// GCPGCEInstanceLabels returns an attribute KeyValue conforming to the -// "gcp.gce.instance.labels" semantic conventions. It represents the GCE instance -// labels, `` being the label name and the value being the label value. -func GCPGCEInstanceLabels(key string, val string) attribute.KeyValue { - return attribute.String("gcp.gce.instance.labels."+key, val) -} - // GCPGCEInstanceName returns an attribute KeyValue conforming to the // "gcp.gce.instance.name" semantic conventions. It represents the instance name // of a GCE instance. This is the value provided by `host.name`, the visible name @@ -6487,92 +6291,1185 @@ var ( GCPAppHubDestinationWorkloadEnvironmentTypeDevelopment = GCPAppHubDestinationWorkloadEnvironmentTypeKey.String("DEVELOPMENT") ) -// Namespace: geo +// Namespace: gen_ai const ( - // GeoContinentCodeKey is the attribute Key conforming to the - // "geo.continent.code" semantic conventions. It represents the two-letter code - // representing continent’s name. + // GenAIAgentDescriptionKey is the attribute Key conforming to the + // "gen_ai.agent.description" semantic conventions. It represents the free-form + // description of the GenAI agent provided by the application. // - // Type: Enum + // Type: string // RequirementLevel: Recommended // Stability: Development // - // Examples: - GeoContinentCodeKey = attribute.Key("geo.continent.code") + // Examples: "Helps with math problems", "Generates fiction stories" + GenAIAgentDescriptionKey = attribute.Key("gen_ai.agent.description") - // GeoCountryISOCodeKey is the attribute Key conforming to the - // "geo.country.iso_code" semantic conventions. It represents the two-letter ISO - // Country Code ([ISO 3166-1 alpha2]). + // GenAIAgentIDKey is the attribute Key conforming to the "gen_ai.agent.id" + // semantic conventions. It represents the unique identifier of the GenAI agent. // // Type: string // RequirementLevel: Recommended // Stability: Development // - // Examples: "CA" + // Examples: "asst_5j66UpCpwteGg4YSxUnt7lPY" + GenAIAgentIDKey = attribute.Key("gen_ai.agent.id") + + // GenAIAgentNameKey is the attribute Key conforming to the "gen_ai.agent.name" + // semantic conventions. It represents the human-readable name of the GenAI + // agent provided by the application. // - // [ISO 3166-1 alpha2]: https://wikipedia.org/wiki/ISO_3166-1#Codes - GeoCountryISOCodeKey = attribute.Key("geo.country.iso_code") + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Math Tutor", "Fiction Writer" + GenAIAgentNameKey = attribute.Key("gen_ai.agent.name") - // GeoLocalityNameKey is the attribute Key conforming to the "geo.locality.name" - // semantic conventions. It represents the locality name. Represents the name of - // a city, town, village, or similar populated place. + // GenAIAgentVersionKey is the attribute Key conforming to the + // "gen_ai.agent.version" semantic conventions. It represents the version of the + // GenAI agent. // // Type: string // RequirementLevel: Recommended // Stability: Development // - // Examples: "Montreal", "Berlin" - GeoLocalityNameKey = attribute.Key("geo.locality.name") + // Examples: "1.0.0", "2025-05-01" + GenAIAgentVersionKey = attribute.Key("gen_ai.agent.version") - // GeoLocationLatKey is the attribute Key conforming to the "geo.location.lat" - // semantic conventions. It represents the latitude of the geo location in - // [WGS84]. + // GenAIConversationIDKey is the attribute Key conforming to the + // "gen_ai.conversation.id" semantic conventions. It represents the unique + // identifier for a conversation (session, thread), used to store and correlate + // messages within this conversation. // - // Type: double + // Type: string // RequirementLevel: Recommended // Stability: Development // - // Examples: 45.505918 + // Examples: "conv_5j66UpCpwteGg4YSxUnt7lPY" + GenAIConversationIDKey = attribute.Key("gen_ai.conversation.id") + + // GenAIDataSourceIDKey is the attribute Key conforming to the + // "gen_ai.data_source.id" semantic conventions. It represents the data source + // identifier. // - // [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 - GeoLocationLatKey = attribute.Key("geo.location.lat") + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "H7STPQYOND" + // Note: Data sources are used by AI agents and RAG applications to store + // grounding data. A data source may be an external database, object store, + // document collection, website, or any other storage system used by the GenAI + // agent or application. The `gen_ai.data_source.id` SHOULD match the identifier + // used by the GenAI system rather than a name specific to the external storage, + // such as a database or object store. Semantic conventions referencing + // `gen_ai.data_source.id` MAY also leverage additional attributes, such as + // `db.*`, to further identify and describe the data source. + GenAIDataSourceIDKey = attribute.Key("gen_ai.data_source.id") - // GeoLocationLonKey is the attribute Key conforming to the "geo.location.lon" - // semantic conventions. It represents the longitude of the geo location in - // [WGS84]. + // GenAIEmbeddingsDimensionCountKey is the attribute Key conforming to the + // "gen_ai.embeddings.dimension.count" semantic conventions. It represents the + // number of dimensions the resulting output embeddings should have. // - // Type: double + // Type: int // RequirementLevel: Recommended // Stability: Development // - // Examples: -73.61483 + // Examples: 512, 1024 + GenAIEmbeddingsDimensionCountKey = attribute.Key("gen_ai.embeddings.dimension.count") + + // GenAIEvaluationExplanationKey is the attribute Key conforming to the + // "gen_ai.evaluation.explanation" semantic conventions. It represents a + // free-form explanation for the assigned score provided by the evaluator. // - // [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 - GeoLocationLonKey = attribute.Key("geo.location.lon") + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "The response is factually accurate but lacks sufficient detail to + // fully address the question." + GenAIEvaluationExplanationKey = attribute.Key("gen_ai.evaluation.explanation") - // GeoPostalCodeKey is the attribute Key conforming to the "geo.postal_code" - // semantic conventions. It represents the postal code associated with the - // location. Values appropriate for this field may also be known as a postcode - // or ZIP code and will vary widely from country to country. + // GenAIEvaluationNameKey is the attribute Key conforming to the + // "gen_ai.evaluation.name" semantic conventions. It represents the name of the + // evaluation metric used for the GenAI response. // // Type: string // RequirementLevel: Recommended // Stability: Development // - // Examples: "94040" - GeoPostalCodeKey = attribute.Key("geo.postal_code") + // Examples: "Relevance", "IntentResolution" + GenAIEvaluationNameKey = attribute.Key("gen_ai.evaluation.name") - // GeoRegionISOCodeKey is the attribute Key conforming to the - // "geo.region.iso_code" semantic conventions. It represents the region ISO code - // ([ISO 3166-2]). + // GenAIEvaluationScoreLabelKey is the attribute Key conforming to the + // "gen_ai.evaluation.score.label" semantic conventions. It represents the human + // readable label for evaluation. // // Type: string // RequirementLevel: Recommended // Stability: Development // - // Examples: "CA-QC" + // Examples: "relevant", "not_relevant", "correct", "incorrect", "pass", "fail" + // Note: This attribute provides a human-readable interpretation of the + // evaluation score produced by an evaluator. For example, a score value of 1 + // could mean "relevant" in one evaluation system and "not relevant" in another, + // depending on the scoring range and evaluator. The label SHOULD have low + // cardinality. Possible values depend on the evaluation metric and evaluator + // used; implementations SHOULD document the possible values. + GenAIEvaluationScoreLabelKey = attribute.Key("gen_ai.evaluation.score.label") + + // GenAIEvaluationScoreValueKey is the attribute Key conforming to the + // "gen_ai.evaluation.score.value" semantic conventions. It represents the + // evaluation score returned by the evaluator. // - // [ISO 3166-2]: https://wikipedia.org/wiki/ISO_3166-2 + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 4.0 + GenAIEvaluationScoreValueKey = attribute.Key("gen_ai.evaluation.score.value") + + // GenAIInputMessagesKey is the attribute Key conforming to the + // "gen_ai.input.messages" semantic conventions. It represents the chat history + // provided to the model as an input. + // + // Type: any + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "[\n {\n "role": "user",\n "parts": [\n {\n "type": "text",\n + // "content": "Weather in Paris?"\n }\n ]\n },\n {\n "role": "assistant",\n + // "parts": [\n {\n "type": "tool_call",\n "id": + // "call_VSPygqKTWdrhaFErNvMV18Yl",\n "name": "get_weather",\n "arguments": {\n + // "location": "Paris"\n }\n }\n ]\n },\n {\n "role": "tool",\n "parts": [\n {\n + // "type": "tool_call_response",\n "id": " call_VSPygqKTWdrhaFErNvMV18Yl",\n + // "result": "rainy, 57°F"\n }\n ]\n }\n]\n" + // Note: Instrumentations MUST follow [Input messages JSON schema]. + // When the attribute is recorded on events, it MUST be recorded in structured + // form. When recorded on spans, it MAY be recorded as a JSON string if + // structured + // format is not supported and SHOULD be recorded in structured form otherwise. + // + // Messages MUST be provided in the order they were sent to the model. + // Instrumentations MAY provide a way for users to filter or truncate + // input messages. + // + // > [!Warning] + // > This attribute is likely to contain sensitive information including + // > user/PII data. + // + // See [Recording content on attributes] + // section for more details. + // + // [Input messages JSON schema]: /docs/gen-ai/gen-ai-input-messages.json + // [Recording content on attributes]: /docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes + GenAIInputMessagesKey = attribute.Key("gen_ai.input.messages") + + // GenAIOperationNameKey is the attribute Key conforming to the + // "gen_ai.operation.name" semantic conventions. It represents the name of the + // operation being performed. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: If one of the predefined values applies, but specific system uses a + // different name it's RECOMMENDED to document it in the semantic conventions + // for specific GenAI system and use system-specific name in the + // instrumentation. If a different name is not documented, instrumentation + // libraries SHOULD use applicable predefined value. + GenAIOperationNameKey = attribute.Key("gen_ai.operation.name") + + // GenAIOutputMessagesKey is the attribute Key conforming to the + // "gen_ai.output.messages" semantic conventions. It represents the messages + // returned by the model where each message represents a specific model response + // (choice, candidate). + // + // Type: any + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "[\n {\n "role": "assistant",\n "parts": [\n {\n "type": "text",\n + // "content": "The weather in Paris is currently rainy with a temperature of + // 57°F."\n }\n ],\n "finish_reason": "stop"\n }\n]\n" + // Note: Instrumentations MUST follow [Output messages JSON schema] + // + // Each message represents a single output choice/candidate generated by + // the model. Each message corresponds to exactly one generation + // (choice/candidate) and vice versa - one choice cannot be split across + // multiple messages or one message cannot contain parts from multiple choices. + // + // When the attribute is recorded on events, it MUST be recorded in structured + // form. When recorded on spans, it MAY be recorded as a JSON string if + // structured + // format is not supported and SHOULD be recorded in structured form otherwise. + // + // Instrumentations MAY provide a way for users to filter or truncate + // output messages. + // + // > [!Warning] + // > This attribute is likely to contain sensitive information including + // > user/PII data. + // + // See [Recording content on attributes] + // section for more details. + // + // [Output messages JSON schema]: /docs/gen-ai/gen-ai-output-messages.json + // [Recording content on attributes]: /docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes + GenAIOutputMessagesKey = attribute.Key("gen_ai.output.messages") + + // GenAIOutputTypeKey is the attribute Key conforming to the + // "gen_ai.output.type" semantic conventions. It represents the represents the + // content type requested by the client. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: This attribute SHOULD be used when the client requests output of a + // specific type. The model may return zero or more outputs of this type. + // This attribute specifies the output modality and not the actual output + // format. For example, if an image is requested, the actual output could be a + // URL pointing to an image file. + // Additional output format details may be recorded in the future in the + // `gen_ai.output.{type}.*` attributes. + GenAIOutputTypeKey = attribute.Key("gen_ai.output.type") + + // GenAIPromptNameKey is the attribute Key conforming to the + // "gen_ai.prompt.name" semantic conventions. It represents the name of the + // prompt that uniquely identifies it. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "analyze-code" + GenAIPromptNameKey = attribute.Key("gen_ai.prompt.name") + + // GenAIProviderNameKey is the attribute Key conforming to the + // "gen_ai.provider.name" semantic conventions. It represents the Generative AI + // provider as identified by the client or server instrumentation. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + // Note: The attribute SHOULD be set based on the instrumentation's best + // knowledge and may differ from the actual model provider. + // + // Multiple providers, including Azure OpenAI, Gemini, and AI hosting platforms + // are accessible using the OpenAI REST API and corresponding client libraries, + // but may proxy or host models from different providers. + // + // The `gen_ai.request.model`, `gen_ai.response.model`, and `server.address` + // attributes may help identify the actual system in use. + // + // The `gen_ai.provider.name` attribute acts as a discriminator that + // identifies the GenAI telemetry format flavor specific to that provider + // within GenAI semantic conventions. + // It SHOULD be set consistently with provider-specific attributes and signals. + // For example, GenAI spans, metrics, and events related to AWS Bedrock + // should have the `gen_ai.provider.name` set to `aws.bedrock` and include + // applicable `aws.bedrock.*` attributes and are not expected to include + // `openai.*` attributes. + GenAIProviderNameKey = attribute.Key("gen_ai.provider.name") + + // GenAIRequestChoiceCountKey is the attribute Key conforming to the + // "gen_ai.request.choice.count" semantic conventions. It represents the target + // number of candidate completions to return. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 3 + GenAIRequestChoiceCountKey = attribute.Key("gen_ai.request.choice.count") + + // GenAIRequestEncodingFormatsKey is the attribute Key conforming to the + // "gen_ai.request.encoding_formats" semantic conventions. It represents the + // encoding formats requested in an embeddings operation, if specified. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "base64"], ["float", "binary" + // Note: In some GenAI systems the encoding formats are called embedding types. + // Also, some GenAI systems only accept a single format per request. + GenAIRequestEncodingFormatsKey = attribute.Key("gen_ai.request.encoding_formats") + + // GenAIRequestFrequencyPenaltyKey is the attribute Key conforming to the + // "gen_ai.request.frequency_penalty" semantic conventions. It represents the + // frequency penalty setting for the GenAI request. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0.1 + GenAIRequestFrequencyPenaltyKey = attribute.Key("gen_ai.request.frequency_penalty") + + // GenAIRequestMaxTokensKey is the attribute Key conforming to the + // "gen_ai.request.max_tokens" semantic conventions. It represents the maximum + // number of tokens the model generates for a request. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 100 + GenAIRequestMaxTokensKey = attribute.Key("gen_ai.request.max_tokens") + + // GenAIRequestModelKey is the attribute Key conforming to the + // "gen_ai.request.model" semantic conventions. It represents the name of the + // GenAI model a request is being made to. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: gpt-4 + GenAIRequestModelKey = attribute.Key("gen_ai.request.model") + + // GenAIRequestPresencePenaltyKey is the attribute Key conforming to the + // "gen_ai.request.presence_penalty" semantic conventions. It represents the + // presence penalty setting for the GenAI request. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0.1 + GenAIRequestPresencePenaltyKey = attribute.Key("gen_ai.request.presence_penalty") + + // GenAIRequestSeedKey is the attribute Key conforming to the + // "gen_ai.request.seed" semantic conventions. It represents the requests with + // same seed value more likely to return same result. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 100 + GenAIRequestSeedKey = attribute.Key("gen_ai.request.seed") + + // GenAIRequestStopSequencesKey is the attribute Key conforming to the + // "gen_ai.request.stop_sequences" semantic conventions. It represents the list + // of sequences that the model will use to stop generating further tokens. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "forest", "lived" + GenAIRequestStopSequencesKey = attribute.Key("gen_ai.request.stop_sequences") + + // GenAIRequestTemperatureKey is the attribute Key conforming to the + // "gen_ai.request.temperature" semantic conventions. It represents the + // temperature setting for the GenAI request. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 0.0 + GenAIRequestTemperatureKey = attribute.Key("gen_ai.request.temperature") + + // GenAIRequestTopKKey is the attribute Key conforming to the + // "gen_ai.request.top_k" semantic conventions. It represents the top_k sampling + // setting for the GenAI request. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1.0 + GenAIRequestTopKKey = attribute.Key("gen_ai.request.top_k") + + // GenAIRequestTopPKey is the attribute Key conforming to the + // "gen_ai.request.top_p" semantic conventions. It represents the top_p sampling + // setting for the GenAI request. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 1.0 + GenAIRequestTopPKey = attribute.Key("gen_ai.request.top_p") + + // GenAIResponseFinishReasonsKey is the attribute Key conforming to the + // "gen_ai.response.finish_reasons" semantic conventions. It represents the + // array of reasons the model stopped generating tokens, corresponding to each + // generation received. + // + // Type: string[] + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "stop"], ["stop", "length" + GenAIResponseFinishReasonsKey = attribute.Key("gen_ai.response.finish_reasons") + + // GenAIResponseIDKey is the attribute Key conforming to the + // "gen_ai.response.id" semantic conventions. It represents the unique + // identifier for the completion. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "chatcmpl-123" + GenAIResponseIDKey = attribute.Key("gen_ai.response.id") + + // GenAIResponseModelKey is the attribute Key conforming to the + // "gen_ai.response.model" semantic conventions. It represents the name of the + // model that generated the response. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "gpt-4-0613" + GenAIResponseModelKey = attribute.Key("gen_ai.response.model") + + // GenAIRetrievalDocumentsKey is the attribute Key conforming to the + // "gen_ai.retrieval.documents" semantic conventions. It represents the + // documents retrieved. + // + // Type: any + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "[\n {\n "id": "doc_123",\n "score": 0.95\n },\n {\n "id": + // "doc_456",\n "score": 0.87\n },\n {\n "id": "doc_789",\n "score": 0.82\n + // }\n]\n" + // Note: Instrumentations MUST follow [Retrieval documents JSON schema]. + // When the attribute is recorded on events, it MUST be recorded in structured + // form. When recorded on spans, it MAY be recorded as a JSON string if + // structured + // format is not supported and SHOULD be recorded in structured form otherwise. + // + // Each document object SHOULD contain at least the following properties: + // `id` (string): A unique identifier for the document, `score` (double): The + // relevance score of the document + // + // [Retrieval documents JSON schema]: /docs/gen-ai/gen-ai-retrieval-documents.json + GenAIRetrievalDocumentsKey = attribute.Key("gen_ai.retrieval.documents") + + // GenAIRetrievalQueryTextKey is the attribute Key conforming to the + // "gen_ai.retrieval.query.text" semantic conventions. It represents the query + // text used for retrieval. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "What is the capital of France?", "weather in Paris" + // Note: > [!Warning] + // + // > This attribute may contain sensitive information. + GenAIRetrievalQueryTextKey = attribute.Key("gen_ai.retrieval.query.text") + + // GenAISystemInstructionsKey is the attribute Key conforming to the + // "gen_ai.system_instructions" semantic conventions. It represents the system + // message or instructions provided to the GenAI model separately from the chat + // history. + // + // Type: any + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "[\n {\n "type": "text",\n "content": "You are an Agent that greet + // users, always use greetings tool to respond"\n }\n]\n", "[\n {\n "type": + // "text",\n "content": "You are a language translator."\n },\n {\n "type": + // "text",\n "content": "Your mission is to translate text in English to + // French."\n }\n]\n" + // Note: This attribute SHOULD be used when the corresponding provider or API + // allows to provide system instructions or messages separately from the + // chat history. + // + // Instructions that are part of the chat history SHOULD be recorded in + // `gen_ai.input.messages` attribute instead. + // + // Instrumentations MUST follow [System instructions JSON schema]. + // + // When recorded on spans, it MAY be recorded as a JSON string if structured + // format is not supported and SHOULD be recorded in structured form otherwise. + // + // Instrumentations MAY provide a way for users to filter or truncate + // system instructions. + // + // > [!Warning] + // > This attribute may contain sensitive information. + // + // See [Recording content on attributes] + // section for more details. + // + // [System instructions JSON schema]: /docs/gen-ai/gen-ai-system-instructions.json + // [Recording content on attributes]: /docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes + GenAISystemInstructionsKey = attribute.Key("gen_ai.system_instructions") + + // GenAITokenTypeKey is the attribute Key conforming to the "gen_ai.token.type" + // semantic conventions. It represents the type of token being counted. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "input", "output" + GenAITokenTypeKey = attribute.Key("gen_ai.token.type") + + // GenAIToolCallArgumentsKey is the attribute Key conforming to the + // "gen_ai.tool.call.arguments" semantic conventions. It represents the + // parameters passed to the tool call. + // + // Type: any + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "{\n "location": "San Francisco?",\n "date": "2025-10-01"\n}\n" + // Note: > [!WARNING] + // + // > This attribute may contain sensitive information. + // + // It's expected to be an object - in case a serialized string is available + // to the instrumentation, the instrumentation SHOULD do the best effort to + // deserialize it to an object. When recorded on spans, it MAY be recorded as a + // JSON string if structured format is not supported and SHOULD be recorded in + // structured form otherwise. + GenAIToolCallArgumentsKey = attribute.Key("gen_ai.tool.call.arguments") + + // GenAIToolCallIDKey is the attribute Key conforming to the + // "gen_ai.tool.call.id" semantic conventions. It represents the tool call + // identifier. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "call_mszuSIzqtI65i1wAUOE8w5H4" + GenAIToolCallIDKey = attribute.Key("gen_ai.tool.call.id") + + // GenAIToolCallResultKey is the attribute Key conforming to the + // "gen_ai.tool.call.result" semantic conventions. It represents the result + // returned by the tool call (if any and if execution was successful). + // + // Type: any + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "{\n "temperature_range": {\n "high": 75,\n "low": 60\n },\n + // "conditions": "sunny"\n}\n" + // Note: > [!WARNING] + // + // > This attribute may contain sensitive information. + // + // It's expected to be an object - in case a serialized string is available + // to the instrumentation, the instrumentation SHOULD do the best effort to + // deserialize it to an object. When recorded on spans, it MAY be recorded as a + // JSON string if structured format is not supported and SHOULD be recorded in + // structured form otherwise. + GenAIToolCallResultKey = attribute.Key("gen_ai.tool.call.result") + + // GenAIToolDefinitionsKey is the attribute Key conforming to the + // "gen_ai.tool.definitions" semantic conventions. It represents the list of + // source system tool definitions available to the GenAI agent or model. + // + // Type: any + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "[\n {\n "type": "function",\n "name": "get_current_weather",\n + // "description": "Get the current weather in a given location",\n "parameters": + // {\n "type": "object",\n "properties": {\n "location": {\n "type": "string",\n + // "description": "The city and state, e.g. San Francisco, CA"\n },\n "unit": + // {\n "type": "string",\n "enum": [\n "celsius",\n "fahrenheit"\n ]\n }\n },\n + // "required": [\n "location",\n "unit"\n ]\n }\n }\n]\n" + // Note: The value of this attribute matches source system tool definition + // format. + // + // It's expected to be an array of objects where each object represents a tool + // definition. In case a serialized string is available + // to the instrumentation, the instrumentation SHOULD do the best effort to + // deserialize it to an array. When recorded on spans, it MAY be recorded as a + // JSON string if structured format is not supported and SHOULD be recorded in + // structured form otherwise. + // + // Since this attribute could be large, it's NOT RECOMMENDED to populate + // it by default. Instrumentations MAY provide a way to enable + // populating this attribute. + GenAIToolDefinitionsKey = attribute.Key("gen_ai.tool.definitions") + + // GenAIToolDescriptionKey is the attribute Key conforming to the + // "gen_ai.tool.description" semantic conventions. It represents the tool + // description. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Multiply two numbers" + GenAIToolDescriptionKey = attribute.Key("gen_ai.tool.description") + + // GenAIToolNameKey is the attribute Key conforming to the "gen_ai.tool.name" + // semantic conventions. It represents the name of the tool utilized by the + // agent. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Flights" + GenAIToolNameKey = attribute.Key("gen_ai.tool.name") + + // GenAIToolTypeKey is the attribute Key conforming to the "gen_ai.tool.type" + // semantic conventions. It represents the type of the tool utilized by the + // agent. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "function", "extension", "datastore" + // Note: Extension: A tool executed on the agent-side to directly call external + // APIs, bridging the gap between the agent and real-world systems. + // Agent-side operations involve actions that are performed by the agent on the + // server or within the agent's controlled environment. + // Function: A tool executed on the client-side, where the agent generates + // parameters for a predefined function, and the client executes the logic. + // Client-side operations are actions taken on the user's end or within the + // client application. + // Datastore: A tool used by the agent to access and query structured or + // unstructured external data for retrieval-augmented tasks or knowledge + // updates. + GenAIToolTypeKey = attribute.Key("gen_ai.tool.type") + + // GenAIUsageCacheCreationInputTokensKey is the attribute Key conforming to the + // "gen_ai.usage.cache_creation.input_tokens" semantic conventions. It + // represents the number of input tokens written to a provider-managed cache. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 25 + // Note: The value SHOULD be included in `gen_ai.usage.input_tokens`. + GenAIUsageCacheCreationInputTokensKey = attribute.Key("gen_ai.usage.cache_creation.input_tokens") + + // GenAIUsageCacheReadInputTokensKey is the attribute Key conforming to the + // "gen_ai.usage.cache_read.input_tokens" semantic conventions. It represents + // the number of input tokens served from a provider-managed cache. + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 50 + // Note: The value SHOULD be included in `gen_ai.usage.input_tokens`. + GenAIUsageCacheReadInputTokensKey = attribute.Key("gen_ai.usage.cache_read.input_tokens") + + // GenAIUsageInputTokensKey is the attribute Key conforming to the + // "gen_ai.usage.input_tokens" semantic conventions. It represents the number of + // tokens used in the GenAI input (prompt). + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 100 + // Note: This value SHOULD include all types of input tokens, including cached + // tokens. + // Instrumentations SHOULD make a best effort to populate this value, using a + // total + // provided by the provider when available or, depending on the provider API, + // by summing different token types parsed from the provider output. + GenAIUsageInputTokensKey = attribute.Key("gen_ai.usage.input_tokens") + + // GenAIUsageOutputTokensKey is the attribute Key conforming to the + // "gen_ai.usage.output_tokens" semantic conventions. It represents the number + // of tokens used in the GenAI response (completion). + // + // Type: int + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 180 + GenAIUsageOutputTokensKey = attribute.Key("gen_ai.usage.output_tokens") +) + +// GenAIAgentDescription returns an attribute KeyValue conforming to the +// "gen_ai.agent.description" semantic conventions. It represents the free-form +// description of the GenAI agent provided by the application. +func GenAIAgentDescription(val string) attribute.KeyValue { + return GenAIAgentDescriptionKey.String(val) +} + +// GenAIAgentID returns an attribute KeyValue conforming to the "gen_ai.agent.id" +// semantic conventions. It represents the unique identifier of the GenAI agent. +func GenAIAgentID(val string) attribute.KeyValue { + return GenAIAgentIDKey.String(val) +} + +// GenAIAgentName returns an attribute KeyValue conforming to the +// "gen_ai.agent.name" semantic conventions. It represents the human-readable +// name of the GenAI agent provided by the application. +func GenAIAgentName(val string) attribute.KeyValue { + return GenAIAgentNameKey.String(val) +} + +// GenAIAgentVersion returns an attribute KeyValue conforming to the +// "gen_ai.agent.version" semantic conventions. It represents the version of the +// GenAI agent. +func GenAIAgentVersion(val string) attribute.KeyValue { + return GenAIAgentVersionKey.String(val) +} + +// GenAIConversationID returns an attribute KeyValue conforming to the +// "gen_ai.conversation.id" semantic conventions. It represents the unique +// identifier for a conversation (session, thread), used to store and correlate +// messages within this conversation. +func GenAIConversationID(val string) attribute.KeyValue { + return GenAIConversationIDKey.String(val) +} + +// GenAIDataSourceID returns an attribute KeyValue conforming to the +// "gen_ai.data_source.id" semantic conventions. It represents the data source +// identifier. +func GenAIDataSourceID(val string) attribute.KeyValue { + return GenAIDataSourceIDKey.String(val) +} + +// GenAIEmbeddingsDimensionCount returns an attribute KeyValue conforming to the +// "gen_ai.embeddings.dimension.count" semantic conventions. It represents the +// number of dimensions the resulting output embeddings should have. +func GenAIEmbeddingsDimensionCount(val int) attribute.KeyValue { + return GenAIEmbeddingsDimensionCountKey.Int(val) +} + +// GenAIEvaluationExplanation returns an attribute KeyValue conforming to the +// "gen_ai.evaluation.explanation" semantic conventions. It represents a +// free-form explanation for the assigned score provided by the evaluator. +func GenAIEvaluationExplanation(val string) attribute.KeyValue { + return GenAIEvaluationExplanationKey.String(val) +} + +// GenAIEvaluationName returns an attribute KeyValue conforming to the +// "gen_ai.evaluation.name" semantic conventions. It represents the name of the +// evaluation metric used for the GenAI response. +func GenAIEvaluationName(val string) attribute.KeyValue { + return GenAIEvaluationNameKey.String(val) +} + +// GenAIEvaluationScoreLabel returns an attribute KeyValue conforming to the +// "gen_ai.evaluation.score.label" semantic conventions. It represents the human +// readable label for evaluation. +func GenAIEvaluationScoreLabel(val string) attribute.KeyValue { + return GenAIEvaluationScoreLabelKey.String(val) +} + +// GenAIEvaluationScoreValue returns an attribute KeyValue conforming to the +// "gen_ai.evaluation.score.value" semantic conventions. It represents the +// evaluation score returned by the evaluator. +func GenAIEvaluationScoreValue(val float64) attribute.KeyValue { + return GenAIEvaluationScoreValueKey.Float64(val) +} + +// GenAIPromptName returns an attribute KeyValue conforming to the +// "gen_ai.prompt.name" semantic conventions. It represents the name of the +// prompt that uniquely identifies it. +func GenAIPromptName(val string) attribute.KeyValue { + return GenAIPromptNameKey.String(val) +} + +// GenAIRequestChoiceCount returns an attribute KeyValue conforming to the +// "gen_ai.request.choice.count" semantic conventions. It represents the target +// number of candidate completions to return. +func GenAIRequestChoiceCount(val int) attribute.KeyValue { + return GenAIRequestChoiceCountKey.Int(val) +} + +// GenAIRequestEncodingFormats returns an attribute KeyValue conforming to the +// "gen_ai.request.encoding_formats" semantic conventions. It represents the +// encoding formats requested in an embeddings operation, if specified. +func GenAIRequestEncodingFormats(val ...string) attribute.KeyValue { + return GenAIRequestEncodingFormatsKey.StringSlice(val) +} + +// GenAIRequestFrequencyPenalty returns an attribute KeyValue conforming to the +// "gen_ai.request.frequency_penalty" semantic conventions. It represents the +// frequency penalty setting for the GenAI request. +func GenAIRequestFrequencyPenalty(val float64) attribute.KeyValue { + return GenAIRequestFrequencyPenaltyKey.Float64(val) +} + +// GenAIRequestMaxTokens returns an attribute KeyValue conforming to the +// "gen_ai.request.max_tokens" semantic conventions. It represents the maximum +// number of tokens the model generates for a request. +func GenAIRequestMaxTokens(val int) attribute.KeyValue { + return GenAIRequestMaxTokensKey.Int(val) +} + +// GenAIRequestModel returns an attribute KeyValue conforming to the +// "gen_ai.request.model" semantic conventions. It represents the name of the +// GenAI model a request is being made to. +func GenAIRequestModel(val string) attribute.KeyValue { + return GenAIRequestModelKey.String(val) +} + +// GenAIRequestPresencePenalty returns an attribute KeyValue conforming to the +// "gen_ai.request.presence_penalty" semantic conventions. It represents the +// presence penalty setting for the GenAI request. +func GenAIRequestPresencePenalty(val float64) attribute.KeyValue { + return GenAIRequestPresencePenaltyKey.Float64(val) +} + +// GenAIRequestSeed returns an attribute KeyValue conforming to the +// "gen_ai.request.seed" semantic conventions. It represents the requests with +// same seed value more likely to return same result. +func GenAIRequestSeed(val int) attribute.KeyValue { + return GenAIRequestSeedKey.Int(val) +} + +// GenAIRequestStopSequences returns an attribute KeyValue conforming to the +// "gen_ai.request.stop_sequences" semantic conventions. It represents the list +// of sequences that the model will use to stop generating further tokens. +func GenAIRequestStopSequences(val ...string) attribute.KeyValue { + return GenAIRequestStopSequencesKey.StringSlice(val) +} + +// GenAIRequestTemperature returns an attribute KeyValue conforming to the +// "gen_ai.request.temperature" semantic conventions. It represents the +// temperature setting for the GenAI request. +func GenAIRequestTemperature(val float64) attribute.KeyValue { + return GenAIRequestTemperatureKey.Float64(val) +} + +// GenAIRequestTopK returns an attribute KeyValue conforming to the +// "gen_ai.request.top_k" semantic conventions. It represents the top_k sampling +// setting for the GenAI request. +func GenAIRequestTopK(val float64) attribute.KeyValue { + return GenAIRequestTopKKey.Float64(val) +} + +// GenAIRequestTopP returns an attribute KeyValue conforming to the +// "gen_ai.request.top_p" semantic conventions. It represents the top_p sampling +// setting for the GenAI request. +func GenAIRequestTopP(val float64) attribute.KeyValue { + return GenAIRequestTopPKey.Float64(val) +} + +// GenAIResponseFinishReasons returns an attribute KeyValue conforming to the +// "gen_ai.response.finish_reasons" semantic conventions. It represents the array +// of reasons the model stopped generating tokens, corresponding to each +// generation received. +func GenAIResponseFinishReasons(val ...string) attribute.KeyValue { + return GenAIResponseFinishReasonsKey.StringSlice(val) +} + +// GenAIResponseID returns an attribute KeyValue conforming to the +// "gen_ai.response.id" semantic conventions. It represents the unique identifier +// for the completion. +func GenAIResponseID(val string) attribute.KeyValue { + return GenAIResponseIDKey.String(val) +} + +// GenAIResponseModel returns an attribute KeyValue conforming to the +// "gen_ai.response.model" semantic conventions. It represents the name of the +// model that generated the response. +func GenAIResponseModel(val string) attribute.KeyValue { + return GenAIResponseModelKey.String(val) +} + +// GenAIRetrievalQueryText returns an attribute KeyValue conforming to the +// "gen_ai.retrieval.query.text" semantic conventions. It represents the query +// text used for retrieval. +func GenAIRetrievalQueryText(val string) attribute.KeyValue { + return GenAIRetrievalQueryTextKey.String(val) +} + +// GenAIToolCallID returns an attribute KeyValue conforming to the +// "gen_ai.tool.call.id" semantic conventions. It represents the tool call +// identifier. +func GenAIToolCallID(val string) attribute.KeyValue { + return GenAIToolCallIDKey.String(val) +} + +// GenAIToolDescription returns an attribute KeyValue conforming to the +// "gen_ai.tool.description" semantic conventions. It represents the tool +// description. +func GenAIToolDescription(val string) attribute.KeyValue { + return GenAIToolDescriptionKey.String(val) +} + +// GenAIToolName returns an attribute KeyValue conforming to the +// "gen_ai.tool.name" semantic conventions. It represents the name of the tool +// utilized by the agent. +func GenAIToolName(val string) attribute.KeyValue { + return GenAIToolNameKey.String(val) +} + +// GenAIToolType returns an attribute KeyValue conforming to the +// "gen_ai.tool.type" semantic conventions. It represents the type of the tool +// utilized by the agent. +func GenAIToolType(val string) attribute.KeyValue { + return GenAIToolTypeKey.String(val) +} + +// GenAIUsageCacheCreationInputTokens returns an attribute KeyValue conforming to +// the "gen_ai.usage.cache_creation.input_tokens" semantic conventions. It +// represents the number of input tokens written to a provider-managed cache. +func GenAIUsageCacheCreationInputTokens(val int) attribute.KeyValue { + return GenAIUsageCacheCreationInputTokensKey.Int(val) +} + +// GenAIUsageCacheReadInputTokens returns an attribute KeyValue conforming to the +// "gen_ai.usage.cache_read.input_tokens" semantic conventions. It represents the +// number of input tokens served from a provider-managed cache. +func GenAIUsageCacheReadInputTokens(val int) attribute.KeyValue { + return GenAIUsageCacheReadInputTokensKey.Int(val) +} + +// GenAIUsageInputTokens returns an attribute KeyValue conforming to the +// "gen_ai.usage.input_tokens" semantic conventions. It represents the number of +// tokens used in the GenAI input (prompt). +func GenAIUsageInputTokens(val int) attribute.KeyValue { + return GenAIUsageInputTokensKey.Int(val) +} + +// GenAIUsageOutputTokens returns an attribute KeyValue conforming to the +// "gen_ai.usage.output_tokens" semantic conventions. It represents the number of +// tokens used in the GenAI response (completion). +func GenAIUsageOutputTokens(val int) attribute.KeyValue { + return GenAIUsageOutputTokensKey.Int(val) +} + +// Enum values for gen_ai.operation.name +var ( + // Chat completion operation such as [OpenAI Chat API] + // Stability: development + // + // [OpenAI Chat API]: https://platform.openai.com/docs/api-reference/chat + GenAIOperationNameChat = GenAIOperationNameKey.String("chat") + // Multimodal content generation operation such as [Gemini Generate Content] + // Stability: development + // + // [Gemini Generate Content]: https://ai.google.dev/api/generate-content + GenAIOperationNameGenerateContent = GenAIOperationNameKey.String("generate_content") + // Text completions operation such as [OpenAI Completions API (Legacy)] + // Stability: development + // + // [OpenAI Completions API (Legacy)]: https://platform.openai.com/docs/api-reference/completions + GenAIOperationNameTextCompletion = GenAIOperationNameKey.String("text_completion") + // Embeddings operation such as [OpenAI Create embeddings API] + // Stability: development + // + // [OpenAI Create embeddings API]: https://platform.openai.com/docs/api-reference/embeddings/create + GenAIOperationNameEmbeddings = GenAIOperationNameKey.String("embeddings") + // Retrieval operation such as [OpenAI Search Vector Store API] + // Stability: development + // + // [OpenAI Search Vector Store API]: https://platform.openai.com/docs/api-reference/vector-stores/search + GenAIOperationNameRetrieval = GenAIOperationNameKey.String("retrieval") + // Create GenAI agent + // Stability: development + GenAIOperationNameCreateAgent = GenAIOperationNameKey.String("create_agent") + // Invoke GenAI agent + // Stability: development + GenAIOperationNameInvokeAgent = GenAIOperationNameKey.String("invoke_agent") + // Execute a tool + // Stability: development + GenAIOperationNameExecuteTool = GenAIOperationNameKey.String("execute_tool") +) + +// Enum values for gen_ai.output.type +var ( + // Plain text + // Stability: development + GenAIOutputTypeText = GenAIOutputTypeKey.String("text") + // JSON object with known or unknown schema + // Stability: development + GenAIOutputTypeJSON = GenAIOutputTypeKey.String("json") + // Image + // Stability: development + GenAIOutputTypeImage = GenAIOutputTypeKey.String("image") + // Speech + // Stability: development + GenAIOutputTypeSpeech = GenAIOutputTypeKey.String("speech") +) + +// Enum values for gen_ai.provider.name +var ( + // [OpenAI] + // Stability: development + // + // [OpenAI]: https://openai.com/ + GenAIProviderNameOpenAI = GenAIProviderNameKey.String("openai") + // Any Google generative AI endpoint + // Stability: development + GenAIProviderNameGCPGenAI = GenAIProviderNameKey.String("gcp.gen_ai") + // [Vertex AI] + // Stability: development + // + // [Vertex AI]: https://cloud.google.com/vertex-ai + GenAIProviderNameGCPVertexAI = GenAIProviderNameKey.String("gcp.vertex_ai") + // [Gemini] + // Stability: development + // + // [Gemini]: https://cloud.google.com/products/gemini + GenAIProviderNameGCPGemini = GenAIProviderNameKey.String("gcp.gemini") + // [Anthropic] + // Stability: development + // + // [Anthropic]: https://www.anthropic.com/ + GenAIProviderNameAnthropic = GenAIProviderNameKey.String("anthropic") + // [Cohere] + // Stability: development + // + // [Cohere]: https://cohere.com/ + GenAIProviderNameCohere = GenAIProviderNameKey.String("cohere") + // Azure AI Inference + // Stability: development + GenAIProviderNameAzureAIInference = GenAIProviderNameKey.String("azure.ai.inference") + // [Azure OpenAI] + // Stability: development + // + // [Azure OpenAI]: https://azure.microsoft.com/products/ai-services/openai-service/ + GenAIProviderNameAzureAIOpenAI = GenAIProviderNameKey.String("azure.ai.openai") + // [IBM Watsonx AI] + // Stability: development + // + // [IBM Watsonx AI]: https://www.ibm.com/products/watsonx-ai + GenAIProviderNameIBMWatsonxAI = GenAIProviderNameKey.String("ibm.watsonx.ai") + // [AWS Bedrock] + // Stability: development + // + // [AWS Bedrock]: https://aws.amazon.com/bedrock + GenAIProviderNameAWSBedrock = GenAIProviderNameKey.String("aws.bedrock") + // [Perplexity] + // Stability: development + // + // [Perplexity]: https://www.perplexity.ai/ + GenAIProviderNamePerplexity = GenAIProviderNameKey.String("perplexity") + // [xAI] + // Stability: development + // + // [xAI]: https://x.ai/ + GenAIProviderNameXAI = GenAIProviderNameKey.String("x_ai") + // [DeepSeek] + // Stability: development + // + // [DeepSeek]: https://www.deepseek.com/ + GenAIProviderNameDeepseek = GenAIProviderNameKey.String("deepseek") + // [Groq] + // Stability: development + // + // [Groq]: https://groq.com/ + GenAIProviderNameGroq = GenAIProviderNameKey.String("groq") + // [Mistral AI] + // Stability: development + // + // [Mistral AI]: https://mistral.ai/ + GenAIProviderNameMistralAI = GenAIProviderNameKey.String("mistral_ai") +) + +// Enum values for gen_ai.token.type +var ( + // Input tokens (prompt, input, etc.) + // Stability: development + GenAITokenTypeInput = GenAITokenTypeKey.String("input") + // Output tokens (completion, response, etc.) + // Stability: development + GenAITokenTypeOutput = GenAITokenTypeKey.String("output") +) + +// Namespace: geo +const ( + // GeoContinentCodeKey is the attribute Key conforming to the + // "geo.continent.code" semantic conventions. It represents the two-letter code + // representing continent’s name. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + GeoContinentCodeKey = attribute.Key("geo.continent.code") + + // GeoCountryISOCodeKey is the attribute Key conforming to the + // "geo.country.iso_code" semantic conventions. It represents the two-letter ISO + // Country Code ([ISO 3166-1 alpha2]). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "CA" + // + // [ISO 3166-1 alpha2]: https://wikipedia.org/wiki/ISO_3166-1#Codes + GeoCountryISOCodeKey = attribute.Key("geo.country.iso_code") + + // GeoLocalityNameKey is the attribute Key conforming to the "geo.locality.name" + // semantic conventions. It represents the locality name. Represents the name of + // a city, town, village, or similar populated place. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "Montreal", "Berlin" + GeoLocalityNameKey = attribute.Key("geo.locality.name") + + // GeoLocationLatKey is the attribute Key conforming to the "geo.location.lat" + // semantic conventions. It represents the latitude of the geo location in + // [WGS84]. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: 45.505918 + // + // [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 + GeoLocationLatKey = attribute.Key("geo.location.lat") + + // GeoLocationLonKey is the attribute Key conforming to the "geo.location.lon" + // semantic conventions. It represents the longitude of the geo location in + // [WGS84]. + // + // Type: double + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: -73.61483 + // + // [WGS84]: https://wikipedia.org/wiki/World_Geodetic_System#WGS84 + GeoLocationLonKey = attribute.Key("geo.location.lon") + + // GeoPostalCodeKey is the attribute Key conforming to the "geo.postal_code" + // semantic conventions. It represents the postal code associated with the + // location. Values appropriate for this field may also be known as a postcode + // or ZIP code and will vary widely from country to country. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "94040" + GeoPostalCodeKey = attribute.Key("geo.postal_code") + + // GeoRegionISOCodeKey is the attribute Key conforming to the + // "geo.region.iso_code" semantic conventions. It represents the region ISO code + // ([ISO 3166-2]). + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "CA-QC" + // + // [ISO 3166-2]: https://wikipedia.org/wiki/ISO_3166-2 GeoRegionISOCodeKey = attribute.Key("geo.region.iso_code") ) @@ -6637,61 +7534,23 @@ var ( GeoContinentCodeAn = GeoContinentCodeKey.String("AN") // Asia // Stability: development - GeoContinentCodeAs = GeoContinentCodeKey.String("AS") - // Europe - // Stability: development - GeoContinentCodeEu = GeoContinentCodeKey.String("EU") - // North America - // Stability: development - GeoContinentCodeNa = GeoContinentCodeKey.String("NA") - // Oceania - // Stability: development - GeoContinentCodeOc = GeoContinentCodeKey.String("OC") - // South America - // Stability: development - GeoContinentCodeSa = GeoContinentCodeKey.String("SA") -) - -// Namespace: go -const ( - // GoCPUDetailedStateKey is the attribute Key conforming to the - // "go.cpu.detailed_state" semantic conventions. It represents the detailed - // state of the CPU. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "gc/pause", "gc/mark/assist" - // Note: Value SHOULD match the specific CPU class reported by the Go runtime - // under `/cpu/classes/...`. The list of possible values is subject to change - // with the Go version used. - GoCPUDetailedStateKey = attribute.Key("go.cpu.detailed_state") - - // GoCPUStateKey is the attribute Key conforming to the "go.cpu.state" semantic - // conventions. It represents the state of the CPU. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "user", "gc" - GoCPUStateKey = attribute.Key("go.cpu.state") - - // GoMemoryDetailedTypeKey is the attribute Key conforming to the - // "go.memory.detailed_type" semantic conventions. It represents the detailed - // type of memory. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "heap/objects", "heap/free" - // Note: Value SHOULD match the specific memory class reported by the Go runtime - // under `/memory/classes/...`. The list of possible values is subject to change - // with the Go version used. - GoMemoryDetailedTypeKey = attribute.Key("go.memory.detailed_type") + GeoContinentCodeAs = GeoContinentCodeKey.String("AS") + // Europe + // Stability: development + GeoContinentCodeEu = GeoContinentCodeKey.String("EU") + // North America + // Stability: development + GeoContinentCodeNa = GeoContinentCodeKey.String("NA") + // Oceania + // Stability: development + GeoContinentCodeOc = GeoContinentCodeKey.String("OC") + // South America + // Stability: development + GeoContinentCodeSa = GeoContinentCodeKey.String("SA") +) +// Namespace: go +const ( // GoMemoryTypeKey is the attribute Key conforming to the "go.memory.type" // semantic conventions. It represents the type of memory. // @@ -6703,36 +7562,6 @@ const ( GoMemoryTypeKey = attribute.Key("go.memory.type") ) -// GoCPUDetailedState returns an attribute KeyValue conforming to the -// "go.cpu.detailed_state" semantic conventions. It represents the detailed state -// of the CPU. -func GoCPUDetailedState(val string) attribute.KeyValue { - return GoCPUDetailedStateKey.String(val) -} - -// GoMemoryDetailedType returns an attribute KeyValue conforming to the -// "go.memory.detailed_type" semantic conventions. It represents the detailed -// type of memory. -func GoMemoryDetailedType(val string) attribute.KeyValue { - return GoMemoryDetailedTypeKey.String(val) -} - -// Enum values for go.cpu.state -var ( - // CPU time spent running user Go code. - // Stability: development - GoCPUStateUser = GoCPUStateKey.String("user") - // CPU time spent performing garbage collection tasks. - // Stability: development - GoCPUStateGC = GoCPUStateKey.String("gc") - // CPU time spent returning unused memory to the underlying platform. - // Stability: development - GoCPUStateScavenge = GoCPUStateKey.String("scavenge") - // Available CPU time not spent executing any Go or Go runtime code. - // Stability: development - GoCPUStateIdle = GoCPUStateKey.String("idle") -) - // Enum values for go.memory.type var ( // Memory allocated from the heap that is reserved for stack space, whether or @@ -6755,8 +7584,7 @@ const ( // Stability: Development // // Examples: query findBookById { bookById(id: ?) { name } } - // Note: If instrumentation can reliably identify and redact sensitive - // information it SHOULD do it. + // Note: The value may be sanitized to exclude sensitive information. GraphQLDocumentKey = attribute.Key("graphql.document") // GraphQLOperationNameKey is the attribute Key conforming to the @@ -7507,7 +8335,7 @@ var ( const ( // HwBatteryCapacityKey is the attribute Key conforming to the // "hw.battery.capacity" semantic conventions. It represents the design capacity - // in Watts-hours or Ampere-hours. + // in Watts-hours or Amper-hours. // // Type: string // RequirementLevel: Recommended @@ -7809,7 +8637,7 @@ const ( // HwBatteryCapacity returns an attribute KeyValue conforming to the // "hw.battery.capacity" semantic conventions. It represents the design capacity -// in Watts-hours or Ampere-hours. +// in Watts-hours or Amper-hours. func HwBatteryCapacity(val string) attribute.KeyValue { return HwBatteryCapacityKey.String(val) } @@ -8198,7 +9026,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "opentelemetry-cluster" K8SClusterNameKey = attribute.Key("k8s.cluster.name") @@ -8209,7 +9037,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "218fc5a9-a5f1-4b54-aa05-46717d0ab26d" // Note: K8s doesn't have support for obtaining a cluster ID. If this is ever @@ -8238,19 +9066,6 @@ const ( // [ISO/IEC 9834-8 and ITU-T X.667]: https://www.itu.int/ITU-T/studygroups/com17/oid.html K8SClusterUIDKey = attribute.Key("k8s.cluster.uid") - // K8SContainerEphemeralStorageFsTypeKey is the attribute Key conforming to the - // "k8s.container.ephemeral_storage.fs_type" semantic conventions. It represents - // the type of file system component for ephemeral storage. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "rootfs", "logs" - // Note: Eviction decisions based on ephemeral-storage resource limits are made - // based on the total container usage. - K8SContainerEphemeralStorageFsTypeKey = attribute.Key("k8s.container.ephemeral_storage.fs_type") - // K8SContainerNameKey is the attribute Key conforming to the // "k8s.container.name" semantic conventions. It represents the name of the // Container from Pod specification, must be unique within a Pod. Container @@ -8258,7 +9073,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "redis" K8SContainerNameKey = attribute.Key("k8s.container.name") @@ -8270,7 +9085,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") @@ -8299,8 +9114,8 @@ const ( // "CreateContainerConfigError", "ErrImagePull", "ImagePullBackOff", // "OOMKilled", "Completed", "Error", "ContainerCannotRun" // - // [K8s ContainerStateWaiting]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#containerstatewaiting-v1-core - // [K8s ContainerStateTerminated]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#containerstateterminated-v1-core + // [K8s ContainerStateWaiting]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstatewaiting-v1-core + // [K8s ContainerStateTerminated]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstateterminated-v1-core K8SContainerStatusReasonKey = attribute.Key("k8s.container.status.reason") // K8SContainerStatusStateKey is the attribute Key conforming to the @@ -8313,7 +9128,7 @@ const ( // // Examples: "terminated", "running", "waiting" // - // [K8s ContainerState]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#containerstate-v1-core + // [K8s ContainerState]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstate-v1-core K8SContainerStatusStateKey = attribute.Key("k8s.container.status.state") // K8SCronJobNameKey is the attribute Key conforming to the "k8s.cronjob.name" @@ -8321,7 +9136,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "opentelemetry" K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") @@ -8331,7 +9146,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") @@ -8342,7 +9157,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "opentelemetry" K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") @@ -8352,7 +9167,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") @@ -8363,7 +9178,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "opentelemetry" K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") @@ -8374,7 +9189,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") @@ -8464,7 +9279,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "opentelemetry" K8SJobNameKey = attribute.Key("k8s.job.name") @@ -8474,7 +9289,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" K8SJobUIDKey = attribute.Key("k8s.job.uid") @@ -8485,7 +9300,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "default" K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") @@ -8502,7 +9317,7 @@ const ( // Note: This attribute aligns with the `phase` field of the // [K8s NamespaceStatus] // - // [K8s NamespaceStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#namespacestatus-v1-core + // [K8s NamespaceStatus]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#namespacestatus-v1-core K8SNamespacePhaseKey = attribute.Key("k8s.namespace.phase") // K8SNodeConditionStatusKey is the attribute Key conforming to the @@ -8517,7 +9332,7 @@ const ( // Note: This attribute aligns with the `status` field of the // [NodeCondition] // - // [NodeCondition]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#nodecondition-v1-core + // [NodeCondition]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#nodecondition-v1-core K8SNodeConditionStatusKey = attribute.Key("k8s.node.condition.status") // K8SNodeConditionTypeKey is the attribute Key conforming to the @@ -8541,8 +9356,8 @@ const ( // When this occurs, the exact value as reported by the Kubernetes API SHOULD be // used. // - // [K8s documentation]: https://kubernetes.io/docs/reference/node/node-status/#condition - // [NodeCondition]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#nodecondition-v1-core + // [K8s documentation]: https://v1-32.docs.kubernetes.io/docs/reference/node/node-status/#condition + // [NodeCondition]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#nodecondition-v1-core K8SNodeConditionTypeKey = attribute.Key("k8s.node.condition.type") // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" @@ -8550,128 +9365,27 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "node-1" K8SNodeNameKey = attribute.Key("k8s.node.name") - // K8SNodeSystemContainerNameKey is the attribute Key conforming to the - // "k8s.node.system_container.name" semantic conventions. It represents the name - // of the system container running on the K8s Node. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "kubelet", "runtime", "pods", "misc" - K8SNodeSystemContainerNameKey = attribute.Key("k8s.node.system_container.name") - // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" semantic // conventions. It represents the UID of the Node. // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2" K8SNodeUIDKey = attribute.Key("k8s.node.uid") - // K8SPersistentvolumeNameKey is the attribute Key conforming to the - // "k8s.persistentvolume.name" semantic conventions. It represents the name of - // the PersistentVolume. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "pv-data-01" - K8SPersistentvolumeNameKey = attribute.Key("k8s.persistentvolume.name") - - // K8SPersistentvolumeReclaimPolicyKey is the attribute Key conforming to the - // "k8s.persistentvolume.reclaim_policy" semantic conventions. It represents the - // reclaim policy of the PersistentVolume. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Delete", "Retain", "Recycle" - // Note: This attribute aligns with the `persistentVolumeReclaimPolicy` field of - // the - // [K8s PersistentVolumeSpec]. - // - // [K8s PersistentVolumeSpec]: https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/persistent-volume-v1/#PersistentVolumeSpec - K8SPersistentvolumeReclaimPolicyKey = attribute.Key("k8s.persistentvolume.reclaim_policy") - - // K8SPersistentvolumeStatusPhaseKey is the attribute Key conforming to the - // "k8s.persistentvolume.status.phase" semantic conventions. It represents the - // phase of the PersistentVolume. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Pending", "Available", "Bound", "Released", "Failed" - // Note: This attribute aligns with the `phase` field of the - // [K8s PersistentVolumeStatus]. - // - // [K8s PersistentVolumeStatus]: https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/persistent-volume-v1/#PersistentVolumeStatus - K8SPersistentvolumeStatusPhaseKey = attribute.Key("k8s.persistentvolume.status.phase") - - // K8SPersistentvolumeUIDKey is the attribute Key conforming to the - // "k8s.persistentvolume.uid" semantic conventions. It represents the UID of the - // PersistentVolume. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" - K8SPersistentvolumeUIDKey = attribute.Key("k8s.persistentvolume.uid") - - // K8SPersistentvolumeclaimNameKey is the attribute Key conforming to the - // "k8s.persistentvolumeclaim.name" semantic conventions. It represents the name - // of the PersistentVolumeClaim. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "pvc-data-01" - K8SPersistentvolumeclaimNameKey = attribute.Key("k8s.persistentvolumeclaim.name") - - // K8SPersistentvolumeclaimStatusPhaseKey is the attribute Key conforming to the - // "k8s.persistentvolumeclaim.status.phase" semantic conventions. It represents - // the phase of the PersistentVolumeClaim. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "Pending", "Bound", "Lost" - // Note: This attribute aligns with the `phase` field of the - // [K8s PersistentVolumeClaimStatus]. - // - // [K8s PersistentVolumeClaimStatus]: https://kubernetes.io/docs/reference/kubernetes-api/config-and-storage-resources/persistent-volume-claim-v1/#PersistentVolumeClaimStatus - K8SPersistentvolumeclaimStatusPhaseKey = attribute.Key("k8s.persistentvolumeclaim.status.phase") - - // K8SPersistentvolumeclaimUIDKey is the attribute Key conforming to the - // "k8s.persistentvolumeclaim.uid" semantic conventions. It represents the UID - // of the PersistentVolumeClaim. - // - // Type: string - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" - K8SPersistentvolumeclaimUIDKey = attribute.Key("k8s.persistentvolumeclaim.uid") - // K8SPodHostnameKey is the attribute Key conforming to the "k8s.pod.hostname" // semantic conventions. It represents the specifies the hostname of the Pod. // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "collector-gateway" // Note: The K8s Pod spec has an optional hostname field, which can be used to @@ -8691,7 +9405,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "172.18.0.2" // Note: This attribute aligns with the `podIP` field of the @@ -8705,7 +9419,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "opentelemetry-pod-autoconf" K8SPodNameKey = attribute.Key("k8s.pod.name") @@ -8716,7 +9430,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "2025-12-04T08:41:03Z" // Note: Date and time at which the object was acknowledged by the Kubelet. @@ -8760,7 +9474,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" K8SPodUIDKey = attribute.Key("k8s.pod.uid") @@ -8771,7 +9485,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "opentelemetry" K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") @@ -8782,7 +9496,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") @@ -8995,7 +9709,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "opentelemetry" K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") @@ -9006,7 +9720,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Beta // // Examples: "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff" K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") @@ -9021,7 +9735,7 @@ const ( // // Examples: "gold.storageclass.storage.k8s.io" // - // [StorageClass]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#storageclass-v1-storage-k8s-io + // [StorageClass]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#storageclass-v1-storage-k8s-io K8SStorageclassNameKey = attribute.Key("k8s.storageclass.name") // K8SVolumeNameKey is the attribute Key conforming to the "k8s.volume.name" @@ -9291,80 +10005,12 @@ func K8SNodeName(val string) attribute.KeyValue { return K8SNodeNameKey.String(val) } -// K8SNodeSystemContainerName returns an attribute KeyValue conforming to the -// "k8s.node.system_container.name" semantic conventions. It represents the name -// of the system container running on the K8s Node. -func K8SNodeSystemContainerName(val string) attribute.KeyValue { - return K8SNodeSystemContainerNameKey.String(val) -} - // K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" // semantic conventions. It represents the UID of the Node. func K8SNodeUID(val string) attribute.KeyValue { return K8SNodeUIDKey.String(val) } -// K8SPersistentvolumeAnnotation returns an attribute KeyValue conforming to the -// "k8s.persistentvolume.annotation" semantic conventions. It represents the -// annotation placed on the PersistentVolume, the `` being the annotation -// name, the value being the annotation value, even if the value is empty. -func K8SPersistentvolumeAnnotation(key string, val string) attribute.KeyValue { - return attribute.String("k8s.persistentvolume.annotation."+key, val) -} - -// K8SPersistentvolumeLabel returns an attribute KeyValue conforming to the -// "k8s.persistentvolume.label" semantic conventions. It represents the label -// placed on the PersistentVolume, the `` being the label name, the value -// being the label value, even if the value is empty. -func K8SPersistentvolumeLabel(key string, val string) attribute.KeyValue { - return attribute.String("k8s.persistentvolume.label."+key, val) -} - -// K8SPersistentvolumeName returns an attribute KeyValue conforming to the -// "k8s.persistentvolume.name" semantic conventions. It represents the name of -// the PersistentVolume. -func K8SPersistentvolumeName(val string) attribute.KeyValue { - return K8SPersistentvolumeNameKey.String(val) -} - -// K8SPersistentvolumeUID returns an attribute KeyValue conforming to the -// "k8s.persistentvolume.uid" semantic conventions. It represents the UID of the -// PersistentVolume. -func K8SPersistentvolumeUID(val string) attribute.KeyValue { - return K8SPersistentvolumeUIDKey.String(val) -} - -// K8SPersistentvolumeclaimAnnotation returns an attribute KeyValue conforming to -// the "k8s.persistentvolumeclaim.annotation" semantic conventions. It represents -// the annotation placed on the PersistentVolumeClaim, the `` being the -// annotation name, the value being the annotation value, even if the value is -// empty. -func K8SPersistentvolumeclaimAnnotation(key string, val string) attribute.KeyValue { - return attribute.String("k8s.persistentvolumeclaim.annotation."+key, val) -} - -// K8SPersistentvolumeclaimLabel returns an attribute KeyValue conforming to the -// "k8s.persistentvolumeclaim.label" semantic conventions. It represents the -// label placed on the PersistentVolumeClaim, the `` being the label name, -// the value being the label value, even if the value is empty. -func K8SPersistentvolumeclaimLabel(key string, val string) attribute.KeyValue { - return attribute.String("k8s.persistentvolumeclaim.label."+key, val) -} - -// K8SPersistentvolumeclaimName returns an attribute KeyValue conforming to the -// "k8s.persistentvolumeclaim.name" semantic conventions. It represents the name -// of the PersistentVolumeClaim. -func K8SPersistentvolumeclaimName(val string) attribute.KeyValue { - return K8SPersistentvolumeclaimNameKey.String(val) -} - -// K8SPersistentvolumeclaimUID returns an attribute KeyValue conforming to the -// "k8s.persistentvolumeclaim.uid" semantic conventions. It represents the UID of -// the PersistentVolumeClaim. -func K8SPersistentvolumeclaimUID(val string) attribute.KeyValue { - return K8SPersistentvolumeclaimUIDKey.String(val) -} - // K8SPodAnnotation returns an attribute KeyValue conforming to the // "k8s.pod.annotation" semantic conventions. It represents the annotation placed // on the Pod, the `` being the annotation name, the value being the @@ -9569,7 +10215,7 @@ func K8SStatefulSetUID(val string) attribute.KeyValue { // "k8s.storageclass.name" semantic conventions. It represents the name of K8s // [StorageClass] object. // -// [StorageClass]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.34/#storageclass-v1-storage-k8s-io +// [StorageClass]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#storageclass-v1-storage-k8s-io func K8SStorageclassName(val string) attribute.KeyValue { return K8SStorageclassNameKey.String(val) } @@ -9581,16 +10227,6 @@ func K8SVolumeName(val string) attribute.KeyValue { return K8SVolumeNameKey.String(val) } -// Enum values for k8s.container.ephemeral_storage.fs_type -var ( - // For the container's writable layer usage. - // Stability: development - K8SContainerEphemeralStorageFsTypeRootfs = K8SContainerEphemeralStorageFsTypeKey.String("rootfs") - // For the container's log files usage (stdout/stderr). - // Stability: development - K8SContainerEphemeralStorageFsTypeLogs = K8SContainerEphemeralStorageFsTypeKey.String("logs") -) - // Enum values for k8s.container.status.reason var ( // The container is being created. @@ -9682,51 +10318,6 @@ var ( K8SNodeConditionTypeNetworkUnavailable = K8SNodeConditionTypeKey.String("NetworkUnavailable") ) -// Enum values for k8s.persistentvolume.reclaim_policy -var ( - // The volume will be deleted when released from its claim. - // Stability: development - K8SPersistentvolumeReclaimPolicyDelete = K8SPersistentvolumeReclaimPolicyKey.String("Delete") - // The volume will be recycled (basic scrub) when released from its claim. - // Stability: development - K8SPersistentvolumeReclaimPolicyRecycle = K8SPersistentvolumeReclaimPolicyKey.String("Recycle") - // The volume will be retained when released from its claim. - // Stability: development - K8SPersistentvolumeReclaimPolicyRetain = K8SPersistentvolumeReclaimPolicyKey.String("Retain") -) - -// Enum values for k8s.persistentvolume.status.phase -var ( - // The volume is available and not yet bound to a claim. - // Stability: development - K8SPersistentvolumeStatusPhaseAvailable = K8SPersistentvolumeStatusPhaseKey.String("Available") - // The volume is bound to a claim. - // Stability: development - K8SPersistentvolumeStatusPhaseBound = K8SPersistentvolumeStatusPhaseKey.String("Bound") - // The volume has failed its automatic reclamation. - // Stability: development - K8SPersistentvolumeStatusPhaseFailed = K8SPersistentvolumeStatusPhaseKey.String("Failed") - // The volume is being provisioned. - // Stability: development - K8SPersistentvolumeStatusPhasePending = K8SPersistentvolumeStatusPhaseKey.String("Pending") - // The claim has been deleted but the volume is not yet available. - // Stability: development - K8SPersistentvolumeStatusPhaseReleased = K8SPersistentvolumeStatusPhaseKey.String("Released") -) - -// Enum values for k8s.persistentvolumeclaim.status.phase -var ( - // The claim is bound to a volume. - // Stability: development - K8SPersistentvolumeclaimStatusPhaseBound = K8SPersistentvolumeclaimStatusPhaseKey.String("Bound") - // The claim has lost its underlying volume (the volume does not exist anymore). - // Stability: development - K8SPersistentvolumeclaimStatusPhaseLost = K8SPersistentvolumeclaimStatusPhaseKey.String("Lost") - // The claim has not yet been bound to a volume. - // Stability: development - K8SPersistentvolumeclaimStatusPhasePending = K8SPersistentvolumeclaimStatusPhaseKey.String("Pending") -) - // Enum values for k8s.pod.status.phase var ( // The pod has been accepted by the system, but one or more of the containers @@ -9829,32 +10420,32 @@ var ( // A [persistentVolumeClaim] volume // Stability: development // - // [persistentVolumeClaim]: https://kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim + // [persistentVolumeClaim]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim K8SVolumeTypePersistentVolumeClaim = K8SVolumeTypeKey.String("persistentVolumeClaim") // A [configMap] volume // Stability: development // - // [configMap]: https://kubernetes.io/docs/concepts/storage/volumes/#configmap + // [configMap]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#configmap K8SVolumeTypeConfigMap = K8SVolumeTypeKey.String("configMap") // A [downwardAPI] volume // Stability: development // - // [downwardAPI]: https://kubernetes.io/docs/concepts/storage/volumes/#downwardapi + // [downwardAPI]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#downwardapi K8SVolumeTypeDownwardAPI = K8SVolumeTypeKey.String("downwardAPI") // An [emptyDir] volume // Stability: development // - // [emptyDir]: https://kubernetes.io/docs/concepts/storage/volumes/#emptydir + // [emptyDir]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#emptydir K8SVolumeTypeEmptyDir = K8SVolumeTypeKey.String("emptyDir") // A [secret] volume // Stability: development // - // [secret]: https://kubernetes.io/docs/concepts/storage/volumes/#secret + // [secret]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#secret K8SVolumeTypeSecret = K8SVolumeTypeKey.String("secret") // A [local] volume // Stability: development // - // [local]: https://kubernetes.io/docs/concepts/storage/volumes/#local + // [local]: https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#local K8SVolumeTypeLocal = K8SVolumeTypeKey.String("local") ) @@ -10003,21 +10594,203 @@ const ( // "mainframe.lpar.name" semantic conventions. It represents the name of the // logical partition that hosts a systems with a mainframe operating system. // - // Type: string - // RequirementLevel: Recommended - // Stability: Development + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "LPAR01" + MainframeLparNameKey = attribute.Key("mainframe.lpar.name") +) + +// MainframeLparName returns an attribute KeyValue conforming to the +// "mainframe.lpar.name" semantic conventions. It represents the name of the +// logical partition that hosts a systems with a mainframe operating system. +func MainframeLparName(val string) attribute.KeyValue { + return MainframeLparNameKey.String(val) +} + +// Namespace: mcp +const ( + // McpMethodNameKey is the attribute Key conforming to the "mcp.method.name" + // semantic conventions. It represents the name of the request or notification + // method. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + McpMethodNameKey = attribute.Key("mcp.method.name") + + // McpProtocolVersionKey is the attribute Key conforming to the + // "mcp.protocol.version" semantic conventions. It represents the [version] of + // the Model Context Protocol used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "2025-06-18" + // + // [version]: https://modelcontextprotocol.io/specification/versioning + McpProtocolVersionKey = attribute.Key("mcp.protocol.version") + + // McpResourceURIKey is the attribute Key conforming to the "mcp.resource.uri" + // semantic conventions. It represents the value of the resource uri. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "postgres://database/customers/schema", + // "file:///home/user/documents/report.pdf" + // Note: This is a URI of the resource provided in the following requests or + // notifications: `resources/read`, `resources/subscribe`, + // `resources/unsubscribe`, or `notifications/resources/updated`. + McpResourceURIKey = attribute.Key("mcp.resource.uri") + + // McpSessionIDKey is the attribute Key conforming to the "mcp.session.id" + // semantic conventions. It represents the identifies [MCP session]. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "191c4850af6c49e08843a3f6c80e5046" + // + // [MCP session]: https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#session-management + McpSessionIDKey = attribute.Key("mcp.session.id") +) + +// McpProtocolVersion returns an attribute KeyValue conforming to the +// "mcp.protocol.version" semantic conventions. It represents the [version] of +// the Model Context Protocol used. +// +// [version]: https://modelcontextprotocol.io/specification/versioning +func McpProtocolVersion(val string) attribute.KeyValue { + return McpProtocolVersionKey.String(val) +} + +// McpResourceURI returns an attribute KeyValue conforming to the +// "mcp.resource.uri" semantic conventions. It represents the value of the +// resource uri. +func McpResourceURI(val string) attribute.KeyValue { + return McpResourceURIKey.String(val) +} + +// McpSessionID returns an attribute KeyValue conforming to the "mcp.session.id" +// semantic conventions. It represents the identifies [MCP session]. +// +// [MCP session]: https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#session-management +func McpSessionID(val string) attribute.KeyValue { + return McpSessionIDKey.String(val) +} + +// Enum values for mcp.method.name +var ( + // Notification cancelling a previously-issued request. + // + // Stability: development + McpMethodNameNotificationsCancelled = McpMethodNameKey.String("notifications/cancelled") + // Request to initialize the MCP client. + // + // Stability: development + McpMethodNameInitialize = McpMethodNameKey.String("initialize") + // Notification indicating that the MCP client has been initialized. + // + // Stability: development + McpMethodNameNotificationsInitialized = McpMethodNameKey.String("notifications/initialized") + // Notification indicating the progress for a long-running operation. + // + // Stability: development + McpMethodNameNotificationsProgress = McpMethodNameKey.String("notifications/progress") + // Request to check that the other party is still alive. + // + // Stability: development + McpMethodNamePing = McpMethodNameKey.String("ping") + // Request to list resources available on server. + // + // Stability: development + McpMethodNameResourcesList = McpMethodNameKey.String("resources/list") + // Request to list resource templates available on server. + // + // Stability: development + McpMethodNameResourcesTemplatesList = McpMethodNameKey.String("resources/templates/list") + // Request to read a resource. + // + // Stability: development + McpMethodNameResourcesRead = McpMethodNameKey.String("resources/read") + // Notification indicating that the list of resources has changed. + // + // Stability: development + McpMethodNameNotificationsResourcesListChanged = McpMethodNameKey.String("notifications/resources/list_changed") + // Request to subscribe to a resource. + // + // Stability: development + McpMethodNameResourcesSubscribe = McpMethodNameKey.String("resources/subscribe") + // Request to unsubscribe from resource updates. + // + // Stability: development + McpMethodNameResourcesUnsubscribe = McpMethodNameKey.String("resources/unsubscribe") + // Notification indicating that a resource has been updated. + // + // Stability: development + McpMethodNameNotificationsResourcesUpdated = McpMethodNameKey.String("notifications/resources/updated") + // Request to list prompts available on server. + // + // Stability: development + McpMethodNamePromptsList = McpMethodNameKey.String("prompts/list") + // Request to get a prompt. + // + // Stability: development + McpMethodNamePromptsGet = McpMethodNameKey.String("prompts/get") + // Notification indicating that the list of prompts has changed. + // + // Stability: development + McpMethodNameNotificationsPromptsListChanged = McpMethodNameKey.String("notifications/prompts/list_changed") + // Request to list tools available on server. + // + // Stability: development + McpMethodNameToolsList = McpMethodNameKey.String("tools/list") + // Request to call a tool. + // + // Stability: development + McpMethodNameToolsCall = McpMethodNameKey.String("tools/call") + // Notification indicating that the list of tools has changed. + // + // Stability: development + McpMethodNameNotificationsToolsListChanged = McpMethodNameKey.String("notifications/tools/list_changed") + // Request to set the logging level. + // + // Stability: development + McpMethodNameLoggingSetLevel = McpMethodNameKey.String("logging/setLevel") + // Notification indicating that a message has been received. + // + // Stability: development + McpMethodNameNotificationsMessage = McpMethodNameKey.String("notifications/message") + // Request to create a sampling message. + // + // Stability: development + McpMethodNameSamplingCreateMessage = McpMethodNameKey.String("sampling/createMessage") + // Request to complete a prompt. + // + // Stability: development + McpMethodNameCompletionComplete = McpMethodNameKey.String("completion/complete") + // Request to list roots available on server. + // + // Stability: development + McpMethodNameRootsList = McpMethodNameKey.String("roots/list") + // Notification indicating that the list of roots has changed. // - // Examples: "LPAR01" - MainframeLparNameKey = attribute.Key("mainframe.lpar.name") + // Stability: development + McpMethodNameNotificationsRootsListChanged = McpMethodNameKey.String("notifications/roots/list_changed") + // Request from the server to elicit additional information from the user via + // the client + // + // Stability: development + McpMethodNameElicitationCreate = McpMethodNameKey.String("elicitation/create") ) -// MainframeLparName returns an attribute KeyValue conforming to the -// "mainframe.lpar.name" semantic conventions. It represents the name of the -// logical partition that hosts a systems with a mainframe operating system. -func MainframeLparName(val string) attribute.KeyValue { - return MainframeLparNameKey.String(val) -} - // Namespace: messaging const ( // MessagingBatchMessageCountKey is the attribute Key conforming to the @@ -10911,14 +11684,12 @@ const ( NetworkInterfaceNameKey = attribute.Key("network.interface.name") // NetworkIODirectionKey is the attribute Key conforming to the - // "network.io.direction" semantic conventions. It represents the direction of - // traffic from the perspective of the observing host's physical or virtual - // network interface. It should not be used to represent the logical direction - // of a stateful connection or network flow. + // "network.io.direction" semantic conventions. It represents the network IO + // operation direction. // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "transmit" NetworkIODirectionKey = attribute.Key("network.io.direction") @@ -11235,10 +12006,10 @@ var ( // Enum values for network.io.direction var ( // transmit - // Stability: release_candidate + // Stability: development NetworkIODirectionTransmit = NetworkIODirectionKey.String("transmit") // receive - // Stability: release_candidate + // Stability: development NetworkIODirectionReceive = NetworkIODirectionKey.String("receive") ) @@ -11417,6 +12188,90 @@ func OncRPCVersion(val int) attribute.KeyValue { return OncRPCVersionKey.Int(val) } +// Namespace: openai +const ( + // OpenAIAPITypeKey is the attribute Key conforming to the "openai.api.type" + // semantic conventions. It represents the type of OpenAI API being used. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: + OpenAIAPITypeKey = attribute.Key("openai.api.type") + + // OpenAIRequestServiceTierKey is the attribute Key conforming to the + // "openai.request.service_tier" semantic conventions. It represents the service + // tier requested. May be a specific tier, default, or auto. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "auto", "default" + OpenAIRequestServiceTierKey = attribute.Key("openai.request.service_tier") + + // OpenAIResponseServiceTierKey is the attribute Key conforming to the + // "openai.response.service_tier" semantic conventions. It represents the + // service tier used for the response. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "scale", "default" + OpenAIResponseServiceTierKey = attribute.Key("openai.response.service_tier") + + // OpenAIResponseSystemFingerprintKey is the attribute Key conforming to the + // "openai.response.system_fingerprint" semantic conventions. It represents a + // fingerprint to track any eventual change in the Generative AI environment. + // + // Type: string + // RequirementLevel: Recommended + // Stability: Development + // + // Examples: "fp_44709d6fcb" + OpenAIResponseSystemFingerprintKey = attribute.Key("openai.response.system_fingerprint") +) + +// OpenAIResponseServiceTier returns an attribute KeyValue conforming to the +// "openai.response.service_tier" semantic conventions. It represents the service +// tier used for the response. +func OpenAIResponseServiceTier(val string) attribute.KeyValue { + return OpenAIResponseServiceTierKey.String(val) +} + +// OpenAIResponseSystemFingerprint returns an attribute KeyValue conforming to +// the "openai.response.system_fingerprint" semantic conventions. It represents a +// fingerprint to track any eventual change in the Generative AI environment. +func OpenAIResponseSystemFingerprint(val string) attribute.KeyValue { + return OpenAIResponseSystemFingerprintKey.String(val) +} + +// Enum values for openai.api.type +var ( + // The OpenAI [Chat Completions API]. + // Stability: development + // + // [Chat Completions API]: https://developers.openai.com/api/reference/chat-completions/overview + OpenAIAPITypeChatCompletions = OpenAIAPITypeKey.String("chat_completions") + // The OpenAI [Responses API]. + // Stability: development + // + // [Responses API]: https://developers.openai.com/api/reference/responses/overview + OpenAIAPITypeResponses = OpenAIAPITypeKey.String("responses") +) + +// Enum values for openai.request.service_tier +var ( + // The system will utilize scale tier credits until they are exhausted. + // Stability: development + OpenAIRequestServiceTierAuto = OpenAIRequestServiceTierKey.String("auto") + // The system will utilize the default scale tier. + // Stability: development + OpenAIRequestServiceTierDefault = OpenAIRequestServiceTierKey.String("default") +) + // Namespace: openshift const ( // OpenShiftClusterquotaNameKey is the attribute Key conforming to the @@ -11489,7 +12344,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "example.com", "corp.internal", "prod.db.local" // Note: This attribute SHOULD be set to the value of the `DB_DOMAIN` @@ -11509,7 +12364,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "ORCL1", "ORCL2", "ORCL3" // Note: There can be multiple instances associated with a single database @@ -11525,7 +12380,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "ORCL1", "FREE" // Note: This attribute SHOULD be set to the value of the parameter `DB_NAME` @@ -11538,7 +12393,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "PDB1", "FREEPDB" // Note: This attribute SHOULD reflect the PDB that the session is currently @@ -11556,7 +12411,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "order-processing-service", "db_low.adb.oraclecloud.com", // "db_high.adb.oraclecloud.com" @@ -11814,7 +12669,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Development // // Examples: "browser.mouse.click", "device.app.lifecycle" // Note: This attribute SHOULD be used by non-OTLP exporters when destination @@ -12285,7 +13140,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: 4 // Note: This field can be useful for querying or performing bucket analysis on @@ -12301,7 +13156,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "cmd/otelcol" ProcessCommandKey = attribute.Key("process.command") @@ -12317,7 +13172,7 @@ const ( // // Type: string[] // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "cmd/otecol", "--config=config.yaml" ProcessCommandArgsKey = attribute.Key("process.command_args") @@ -12332,7 +13187,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "C:\cmd\otecol --config="my directory\config.yaml"" ProcessCommandLineKey = attribute.Key("process.command_line") @@ -12344,7 +13199,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: ProcessContextSwitchTypeKey = attribute.Key("process.context_switch.type") @@ -12355,7 +13210,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "2023-11-21T09:25:34.853Z" ProcessCreationTimeKey = attribute.Key("process.creation.time") @@ -12366,7 +13221,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "c89b11207f6479603b0d49bf291c092c2b719293" ProcessExecutableBuildIDGNUKey = attribute.Key("process.executable.build_id.gnu") @@ -12377,7 +13232,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: // "foh3mEXu7BLZjsN9pOwG/kATcXlYVCDEFouRMQed_/WwRFB1hPo9LBkekthSPG/x8hMC8emW2cCjXD0_1aY" @@ -12385,27 +13240,14 @@ const ( // ProcessExecutableBuildIDHtlhashKey is the attribute Key conforming to the // "process.executable.build_id.htlhash" semantic conventions. It represents the - // deterministic build ID for executables. + // profiling specific build ID for executables. See the OTel specification for + // Profiles for more information. // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "600DCAFE4A110000F2BF38C493F5FB92" - // Note: GNU and Go build IDs may be stripped or unavailable in some - // environments - // (e.g., Alpine Linux, Docker images). This attribute provides a deterministic - // build ID computed by hashing the first and last 4096 bytes of the file - // along with its length: - // - // ``` - // Input ← Concat(File[:4096], File[-4096:], BigEndianUInt64(Len(File))) - // Digest ← SHA256(Input) - // BuildID ← Digest[:16] - // ``` - // - // The result is the first 16 bytes (128 bits) of the SHA256 digest, - // represented as a hex string. ProcessExecutableBuildIDHtlhashKey = attribute.Key("process.executable.build_id.htlhash") // ProcessExecutableNameKey is the attribute Key conforming to the @@ -12416,7 +13258,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "otelcol" ProcessExecutableNameKey = attribute.Key("process.executable.name") @@ -12429,7 +13271,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "/usr/bin/cmd/otelcol" ProcessExecutablePathKey = attribute.Key("process.executable.path") @@ -12439,7 +13281,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: 127 ProcessExitCodeKey = attribute.Key("process.exit.code") @@ -12450,7 +13292,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "2023-11-21T09:26:12.315Z" ProcessExitTimeKey = attribute.Key("process.exit.time") @@ -12462,7 +13304,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: 23 ProcessGroupLeaderPIDKey = attribute.Key("process.group_leader.pid") @@ -12473,7 +13315,7 @@ const ( // // Type: boolean // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: ProcessInteractiveKey = attribute.Key("process.interactive") @@ -12484,7 +13326,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "1:name=systemd:/user.slice/user-1000.slice/session-3.scope", // "0::/user.slice/user-1000.slice/user@1000.service/tmux-spawn-0267755b-4639-4a27-90ed-f19f88e53748.scope" @@ -12502,7 +13344,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "root" ProcessOwnerKey = attribute.Key("process.owner") @@ -12513,7 +13355,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: 111 ProcessParentPIDKey = attribute.Key("process.parent_pid") @@ -12523,7 +13365,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: 1234 ProcessPIDKey = attribute.Key("process.pid") @@ -12534,7 +13376,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: 1000 ProcessRealUserIDKey = attribute.Key("process.real_user.id") @@ -12545,7 +13387,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "operator" ProcessRealUserNameKey = attribute.Key("process.real_user.name") @@ -12557,7 +13399,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0 ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") @@ -12568,7 +13410,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "OpenJDK Runtime Environment" ProcessRuntimeNameKey = attribute.Key("process.runtime.name") @@ -12579,7 +13421,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: 14.0.2 ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") @@ -12590,7 +13432,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: 1002 ProcessSavedUserIDKey = attribute.Key("process.saved_user.id") @@ -12601,7 +13443,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "operator" ProcessSavedUserNameKey = attribute.Key("process.saved_user.name") @@ -12613,7 +13455,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: 14 ProcessSessionLeaderPIDKey = attribute.Key("process.session_leader.pid") @@ -12624,7 +13466,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "running" // @@ -12636,7 +13478,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "cat /etc/hostname", "xfce4-session", "bash" // Note: In many Unix-like systems, process title (proctitle), is the string @@ -12650,7 +13492,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: 1001 ProcessUserIDKey = attribute.Key("process.user.id") @@ -12661,7 +13503,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "root" ProcessUserNameKey = attribute.Key("process.user.name") @@ -12671,7 +13513,7 @@ const ( // // Type: int // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: 12 // Note: The process ID within a PID namespace. This is not necessarily unique @@ -12685,7 +13527,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "/root" ProcessWorkingDirectoryKey = attribute.Key("process.working_directory") @@ -12761,7 +13603,8 @@ func ProcessExecutableBuildIDGo(val string) attribute.KeyValue { // ProcessExecutableBuildIDHtlhash returns an attribute KeyValue conforming to // the "process.executable.build_id.htlhash" semantic conventions. It represents -// the deterministic build ID for executables. +// the profiling specific build ID for executables. See the OTel specification +// for Profiles for more information. func ProcessExecutableBuildIDHtlhash(val string) attribute.KeyValue { return ProcessExecutableBuildIDHtlhashKey.String(val) } @@ -12934,26 +13777,26 @@ func ProcessWorkingDirectory(val string) attribute.KeyValue { // Enum values for process.context_switch.type var ( // voluntary - // Stability: release_candidate + // Stability: development ProcessContextSwitchTypeVoluntary = ProcessContextSwitchTypeKey.String("voluntary") // involuntary - // Stability: release_candidate + // Stability: development ProcessContextSwitchTypeInvoluntary = ProcessContextSwitchTypeKey.String("involuntary") ) // Enum values for process.state var ( // running - // Stability: release_candidate + // Stability: development ProcessStateRunning = ProcessStateKey.String("running") // sleeping - // Stability: release_candidate + // Stability: development ProcessStateSleeping = ProcessStateKey.String("sleeping") // stopped - // Stability: release_candidate + // Stability: development ProcessStateStopped = ProcessStateKey.String("stopped") // defunct - // Stability: release_candidate + // Stability: development ProcessStateDefunct = ProcessStateKey.String("defunct") ) @@ -13049,12 +13892,6 @@ var ( // // [Rust]: https://wikipedia.org/wiki/Rust_(programming_language) ProfileFrameTypeRust = ProfileFrameTypeKey.String("rust") - // [LuaJIT] - // - // Stability: development - // - // [LuaJIT]: https://en.wikipedia.org/wiki/LuaJIT - ProfileFrameTypeLuajit = ProfileFrameTypeKey.String("luajit") ) // Namespace: rpc @@ -13404,7 +14241,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Alpha + // Stability: Development // // Examples: "critical", "high", "medium", "low" // Note: Application developers are encouraged to set `service.criticality` to @@ -13480,11 +14317,9 @@ const ( // Examples: "shoppingcart" // Note: MUST be the same for all instances of horizontally scaled services. If // the value was not specified, SDKs MUST fallback to `unknown_service:` - // concatenated with the process executable name, e.g. `unknown_service:bash`. - // If the process executable name is not available, the value MUST be set to + // concatenated with [`process.executable.name`], e.g. `unknown_service:bash`. + // If `process.executable.name` is not available, the value MUST be set to // `unknown_service`. - // The process executable name is the name of the process executable, the same - // value as described by the [`process.executable.name`] resource attribute. // // [`process.executable.name`]: process.md ServiceNameKey = attribute.Key("service.name") @@ -13602,21 +14437,21 @@ var ( // Service is business-critical; downtime directly impacts revenue, user // experience, or core functionality. // - // Stability: alpha + // Stability: development ServiceCriticalityCritical = ServiceCriticalityKey.String("critical") // Service is important but has degradation tolerance or fallback mechanisms. // - // Stability: alpha + // Stability: development ServiceCriticalityHigh = ServiceCriticalityKey.String("high") // Service provides supplementary functionality; degradation has limited user // impact. // - // Stability: alpha + // Stability: development ServiceCriticalityMedium = ServiceCriticalityKey.String("medium") // Service is non-essential to core operations; used for background tasks or // internal tools. // - // Stability: alpha + // Stability: development ServiceCriticalityLow = ServiceCriticalityKey.String("low") ) @@ -13808,17 +14643,6 @@ const ( // Examples: "ext4" SystemFilesystemTypeKey = attribute.Key("system.filesystem.type") - // SystemMemoryLinuxHugepagesStateKey is the attribute Key conforming to the - // "system.memory.linux.hugepages.state" semantic conventions. It represents the - // Linux HugePages memory state. - // - // Type: Enum - // RequirementLevel: Recommended - // Stability: Development - // - // Examples: "free", "used" - SystemMemoryLinuxHugepagesStateKey = attribute.Key("system.memory.linux.hugepages.state") - // SystemMemoryLinuxSlabStateKey is the attribute Key conforming to the // "system.memory.linux.slab.state" semantic conventions. It represents the // Linux Slab memory state. @@ -13857,7 +14681,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "minor" SystemPagingFaultTypeKey = attribute.Key("system.paging.fault.type") @@ -13929,16 +14753,6 @@ var ( SystemFilesystemTypeExt4 = SystemFilesystemTypeKey.String("ext4") ) -// Enum values for system.memory.linux.hugepages.state -var ( - // free - // Stability: development - SystemMemoryLinuxHugepagesStateFree = SystemMemoryLinuxHugepagesStateKey.String("free") - // used - // Stability: development - SystemMemoryLinuxHugepagesStateUsed = SystemMemoryLinuxHugepagesStateKey.String("used") -) - // Enum values for system.memory.linux.slab.state var ( // reclaimable @@ -13978,10 +14792,10 @@ var ( // Enum values for system.paging.fault.type var ( // major - // Stability: release_candidate + // Stability: development SystemPagingFaultTypeMajor = SystemPagingFaultTypeKey.String("major") // minor - // Stability: release_candidate + // Stability: development SystemPagingFaultTypeMinor = SystemPagingFaultTypeKey.String("minor") ) @@ -14003,7 +14817,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Development // // Examples: "parts-unlimited-java" // Note: Official auto instrumentation agents and distributions SHOULD set the @@ -14018,7 +14832,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Stable + // Stability: Development // // Examples: "1.2.3" TelemetryDistroVersionKey = attribute.Key("telemetry.distro.version") @@ -14112,9 +14926,6 @@ var ( // java // Stability: stable TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") - // kotlin - // Stability: stable - TelemetrySDKLanguageKotlin = TelemetrySDKLanguageKey.String("kotlin") // nodejs // Stability: stable TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") @@ -14956,9 +15767,8 @@ const ( // replaced by the // value `REDACTED`: // - // - [`X-Amz-Signature`] - // - [`X-Amz-Credential`] - // - [`X-Amz-Security-Token`] + // - [`AWSAccessKeyId`] + // - [`Signature`] // - [`sig`] // - [`X-Goog-Signature`] // @@ -14981,9 +15791,8 @@ const ( // `https://www.example.com/path?color=blue&sig=REDACTED`. // // [RFC3986]: https://www.rfc-editor.org/rfc/rfc3986 - // [`X-Amz-Signature`]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-authentication-methods.html - // [`X-Amz-Credential`]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-authentication-methods.html - // [`X-Amz-Security-Token`]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-authentication-methods.html + // [`AWSAccessKeyId`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth + // [`Signature`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth // [`sig`]: https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token // [`X-Goog-Signature`]: https://cloud.google.com/storage/docs/access-control/signed-urls URLFullKey = attribute.Key("url.full") @@ -15045,9 +15854,8 @@ const ( // Query string values for the following keys SHOULD be redacted by default and // replaced by the value `REDACTED`: // - // - [`X-Amz-Signature`] - // - [`X-Amz-Credential`] - // - [`X-Amz-Security-Token`] + // - [`AWSAccessKeyId`] + // - [`Signature`] // - [`sig`] // - [`X-Goog-Signature`] // @@ -15069,9 +15877,8 @@ const ( // `q=OpenTelemetry&sig=REDACTED`. // // [URI query]: https://www.rfc-editor.org/rfc/rfc3986#section-3.4 - // [`X-Amz-Signature`]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-authentication-methods.html - // [`X-Amz-Credential`]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-authentication-methods.html - // [`X-Amz-Security-Token`]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-authentication-methods.html + // [`AWSAccessKeyId`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth + // [`Signature`]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/RESTAuthentication.html#RESTAuthenticationQueryStringAuth // [`sig`]: https://learn.microsoft.com/azure/storage/common/storage-sas-overview#sas-token // [`X-Goog-Signature`]: https://cloud.google.com/storage/docs/access-control/signed-urls URLQueryKey = attribute.Key("url.query") @@ -15521,7 +16328,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "123" VCSChangeIDKey = attribute.Key("vcs.change.id") @@ -15532,7 +16339,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "open", "closed", "merged" VCSChangeStateKey = attribute.Key("vcs.change.state") @@ -15544,7 +16351,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "Fixes broken thing", "feat: add my new feature", "[chore] update // dependency" @@ -15556,7 +16363,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "added", "removed" VCSLineChangeTypeKey = attribute.Key("vcs.line_change.type") @@ -15567,7 +16374,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "my-org", "myteam", "business-unit" VCSOwnerNameKey = attribute.Key("vcs.owner.name") @@ -15578,7 +16385,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "github", "gitlab", "gitea", "bitbucket" VCSProviderNameKey = attribute.Key("vcs.provider.name") @@ -15589,7 +16396,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "my-feature-branch", "tag-1-test" // Note: `base` refers to the starting point of a change. For example, `main` @@ -15606,7 +16413,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "9d59409acf479dfa0df1aa568182e43e43df8bbe28d60fcf2bc52e30068802cc", // "main", "123", "HEAD" @@ -15638,7 +16445,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "branch", "tag" // Note: `base` refers to the starting point of a change. For example, `main` @@ -15654,7 +16461,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "my-feature-branch", "tag-1-test" // Note: `head` refers to where you are right now; the current reference at a @@ -15670,7 +16477,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "9d59409acf479dfa0df1aa568182e43e43df8bbe28d60fcf2bc52e30068802cc", // "main", "123", "HEAD" @@ -15700,7 +16507,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "branch", "tag" // Note: `head` refers to where you are right now; the current reference at a @@ -15714,7 +16521,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "branch", "tag" // @@ -15728,7 +16535,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "semantic-conventions", "my-cool-repo" // Note: Due to it only being the name, it can clash with forks of the same @@ -15743,7 +16550,7 @@ const ( // // Type: string // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: // "https://github.com/opentelemetry/open-telemetry-collector-contrib", @@ -15760,7 +16567,7 @@ const ( // // Type: Enum // RequirementLevel: Recommended - // Stability: Release_Candidate + // Stability: Development // // Examples: "ahead", "behind" VCSRevisionDeltaDirectionKey = attribute.Key("vcs.revision_delta.direction") @@ -15851,53 +16658,53 @@ var ( // Open means the change is currently active and under review. It hasn't been // merged into the target branch yet, and it's still possible to make changes or // add comments. - // Stability: release_candidate + // Stability: development VCSChangeStateOpen = VCSChangeStateKey.String("open") // WIP (work-in-progress, draft) means the change is still in progress and not // yet ready for a full review. It might still undergo significant changes. - // Stability: release_candidate + // Stability: development VCSChangeStateWip = VCSChangeStateKey.String("wip") // Closed means the merge request has been closed without merging. This can // happen for various reasons, such as the changes being deemed unnecessary, the // issue being resolved in another way, or the author deciding to withdraw the // request. - // Stability: release_candidate + // Stability: development VCSChangeStateClosed = VCSChangeStateKey.String("closed") // Merged indicates that the change has been successfully integrated into the // target codebase. - // Stability: release_candidate + // Stability: development VCSChangeStateMerged = VCSChangeStateKey.String("merged") ) // Enum values for vcs.line_change.type var ( // How many lines were added. - // Stability: release_candidate + // Stability: development VCSLineChangeTypeAdded = VCSLineChangeTypeKey.String("added") // How many lines were removed. - // Stability: release_candidate + // Stability: development VCSLineChangeTypeRemoved = VCSLineChangeTypeKey.String("removed") ) // Enum values for vcs.provider.name var ( // [GitHub] - // Stability: release_candidate + // Stability: development // // [GitHub]: https://github.com VCSProviderNameGithub = VCSProviderNameKey.String("github") // [GitLab] - // Stability: release_candidate + // Stability: development // // [GitLab]: https://gitlab.com VCSProviderNameGitlab = VCSProviderNameKey.String("gitlab") // [Gitea] - // Stability: release_candidate + // Stability: development // // [Gitea]: https://gitea.io VCSProviderNameGitea = VCSProviderNameKey.String("gitea") // [Bitbucket] - // Stability: release_candidate + // Stability: development // // [Bitbucket]: https://bitbucket.org VCSProviderNameBitbucket = VCSProviderNameKey.String("bitbucket") @@ -15906,12 +16713,12 @@ var ( // Enum values for vcs.ref.base.type var ( // [branch] - // Stability: release_candidate + // Stability: development // // [branch]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch VCSRefBaseTypeBranch = VCSRefBaseTypeKey.String("branch") // [tag] - // Stability: release_candidate + // Stability: development // // [tag]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag VCSRefBaseTypeTag = VCSRefBaseTypeKey.String("tag") @@ -15920,12 +16727,12 @@ var ( // Enum values for vcs.ref.head.type var ( // [branch] - // Stability: release_candidate + // Stability: development // // [branch]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch VCSRefHeadTypeBranch = VCSRefHeadTypeKey.String("branch") // [tag] - // Stability: release_candidate + // Stability: development // // [tag]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag VCSRefHeadTypeTag = VCSRefHeadTypeKey.String("tag") @@ -15934,12 +16741,12 @@ var ( // Enum values for vcs.ref.type var ( // [branch] - // Stability: release_candidate + // Stability: development // // [branch]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch VCSRefTypeBranch = VCSRefTypeKey.String("branch") // [tag] - // Stability: release_candidate + // Stability: development // // [tag]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag VCSRefTypeTag = VCSRefTypeKey.String("tag") @@ -15948,10 +16755,10 @@ var ( // Enum values for vcs.revision_delta.direction var ( // How many revisions the change is behind the target ref. - // Stability: release_candidate + // Stability: development VCSRevisionDeltaDirectionBehind = VCSRevisionDeltaDirectionKey.String("behind") // How many revisions the change is ahead of the target ref. - // Stability: release_candidate + // Stability: development VCSRevisionDeltaDirectionAhead = VCSRevisionDeltaDirectionKey.String("ahead") ) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/doc.go similarity index 77% rename from vendor/go.opentelemetry.io/otel/semconv/v1.43.0/doc.go rename to vendor/go.opentelemetry.io/otel/semconv/v1.40.0/doc.go index aadce15c02..c5c41e4d27 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/doc.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/doc.go @@ -1,11 +1,9 @@ -// Code generated from semantic convention specification. DO NOT EDIT. - // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 // Package semconv implements OpenTelemetry semantic conventions. // // OpenTelemetry semantic conventions are agreed standardized naming -// patterns for OpenTelemetry things. This package represents the v1.43.0 +// patterns for OpenTelemetry things. This package represents the v1.40.0 // version of the OpenTelemetry semantic conventions. -package semconv +package semconv // import "go.opentelemetry.io/otel/semconv/v1.40.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/error_type.go b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/error_type.go similarity index 74% rename from vendor/go.opentelemetry.io/otel/semconv/v1.43.0/error_type.go rename to vendor/go.opentelemetry.io/otel/semconv/v1.40.0/error_type.go index 5d8eff2229..6d26e52821 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/error_type.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/error_type.go @@ -1,13 +1,10 @@ -// Code generated from semantic convention specification. DO NOT EDIT. - // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package semconv +package semconv // import "go.opentelemetry.io/otel/semconv/v1.40.0" import ( "errors" - "fmt" "reflect" "go.opentelemetry.io/otel/attribute" @@ -25,8 +22,7 @@ import ( // the returned attribute has that method's return value. If multiple errors in // the chain implement this method, the value from the first match found by // [errors.As] is used. Otherwise, the returned attribute has a value derived -// from the concrete type of err after unwrapping any wrappers created with -// [fmt.Errorf]. +// from the concrete type of err. // // The key of the returned attribute is [ErrorTypeKey]. func ErrorType(err error) attribute.KeyValue { @@ -54,7 +50,7 @@ func errorType(err error) string { // Fallback to reflection if the ErrorType method is not supported or // returns an empty value. - t := reflect.TypeOf(unwrapFmtWrapped(err)) + t := reflect.TypeOf(err) pkg, name := t.PkgPath(), t.Name() if pkg != "" && name != "" { s = pkg + "." + name @@ -68,16 +64,3 @@ func errorType(err error) string { } return s } - -var fmtWrapErrorType = reflect.TypeOf(fmt.Errorf("wrapped: %w", errors.New("err"))) - -func unwrapFmtWrapped(err error) error { - for reflect.TypeOf(err) == fmtWrapErrorType { - u := errors.Unwrap(err) - if u == nil { - return err // When the wrapped error is nil, use the concrete type of the wrapper. - } - err = u - } - return err -} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/exception.go similarity index 69% rename from vendor/go.opentelemetry.io/otel/semconv/v1.43.0/exception.go rename to vendor/go.opentelemetry.io/otel/semconv/v1.40.0/exception.go index 6c9b05adbc..6a26231a1a 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/exception.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/exception.go @@ -1,9 +1,7 @@ -// Code generated from semantic convention specification. DO NOT EDIT. - // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package semconv +package semconv // import "go.opentelemetry.io/otel/semconv/v1.40.0" const ( // ExceptionEventName is the name of the Span event representing an exception. diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/schema.go similarity index 68% rename from vendor/go.opentelemetry.io/otel/semconv/v1.43.0/schema.go rename to vendor/go.opentelemetry.io/otel/semconv/v1.40.0/schema.go index ce5f5f5c5b..a07ffa3361 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/schema.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/schema.go @@ -1,11 +1,9 @@ -// Code generated from semantic convention specification. DO NOT EDIT. - // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package semconv +package semconv // import "go.opentelemetry.io/otel/semconv/v1.40.0" // SchemaURL is the schema URL that matches the version of the semantic conventions // that this package defines. Semconv packages starting from v1.4.0 must declare // non-empty schema URL in the form https://opentelemetry.io/schemas/ -const SchemaURL = "https://opentelemetry.io/schemas/1.43.0" +const SchemaURL = "https://opentelemetry.io/schemas/1.40.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/MIGRATION.md b/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/MIGRATION.md deleted file mode 100644 index 54d8e7d70f..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/MIGRATION.md +++ /dev/null @@ -1,4 +0,0 @@ - -# Migration from v1.42.0 to v1.43.0 - -The `go.opentelemetry.io/otel/semconv/v1.43.0` package should be a drop-in replacement for `go.opentelemetry.io/otel/semconv/v1.42.0`. diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/README.md b/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/README.md deleted file mode 100644 index 20e64d7953..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.43.0/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Semconv v1.43.0 - -[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/semconv/v1.43.0)](https://pkg.go.dev/go.opentelemetry.io/otel/semconv/v1.43.0) diff --git a/vendor/go.opentelemetry.io/otel/trace.go b/vendor/go.opentelemetry.io/otel/trace.go index 9c1567a2e6..6836c65478 100644 --- a/vendor/go.opentelemetry.io/otel/trace.go +++ b/vendor/go.opentelemetry.io/otel/trace.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package otel +package otel // import "go.opentelemetry.io/otel" import ( "go.opentelemetry.io/otel/internal/global" diff --git a/vendor/go.opentelemetry.io/otel/trace/auto.go b/vendor/go.opentelemetry.io/otel/trace/auto.go index 17cf898cd9..9316fd0ac4 100644 --- a/vendor/go.opentelemetry.io/otel/trace/auto.go +++ b/vendor/go.opentelemetry.io/otel/trace/auto.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace +package trace // import "go.opentelemetry.io/otel/trace" import ( "context" @@ -20,7 +20,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - semconv "go.opentelemetry.io/otel/semconv/v1.43.0" + semconv "go.opentelemetry.io/otel/semconv/v1.40.0" "go.opentelemetry.io/otel/trace/embedded" "go.opentelemetry.io/otel/trace/internal/telemetry" ) @@ -314,14 +314,6 @@ func convAttrValue(value attribute.Value) telemetry.Value { case attribute.STRING: v := truncate(maxSpan.AttrValueLen, value.AsString()) return telemetry.StringValue(v) - case attribute.BYTESLICE: - // len(v.AsString()) is identical to len(v.AsByteSlice()) but - // avoids allocating the full slice before truncation. - s := value.AsString() - if maxSpan.AttrValueLen >= 0 && len(s) > maxSpan.AttrValueLen { - return telemetry.BytesValue([]byte(s[:maxSpan.AttrValueLen])) - } - return telemetry.BytesValue([]byte(s)) case attribute.BOOLSLICE: slice := value.AsBoolSlice() out := make([]telemetry.Value, 0, len(slice)) @@ -351,23 +343,6 @@ func convAttrValue(value attribute.Value) telemetry.Value { out = append(out, telemetry.StringValue(v)) } return telemetry.SliceValue(out...) - case attribute.SLICE: - slice := value.AsSlice() - out := make([]telemetry.Value, 0, len(slice)) - for _, v := range slice { - out = append(out, convAttrValue(v)) - } - return telemetry.SliceValue(out...) - case attribute.MAP: - kvs := value.AsMap() - out := make([]telemetry.Attr, 0, len(kvs)) - for _, kv := range kvs { - out = append(out, telemetry.Attr{ - Key: string(kv.Key), - Value: convAttrValue(kv.Value), - }) - } - return telemetry.MapValue(out...) } return telemetry.Value{} } @@ -488,8 +463,7 @@ func (s *autoSpan) RecordError(err error, opts ...EventOption) { cfg := NewEventConfig(opts...) attrs := cfg.Attributes() - attrs = append( - attrs, + attrs = append(attrs, semconv.ExceptionType(typeStr(err)), semconv.ExceptionMessage(err.Error()), ) diff --git a/vendor/go.opentelemetry.io/otel/trace/config.go b/vendor/go.opentelemetry.io/otel/trace/config.go index 862ecc8988..d9ecef1cad 100644 --- a/vendor/go.opentelemetry.io/otel/trace/config.go +++ b/vendor/go.opentelemetry.io/otel/trace/config.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace +package trace // import "go.opentelemetry.io/otel/trace" import ( "slices" @@ -34,17 +34,10 @@ func (t *TracerConfig) SchemaURL() string { return t.schemaURL } -type experimentalOption interface { - Experimental() -} - // NewTracerConfig applies all the options to a returned TracerConfig. func NewTracerConfig(options ...TracerOption) TracerConfig { var config TracerConfig for _, option := range options { - if _, ok := option.(experimentalOption); ok { - continue - } config = option.apply(config) } return config @@ -110,9 +103,6 @@ func (cfg *SpanConfig) SpanKind() SpanKind { func NewSpanStartConfig(options ...SpanStartOption) SpanConfig { var c SpanConfig for _, option := range options { - if _, ok := option.(experimentalOption); ok { - continue - } c = option.applySpanStart(c) } return c @@ -125,9 +115,6 @@ func NewSpanStartConfig(options ...SpanStartOption) SpanConfig { func NewSpanEndConfig(options ...SpanEndOption) SpanConfig { var c SpanConfig for _, option := range options { - if _, ok := option.(experimentalOption); ok { - continue - } c = option.applySpanEnd(c) } return c @@ -180,9 +167,6 @@ func (cfg *EventConfig) StackTrace() bool { func NewEventConfig(options ...EventOption) EventConfig { var c EventConfig for _, option := range options { - if _, ok := option.(experimentalOption); ok { - continue - } c = option.applyEvent(c) } if c.timestamp.IsZero() { diff --git a/vendor/go.opentelemetry.io/otel/trace/context.go b/vendor/go.opentelemetry.io/otel/trace/context.go index 89927eda6f..8c45a7107f 100644 --- a/vendor/go.opentelemetry.io/otel/trace/context.go +++ b/vendor/go.opentelemetry.io/otel/trace/context.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace +package trace // import "go.opentelemetry.io/otel/trace" import "context" diff --git a/vendor/go.opentelemetry.io/otel/trace/doc.go b/vendor/go.opentelemetry.io/otel/trace/doc.go index 57de8f348a..cdbf41d6d7 100644 --- a/vendor/go.opentelemetry.io/otel/trace/doc.go +++ b/vendor/go.opentelemetry.io/otel/trace/doc.go @@ -116,4 +116,4 @@ It is strongly recommended that authors only embed That implementation is the only one OpenTelemetry authors can guarantee will fully implement all the API interfaces when a user updates their API. */ -package trace +package trace // import "go.opentelemetry.io/otel/trace" diff --git a/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go b/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go index 59d8a510b3..3e359a00bf 100644 --- a/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go +++ b/vendor/go.opentelemetry.io/otel/trace/embedded/embedded.go @@ -11,7 +11,7 @@ // the API package). // // [OpenTelemetry trace API]: https://pkg.go.dev/go.opentelemetry.io/otel/trace -package embedded +package embedded // import "go.opentelemetry.io/otel/trace/embedded" // TracerProvider is embedded in // [go.opentelemetry.io/otel/trace.TracerProvider]. diff --git a/vendor/go.opentelemetry.io/otel/trace/hex.go b/vendor/go.opentelemetry.io/otel/trace/hex.go index 5f156b0dcb..1cbef1d4b9 100644 --- a/vendor/go.opentelemetry.io/otel/trace/hex.go +++ b/vendor/go.opentelemetry.io/otel/trace/hex.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace +package trace // import "go.opentelemetry.io/otel/trace" const ( // hexLU is a hex lookup table of the 16 lowercase hex digits. diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/attr.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/attr.go index 9503318eb5..ff0f6eac62 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/attr.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/attr.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package telemetry +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" // Attr is a key-value pair. type Attr struct { diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/doc.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/doc.go index 949e2165c0..5debe90bbb 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/doc.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/doc.go @@ -5,4 +5,4 @@ Package telemetry provides a lightweight representations of OpenTelemetry telemetry that is compatible with the OTLP JSON protobuf encoding. */ -package telemetry +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/id.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/id.go index 3a6d6b87a4..bea56f2e7d 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/id.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/id.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package telemetry +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" import ( "encoding/hex" diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/number.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/number.go index 29e629d667..f5e3a8cec9 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/number.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/number.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package telemetry +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" import ( "encoding/json" diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/resource.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/resource.go index cecad8bae3..1798a702d4 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/resource.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/resource.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package telemetry +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" import ( "bytes" diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/scope.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/scope.go index b6f2e28d40..c2b4c635b7 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/scope.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/scope.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package telemetry +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" import ( "bytes" diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/span.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/span.go index 0da6e5fd6a..e7ca62c660 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/span.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/span.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package telemetry +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" import ( "bytes" @@ -314,9 +314,9 @@ type SpanEvent struct { } // MarshalJSON encodes e into OTLP formatted JSON. -func (se SpanEvent) MarshalJSON() ([]byte, error) { - t := se.Time.UnixNano() - if se.Time.IsZero() || t < 0 { +func (e SpanEvent) MarshalJSON() ([]byte, error) { + t := e.Time.UnixNano() + if e.Time.IsZero() || t < 0 { t = 0 } @@ -325,7 +325,7 @@ func (se SpanEvent) MarshalJSON() ([]byte, error) { Alias Time uint64 `json:"timeUnixNano,omitempty"` }{ - Alias: Alias(se), + Alias: Alias(e), Time: uint64(t), // nolint: gosec // >0 checked above }) } diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/status.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/status.go index 5dac1b2cb8..1039bf40cd 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/status.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/status.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package telemetry +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" // StatusCode is the status of a Span. // diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/traces.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/traces.go index 44197b8084..e5f10767ca 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/traces.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/traces.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package telemetry +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" import ( "bytes" diff --git a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/value.go b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/value.go index 9d2d680634..cb7927b816 100644 --- a/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/value.go +++ b/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/value.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package telemetry +package telemetry // import "go.opentelemetry.io/otel/trace/internal/telemetry" import ( "bytes" diff --git a/vendor/go.opentelemetry.io/otel/trace/nonrecording.go b/vendor/go.opentelemetry.io/otel/trace/nonrecording.go index d672f03c2a..c00221e7be 100644 --- a/vendor/go.opentelemetry.io/otel/trace/nonrecording.go +++ b/vendor/go.opentelemetry.io/otel/trace/nonrecording.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace +package trace // import "go.opentelemetry.io/otel/trace" // nonRecordingSpan is a minimal implementation of a Span that wraps a // SpanContext. It performs no operations other than to return the wrapped diff --git a/vendor/go.opentelemetry.io/otel/trace/noop.go b/vendor/go.opentelemetry.io/otel/trace/noop.go index b954251b2d..400fab1238 100644 --- a/vendor/go.opentelemetry.io/otel/trace/noop.go +++ b/vendor/go.opentelemetry.io/otel/trace/noop.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace +package trace // import "go.opentelemetry.io/otel/trace" import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/trace/noop/noop.go b/vendor/go.opentelemetry.io/otel/trace/noop/noop.go index 4f8190e417..689d220df7 100644 --- a/vendor/go.opentelemetry.io/otel/trace/noop/noop.go +++ b/vendor/go.opentelemetry.io/otel/trace/noop/noop.go @@ -10,7 +10,7 @@ // This implementation can be embedded in other implementations of the // OpenTelemetry trace API. Doing so will mean the implementation defaults to // no operation for methods it does not implement. -package noop +package noop // import "go.opentelemetry.io/otel/trace/noop" import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/trace/provider.go b/vendor/go.opentelemetry.io/otel/trace/provider.go index 891cc0b8ca..ef85cb70c6 100644 --- a/vendor/go.opentelemetry.io/otel/trace/provider.go +++ b/vendor/go.opentelemetry.io/otel/trace/provider.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace +package trace // import "go.opentelemetry.io/otel/trace" import "go.opentelemetry.io/otel/trace/embedded" diff --git a/vendor/go.opentelemetry.io/otel/trace/span.go b/vendor/go.opentelemetry.io/otel/trace/span.go index 603b2c146f..d01e793664 100644 --- a/vendor/go.opentelemetry.io/otel/trace/span.go +++ b/vendor/go.opentelemetry.io/otel/trace/span.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace +package trace // import "go.opentelemetry.io/otel/trace" import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/trace/trace.go b/vendor/go.opentelemetry.io/otel/trace/trace.go index c4c383819f..e3d103c4b6 100644 --- a/vendor/go.opentelemetry.io/otel/trace/trace.go +++ b/vendor/go.opentelemetry.io/otel/trace/trace.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace +package trace // import "go.opentelemetry.io/otel/trace" import ( "encoding/json" diff --git a/vendor/go.opentelemetry.io/otel/trace/tracer.go b/vendor/go.opentelemetry.io/otel/trace/tracer.go index 7e6e5ee937..77952d2a0b 100644 --- a/vendor/go.opentelemetry.io/otel/trace/tracer.go +++ b/vendor/go.opentelemetry.io/otel/trace/tracer.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace +package trace // import "go.opentelemetry.io/otel/trace" import ( "context" diff --git a/vendor/go.opentelemetry.io/otel/trace/tracestate.go b/vendor/go.opentelemetry.io/otel/trace/tracestate.go index 9ac78fa04c..e9cb3fd4d1 100644 --- a/vendor/go.opentelemetry.io/otel/trace/tracestate.go +++ b/vendor/go.opentelemetry.io/otel/trace/tracestate.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package trace +package trace // import "go.opentelemetry.io/otel/trace" import ( "encoding/json" diff --git a/vendor/go.opentelemetry.io/otel/version.go b/vendor/go.opentelemetry.io/otel/version.go index ea79030969..1db4f47e43 100644 --- a/vendor/go.opentelemetry.io/otel/version.go +++ b/vendor/go.opentelemetry.io/otel/version.go @@ -1,9 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package otel +package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.45.0" + return "1.43.0" } diff --git a/vendor/go.opentelemetry.io/otel/versions.yaml b/vendor/go.opentelemetry.io/otel/versions.yaml index 3b1ad7301a..bcc6ee78a4 100644 --- a/vendor/go.opentelemetry.io/otel/versions.yaml +++ b/vendor/go.opentelemetry.io/otel/versions.yaml @@ -3,7 +3,7 @@ module-sets: stable-v1: - version: v1.45.0 + version: v1.43.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opencensus @@ -22,12 +22,11 @@ module-sets: - go.opentelemetry.io/otel/sdk/metric - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.67.0 + version: v0.65.0 modules: - go.opentelemetry.io/otel/exporters/prometheus - - go.opentelemetry.io/otel/metric/x experimental-logs: - version: v0.21.0 + version: v0.19.0 modules: - go.opentelemetry.io/otel/log - go.opentelemetry.io/otel/log/logtest @@ -37,7 +36,7 @@ module-sets: - go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp - go.opentelemetry.io/otel/exporters/stdout/stdoutlog experimental-schema: - version: v0.0.18 + version: v0.0.16 modules: - go.opentelemetry.io/otel/schema excluded-modules: @@ -56,9 +55,6 @@ modules: go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc: version-refs: - ./internal/version.go - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp: - version-refs: - - ./internal/version.go go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc: version-refs: - ./internal/version.go diff --git a/vendor/golang.org/x/mod/modfile/read.go b/vendor/golang.org/x/mod/modfile/read.go index 9e35e1ac51..504a2f1df6 100644 --- a/vendor/golang.org/x/mod/modfile/read.go +++ b/vendor/golang.org/x/mod/modfile/read.go @@ -9,7 +9,6 @@ import ( "errors" "fmt" "os" - "slices" "strconv" "strings" "unicode" @@ -106,7 +105,8 @@ func (x *FileSyntax) addLine(hint Expr, tokens ...string) *Line { if hint == nil { // If no hint given, add to the last statement of the given type. Loop: - for _, stmt := range slices.Backward(x.Stmt) { + for i := len(x.Stmt) - 1; i >= 0; i-- { + stmt := x.Stmt[i] switch stmt := stmt.(type) { case *Line: if stmt.Token != nil && stmt.Token[0] == tokens[0] { @@ -718,7 +718,9 @@ func (in *input) assignComments() { } // Assign suffix comments to syntax immediately before. - for _, x := range slices.Backward(in.post) { + for i := len(in.post) - 1; i >= 0; i-- { + x := in.post[i] + start, end := x.Span() if debug { fmt.Fprintf(os.Stderr, "post %T :%d:%d #%d :%d:%d #%d\n", x, start.Line, start.LineRune, start.Byte, end.Line, end.LineRune, end.Byte) @@ -924,7 +926,7 @@ var ( moduleStr = []byte("module") ) -// ModulePath returns the module path from the go.mod file text. +// ModulePath returns the module path from the gomod file text. // If it cannot find a module path, it returns an empty string. // It is tolerant of unrelated problems in the go.mod file. func ModulePath(mod []byte) string { diff --git a/vendor/golang.org/x/mod/modfile/rule.go b/vendor/golang.org/x/mod/modfile/rule.go index 20ba825d29..c5b8305de7 100644 --- a/vendor/golang.org/x/mod/modfile/rule.go +++ b/vendor/golang.org/x/mod/modfile/rule.go @@ -327,7 +327,6 @@ func parseToFile(file string, data []byte, fix VersionFixer, strict bool) (parse } var GoVersionRE = lazyregexp.New(`^([1-9][0-9]*)\.(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))?([a-z]+[0-9]+)?$`) - var laxGoVersionRE = lazyregexp.New(`^v?(([1-9][0-9]*)\.(0|[1-9][0-9]*))([^0-9].*)$`) // Toolchains must be named beginning with `go1`, @@ -1273,17 +1272,6 @@ func (f *File) SetRequire(req []*Require) { // SetRequireSeparateIndirect will split it into a direct-only and indirect-only // block. This aids in the transition to separate blocks. func (f *File) SetRequireSeparateIndirect(req []*Require) { - f.setRequireSeparateIndirect(req, false) -} - -// SetRequireAtMostTwo is like SetRequireSeparateIndirect but it aggressively -// consolidates all requirements into at most two blocks (one direct, one indirect). -// It ignores existing blocks and comments when deciding where to place requirements. -func (f *File) SetRequireAtMostTwo(req []*Require) { - f.setRequireSeparateIndirect(req, true) -} - -func (f *File) setRequireSeparateIndirect(req []*Require, simplify bool) { // hasComments returns whether a line or block has comments // other than "indirect". hasComments := func(c Comments) bool { @@ -1316,17 +1304,6 @@ func (f *File) setRequireSeparateIndirect(req []*Require, simplify bool) { } // Examine existing require lines and blocks. - need := make(map[string]*Require) - for _, r := range req { - need[r.Mod.Path] = r - } - lineIndirect := make(map[*Line]bool) - for _, r := range f.Require { - if n := need[r.Mod.Path]; n != nil { - lineIndirect[r.Syntax] = n.Indirect - } - } - var ( // We may insert new requirements into the last uncommented // direct-only and indirect-only blocks. We may also move requirements @@ -1344,9 +1321,7 @@ func (f *File) setRequireSeparateIndirect(req []*Require, simplify bool) { // Track the block each requirement belongs to (if any) so we can // move them later. - lineToBlock = make(map[*Line]*LineBlock) - directBlockComments []Comment - indirectBlockComments []Comment + lineToBlock = make(map[*Line]*LineBlock) ) for i, stmt := range f.Syntax.Stmt { switch stmt := stmt.(type) { @@ -1389,24 +1364,6 @@ func (f *File) setRequireSeparateIndirect(req []*Require, simplify bool) { if allIndirect { lastIndirectIndex = i } - if simplify { - anyDirect := false - for _, line := range stmt.Line { - if ind, ok := lineIndirect[line]; ok && !ind { - anyDirect = true - break - } - } - target := &directBlockComments - if !anyDirect && len(stmt.Line) > 0 { - target = &indirectBlockComments - } - if len(*target) > 0 && len(stmt.Comments.Before) > 0 { - *target = append(*target, Comment{Token: "//"}) - } - *target = append(*target, stmt.Comments.Before...) - stmt.Comments.Before = nil - } } } @@ -1465,23 +1422,18 @@ func (f *File) setRequireSeparateIndirect(req []*Require, simplify bool) { lastIndirectBlock = ensureBlock(lastIndirectIndex) } - if simplify { - if len(directBlockComments) > 0 { - lastDirectBlock.Comments.Before = append(lastDirectBlock.Comments.Before, directBlockComments...) - } - if len(indirectBlockComments) > 0 { - lastIndirectBlock.Comments.Before = append(lastIndirectBlock.Comments.Before, indirectBlockComments...) - } - } - // Delete requirements we don't want anymore. // Update versions and indirect comments on requirements we want to keep. // If a requirement is in last{Direct,Indirect}Block with the wrong - // indirect marking after this, or if the requirement is in a single + // indirect marking after this, or if the requirement is in an single // uncommented mixed block (oneFlatUncommentedBlock), move it to the // correct block. // // Some blocks may be empty after this. Cleanup will remove them. + need := make(map[string]*Require) + for _, r := range req { + need[r.Mod.Path] = r + } have := make(map[string]*Require) for _, r := range f.Require { path := r.Mod.Path @@ -1494,10 +1446,10 @@ func (f *File) setRequireSeparateIndirect(req []*Require, simplify bool) { r.setVersion(need[path].Mod.Version) r.setIndirect(need[path].Indirect) if need[path].Indirect && - (simplify || oneFlatUncommentedBlock || lineToBlock[r.Syntax] == lastDirectBlock) { + (oneFlatUncommentedBlock || lineToBlock[r.Syntax] == lastDirectBlock) { moveReq(r, lastIndirectBlock) } else if !need[path].Indirect && - (simplify || oneFlatUncommentedBlock || lineToBlock[r.Syntax] == lastIndirectBlock) { + (oneFlatUncommentedBlock || lineToBlock[r.Syntax] == lastIndirectBlock) { moveReq(r, lastDirectBlock) } } @@ -1537,7 +1489,7 @@ func (f *File) DropRequire(path string) error { return nil } -// AddExclude adds an exclude statement to the mod file. Errors if the provided +// AddExclude adds a exclude statement to the mod file. Errors if the provided // version is not a canonical version string func (f *File) AddExclude(path, vers string) error { if err := checkCanonicalVersion(path, vers); err != nil { @@ -1708,7 +1660,7 @@ func (f *File) AddIgnore(path string) error { return nil } -// DropIgnore removes an ignore directive with the given path. +// DropIgnore removes a ignore directive with the given path. // It does nothing if no such ignore directive exists. func (f *File) DropIgnore(path string) error { for _, t := range f.Ignore { @@ -1784,7 +1736,8 @@ func removeDups(syntax *FileSyntax, exclude *[]*Exclude, replace *[]*Replace, to // Remove duplicate replacements. // Later replacements take priority over earlier ones. haveReplace := make(map[module.Version]bool) - for _, x := range slices.Backward(*replace) { + for i := len(*replace) - 1; i >= 0; i-- { + x := (*replace)[i] if haveReplace[x.Old] { kill[x.Syntax] = true continue diff --git a/vendor/golang.org/x/net/html/entity.go b/vendor/golang.org/x/net/html/entity.go index 4e8d5d55f2..b628880a01 100644 --- a/vendor/golang.org/x/net/html/entity.go +++ b/vendor/golang.org/x/net/html/entity.go @@ -2156,8 +2156,9 @@ var entity = map[string]rune{ // HTML entities that are two unicode codepoints. var entity2 = map[string][2]rune{ - "nLt;": {'\u226A', '\u20D2'}, - "nGt;": {'\u226B', '\u20D2'}, + // TODO(nigeltao): Handle replacements that are wider than their names. + // "nLt;": {'\u226A', '\u20D2'}, + // "nGt;": {'\u226B', '\u20D2'}, "NotEqualTilde;": {'\u2242', '\u0338'}, "NotGreaterFullEqual;": {'\u2267', '\u0338'}, "NotGreaterGreater;": {'\u226B', '\u0338'}, diff --git a/vendor/golang.org/x/net/html/escape.go b/vendor/golang.org/x/net/html/escape.go index df3edc5b12..12f2273706 100644 --- a/vendor/golang.org/x/net/html/escape.go +++ b/vendor/golang.org/x/net/html/escape.go @@ -6,7 +6,6 @@ package html import ( "bytes" - "slices" "strings" "unicode/utf8" ) @@ -51,24 +50,25 @@ var replacementTable = [...]rune{ // 0x0D->'\u000D' is a no-op. } -// unescapeEntity attempts to consume a character reference from s[src:], -// returning the rune, potential second rune, and number of bytes consumed -// (which indicates the length of the character reference). It is assumed that -// the first byte of s is '&'. attribute should be true if parsing an attribute -// value. -func unescapeEntity(s []byte, attribute bool) (rune, rune, int) { +// unescapeEntity reads an entity like "<" from b[src:] and writes the +// corresponding "<" to b[dst:], returning the incremented dst and src cursors. +// Precondition: b[src] == '&' && dst <= src. +// attribute should be true if parsing an attribute value. +func unescapeEntity(b []byte, dst, src int, attribute bool) (dst1, src1 int) { // https://html.spec.whatwg.org/multipage/syntax.html#consume-a-character-reference // i starts at 1 because we already know that s[0] == '&'. - i := 1 + i, s := 1, b[src:] if len(s) <= 1 { - return '&', 0, 1 + b[dst] = b[src] + return dst + 1, src + 1 } if s[i] == '#' { - if len(s) <= 2 { // We need to have at least "&#". - return '&', 0, 1 + if len(s) <= 3 { // We need to have at least "&#.". + b[dst] = b[src] + return dst + 1, src + 1 } i++ c := s[i] @@ -78,43 +78,34 @@ func unescapeEntity(s []byte, attribute bool) (rune, rune, int) { i++ } - i0 := i x := '\x00' for i < len(s) { c = s[i] - var d rune - var mult rune + i++ if hex { - mult = 16 if '0' <= c && c <= '9' { - d = rune(c) - '0' + x = 16*x + rune(c) - '0' + continue } else if 'a' <= c && c <= 'f' { - d = rune(c) - 'a' + 10 + x = 16*x + rune(c) - 'a' + 10 + continue } else if 'A' <= c && c <= 'F' { - d = rune(c) - 'A' + 10 - } else { - break - } - } else { - mult = 10 - if '0' <= c && c <= '9' { - d = rune(c) - '0' - } else { - break + x = 16*x + rune(c) - 'A' + 10 + continue } + } else if '0' <= c && c <= '9' { + x = 10*x + rune(c) - '0' + continue } - if x <= 0x10FFFF { - x = mult*x + d + if c != ';' { + i-- } - i++ - } - - if i == i0 { // No characters matched. - return '&', 0, 1 + break } - if i < len(s) && s[i] == ';' { - i++ + if i <= 3 { // No characters matched. + b[dst] = b[src] + return dst + 1, src + 1 } if 0x80 <= x && x <= 0x9F { @@ -125,7 +116,7 @@ func unescapeEntity(s []byte, attribute bool) (rune, rune, int) { x = '\uFFFD' } - return x, 0, i + return dst + utf8.EncodeRune(b[dst:], x), src + i } // Consume the maximum number of characters possible, with the @@ -150,9 +141,10 @@ func unescapeEntity(s []byte, attribute bool) (rune, rune, int) { } else if attribute && entityName[len(entityName)-1] != ';' && len(s) > i && s[i] == '=' { // No-op. } else if x := entity[entityName]; x != 0 { - return x, 0, i + return dst + utf8.EncodeRune(b[dst:], x), src + i } else if x := entity2[entityName]; x[0] != 0 { - return x[0], x[1], i + dst1 := dst + utf8.EncodeRune(b[dst:], x[0]) + return dst1 + utf8.EncodeRune(b[dst1:], x[1]), src + i } else if !attribute { maxLen := len(entityName) - 1 if maxLen > longestEntityWithoutSemicolon { @@ -160,67 +152,35 @@ func unescapeEntity(s []byte, attribute bool) (rune, rune, int) { } for j := maxLen; j > 1; j-- { if x := entity[entityName[:j]]; x != 0 { - return x, 0, j + 1 + return dst + utf8.EncodeRune(b[dst:], x), src + j + 1 } } } - return '&', 0, 1 + dst1, src1 = dst+i, src+i + copy(b[dst:dst1], b[src:src1]) + return dst1, src1 } -// unescape unescapes b's entites, so that "a<b" becomes "a entityNameLen { - if reusingB { - out = slices.Clone(out) - reusingB = false + for i, c := range b { + if c == '&' { + dst, src := unescapeEntity(b, i, i, attribute) + for src < len(b) { + c := b[src] + if c == '&' { + dst, src = unescapeEntity(b, dst, src, attribute) + } else { + b[dst] = c + dst, src = dst+1, src+1 + } } - out = slices.Grow(out, replLen) - } - out = utf8.AppendRune(out, r1) - if r2 != 0 { - out = utf8.AppendRune(out, r2) + return b[0:dst] } - - src += entityNameLen } - - return out + return b } // lower lower-cases the A-Z bytes in b in-place, so that "aBc" becomes "abc". diff --git a/vendor/golang.org/x/net/html/foreign.go b/vendor/golang.org/x/net/html/foreign.go index 65d01d1ed9..e8515d8e88 100644 --- a/vendor/golang.org/x/net/html/foreign.go +++ b/vendor/golang.org/x/net/html/foreign.go @@ -23,7 +23,7 @@ func adjustForeignAttributes(aa []Attribute) { } switch a.Key { case "xlink:actuate", "xlink:arcrole", "xlink:href", "xlink:role", "xlink:show", - "xlink:title", "xlink:type", "xml:lang", "xml:space", "xmlns:xlink": + "xlink:title", "xlink:type", "xml:base", "xml:lang", "xml:space", "xmlns:xlink": j := strings.Index(a.Key, ":") aa[i].Namespace = a.Key[:j] aa[i].Key = a.Key[j+1:] diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go index 165b6108d4..b3d2a25581 100644 --- a/vendor/golang.org/x/net/html/parse.go +++ b/vendor/golang.org/x/net/html/parse.go @@ -63,7 +63,7 @@ func (p *parser) top() *Node { // Stop tags for use in popUntil. These come from section 12.2.4.2. var ( defaultScopeStopTags = map[string][]a.Atom{ - "": {a.Applet, a.Caption, a.Html, a.Table, a.Td, a.Th, a.Marquee, a.Object, a.Template, a.Select}, + "": {a.Applet, a.Caption, a.Html, a.Table, a.Td, a.Th, a.Marquee, a.Object, a.Template}, "math": {a.AnnotationXml, a.Mi, a.Mn, a.Mo, a.Ms, a.Mtext}, "svg": {a.Desc, a.ForeignObject, a.Title}, } @@ -78,6 +78,7 @@ const ( tableScope tableRowScope tableBodyScope + selectScope ) // popUntil pops the stack of open elements at the highest element whose tag @@ -132,6 +133,10 @@ func (p *parser) indexOfElementInScope(s scope, matchTags ...a.Atom) int { if tagAtom == a.Html || tagAtom == a.Table || tagAtom == a.Template { return -1 } + case selectScope: + if tagAtom != a.Optgroup && tagAtom != a.Option { + return -1 + } default: panic(fmt.Sprintf("html: internal error: indexOfElementInScope unknown scope: %d", s)) } @@ -455,6 +460,21 @@ func (p *parser) resetInsertionMode() { } switch n.DataAtom { + case a.Select: + if !last { + for ancestor, first := n, p.oe[0]; ancestor != first; { + ancestor = p.oe[p.oe.index(ancestor)-1] + switch ancestor.DataAtom { + case a.Template: + p.im = inSelectIM + return + case a.Table: + p.im = inSelectInTableIM + return + } + } + } + p.im = inSelectIM case a.Td, a.Th: // TODO: remove this divergence from the HTML5 spec. // @@ -982,10 +1002,7 @@ func inBodyIM(p *parser) bool { p.popUntil(buttonScope, a.P) p.addElement() case a.Button: - if p.elementInScope(defaultScope, a.Button) { - p.generateImpliedEndTags() - p.popUntil(defaultScope, a.Button) - } + p.popUntil(defaultScope, a.Button) p.reconstructActiveFormattingElements() p.addElement() p.framesetOK = false @@ -1023,18 +1040,7 @@ func inBodyIM(p *parser) bool { p.framesetOK = false p.im = inTableIM return true - case a.Area, a.Br, a.Embed, a.Img, a.Keygen, a.Wbr: - p.reconstructActiveFormattingElements() - p.addElement() - p.oe.pop() - p.acknowledgeSelfClosingTag() - p.framesetOK = false - case a.Input: - if p.fragment && p.context.DataAtom == a.Select { - // Ignore the token. - return true - } - p.popUntil(defaultScope, a.Select) + case a.Area, a.Br, a.Embed, a.Img, a.Input, a.Keygen, a.Wbr: p.reconstructActiveFormattingElements() p.addElement() p.oe.pop() @@ -1055,13 +1061,7 @@ func inBodyIM(p *parser) bool { p.oe.pop() p.acknowledgeSelfClosingTag() case a.Hr: - if p.elementInScope(buttonScope, a.P) { - p.generateImpliedEndTags("p") - p.popUntil(defaultScope, a.P) - } - if p.elementInScope(defaultScope, a.Select) { - p.generateImpliedEndTags() - } + p.popUntil(buttonScope, a.P) p.addElement() p.oe.pop() p.acknowledgeSelfClosingTag() @@ -1095,30 +1095,13 @@ func inBodyIM(p *parser) bool { // Don't let the tokenizer go into raw text mode when scripting is disabled. p.tokenizer.NextIsNotRawText() case a.Select: - if p.fragment && p.context.DataAtom == a.Select { - // Ignore the token. - return true - } else if p.popUntil(defaultScope, a.Select) { - return true - } p.reconstructActiveFormattingElements() p.addElement() p.framesetOK = false + p.im = inSelectIM return true - case a.Option: - if p.elementInScope(defaultScope, a.Select) { - p.generateImpliedEndTags("optgroup") - // If oe has option element in scope, parse error? - } else if p.top().DataAtom == a.Option { - p.oe.pop() - } - p.reconstructActiveFormattingElements() - p.addElement() - case a.Optgroup: - if p.elementInScope(defaultScope, a.Select) { - p.generateImpliedEndTags() - // If oe has option or optgroup element in scope, parse error? - } else if p.top().DataAtom == a.Option { + case a.Optgroup, a.Option: + if p.top().DataAtom == a.Option { p.oe.pop() } p.reconstructActiveFormattingElements() @@ -1166,12 +1149,7 @@ func inBodyIM(p *parser) bool { return false } return true - case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Main, a.Menu, a.Nav, a.Ol, a.Pre, a.Search, a.Section, a.Select, a.Summary, a.Ul: - if !p.elementInScope(defaultScope, p.tok.DataAtom) { - // Ignore the token. - return true - } - p.generateImpliedEndTags() + case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Main, a.Menu, a.Nav, a.Ol, a.Pre, a.Search, a.Section, a.Summary, a.Ul: p.popUntil(defaultScope, p.tok.DataAtom) case a.Form: if p.oe.contains(a.Template) { @@ -1510,6 +1488,17 @@ func inTableIM(p *parser) bool { } p.addElement() p.form = p.oe.pop() + case a.Select: + p.reconstructActiveFormattingElements() + switch p.top().DataAtom { + case a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr: + p.fosterParenting = true + } + p.addElement() + p.fosterParenting = false + p.framesetOK = false + p.im = inSelectInTableIM + return true } case EndTagToken: switch p.tok.DataAtom { @@ -1558,6 +1547,12 @@ func inCaptionIM(p *parser) bool { p.clearActiveFormattingElements() p.im = inTableIM return false + case a.Select: + p.reconstructActiveFormattingElements() + p.addElement() + p.framesetOK = false + p.im = inSelectInTableIM + return true } case EndTagToken: switch p.tok.DataAtom { @@ -1767,6 +1762,12 @@ func inCellIM(p *parser) bool { } // Ignore the token. return true + case a.Select: + p.reconstructActiveFormattingElements() + p.addElement() + p.framesetOK = false + p.im = inSelectInTableIM + return true } case EndTagToken: switch p.tok.DataAtom { @@ -1797,6 +1798,118 @@ func inCellIM(p *parser) bool { return inBodyIM(p) } +// Section 12.2.6.4.16. +func inSelectIM(p *parser) bool { + switch p.tok.Type { + case TextToken: + p.addText(strings.Replace(p.tok.Data, "\x00", "", -1)) + case StartTagToken: + switch p.tok.DataAtom { + case a.Html: + return inBodyIM(p) + case a.Option: + if p.top().DataAtom == a.Option { + p.oe.pop() + } + p.addElement() + case a.Optgroup: + if p.top().DataAtom == a.Option { + p.oe.pop() + } + if p.top().DataAtom == a.Optgroup { + p.oe.pop() + } + p.addElement() + case a.Select: + if !p.popUntil(selectScope, a.Select) { + // Ignore the token. + return true + } + p.resetInsertionMode() + case a.Input, a.Keygen, a.Textarea: + if p.elementInScope(selectScope, a.Select) { + p.parseImpliedToken(EndTagToken, a.Select, a.Select.String()) + return false + } + // In order to properly ignore