Skip to content
Open
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
24 changes: 14 additions & 10 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,18 @@ def build_module(
if module.name == "engine":

build_type = "Release" if release else "Debug"
cfg_result = subprocess.run(
["cmake", "-S", ".", "-B", "build",
f"-DCMAKE_BUILD_TYPE={build_type}"],
cwd=str(module.dir),
capture_output=True,
text=True,
timeout=120,
env=env,
)
try:
cfg_result = subprocess.run(
["cmake", "-S", ".", "-B", "build",
f"-DCMAKE_BUILD_TYPE={build_type}"],
cwd=str(module.dir),
capture_output=True,
text=True,
timeout=120,
env=env,
)
except FileNotFoundError as e:
return False, time.time() - start, f"Command not found: {e}"
if cfg_result.returncode != 0:
return False, time.time() - start, (
f"CMake configure failed:\n{cfg_result.stderr}")
Expand Down Expand Up @@ -659,7 +662,8 @@ def main():
print(f"\n {color('⚠ Some tools missing - will try anyway:', Colors.YELLOW)}")
for m in missing:
print(f" {m}")
print(f" {color('Not all modules will build. That\'s fine.', Colors.GRAY)}")
msg = "Not all modules will build. That's fine."
print(f" {color(msg, Colors.GRAY)}")
else:
print(f" {color('✓ All prerequisites found', Colors.GREEN)}")

Expand Down
75 changes: 75 additions & 0 deletions diagnostic/build-bf2147ac-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"generated_at": "2026-07-24T06:08:52.851100+00:00",
"commit": "bf2147ac",
"diagnostic_logd": "diagnostic/build-bf2147ac.logd",
"chunked": false,
"chunk_size_bytes": null,
"password": "154f84ee5a8e0b42050f",
"decrypt_command": "encryptly unpack diagnostic/build-bf2147ac.logd <outdir> --password 154f84ee5a8e0b42050f",
"total_modules": 10,
"passed": 3,
"failed": 7,
"modules": [
{
"name": "backend",
"status": "FAIL",
"elapsed_seconds": 0,
"artifact": null
},
{
"name": "frontend",
"status": "PASS",
"elapsed_seconds": 13.871,
"artifact": "/home/abhiram02092003/TentOfTrials/frontend/dist"
},
{
"name": "market",
"status": "PASS",
"elapsed_seconds": 0.376,
"artifact": "/home/abhiram02092003/TentOfTrials/market/market"
},
{
"name": "frailbox",
"status": "PASS",
"elapsed_seconds": 0.005,
"artifact": "/home/abhiram02092003/TentOfTrials/frailbox/frailbox"
},
{
"name": "engine",
"status": "FAIL",
"elapsed_seconds": 0.001,
"artifact": null
},
{
"name": "compliance",
"status": "FAIL",
"elapsed_seconds": 0,
"artifact": null
},
{
"name": "v2-market-stream",
"status": "FAIL",
"elapsed_seconds": 0,
"artifact": null
},
{
"name": "nfc-scanner",
"status": "FAIL",
"elapsed_seconds": 0,
"artifact": null
},
{
"name": "openapi-haskell",
"status": "FAIL",
"elapsed_seconds": 0,
"artifact": null
},
{
"name": "openapi-tools",
"status": "FAIL",
"elapsed_seconds": 0,
"artifact": null
}
],
"pr_note": "Include this metadata and diagnostic/build-bf2147ac.logd in your PR. Maintainers may ask you to remove these diagnostic artifacts before merging."
}
Binary file added diagnostic/build-bf2147ac.logd
Binary file not shown.
10 changes: 5 additions & 5 deletions tools/log_aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ def extract_level(self, line: str) -> str:
return 'unknown'

def extract_service(self, line: str) -> Optional[str]:
match = re.search(r'\[(\w+)\]', line)
match = re.search(r'\[([\w-]+)\]', line)
if match:
return match.group(1)
match = re.search(r'(\w+)\s*:', line)
if match and match.group(1).isupper():
return match.group(1)
for m in re.finditer(r'([\w-]+)\s*:', line):
if m.group(1).isupper():
return m.group(1)
return None


