From fad133f120c02ab641fc0ef753803d673087e033 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 14 Sep 2026 01:02:57 +0800 Subject: [PATCH] Sync telemetry producer fixtures (#7763) test(protocol): sync telemetry producer vectors --- protocol/agent/v1/fixtures/fixture-sets.json | 5 + protocol/agent/v1/fixtures/manifest.sha256 | 1 + .../v1/fixtures/telemetry/MANIFEST.sha256 | 2 + .../v1/fixtures/telemetry/accept-vectors.json | 138 ++++++++++++++++++ .../v1/fixtures/telemetry/reject-vectors.json | 28 ++++ rustfs/tests/agent_protocol_fixtures.rs | 6 +- 6 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 protocol/agent/v1/fixtures/telemetry/MANIFEST.sha256 create mode 100644 protocol/agent/v1/fixtures/telemetry/accept-vectors.json create mode 100644 protocol/agent/v1/fixtures/telemetry/reject-vectors.json diff --git a/protocol/agent/v1/fixtures/fixture-sets.json b/protocol/agent/v1/fixtures/fixture-sets.json index dd08c8a14..b141dd5da 100644 --- a/protocol/agent/v1/fixtures/fixture-sets.json +++ b/protocol/agent/v1/fixtures/fixture-sets.json @@ -48,6 +48,11 @@ "status": "populated", "purpose": "Bounded performance.siteReplication@1 aggregate results, destination-confirmation semantics, and rejection of operational secrets and unresolved target controls." }, + { + "name": "telemetry", + "status": "populated", + "purpose": "Consent-bound telemetry.record@1, telemetry.otlp@1, and telemetry.replay@1 producer results, resource limits, redaction boundaries, cancellation, and signed local exports." + }, { "name": "diagnostic-scheduler", "status": "populated", diff --git a/protocol/agent/v1/fixtures/manifest.sha256 b/protocol/agent/v1/fixtures/manifest.sha256 index 962463c9e..1ee4032da 100644 --- a/protocol/agent/v1/fixtures/manifest.sha256 +++ b/protocol/agent/v1/fixtures/manifest.sha256 @@ -6,6 +6,7 @@ cc6c3f3bf5e6a938f2e00b8ce42d8fa7bfb974f4eb2927101d4ede4ebdc10dd5 inventory 0207458ec9b97b368e2f347da112511a3aabd27d752890cacda4fa2408e7f19e object-performance a464d4c695d76dd985c0f2abf68c2135c080221098ad2427022f85243a7bf6ae network-performance 0dc06ec2caa8764a51d44e4176959462aa5d0ed9fe5a38453a681ed9d83b8ad6 site-replication-performance +fad21eec58d4d4d547893af9050cdc5eaf9d4f84b15fb423214b16be50e7ff7a telemetry 655b83debfcbb6e2d8ad1974aeb0ce2d42f42d651f97b465dd791e3697919240 diagnostic-scheduler a2557ab1f7f70fb86a8affc8451596c272478fd2d5500c367b8f9e8385d72578 offline-enrollment 8b6fd07759d1264489a8bb54d2dda4836ad0f59b5ee5d52966365918b3de4c9e bundle diff --git a/protocol/agent/v1/fixtures/telemetry/MANIFEST.sha256 b/protocol/agent/v1/fixtures/telemetry/MANIFEST.sha256 new file mode 100644 index 000000000..65d742e89 --- /dev/null +++ b/protocol/agent/v1/fixtures/telemetry/MANIFEST.sha256 @@ -0,0 +1,2 @@ +1fd1bf2b23a9db2e83ec53f4d9b90449bc7d58f9a586a0bff2dbbe057426b4b3 accept-vectors.json +18f33760811bb599b0914cb36b9a636f8f41a2558bb7e9aaec34eaaff38e0678 reject-vectors.json diff --git a/protocol/agent/v1/fixtures/telemetry/accept-vectors.json b/protocol/agent/v1/fixtures/telemetry/accept-vectors.json new file mode 100644 index 000000000..f4d02f3ef --- /dev/null +++ b/protocol/agent/v1/fixtures/telemetry/accept-vectors.json @@ -0,0 +1,138 @@ +{ + "protocolVersion": "v1", + "fixtureSet": "telemetry", + "schemaVersion": 1, + "classification": "L3", + "fixture": "accept-vectors", + "producer": { + "repository": "rustfs/rustfs", + "headCommit": "85b8dc44d7d06d17ad5f5324b0a2766889d873e5", + "mergeCommit": "f2cdca42eddd44681cd220d7b9dfdbbe91c719a1", + "pullRequest": 7720, + "evidenceUrl": "https://github.com/rustfs/rustfs/pull/7720", + "verifiedRuns": { + "record": "UNSUPPORTED_SOURCE_UNAVAILABLE", + "otlp": "REAL_BINARY_LOOPBACK_VERIFIED", + "replay": "REAL_BINARY_ARCHIVE_VERIFIED" + }, + "sourceFiles": [ + "rustfs/src/connect/diagnostics/trace_record.rs", + "rustfs/src/connect/diagnostics/trace_otlp.rs", + "rustfs/src/connect/diagnostics/trace_replay.rs", + "rustfs/src/connect/diagnostics/trace_analysis.rs" + ], + "testCommand": "cargo test -p rustfs --test connect_trace_analysis --test connect_trace_otlp --test connect_trace_record --test connect_trace_replay" + }, + "limits": { + "maxDurationMillis": 30000, + "maxSpans": 1024, + "maxResultBytes": 262144, + "maxOtlpBodyBytes": 1048576, + "maxArchiveBytes": 524288, + "maxDecompressedBytes": 278528, + "maxConcurrency": 1 + }, + "signedExport": { + "members": ["envelope.json", "envelope.sig", "result.json"], + "algorithm": "ES256", + "signatureDomain": "rustfs-diagnostic-envelope-v1\u0000", + "fileMode": "0600", + "noClobber": true, + "classification": "L3", + "requiresConfirmedConsent": true + }, + "vectors": [ + { + "id": "telemetry.record.source-unavailable", + "evidenceType": "SOURCE_VERIFIED_CONTRACT_VECTOR", + "accepted": true, + "value": { + "schemaVersion": 1, + "runUid": "019e3ae0-0000-7000-8000-000000000001", + "toolId": "telemetry.record", + "capability": "telemetry.record@1", + "outcome": "UNSUPPORTED", + "reasonCode": "UNSUPPORTED_TOOL", + "durationMillis": 1, + "provenance": { + "repository": "rustfs/rustfs", + "sourceCommit": "85b8dc44d7d06d17ad5f5324b0a2766889d873e5", + "executableSha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "rustfsVersion": "1.0.0-rc.6", + "osFamily": "LINUX", + "architecture": "x86_64", + "buildFeatures": [] + }, + "coverage": {"requestedUnits": 1, "completedUnits": 0, "unit": "WINDOW"}, + "data": null + }, + "expected": { + "artifactCreated": false, + "reason": "The current TraceBus has no approved typed S3 or RPC source." + } + }, + { + "id": "telemetry.otlp.succeeded", + "evidenceType": "SYNTHETIC_CONTRACT_VECTOR_WITH_REAL_BINARY_RUN", + "accepted": true, + "value": { + "schemaVersion": 1, + "runUid": "019e3ae0-0000-7000-8000-000000000001", + "toolId": "telemetry.otlp", + "capability": "telemetry.otlp@1", + "outcome": "SUCCEEDED", + "reasonCode": "COMPLETE", + "durationMillis": 10, + "provenance": { + "repository": "rustfs/rustfs", + "sourceCommit": "85b8dc44d7d06d17ad5f5324b0a2766889d873e5", + "executableSha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "rustfsVersion": "1.0.0-rc.6", + "osFamily": "LINUX", + "architecture": "x86_64", + "buildFeatures": [] + }, + "coverage": {"requestedUnits": 1, "completedUnits": 1, "unit": "WINDOW"}, + "data": {"acceptedSpanCount": 2, "rejectedSpanCount": 0, "exportedBytes": 128} + }, + "expected": { + "artifactCreated": true, + "credentialsRemainLocal": true, + "receiptContainsCredentials": false + } + }, + { + "id": "telemetry.replay.succeeded", + "evidenceType": "SYNTHETIC_CONTRACT_VECTOR_WITH_REAL_BINARY_RUN", + "accepted": true, + "value": { + "schemaVersion": 1, + "runUid": "019e3ae0-0000-7000-8000-000000000001", + "toolId": "telemetry.replay", + "capability": "telemetry.replay@1", + "outcome": "SUCCEEDED", + "reasonCode": "COMPLETE", + "durationMillis": 1, + "provenance": { + "repository": "rustfs/rustfs", + "sourceCommit": "85b8dc44d7d06d17ad5f5324b0a2766889d873e5", + "executableSha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "rustfsVersion": "1.0.0-rc.6", + "osFamily": "LINUX", + "architecture": "x86_64", + "buildFeatures": [] + }, + "coverage": {"requestedUnits": 1, "completedUnits": 1, "unit": "WINDOW"}, + "data": { + "inputArtifactSha256": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", + "spans": [{"operation": "GET_OBJECT", "durationMicros": 500, "status": "OK"}] + } + }, + "expected": { + "artifactCreated": true, + "inputWasLocallyReviewed": true, + "analysisUsesObservedValuesOnly": true + } + } + ] +} diff --git a/protocol/agent/v1/fixtures/telemetry/reject-vectors.json b/protocol/agent/v1/fixtures/telemetry/reject-vectors.json new file mode 100644 index 000000000..718011117 --- /dev/null +++ b/protocol/agent/v1/fixtures/telemetry/reject-vectors.json @@ -0,0 +1,28 @@ +{ + "protocolVersion": "v1", + "fixtureSet": "telemetry", + "schemaVersion": 1, + "classification": "L3", + "fixture": "reject-vectors", + "vectors": [ + {"id": "telemetry.consent.missing", "stage": "REQUEST", "input": {"acknowledgeL3": false}, "expected": {"accepted": false, "reason": "CONSENT_REQUIRED", "artifactCreated": false}}, + {"id": "telemetry.consent.expired", "stage": "REQUEST", "input": {"consentExpiresAt": "2026-09-11T23:59:59Z", "producedAt": "2026-09-12T00:00:00Z"}, "expected": {"accepted": false, "reason": "CONSENT_EXPIRED", "artifactCreated": false}}, + {"id": "telemetry.record.duration-zero", "stage": "REQUEST", "input": {"durationMillis": 0, "maxSpans": 1}, "expected": {"accepted": false, "reason": "INVALID_DURATION", "artifactCreated": false}}, + {"id": "telemetry.record.duration-over-limit", "stage": "REQUEST", "input": {"durationMillis": 30001, "maxSpans": 1}, "expected": {"accepted": false, "reason": "INVALID_DURATION", "artifactCreated": false}}, + {"id": "telemetry.record.spans-zero", "stage": "REQUEST", "input": {"durationMillis": 1, "maxSpans": 0}, "expected": {"accepted": false, "reason": "INVALID_SPAN_LIMIT", "artifactCreated": false}}, + {"id": "telemetry.record.spans-over-limit", "stage": "REQUEST", "input": {"durationMillis": 1, "maxSpans": 1025}, "expected": {"accepted": false, "reason": "INVALID_SPAN_LIMIT", "artifactCreated": false}}, + {"id": "telemetry.record.stopped", "stage": "CAPTURE", "input": {"cancelled": true}, "expected": {"accepted": false, "reason": "CANCELLED", "artifactCreated": false}}, + {"id": "telemetry.record.source-unavailable-with-data", "stage": "RESULT", "input": {"outcome": "UNSUPPORTED", "reasonCode": "UNSUPPORTED_TOOL", "data": {"spans": [], "droppedSpanCount": 0}}, "expected": {"accepted": false, "reason": "INVALID_OUTCOME_DATA", "artifactCreated": false}}, + {"id": "telemetry.record.header-field", "stage": "RESULT", "input": {"data": {"spans": [{"operation": "GET_OBJECT", "durationMicros": 1, "status": "OK", "authorization": "SYNTHETIC_FORBIDDEN_SECRET"}], "droppedSpanCount": 0}}, "expected": {"accepted": false, "reason": "UNKNOWN_FIELD", "artifactCreated": false}}, + {"id": "telemetry.record.customer-name-field", "stage": "RESULT", "input": {"data": {"spans": [{"operation": "GET_OBJECT", "durationMicros": 1, "status": "OK", "objectName": "SYNTHETIC_FORBIDDEN_OBJECT"}], "droppedSpanCount": 0}}, "expected": {"accepted": false, "reason": "UNKNOWN_FIELD", "artifactCreated": false}}, + {"id": "telemetry.otlp.remote-plaintext", "stage": "REQUEST", "input": {"endpoint": "http://collector.example/v1/traces"}, "expected": {"accepted": false, "reason": "INVALID_ENDPOINT", "artifactCreated": false}}, + {"id": "telemetry.otlp.body-over-limit", "stage": "REQUEST", "input": {"bodySizeBytes": 1048577}, "expected": {"accepted": false, "reason": "INVALID_BATCH", "artifactCreated": false}}, + {"id": "telemetry.otlp.credential-in-receipt", "stage": "RESULT", "input": {"data": {"acceptedSpanCount": 1, "rejectedSpanCount": 0, "exportedBytes": 128, "authorization": "SYNTHETIC_FORBIDDEN_SECRET"}}, "expected": {"accepted": false, "reason": "UNKNOWN_FIELD", "artifactCreated": false}}, + {"id": "telemetry.replay.unreviewed", "stage": "REQUEST", "input": {"locallyReviewed": false}, "expected": {"accepted": false, "reason": "INVALID_INPUT", "artifactCreated": false}}, + {"id": "telemetry.replay.input-over-limit", "stage": "REQUEST", "input": {"inputSizeBytes": 262145}, "expected": {"accepted": false, "reason": "INVALID_INPUT", "artifactCreated": false}}, + {"id": "telemetry.export.unsigned", "stage": "EXPORT", "input": {"members": ["envelope.json", "result.json"]}, "expected": {"accepted": false, "reason": "SIGNATURE_REQUIRED", "artifactCreated": false}}, + {"id": "telemetry.export.tampered", "stage": "EXPORT", "input": {"payloadDigestMatches": false}, "expected": {"accepted": false, "reason": "DIGEST_MISMATCH", "artifactCreated": false}}, + {"id": "telemetry.export.archive-over-limit", "stage": "EXPORT", "input": {"archiveSizeBytes": 524289}, "expected": {"accepted": false, "reason": "LIMIT_EXCEEDED", "artifactCreated": false}}, + {"id": "telemetry.export.existing-output", "stage": "EXPORT", "input": {"outputExists": true}, "expected": {"accepted": false, "reason": "ALREADY_EXISTS", "artifactCreated": false}} + ] +} diff --git a/rustfs/tests/agent_protocol_fixtures.rs b/rustfs/tests/agent_protocol_fixtures.rs index 679258042..0cee61d08 100644 --- a/rustfs/tests/agent_protocol_fixtures.rs +++ b/rustfs/tests/agent_protocol_fixtures.rs @@ -36,13 +36,17 @@ fn sha256_hex(bytes: &[u8]) -> String { /// The registry is closed; adding another set is a protocol change, not a /// fixture change. Mirrors `EXPECTED_SETS` in Connect's checker. -const EXPECTED_SETS: [&str; 9] = [ +const EXPECTED_SETS: [&str; 13] = [ "auth", "version", "registration", "heartbeat", "inventory", "object-performance", + "network-performance", + "site-replication-performance", + "telemetry", + "diagnostic-scheduler", "offline-enrollment", "bundle", "redaction",