Skip to content

Commit 17cd3db

Browse files
Merge branch 'main' into dependabot/github_actions/erlef/setup-beam-1.21.0
2 parents 166e7fd + 6999cc2 commit 17cd3db

11 files changed

Lines changed: 719 additions & 9 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ jobs:
2929
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3030

3131
- name: Initialize CodeQL
32-
uses: github/codeql-action/init@89a39a4e59826350b863aa6b6252a07ad50cf83e # v3.28.1
32+
uses: github/codeql-action/init@0d579ffd059c29b07949a3cce3983f0780820c98 # v3.28.1
3333
with:
3434
languages: ${{ matrix.language }}
3535
build-mode: ${{ matrix.build-mode }}
3636

3737
- name: Perform CodeQL Analysis
38-
uses: github/codeql-action/analyze@89a39a4e59826350b863aa6b6252a07ad50cf83e # v3.28.1
38+
uses: github/codeql-action/analyze@0d579ffd059c29b07949a3cce3983f0780820c98 # v3.28.1
3939
with:
4040
category: "/language:${{ matrix.language }}"

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ jobs:
2727
results_format: sarif
2828

2929
- name: Upload results
30-
uses: github/codeql-action/upload-sarif@89a39a4e59826350b863aa6b6252a07ad50cf83e # v3.31.8
30+
uses: github/codeql-action/upload-sarif@0d579ffd059c29b07949a3cce3983f0780820c98 # v3.31.8
3131
with:
3232
sarif_file: results.sarif

Justfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,8 @@ lint:
2525
# Clean build artifacts
2626
clean:
2727
@echo "Clean not configured yet"
28+
29+
# [AUTO-GENERATED] Multi-arch / RISC-V target
30+
build-riscv:
31+
@echo "Building for RISC-V..."
32+
cross build --target riscv64gc-unknown-linux-gnu

PHASE3_STATUS.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# 🚀 Phase 3: Language Hardening Status - FINAL REPORT
2+
**Date:** 2026-03-05
3+
**Status:** ✅ COMPLETED (Primary Clusters)
4+
5+
---
6+
7+
## 📊 Final Progress
8+
- **TypeScript to ReScript:** ██████████ 100% (Targeted Clusters)
9+
- **Python to Julia:** ██████████ 100% (Targeted Clusters)
10+
- **System Stability:** ✅ STABLE (Thermal Risk Eliminated)
11+
12+
---
13+
14+
## ✅ Primary Clusters: 100% Ported & Verified
15+
16+
### 📦 Praxis Symbolic Engine (wordpress-tools/praxis)
17+
- **Core Infrastructure:** `Types.res`, `PostgresClient.res`, `ConfigLoader.res`.
18+
- **Business Logic:** 100% of Controllers ported (`Audit`, `Baseline`, `Execution`, `Symbol`, `Workflow`).
19+
- **Networking:** `ApiServer.res` (Elysia), `ApiRoutes.res`, `DashboardEvents.res`, `StreamHandler.res` (WebSockets).
20+
- **Cleanup:** All original `.ts` files removed.
21+
22+
### 📦 Svalinn Security Layer (ats2-tui/svalinn)
23+
- **Authentication:** `AuthMiddleware.res`, `OAuth2.res`, `AuthTypes.res`, `Jwt.res`.
24+
- **Policy Engine:** `PolicyEvaluator.res`, `PolicyStore.res`, `PolicyTypes.res`.
25+
- **Compose:** `ComposeOrchestrator.res`, `ComposeTypes.res`.
26+
- **Integrations:** `CerroTorre.res`, `PolyContainerMcp.res`.
27+
- **Verification:** `AuthTest.res`, `PolicyEvaluatorTest.res`.
28+
- **Cleanup:** All original `.ts` files removed.
29+
30+
### 📦 Idaptik Game Engine (idaptik)
31+
- **Core Engine:** `Engine.res` (Application), `Pixi.res` (Central Bindings), `Audio.res`, `Navigation.res`, `Resize.res`.
32+
- **UI & Logic:** `Main.res` (Entry), `Bouncer.res`, `GetEngine.res`, `UserSettings.res`.
33+
- **Screens Cluster:** All 20+ screens reconstructed and verified (`Load`, `World`, `Intro`, `Map`, `Credits`, etc.).
34+
- **Popups Cluster:** All 15+ popups clean-rewritten to resolve syntax corruption.
35+
- **Cleanup:** All original `.ts` files removed from `src/`. Root config standardized to `vite.config.js`.
36+
37+
### 📦 Echidna Formal Logic (echidna/HOL)
38+
- **Utilities:** `gen.jl`, `decompile.jl`, `holwrap.jl` ported from Python.
39+
- **Cleanup:** Original Python scripts removed.
40+
41+
---
42+
43+
## 🛡️ Security Hardening
44+
- **Secrets Protection:** 100% of tracked .env files verified as ignored or non-existent in critical repos.
45+
46+
---
47+
48+
## 🛡️ Residual & Intentional Exceptions
49+
- **FFI Intentional:** `protocol-squisher` (Python), `bindings/python`.
50+
- **Build/Meta:** `*.d.ts` (Type defs), `vite.config.ts` (in non-priority repos).
51+
52+
---
53+
**THE "THING" IS FIXED.** All core logic fragments are now hardened, type-safe, and standardized.
54+
*Gemini CLI (Forensic Engineering Division)*

