Skip to content

rust tests#753

Merged
forstmeier merged 4 commits intorust-unit-tests-and-coverage-updatesfrom
rust-tests
Feb 12, 2026
Merged

rust tests#753
forstmeier merged 4 commits intorust-unit-tests-and-coverage-updatesfrom
rust-tests

Conversation

@chrisaddy
Copy link
Copy Markdown
Collaborator

@chrisaddy chrisaddy commented Feb 10, 2026

This pull request makes several improvements to the datamanager application, focusing on observability, error handling, configuration flexibility, and testability. The main changes include refactoring the server startup and observability initialization into a new startup module, simplifying error handling in DataFrame creation, allowing custom DuckDB S3 endpoints, and adding new integration tests. There are also dependency updates to improve testing capabilities.

Observability and Server Startup Refactor:

  • Moved Sentry and tracing initialization, as well as server startup logic, into a new startup module (startup.rs). This improves code organization, testability, and separation of concerns. The main entrypoint (main.rs) is now much simpler and includes tests for server startup logic. [1] [2] [3]

Error Handling Simplification:

  • Simplified error handling in DataFrame creation functions by removing custom error mapping and logging; errors now propagate naturally, reducing code duplication and improving clarity (data.rs). [1] [2] [3] [4] [5]
  • Simplified CSV response handling in the equity details endpoint, removing unnecessary error branches and panics in favor of direct error propagation (equity_details.rs).

Configuration and Flexibility:

  • Enhanced DuckDB S3 configuration to support custom S3 endpoints and SSL settings via environment variables, making local development and testing with S3-compatible services easier (storage.rs).
  • Changed the date_to_int utility to panic on parse errors, as the format is guaranteed, simplifying its usage (storage.rs). [1] [2]

Testing Improvements:

  • Added integration tests for server startup, observability initialization, and application health endpoint, including environment variable guards for safe test isolation (startup.rs, main.rs). [1] [2]
  • Updated dependencies to add testcontainers and testcontainers-modules for improved integration testing, and enabled the bundled feature for DuckDB to ease local development (Cargo.toml). [1] [2]

Dependency Updates:

  • Added testcontainers and testcontainers-modules for localstack integration in tests, and enabled the bundled feature for DuckDB to facilitate local builds (Cargo.toml). [1] [2]

These changes collectively improve the maintainability, configurability, and reliability of the datamanager service.

Copilot AI review requested due to automatic review settings February 10, 2026 08:11
@github-project-automation github-project-automation Bot moved this to To Do in Overview Feb 10, 2026
@chrisaddy chrisaddy changed the base branch from master to rust-unit-tests-and-coverage-updates February 10, 2026 08:11
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 10, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch rust-tests

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Feb 10, 2026

Greptile Overview

Greptile Summary

This PR expands Rust test coverage for applications/datamanager by adding LocalStack-backed integration tests (via testcontainers) and additional unit tests around startup, storage, handlers, and error formatting. It also tweaks DuckDB configuration to support a custom S3 endpoint (for tests/LocalStack) and updates .gitignore for coverage output.