Expand Down Expand Up @@ -187,7 +187,7 @@ def parse(self, line: str) -> Optional[Dict[str, Any]]:
'message': match.group(5),
'fields': {
'remote_addr': match.group(1),
'remote_user': match.group(2),
'remote_user': match.group(3),
'request': match.group(5),
'status': status_code,
'body_bytes': match.group(7),
Expand Down
1 change: 1 addition & 0 deletions tools/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Independent parser fixture tests for TentOfTrials log aggregator.
7 changes: 7 additions & 0 deletions tools/tests/fixtures/json_logs.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{"timestamp":"2024-03-15T10:30:00Z","level":"INFO","service":"payment-gateway","message":"Transaction processed successfully","amount":125.50,"currency":"USD"}
{"time":"2024-03-15T10:30:01.123Z","level":"ERROR","service":"auth-service","msg":"Invalid token received","user_id":"usr-9876","ip":"192.168.1.100"}
{"@timestamp":"2024-03-15T10:30:02.456+00:00","severity":"WARN","app":"inventory-manager","event":"Low stock alert","sku":"WIDGET-001","quantity":3}
{"timestamp":"2024-03-15T10:30:03Z","level":"DEBUG","logger":"data-pipeline","message":"Batch job started","batch_id":"batch-42","records":1500}
{"timestamp":"2024-03-15T10:30:04Z","level":"CRITICAL","service":"database-proxy","message":"Connection pool exhausted","active":50,"max":50}
{"timestamp":"2024-03-15T10:30:05Z","lvl":"info","service":"order-service","message":"Order #12345 confirmed","customer":"CUST-789"}
{"timestamp":"2024-03-15T10:30:06Z","level":"ERROR","service":"notification-hub","msg":"Email delivery failed","recipient":"user@example.com","retry_count":3}
5 changes: 5 additions & 0 deletions tools/tests/fixtures/malformed_logs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
this is just a random string with no log structure at all
{bad json: no closing brace
---SYSTEM BOOT--- kernel loaded ok
[2024/03/15 10:30:00] [info] [module] message with mixed brackets
just whitespace and newlines
10 changes: 10 additions & 0 deletions tools/tests/fixtures/nginx_logs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
192.168.1.10 - - [15/Mar/2024:10:30:00 +0000] "GET /api/v1/orders HTTP/1.1" 200 1234 "https://app.example.com" "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
10.0.0.5 - admin [15/Mar/2024:10:30:01 +0000] "POST /api/v1/auth/login HTTP/1.1" 200 512 "https://app.example.com/login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)"
172.16.0.1 - - [15/Mar/2024:10:30:02 +0000] "GET /api/v1/products/9999 HTTP/1.1" 404 89 "https://app.example.com" "curl/7.68.0"
192.168.2.20 - - [15/Mar/2024:10:30:03 +0000] "DELETE /api/v1/cache/invalidate HTTP/1.1" 500 234 "https://admin.example.com" "Mozilla/5.0 (X11; Linux x86_64)"
10.0.0.5 - admin [15/Mar/2024:10:30:04 +0000] "PUT /api/v1/users/settings HTTP/1.1" 200 1024 "https://app.example.com/settings" "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0)"
192.168.3.30 - - [15/Mar/2024:10:30:05 +0000] "GET /health HTTP/1.1" 200 2 "http://localhost:8080" "kube-probe/1.28"
10.0.0.5 - - [15/Mar/2024:10:30:06 +0000] "GET /static/bundle.js HTTP/1.1" 304 0 "https://app.example.com" "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
172.16.0.100 - - [15/Mar/2024:10:30:07 +0000] "POST /api/v1/upload HTTP/1.1" 413 156 "https://app.example.com" "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
192.168.4.40 - - [15/Mar/2024:10:30:08 +0000] "CONNECT api.stripe.com:443 HTTP/1.1" 200 0 "-" "Mozilla/5.0"
10.0.0.5 - admin [15/Mar/2024:10:30:09 +0000] "GET /api/v1/admin/dashboard HTTP/1.1" 403 67 "https://admin.example.com" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)"
10 changes: 10 additions & 0 deletions tools/tests/fixtures/text_logs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
2024-03-15 10:30:00 INFO [auth-service] User login successful for user_id=usr-1234
2024-03-15 10:30:01 ERROR [database-proxy] Connection timeout after 30s connecting to db-primary-01
2024-03-15 10:30:02 WARNING [payment-gateway] Rate limit approaching: 850/1000 requests per minute
2024-03-15 10:30:03 DEBUG [data-pipeline] Processing batch batch-42 of 1500 records
2024-03-15 10:30:04 INFO [order-service] Order #ORD-9876 shipped via FedEx tracking=FX123456789
2024-03-15T10:30:05 INFO [inventory-manager] Restocked SKU=WIDGET-001 qty=500
Mar 15 10:30:06 web-server-01 CRITICAL [monitoring] Disk usage critical: 98% on /var/log
2024-03-15 10:30:07 NOTICE [auth-service] Password reset request for user_id=usr-5678
2024-03-15 10:30:08 ERROR [notification-hub] SMS delivery failed: carrier timeout
2024-03-15 10:30:09 INFO PAYMENT-SERVICE: Transaction tx-abc-123 completed successfully
139 changes: 139 additions & 0 deletions tools/tests/fixtures_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
#!/usr/bin/env python3
"""Independent parser fixture tests for TentOfTrials log aggregator.

Hand-written representative log lines covering JSON, text, and nginx
formats. Validates parser output for timestamp, level, service, and
key fields. Includes malformed/unsupported line cases.
"""
import os
import sys
import unittest

# Add parent dir so we can import log_aggregator
TOOLS_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, TOOLS_DIR)
from log_aggregator import JSONLogParser, TextLogParser, NginxLogParser