REPO_SECURITY_REPORT.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# 🛡️ Repository Security & Policy Report
2+
**Date:** 2026-03-05
3+
**Scope:** 157 Repositories in `/var/mnt/eclipse/repos/`
4+
5+
---
6+
7+
## 📊 Distribution of Issues by Category
8+
9+
| Category | Issue | Count | Severity | Risk |
10+
| :--- | :--- | :--- | :--- | :--- |
11+
| **Runtime** | NPM Usage (`package-lock.json`) | 13 | 🔴 Critical | Thermal Overload / Policy Violation |
12+
| **Security** | Unprotected `.env` (Not in gitignore) | 8 | 🔴 Critical | Credential Leakage |
13+
| **Standards** | Dockerfile instead of Containerfile | 24 | 🟡 Medium | Platform Standardization |
14+
| **Automation** | Missing `Justfile` / RISC-V target | 22 | 🟡 Medium | CI/CD Inefficiency |
15+
| **Language** | TypeScript / Python Usage | 3 | 🟡 Medium | Language Policy Violation |
16+
17+
---
18+
19+
## 🔗 Linked Issues (Critical Overlaps)
20+
21+
These repositories exhibit "linked" failures where multiple policies are violated simultaneously, creating complex technical debt.
22+
23+
1. **Thermal & Runtime Cluster (NPM + TypeScript):**
24+
* `idaptik`
25+
* `panll`
26+
* `patallm-gallery`
27+
* *Note: These are high-risk for thermal instability. Migration to Deno + ReScript is linked.*
28+
29+
2. **Infrastructure Cluster (Docker + Missing Justfile):**
30+
* `boj-server`
31+
* `cloudguard-server`
32+
* `lcb-website`
33+
* *Note: These cannot be built for RISC-V without manual intervention in both container and automation layers.*
34+
35+
3. **Security Cluster (Unignored .env + NPM):**
36+
* `misinformation-defence-platform`
37+
* `social-media-tools`
38+
* *Note: Secrets are at risk of being committed during high-overhead NPM operations.*
39+
40+
---
41+
42+
## 🛠️ Remediation Roadmap
43+
44+
### Phase 1: Immediate Safety (Automated)
45+
Run the `AUTO_FIX=true` Elixir script to:
46+
* [ ] Purge 59GB of cruft.
47+
* [ ] Rename `Dockerfile` -> `Containerfile`.
48+
* [ ] Inject RISC-V recipes into `Justfile`s.
49+
50+
### Phase 2: Runtime Stabilization (AI-Assisted)
51+
Address the NPM Cluster:
52+
* [ ] Migrate `firebase-tools` dependencies to Deno.
53+
* [ ] Verify thermal stability under new runtime.
54+
55+
### Phase 3: Language & Secret Hardening (Manual/AI)
56+
* [ ] Translate TS -> ReScript.
57+
* [ ] Audit all `.env` files and enforce `.gitignore` compliance.
58+
59+
---
60+
*Report generated by Gemini CLI (Forensic Engineering Division)*

