Skip to content

Feat logging#181

Merged
ryansurf merged 5 commits into
mainfrom
feat-logging
Feb 11, 2026
Merged

Feat logging#181
ryansurf merged 5 commits into
mainfrom
feat-logging

Conversation

@ryansurf
Copy link
Copy Markdown
Owner

@ryansurf ryansurf commented Feb 10, 2026

General:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Code:

  1. [ x ] Does your submission pass tests?
  2. Have you run the linter/formatter on your code locally before submission?
  3. Have you updated the documentation/README to reflect your changes, as applicable?
  4. Have you added an explanation of what your changes do?
  5. Have you written new tests for your changes, as applicable?

Summary by Sourcery

Introduce optional MongoDB-backed storage and Docker-based log viewing while temporarily disabling flaky integration tests.

New Features:

  • Add optional MongoDB storage for application output when a DB URI is configured.
  • Expose live Docker container logs via a Dozzle service in the Docker Compose setup.

Build:

  • Install required system packages (including GCC and Kerberos headers) in the Docker image to support dependency builds.

Deployment:

  • Extend Docker Compose configuration with MongoDB and Dozzle services plus a persistent MongoDB volume, and make the app depend on MongoDB startup.

Documentation:

  • Add developer documentation for storage options using MongoDB and for tooling, including the Dozzle log viewer, and link them in the MkDocs navigation.

Tests:

  • Comment out several broken CLI and server integration tests with TODOs indicating they need to be fixed or mocked.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Feb 10, 2026

Reviewer's Guide

Disables several brittle integration-style tests, extends Docker and docker-compose configuration to support MongoDB and Dozzle for logging/storage, and adds developer documentation for the new tooling and storage options.

Flow diagram for logging and storage with MongoDB and Dozzle

flowchart LR
    App[CLI Surf app container] --> Stdout[STDOUT output]
    Stdout --> DockerLogs[Docker logs]
    DockerLogs --> Dozzle[Dozzle container real_time_log_viewer]

    App -->|DB_URI_set| MongoDB[mongodb_local or cloud MongoDB]

    MongoDB --> DevTools[Developer tools such as MongoDB Compass]
Loading

File-Level Changes

Change Details Files
Temporarily disable brittle CLI and server integration tests that depend on external services or unstable environment assumptions.
  • Comment out server route test that validates /help, /home, and root endpoints and add a TODO to fix the broken test.
  • Comment out helper JSON-output test that calls cli.run with live API access and annotate with a TODO suggesting API mocking.
  • Comment out CLI output test relying on live data and timing and add a TODO to fix the broken test.
tests/test_server.py
tests/test_helper.py
tests/test_cli.py
Extend docker-compose stack to include MongoDB for optional result storage and Dozzle for live Docker log viewing, with a named volume for database persistence.
  • Add mongodb service with default port mapping, restart policy, and persistent mongo_data volume.
  • Add dozzle service configured to read Docker socket and expose a web UI on port 8080.
  • Declare mongo_data named volume for MongoDB data files.
  • Configure existing app service to depend_on mongodb so it starts after the database.
compose.yaml
Update Docker image build to install system packages required by new Python dependencies (e.g., MongoDB-related or Kerberos-enabled libraries).
  • Run apt-get update and install gcc and libkrb5-dev before Python dependencies installation, then clean up apt lists to keep the image slim.
Dockerfile
Document new tooling (Dozzle) and storage backend (MongoDB) and expose them in the developer docs navigation.
  • Add Tooling page describing Dozzle usage and access URL when using Docker Compose.
  • Add Storage page describing MongoDB usage, configuration via DB_URI in .env, and viewing data via tools like MongoDB Compass.
  • Update MkDocs navigation to link the new Tooling and Storage developer documentation pages.
mkdocs.yml
docs/tooling.md
docs/storage.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 5 issues, and left some high level feedback:

  • Instead of commenting out the failing tests with TODOs, consider marking them with @pytest.mark.skip or @pytest.mark.xfail (and a clear reason) so they remain visible in the test suite while not breaking CI.
  • The Dockerfile line installing libkrb5-dev has a trailing backslash with a space (libkrb5-dev \ ), which will break the RUN command; remove the extra space or backslash to ensure the image builds correctly.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Instead of commenting out the failing tests with TODOs, consider marking them with `@pytest.mark.skip` or `@pytest.mark.xfail` (and a clear reason) so they remain visible in the test suite while not breaking CI.
- The `Dockerfile` line installing `libkrb5-dev` has a trailing backslash with a space (`libkrb5-dev \ `), which will break the `RUN` command; remove the extra space or backslash to ensure the image builds correctly.

## Individual Comments

### Comment 1
<location> `Dockerfile:14-16` </location>
<code_context>
 COPY .env.example .env

