From 4c76b43ee8a90c539ff86f286b8e37c51e18cef6 Mon Sep 17 00:00:00 2001 From: aitbc1 Date: Fri, 27 Mar 2026 22:33:38 +0100 Subject: [PATCH] fix: resolve poetry.lock sync issue in security scanning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit POETRY LOCK FIX: Handle out-of-sync poetry.lock files Issue Fixed: ❌ pyproject.toml changed significantly since poetry.lock was last generated ❌ poetry install --no-root failing due to lock file mismatch Solution Applied: ✅ Added poetry.lock sync check before installation ✅ Automatic poetry.lock regeneration when needed ✅ Graceful handling of lock file updates ✅ Continued dependency installation after lock sync Changes Made: 1. Lock File Check: - Added poetry check --lock validation - Conditional installation based on lock status 2. Automatic Regeneration: - poetry lock --no-update when out of sync - Followed by poetry install --no-root 3. Error Prevention: - Prevents installation failures - Maintains dependency consistency - Handles CI environment properly Impact: - Security scanning workflow now works reliably - Poetry dependency installation succeeds - No more lock file mismatch errors - Security scans complete successfully This resolves the critical issue where the security scanning workflow was failing due to poetry.lock being out of sync with pyproject.toml changes. --- .gitea/workflows/security-scanning.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/security-scanning.yml b/.gitea/workflows/security-scanning.yml index c4caa0f5..ca1db4fc 100644 --- a/.gitea/workflows/security-scanning.yml +++ b/.gitea/workflows/security-scanning.yml @@ -85,7 +85,17 @@ jobs: echo "=== PYTHON DEPENDENCIES ===" # Use poetry to install dependencies only (skip current project) echo "Installing dependencies with poetry (no-root mode)..." - $POETRY_CMD install --no-root + + # Check if poetry.lock is in sync, regenerate if needed + if $POETRY_CMD check --lock 2>/dev/null; then + echo "poetry.lock is in sync, installing dependencies..." + $POETRY_CMD install --no-root + else + echo "poetry.lock is out of sync, regenerating..." + $POETRY_CMD lock --no-update + echo "Installing dependencies with updated lock file..." + $POETRY_CMD install --no-root + fi echo "✅ Running security scan..." # Install bandit for code security only (skip Safety CLI)