diff --git a/.cursor/rules/ubs.md b/.cursor/rules/ubs.md index 36a8729eb..ab3d81157 100644 --- a/.cursor/rules/ubs.md +++ b/.cursor/rules/ubs.md @@ -6,19 +6,46 @@ UBS stands for "Ultimate Bug Scanner": **The AI Coding Agent's Secret Weapon: Fl **Install:** `curl -sSL https://raw.githubusercontent.com/Dicklesworthstone/ultimate_bug_scanner/master/install.sh | bash` -**Golden Rule:** `ubs ` before every commit. Exit 0 = safe. Exit >0 = fix & re-run. +**Golden Rule:** `ubs --only= ` before every commit. Exit 0 = safe. Exit >0 = fix & re-run. +Always specify language with `--only` to avoid false positives from cross-language scanning. + +**Why --only is Critical:** +UBS auto-detects all 8 languages (js, python, cpp, rust, golang, java, ruby, swift) and scans every file with every scanner. Without `--only`: +- Python scanner reports "invalid-syntax" errors on Rust files +- JavaScript scanner flags "loose equality" in Rust code (false critical) +- Wasted time (8x slower) scanning files with wrong language parsers + +**Always specify target language to avoid noise and false positives.** **Commands:** ```bash -ubs file.ts file2.py # Specific files (< 1s) — USE THIS -ubs $(git diff --name-only --cached) # Staged files — before commit -ubs --only=js,python src/ # Language filter (3-5x faster) -ubs --ci --fail-on-warning . # CI mode — before PR -ubs --help # Full command reference -ubs sessions --entries 1 # Tail the latest install session log -ubs . # Whole project (ignores things like .venv and node_modules automatically) +# Language-specific scanning (RECOMMENDED) +ubs --only=rust crates/terraphim_automata/src/lib.rs # Rust files only +ubs --only=python test_*.py # Python files only +ubs --only=js desktop/src/lib/*.ts # JavaScript/TypeScript files only +ubs --only=js,python src/ # Multiple languages + +# General commands +ubs file.ts file2.py # Specific files (use --only instead) +ubs $(git diff --name-only --cached) # Staged files — before commit +ubs --ci --fail-on-warning . # CI mode — before PR +ubs --help # Full command reference +ubs sessions --entries 1 # Tail the latest install session log +ubs . # Whole project (slow, avoid) ``` +**Language Flags Quick Reference:** +| Flag | File Extensions | Use For | +|------|----------------|---------| +| `--only=rust` | .rs | Rust source files | +| `--only=python` | .py, .pyi | Python scripts and tests | +| `--only=js` | .js, .ts, .jsx, .tsx | JavaScript/TypeScript files | +| `--only=cpp` | .c, .cpp, .h, .hpp | C/C++ files | +| `--only=golang` | .go | Go source files | +| `--only=java` | .java | Java source files | +| `--only=ruby` | .rb | Ruby scripts | +| `--only=swift` | .swift | Swift source files | + **Output Format:** ``` ⚠️ Category (N errors) @@ -47,4 +74,5 @@ Parse: `file:line:col` → location | 💡 → how to fix | Exit 0/1 → pass/fa - ❌ Ignore findings → ✅ Investigate each - ❌ Full scan per edit → ✅ Scope to file - ❌ Fix symptom (`if (x) { x.y }`) → ✅ Root cause (`x?.y`) +- ❌ Scan without `--only` → ✅ Always specify target language ```` diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index f563945c6..186d6dcfc 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -37,6 +37,9 @@ jobs: name: Build Documentation runs-on: [self-hosted, linux, x64] steps: + - name: Pre-checkout cleanup + run: | + sudo rm -rf "${{ github.workspace }}/target" "${{ github.workspace }}/desktop/dist" "${{ github.workspace }}/desktop/node_modules" "${{ github.workspace }}/terraphim_server/dist" 2>/dev/null || true - name: Checkout repository uses: actions/checkout@v6 diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.yml index 964869cd4..92ada2513 100644 --- a/.github/workflows/deploy-website.yml +++ b/.github/workflows/deploy-website.yml @@ -11,6 +11,7 @@ on: jobs: deploy: + if: github.event_name != 'pull_request' runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/python-bindings.yml b/.github/workflows/python-bindings.yml index 85f201183..1ba5c789f 100644 --- a/.github/workflows/python-bindings.yml +++ b/.github/workflows/python-bindings.yml @@ -27,6 +27,9 @@ jobs: name: Lint Python Code runs-on: [self-hosted, linux, x64] steps: + - name: Pre-checkout cleanup + run: | + sudo rm -rf "${{ github.workspace }}/target" "${{ github.workspace }}/desktop/dist" "${{ github.workspace }}/desktop/node_modules" "${{ github.workspace }}/terraphim_server/dist" 2>/dev/null || true - uses: actions/checkout@v6 - name: Set up Python diff --git a/Cargo.lock b/Cargo.lock index 74162b984..4cc9776aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2325,18 +2325,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" -[[package]] -name = "enum-as-inner" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" -dependencies = [ - "heck 0.5.0", - "proc-macro2", - "quote", - "syn 2.0.114", -] - [[package]] name = "enumflags2" version = "0.7.12" @@ -3993,16 +3981,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "1.1.0" @@ -4177,18 +4155,6 @@ dependencies = [ "rustversion", ] -[[package]] -name = "ipconfig" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" -dependencies = [ - "socket2 0.5.10", - "widestring", - "windows-sys 0.48.0", - "winreg 0.50.0", -] - [[package]] name = "ipnet" version = "2.11.0" @@ -4622,12 +4588,6 @@ dependencies = [ "bitflags 2.10.0", ] -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - [[package]] name = "linux-raw-sys" version = "0.11.0" @@ -4694,15 +4654,6 @@ dependencies = [ "hashbrown 0.16.1", ] -[[package]] -name = "lru-cache" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" -dependencies = [ - "linked-hash-map", -] - [[package]] name = "lru-slab" version = "0.1.2" @@ -7283,12 +7234,6 @@ dependencies = [ "thiserror 2.0.17", ] -[[package]] -name = "resolv-conf" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e061d1b48cb8d38042de4ae0a7a6401009d6143dc80d2e2d6f31f0bdd6470c7" - [[package]] name = "rfc6979" version = "0.4.0" @@ -10275,37 +10220,6 @@ dependencies = [ "zstd", ] -[[package]] -name = "terraphim_rlm" -version = "1.6.0" -dependencies = [ - "anyhow", - "async-trait", - "bollard", - "dashmap", - "futures", - "hyper 1.8.1", - "hyper-util", - "jiff 0.2.16", - "log", - "parking_lot 0.12.5", - "reqwest 0.12.28", - "serde", - "serde_json", - "tempfile", - "terraphim-firecracker", - "terraphim_agent_supervisor", - "terraphim_automata", - "terraphim_service", - "test-log", - "thiserror 1.0.69", - "tokio", - "tokio-test", - "tokio-util", - "trust-dns-resolver", - "ulid", -] - [[package]] name = "terraphim_rolegraph" version = "1.4.10" @@ -11155,52 +11069,6 @@ dependencies = [ "tracing-log", ] -[[package]] -name = "trust-dns-proto" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3119112651c157f4488931a01e586aa459736e9d6046d3bd9105ffb69352d374" -dependencies = [ - "async-trait", - "cfg-if", - "data-encoding", - "enum-as-inner", - "futures-channel", - "futures-io", - "futures-util", - "idna 0.4.0", - "ipnet", - "once_cell", - "rand 0.8.5", - "smallvec", - "thiserror 1.0.69", - "tinyvec", - "tokio", - "tracing", - "url", -] - -[[package]] -name = "trust-dns-resolver" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a3e6c3aff1718b3c73e395d1f35202ba2ffa847c6a62eea0db8fb4cfe30be6" -dependencies = [ - "cfg-if", - "futures-util", - "ipconfig", - "lru-cache", - "once_cell", - "parking_lot 0.12.5", - "rand 0.8.5", - "resolv-conf", - "smallvec", - "thiserror 1.0.69", - "tokio", - "tracing", - "trust-dns-proto", -] - [[package]] name = "try-lock" version = "0.2.5" @@ -11452,7 +11320,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" dependencies = [ "form_urlencoded", - "idna 1.1.0", + "idna", "percent-encoding", "serde", "serde_derive", @@ -11921,12 +11789,6 @@ dependencies = [ "wasite", ] -[[package]] -name = "widestring" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471" - [[package]] name = "winapi" version = "0.3.9" diff --git a/crates/terraphim_automata/src/lib.rs b/crates/terraphim_automata/src/lib.rs index 62d45e584..838d040d8 100644 --- a/crates/terraphim_automata/src/lib.rs +++ b/crates/terraphim_automata/src/lib.rs @@ -314,6 +314,7 @@ pub async fn load_thesaurus_from_json_and_replace_async( /// Note: Remote loading requires the "remote-loading" feature to be enabled. #[cfg(feature = "remote-loading")] pub async fn load_thesaurus(automata_path: &AutomataPath) -> Result { + #[allow(dead_code)] async fn read_url(url: String) -> Result { log::debug!("Reading thesaurus from remote: {url}"); let response = reqwest::Client::builder()