FIXTURES_DIR = os.path.join(os.path.dirname(__file__), "fixtures")

# ---------------------------------------------------------------------------
# JSON FIXTURES
# ---------------------------------------------------------------------------
JSON_FIXTURES = [
{
"line": '{"timestamp":"2024-03-15T10:30:00Z","level":"INFO","service":"payment-gateway","message":"Transaction processed successfully","amount":125.50}',
"expect": {
"format": "json",
"level": "INFO",
"service": "payment-gateway",
"ts_present": True,
"field_check": {"amount": 125.50},
},
},
{
"line": '{"time":"2024-03-15T10:30:01.123Z","level":"ERROR","service":"auth-service","msg":"Invalid token received","user_id":"usr-9876"}',
"expect": {
"format": "json",
"level": "ERROR",
"service": "auth-service",
"ts_present": True,
"field_check": {"user_id": "usr-9876"},
},
},
{
"line": '{"@timestamp":"2024-03-15T10:30:02.456+00:00","severity":"WARN","app":"inventory-manager","event":"Low stock alert","sku":"WIDGET-001"}',
"expect": {
"format": "json",
"level": "WARN",
"service": "inventory-manager",
"ts_present": True,
"field_check": {"sku": "WIDGET-001"},
},
},
{
"line": '{"timestamp":"2024-03-15T10:30:03Z","level":"DEBUG","logger":"data-pipeline","message":"Batch job started","batch_id":"batch-42"}',
"expect": {
"format": "json",
"level": "DEBUG",
"service": "data-pipeline",
"ts_present": True,
"field_check": {"batch_id": "batch-42"},
},
},
{
"line": '{"timestamp":"2024-03-15T10:30:04Z","level":"CRITICAL","service":"database-proxy","message":"Connection pool exhausted","active":50}',
"expect": {
"format": "json",
"level": "CRITICAL",
"service": "database-proxy",
"ts_present": True,
"field_check": {"active": 50},
},
},
{
"line": '{"timestamp":"2024-03-15T10:30:05Z","lvl":"info","service":"order-service","message":"Order confirmed","customer":"CUST-789"}',
"expect": {
"format": "json",
"level": "info",
"service": "order-service",
"ts_present": True,
"field_check": {"customer": "CUST-789"},
},
},
{
"line": '{"timestamp":"2024-03-15T10:30:06Z","level":"ERROR","service":"notification-hub","msg":"Email delivery failed","retry_count":3}',
"expect": {
"format": "json",
"level": "ERROR",
"service": "notification-hub",
"ts_present": True,
"field_check": {"retry_count": 3},
},
},
]

# ---------------------------------------------------------------------------
# TEXT FIXTURES
# ---------------------------------------------------------------------------
TEXT_FIXTURES = [
{
"line": "2024-03-15 10:30:00 INFO [auth-service] User login successful for user_id=usr-1234",
"expect": {"format": "text", "level": "info", "service": "auth-service", "ts_present": True},
},
{
"line": "2024-03-15 10:30:01 ERROR [database-proxy] Connection timeout after 30s",
"expect": {"format": "text", "level": "error", "service": "database-proxy", "ts_present": True},
},
{
"line": "2024-03-15 10:30:02 WARNING [payment-gateway] Rate limit approaching",
"expect": {"format": "text", "level": "warn", "service": "payment-gateway", "ts_present": True},
},
{
"line": "2024-03-15 10:30:03 DEBUG [data-pipeline] Processing batch batch-42",
"expect": {"format": "text", "level": "debug", "service": "data-pipeline", "ts_present": True},
},
{
"line": "2024-03-15 10:30:04 INFO [order-service] Order #ORD-9876 shipped",
"expect": {"format": "text", "level": "info", "service": "order-service", "ts_present": True},
},
{
"line": "2024-03-15T10:30:05 INFO [inventory-manager] Restocked SKU=WIDGET-001",
"expect": {"format": "text", "level": "info", "service": "inventory-manager", "ts_present": True},
},
{
"line": "Mar 15 10:30:06 web-server-01 CRITICAL [monitoring] Disk usage critical: 98%",
"expect": {"format": "text", "level": "error", "service": "monitoring", "ts_present": True},
},
{
"line": "2024-03-15 10:30:07 NOTICE [auth-service] Password reset request",
"expect": {"format": "text", "level": "info", "service": "auth-service", "ts_present": True},
},
{
"line": "2024-03-15 10:30:08 ERROR [notification-hub] SMS delivery failed",
"expect": {"format": "text", "level": "error", "service": "notification-hub", "ts_present": True},
},
{
"line": "2024-03-15 10:30:09 INFO PAYMENT-SERVICE: Transaction completed",
"expect": {"format": "text", "level": "info", "service": "PAYMENT-SERVICE", "ts_present": True},
},
]
Loading