+# Install the tool the dependencies need
+RUN apt-get update && apt-get install -y \
+    gcc \
+    libkrb5-dev \ 
+    && rm -rf /var/lib/apt/lists/*
+
</code_context>

<issue_to_address>
**issue (bug_risk):** The trailing space after the backslash will break the RUN command at build time.

Because of the trailing space, the backslash escapes the space instead of the newline, so the shell sees `libkrb5-dev\` as the end of the line and the RUN command will fail to parse. Remove the trailing space (or the backslash if it’s the last package) to fix it.
</issue_to_address>

### Comment 2
<location> `compose.yaml:14-17` </location>
<code_context>
+    depends_on:
+      - mongodb
+  
+  mongodb:
+    image: mongo:latest
+    container_name: mongodb_local
+    restart: always
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Using the `latest` MongoDB tag can introduce non-deterministic behavior across environments.

Please pin MongoDB to a specific major/minor version (e.g. `mongo:7.0`) so environment behavior stays consistent when new images are published, especially when debugging version-specific issues locally.

```suggestion
  mongodb:
    image: mongo:7.0
    container_name: mongodb_local
    restart: always
```
</issue_to_address>

### Comment 3
<location> `compose.yaml:23-28` </location>
<code_context>
+    volumes:
+      - mongo_data:/data/db
+    
+  dozzle:
+    image: amir20/dozzle:latest
+    container_name: dozzle
+    restart: always
+    volumes:
+      - /var/run/docker.sock:/var/run/docker.sock
+    ports:
+      - 8080:8080
</code_context>

<issue_to_address>
**🚨 question (security):** Mounting the Docker socket into the dozzle container has security implications.

Mounting `/var/run/docker.sock` gives this container broad control over the Docker daemon (and effectively the host). If this is meant only for local/dev use, please make that explicit in the compose file or related docs and ensure it’s not used as-is in production.
</issue_to_address>

### Comment 4
<location> `docs/tooling.md:5` </location>
<code_context>
+
+## [Dozzle](https://github.com/amir20/dozzle)
+
+When using Docker Compose to spin up the app, a dozzle container is deployed. 
+This can be accessed at `http://localhost:8080/` to view live Docker logs. 
+
</code_context>

<issue_to_address>
**nitpick (typo):** Capitalize "Dozzle" for consistency with the product name and heading.

In the sentence, change “a dozzle container” to “a Dozzle container” to use the correct proper noun capitalization.

```suggestion
When using Docker Compose to spin up the app, a Dozzle container is deployed. 
```
</issue_to_address>

### Comment 5
<location> `docs/tooling.md:8` </location>
<code_context>
+When using Docker Compose to spin up the app, a dozzle container is deployed. 
+This can be accessed at `http://localhost:8080/` to view live Docker logs. 
+
+> **_NOTE:_** Dozzle logs are not persistent - nothing is stored, it is just a real-time log viewer for Docker containers
\ No newline at end of file
</code_context>

<issue_to_address>
**issue (typo):** Tighten punctuation in the NOTE sentence (comma splice and missing period).

This sentence has a comma splice ("nothing is stored, it is just...") and is missing a period. Please either split it into two sentences (e.g., "Dozzle logs are not persistent — nothing is stored. It is just a real-time log viewer for Docker containers.") or use a semicolon, and add a final period.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread Dockerfile
Comment on lines +14 to +16
RUN apt-get update && apt-get install -y \
gcc \
libkrb5-dev \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

issue (bug_risk): The trailing space after the backslash will break the RUN command at build time.

Because of the trailing space, the backslash escapes the space instead of the newline, so the shell sees libkrb5-dev\ as the end of the line and the RUN command will fail to parse. Remove the trailing space (or the backslash if it’s the last package) to fix it.

Comment thread compose.yaml
Comment on lines +14 to +17
mongodb:
image: mongo:latest
container_name: mongodb_local
restart: always
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion (bug_risk): Using the latest MongoDB tag can introduce non-deterministic behavior across environments.

Please pin MongoDB to a specific major/minor version (e.g. mongo:7.0) so environment behavior stays consistent when new images are published, especially when debugging version-specific issues locally.

Suggested change
mongodb:
image: mongo:latest
container_name: mongodb_local
restart: always
mongodb:
image: mongo:7.0
container_name: mongodb_local
restart: always

Comment thread compose.yaml
Comment on lines +23 to +28
dozzle:
image: amir20/dozzle:latest
container_name: dozzle
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚨 question (security): Mounting the Docker socket into the dozzle container has security implications.

Mounting /var/run/docker.sock gives this container broad control over the Docker daemon (and effectively the host). If this is meant only for local/dev use, please make that explicit in the compose file or related docs and ensure it’s not used as-is in production.

Comment thread docs/tooling.md Outdated
Comment thread docs/tooling.md
When using Docker Compose to spin up the app, a dozzle container is deployed.
This can be accessed at `http://localhost:8080/` to view live Docker logs.

> **_NOTE:_** Dozzle logs are not persistent - nothing is stored, it is just a real-time log viewer for Docker containers No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

issue (typo): Tighten punctuation in the NOTE sentence (comma splice and missing period).

This sentence has a comma splice ("nothing is stored, it is just...") and is missing a period. Please either split it into two sentences (e.g., "Dozzle logs are not persistent — nothing is stored. It is just a real-time log viewer for Docker containers.") or use a semicolon, and add a final period.

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
see 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@ryansurf ryansurf merged commit 2688c33 into main Feb 11, 2026
6 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant