Skip to content

Fix Vite permissions and healthcheck logs - #166

Merged
bihius merged 3 commits into
mainfrom
feat/m1-volumes-and-smoke
Apr 26, 2026
Merged

bihius merged 3 commits into
mainfrom
feat/m1-volumes-and-smoke

Conversation

@bihius

@bihius bihius commented Apr 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Run frontend dependency installation as the node user so Vite can write its optimizer cache at runtime.
  • Filter backend uvicorn access logs for GET /health while preserving normal request logs.
  • Add unit coverage for the backend healthcheck access-log filter.

Test plan

  • uv run pytest --cov=app
  • uv run mypy app/
  • uv run ruff check app/
  • pnpm run type-check
  • pnpm run lint
  • pnpm run test
  • docker-compose -f deploy/docker/docker-compose.yml --env-file deploy/docker/.env build --no-cache frontend
  • docker-compose -f deploy/docker/docker-compose.yml --env-file deploy/docker/.env up -d --no-deps --force-recreate frontend
  • python3 HTTP check for http://127.0.0.1:3000 returned 200
  • docker-compose backend log check confirmed /health access logs are filtered while /docs still logs

Copilot AI review requested due to automatic review settings April 25, 2026 12:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adjusts the frontend container build to avoid Vite runtime write-permission issues, and reduces backend log noise by suppressing /health access logs with accompanying unit coverage.

Changes:

  • Run pnpm install as the node user in the frontend Docker image so Vite can write optimizer/cache files at runtime.
  • Add a uvicorn.access logging filter that drops access logs for /health.
  • Add unit tests covering the healthcheck access-log filter behaviour.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/frontend/Dockerfile Switches to USER node before dependency install to ensure Vite/pnpm-created files are writable at runtime.
src/backend/app/main.py Introduces and installs a uvicorn.access logging filter to suppress /health access logs.
src/backend/tests/unit/test_access_logging.py Adds unit tests verifying the access-log filter drops /health while keeping other paths.

Comment thread src/backend/app/main.py
Comment on lines +13 to +17
def filter(self, record: logging.LogRecord) -> bool:
args = record.args
if isinstance(args, tuple) and len(args) >= 3 and args[2] == "/health":
return False
return True

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

The PR description says to filter uvicorn access logs for GET /health, but the filter currently drops any request whose path is "/health" regardless of method (and status). This can hide unexpected traffic (e.g., non-GET /health returning 405) that would be useful to keep in logs. Consider checking both method (args[1] == "GET") and optionally the status code before returning False, and update the unit test(s) accordingly.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fixed in ac5a0c4. The filter now checks args[1] == "GET" and args[2] == "/health", so non-GET requests to /health (e.g. a 405) are preserved in logs. Added a test_healthcheck_access_filter_keeps_non_get_health test covering POST /health → 405.

…s filter

- Docker Compose, HAProxy, and ADR updates for M1 local dev.
- Alembic env and migration style (ruff); tests and seed script line length.
- main.py: format healthcheck log filter, only suppress GET /health.
- Ruff format on logs router and related tests.

Made-with: Cursor
@gitguardian

gitguardian Bot commented Apr 25, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
28755231 Triggered Generic CLI Secret 0af3714 src/backend/scripts/seed_admin.py View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@bihius
bihius merged commit eed2ad1 into main Apr 26, 2026
3 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.

3 participants