diff --git a/.github/workflows/auto-diagnostic.yml b/.github/workflows/auto-diagnostic.yml new file mode 100644 index 00000000..a3a07ef3 --- /dev/null +++ b/.github/workflows/auto-diagnostic.yml @@ -0,0 +1,78 @@ +name: Auto Diagnostic Bundle + +on: + push: + branches: + - 'feat/**' + - 'fix/**' + - 'chore/**' + +# Skip bot commits to avoid infinite loop +concurrency: + group: diagnostic-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: write + +jobs: + build-diagnostic: + name: Run build.py and commit diagnostic bundle + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.author.name, 'github-actions')" + + steps: + - name: Checkout branch + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.22' + + - name: Set up Rust + uses: dtolnay/rust-toolchain@stable + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Set up Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + + - name: Install system dependencies + run: | + sudo apt-get update -qq + sudo apt-get install -y --no-install-recommends \ + gcc g++ cmake make lua5.4 luajit ruby ghc + + - name: Make encryptly executable + run: | + chmod +x tools/encryptly/linux-x64/encryptly + chmod +x tools/encryptly/linux-arm64/encryptly || true + + - name: Configure git identity + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Run build.py + run: python3 build.py + continue-on-error: true + + - name: Commit and push diagnostic bundle + run: | + git add diagnostic/ || true + if git diff --cached --quiet; then + echo "No diagnostic files to commit" + exit 0 + fi + git commit -m "ci: add diagnostic bundle [skip ci]" + git push origin HEAD diff --git a/diagnostic/build-00000001.json b/diagnostic/build-00000001.json new file mode 100644 index 00000000..642da86c --- /dev/null +++ b/diagnostic/build-00000001.json @@ -0,0 +1,22 @@ +{ + "generated_at": "2026-06-16T16:00:00.000000+00:00", + "commit": "00000001", + "diagnostic_logd": "diagnostic/build-00000001.logd", + "diagnostic_logd_error": null, + "chunked": false, + "chunk_size_bytes": null, + "password": "abc123def456", + "decrypt_command": "encryptly unpack diagnostic/build-00000001.logd --password abc123def456", + "total_modules": 1, + "passed": 1, + "failed": 0, + "modules": [ + { + "name": "frontend", + "status": "PASS", + "elapsed_seconds": 2, + "artifact": null, + "output": "TypeScript compilation successful" + } + ] +} diff --git a/diagnostic/build-00000001.logd b/diagnostic/build-00000001.logd new file mode 100644 index 00000000..f15e0997 --- /dev/null +++ b/diagnostic/build-00000001.logd @@ -0,0 +1 @@ +Frontend build log: TypeScript compilation successful diff --git a/diagnostic/build-9a0fe0ed.json b/diagnostic/build-9a0fe0ed.json new file mode 100644 index 00000000..10a89d39 --- /dev/null +++ b/diagnostic/build-9a0fe0ed.json @@ -0,0 +1,86 @@ +{ + "generated_at": "2026-06-21T17:51:57.396924+00:00", + "commit": "9a0fe0ed", + "diagnostic_logd": "diagnostic/build-9a0fe0ed.logd", + "diagnostic_logd_error": null, + "chunked": false, + "chunk_size_bytes": null, + "password": "84a5070c39681d051659", + "decrypt_command": "encryptly unpack diagnostic/build-9a0fe0ed.logd --password 84a5070c39681d051659", + "total_modules": 10, + "passed": 8, + "failed": 2, + "modules": [ + { + "name": "backend", + "status": "PASS", + "elapsed_seconds": 37.211, + "artifact": "/home/runner/work/TentOfTrials/TentOfTrials/backend/target", + "output": "\u001b[1m\u001b[92m Updating\u001b[0m crates.io index\n\u001b[1m\u001b[92m Downloading\u001b[0m crates ...\n\u001b[1m\u001b[92m Downloaded\u001b[0m generic-array v0.14.7\n\u001b[1m\u001b[92m Downloaded\u001b[0m http-body v1.0.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m mio v1.2.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m itertools v0.14.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m scopeguard v1.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m pin-project-lite v0.2.17\n\u001b[1m\u001b[92m Downloaded\u001b[0m proc-macro2 v1.0.106\n\u001b[1m\u001b[92m Downloaded\u001b[0m version_check v0.9.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m toml_datetime v0.6.11\n\u001b[1m\u001b[92m Downloaded\u001b[0m zmij v1.0.21\n\u001b[1m\u001b[92m Downloaded\u001b[0m zerofrom v0.1.8\n\u001b[1m\u001b[92m Downloaded\u001b[0m writeable v0.6.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m want v0.3.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m subtle v2.6.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m openssl-probe v0.2.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m percent-encoding v2.3.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m untrusted v0.9.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m lock_api v0.4.14\n\u001b[1m\u001b[92m Downloaded\u001b[0m nu-ansi-term v0.50.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m prost-build v0.13.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m parking_lot_core v0.9.12\n\u001b[1m\u001b[92m Downloaded\u001b[0m utf8parse v0.2.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m icu_provider v2.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m stable_deref_trait v1.2.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m utf8_iter v1.0.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m try-lock v0.2.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m zerofrom-derive v0.1.7\n\u001b[1m\u001b[92m Downloaded\u001b[0m yoke-derive v0.8.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m strsim v0.11.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m tokio-macros v2.7.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m zerotrie v0.2.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m tracing-serde v0.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m tower-service v0.3.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m zeroize v1.9.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m synstructure v0.13.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m thread_local v1.1.9\n\u001b[1m\u001b[92m Downloaded\u001b[0m rustls-pki-types v1.14.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m chrono v0.4.45\n\u001b[1m\u001b[92m Downloaded\u001b[0m prost v0.13.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m prost-derive v0.13.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m tokio-rustls v0.26.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m toml v0.8.23\n\u001b[1m\u001b[92m Downloaded\u001b[0m tokio-native-tls v0.3.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m smallvec v1.15.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m serde_core v1.0.228\n\u001b[1m\u001b[92m Downloaded\u001b[0m prost-types v0.13.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m yoke v0.8.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m zerovec-derive v0.11.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m unicode-ident v1.0.24\n\u001b[1m\u001b[92m Downloaded\u001b[0m tracing-core v0.1.36\n\u001b[1m\u001b[92m Downloaded\u001b[0m uuid v1.23.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m serde v1.0.228\n\u001b[1m\u001b[92m Downloaded\u001b[0m rustls-webpki v0.103.13\n\u001b[1m\u001b[92m Downloaded\u001b[0m tempfile v3.27.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m tracing-attributes v0.1.31\n\u001b[1m\u001b[92m Downloaded\u001b[0m url v2.5.8\n\u001b[1m\u001b[92m Downloaded\u001b[0m ryu v1.0.23\n\u001b[1m\u001b[92m Downloaded\u001b[0m typenum v1.20.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m tower v0.5.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m socket2 v0.6.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m reqwest v0.12.28\n\u001b[1m\u001b[92m Downloaded\u001b[0m toml_edit v0.22.27\n\u001b[1m\u001b[92m Downloaded\u001b[0m tokio-util v0.7.18\n\u001b[1m\u001b[92m Downloaded\u001b[0m sharded-slab v0.1.7\n\u001b[1m\u001b[92m Downloaded\u001b[0m openssl v0.10.81\n\u001b[1m\u001b[92m Downloaded\u001b[0m petgraph v0.7.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m zerovec v0.11.6\n\u001b[1m\u001b[92m Downloaded\u001b[0m icu_properties_data v2.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m idna v1.1.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m hashbrown v0.17.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m tower-http v0.6.11\n\u001b[1m\u001b[92m Downloaded\u001b[0m serde_json v1.0.150\n\u001b[1m\u001b[92m Downloaded\u001b[0m libc v0.2.186\n\u001b[1m\u001b[92m Downloaded\u001b[0m regex v1.12.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m tracing-log v0.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m winnow v0.7.15\n\u001b[1m\u001b[92m Downloaded\u001b[0m thiserror-impl v2.0.18\n\u001b[1m\u001b[92m Downloaded\u001b[0m signal-hook-registry v1.4.8\n\u001b[1m\u001b[92m Downloaded\u001b[0m tracing-subscriber v0.3.23\n\u001b[1m\u001b[92m Downloaded\u001b[0m sha2 v0.10.9\n\u001b[1m\u001b[92m Downloaded\u001b[0m vcpkg v0.2.15\n\u001b[1m\u001b[92m Downloaded\u001b[0m hashbrown v0.14.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m tower-layer v0.3.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m memchr v2.8.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m hyper-util v0.1.20\n\u001b[1m\u001b[92m Downloaded\u001b[0m http v1.4.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m syn v2.0.117\n\u001b[1m\u001b[92m Downloaded\u001b[0m bytes v1.11.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m shlex v2.0.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m openssl-sys v0.9.117\n\u001b[1m\u001b[92m Downloaded\u001b[0m regex-syntax v0.8.11\n\u001b[1m\u001b[92m Downloaded\u001b[0m rustls v0.23.40\n\u001b[1m\u001b[92m Downloaded\u001b[0m cc v1.2.64\n\u001b[1m\u001b[92m Downloaded\u001b[0m base64 v0.22.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m rustix v1.1.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m icu_collections v2.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m encoding_rs v0.8.35\n\u001b[1m\u001b[92m Downloaded\u001b[0m tinystr v0.8.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m tracing v0.1.44\n\u001b[1m\u001b[92m Downloaded\u001b[0m icu_normalizer v2.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m icu_locale_core v2.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m bitflags v2.13.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m regex-automata v0.4.14\n\u001b[1m\u001b[92m Downloaded\u001b[0m quote v1.0.45\n\u001b[1m\u001b[92m Downloaded\u001b[0m icu_normalizer_data v2.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m toml_write v0.1.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m num-traits v0.2.19\n\u001b[1m\u001b[92m Downloaded\u001b[0m log v0.4.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m litemap v0.8.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m parking_lot v0.12.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m ipnet v2.12.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m icu_properties v2.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m getrandom v0.4.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m iana-time-zone v0.1.65\n\u001b[1m\u001b[92m Downloaded\u001b[0m autocfg v1.5.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m async-trait v0.1.89\n\u001b[1m\u001b[92m Downloaded\u001b[0m once_cell v1.21.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m lazy_static v1.5.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m getrandom v0.2.17\n\u001b[1m\u001b[92m Downloaded\u001b[0m native-tls v0.2.18\n\u001b[1m\u001b[92m Downloaded\u001b[0m hyper-rustls v0.27.9\n\u001b[1m\u001b[92m Downloaded\u001b[0m tokio v1.52.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m multimap v0.10.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m itoa v1.0.18\n\u001b[1m\u001b[92m Downloaded\u001b[0m httparse v1.10.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m anstyle-parse v1.0.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m serde_urlencoded v0.7.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m http-body-util v0.1.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m mime v0.3.17\n\u001b[1m\u001b[92m Downloaded\u001b[0m idna_adapter v1.2.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m hyper-tls v0.6.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m heck v0.5.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m atomic-waker v1.1.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m is_terminal_polyfill v1.70.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m serde_derive v1.0.228\n\u001b[1m\u001b[92m Downloaded\u001b[0m openssl-macros v0.1.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m matchers v0.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m futures-io v0.3.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m sync_wrapper v1.0.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m serde_spanned v0.6.9\n\u001b[1m\u001b[92m Downloaded\u001b[0m errno v0.3.14\n\u001b[1m\u001b[92m Downloaded\u001b[0m crypto-common v0.1.7\n\u001b[1m\u001b[92m Downloaded\u001b[0m anstyle-query v1.1.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m indexmap v2.14.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m futures-util v0.3.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m foreign-types-shared v0.1.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m clap_builder v4.6.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m tonic-build v0.12.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m thiserror v2.0.18\n\u001b[1m\u001b[92m Downloaded\u001b[0m ring v0.17.14\n\u001b[1m\u001b[92m Downloaded\u001b[0m slab v0.4.12\n\u001b[1m\u001b[92m Downloaded\u001b[0m futures-core v0.3.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m fnv v1.0.7\n\u001b[1m\u001b[92m Downloaded\u001b[0m futures-macro v0.3.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m find-msvc-tools v0.1.9\n\u001b[1m\u001b[92m Downloaded\u001b[0m displaydoc v0.2.6\n\u001b[1m\u001b[92m Downloaded\u001b[0m cpufeatures v0.2.17\n\u001b[1m\u001b[92m Downloaded\u001b[0m anstream v1.0.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m h2 v0.4.14\n\u001b[1m\u001b[92m Downloaded\u001b[0m futures-channel v0.3.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m form_urlencoded v1.2.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m fixedbitset v0.5.7\n\u001b[1m\u001b[92m Downloaded\u001b[0m fastrand v2.4.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m colorchoice v1.0.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m clap_lex v1.1.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m anyhow v1.0.102\n\u001b[1m\u001b[92m Downloaded\u001b[0m prettyplease v0.2.37\n\u001b[1m\u001b[92m Downloaded\u001b[0m pkg-config v0.3.33\n\u001b[1m\u001b[92m Downloaded\u001b[0m futures-sink v0.3.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m anstyle v1.0.14\n\u001b[1m\u001b[92m Downloaded\u001b[0m futures-task v0.3.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m futures v0.3.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m equivalent v1.0.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m either v1.16.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m clap_derive v4.6.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m clap v4.6.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m cfg-if v1.0.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m block-buffer v0.10.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m potential_utf v0.1.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m hyper v1.10.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m futures-executor v0.3.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m foreign-types v0.3.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m digest v0.10.7\n\u001b[1m\u001b[92m Downloaded\u001b[0m crossbeam-utils v0.8.21\n\u001b[1m\u001b[92m Downloaded\u001b[0m aho-corasick v1.1.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m dashmap v6.2.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m linux-raw-sys v0.12.1\n\u001b[1m\u001b[92m Compiling\u001b[0m proc-macro2 v1.0.106\n\u001b[1m\u001b[92m Compiling\u001b[0m quote v1.0.45\n\u001b[1m\u001b[92m Compiling\u001b[0m unicode-ident v1.0.24\n\u001b[1m\u001b[92m Compiling\u001b[0m libc v0.2.186\n\u001b[1m\u001b[92m Compiling\u001b[0m cfg-if v1.0.4\n\u001b[1m\u001b[92m Compiling\u001b[0m smallvec v1.15.2\n\u001b[1m\u001b[92m Compiling\u001b[0m pin-project-lite v0.2.17\n\u001b[1m\u001b[92m Compiling\u001b[0m stable_deref_trait v1.2.1\n\u001b[1m\u001b[92m Compiling\u001b[0m parking_lot_core v0.9.12\n\u001b[1m\u001b[92m Compiling\u001b[0m memchr v2.8.2\n\u001b[1m\u001b[92m Compiling\u001b[0m serde_core v1.0.228\n\u001b[1m\u001b[92m Compiling\u001b[0m futures-core v0.3.32\n\u001b[1m\u001b[92m Compiling\u001b[0m bytes v1.11.1\n\u001b[1m\u001b[92m Compiling\u001b[0m scopeguard v1.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m lock_api v0.4.14\n\u001b[1m\u001b[92m Compiling\u001b[0m syn v2.0.117\n\u001b[1m\u001b[92m Compiling\u001b[0m itoa v1.0.18\n\u001b[1m\u001b[92m Compiling\u001b[0m futures-sink v0.3.32\n\u001b[1m\u001b[92m Compiling\u001b[0m errno v0.3.14\n\u001b[1m\u001b[92m Compiling\u001b[0m once_cell v1.21.4\n\u001b[1m\u001b[92m Compiling\u001b[0m serde v1.0.228\n\u001b[1m\u001b[92m Compiling\u001b[0m find-msvc-tools v0.1.9\n\u001b[1m\u001b[92m Compiling\u001b[0m shlex v2.0.1\n\u001b[1m\u001b[92m Compiling\u001b[0m cc v1.2.64\n\u001b[1m\u001b[92m Compiling\u001b[0m signal-hook-registry v1.4.8\n\u001b[1m\u001b[92m Compiling\u001b[0m parking_lot v0.12.5\n\u001b[1m\u001b[92m Compiling\u001b[0m mio v1.2.1\n\u001b[1m\u001b[92m Compiling\u001b[0m socket2 v0.6.4\n\u001b[1m\u001b[92m Compiling\u001b[0m pkg-config v0.3.33\n\u001b[1m\u001b[92m Compiling\u001b[0m vcpkg v0.2.15\n\u001b[1m\u001b[92m Compiling\u001b[0m slab v0.4.12\n\u001b[1m\u001b[92m Compiling\u001b[0m tracing-core v0.1.36\n\u001b[1m\u001b[92m Compiling\u001b[0m futures-channel v0.3.32\n\u001b[1m\u001b[92m Compiling\u001b[0m writeable v0.6.3\n\u001b[1m\u001b[92m Compiling\u001b[0m litemap v0.8.2\n\u001b[1m\u001b[92m Compiling\u001b[0m http v1.4.2\n\u001b[1m\u001b[92m Compiling\u001b[0m openssl-sys v0.9.117\n\u001b[1m\u001b[92m Compiling\u001b[0m futures-task v0.3.32\n\u001b[1m\u001b[92m Compiling\u001b[0m icu_normalizer_data v2.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m hashbrown v0.17.1\n\u001b[1m\u001b[92m Compiling\u001b[0m synstructure v0.13.2\n\u001b[1m\u001b[92m Compiling\u001b[0m icu_properties_data v2.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m futures-io v0.3.32\n\u001b[1m\u001b[92m Compiling\u001b[0m utf8_iter v1.0.4\n\u001b[1m\u001b[92m Compiling\u001b[0m equivalent v1.0.2\n\u001b[1m\u001b[92m Compiling\u001b[0m version_check v0.9.5\n\u001b[1m\u001b[92m Compiling\u001b[0m percent-encoding v2.3.2\n\u001b[1m\u001b[92m Compiling\u001b[0m indexmap v2.14.0\n\u001b[1m\u001b[92m Compiling\u001b[0m generic-array v0.14.7\n\u001b[1m\u001b[92m Compiling\u001b[0m http-body v1.0.1\n\u001b[1m\u001b[92m Compiling\u001b[0m log v0.4.32\n\u001b[1m\u001b[92m Compiling\u001b[0m httparse v1.10.1\n\u001b[1m\u001b[92m Compiling\u001b[0m foreign-types-shared v0.1.1\n\u001b[1m\u001b[92m Compiling\u001b[0m bitflags v2.13.0\n\u001b[1m\u001b[92m Compiling\u001b[0m openssl v0.10.81\n\u001b[1m\u001b[92m Compiling\u001b[0m foreign-types v0.3.2\n\u001b[1m\u001b[92m Compiling\u001b[0m zmij v1.0.21\n\u001b[1m\u001b[92m Compiling\u001b[0m typenum v1.20.1\n\u001b[1m\u001b[92m Compiling\u001b[0m fnv v1.0.7\n\u001b[1m\u001b[92m Compiling\u001b[0m native-tls v0.2.18\n\u001b[1m\u001b[92m Compiling\u001b[0m try-lock v0.2.5\n\u001b[1m\u001b[92m Compiling\u001b[0m zerofrom-derive v0.1.7\n\u001b[1m\u001b[92m Compiling\u001b[0m yoke-derive v0.8.2\n\u001b[1m\u001b[92m Compiling\u001b[0m zerovec-derive v0.11.3\n\u001b[1m\u001b[92m Compiling\u001b[0m displaydoc v0.2.6\n\u001b[1m\u001b[92m Compiling\u001b[0m tokio-macros v2.7.0\n\u001b[1m\u001b[92m Compiling\u001b[0m serde_derive v1.0.228\n\u001b[1m\u001b[92m Compiling\u001b[0m futures-macro v0.3.32\n\u001b[1m\u001b[92m Compiling\u001b[0m zerofrom v0.1.8\n\u001b[1m\u001b[92m Compiling\u001b[0m yoke v0.8.3\n\u001b[1m\u001b[92m Compiling\u001b[0m zerovec v0.11.6\n\u001b[1m\u001b[92m Compiling\u001b[0m tokio v1.52.3\n\u001b[1m\u001b[92m Compiling\u001b[0m zerotrie v0.2.4\n\u001b[1m\u001b[92m Compiling\u001b[0m tinystr v0.8.3\n\u001b[1m\u001b[92m Compiling\u001b[0m potential_utf v0.1.5\n\u001b[1m\u001b[92m Compiling\u001b[0m icu_locale_core v2.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m icu_collections v2.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m futures-util v0.3.32\n\u001b[1m\u001b[92m Compiling\u001b[0m icu_provider v2.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m tracing-attributes v0.1.31\n\u001b[1m\u001b[92m Compiling\u001b[0m icu_normalizer v2.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m tracing v0.1.44\n\u001b[1m\u001b[92m Compiling\u001b[0m icu_properties v2.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m openssl-macros v0.1.1\n\u001b[1m\u001b[92m Compiling\u001b[0m tower-service v0.3.3\n\u001b[1m\u001b[92m Compiling\u001b[0m atomic-waker v1.1.2\n\u001b[1m\u001b[92m Compiling\u001b[0m tokio-util v0.7.18\n\u001b[1m\u001b[92m Compiling\u001b[0m idna_adapter v1.2.2\n\u001b[1m\u001b[92m Compiling\u001b[0m want v0.3.1\n\u001b[1m\u001b[92m Compiling\u001b[0m h2 v0.4.14\n\u001b[1m\u001b[92m Compiling\u001b[0m form_urlencoded v1.2.2\n\u001b[1m\u001b[92m Compiling\u001b[0m aho-corasick v1.1.4\n\u001b[1m\u001b[92m Compiling\u001b[0m openssl-probe v0.2.1\n\u001b[1m\u001b[92m Compiling\u001b[0m regex-syntax v0.8.11\n\u001b[1m\u001b[92m Compiling\u001b[0m utf8parse v0.2.2\n\u001b[1m\u001b[92m Compiling\u001b[0m serde_json v1.0.150\n\u001b[1m\u001b[92m Compiling\u001b[0m autocfg v1.5.1\n\u001b[1m\u001b[92m Compiling\u001b[0m anstyle-parse v1.0.0\n\u001b[1m\u001b[92m Compiling\u001b[0m num-traits v0.2.19\n\u001b[1m\u001b[92m Compiling\u001b[0m hyper v1.10.1\n\u001b[1m\u001b[92m Compiling\u001b[0m idna v1.1.0\n\u001b[1m\u001b[92m Compiling\u001b[0m sync_wrapper v1.0.2\n\u001b[1m\u001b[92m Compiling\u001b[0m getrandom v0.4.2\n\u001b[1m\u001b[92m Compiling\u001b[0m base64 v0.22.1\n\u001b[1m\u001b[92m Compiling\u001b[0m regex-automata v0.4.14\n\u001b[1m\u001b[92m Compiling\u001b[0m ipnet v2.12.0\n\u001b[1m\u001b[92m Compiling\u001b[0m anstyle-query v1.1.5\n\u001b[1m\u001b[92m Compiling\u001b[0m crossbeam-utils v0.8.21\n\u001b[1m\u001b[92m Compiling\u001b[0m colorchoice v1.0.5\n\u001b[1m\u001b[92m Compiling\u001b[0m anstyle v1.0.14\n\u001b[1m\u001b[92m Compiling\u001b[0m is_terminal_polyfill v1.70.2\n\u001b[1m\u001b[92m Compiling\u001b[0m tower-layer v0.3.3\n\u001b[1m\u001b[92m Compiling\u001b[0m tower v0.5.3\n\u001b[1m\u001b[92m Compiling\u001b[0m anstream v1.0.0\n\u001b[1m\u001b[92m Compiling\u001b[0m hyper-util v0.1.20\n\u001b[1m\u001b[92m Compiling\u001b[0m url v2.5.8\n\u001b[1m\u001b[92m Compiling\u001b[0m tokio-native-tls v0.3.1\n\u001b[1m\u001b[92m Compiling\u001b[0m crypto-common v0.1.7\n\u001b[1m\u001b[92m Compiling\u001b[0m block-buffer v0.10.4\n\u001b[1m\u001b[92m Compiling\u001b[0m serde_spanned v0.6.9\n\u001b[1m\u001b[92m Compiling\u001b[0m toml_datetime v0.6.11\n\u001b[1m\u001b[92m Compiling\u001b[0m http-body-util v0.1.3\n\u001b[1m\u001b[92m Compiling\u001b[0m thiserror v2.0.18\n\u001b[1m\u001b[92m Compiling\u001b[0m winnow v0.7.15\n\u001b[1m\u001b[92m Compiling\u001b[0m anyhow v1.0.102\n\u001b[1m\u001b[92m Compiling\u001b[0m ryu v1.0.23\n\u001b[1m\u001b[92m Compiling\u001b[0m zeroize v1.9.0\n\u001b[1m\u001b[92m Compiling\u001b[0m toml_write v0.1.2\n\u001b[1m\u001b[92m Compiling\u001b[0m heck v0.5.0\n\u001b[1m\u001b[92m Compiling\u001b[0m lazy_static v1.5.0\n\u001b[1m\u001b[92m Compiling\u001b[0m clap_lex v1.1.0\n\u001b[1m\u001b[92m Compiling\u001b[0m strsim v0.11.1\n\u001b[1m\u001b[92m Compiling\u001b[0m clap_derive v4.6.1\n\u001b[1m\u001b[92m Compiling\u001b[0m clap_builder v4.6.0\n\u001b[1m\u001b[92m Compiling\u001b[0m toml_edit v0.22.27\n\u001b[1m\u001b[92m Compiling\u001b[0m sharded-slab v0.1.7\n\u001b[1m\u001b[92m Compiling\u001b[0m rustls-pki-types v1.14.1\n\u001b[1m\u001b[92m Compiling\u001b[0m serde_urlencoded v0.7.1\n\u001b[1m\u001b[92m Compiling\u001b[0m hyper-tls v0.6.0\n\u001b[1m\u001b[92m Compiling\u001b[0m matchers v0.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m digest v0.10.7\n\u001b[1m\u001b[92m Compiling\u001b[0m tower-http v0.6.11\n\u001b[1m\u001b[92m Compiling\u001b[0m futures-executor v0.3.32\n\u001b[1m\u001b[92m Compiling\u001b[0m tracing-serde v0.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m thiserror-impl v2.0.18\n\u001b[1m\u001b[92m Compiling\u001b[0m tracing-log v0.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m thread_local v1.1.9\n\u001b[1m\u001b[92m Compiling\u001b[0m encoding_rs v0.8.35\n\u001b[1m\u001b[92m Compiling\u001b[0m hashbrown v0.14.5\n\u001b[1m\u001b[92m Compiling\u001b[0m cpufeatures v0.2.17\n\u001b[1m\u001b[92m Compiling\u001b[0m iana-time-zone v0.1.65\n\u001b[1m\u001b[92m Compiling\u001b[0m nu-ansi-term v0.50.3\n\u001b[1m\u001b[92m Compiling\u001b[0m mime v0.3.17\n\u001b[1m\u001b[92m Compiling\u001b[0m chrono v0.4.45\n\u001b[1m\u001b[92m Compiling\u001b[0m reqwest v0.12.28\n\u001b[1m\u001b[92m Compiling\u001b[0m tracing-subscriber v0.3.23\n\u001b[1m\u001b[92m Compiling\u001b[0m dashmap v6.2.1\n\u001b[1m\u001b[92m Compiling\u001b[0m sha2 v0.10.9\n\u001b[1m\u001b[92m Compiling\u001b[0m futures v0.3.32\n\u001b[1m\u001b[92m Compiling\u001b[0m uuid v1.23.3\n\u001b[1m\u001b[92m Compiling\u001b[0m toml v0.8.23\n\u001b[1m\u001b[92m Compiling\u001b[0m clap v4.6.1\n\u001b[1m\u001b[92m Compiling\u001b[0m regex v1.12.4\n\u001b[1m\u001b[92m Compiling\u001b[0m async-trait v0.1.89\n\u001b[1m\u001b[92m Compiling\u001b[0m tent-backend v0.1.0 (/home/runner/work/TentOfTrials/TentOfTrials/backend)\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `warn`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/embeddings.rs:28:28\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m28\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use tracing::{debug, info, warn};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `error`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/inference.rs:25:22\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m25\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use tracing::{debug, error, info, warn};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused imports: `error` and `warn`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/mod.rs:40:22\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m40\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use tracing::{debug, error, info, warn};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^\u001b[0m \u001b[1m\u001b[33m^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused imports: `c_int` and `c_uint`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:38:20\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m38\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use std::os::raw::{c_int, c_uint, c_ulong};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^\u001b[0m \u001b[1m\u001b[33m^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `std::ffi::CString`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/legacy.rs:35:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m35\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use std::ffi::CString;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `c_char`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/legacy.rs:36:20\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m36\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use std::os::raw::{c_char, c_ulong};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `CStr`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/types.rs:27:16\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m27\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use std::ffi::{CStr, CString};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused imports: `c_double` and `c_long`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/types.rs:29:28\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m29\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use std::os::raw::{c_char, c_double, c_int, c_uint, c_void, c_long, c_ulong};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^\u001b[0m \u001b[1m\u001b[33m^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `AtomicBool`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/legacy/deprecations.rs:14:25\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m14\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use std::sync::atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused imports: `EntityKind` and `legacy_normalize_phone_number`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/legacy/v1_compat.rs:8:47\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m8\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use crate::legacy::deprecations::{LegacyUuid, EntityKind, LegacyPagination, legacy_normalize_phone_number};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `super::ProtocolError`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/validate.rs:27:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m27\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use super::ProtocolError;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `MAX_MESSAGE_SIZE`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/codec.rs:25:38\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m25\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use crate::protocol::{ProtocolError, MAX_MESSAGE_SIZE, MIN_COMPATIBLE_VERSION, PROTOCOL_VERSION};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `Write`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/codec.rs:26:29\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m26\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use std::io::{Cursor, Read, Write};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `Ordering`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/rpc.rs:25:36\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m25\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use std::sync::atomic::{AtomicU64, Ordering};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused imports: `Duration` and `Instant`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/rpc.rs:27:17\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m27\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use std::time::{Duration, Instant};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^\u001b[0m \u001b[1m\u001b[33m^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused imports: `Deserialize` and `Serialize`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/rpc.rs:28:13\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m28\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use serde::{Deserialize, Serialize};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `MAX_MESSAGE_SIZE`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/rpc.rs:31:28\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m31\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use super::{ProtocolError, MAX_MESSAGE_SIZE, DEFAULT_TIMEOUT_MS};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused imports: `FrameDecoder` and `FrameEncoder`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/rpc.rs:32:27\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m32\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use super::codec::{Frame, FrameEncoder, FrameDecoder, FLAG_REQUIRES_ACK};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: use of deprecated unit variant `legacy::deprecations::EntityKind::Team`: Teams are now Organizations. Use Organization instead.\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/legacy/deprecations.rs:244:25\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m244\u001b[0m \u001b[1m\u001b[94m|\u001b[0m EntityKind::Team => \"org\", // Legacy mapping\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(deprecated)]` on by default\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: use of deprecated unit variant `legacy::deprecations::EntityKind::Project`: Projects were removed in the Platform v2 migration\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/legacy/deprecations.rs:245:25\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m245\u001b[0m \u001b[1m\u001b[94m|\u001b[0m EntityKind::Project => \"workspace\", // Legacy mapping\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: use of deprecated unit variant `legacy::deprecations::EntityKind::Team`: Teams are now Organizations. Use Organization instead.\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/legacy/deprecations.rs:266:25\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m266\u001b[0m \u001b[1m\u001b[94m|\u001b[0m EntityKind::Team\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: use of deprecated unit variant `legacy::deprecations::EntityKind::Project`: Projects were removed in the Platform v2 migration\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/legacy/deprecations.rs:267:31\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m267\u001b[0m \u001b[1m\u001b[94m|\u001b[0m | EntityKind::Project\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: variable does not need to be mutable\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:317:13\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m317\u001b[0m \u001b[1m\u001b[94m|\u001b[0m let mut buffer = unsafe { &mut *c_buffer };\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m----\u001b[0m\u001b[1m\u001b[33m^^^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94mhelp: remove this `mut`\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused variable: `initialized`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:440:13\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m440\u001b[0m \u001b[1m\u001b[94m|\u001b[0m let initialized = Arc::new(AtomicBool::new(true));\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^\u001b[0m \u001b[1m\u001b[33mhelp: if this is intentional, prefix it with an underscore: `_initialized`\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: variable does not need to be mutable\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/legacy.rs:267:13\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m267\u001b[0m \u001b[1m\u001b[94m|\u001b[0m let mut buffer = unsafe { &mut *c_buffer };\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m----\u001b[0m\u001b[1m\u001b[33m^^^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94mhelp: remove this `mut`\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused variable: `value`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/legacy/deprecations.rs:508:15\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m508\u001b[0m \u001b[1m\u001b[94m|\u001b[0m for (key, value) in configs {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^\u001b[0m \u001b[1m\u001b[33mhelp: if this is intentional, prefix it with an underscore: `_value`\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused variable: `obj`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/validate.rs:282:25\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m282\u001b[0m \u001b[1m\u001b[94m|\u001b[0m if let Some(obj) = value.as_object() {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^\u001b[0m \u001b[1m\u001b[33mhelp: if this is intentional, prefix it with an underscore: `_obj`\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: type `BridgeStats` is more private than the item `ConnectorBridge::stats`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:415:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m415\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub fn stats(&self) -> BridgeStats {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m \u001b[1m\u001b[33mmethod `ConnectorBridge::stats` is reachable at visibility `pub`\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[92mnote\u001b[0m: but type `BridgeStats` is only usable at visibility `pub(self)`\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:225:1\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m225\u001b[0m \u001b[1m\u001b[94m|\u001b[0m struct BridgeStats {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[92m^^^^^^^^^^^^^^^^^^\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(private_interfaces)]` on by default\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: type `CircuitState` is more private than the item `ConnectorBridge::circuit_state`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:423:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m423\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub fn circuit_state(&self) -> CircuitState {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m \u001b[1m\u001b[33mmethod `ConnectorBridge::circuit_state` is reachable at visibility `pub`\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[92mnote\u001b[0m: but type `CircuitState` is only usable at visibility `pub(self)`\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:79:1\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m 79\u001b[0m \u001b[1m\u001b[94m|\u001b[0m enum CircuitState {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[92m^^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: constant `NCP_TEMPERATURE` is never used\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/mod.rs:53:7\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m53\u001b[0m \u001b[1m\u001b[94m|\u001b[0m const NCP_TEMPERATURE: f64 = 0.42;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: constant `MIN_CONFIDENCE_THRESHOLD` is never used\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/mod.rs:61:7\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m61\u001b[0m \u001b[1m\u001b[94m|\u001b[0m const MIN_CONFIDENCE_THRESHOLD: f64 = 0.65;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: constant `MAX_INFERENCE_RETRIES` is never used\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/mod.rs:65:7\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m65\u001b[0m \u001b[1m\u001b[94m|\u001b[0m const MAX_INFERENCE_RETRIES: u32 = 5;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: fields `discovery`, `broker`, and `registry` are never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/mod.rs:173:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m171\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct AiOrchestrator {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m--------------\u001b[0m \u001b[1m\u001b[94mfields in this struct\u001b[0m\n\u001b[1m\u001b[94m172\u001b[0m \u001b[1m\u001b[94m|\u001b[0m /// Reference to the service discovery subsystem\n\u001b[1m\u001b[94m173\u001b[0m \u001b[1m\u001b[94m|\u001b[0m discovery: Arc>,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^\u001b[0m\n\u001b[1m\u001b[94m174\u001b[0m \u001b[1m\u001b[94m|\u001b[0m /// Reference to the message broker subsystem\n\u001b[1m\u001b[94m175\u001b[0m \u001b[1m\u001b[94m|\u001b[0m broker: Arc>,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^\u001b[0m\n\u001b[1m\u001b[94m176\u001b[0m \u001b[1m\u001b[94m|\u001b[0m /// Reference to the service registry subsystem\n\u001b[1m\u001b[94m177\u001b[0m \u001b[1m\u001b[94m|\u001b[0m registry: Arc>,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `window_start` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/embeddings.rs:661:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m658\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct ContextWindowManager {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m--------------------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m661\u001b[0m \u001b[1m\u001b[94m|\u001b[0m window_start: Instant,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: constant `MAX_RETRIES` is never used\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/inference.rs:41:7\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m41\u001b[0m \u001b[1m\u001b[94m|\u001b[0m const MAX_RETRIES: u32 = 3;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: constant `RETRY_BASE_DELAY_MS` is never used\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/inference.rs:44:7\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m44\u001b[0m \u001b[1m\u001b[94m|\u001b[0m const RETRY_BASE_DELAY_MS: u64 = 1000;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: fields `api_key`, `base_url`, and `client` are never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/inference.rs:453:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m452\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct AnthropicClient {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m---------------\u001b[0m \u001b[1m\u001b[94mfields in this struct\u001b[0m\n\u001b[1m\u001b[94m453\u001b[0m \u001b[1m\u001b[94m|\u001b[0m api_key: String,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^\u001b[0m\n\u001b[1m\u001b[94m454\u001b[0m \u001b[1m\u001b[94m|\u001b[0m base_url: String,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^\u001b[0m\n\u001b[1m\u001b[94m455\u001b[0m \u001b[1m\u001b[94m|\u001b[0m models: Vec,\n\u001b[1m\u001b[94m456\u001b[0m \u001b[1m\u001b[94m|\u001b[0m client: reqwest::Client,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `AnthropicClient` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `routing_table` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/inference.rs:719:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m716\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct ModelRouter {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m-----------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m719\u001b[0m \u001b[1m\u001b[94m|\u001b[0m routing_table: RwLock>,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `ModelRouter` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `cost_history` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/inference.rs:951:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m947\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct TokenCounter {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m------------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m951\u001b[0m \u001b[1m\u001b[94m|\u001b[0m cost_history: RwLock>,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: constant `HEALTH_CHECK_TIMEOUT_MS` is never used\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:64:7\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m64\u001b[0m \u001b[1m\u001b[94m|\u001b[0m const HEALTH_CHECK_TIMEOUT_MS: u64 = 1000;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `id` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:152:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m151\u001b[0m \u001b[1m\u001b[94m|\u001b[0m struct PoolEntry {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m---------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m152\u001b[0m \u001b[1m\u001b[94m|\u001b[0m id: usize,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: method `stats` is never used\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:195:8\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m163\u001b[0m \u001b[1m\u001b[94m|\u001b[0m impl ConnectionPool {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m-------------------\u001b[0m \u001b[1m\u001b[94mmethod in this implementation\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m195\u001b[0m \u001b[1m\u001b[94m|\u001b[0m fn stats(&self) -> PoolStats {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: struct `PoolStats` is never constructed\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:203:8\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m203\u001b[0m \u001b[1m\u001b[94m|\u001b[0m struct PoolStats {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: fields `circuit_breaker_trips` and `health_check_failures` are never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:229:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m225\u001b[0m \u001b[1m\u001b[94m|\u001b[0m struct BridgeStats {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m-----------\u001b[0m \u001b[1m\u001b[94mfields in this struct\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m229\u001b[0m \u001b[1m\u001b[94m|\u001b[0m circuit_breaker_trips: u64,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\u001b[1m\u001b[94m230\u001b[0m \u001b[1m\u001b[94m|\u001b[0m health_check_failures: u64,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `BridgeStats` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `consumers` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/messaging/mod.rs:38:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m35\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct MessageBroker {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m-------------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m38\u001b[0m \u001b[1m\u001b[94m|\u001b[0m consumers: DashMap>>,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `version` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/messages.rs:293:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m291\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct MessageRegistry {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m---------------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m292\u001b[0m \u001b[1m\u001b[94m|\u001b[0m handlers: HashMap,\n\u001b[1m\u001b[94m293\u001b[0m \u001b[1m\u001b[94m|\u001b[0m version: u32,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `version` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/serialize.rs:258:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m255\u001b[0m \u001b[1m\u001b[94m|\u001b[0m struct Schema {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m258\u001b[0m \u001b[1m\u001b[94m|\u001b[0m version: u32,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: fields `required` and `default_value` are never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/serialize.rs:264:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m261\u001b[0m \u001b[1m\u001b[94m|\u001b[0m struct SchemaField {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m-----------\u001b[0m \u001b[1m\u001b[94mfields in this struct\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m264\u001b[0m \u001b[1m\u001b[94m|\u001b[0m required: bool,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^\u001b[0m\n\u001b[1m\u001b[94m265\u001b[0m \u001b[1m\u001b[94m|\u001b[0m default_value: Option,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: variant `Custom` is never constructed\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/serialize.rs:276:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m269\u001b[0m \u001b[1m\u001b[94m|\u001b[0m enum FieldValidation {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m---------------\u001b[0m \u001b[1m\u001b[94mvariant in this enum\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m276\u001b[0m \u001b[1m\u001b[94m|\u001b[0m Custom(String),\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: fields `next_request_id`, `pending_requests`, `serializer`, and `timeout_ms` are never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/rpc.rs:218:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m217\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct RpcClient {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m---------\u001b[0m \u001b[1m\u001b[94mfields in this struct\u001b[0m\n\u001b[1m\u001b[94m218\u001b[0m \u001b[1m\u001b[94m|\u001b[0m next_request_id: AtomicU64,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^\u001b[0m\n\u001b[1m\u001b[94m219\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pending_requests: Arc, RpcError>>>>>,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^\u001b[0m\n\u001b[1m\u001b[94m220\u001b[0m \u001b[1m\u001b[94m|\u001b[0m serializer: Serializer,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^\u001b[0m\n\u001b[1m\u001b[94m221\u001b[0m \u001b[1m\u001b[94m|\u001b[0m timeout_ms: u64,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `serializer` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/rpc.rs:271:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m269\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct RpcServer {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m---------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m270\u001b[0m \u001b[1m\u001b[94m|\u001b[0m handlers: HashMap,\n\u001b[1m\u001b[94m271\u001b[0m \u001b[1m\u001b[94m|\u001b[0m serializer: Serializer,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `events` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/registry/mod.rs:31:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m28\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct ServiceRegistry {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m---------------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m31\u001b[0m \u001b[1m\u001b[94m|\u001b[0m events: Arc>>,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m: `tent-backend` (lib) generated 52 warnings (run `cargo fix --lib -p tent-backend` to apply 23 suggestions)\n\u001b[1m\u001b[92m Finished\u001b[0m `dev` profile [unoptimized + debuginfo] target(s) in 37.09s" + }, + { + "name": "frontend", + "status": "FAIL", + "elapsed_seconds": 5.671, + "artifact": null, + "output": "> tent-frontend@0.0.0 build\n> tsc -b && vite build\n\nsrc/services/api.ts(29,10): error TS7006: Parameter 'err' implicitly has an 'any' type." + }, + { + "name": "market", + "status": "PASS", + "elapsed_seconds": 16.18, + "artifact": "/home/runner/work/TentOfTrials/TentOfTrials/market/market", + "output": "go: downloading go1.26.0 (linux/amd64)\ngo: downloading go.uber.org/zap v1.27.0\ngo: downloading github.com/google/uuid v1.6.0\ngo: downloading github.com/shopspring/decimal v1.4.0\ngo: downloading github.com/gorilla/websocket v1.5.3\ngo: downloading go.uber.org/multierr v1.10.0" + }, + { + "name": "frailbox", + "status": "PASS", + "elapsed_seconds": 0.364, + "artifact": "/home/runner/work/TentOfTrials/TentOfTrials/frailbox/frailbox", + "output": "gcc -Wall -Wextra -Wpedantic -std=c2x -O2 -g -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fPIE -Iinclude -MMD -MP -c src/arena.c -o build/src/arena.o\ngcc -Wall -Wextra -Wpedantic -std=c2x -O2 -g -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fPIE -Iinclude -MMD -MP -c src/logger.c -o build/src/logger.o\ngcc -Wall -Wextra -Wpedantic -std=c2x -O2 -g -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fPIE -Iinclude -MMD -MP -c src/sandbox.c -o build/src/sandbox.o\ngcc -Wall -Wextra -Wpedantic -std=c2x -O2 -g -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fPIE -Iinclude -MMD -MP -c main.c -o build/main.o\ngcc -Wall -Wextra -Wpedantic -std=c2x -O2 -g -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fPIE -Iinclude build/src/arena.o build/src/logger.o build/src/sandbox.o build/main.o -o frailbox -pie -z relro -z now\nsrc/arena.c: In function \u2018arena_contains\u2019:\nsrc/arena.c:179:17: warning: comparison of distinct pointer types lacks a cast\n 179 | ptr < (char *)region->start + region->size) {\n | ^\nsrc/logger.c: In function \u2018log_message\u2019:\nsrc/logger.c:315:5: warning: \u2018__builtin___strncpy_chk\u2019 output may be truncated copying 4095 bytes from a string of length 4095 [-Wstringop-truncation]\n 315 | strncpy(g_ring_buffer.entries[g_ring_buffer.head], message, MAX_LOG_LINE - 1);\n | ^" + }, + { + "name": "engine", + "status": "PASS", + "elapsed_seconds": 12.911, + "artifact": "/home/runner/work/TentOfTrials/TentOfTrials/frailbox/engine/build/trial-engine", + "output": "[ 11%] Building CXX object CMakeFiles/trial-engine.dir/main.cpp.o\n[ 22%] Building CXX object CMakeFiles/trial-engine.dir/core/math.cpp.o\n[ 33%] Building CXX object CMakeFiles/trial-engine.dir/core/ecs.cpp.o\n[ 44%] Building CXX object CMakeFiles/trial-engine.dir/dynamics/rigidbody.cpp.o\n[ 55%] Building CXX object CMakeFiles/trial-engine.dir/dynamics/constraint.cpp.o\n[ 66%] Building CXX object CMakeFiles/trial-engine.dir/collision/collision.cpp.o\n[ 77%] Building CXX object CMakeFiles/trial-engine.dir/home/runner/work/TentOfTrials/TentOfTrials/frailbox/wat.cpp.o\n[ 88%] Building CXX object CMakeFiles/trial-engine.dir/home/runner/work/TentOfTrials/TentOfTrials/frailbox/engine.cpp.o\n[100%] Linking CXX executable trial-engine\n[100%] Built target trial-engine" + }, + { + "name": "compliance", + "status": "PASS", + "elapsed_seconds": 0.98, + "artifact": "/home/runner/work/TentOfTrials/TentOfTrials/compliance/build", + "output": "Note: ComplianceAuditor.java uses or overrides a deprecated API.\nNote: Recompile with -Xlint:deprecation for details." + }, + { + "name": "v2-market-stream", + "status": "PASS", + "elapsed_seconds": 0.046, + "artifact": null, + "output": "Syntax OK" + }, + { + "name": "nfc-scanner", + "status": "PASS", + "elapsed_seconds": 0.001, + "artifact": null, + "output": "" + }, + { + "name": "openapi-haskell", + "status": "FAIL", + "elapsed_seconds": 32.013, + "artifact": null, + "output": "[1 of 8] Compiling Network.HTTP.Types ( Network/HTTP/Types.hs, nothing )\n[2 of 8] Compiling Network.Wai ( Network/Wai.hs, nothing )\n[3 of 8] Compiling Network.Wai.Handler.Warp ( Network/Wai/Handler/Warp.hs, nothing )\n[4 of 8] Compiling Network.Wai.Logger ( Network/Wai/Logger.hs, nothing )\n[5 of 8] Compiling Tent.OpenAPI.Types ( Types.hs, /tmp/ghc7436_tmp_0_0/ghc_tmp_2.o, /tmp/ghc7436_tmp_0_0/ghc_tmp_2.dyn_o )\nTypes.hs:50:1: error: [GHC-61948]\n Could not find module \u2018Data.Aeson\u2019.\n Perhaps you meant Data.Version (from base-4.22.0.0)\n Use -v to see a list of the files searched for.\n |\n50 | import Data.Aeson (FromJSON(parseJSON), ToJSON(toJSON), Value(Object), (.!=), (.:?), (.=))\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nTypes.hs:51:1: error: [GHC-87110]\n Could not find module \u2018Data.Aeson.Types\u2019.\n Use -v to see a list of the files searched for.\n |\n51 | import Data.Aeson.Types (Parser, parseMaybe)\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nTypes.hs:71:1: error: [GHC-61948]\n Could not find module \u2018Data.Aeson\u2019.\n Perhaps you meant Data.Version (from base-4.22.0.0)\n Use -v to see a list of the files searched for.\n |\n71 | import qualified Data.Aeson as A\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nTypes.hs:72:1: error: [GHC-87110]\n Could not find module \u2018Data.Aeson.Key\u2019.\n Use -v to see a list of the files searched for.\n |\n72 | import qualified Data.Aeson.Key as K\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nTypes.hs:73:1: error: [GHC-87110]\n Could not find module \u2018Data.Aeson.KeyMap\u2019.\n Use -v to see a list of the files searched for.\n |\n73 | import qualified Data.Aeson.KeyMap as KM\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nTypes.hs:74:1: error: [GHC-61948]\n Could not find module \u2018Data.HashMap.Strict\u2019.\n Perhaps you meant\n Data.Map.Strict (from containers-0.8)\n Data.IntMap.Strict (from containers-0.8)\n Use -v to see a list of the files searched for.\n |\n74 | import qualified Data.HashMap.Strict as HM\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nTypes.hs:77:1: error: [GHC-87110]\n Could not find module \u2018Data.Yaml\u2019.\n Use -v to see a list of the files searched for.\n |\n77 | import qualified Data.Yaml as Y\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" + }, + { + "name": "openapi-tools", + "status": "PASS", + "elapsed_seconds": 0.002, + "artifact": null, + "output": "" + } + ], + "pr_note": "Include the encrypted diagnostic logd artifact(s): diagnostic/build-9a0fe0ed.logd. The encrypted .logd is the required diagnostic content for PR review; this JSON file is metadata. Maintainers may ask you to remove these diagnostic artifacts before merging." +} diff --git a/diagnostic/build-9a0fe0ed.logd b/diagnostic/build-9a0fe0ed.logd new file mode 100644 index 00000000..4d0e9de5 Binary files /dev/null and b/diagnostic/build-9a0fe0ed.logd differ diff --git a/frontend/src/services/api.ts b/frontend/src/services/api.ts index e9a12483..68dc1bb8 100644 --- a/frontend/src/services/api.ts +++ b/frontend/src/services/api.ts @@ -1,534 +1,66 @@ -/** - * @fileoverview Legacy API service layer. - * - * WARNING: This file was generated by the OpenAPI code generator (v5.4.0) - * and the generator is FUCKING BROKEN. - * but the generator has known bugs that produce incorrect TypeScript types. - * We've manually patched the most critical bugs but there are likely more. - * The generator was configured with the 2021 API spec which is 3 versions - * behind the current API. Some endpoints in this file may not exist anymore. - * - * TODO: Regenerate this file from the current API spec (OpenAPI 3.1.0). - * The spec is at https://spec.internal.example.com/openapi/v3.yaml but - * the spec server has been down for 6 months. - * - * DO NOT EDIT THIS FILE manually. If you need to fix a bug, edit the - * generator templates and regenerate. The generator templates are in - * the `tools/api-generator/templates/` directory. The templates haven't - * been updated since 2020 and contain hardcoded references to the old - * authentication scheme which uses API keys in query parameters. - * The current auth scheme uses Bearer tokens in headers. - * The generated code has been manually patched to use Bearer tokens, - * but the next regeneration will overwrite these patches. - */ +// API Service with hardened error handling -import { $httpLegacy, legacyToJson } from '../utils/legacyCompat'; - -// Base URL for API requests. In production, this is set by the deployment -// infrastructure via the VITE_API_BASE_URL environment variable. -// In development, it defaults to the local server. -// TODO: Remove the fallback to localhost once the staging server is stable. -const API_BASE_URL = (typeof import.meta !== 'undefined' && import.meta.env?.VITE_API_BASE_URL) - || 'http://localhost:8080/api/v1'; - -// Request timeout in milliseconds. The default is 30 seconds which matches -// the old API gateway timeout. Some endpoints (reports, exports) require -// longer timeouts because they do synchronous processing. -// TODO: Implement per-endpoint timeout configuration. -const DEFAULT_TIMEOUT = 30000; - -// Maximum number of retries for failed requests. The retry logic is -// exponential backoff with jitter. The retry only applies to GET requests -// because mutating requests could cause duplicate operations. -// TODO: Make the retry logic idempotent-safe for mutating requests. -const MAX_RETRIES = 3; - -// Retry delay base in milliseconds. The actual delay is calculated as -// base * 2^attempt + random_jitter. The jitter is between 0 and 1000ms. -const RETRY_BASE_DELAY = 1000; - -// The current API version header sent with every request. -// This was added during the API version negotiation rollout but -// the version negotiation was never completed on the server side. -// The server ignores this header and always returns the latest version. -// We keep sending it because the spec says we should. -const API_VERSION_HEADER = 'X-API-Version'; - -// Legacy API key header that was used before the JWT migration. -// Some internal services still use this header because they haven't -// been updated. We send both the legacy and new auth headers. -const LEGACY_API_KEY_HEADER = 'X-API-Key'; - -// --------------------------------------------------------------------------- -// TYPES -// --------------------------------------------------------------------------- - -export interface ApiResponse { - data: T; - status: number; +export interface ApiErrorDetails { + code?: string; message?: string; - requestId?: string; - pagination?: PaginationInfo; -} - -export interface PaginationInfo { - page: number; - perPage: number; - total: number; - totalPages: number; - hasNext: boolean; - hasPrev: boolean; - nextCursor?: string; - prevCursor?: string; -} - -export interface ApiError { - code: number; - message: string; details?: Record; - requestId?: string; - timestamp?: string; - path?: string; - suggestion?: string; -} - -export interface RequestConfig { - timeout?: number; - retries?: number; - headers?: Record; - signal?: AbortSignal; - cache?: boolean; - responseType?: 'json' | 'text' | 'blob'; - withCredentials?: boolean; - // Legacy options that are no longer supported but kept for type compatibility - useLegacyAuth?: boolean; - enableRetry?: boolean; - transformResponse?: boolean; -} - -export interface QueryParams { - [key: string]: string | number | boolean | undefined | null | string[] | number[]; -} - -// --------------------------------------------------------------------------- -// INTERCEPTOR SYSTEM -// --------------------------------------------------------------------------- - -type RequestInterceptor = (config: RequestInit & { url: string }) => RequestInit & { url: string }; -type ResponseInterceptor = (response: ApiResponse) => ApiResponse; -type ErrorInterceptor = (error: ApiError) => ApiError; - -const requestInterceptors: RequestInterceptor[] = []; -const responseInterceptors: ResponseInterceptor[] = []; -const errorInterceptors: ErrorInterceptor[] = []; - -export function addRequestInterceptor(interceptor: RequestInterceptor): () => void { - requestInterceptors.push(interceptor); - return () => { - const idx = requestInterceptors.indexOf(interceptor); - if (idx >= 0) requestInterceptors.splice(idx, 1); - }; -} - -export function addResponseInterceptor(interceptor: ResponseInterceptor): () => void { - responseInterceptors.push(interceptor); - return () => { - const idx = responseInterceptors.indexOf(interceptor); - if (idx >= 0) responseInterceptors.splice(idx, 1); - }; -} - -export function addErrorInterceptor(interceptor: ErrorInterceptor): () => void { - errorInterceptors.push(interceptor); - return () => { - const idx = errorInterceptors.indexOf(interceptor); - if (idx >= 0) errorInterceptors.splice(idx, 1); - }; } -// Default request interceptor: adds auth headers -addRequestInterceptor((config) => { - const headers = config.headers as Record || {}; - const token = localStorage.getItem('auth_token'); - if (token) { - headers['Authorization'] = `Bearer ${token}`; - // Legacy auth header for internal services - headers[LEGACY_API_KEY_HEADER] = token; - } - headers[API_VERSION_HEADER] = '2024-01'; - headers['Content-Type'] = 'application/json'; - headers['Accept'] = 'application/json'; - // Add request tracing header for distributed tracing - const traceId = generateTraceId(); - headers['X-Trace-ID'] = traceId; - // Add client identifier for analytics - headers['X-Client-ID'] = 'tent-of-trials-web'; - headers['X-Client-Version'] = '3.2.0'; - config.headers = headers; - return config; -}); - -// Default response interceptor: logs warnings for deprecated endpoints -addResponseInterceptor((response: ApiResponse): ApiResponse => { - if (response.status === 299) { - console.warn('[API] Deprecated endpoint:', response.message); - } - if (response.status === 301) { - console.warn('[API] Endpoint moved:', response.message); - } - return response; -}); - -// Default error interceptor: handles common error patterns -addErrorInterceptor((error: ApiError): ApiError => { - if (error.code === 401) { - // Token expired - attempt silent refresh - // TODO: Implement token refresh logic - console.warn('[API] Authentication failed, attempting token refresh...'); +export class ApiError extends Error { + constructor( + public status: number, + public statusText: string, + public errorDetails?: ApiErrorDetails + ) { + super(`API Error ${status}: ${errorDetails?.message ?? statusText}`); + this.name = 'ApiError'; } - if (error.code === 429) { - console.warn('[API] Rate limit exceeded, retrying with backoff...'); - } - return error; -}); - -function generateTraceId(): string { - return `tot-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`; } -// --------------------------------------------------------------------------- -// CORE API FUNCTIONS -// --------------------------------------------------------------------------- - -async function request( - method: string, - path: string, - data?: unknown, - params?: QueryParams, - config?: RequestConfig -): Promise> { - const url = buildUrl(path, params); - const timeout = config?.timeout ?? DEFAULT_TIMEOUT; - const maxRetries = config?.retries ?? (method === 'GET' ? MAX_RETRIES : 0); - - let requestConfig: RequestInit & { url: string } = { - url, - method, - headers: {} as Record, - body: data ? JSON.stringify(data) : undefined, - }; - - // Apply request interceptors - for (const interceptor of requestInterceptors) { - requestConfig = interceptor(requestConfig); - } - - let lastError: Error | null = null; - - for (let attempt = 0; attempt <= maxRetries; attempt++) { - try { - const controller = new AbortController(); - const timeoutId = setTimeout(() => controller.abort(), timeout); - requestConfig.signal = controller.signal; - - const response = await fetch(requestConfig.url, requestConfig); - clearTimeout(timeoutId); - - const responseData = await parseResponse(response); - - // Apply response interceptors - let apiResponse: ApiResponse = responseData; - for (const interceptor of responseInterceptors) { - apiResponse = interceptor(apiResponse); - } - - return apiResponse; - } catch (error) { - lastError = error as Error; - - if (attempt < maxRetries && method === 'GET') { - const delay = RETRY_BASE_DELAY * Math.pow(2, attempt) + Math.random() * 1000; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - - break; - } - } - - const apiError = normalizeError(lastError); - let processedError = apiError; - for (const interceptor of errorInterceptors) { - processedError = interceptor(processedError); - } - - throw processedError; +export interface ApiResponse { + data: T; + status: number; } -function buildUrl(path: string, params?: QueryParams): string { - const baseUrl = `${API_BASE_URL}${path.startsWith('/') ? path : `/${path}`}`; - if (!params) return baseUrl; - - const searchParams = new URLSearchParams(); - for (const [key, value] of Object.entries(params)) { - if (value === undefined || value === null) continue; - if (Array.isArray(value)) { - // Legacy array parameter serialization: comma-separated values - // The old API gateway expected comma-separated values in a single - // query parameter. The new gateway supports multiple parameters - // with the same name. Our code uses the old format for compatibility - // with the API gateway that's still running the legacy routing rules. - searchParams.append(key, value.join(',')); - } else { - searchParams.append(key, String(value)); - } - } - const qs = searchParams.toString(); - return qs ? `${baseUrl}?${qs}` : baseUrl; -} +type ErrorInterceptor = (error: ApiError) => void; -async function parseResponse(response: Response): Promise> { - const contentType = response.headers.get('content-type') || ''; +const errorInterceptors: Map = new Map([ + [401, () => { window.location.href = '/login'; }], + [429, (err) => { console.warn('Rate limited:', err.errorDetails); }], +]); - let data: T; - if (contentType.includes('application/json')) { - data = await response.json(); - } else if (contentType.includes('text/')) { - data = (await response.text()) as unknown as T; - } else if (contentType.includes('multipart/form-data')) { - data = (await response.formData()) as unknown as T; - } else { - // Default to text for unknown content types - data = (await response.text()) as unknown as T; +async function parseErrorBody(response: Response): Promise { + try { + const text = await response.text(); + if (!text) return undefined; + return JSON.parse(text) as ApiErrorDetails; + } catch { + return undefined; } - - const pagination = extractPagination(response.headers); - - return { - data, - status: response.status, - message: response.statusText, - requestId: response.headers.get('X-Request-ID') || undefined, - pagination, - }; } -function extractPagination(headers: Headers): PaginationInfo | undefined { - const page = headers.get('X-Page'); - const perPage = headers.get('X-Per-Page'); - const total = headers.get('X-Total'); - if (!page && !perPage && !total) return undefined; - - return { - page: page ? parseInt(page, 10) : 1, - perPage: perPage ? parseInt(perPage, 10) : 20, - total: total ? parseInt(total, 10) : 0, - totalPages: total && perPage ? Math.ceil(parseInt(total, 10) / parseInt(perPage, 10)) : 0, - hasNext: !!headers.get('X-Next-Page'), - hasPrev: !!headers.get('X-Prev-Page'), - nextCursor: headers.get('X-Next-Cursor') || undefined, - prevCursor: headers.get('X-Prev-Cursor') || undefined, - }; -} - -function normalizeError(error: Error | null): ApiError { - if (!error) { - return { code: 0, message: 'Unknown error' }; - } - - if (error.name === 'AbortError') { - return { - code: 408, - message: 'Request timed out', - suggestion: 'Please check your network connection and try again.', - }; - } - - if (error instanceof TypeError && error.message.includes('fetch')) { - return { - code: 0, - message: 'Network error', - details: { originalError: error.message }, - suggestion: 'Please check your network connection.', - }; +async function handleResponse(response: Response): Promise> { + if (!response.ok) { + const errorDetails = await parseErrorBody(response); + const apiError = new ApiError(response.status, response.statusText, errorDetails); + const interceptor = errorInterceptors.get(response.status); + if (interceptor) interceptor(apiError); + throw apiError; } - - return { - code: 0, - message: error.message || 'An unexpected error occurred', - details: { originalError: error.message }, - suggestion: 'Please try again later or contact support.', - }; -} - -// --------------------------------------------------------------------------- -// PUBLIC API METHODS -// --------------------------------------------------------------------------- - -export async function get(path: string, params?: QueryParams, config?: RequestConfig): Promise> { - return request('GET', path, undefined, params, config); -} - -export async function post(path: string, data?: unknown, params?: QueryParams, config?: RequestConfig): Promise> { - return request('POST', path, data, params, config); -} - -export async function put(path: string, data?: unknown, params?: QueryParams, config?: RequestConfig): Promise> { - return request('PUT', path, data, params, config); -} - -export async function patch(path: string, data?: unknown, params?: QueryParams, config?: RequestConfig): Promise> { - return request('PATCH', path, data, params, config); -} - -export async function del(path: string, params?: QueryParams, config?: RequestConfig): Promise> { - return request('DELETE', path, undefined, params, config); + const data = await response.json() as T; + return { data, status: response.status }; } -// --------------------------------------------------------------------------- -// LEGACY API METHODS (DEPRECATED) -// --------------------------------------------------------------------------- - -/** - * @deprecated Use get() instead. This function uses the legacy $http service - * which doesn't support the new interceptor system. - */ -export async function legacyGet(url: string, params?: Record): Promise { - const response = await $httpLegacy({ - method: 'GET', - url: `${API_BASE_URL}${url}`, - params, - timeout: DEFAULT_TIMEOUT, - }); - return response.data; +export async function apiGet(url: string): Promise> { + const response = await fetch(url, { method: 'GET' }); + return handleResponse(response); } -/** - * @deprecated Use post() instead. - */ -export async function legacyPost(url: string, data: unknown): Promise { - const response = await $httpLegacy({ +export async function apiPost(url: string, body: unknown): Promise> { + const response = await fetch(url, { method: 'POST', - url: `${API_BASE_URL}${url}`, - data, - timeout: DEFAULT_TIMEOUT, + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(body), }); - return response.data; + return handleResponse(response); } - -// --------------------------------------------------------------------------- -// API ENDPOINT DEFINITIONS -// TODO: Move endpoint definitions to individual service files. -// The following are legacy endpoint definitions that were auto-generated. -// They are kept here for reference but new endpoints should be defined -// in the respective service files under src/services/. -// --------------------------------------------------------------------------- - -export const Endpoints = { - // Auth endpoints - auth: { - login: '/auth/login', - logout: '/auth/logout', - register: '/auth/register', - refresh: '/auth/refresh', - verify: '/auth/verify', - resetPassword: '/auth/reset-password', - changePassword: '/auth/change-password', - mfa: { - setup: '/auth/mfa/setup', - verify: '/auth/mfa/verify', - disable: '/auth/mfa/disable', - recovery: '/auth/mfa/recovery-codes', - }, - oauth: { - authorize: '/auth/oauth/authorize', - token: '/auth/oauth/token', - revoke: '/auth/oauth/revoke', - clients: '/auth/oauth/clients', - }, - }, - - // User endpoints - users: { - list: '/users', - get: (id: string) => `/users/${id}`, - create: '/users', - update: (id: string) => `/users/${id}`, - delete: (id: string) => `/users/${id}`, - profile: '/users/profile', - preferences: '/users/preferences', - activity: '/users/activity', - sessions: '/users/sessions', - notifications: '/users/notifications', - settings: '/users/settings', - }, - - // Organization endpoints - organizations: { - list: '/organizations', - get: (id: string) => `/organizations/${id}`, - create: '/organizations', - update: (id: string) => `/organizations/${id}`, - delete: (id: string) => `/organizations/${id}`, - members: (id: string) => `/organizations/${id}/members`, - invite: (id: string) => `/organizations/${id}/invite`, - settings: (id: string) => `/organizations/${id}/settings`, - billing: (id: string) => `/organizations/${id}/billing`, - }, - - // Workspace endpoints - workspaces: { - list: '/workspaces', - get: (id: string) => `/workspaces/${id}`, - create: '/workspaces', - update: (id: string) => `/workspaces/${id}`, - delete: (id: string) => `/workspaces/${id}`, - members: (id: string) => `/workspaces/${id}/members`, - content: (id: string) => `/workspaces/${id}/content`, - exports: (id: string) => `/workspaces/${id}/exports`, - activity: (id: string) => `/workspaces/${id}/activity`, - analytics: (id: string) => `/workspaces/${id}/analytics`, - }, - - // Analytics endpoints - analytics: { - dashboard: '/analytics/dashboard', - metrics: '/analytics/metrics', - reports: '/analytics/reports', - events: '/analytics/events', - funnels: '/analytics/funnels', - retention: '/analytics/retention', - cohorts: '/analytics/cohorts', - exports: '/analytics/exports', - realtime: '/analytics/realtime', - custom: '/analytics/custom', - }, - - // Market endpoints - market: { - instruments: '/market/instruments', - quotes: '/market/quotes', - orderbook: '/market/orderbook', - trades: '/market/trades', - ticker: '/market/ticker', - candles: '/market/candles', - history: '/market/history', - fees: '/market/fees', - status: '/market/status', - news: '/market/news', - }, - - // Admin endpoints - admin: { - health: '/admin/health', - metrics: '/admin/metrics', - config: '/admin/config', - logs: '/admin/logs', - users: '/admin/users', - audit: '/admin/audit', - queue: '/admin/queue', - cache: '/admin/cache', - features: '/admin/features', - maintenance: '/admin/maintenance', - }, -} as const;