Key areas touched:

  • applications/datamanager/src/startup.rs centralizes sentry/tracing initialization and server start, which src/main.rs now calls.
  • applications/datamanager/tests/** introduces a shared LocalStack/S3 test harness and adds end-to-end route/storage tests.
  • applications/datamanager/src/storage.rs adds env-driven DuckDB S3 endpoint configuration.

Blocking issues to address before merge are mainly around newly introduced panics in request/runtime code paths and a resource leak in the LocalStack test harness.

Confidence Score: 3/5

  • This PR is mergeable after fixing a few correctness issues that can crash the service or leak resources during tests.
  • Most changes are additive tests and small refactors, but there are two new .expect()/.unwrap() crash paths in production code (equity_details handler and date_to_int) and the LocalStack harness intentionally leaks the container, which can waste CI resources.
  • applications/datamanager/src/equity_details.rs, applications/datamanager/src/storage.rs, applications/datamanager/tests/common/mod.rs

Important Files Changed

Filename Overview
.gitignore Adds ignores for coverage/ and some local dev artifacts; no functional code changes.
Cargo.lock Updates lockfile for new/changed Rust dev dependencies (testcontainers/localstack, duckdb bundled).
applications/datamanager/Cargo.toml Adds duckdb bundled feature and introduces testcontainers dev dependencies for LocalStack-backed integration tests; review new Docker dependency in CI.
applications/datamanager/src/data.rs Simplifies DataFrame construction by relying on Polars errors directly; behavior unchanged aside from less contextual logging on failures.
applications/datamanager/src/equity_details.rs Refactors CSV response generation but introduces .expect() panics in the HTTP handler on CSV/UTF-8 errors.
applications/datamanager/src/lib.rs Exports new startup module for reuse in main/tests.
applications/datamanager/src/main.rs Moves startup logic into reusable functions and adds unit tests for exit-code mapping; overall behavior preserved.
applications/datamanager/src/startup.rs New startup module with tracing/sentry init and server runner plus tests; uses unsafe env var mutation in tests and network polling.
applications/datamanager/src/storage.rs Adds DuckDB custom S3 endpoint env support, but changes date_to_int to unwrap and can panic; otherwise query logic unchanged.
applications/datamanager/tests/common/mod.rs Adds shared test helpers with LocalStack via testcontainers; currently leaks the container with Box::leak and mutates env vars unsafely.
applications/datamanager/tests/test_data.rs Adds tracing init to existing DataFrame unit tests; no logic changes to assertions.
applications/datamanager/tests/test_errors.rs Adds basic display/formatting coverage for custom Error enum.
applications/datamanager/tests/test_handlers.rs Adds end-to-end handler tests using LocalStack + mockito; relies on Docker availability and serial env var mutation.
applications/datamanager/tests/test_state_and_health.rs Adds state/env and basic routing tests; uses unsafe env var mutation with serial execution.
applications/datamanager/tests/test_storage.rs Adds storage round-trip tests using LocalStack; includes coverage of ticker validation and default date range paths.

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

15 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

Comment thread applications/datamanager/src/storage.rs Outdated
Comment thread applications/datamanager/src/equity_details.rs Outdated
Comment thread applications/datamanager/tests/common/mod.rs
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the Rust test suite for the datamanager application (including integration tests against S3 via LocalStack), refactors server startup/observability initialization into a dedicated module, and adjusts DuckDB/S3 configuration and related dependencies to improve CI robustness.

Changes:

  • Add extensive integration tests for handlers, storage, state/env, and error formatting (with a shared LocalStack-based S3 test harness).
  • Refactor service startup concerns into startup.rs and simplify main.rs to delegate initialization and server run logic.
  • Update DuckDB/S3 configuration handling (custom endpoint/SSL via env) and dependency setup (DuckDB bundled, add testcontainers).

Reviewed changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
applications/datamanager/tests/common/mod.rs Adds shared integration-test utilities: LocalStack S3, bucket setup/cleanup, DuckDB env setup, and a spawned Axum server helper.
applications/datamanager/tests/test_storage.rs New storage-focused integration tests covering S3 read/write and DuckDB query paths.
applications/datamanager/tests/test_state_and_health.rs New tests for /health, router 404 behavior, and State::from_env behavior with env guards.
applications/datamanager/tests/test_handlers.rs New end-to-end handler tests for predictions/portfolios/equity-details/equity-bars, including error-path coverage.
applications/datamanager/tests/test_errors.rs Adds a small unit test for Error display formatting.
applications/datamanager/tests/test_data.rs Adds test tracing initialization and calls it from existing DataFrame-related tests.
applications/datamanager/src/storage.rs Updates date_to_int signature/behavior and refactors DuckDB S3 configuration to support custom endpoint/SSL via env vars.
applications/datamanager/src/startup.rs New module for Sentry/tracing initialization and server run/serve helpers (with tests).
applications/datamanager/src/main.rs Refactors binary entrypoint to use datamanager::startup and adds tests for exit-code behavior.
applications/datamanager/src/lib.rs Exposes the new startup module.
applications/datamanager/src/equity_details.rs Simplifies CSV response writing logic for equity details.
applications/datamanager/src/data.rs Simplifies error propagation in DataFrame creation/transforms by relying on ? conversions.
applications/datamanager/Cargo.toml Enables DuckDB bundled feature and adds testcontainers dependencies for LocalStack-backed tests.
Cargo.lock Updates lockfile to include new transitive dependencies (testcontainers/bollard/etc.) and version resolution changes.
.gitignore Ignores coverage output and additional local/dev artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread applications/datamanager/src/equity_details.rs Outdated
Comment thread applications/datamanager/src/storage.rs Outdated
Comment thread applications/datamanager/src/storage.rs Outdated
Comment thread applications/datamanager/tests/test_handlers.rs Outdated
Comment thread applications/datamanager/tests/test_data.rs Outdated
Comment thread applications/datamanager/tests/test_storage.rs Outdated
@github-project-automation github-project-automation Bot moved this from To Do to In Progress in Overview Feb 10, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Feb 10, 2026

Greptile Overview

Greptile Summary

This PR refactors datamanager startup/observability into a new startup module, expands DuckDB/S3 configuration for local S3-compatible endpoints, simplifies some DataFrame error propagation, and adds a substantial integration test suite (LocalStack + HTTP-level handler tests). CI is also updated to upload Rust coverage alongside Python coverage.

Key things to address before merge:

  • query_predictions_dataframe_from_s3 builds a WHERE ticker IN (...) clause by interpolating tickers without escaping/validation, which is a SQL injection vector if the ticker list is user-controlled.
  • Some new test helpers mutate process environment variables using unsafe APIs without synchronization/restoration, which can cause UB and order-dependent test flakiness under multi-threaded runtimes.
  • Tracing initialization drops the try_init() result, making initialization failures silent and hard to debug.

Confidence Score: 3/5

  • This PR has a few concrete correctness/security issues to fix before merge.
  • Most changes are straightforward refactors plus tests, but there is a clear SQL-injection bug in predictions query construction and some test/environment initialization patterns that can cause undefined behavior or flakiness (unsafe env mutation + silent tracing init failure). Fixing these should make the PR safe to merge.
  • applications/datamanager/src/storage.rs, applications/datamanager/src/startup.rs, applications/datamanager/tests/common/mod.rs

Important Files Changed

Filename Overview
.github/workflows/run_code_checks.yaml Adds Rust coverage artifact to Coveralls upload; no functional code changes.
applications/datamanager/src/startup.rs Adds centralized sentry/tracing init and server runner; issues found with ignored tracing init errors and unsafe env var mutation in tests.
applications/datamanager/src/storage.rs Adds DuckDB S3 endpoint/SSL env config; issue found where predictions ticker list is interpolated into SQL without escaping/validation.
applications/datamanager/tests/common/mod.rs Adds shared integration-test infra (LocalStack, env guards, server spawning); issue found where some env var mutations are unguarded and leak across tests (plus previously noted LocalStack leak).
applications/datamanager/tests/test_handlers.rs Adds end-to-end handler tests using LocalStack and mockito; relies on shared env setup.

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

Comment thread applications/datamanager/src/startup.rs Outdated
Comment thread applications/datamanager/src/startup.rs
Comment thread applications/datamanager/tests/common/mod.rs Outdated
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Feb 10, 2026

Additional Comments (1)

applications/datamanager/src/storage.rs
Ticker SQL injection risk

In query_predictions_dataframe_from_s3, tickers_query is built with format!("'{}'", ticker) without escaping/validation. If PredictionQuery.ticker is user-controlled (it comes from request query parsing in the predictions handler), a ticker containing ' can break out of the string literal and inject SQL into DuckDB. This is different from the equity bars query, which validates and escapes tickers. Apply the same validation/escaping here (or use parameters instead of string interpolation).

Prompt To Fix With AI
This is a comment left during a code review.
Path: applications/datamanager/src/storage.rs
Line: 417:436

Comment:
**Ticker SQL injection risk**

In `query_predictions_dataframe_from_s3`, `tickers_query` is built with `format!("'{}'", ticker)` without escaping/validation. If `PredictionQuery.ticker` is user-controlled (it comes from request query parsing in the predictions handler), a ticker containing `'` can break out of the string literal and inject SQL into DuckDB. This is different from the equity bars query, which validates and escapes tickers. Apply the same validation/escaping here (or use parameters instead of string interpolation).

How can I resolve this? If you propose a fix, please make it concise.

…handling

Implemented fixes for three review comments from greptile-apps regarding
test infrastructure and observability initialization:

1. Tracing initialization error handling (startup.rs:23-40)
   - Changed initialize_tracing() to return Result<(), Box<dyn Error>>
   - Production code (main.rs) now uses expect() to fail fast if tracing
     cannot be initialized
   - Test code properly discards Result with let _ since tests intentionally
     call initialize_tracing() twice to verify idempotency

2. Thread safety documentation for EnvironmentVariableGuard (startup.rs:74-99)
   - Added SAFETY comments explaining why unsafe env var mutation is safe
   - Tests use #[serial] to prevent concurrent execution across tests
   - Env vars are set synchronously before spawning async tasks
   - RAII guard ensures cleanup when guard goes out of scope

3. Environment variable cleanup in tests (common/mod.rs:192-201)
   - Removed set_duckdb_aws_environment() function entirely
   - Updated setup_test_bucket() to return DuckDbEnvironmentGuard
   - Modified 62 test call sites across 3 files to capture env guard
   - Eliminates code duplication and prevents test pollution

All changes maintain idiomatic Rust patterns and align with codebase
principles of finding root causes and avoiding temporary fixes.

Files modified:
- applications/datamanager/src/startup.rs (tracing init + env guard docs)
- applications/datamanager/src/main.rs (handle tracing init error)
- applications/datamanager/tests/common/mod.rs (remove duplicate function)
- applications/datamanager/tests/test_storage.rs (update 37 call sites)
- applications/datamanager/tests/test_state_and_health.rs (update 3 call sites)
- applications/datamanager/tests/test_handlers.rs (update 22 call sites)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Feb 11, 2026

Greptile Overview

Greptile Summary

This PR refactors datamanager startup/observability into a new startup module, simplifies some error propagation in DataFrame and handler code, adds configurable DuckDB S3 endpoint/SSL settings via env vars, and introduces LocalStack-backed integration tests using testcontainers.

Overall the refactor aligns server startup with more testable seams (e.g., serve_app/run_server), and the new tests expand coverage of handlers, storage, and health endpoints. Remaining merge blockers are concentrated in: (1) unsafe/test-flaky observability init being exercised from unit tests, and (2) DuckDB S3 config SQL being built via unescaped string interpolation for AWS credentials (can break config and enables SQL statement injection into DuckDB settings).

Confidence Score: 3/5

  • Reasonably safe once two correctness issues are addressed (test flakiness and DuckDB config SQL interpolation).
  • Most changes are refactors and test additions, but there is a concrete injection/breakage risk from interpolating AWS credentials into DuckDB SET statements without escaping, and at least one new unit test deterministically depends on global observability initialization behavior (order-dependent/flaky in a shared test process). Previous-thread issues (env mutation unsafety, handler panics) also still warrant fixes but were not re-commented per instructions.
  • applications/datamanager/src/storage.rs, applications/datamanager/src/main.rs (and related observability init paths)

Important Files Changed

Filename Overview
.github/workflows/run_code_checks.yaml Updates Coveralls upload to include Rust coverage XML alongside Python.
applications/datamanager/Cargo.toml Enables DuckDB bundled feature and adds testcontainers dependencies for integration tests.
applications/datamanager/src/equity_details.rs Refactors CSV response handling but introduces request-handler panics via expect/from_utf8 (already flagged in previous threads).
applications/datamanager/src/main.rs Moves observability/server startup into startup; adds tests but one async test calls real init paths and can be flaky/order-dependent.
applications/datamanager/src/startup.rs Adds startup/observability module with tests; contains env var mutation patterns and tracing init handling issues (covered in previous threads).
applications/datamanager/src/storage.rs Adds DuckDB S3 endpoint/SSL env configuration and sanitization helper; still interpolates AWS credentials into SQL without escaping, enabling breakage/injection.
applications/datamanager/tests/common/mod.rs Adds shared LocalStack + env guard helpers; includes intentional container leak and unsafe env mutation patterns (covered in previous threads).
applications/datamanager/tests/test_storage.rs Adds storage integration tests; exercises DuckDB S3 configuration paths, including new endpoint/SSL env vars.

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

17 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment thread applications/datamanager/src/main.rs
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Feb 11, 2026

Additional Comments (1)

applications/datamanager/src/storage.rs
Config injection not sanitized

DUCKDB_S3_ENDPOINT is sanitized, but the AWS credential values interpolated into the DuckDB SET statements (access_key_id, secret_access_key, and session_token) are not. Those fields can legally contain characters like ' or ; (especially session tokens), which will break the SQL batch and can allow statement injection into DuckDB configuration. You likely want to either (1) escape single quotes for all interpolated values (credentials + region), or (2) set these options via DuckDB parameters/PRAGMAs that don’t require string interpolation.

Prompt To Fix With AI
This is a comment left during a code review.
Path: applications/datamanager/src/storage.rs
Line: 152:155

Comment:
**Config injection not sanitized**

`DUCKDB_S3_ENDPOINT` is sanitized, but the AWS credential values interpolated into the DuckDB `SET` statements (`access_key_id`, `secret_access_key`, and `session_token`) are not. Those fields can legally contain characters like `'` or `;` (especially session tokens), which will break the SQL batch and can allow statement injection into DuckDB configuration. You likely want to either (1) escape single quotes for *all* interpolated values (credentials + region), or (2) set these options via DuckDB parameters/PRAGMAs that don’t require string interpolation.

How can I resolve this? If you propose a fix, please make it concise.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Feb 11, 2026

Greptile Overview

Greptile Summary

This PR primarily improves datamanager testability/observability by refactoring server startup + tracing/Sentry init into a startup module, adding LocalStack-backed integration test infrastructure (via testcontainers), and extending CI to upload Rust coverage alongside Python.

Most of the Rust-side changes are organizational, but there are a few new runtime/CI hazards introduced by the refactor and test additions (notably: a GitHub Actions workflow input that will fail, new unwrap()s in request handlers, and test env var mutations that aren’t restored).

Confidence Score: 2/5

  • Not safe to merge yet due to a CI-breaking workflow change and new runtime panics in service request paths.
  • CI will fail because actions/download-artifact@v4 is configured with an unsupported run-id input. Additionally, new unwrap() usages in request handlers and state initialization introduce process-panicking failure modes in production code paths. There is also test pollution via unguarded environment variable mutation.
  • .github/workflows/run_code_checks.yaml, applications/datamanager/src/equity_bars.rs, applications/datamanager/src/main.rs, applications/datamanager/src/state.rs, applications/datamanager/src/storage.rs

Important Files Changed

Filename Overview
.github/workflows/launch_infrastructure.yaml Adds Docker Buildx setup and removes conditional artifact download step.
.github/workflows/run_code_checks.yaml Adds rust-cache settings and Coveralls rust.xml upload, but includes an invalid input (run-id) for actions/download-artifact@v4 which will break CI.
applications/datamanager/src/equity_bars.rs Adds response header setting via .parse().unwrap(); these unwraps can panic in handler path.
applications/datamanager/src/main.rs Main delegates to startup; test mutates env vars unsafely without restoring, leaking state across tests.
applications/datamanager/src/startup.rs Introduces startup module and tests; previous threads already cover tracing init handling and env var guard unsafety.
applications/datamanager/src/state.rs State initialization uses reqwest::Client::builder().build().unwrap() which can panic during env-based initialization.
applications/datamanager/src/storage.rs Adds DuckDB S3 endpoint config and parquet serialization; uses full DataFrame clones when writing parquet, which can double memory usage on large frames.
applications/datamanager/tests/common/mod.rs Adds LocalStack + env guards; previous threads already flag intentional container leak and unsafe env mutation patterns.

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

22 files reviewed, 5 comments

Edit Code Review Agent Settings | Greptile

Comment thread applications/datamanager/src/main.rs
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Feb 11, 2026

Additional Comments (4)

.github/workflows/run_code_checks.yaml
CI fails on artifact input

actions/download-artifact@v4 doesn’t accept a run-id input; artifacts are already scoped to the current workflow run. With this in place, the step will error with an “Unexpected input” failure and block coverage upload.

          merge-multiple: true
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/run_code_checks.yaml
Line: 82:88

Comment:
**CI fails on artifact input**

`actions/download-artifact@v4` doesn’t accept a `run-id` input; artifacts are already scoped to the current workflow run. With this in place, the step will error with an “Unexpected input” failure and block coverage upload.

```suggestion
          merge-multiple: true
```

How can I resolve this? If you propose a fix, please make it concise.

applications/datamanager/src/equity_bars.rs
Unwrap can panic in handler

These .parse().unwrap() calls will panic the whole service if header parsing fails (it’s a request path, so panics crash the process). Even though the literals look safe, this is still a runtime abort in production; please avoid unwrap() in handlers.

Also appears in: applications/datamanager/src/equity_bars.rs:98, applications/datamanager/src/equity_bars.rs:104.

Prompt To Fix With AI
This is a comment left during a code review.
Path: applications/datamanager/src/equity_bars.rs
Line: 96:104

Comment:
**Unwrap can panic in handler**

These `.parse().unwrap()` calls will panic the whole service if header parsing fails (it’s a request path, so panics crash the process). Even though the literals look safe, this is still a runtime abort in production; please avoid `unwrap()` in handlers.

Also appears in: `applications/datamanager/src/equity_bars.rs:98`, `applications/datamanager/src/equity_bars.rs:104`.

How can I resolve this? If you propose a fix, please make it concise.

applications/datamanager/src/state.rs
Panic during state init

reqwest::Client::builder().build().unwrap() can panic if the client builder fails (e.g., invalid TLS backend configuration). Since this is used in State::from_env(), it can take down the service during startup rather than returning an error path.

Consider propagating the error instead of unwrapping.

Prompt To Fix With AI
This is a comment left during a code review.
Path: applications/datamanager/src/state.rs
Line: 24:27

Comment:
**Panic during state init**

`reqwest::Client::builder().build().unwrap()` can panic if the client builder fails (e.g., invalid TLS backend configuration). Since this is used in `State::from_env()`, it can take down the service during startup rather than returning an error path.

Consider propagating the error instead of unwrapping.

How can I resolve this? If you propose a fix, please make it concise.

applications/datamanager/src/storage.rs
Full DataFrame clone before parquet

writer.finish(&mut dataframe.clone()) clones the entire DataFrame just to obtain a mutable reference for serialization. For large frames this doubles memory usage and can lead to OOMs or major slowdowns on the write-to-S3 path.

Same pattern also appears in query_equity_bars_parquet_from_s3 at applications/datamanager/src/storage.rs:358-365.

Prompt To Fix With AI
This is a comment left during a code review.
Path: applications/datamanager/src/storage.rs
Line: 106:112

Comment:
**Full DataFrame clone before parquet**

`writer.finish(&mut dataframe.clone())` clones the entire DataFrame just to obtain a mutable reference for serialization. For large frames this doubles memory usage and can lead to OOMs or major slowdowns on the write-to-S3 path.

Same pattern also appears in `query_equity_bars_parquet_from_s3` at `applications/datamanager/src/storage.rs:358-365`.

How can I resolve this? If you propose a fix, please make it concise.

@forstmeier forstmeier merged commit 42d8f15 into rust-unit-tests-and-coverage-updates Feb 12, 2026
8 of 10 checks passed
@forstmeier forstmeier deleted the rust-tests branch February 12, 2026 01:23
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Overview Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants