Skip to content

Commit af403c7

Browse files
committed
feat(trogon-nats): implement Claim Check pattern for oversized payloads
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
1 parent efe6f29 commit af403c7

31 files changed

Lines changed: 1064 additions & 425 deletions

File tree

devops/docker/compose/.env.example

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
# GITHUB_STREAM_NAME=GITHUB
99
# GITHUB_STREAM_MAX_AGE_SECS=604800
1010
# GITHUB_NATS_ACK_TIMEOUT_SECS=10
11-
# GITHUB_MAX_BODY_SIZE=26214400
1211

1312
# --- GitLab Source ---
1413
# GITLAB_WEBHOOK_SECRET=
@@ -17,7 +16,6 @@
1716
# GITLAB_STREAM_NAME=GITLAB
1817
# GITLAB_STREAM_MAX_AGE_SECS=604800
1918
# GITLAB_NATS_ACK_TIMEOUT_MS=10000
20-
# GITLAB_MAX_BODY_SIZE=26214400
2119

2220
# --- Linear Source ---
2321
# LINEAR_WEBHOOK_SECRET=
@@ -57,7 +55,6 @@
5755
# SLACK_STREAM_NAME=SLACK
5856
# SLACK_STREAM_MAX_AGE_SECS=604800
5957
# SLACK_NATS_ACK_TIMEOUT_SECS=10
60-
# SLACK_MAX_BODY_SIZE=1048576
6158
# SLACK_TIMESTAMP_MAX_DRIFT_SECS=300
6259

6360
# --- Logging ---

devops/docker/compose/compose.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ services:
2929
GITHUB_STREAM_NAME: "${GITHUB_STREAM_NAME:-GITHUB}"
3030
GITHUB_STREAM_MAX_AGE_SECS: "${GITHUB_STREAM_MAX_AGE_SECS:-604800}"
3131
GITHUB_NATS_ACK_TIMEOUT_SECS: "${GITHUB_NATS_ACK_TIMEOUT_SECS:-10}"
32-
GITHUB_MAX_BODY_SIZE: "${GITHUB_MAX_BODY_SIZE:-26214400}"
3332
RUST_LOG: "${RUST_LOG:-info}"
3433
depends_on:
3534
nats:
@@ -110,7 +109,6 @@ services:
110109
GITLAB_STREAM_NAME: "${GITLAB_STREAM_NAME:-GITLAB}"
111110
GITLAB_STREAM_MAX_AGE_SECS: "${GITLAB_STREAM_MAX_AGE_SECS:-604800}"
112111
GITLAB_NATS_ACK_TIMEOUT_MS: "${GITLAB_NATS_ACK_TIMEOUT_MS:-10000}"
113-
GITLAB_MAX_BODY_SIZE: "${GITLAB_MAX_BODY_SIZE:-26214400}"
114112
RUST_LOG: "${RUST_LOG:-info}"
115113
depends_on:
116114
nats:
@@ -160,7 +158,6 @@ services:
160158
SLACK_STREAM_NAME: "${SLACK_STREAM_NAME:-SLACK}"
161159
SLACK_STREAM_MAX_AGE_SECS: "${SLACK_STREAM_MAX_AGE_SECS:-604800}"
162160
SLACK_NATS_ACK_TIMEOUT_SECS: "${SLACK_NATS_ACK_TIMEOUT_SECS:-10}"
163-
SLACK_MAX_BODY_SIZE: "${SLACK_MAX_BODY_SIZE:-1048576}"
164161
SLACK_TIMESTAMP_MAX_DRIFT_SECS: "${SLACK_TIMESTAMP_MAX_DRIFT_SECS:-300}"
165162
RUST_LOG: "${RUST_LOG:-info}"
166163
depends_on:

rsworkspace/Cargo.lock

Lines changed: 1 addition & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rsworkspace/crates/AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Errors must be typed—use structs or enums, never `String` or `format!()`. Ever
77
You must use the `test-support` feature to share test helpers between crates.
88
Prefer one trait per operation over a single trait with multiple operations.
99

10+
Production implementations of infrastructure traits must be zero-cost passthroughs to the underlying SDK. No error wrapping (use the SDK's error types directly via associated `type Error`), no return type conversion (add associated types like `type Info` to match the SDK's return), no `map_err`, no `map(|_| ())`. The impl body should be `self.sdk_field.method(args).await` — nothing else. Conversion logic (e.g. `Cursor::new`, `read_to_end`) belongs in the caller, not the passthrough.
11+
1012
For NATS infrastructure and testing, use the `trogon-nats` crate which provides:
1113
- `NatsClient` trait for testability
1214
- Connection management with auto-reconnect

rsworkspace/crates/trogon-nats/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ edition = "2024"
77
workspace = true
88

99
[dependencies]
10-
async-nats = { workspace = true, features = ["ring", "nkeys", "jetstream"] }
10+
async-nats = { workspace = true, features = ["ring", "nkeys", "jetstream", "object-store"] }
1111
bytes = { workspace = true }
1212
futures = { workspace = true }
1313
opentelemetry = { workspace = true }
1414
serde = { workspace = true }
1515
serde_json = { workspace = true }
16-
tokio = { workspace = true, features = ["time"] }
16+
tokio = { workspace = true, features = ["time", "io-util"] }
1717
tracing = { workspace = true }
1818
tracing-opentelemetry = { workspace = true }
1919
trogon-std = { workspace = true }

0 commit comments

Comments
 (0)