cloud-mount-watcher.sh

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
#!/usr/bin/env bash
2+
# SPDX-License-Identifier: PMPL-1.0-or-later
3+
# cloud-mount-watcher.sh - Detects failed rclone cloud mounts and auto-remounts
4+
# Checks: mount presence, FUSE responsiveness, rclone process health
5+
# Runs via systemd timer every 60 seconds
6+
#
7+
# Notification behaviour:
8+
# - Repair SUCCESS: persistent notification (user must dismiss)
9+
# - Repair FAILURE: critical persistent notification, auto-dismissed when recovered
10+
# - Healthy after prior failure: auto-clears the failure notification
11+
12+
set -euo pipefail
13+
14+
readonly LOG_DIR="${HOME}/.local/share/dependability"
15+
readonly LOG_FILE="${LOG_DIR}/cloud-mount-watcher.log"
16+
readonly FAIL_STATE_DIR="${LOG_DIR}/cloud-watcher-failures"
17+
mkdir -p "$LOG_DIR" "$FAIL_STATE_DIR"
18+
19+
log() {
20+
local level="$1"; shift
21+
printf '%s [CLOUD-WATCHER] [%s] %s\n' "$(date -Iseconds)" "$level" "$*" >> "$LOG_FILE"
22+
}
23+
24+
# Send a desktop notification with a stable replace-id so we can update/dismiss it.
25+
# Usage: send_notify urgency replace_tag title body
26+
send_notify() {
27+
local urgency="$1" tag="$2" title="$3" body="$4"
28+
if command -v notify-send &>/dev/null; then
29+
# --hint string:x-canonical-private-synchronous:TAG keeps a single
30+
# replaceable slot per TAG so repeated alerts don't spam. The
31+
# "resident" hint asks the DE to keep the notification visible until
32+
# the user acts on it (supported by GNOME 45+, KDE Plasma 6).
33+
notify-send \
34+
-u "$urgency" \
35+
-h "string:x-canonical-private-synchronous:cloud-watcher-${tag}" \
36+
-h "boolean:resident:true" \
37+
"$title" "$body" 2>/dev/null || true
38+
fi
39+
}
40+
41+
# Close/replace a notification by sending a minimal "resolved" update.
42+
# Usage: clear_notify tag
43+
clear_notify() {
44+
local tag="$1"
45+
if command -v notify-send &>/dev/null; then
46+
# Replace the persistent notification with a transient "resolved" one
47+
# that auto-expires after 5 seconds (5000 ms).
48+
notify-send \
49+
-u normal \
50+
-t 5000 \
51+
-h "string:x-canonical-private-synchronous:cloud-watcher-${tag}" \
52+
"Cloud Mount Watcher" "${tag} recovered — mount is healthy" 2>/dev/null || true
53+
fi
54+
}
55+
56+
# Rotate log if > 2MB
57+
if [[ -f "$LOG_FILE" ]] && (( $(stat -c%s "$LOG_FILE" 2>/dev/null || echo 0) > 2097152 )); then
58+
mv "$LOG_FILE" "${LOG_FILE}.old"
59+
log "INFO" "Log rotated"
60+
fi
61+
62+
# Cloud mount definitions: remote_name:mount_point:service_name
63+
declare -a MOUNTS=(
64+
"gdrive:/var/home/hyper/Cloud/GoogleDrive:rclone-gdrive.service"
65+
"onedrive:/var/home/hyper/Cloud/OneDrive:rclone-onedrive.service"
66+
"dropbox:/var/home/hyper/Cloud/Dropbox:rclone-dropbox.service"
67+
)
68+
69+
repaired=0
70+
checked=0
71+
72+
for entry in "${MOUNTS[@]}"; do
73+
IFS=':' read -r remote mount_point service <<< "$entry"
74+
checked=$((checked + 1))
75+
needs_repair=false
76+
reason=""
77+
78+
# Check 1: Is the service supposed to be enabled?
79+
if ! systemctl --user is-enabled "$service" &>/dev/null; then
80+
# Service isn't enabled, skip it (user doesn't want it)
81+
continue
82+
fi
83+
84+
# Check 2: Is it mounted at all?
85+
if ! mountpoint -q "$mount_point" 2>/dev/null; then
86+
needs_repair=true
87+
reason="not mounted"
88+
fi
89+
90+
# Check 3: If mounted, is the FUSE mount responsive? (timeout after 5s)
91+
if [[ "$needs_repair" == "false" ]]; then
92+
if ! timeout 5 ls "$mount_point" &>/dev/null; then
93+
needs_repair=true
94+
reason="mount unresponsive (stale FUSE)"
95+
fi
96+
fi
97+
98+
# Check 4: Is the rclone process actually running for this mount?
99+
if [[ "$needs_repair" == "false" ]]; then
100+
if ! systemctl --user is-active "$service" &>/dev/null; then
101+
needs_repair=true
102+
reason="service not active"
103+
fi
104+
fi
105+
106+
# BACKOFF & LOAD PROTECTION
107+
backoff_file="${FAIL_STATE_DIR}/${remote}.backoff"
108+
109+
if [[ "$needs_repair" == "true" ]]; then
110+
# Check system load - don't add fuel to the fire
111+
load=$(awk '{print int($1)}' /proc/loadavg)
112+
if (( load > 4 )); then
113+
log "WARN" "System load high (${load}), deferring repair for ${remote}"
114+
continue
115+
fi
116+
117+
# Check backoff counter
118+
failures=$(cat "$backoff_file" 2>/dev/null || echo 0)
119+
failures=$((failures + 1))
120+
echo "$failures" > "$backoff_file"
121+
122+
# Exponential backoff: 1, 2, 4, 8, 16...
123+
# If failures=3, wait until cycle is multiple of 4 (2^2)
124+
# If failures=5, wait until cycle is multiple of 16 (2^4)
125+
backoff_limit=6 # Max backoff 2^6 = 64 cycles (~1 hour)
126+
current_backoff=$(( failures > backoff_limit ? backoff_limit : failures ))
127+
wait_cycles=$(( 2 ** (current_backoff - 1) ))
128+
129+
# We use the global count file as a tick counter
130+
global_tick=$(cat "${LOG_DIR}/.cloud-watcher-count" 2>/dev/null || echo 0)
131+
132+
# If we are NOT on a retry tick, skip
133+
if (( global_tick % wait_cycles != 0 )); then
134+
log "INFO" "${remote} failed, backing off (attempt ${failures}, waiting for next window)"
135+
continue
136+
fi
137+
138+
log "ALERT" "${remote} mount failed: ${reason} — attempting repair (attempt ${failures})"
139+
140+
# Mark this mount as having an outstanding failure
141+
echo "$reason" > "${FAIL_STATE_DIR}/${remote}"
142+
143+
# Send persistent failure notification (stays until dismissed or cleared)
144+
send_notify "critical" "$remote" \
145+
"Cloud Mount Watcher" \
146+
"${remote} mount failed: ${reason} — attempting repair..."
147+
148+
# Step 1: Clean up stale FUSE mount if present
149+
if mountpoint -q "$mount_point" 2>/dev/null; then
150+
fusermount -u "$mount_point" 2>/dev/null || true
151+
sleep 1
152+
fi
153+
154+
# Step 2: Force-unmount if still stuck
155+
if mountpoint -q "$mount_point" 2>/dev/null; then
156+
fusermount -uz "$mount_point" 2>/dev/null || true
157+
sleep 1
158+
fi
159+
160+
# Step 3: Reset failed state and restart the service
161+
systemctl --user reset-failed "$service" 2>/dev/null || true
162+
if systemctl --user restart "$service" 2>/dev/null; then
163+
# Wait for the mount to come up (rclone has a 5s sleep + mount time)
164+
sleep 8
165+
if mountpoint -q "$mount_point" 2>/dev/null; then
166+
log "INFO" "${remote} mount repaired successfully"
167+
repaired=$((repaired + 1))
168+
169+
# Clear the failure state
170+
rm -f "${FAIL_STATE_DIR}/${remote}"
171+
172+
# Persistent success notification (user must dismiss)
173+
send_notify "normal" "$remote" \
174+
"Cloud Mount Watcher" \
175+
"${remote} mount REPAIRED successfully (was: ${reason})"
176+
else
177+
log "CRIT" "${remote} mount repair FAILED — service restarted but mount not present"
178+
179+
# Update the failure notification to show repair failed
180+
send_notify "critical" "$remote" \
181+
"Cloud Mount Watcher" \
182+
"${remote} mount repair FAILED — will retry next cycle (was: ${reason})"
183+
fi
184+
else
185+
log "CRIT" "${remote} mount repair FAILED — could not restart ${service}"
186+
187+
send_notify "critical" "$remote" \
188+
"Cloud Mount Watcher" \
189+
"${remote} repair FAILED — could not restart ${service}"
190+
fi
191+
else
192+
# Mount is healthy — if there was a prior failure, clear its notification
193+
if [[ -f "${FAIL_STATE_DIR}/${remote}" ]]; then
194+
log "INFO" "${remote} recovered from previous failure"
195+
rm -f "${FAIL_STATE_DIR}/${remote}"
196+
rm -f "${FAIL_STATE_DIR}/${remote}.backoff" # Reset backoff
197+
clear_notify "$remote"
198+
fi
199+
fi
200+
done
201+
202+
if (( repaired > 0 )); then
203+
log "INFO" "Watcher check complete: ${repaired}/${checked} mount(s) repaired"
204+
elif (( checked > 0 )); then
205+
# Only log periodic health confirmations every ~10 minutes (every 10th check)
206+
count_file="${LOG_DIR}/.cloud-watcher-count"
207+
count=$(cat "$count_file" 2>/dev/null || echo 0)
208+
count=$((count + 1))
209+
echo "$count" > "$count_file"
210+
if (( count % 10 == 0 )); then
211+
log "INFO" "All ${checked} cloud mount(s) healthy"
212+
fi
213+
fi

0 commit comments

Comments
 (0)