Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .github/workflows/auto-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ jobs:
}

if (labels.size > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
labels: Array.from(labels)
});
try {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
labels: Array.from(labels)
});
} catch (error) {
core.warning('Failed to add labels: ' + error.message);
}
}
4 changes: 2 additions & 2 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
if (pr.title.length < 10) {
issues.push('❌ PR title too short (minimum 10 characters)');
}
if (!/^(feat|fix|docs|style|refactor|test|chore|perf|ci|build|revert)(\(.+\))?:/.test(pr.title)) {
issues.push(' PR title should follow conventional commits format');
if (!/^(?:⚡\s*)?(feat|fix|docs|style|refactor|test|chore|perf|ci|build|revert)(\(.+\))?:/i.test(pr.title) && !pr.title.startsWith('⚡')) {
issues.push('⚠️ PR title should follow conventional commits format');
}

if (!pr.body || pr.body.length < 20) {
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ dependencies = [
"ffmpeg-python>=0.2.0",
"qrcode[pil]>=7.0",
"opencv-python>=4.8.0",
"orjson>=3.9.0",
]

[project.optional-dependencies]
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ requests>=2.31.0

# File Handling
aiofiles>=23.2.1
orjson>=3.9.0

# Database
sqlalchemy>=2.0.0
Expand Down
24 changes: 19 additions & 5 deletions scripts/nightly_audit_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
from pathlib import Path
from typing import Dict, Any, List, Optional

try:
import orjson
HAS_ORJSON = True
except ImportError:
HAS_ORJSON = False

# Set up path to include src
import sys
import traceback
Expand Down Expand Up @@ -163,11 +169,14 @@ async def _scan_logs(self):

for log_file in files_to_scan:
try:
with open(log_file, 'r') as f:
with open(log_file, 'rb') as f:
for line in f:
try:
if not line.strip(): continue
entry = json.loads(line)
if HAS_ORJSON:
entry = orjson.loads(line)
else:
entry = json.loads(line.decode('utf-8'))

# Check timestamp
ts_str = entry.get("timestamp")
Expand Down Expand Up @@ -196,7 +205,8 @@ async def _scan_logs(self):
found_issues.append(entry)
continue

except json.JSONDecodeError:
except Exception:
# Catch any JSON decode error (both json and orjson)
Comment on lines +208 to +209
Copy link
Contributor

@vercel vercel bot Mar 8, 2026

Choose a reason for hiding this comment

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

Exception handler catches all Exception types instead of the specific json.JSONDecodeError, masking non-JSON-parsing errors like UnicodeDecodeError and other real problems

Fix on Vercel

continue
except Exception as e:
logger.error(f"Error scanning {log_file}: {e}")
Expand Down Expand Up @@ -224,8 +234,12 @@ async def _check_latency_metrics(self):
return

try:
with open(metrics_file, 'r') as f:
data = json.load(f)
with open(metrics_file, 'rb') as f:
content = f.read()
if HAS_ORJSON:
data = orjson.loads(content)
else:
data = json.loads(content.decode('utf-8'))

metrics = data.get("metrics", {})
for name, metric_data in metrics.items():
Expand Down
Loading