Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
use nix cachix in ci (#2971)
Sean Ayeecdc26614d17
diff --git a/.github/actions/setup-rust/action.yml b/.github/actions/setup-rust/action.ymlindex 8b4692e009..721163c82d 100644--- a/.github/actions/setup-rust/action.yml+++ b/.github/actions/setup-rust/action.yml@@ -20,14 +20,6 @@ runs:run: |set -euo pipefail- # Rustup may be installed but missing from PATH if /etc/environment was overwritten- export PATH="$HOME/.cargo/bin:$PATH"- echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"-- if ! command -v rustup >/dev/null 2>&1; then- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal- fi-if [[ -f rust/rust-toolchain.toml ]]; thentoolchain="$(grep -E '^[[:space:]]*channel[[:space:]]*=' rust/rust-toolchain.toml | sed -E 's/.*"([^"]+)".*/\1/')"elsediff --git a/.github/workflows/build-rust-ci-image.yml b/.github/workflows/build-rust-ci-image.ymlindex cd5103e214..876c8a0f19 100644--- a/.github/workflows/build-rust-ci-image.yml+++ b/.github/workflows/build-rust-ci-image.yml@@ -79,10 +79,64 @@ jobs:sudo install -m 0755 "$tmp_dir/$basename/sccache" /usr/local/bin/sccachesccache --version+ - name: Install Nix+ shell: bash+ run: |+ set -euo pipefail+ curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | \+ sh -s -- install linux --no-confirm --init systemd \+ --extra-conf "experimental-features = nix-command flakes" \+ --extra-conf "trusted-users = root runner"+ # Daemon socket may be active but not reachable in this shell; ensure it.+ sudo systemctl enable --now nix-daemon.socket nix-daemon.service+ # Make nix discoverable in non-login shells (GHA default).+ echo 'PATH="/nix/var/nix/profiles/default/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"' \+ | sudo tee /etc/environment >/dev/null++ - name: Configure cachix substituter+ shell: bash+ env:+ CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}+ run: |+ set -euo pipefail+ export NIX_REMOTE=daemon+ export PATH="/nix/var/nix/profiles/default/bin:$PATH"+ nix profile add nixpkgs#cachix+ cachix authtoken "$CACHIX_AUTH_TOKEN"+ cachix use macro-inc++ - name: Materialize dev shell into /nix/store+ shell: bash+ run: |+ set -euo pipefail+ export NIX_REMOTE=daemon+ export PATH="/nix/var/nix/profiles/default/bin:$PATH"+ sudo mkdir -p /var/cache/nix+ sudo chown runner:runner /var/cache/nix+ nix develop --profile /var/cache/nix/dev-shell --command true++ - name: Write image markers+ shell: bash+ env:+ BUILD_RUN_ID: ${{ github.run_id }}+ BUILD_SHA: ${{ github.sha }}+ run: |+ set -euo pipefail+ marker="run_id=${BUILD_RUN_ID} sha=${BUILD_SHA} ts=$(date -u +%FT%TZ)"+ # Write to multiple locations to learn which the snapshot preserves.+ echo "$marker" | sudo tee /opt/macro-ami-marker.txt >/dev/null+ echo "$marker" | sudo tee /etc/macro-ami-marker.txt >/dev/null+ echo "$marker" | sudo tee /usr/local/share/macro-ami-marker.txt >/dev/null+ echo "$marker" > /home/runner/macro-ami-marker.txt+ # Also drop a sentinel inside /nix so we can tell if the whole tree was wiped.+ echo "$marker" | sudo tee /nix/macro-ami-marker.txt >/dev/null+- name: Verify image contentsshell: bashrun: |set -euo pipefail+ export NIX_REMOTE=daemon+ export PATH="/nix/var/nix/profiles/default/bin:$PATH"rustc --versioncargo --versioncargo clippy --version@@ -92,3 +146,5 @@ jobs:sqlx --versionsccache --versionld.lld --version+ nix --version+ test -L /var/cache/nix/dev-shelldiff --git a/.github/workflows/code-check-cloud-storage.yml b/.github/workflows/code-check-cloud-storage.ymlindex 96a225508e..4ca030c282 100644--- a/.github/workflows/code-check-cloud-storage.yml+++ b/.github/workflows/code-check-cloud-storage.yml@@ -34,7 +34,8 @@ jobs:should_run:- 'rust/cloud-storage/**'- 'rust/rust-toolchain.toml'- - '.github/actions/setup-rust/**'+ - 'flake.nix'+ - 'flake.lock'- '.github/actions/setup-sccache/**'- .github/workflows/code-check-cloud-storage.yml- name: compute nextest package filter@@ -59,7 +60,7 @@ jobs:printf '%s\n' "$changed_files" > /tmp/changed-files# Root cargo/toolchain/CI changes can affect the whole workspace, so run all tests.- if printf '%s\n' "$changed_files" | grep -qE '^(rust/rust-toolchain\.toml|rust/cloud-storage/Cargo\.(toml|lock)|rust/cloud-storage/\.cargo/.*|\.github/actions/(setup-rust|setup-sccache)/.*|\.github/workflows/code-check-cloud-storage\.yml)$'; then+ if printf '%s\n' "$changed_files" | grep -qE '^(rust/rust-toolchain\.toml|flake\.nix|flake\.lock|rust/cloud-storage/Cargo\.(toml|lock)|rust/cloud-storage/\.cargo/.*|\.github/actions/(setup-rust|setup-sccache)/.*|\.github/workflows/code-check-cloud-storage\.yml)$'; thenecho "Workspace-level change detected; running all tests"echo "nextest_filter=" >> "$GITHUB_OUTPUT"exit 0@@ -70,16 +71,16 @@ jobs:import globimport refrom pathlib import Path-+repo = Path.cwd().resolve()workspace = repo / 'rust' / 'cloud-storage'changed_files = [line for line in Path('/tmp/changed-files').read_text().splitlines() if line]-+def workspace_members(manifest: Path) -> list[str]:members = []in_workspace = Falsein_members = False-+for raw_line in manifest.read_text().splitlines():line = raw_line.split('#', 1)[0].strip()if not line:@@ -96,7 +97,7 @@ jobs:if ']' in line:in_members = Falsereturn members-+def package_name(manifest: Path) -> str | None:in_package = Falsefor raw_line in manifest.read_text().splitlines():@@ -111,7 +112,7 @@ jobs:if match:return match.group(1)return None-+packages = []for member in workspace_members(workspace / 'Cargo.toml'):for member_dir in glob.glob(str(workspace / member)):@@ -121,13 +122,13 @@ jobs:name = package_name(manifest)if name:packages.append((manifest.parent.resolve(), name))-+changed_packages = set()for changed_file in changed_files:path = (repo / changed_file).resolve()if path != workspace and workspace not in path.parents:continue-+matching_packages = [(manifest_dir, name)for manifest_dir, name in packages@@ -136,7 +137,7 @@ jobs:if matching_packages:_, name = max(matching_packages, key=lambda item: len(item[0].parts))changed_packages.add(name)-+def escape_nextest_name(name: str) -> str:return (name@@ -144,7 +145,7 @@ jobs:.replace(')', '\\)').replace(',', '\\,'))-+if changed_packages:print('|'.join(f'rdeps(={escape_nextest_name(name)})' for name in sorted(changed_packages)))PY@@ -162,34 +163,51 @@ jobs:if: needs.path-check.outputs.should_run == 'true' && github.event.pull_request.draft == falseruns-on: linux-extra-beefyenv:- RUSTFLAGS: "-Dwarnings -C link-arg=-fuse-ld=lld"+ RUSTFLAGS: "-Dwarnings -C link-arg=-fuse-ld=mold"RUSTDOCFLAGS: "-Dwarnings"- SQLX_OFFLINE: truesteps:- uses: actions/checkout@v6with:clean: false- - uses: ./.github/actions/setup-rust+ - name: Add Nix to PATH+ run: echo "/nix/var/nix/profiles/default/bin" >> "$GITHUB_PATH"+ - name: Enter Nix dev shell+ run: |+ set -euo pipefail+ nix print-dev-env --accept-flake-config > /tmp/dev-env+ echo "BASH_ENV=/tmp/dev-env" >> "$GITHUB_ENV"+ source /tmp/dev-env+ printf '%s\n' "$PATH" | tr ':' '\n' >> "$GITHUB_PATH"+ - uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6+ with:+ workspaces: rust/cloud-storage+ shared-key: cloud-storage-check+ cache-on-failure: true+ cache-targets: false+ - name: Configure sccache S3 backendenv:SCCACHE_BUCKET: ${{ vars.SCCACHE_BUCKET || secrets.SCCACHE_BUCKET }}- - name: setup lldrun: |- if ! command -v ld.lld >/dev/null 2>&1; then- sudo apt-get update- sudo apt-get install -y lld- fi- ld.lld --version+ set -euo pipefail+ mkdir -p "$HOME/.cache/sccache"+ {+ echo "SCCACHE_DIR=$HOME/.cache/sccache"+ echo "SCCACHE_CACHE_SIZE=5G"+ echo "SCCACHE_BASEDIR=${GITHUB_WORKSPACE:-$PWD}"+ if [ -n "${SCCACHE_BUCKET:-}" ]; then+ echo "SCCACHE_BUCKET=${SCCACHE_BUCKET}"+ echo "SCCACHE_REGION=${SCCACHE_REGION:-us-east-1}"+ echo "SCCACHE_S3_KEY_PREFIX=${SCCACHE_S3_KEY_PREFIX:-sccache/}"+ fi+ } >> "$GITHUB_ENV"+ sccache --version- name: fmt- run: |- cd rust/cloud-storage- cargo fmt --check+ run: cd rust/cloud-storage && cargo fmt --check- name: clippyenv:AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID || secrets.AWS_ACCESS_KEY }}AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}- run: |- cd rust/cloud-storage- cargo clippy --all-features+ run: cd rust/cloud-storage && cargo clippy --all-features- name: show sccache statsif: always()env:@@ -204,6 +222,7 @@ jobs:env:NEXTEST_FILTER: ${{ needs.path-check.outputs.nextest_filter }}NEXTEST_TEST_THREADS: '32'+ RUSTFLAGS: "-Dwarnings -C link-arg=-fuse-ld=mold"services:postgres:image: postgres:16@@ -224,44 +243,38 @@ jobs:- uses: actions/checkout@v6with:clean: false- - uses: ./.github/actions/setup-rust- env:- SCCACHE_BUCKET: ${{ vars.SCCACHE_BUCKET || secrets.SCCACHE_BUCKET }}- - name: setup lld+ - name: Add Nix to PATH+ run: echo "/nix/var/nix/profiles/default/bin" >> "$GITHUB_PATH"+ - name: Enter Nix dev shellrun: |- if ! command -v ld.lld >/dev/null 2>&1; then- sudo apt-get update- sudo apt-get install -y lld- fi- ld.lld --version- - uses: actions/cache@v4+ set -euo pipefail+ nix print-dev-env --accept-flake-config > /tmp/dev-env+ echo "BASH_ENV=/tmp/dev-env" >> "$GITHUB_ENV"+ source /tmp/dev-env+ printf '%s\n' "$PATH" | tr ':' '\n' >> "$GITHUB_PATH"+ - uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6with:- path: |- ~/.cargo/registry/index/- ~/.cargo/registry/cache/- ~/.cargo/git/db/- key: ${{ runner.os }}-cargo-${{ hashFiles('rust/cloud-storage/Cargo.lock') }}- restore-keys: |- ${{ runner.os }}-cargo-- - name: check cargo-nextest- id: check-cargo-nextest- run: |- if command -v cargo-nextest >/dev/null 2>&1; then- echo "installed=true" >> "$GITHUB_OUTPUT"- cargo nextest --version- else- echo "installed=false" >> "$GITHUB_OUTPUT"- fi- - name: install cargo-nextest- if: steps.check-cargo-nextest.outputs.installed != 'true'- uses: taiki-e/install-action@e32179aa3c2a47939bd07439bd80ddf13f99979f- - name: install dependencies+ workspaces: rust/cloud-storage+ shared-key: cloud-storage-test+ cache-on-failure: true+ cache-targets: false+ - name: Configure sccache S3 backendenv:- AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID || secrets.AWS_ACCESS_KEY }}- AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}+ SCCACHE_BUCKET: ${{ vars.SCCACHE_BUCKET || secrets.SCCACHE_BUCKET }}run: |- command -v just || cargo install just --locked- command -v sqlx || cargo install sqlx-cli --locked+ set -euo pipefail+ mkdir -p "$HOME/.cache/sccache"+ {+ echo "SCCACHE_DIR=$HOME/.cache/sccache"+ echo "SCCACHE_CACHE_SIZE=5G"+ echo "SCCACHE_BASEDIR=${GITHUB_WORKSPACE:-$PWD}"+ if [ -n "${SCCACHE_BUCKET:-}" ]; then+ echo "SCCACHE_BUCKET=${SCCACHE_BUCKET}"+ echo "SCCACHE_REGION=${SCCACHE_REGION:-us-east-1}"+ echo "SCCACHE_S3_KEY_PREFIX=${SCCACHE_S3_KEY_PREFIX:-sccache/}"+ fi+ } >> "$GITHUB_ENV"+ sccache --version- name: configure postgres for concurrent testsrun: |postgres_container="$(docker ps --format '{{.ID}} {{.Image}}' | awk '$2 == "postgres:16" { print $1; exit }')"@@ -277,9 +290,7 @@ jobs:sleep 1done- name: prepare tests- run: |- just rust/cloud-storage/setup_test_envs- just rust/cloud-storage/initialize_dbs+ run: just rust/cloud-storage/setup_test_envs && just rust/cloud-storage/initialize_dbs- name: run testsenv:AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID || secrets.AWS_ACCESS_KEY }}@@ -291,7 +302,6 @@ jobs:if [ -n "$NEXTEST_FILTER" ]; thenargs+=(-E "$NEXTEST_FILTER")fi-cargo nextest run "${args[@]}"- name: show sccache statsif: always()diff --git a/.github/workflows/web-app-check-main.yml b/.github/workflows/web-app-check-main.ymlindex 031f2f5c85..4f8246bae0 100644--- a/.github/workflows/web-app-check-main.yml+++ b/.github/workflows/web-app-check-main.yml@@ -169,4 +169,3 @@ jobs:fiecho "✅ All jobs passed or were skipped"-diff --git a/.gitignore b/.gitignoreindex f297dd0cac..8212f774b6 100644--- a/.gitignore+++ b/.gitignore@@ -9,3 +9,5 @@ temp/.env.localrun-local.fish**/node_modules+**/result+**/result-*diff --git a/flake.lock b/flake.lockindex 94559a65c0..d4f9839c3a 100644--- a/flake.lock+++ b/flake.lock@@ -1,5 +1,20 @@{"nodes": {+ "crane": {+ "locked": {+ "lastModified": 1777335812,+ "narHash": "sha256-bEg5xoAxAwsyfnGhkEX7RJViTIBIYPd8ISg4O1c0HFc=",+ "owner": "ipetkov",+ "repo": "crane",+ "rev": "5e0fb2f64edff2822249f21293b8304dedaaf676",+ "type": "github"+ },+ "original": {+ "owner": "ipetkov",+ "repo": "crane",+ "type": "github"+ }+ },"fenix": {"inputs": {"nixpkgs": [@@ -57,9 +72,28 @@},"root": {"inputs": {+ "crane": "crane","fenix": "fenix","flake-utils": "flake-utils",- "nixpkgs": "nixpkgs"+ "nixpkgs": "nixpkgs",+ "rs-libreoffice-bindings": "rs-libreoffice-bindings"+ }+ },+ "rs-libreoffice-bindings": {+ "flake": false,+ "locked": {+ "lastModified": 1777577693,+ "narHash": "sha256-lx/AuxPpCarxdDzogkGudCbE4B2OEt5un4s4gIFt1ek=",+ "owner": "macro-inc",+ "repo": "rs-libreoffice-bindings",+ "rev": "056a40ddfac1d9650be30b9f0b4b934e9266c7dc",+ "type": "github"+ },+ "original": {+ "owner": "macro-inc",+ "ref": "dev",+ "repo": "rs-libreoffice-bindings",+ "type": "github"}},"rust-analyzer-src": {diff --git a/flake.nix b/flake.nixindex a5b13d3781..9af63488ee 100644--- a/flake.nix+++ b/flake.nix@@ -4,6 +4,9 @@flake-utils.url = "github:numtide/flake-utils";fenix.url = "github:nix-community/fenix";fenix.inputs.nixpkgs.follows = "nixpkgs";+ crane.url = "github:ipetkov/crane";+ rs-libreoffice-bindings.url = "github:macro-inc/rs-libreoffice-bindings/dev";+ rs-libreoffice-bindings.flake = false;};outputs ={@@ -11,6 +14,8 @@nixpkgs,flake-utils,fenix,+ crane,+ rs-libreoffice-bindings,}:flake-utils.lib.eachDefaultSystem (system:@@ -20,51 +25,23 @@};isDarwin = pkgs.stdenv.isDarwin;isLinux = pkgs.stdenv.isLinux;- packages = with pkgs; [- parallel- docker-compose- zip- cargo-info- cargo-udeps- cargo-lambda- cargo-deny- cargo-nextest- cargo-expand- wasm-pack- pkg-config- bacon- just- just-lsp- taplo- bun- pnpm- sqlx-cli- typescript-language-server- nodejs_24- pulumi- pulumiPackages.pulumi-nodejs- sops- biome- jq- stripe-cli- (- with fenix.packages.${system};- combine [- complete.rustc- complete.rust-src- complete.cargo- complete.clippy- complete.rustfmt- complete.rust-analyzer- targets.wasm32-unknown-unknown.latest.rust-std- ]- )- ];++ # ── cloud-storage (Rust backend) ──────────────────────────────++ rustToolchain = fenix.packages.${system}.fromToolchainFile {+ file = ./rust/rust-toolchain.toml;+ sha256 = "sha256-qqF33vNuAdU5vua96VKVIwuc43j4EFeEXbjQ6+l4mO4=";+ };++ craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;+libraries =with pkgs;[openssl+ openssl.devglib+ glib.devlibclang]++ pkgs.lib.optionals isLinux [@@ -74,20 +51,375 @@++ pkgs.lib.optionals isDarwin [libiconv];- in- {- devShell = pkgs.mkShell (++ # Include Cargo sources plus the .sqlx offline query cache.+ # rs-libreoffice-bindings lives outside the repo; we import it explicitly+ # so the nix sandbox can resolve the path dep in convert_service.+ src =+ let+ sqlxFilter = path: _type: builtins.match ".*\\.sqlx/.*\\.json$" path != null;+ pdfiumFilter = path: _type: builtins.match ".*pdfium-lib/.*\\.(so|dylib)$" path != null;+ assetFilter = path: _type: builtins.match ".*\\.(md|html|txt|json|canvas|sql)$" path != null;+ srcFilter = path: type: (sqlxFilter path type) || (pdfiumFilter path type) || (assetFilter path type) || (craneLib.filterCargoSources path type);+ cloudStorageSrc = pkgs.lib.cleanSourceWith {+ src = ./rust/cloud-storage;+ filter = srcFilter;+ };+ cSourceFilter = path: _type: builtins.match ".*\\.(c|h)$" path != null;+ libreofficeBindingsSrc = pkgs.lib.cleanSourceWith {+ src = rs-libreoffice-bindings;+ filter = path: type: (cSourceFilter path type) || (craneLib.filterCargoSources path type);+ };+ in+ pkgs.runCommand "cloud-storage-src" { } ''+ cp -rT ${cloudStorageSrc} $out+ chmod -R +w $out+ cp -rT ${libreofficeBindingsSrc} $out/rs-libreoffice-bindings+ '';++ commonArgs ={- buildInputs = packages ++ libraries;- PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";+ inherit src;+ pname = "cloud-storage";+ version = "0.1.0";+ strictDeps = true;+ buildInputs = libraries;+ nativeBuildInputs = with pkgs; [ pkg-config ] ++ pkgs.lib.optionals isLinux [ mold ];LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";- SOPS_KMS_ARN = "arn:aws:kms:us-east-1:569036502058:key/mrk-cab29bf948044eb79005a81f48d40e93,arn:aws:kms:us-west-1:569036502058:key/mrk-cab29bf948044eb79005a81f48d40e93";+ OPENSSL_NO_VENDOR = "1";+ SQLX_OFFLINE = "true";+ RUSTFLAGS = pkgs.lib.optionalString isLinux "-C link-arg=-fuse-ld=mold";+ # Build deps + workspace + bins in dev profile so the test job (which runs+ # `cargo nextest` outside the sandbox using the test profile, inheriting dev)+ # can reuse the restored target/debug/ instead of recompiling all deps.+ CARGO_PROFILE = "dev";}// pkgs.lib.optionalAttrs isLinux {LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath libraries}";BINDGEN_EXTRA_CLANG_ARGS = "-I${pkgs.glibc.dev}/include -I${pkgs.gcc.cc}/lib/gcc/${pkgs.stdenv.hostPlatform.config}/${pkgs.gcc.version}/include";+ };++ # Pre-built third-party deps — Cachix caches this; hash is driven by Cargo.lock+ # (workspace member sources are stubbed by crane), so it survives most PRs.+ # --all-features matches the test job (cargo nextest --all-features) and clippy+ # so all consumers share the same dep feature unification.+ cargoArtifacts = craneLib.buildDepsOnly (+ commonArgs+ // {+ cargoExtraArgs = "--locked --all-features";+ }+ );++ # Layered atop cargoArtifacts: pre-compile every workspace lib crate so+ # downstream derivations (openApiBins, clippy) inherit a warm target/. The+ # hash is per-source so cachix only hits when the SHA matches across CI+ # workflows — but since code-check-cloud-storage and web-app-check-main both+ # run on the same SHA, whichever finishes first pushes for the other.+ workspaceArtifacts = craneLib.cargoBuild (+ commonArgs+ // {+ inherit cargoArtifacts;+ pname = "cloud-storage-workspace";+ doCheck = false;+ doInstallCargoArtifacts = true;+ cargoExtraArgs = "--locked --all-features --workspace --lib";+ RUSTFLAGS = "-Dwarnings" + pkgs.lib.optionalString isLinux " -C link-arg=-fuse-ld=mold";+ RUSTDOCFLAGS = "-Dwarnings";});++ openApiBins = craneLib.buildPackage (+ commonArgs+ // {+ cargoArtifacts = workspaceArtifacts;+ pname = "cloud-storage-openapi";+ doCheck = false;+ cargoExtraArgs = pkgs.lib.concatStringsSep " " [+ "--locked"+ "--all-features"+ "--bin document_storage_service_openapi"+ "--bin comms_service_openapi"+ "--bin properties_service_openapi"+ "--bin document_cognition_service_openapi"+ "--bin authentication_service_openapi"+ "--bin notification_service_openapi"+ "--bin static_file_service_openapi"+ "--bin connection_gateway_openapi"+ "--bin contacts_service_openapi"+ "--bin unfurl_service_openapi"+ "--bin email_service_openapi"+ "--bin search_service_openapi"+ "--bin scheduled_action_openapi"+ "--bin document_cognition_service_models"+ "--bin gen_tool_schemas"+ ];+ }+ );++ # Pre-built nextest archive — packages all compiled test binaries plus their+ # metadata into a single tar.zst. CI fetches this archive and runs+ # `cargo nextest run --archive-file` outside the sandbox so tests can hit+ # postgres/redis services. Built in nix → cached by cachix.+ nextestArchive = craneLib.mkCargoDerivation (+ commonArgs+ // {+ cargoArtifacts = workspaceArtifacts;+ pname = "cloud-storage-nextest-archive";+ doCheck = false;+ nativeBuildInputs = commonArgs.nativeBuildInputs or [ ] ++ [ pkgs.cargo-nextest ];+ buildPhaseCargoCommand = ''+ cargo nextest archive \+ --cargo-profile dev \+ --locked --all-features \+ --workspace --lib --bins --tests \+ --archive-file nextest-archive.tar.zst+ '';+ installPhaseCommand = ''+ mkdir -p $out+ cp nextest-archive.tar.zst $out/+ '';+ }+ );++ shellTools =+ with pkgs;+ [+ parallel+ docker-compose+ zip+ cargo-info+ cargo-udeps+ cargo-lambda+ (writeShellScriptBin "rustup" ''+ set -euo pipefail+ rustc_path="$(${coreutils}/bin/readlink -f "$(command -v rustc)")"+ toolchain="$(${coreutils}/bin/basename "$(${coreutils}/bin/dirname "$(${coreutils}/bin/dirname "$rustc_path")")")"+ case "$1 $2" in+ "toolchain list") echo "$toolchain (default)" ;;+ "toolchain add") exit 0 ;;+ "target list") echo "x86_64-unknown-linux-gnu (installed)"; echo "aarch64-unknown-linux-gnu" ;;+ "target add") exit 0 ;;+ "component list") echo "rust-src-x86_64-unknown-linux-gnu (installed)"; echo "clippy-x86_64-unknown-linux-gnu (installed)" ;;+ "component add") exit 0 ;;+ *) echo "rustup shim only supports commands used by cross" >&2; exit 1 ;;+ esac+ '')+ cargo-cross+ cargo-deny+ cargo-nextest+ cargo-expand+ wasm-pack+ pkg-config+ bacon+ just+ just-lsp+ taplo+ bun+ pnpm+ sqlx-cli+ typescript-language-server+ nodejs_24+ pulumi+ pulumiPackages.pulumi-nodejs+ sops+ biome+ jq+ stripe-cli+ sccache+ rustToolchain+ ]+ ++ pkgs.lib.optionals isLinux [ mold ];++ # ── js-app (frontend Tauri app) ────────────────────────────────++ # Need allowUnfree + android license for the Android SDK+ jsPkgs = import nixpkgs {+ inherit system;+ config.allowUnfree = true;+ config.android_sdk.accept_license = true;+ };++ android_sdk = pkgs.lib.optionalAttrs isLinux (+ (jsPkgs.androidenv.composeAndroidPackages {+ platformVersions = [+ "34"+ "36"+ ];+ buildToolsVersions = [+ "35.0.0"+ ];+ ndkVersions = [ "26.3.11579264" ];+ includeNDK = true;+ useGoogleAPIs = false;+ useGoogleTVAddOns = false;+ includeEmulator = true;+ includeSystemImages = true;+ systemImageTypes = [ "google_apis_playstore" ];+ abiVersions = [ "x86_64" ];+ includeSources = false;+ }).androidsdk+ );++ jsBasePackages = with jsPkgs; [+ curl+ wget+ pkg-config+ just+ bun+ biome+ nodejs_24+ typescript-language-server+ cargo-tauri+ cargo-info+ cargo-udeps+ pulumi+ pulumiPackages.pulumi-nodejs+ pulumiPackages.pulumi-aws-native+ playwright+ playwright-mcp+ (+ with fenix.packages.${system};+ combine (+ [+ complete.rustc+ complete.rust-src+ complete.cargo+ complete.clippy+ complete.rustfmt+ complete.rust-analyzer+ ]+ ++ pkgs.lib.optionals isLinux [+ targets.aarch64-linux-android.latest.rust-std+ targets.armv7-linux-androideabi.latest.rust-std+ targets.i686-linux-android.latest.rust-std+ targets.x86_64-linux-android.latest.rust-std+ ]+ )+ )+ ];++ jsLinuxPackages = with jsPkgs; [+ gst_all_1.gstreamer+ gst_all_1.gst-plugins-base+ gst_all_1.gst-plugins-good+ gst_all_1.gst-plugins-bad+ jdk+ xdg-utils+ ];++ jsPackages = jsBasePackages ++ pkgs.lib.optionals isLinux (jsLinuxPackages ++ [ android_sdk ]);++ jsLinuxLibraries = with jsPkgs; [+ gtk3+ libsoup_3+ webkitgtk_4_1+ cairo+ gdk-pixbuf+ glib+ dbus+ openssl+ librsvg+ lsb-release+ ];++ jsDarwinLibraries = with jsPkgs; [+ openssl+ libiconv+ ];++ jsLibraries = if isDarwin then jsDarwinLibraries else jsLinuxLibraries;+ in+ {+ checks = {+ fmt = craneLib.cargoFmt {+ inherit src;+ pname = "cloud-storage";+ version = "0.1.0";+ };+ clippy = craneLib.cargoClippy (+ commonArgs+ // {+ cargoArtifacts = workspaceArtifacts;+ cargoClippyExtraArgs = "--all-features -- -D warnings";+ RUSTDOCFLAGS = "-Dwarnings";+ }+ );+ gen-api =+ let+ openApiFiles = pkgs.lib.cleanSourceWith {+ src = ./js/app/packages/service-clients;+ filter = path: type:+ type == "directory" || pkgs.lib.hasSuffix "openapi.json" (baseNameOf path);+ };+ crateToDir = {+ document_storage_service = "service-storage";+ comms_service = "service-comms";+ properties_service = "service-properties";+ document_cognition_service = "service-cognition";+ authentication_service = "service-auth";+ notification_service = "service-notification";+ static_file_service = "service-static-files";+ connection_gateway = "service-connection";+ contacts_service = "service-contacts";+ unfurl_service = "service-unfurl";+ email_service = "service-email";+ search_service = "service-search";+ scheduled_action = "service-scheduled-action";+ };+ checkScript = pkgs.lib.concatStringsSep "\n" (+ pkgs.lib.mapAttrsToList (crate: dir: ''+ echo -n "Checking ${dir}/openapi.json ... "+ if ! diff \+ <("${openApiBins}/bin/${crate}_openapi" | ${pkgs.jq}/bin/jq --sort-keys .) \+ <(${pkgs.jq}/bin/jq --sort-keys . < "${openApiFiles}/${dir}/openapi.json"); then+ echo "FAIL: run 'bun run gen-api' and commit the result"+ exit 1+ fi+ echo "ok"+ '') crateToDir+ );+ in+ pkgs.runCommand "cloud-storage-gen-api-check" { RUST_LOG = "error"; } ''+ ${checkScript}+ touch $out+ '';+ };++ packages = {+ inherit cargoArtifacts workspaceArtifacts openApiBins nextestArchive;+ default = cargoArtifacts;+ };++ devShells = {+ default = pkgs.mkShell (+ {+ buildInputs = shellTools ++ libraries;+ PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";+ LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";+ SOPS_KMS_ARN = "arn:aws:kms:us-east-1:569036502058:key/mrk-cab29bf948044eb79005a81f48d40e93,arn:aws:kms:us-west-1:569036502058:key/mrk-cab29bf948044eb79005a81f48d40e93";+ RUSTC_WRAPPER = "${pkgs.sccache}/bin/sccache";+ }+ // pkgs.lib.optionalAttrs isLinux {+ LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath libraries}";+ BINDGEN_EXTRA_CLANG_ARGS = "-I${pkgs.glibc.dev}/include -I${pkgs.gcc.cc}/lib/gcc/${pkgs.stdenv.hostPlatform.config}/${pkgs.gcc.version}/include";+ }+ );++ js-app = jsPkgs.mkShell (+ {+ buildInputs = jsPackages ++ jsLibraries;+ PKG_CONFIG_PATH = "${jsPkgs.openssl.dev}/lib/pkgconfig";+ }+ // pkgs.lib.optionalAttrs isLinux {+ LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath jsLibraries}:$LD_LIBRARY_PATH";+ XDG_DATA_DIRS = "${jsPkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${jsPkgs.gsettings-desktop-schemas.name}:${jsPkgs.gtk3}/share/gsettings-schemas/${jsPkgs.gtk3.name}:$XDG_DATA_DIRS";+ ANDROID_HOME = "${android_sdk}/libexec/android-sdk";+ NDK_HOME = "${android_sdk}/libexec/android-sdk/ndk/26.3.11579264";+ GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${android_sdk}/libexec/android-sdk/build-tools/35.0.0/aapt2";+ GIO_MODULE_DIR = "${jsPkgs.glib-networking}/lib/gio/modules/";+ }+ );+ };});}diff --git a/js/app/flake.nix b/js/app/flake.nixdeleted file mode 100644index e5d761245c..0000000000--- a/js/app/flake.nix+++ /dev/null@@ -1,135 +0,0 @@-{- inputs = {- nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";- flake-utils.url = "github:numtide/flake-utils";- fenix.url = "github:nix-community/fenix";- fenix.inputs.nixpkgs.follows = "nixpkgs";- };-- outputs =- {- self,- nixpkgs,- flake-utils,- fenix,- }:- flake-utils.lib.eachDefaultSystem (- system:- let- pkgs = import nixpkgs {- system = system;- config.allowUnfree = true;- config.android_sdk.accept_license = true;- };-- isDarwin = pkgs.stdenv.isDarwin;- isLinux = pkgs.stdenv.isLinux;-- android_sdk = pkgs.lib.optionalAttrs isLinux (- (pkgs.androidenv.composeAndroidPackages {- platformVersions = [- "34"- "36"- ];- buildToolsVersions = [- "35.0.0"- ];- ndkVersions = [ "26.3.11579264" ];- includeNDK = true;- useGoogleAPIs = false;- useGoogleTVAddOns = false;- includeEmulator = true;- includeSystemImages = true;- systemImageTypes = [ "google_apis_playstore" ];- abiVersions = [ "x86_64" ];- includeSources = false;- }).androidsdk- );-- basePackages = with pkgs; [- curl- wget- pkg-config- just- bun- biome- nodejs_24- typescript-language-server- cargo-tauri- cargo-info- cargo-udeps- pulumi- pulumiPackages.pulumi-nodejs- pulumiPackages.pulumi-aws-native- playwright- playwright-mcp- (- with fenix.packages.${system};- combine (- [- complete.rustc- complete.rust-src- complete.cargo- complete.clippy- complete.rustfmt- complete.rust-analyzer- ]- ++ pkgs.lib.optionals isLinux [- targets.aarch64-linux-android.latest.rust-std- targets.armv7-linux-androideabi.latest.rust-std- targets.i686-linux-android.latest.rust-std- targets.x86_64-linux-android.latest.rust-std- ]- )- )- ];-- linuxPackages = with pkgs; [- gst_all_1.gstreamer- gst_all_1.gst-plugins-base- gst_all_1.gst-plugins-good- gst_all_1.gst-plugins-bad- jdk- xdg-utils- ];-- packages = basePackages ++ pkgs.lib.optionals isLinux (linuxPackages ++ [ android_sdk ]);-- linuxLibraries = with pkgs; [- gtk3- libsoup_3- webkitgtk_4_1- cairo- gdk-pixbuf- glib- dbus- openssl- librsvg- lsb-release- ];-- darwinLibraries = with pkgs; [- openssl- libiconv- ];-- libraries = if isDarwin then darwinLibraries else linuxLibraries;- in- {- devShell = pkgs.mkShell (- {- buildInputs = packages ++ libraries;- PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";- }- // pkgs.lib.optionalAttrs isLinux {- LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath libraries}:$LD_LIBRARY_PATH";- XDG_DATA_DIRS = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS";- ANDROID_HOME = "${android_sdk}/libexec/android-sdk";- NDK_HOME = "${android_sdk}/libexec/android-sdk/ndk/26.3.11579264";- GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${android_sdk}/libexec/android-sdk/build-tools/35.0.0/aapt2";- GIO_MODULE_DIR = "${pkgs.glib-networking}/lib/gio/modules/";- }- );- }- );-}diff --git a/js/app/packages/block-chat/README.md b/js/app/packages/block-chat/README.mdindex 0ea21a3f65..c20490b433 100644--- a/js/app/packages/block-chat/README.md+++ b/js/app/packages/block-chat/README.md@@ -1,5 +1,7 @@# chat-block+This package is part of the Macro frontend workspace.+To install dependencies:```bashdiff --git a/js/app/scripts/generate-api-schema.ts b/js/app/scripts/generate-api-schema.tsindex b5804d2280..4a09420b79 100644--- a/js/app/scripts/generate-api-schema.ts+++ b/js/app/scripts/generate-api-schema.ts@@ -67,12 +67,9 @@ async function runBinary(binaryName: string,rustCloudStorageDir = getRustCloudStorageDir(),): Promise<string> {- const binaryPath = path.join(- rustCloudStorageDir,- "target",- "debug",- binaryName,- );+ const binaryPath = process.env.OPENAPI_BINS_DIR+ ? path.join(process.env.OPENAPI_BINS_DIR, binaryName)+ : path.join(rustCloudStorageDir, "target", "debug", binaryName);const proc = Bun.spawn([binaryPath], { stdout: "pipe", stderr: "pipe" });const TIMEOUT_SENTINEL = Symbol("timeout");let timeout: ReturnType<typeof setTimeout> | undefined;@@ -224,10 +221,14 @@ async function main() {console.log(`\nProcessing ${servicesToProcess.length} service(s)...\n`);- // Phase 1: Build all binaries in a single cargo invocation (parallelized by cargo)+ // Phase 1: Build all binaries (skipped when OPENAPI_BINS_DIR is set)const buildStart = performance.now();- await buildOpenApiBinaries(crateNames);- console.log(`Phase 1 (cargo build) total: ${elapsed(buildStart)}`);+ if (process.env.OPENAPI_BINS_DIR) {+ console.log(`Phase 1 (cargo build) skipped — using OPENAPI_BINS_DIR=${process.env.OPENAPI_BINS_DIR}`);+ } else {+ await buildOpenApiBinaries(crateNames);+ console.log(`Phase 1 (cargo build) total: ${elapsed(buildStart)}`);+ }// Phase 2: Run binaries and generate TypeScript in parallelconsole.log("\nGenerating TypeScript clients...\n");diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lockindex 0e31fee8fb..c7e9e62dc0 100644--- a/rust/cloud-storage/Cargo.lock+++ b/rust/cloud-storage/Cargo.lock@@ -1529,7 +1529,7 @@ dependencies = ["bitflags 2.11.1","cexpr","clang-sys",- "itertools 0.12.1",+ "itertools 0.10.5","log","prettyplease","proc-macro2",@@ -5668,15 +5668,6 @@ dependencies = ["either",]-[[package]]-name = "itertools"-version = "0.12.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"-dependencies = [- "either",-]-[[package]]name = "itertools"version = "0.14.0"@@ -5966,7 +5957,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"dependencies = ["cfg-if",- "windows-targets 0.52.6",+ "windows-targets 0.48.5",][[package]]@@ -8634,7 +8625,7 @@ checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4"dependencies = ["bytes","heck 0.5.0",- "itertools 0.12.1",+ "itertools 0.10.5","log","multimap","once_cell",@@ -8654,7 +8645,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1"dependencies = ["anyhow",- "itertools 0.12.1",+ "itertools 0.10.5","proc-macro2","quote","syn 2.0.98",@@ -9352,8 +9343,7 @@ dependencies = [[[package]]name = "rs-libreoffice-bindings"version = "0.0.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "17a4fb704f426cbdebfda10ed0f96c8dcb2d176d060cef76e44aa5c7696d5838"+source = "git+https://github.com/macro-inc/rs-libreoffice-bindings?rev=056a40ddfac1d9650be30b9f0b4b934e9266c7dc#056a40ddfac1d9650be30b9f0b4b934e9266c7dc"dependencies = ["bindgen","cc",@@ -10611,7 +10601,6 @@ dependencies = ["indexmap 2.14.0","log","memchr",- "native-tls","once_cell","percent-encoding","rustls 0.23.36",diff --git a/rust/cloud-storage/Cargo.toml b/rust/cloud-storage/Cargo.tomlindex 3ca37d8ce1..f404004e99 100644--- a/rust/cloud-storage/Cargo.toml+++ b/rust/cloud-storage/Cargo.toml@@ -215,7 +215,7 @@ sha2 = "0.10.8"sqlx = { version = "0.8.6", features = ["chrono","postgres",- "runtime-tokio-native-tls",+ "runtime-tokio-rustls","uuid",] }sqlx-core = { version = "0.8.6" }diff --git a/rust/cloud-storage/Cross.toml b/rust/cloud-storage/Cross.tomlindex e8a7345009..c65ea1dfaa 100644--- a/rust/cloud-storage/Cross.toml+++ b/rust/cloud-storage/Cross.toml@@ -1,9 +1,8 @@[build]-default-target = "x86_64-unknown-linux-gnu" # use this target if none is explicitly provided-pre-build = [ # additional commands to run prior to building the package- "dpkg --add-architecture $CROSS_DEB_ARCH",- "apt-get update && apt-get --assume-yes install libssl-dev:$CROSS_DEB_ARCH"-]+default-target = "x86_64-unknown-linux-gnu" # use this target if none is explicitly provided[build.env]passthrough = ["SQLX_OFFLINE=true"]++[target.x86_64-unknown-linux-gnu]+dockerfile = "./Dockerfile.cross-x86_64-unknown-linux-gnu"diff --git a/rust/cloud-storage/Dockerfile.cross-x86_64-unknown-linux-gnu b/rust/cloud-storage/Dockerfile.cross-x86_64-unknown-linux-gnunew file mode 100644index 0000000000..d579fe329d--- /dev/null+++ b/rust/cloud-storage/Dockerfile.cross-x86_64-unknown-linux-gnu@@ -0,0 +1,10 @@+FROM ghcr.io/cross-rs/x86_64-unknown-linux-gnu:edge++ARG CROSS_DEB_ARCH++RUN dpkg --add-architecture "$CROSS_DEB_ARCH" \+ && apt-get update \+ && apt-get -y upgrade \+ && apt-get --assume-yes install libssl-dev:"$CROSS_DEB_ARCH" gcc-10 g++-10 \+ && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 60 \+ && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 60diff --git a/rust/cloud-storage/ai/src/tool/tool_loop/chat/test.rs b/rust/cloud-storage/ai/src/tool/tool_loop/chat/test.rsindex 659c30a897..5cdcc8b06c 100644--- a/rust/cloud-storage/ai/src/tool/tool_loop/chat/test.rs+++ b/rust/cloud-storage/ai/src/tool/tool_loop/chat/test.rs@@ -1,31 +1,38 @@-#![allow(dead_code)]--use super::MAX_RECURSIONS;+use super::*;use crate::openai_toolset::OpenAIToolSetExt;use crate::tool::types::{AsyncToolSet, PartialToolCall, RequestContext, StreamPart, ToolCall, ToolResult,};use crate::tool::types::{ChatCompletionStream, ExtendedPartStream, PartOrExt, ToolResponse};+use crate::types::noop::NoOpClient;use crate::types::openai::message::convert_message;use crate::types::traits::{ExtendedOpenAIStream, ExtendedOpenAIStreamItem};+use crate::types::{AssistantMessagePart, ChatMessageContent, Role};use crate::types::{ChatCompletionRequest, ChatMessage, ChatMessages};use crate::types::{ExtendedClient, Result};use async_openai::types::chat::{ChatCompletionMessageToolCall, ChatCompletionMessageToolCalls,ChatCompletionRequestAssistantMessage, ChatCompletionRequestAssistantMessageContent,- ChatCompletionRequestMessage, ChatCompletionRequestToolMessage, ChatCompletionStreamOptions,+ ChatCompletionRequestMessage, ChatCompletionRequestToolMessage,+ ChatCompletionRequestToolMessageContent, ChatCompletionStreamOptions,CreateChatCompletionRequest, FinishReason, FunctionCall,};use async_stream::stream;use futures::stream::StreamExt;+use serde_json::json;use std::collections::HashMap;use std::sync::Arc;+// Chat test infrastructure — used by #[cfg(test)] mod tests below.+#[cfg(test)]+#[allow(dead_code)]struct ProcessedStream {pub new_messages: Vec<ChatCompletionRequestMessage>,pub tool_responses: Vec<ToolResponse>,}+#[cfg(test)]+#[allow(dead_code)]pub struct Chat<I, T>whereI: ExtendedClient + Send + Sync,@@ -41,6 +48,7 @@ whereuser_id: String,}+#[allow(dead_code)]impl<I, T> Chat<I, T>whereI: ExtendedClient + Send + Sync,@@ -400,244 +408,226 @@ where}}-#[cfg(test)]-mod tests {- use super::*;- use crate::types::noop::NoOpClient;- use crate::types::{AssistantMessagePart, ChatMessageContent, Role};- use async_openai::types::chat::{- ChatCompletionMessageToolCall, ChatCompletionMessageToolCalls,- ChatCompletionRequestAssistantMessage, ChatCompletionRequestAssistantMessageContent,- ChatCompletionRequestMessage, ChatCompletionRequestToolMessage,- ChatCompletionRequestToolMessageContent, FunctionCall,- };- use serde_json::json;-- fn create_mock_chat() -> Chat<NoOpClient, String> {- let client = NoOpClient;- let toolset = Arc::new(AsyncToolSet::new());- Chat::new(client, toolset, "test_context".to_string())- }+fn create_mock_chat() -> Chat<NoOpClient, String> {+ let client = NoOpClient;+ let toolset = Arc::new(AsyncToolSet::new());+ Chat::new(client, toolset, "test_context".to_string())+}- #[test]- fn test_get_new_conversation_messages_empty() {- let chat = create_mock_chat();- let messages = chat.get_new_conversation_messages();- assert!(messages.is_empty());- }+#[test]+fn test_get_new_conversation_messages_empty() {+ let chat = create_mock_chat();+ let messages = chat.get_new_conversation_messages();+ assert!(messages.is_empty());+}- #[test]- fn test_get_new_conversation_messages_skips_initial() {- let mut chat = create_mock_chat();-- // Add some initial messages- chat.messages = vec![- ChatCompletionRequestMessage::System(- async_openai::types::chat::ChatCompletionRequestSystemMessage {- content:- async_openai::types::chat::ChatCompletionRequestSystemMessageContent::Text(- "System message".to_string(),- ),- ..Default::default()- },- ),- ChatCompletionRequestMessage::User(- async_openai::types::chat::ChatCompletionRequestUserMessage {- content:- async_openai::types::chat::ChatCompletionRequestUserMessageContent::Text(- "User message".to_string(),- ),- ..Default::default()- },- ),- ];- chat.initial_message_count = 2;-- // Add new messages- chat.messages.push(ChatCompletionRequestMessage::Assistant(- ChatCompletionRequestAssistantMessage {- content: Some(ChatCompletionRequestAssistantMessageContent::Text(- "New assistant response".to_string(),- )),+#[test]+fn test_get_new_conversation_messages_skips_initial() {+ let mut chat = create_mock_chat();++ // Add some initial messages+ chat.messages = vec![+ ChatCompletionRequestMessage::System(+ async_openai::types::chat::ChatCompletionRequestSystemMessage {+ content: async_openai::types::chat::ChatCompletionRequestSystemMessageContent::Text(+ "System message".to_string(),+ ),..Default::default()},- ));+ ),+ ChatCompletionRequestMessage::User(+ async_openai::types::chat::ChatCompletionRequestUserMessage {+ content: async_openai::types::chat::ChatCompletionRequestUserMessageContent::Text(+ "User message".to_string(),+ ),+ ..Default::default()+ },+ ),+ ];+ chat.initial_message_count = 2;++ // Add new messages+ chat.messages.push(ChatCompletionRequestMessage::Assistant(+ ChatCompletionRequestAssistantMessage {+ content: Some(ChatCompletionRequestAssistantMessageContent::Text(+ "New assistant response".to_string(),+ )),+ ..Default::default()+ },+ ));- let new_messages = chat.get_new_conversation_messages();+ let new_messages = chat.get_new_conversation_messages();- assert_eq!(new_messages.len(), 1);- assert_eq!(new_messages[0].role, Role::Assistant);- if let ChatMessageContent::Text(text) = &new_messages[0].content {- assert_eq!(text, "New assistant response");- } else {- panic!("Expected text content");- }+ assert_eq!(new_messages.len(), 1);+ assert_eq!(new_messages[0].role, Role::Assistant);+ if let ChatMessageContent::Text(text) = &new_messages[0].content {+ assert_eq!(text, "New assistant response");+ } else {+ panic!("Expected text content");}+}++#[test]+fn test_get_new_conversation_messages_with_tool_calls() {+ let mut chat = create_mock_chat();+ chat.initial_message_count = 0;- #[test]- fn test_get_new_conversation_messages_with_tool_calls() {- let mut chat = create_mock_chat();- chat.initial_message_count = 0;-- let tool_call_id = "call_123".to_string();- let tool_name = "test_tool".to_string();-- // Add tool call mapping- chat.tool_call_id_name_mapping- .insert(tool_call_id.clone(), tool_name.clone());-- // Add messages with tool calls- chat.messages = vec![- ChatCompletionRequestMessage::Assistant(ChatCompletionRequestAssistantMessage {- content: Some(ChatCompletionRequestAssistantMessageContent::Text(- "I'll help you with that.".to_string(),- )),- tool_calls: Some(vec![ChatCompletionMessageToolCalls::Function(- ChatCompletionMessageToolCall {- id: tool_call_id.clone(),- function: FunctionCall {- name: tool_name.clone(),- arguments: json!({"param": "value"}).to_string(),- },+ let tool_call_id = "call_123".to_string();+ let tool_name = "test_tool".to_string();++ // Add tool call mapping+ chat.tool_call_id_name_mapping+ .insert(tool_call_id.clone(), tool_name.clone());++ // Add messages with tool calls+ chat.messages = vec![+ ChatCompletionRequestMessage::Assistant(ChatCompletionRequestAssistantMessage {+ content: Some(ChatCompletionRequestAssistantMessageContent::Text(+ "I'll help you with that.".to_string(),+ )),+ tool_calls: Some(vec![ChatCompletionMessageToolCalls::Function(+ ChatCompletionMessageToolCall {+ id: tool_call_id.clone(),+ function: FunctionCall {+ name: tool_name.clone(),+ arguments: json!({"param": "value"}).to_string(),},- )]),- ..Default::default()- }),- ChatCompletionRequestMessage::Tool(ChatCompletionRequestToolMessage {- tool_call_id: tool_call_id.clone(),- content: ChatCompletionRequestToolMessageContent::Text(- json!({"result": "success"}).to_string(),- ),- }),- ];+ },+ )]),+ ..Default::default()+ }),+ ChatCompletionRequestMessage::Tool(ChatCompletionRequestToolMessage {+ tool_call_id: tool_call_id.clone(),+ content: ChatCompletionRequestToolMessageContent::Text(+ json!({"result": "success"}).to_string(),+ ),+ }),+ ];- let new_messages = chat.get_new_conversation_messages();+ let new_messages = chat.get_new_conversation_messages();- // The ChatMessages conversion merges adjacent assistant messages into one- assert_eq!(new_messages.len(), 1);+ // The ChatMessages conversion merges adjacent assistant messages into one+ assert_eq!(new_messages.len(), 1);- // The message should be assistant with merged parts (text + tool call + tool response)- assert_eq!(new_messages[0].role, Role::Assistant);- if let ChatMessageContent::AssistantMessageParts(parts) = &new_messages[0].content {- assert_eq!(parts.len(), 3);+ // The message should be assistant with merged parts (text + tool call + tool response)+ assert_eq!(new_messages[0].role, Role::Assistant);+ if let ChatMessageContent::AssistantMessageParts(parts) = &new_messages[0].content {+ assert_eq!(parts.len(), 3);- // Should have text part- if let AssistantMessagePart::Text { text } = &parts[0] {- assert_eq!(text, "I'll help you with that.");- } else {- panic!("Expected text part at index 0");- }+ // Should have text part+ if let AssistantMessagePart::Text { text } = &parts[0] {+ assert_eq!(text, "I'll help you with that.");+ } else {+ panic!("Expected text part at index 0");+ }- // Should have tool call part with correct name from mapping- if let AssistantMessagePart::ToolCall { name, id, json } = &parts[1] {- assert_eq!(name, &tool_name);- assert_eq!(id, &tool_call_id);- assert_eq!(json["param"], "value");- } else {- panic!("Expected tool call part at index 1");- }+ // Should have tool call part with correct name from mapping+ if let AssistantMessagePart::ToolCall { name, id, json } = &parts[1] {+ assert_eq!(name, &tool_name);+ assert_eq!(id, &tool_call_id);+ assert_eq!(json["param"], "value");+ } else {+ panic!("Expected tool call part at index 1");+ }- // Should have tool response part- if let AssistantMessagePart::ToolCallResponseJson { name, id, json } = &parts[2] {- assert_eq!(name, &tool_name);- assert_eq!(id, &tool_call_id);- assert_eq!(json["result"], "success");- } else {- panic!("Expected tool response part at index 2");- }+ // Should have tool response part+ if let AssistantMessagePart::ToolCallResponseJson { name, id, json } = &parts[2] {+ assert_eq!(name, &tool_name);+ assert_eq!(id, &tool_call_id);+ assert_eq!(json["result"], "success");} else {- panic!("Expected assistant message parts");+ panic!("Expected tool response part at index 2");}+ } else {+ panic!("Expected assistant message parts");}+}- #[test]- fn test_get_new_conversation_messages_preserves_tool_mapping() {- let mut chat = create_mock_chat();- chat.initial_message_count = 0;+#[test]+fn test_get_new_conversation_messages_preserves_tool_mapping() {+ let mut chat = create_mock_chat();+ chat.initial_message_count = 0;- let tool_call_id = "call_456".to_string();- let tool_name = "search_documents".to_string();+ let tool_call_id = "call_456".to_string();+ let tool_name = "search_documents".to_string();- // Add tool call mapping- chat.tool_call_id_name_mapping- .insert(tool_call_id.clone(), tool_name.clone());+ // Add tool call mapping+ chat.tool_call_id_name_mapping+ .insert(tool_call_id.clone(), tool_name.clone());- // Add tool response message- chat.messages = vec![ChatCompletionRequestMessage::Tool(- ChatCompletionRequestToolMessage {- tool_call_id: tool_call_id.clone(),- content: ChatCompletionRequestToolMessageContent::Text(- json!({"documents": ["doc1", "doc2"]}).to_string(),- ),- },- )];+ // Add tool response message+ chat.messages = vec![ChatCompletionRequestMessage::Tool(+ ChatCompletionRequestToolMessage {+ tool_call_id: tool_call_id.clone(),+ content: ChatCompletionRequestToolMessageContent::Text(+ json!({"documents": ["doc1", "doc2"]}).to_string(),+ ),+ },+ )];- let new_messages = chat.get_new_conversation_messages();+ let new_messages = chat.get_new_conversation_messages();- assert_eq!(new_messages.len(), 1);- assert_eq!(new_messages[0].role, Role::Assistant);+ assert_eq!(new_messages.len(), 1);+ assert_eq!(new_messages[0].role, Role::Assistant);- if let ChatMessageContent::AssistantMessageParts(parts) = &new_messages[0].content {- assert_eq!(parts.len(), 1);+ if let ChatMessageContent::AssistantMessageParts(parts) = &new_messages[0].content {+ assert_eq!(parts.len(), 1);- if let AssistantMessagePart::ToolCallResponseJson { name, id, json } = &parts[0] {- assert_eq!(name, &tool_name); // Verify tool name is preserved from mapping- assert_eq!(id, &tool_call_id);- assert_eq!(json["documents"][0], "doc1");- assert_eq!(json["documents"][1], "doc2");- } else {- panic!("Expected tool response part");- }+ if let AssistantMessagePart::ToolCallResponseJson { name, id, json } = &parts[0] {+ assert_eq!(name, &tool_name); // Verify tool name is preserved from mapping+ assert_eq!(id, &tool_call_id);+ assert_eq!(json["documents"][0], "doc1");+ assert_eq!(json["documents"][1], "doc2");} else {- panic!("Expected assistant message parts");+ panic!("Expected tool response part");}+ } else {+ panic!("Expected assistant message parts");}+}- #[test]- fn test_get_new_conversation_messages_with_error_response() {- let mut chat = create_mock_chat();- chat.initial_message_count = 0;-- let tool_call_id = "call_error".to_string();- let tool_name = "failing_tool".to_string();-- // Add tool call mapping- chat.tool_call_id_name_mapping- .insert(tool_call_id.clone(), tool_name.clone());-- // Add tool error response message- chat.messages = vec![ChatCompletionRequestMessage::Tool(- ChatCompletionRequestToolMessage {- tool_call_id: tool_call_id.clone(),- content: ChatCompletionRequestToolMessageContent::Text(- "Tool execution failed".into(),- ),- },- )];-- let new_messages = chat.get_new_conversation_messages();-- assert_eq!(new_messages.len(), 1);- assert_eq!(new_messages[0].role, Role::Assistant);-- if let ChatMessageContent::AssistantMessageParts(parts) = &new_messages[0].content {- assert_eq!(parts.len(), 1);-- if let AssistantMessagePart::ToolCallErr {- name,- id,- description,- } = &parts[0]- {- assert_eq!(name, &tool_name);- assert_eq!(id, &tool_call_id);- assert_eq!(description, "Tool execution failed");- } else {- eprintln!("{:#?}", parts[0]);- panic!("Expected tool error part");- }+#[test]+fn test_get_new_conversation_messages_with_error_response() {+ let mut chat = create_mock_chat();+ chat.initial_message_count = 0;++ let tool_call_id = "call_error".to_string();+ let tool_name = "failing_tool".to_string();++ // Add tool call mapping+ chat.tool_call_id_name_mapping+ .insert(tool_call_id.clone(), tool_name.clone());++ // Add tool error response message+ chat.messages = vec![ChatCompletionRequestMessage::Tool(+ ChatCompletionRequestToolMessage {+ tool_call_id: tool_call_id.clone(),+ content: ChatCompletionRequestToolMessageContent::Text("Tool execution failed".into()),+ },+ )];++ let new_messages = chat.get_new_conversation_messages();++ assert_eq!(new_messages.len(), 1);+ assert_eq!(new_messages[0].role, Role::Assistant);++ if let ChatMessageContent::AssistantMessageParts(parts) = &new_messages[0].content {+ assert_eq!(parts.len(), 1);++ if let AssistantMessagePart::ToolCallErr {+ name,+ id,+ description,+ } = &parts[0]+ {+ assert_eq!(name, &tool_name);+ assert_eq!(id, &tool_call_id);+ assert_eq!(description, "Tool execution failed");} else {- panic!("Expected assistant message parts");+ eprintln!("{:#?}", parts[0]);+ panic!("Expected tool error part");}+ } else {+ panic!("Expected assistant message parts");}}diff --git a/rust/cloud-storage/anthropic/examples/only_openai_tools.rs b/rust/cloud-storage/anthropic/examples/only_openai_tools.rsindex 5761a39781..9754952a93 100644--- a/rust/cloud-storage/anthropic/examples/only_openai_tools.rs+++ b/rust/cloud-storage/anthropic/examples/only_openai_tools.rs@@ -247,9 +247,9 @@ async fn call_fn(name: &str, args: &str) -> Result<Value, Box<dyn std::error::Er}fn get_current_weather(location: &str, unit: &str) -> serde_json::Value {- let mut rng = rand::thread_rng();+ let mut rng = rand::rng();- let temperature: i32 = rng.gen_range(20..=55);+ let temperature: i32 = rng.random_range(20..=55);let forecasts = ["sunny", "cloudy", "overcast", "rainy", "windy", "foggy", "snowy",diff --git a/rust/cloud-storage/anthropic/examples/tools_openai.rs b/rust/cloud-storage/anthropic/examples/tools_openai.rsindex 003564e5b6..6e54ff5653 100644--- a/rust/cloud-storage/anthropic/examples/tools_openai.rs+++ b/rust/cloud-storage/anthropic/examples/tools_openai.rs@@ -49,14 +49,13 @@ async fn main() {let mut tool_json = String::new();while let Some(part) = stream.next().await {- writeln!(out, "{:#?}", part);+ let _ = writeln!(out, "{:#?}", part);if part.is_err() {writeln!(out, "{:?}", part).expect("io");break;}let part = part.unwrap();match part {- StreamEvent::ContentBlockStart { content_block, .. } => {}StreamEvent::ContentBlockDelta { delta, .. } => match delta {ContentDeltaEvent::InputJsonDelta { partial_json } => {tool_json.push_str(&partial_json);@@ -67,9 +66,7 @@ async fn main() {}other => writeln!(out, "{:?}", other).expect("io"),},- StreamEvent::ContentBlockStop { .. } | StreamEvent::ContentBlockStart { .. } => {- writeln!(out).expect("io")- }+ StreamEvent::ContentBlockStop { .. } => writeln!(out).expect("io"),event => writeln!(out, "{:?}", event).expect("io"),}}diff --git a/rust/cloud-storage/authentication_service/src/api/health.rs b/rust/cloud-storage/authentication_service/src/api/health.rsindex 1656ae67ec..888c758ce7 100644--- a/rust/cloud-storage/authentication_service/src/api/health.rs+++ b/rust/cloud-storage/authentication_service/src/api/health.rs@@ -44,7 +44,7 @@ mod tests {.unwrap();assert_eq!(response.status(), StatusCode::OK);- let body = String::from_utf8(+ let _body = String::from_utf8(response.into_body().collect()diff --git a/rust/cloud-storage/authentication_service/src/api/middleware/team_access.rs b/rust/cloud-storage/authentication_service/src/api/middleware/team_access.rsindex a0ef1b4ff9..77b983dac2 100644--- a/rust/cloud-storage/authentication_service/src/api/middleware/team_access.rs+++ b/rust/cloud-storage/authentication_service/src/api/middleware/team_access.rs@@ -42,7 +42,7 @@ impl BuildTeamAccess for OwnerRole {#[derive(Debug)]pub struct TeamAccessRoleExtractor<T> {- #[expect(dead_code)]+ #[allow(dead_code)]pub role: TeamRole,desired: PhantomData<T>,}diff --git a/rust/cloud-storage/channels/justfile b/rust/cloud-storage/channels/justfileindex 44d95590f5..230e447380 100644--- a/rust/cloud-storage/channels/justfile+++ b/rust/cloud-storage/channels/justfile@@ -1,2 +1,2 @@prepare:- cargo sqlx prepare -- --all-features+ sqlx prepare -- --all-featuresdiff --git a/rust/cloud-storage/comms_service/src/api/channels/get_mentions.rs b/rust/cloud-storage/comms_service/src/api/channels/get_mentions.rsindex 301405e425..ccdbe4a0bb 100644--- a/rust/cloud-storage/comms_service/src/api/channels/get_mentions.rs+++ b/rust/cloud-storage/comms_service/src/api/channels/get_mentions.rs@@ -1,3 +1,4 @@+#[allow(unused_imports)]use crate::api::context::AppState;use crate::api::extractors::{ChannelId, ChannelMember};use axum::http::StatusCode;diff --git a/rust/cloud-storage/comms_service/src/api/mentions/create_mention.rs b/rust/cloud-storage/comms_service/src/api/mentions/create_mention.rsindex cc989f2835..61f10b81cd 100644--- a/rust/cloud-storage/comms_service/src/api/mentions/create_mention.rs+++ b/rust/cloud-storage/comms_service/src/api/mentions/create_mention.rs@@ -1,4 +1,4 @@-use crate::api::context::{AppState, DocumentPermissionJwtSecretKey};+use crate::api::context::DocumentPermissionJwtSecretKey;use axum::{Extension, Json,extract::State,@@ -48,7 +48,7 @@ pub struct CreateEntityMentionResponse {tag = "mentions")]#[tracing::instrument(skip(db, config, user_context))]-#[debug_handler(state = AppState)]+#[debug_handler(state = crate::api::context::AppState)]pub async fn create_mention_handler(State(db): State<PgPool>,State(config): State<LocalOrRemoteSecret<DocumentPermissionJwtSecretKey>>,diff --git a/rust/cloud-storage/contacts/src/domain/models/graph/test.rs b/rust/cloud-storage/contacts/src/domain/models/graph/test.rsindex 42bce50dcb..b6f32bd705 100644--- a/rust/cloud-storage/contacts/src/domain/models/graph/test.rs+++ b/rust/cloud-storage/contacts/src/domain/models/graph/test.rs@@ -1,3 +1,4 @@+#[allow(unused_imports)]use super::*;use macro_user_id::user_id::MacroUserIdStr;diff --git a/rust/cloud-storage/contacts/src/domain/ports.rs b/rust/cloud-storage/contacts/src/domain/ports.rsindex e3c96b272c..0438b72c9d 100644--- a/rust/cloud-storage/contacts/src/domain/ports.rs+++ b/rust/cloud-storage/contacts/src/domain/ports.rs@@ -66,7 +66,7 @@ pub trait ContactsOutboxService: Send + Sync + 'static {pub(crate) struct ContactsBackfillOutboxMessage {pub(crate) id: u64,- #[expect(dead_code)]+ #[allow(dead_code)]pub(crate) channel_id: Uuid,pub(crate) channel_participants: HashSet<MacroUserIdStr<'static>>,}diff --git a/rust/cloud-storage/contacts/src/domain/service/test.rs b/rust/cloud-storage/contacts/src/domain/service/test.rsindex 78d80129f3..2386bc2c97 100644--- a/rust/cloud-storage/contacts/src/domain/service/test.rs+++ b/rust/cloud-storage/contacts/src/domain/service/test.rs@@ -1,3 +1,4 @@+#[allow(unused_imports)]use super::*;#[test]diff --git a/rust/cloud-storage/contacts/src/inbound/http/test.rs b/rust/cloud-storage/contacts/src/inbound/http/test.rsindex 2712f75e55..70ea9eb072 100644--- a/rust/cloud-storage/contacts/src/inbound/http/test.rs+++ b/rust/cloud-storage/contacts/src/inbound/http/test.rs@@ -1,3 +1,4 @@+#[allow(unused_imports)]use super::*;use axum::{Extension, body::Body, http::Request};use http_body_util::BodyExt;diff --git a/rust/cloud-storage/contacts_service/src/config.rs b/rust/cloud-storage/contacts_service/src/config.rsindex 3dbaf00feb..532e4b0a43 100644--- a/rust/cloud-storage/contacts_service/src/config.rs+++ b/rust/cloud-storage/contacts_service/src/config.rs@@ -62,6 +62,7 @@ impl Config {}#[cfg(test)]+ #[allow(dead_code)]pub fn new_testing() -> Self {Config {port: 0,diff --git a/rust/cloud-storage/convert_service/Cargo.toml b/rust/cloud-storage/convert_service/Cargo.tomlindex f0c5e84024..4e77803549 100644--- a/rust/cloud-storage/convert_service/Cargo.toml+++ b/rust/cloud-storage/convert_service/Cargo.toml@@ -32,7 +32,7 @@ model = { path = "../model" }s3_key = { path = "../s3_key" }nix = { version = "0.29.0", features = ["process", "signal"] }remote_env_var = { path = "../remote_env_var" }-rs-libreoffice-bindings = "0.0.7"+rs-libreoffice-bindings = { git = "https://github.com/macro-inc/rs-libreoffice-bindings", rev = "056a40ddfac1d9650be30b9f0b4b934e9266c7dc" }s3_client = { path = "../s3_client" }secretsmanager_client = { path = "../secretsmanager_client" }serde = { workspace = true }diff --git a/rust/cloud-storage/dataloss_prevention_handler/justfile b/rust/cloud-storage/dataloss_prevention_handler/justfileindex a5e7db20aa..8580f2c061 100644--- a/rust/cloud-storage/dataloss_prevention_handler/justfile+++ b/rust/cloud-storage/dataloss_prevention_handler/justfile@@ -8,5 +8,5 @@ deploy-dev:test:cargo test --all-features-build:- cargo lambda build --release --bin {{lambda_name}} --output-format zip\ No newline at end of file+build compiler="":+ cargo lambda build {{ if compiler == "" { "" } else { "--compiler " + compiler } }} --release --bin {{lambda_name}} --output-format zip\ No newline at end of filediff --git a/rust/cloud-storage/delete_chat_handler/justfile b/rust/cloud-storage/delete_chat_handler/justfileindex 85949e8b5f..75dff67371 100644--- a/rust/cloud-storage/delete_chat_handler/justfile+++ b/rust/cloud-storage/delete_chat_handler/justfile@@ -19,5 +19,5 @@ prepare_db:test:cargo test --all-features-build:- SQLX_OFFLINE=true cargo lambda build --release --bin {{lambda_name}} --output-format zip+build compiler="":+ SQLX_OFFLINE=true cargo lambda build {{ if compiler == "" { "" } else { "--compiler " + compiler } }} --release --bin {{lambda_name}} --output-format zipdiff --git a/rust/cloud-storage/deleted_item_poller/justfile b/rust/cloud-storage/deleted_item_poller/justfileindex 7e0c35ff88..348f989cb5 100644--- a/rust/cloud-storage/deleted_item_poller/justfile+++ b/rust/cloud-storage/deleted_item_poller/justfile@@ -8,8 +8,8 @@ deploy-dev:test:cargo test --all-features-build:- SQLX_OFFLINE=true cargo lambda build --release --bin {{lambda_name}} --output-format zip+build compiler="":+ SQLX_OFFLINE=true cargo lambda build {{ if compiler == "" { "" } else { "--compiler " + compiler } }} --release --bin {{lambda_name}} --output-format zipcheck:SQLX_OFFLINE=true cargo checkdiff --git a/rust/cloud-storage/document_storage_service/src/api/annotations/create_anchor.rs b/rust/cloud-storage/document_storage_service/src/api/annotations/create_anchor.rsindex ea62c49704..f4efd04af0 100644--- a/rust/cloud-storage/document_storage_service/src/api/annotations/create_anchor.rs+++ b/rust/cloud-storage/document_storage_service/src/api/annotations/create_anchor.rs@@ -1,7 +1,7 @@use std::sync::Arc;use crate::api::context::EntityAccessService;-use crate::{api::context::ApiContext, service::conn_gateway::update_live_comment_state};+use crate::service::conn_gateway::update_live_comment_state;use axum::{Json,extract::{Extension, Path, State},@@ -46,7 +46,7 @@ pub struct Params {(status = 500, body=ErrorResponse),))]-#[axum::debug_handler(state = ApiContext)]+#[axum::debug_handler(state = crate::api::context::ApiContext)]pub async fn create_anchor_handler(_access: DocumentAccessExtractor<CommentAccessLevel, EntityAccessService>,State(db): State<PgPool>,diff --git a/rust/cloud-storage/document_storage_service/src/api/annotations/create_comment.rs b/rust/cloud-storage/document_storage_service/src/api/annotations/create_comment.rsindex 6c7c2d72d3..9ba59a5d36 100644--- a/rust/cloud-storage/document_storage_service/src/api/annotations/create_comment.rs+++ b/rust/cloud-storage/document_storage_service/src/api/annotations/create_comment.rs@@ -1,10 +1,7 @@use std::sync::Arc;use crate::{- api::{- annotations::{CommentNotifContext, compute_notification_recipients},- context::ApiContext,- },+ api::annotations::{CommentNotifContext, compute_notification_recipients},service::conn_gateway::update_live_comment_state,};use axum::{@@ -54,7 +51,7 @@ pub struct Params {(status = 500, body=ErrorResponse),))]-#[axum::debug_handler(state = ApiContext)]+#[axum::debug_handler(state = crate::api::context::ApiContext)]#[expect(clippy::too_many_arguments, reason = "axum handler extractors")]pub async fn create_comment_handler(State(notification_ingress_service): State<Arc<crate::api::context::NotificationIngressType>>,diff --git a/rust/cloud-storage/document_storage_service/src/api/annotations/delete_anchor.rs b/rust/cloud-storage/document_storage_service/src/api/annotations/delete_anchor.rsindex 4b63d8bcfe..77af1a61ab 100644--- a/rust/cloud-storage/document_storage_service/src/api/annotations/delete_anchor.rs+++ b/rust/cloud-storage/document_storage_service/src/api/annotations/delete_anchor.rs@@ -1,6 +1,6 @@use std::sync::Arc;-use crate::{api::context::ApiContext, service::conn_gateway::update_live_comment_state};+use crate::service::conn_gateway::update_live_comment_state;use axum::{Json,extract::{Extension, State},@@ -34,7 +34,7 @@ use super::comment_error_response;(status = 500, body=ErrorResponse),))]-#[axum::debug_handler(state = ApiContext)]+#[axum::debug_handler(state = crate::api::context::ApiContext)]pub async fn delete_anchor_handler(State(db): State<PgPool>,State(conn_gateway_client): State<Arc<ConnectionGatewayClient>>,diff --git a/rust/cloud-storage/document_storage_service/src/api/annotations/delete_comment.rs b/rust/cloud-storage/document_storage_service/src/api/annotations/delete_comment.rsindex 767b35e621..8d2f7552e6 100644--- a/rust/cloud-storage/document_storage_service/src/api/annotations/delete_comment.rs+++ b/rust/cloud-storage/document_storage_service/src/api/annotations/delete_comment.rs@@ -1,5 +1,6 @@use std::sync::Arc;+#[allow(unused_imports)]use crate::{api::context::ApiContext, service::conn_gateway::update_live_comment_state};use axum::{Json,diff --git a/rust/cloud-storage/document_storage_service/src/api/annotations/edit_anchor.rs b/rust/cloud-storage/document_storage_service/src/api/annotations/edit_anchor.rsindex 9cafd7de1e..9dcff1a568 100644--- a/rust/cloud-storage/document_storage_service/src/api/annotations/edit_anchor.rs+++ b/rust/cloud-storage/document_storage_service/src/api/annotations/edit_anchor.rs@@ -1,6 +1,6 @@use std::sync::Arc;-use crate::{api::context::ApiContext, service::conn_gateway::update_live_comment_state};+use crate::service::conn_gateway::update_live_comment_state;use axum::{Json,extract::{Extension, State},@@ -33,7 +33,7 @@ use super::comment_error_response;(status = 500, body=ErrorResponse),))]-#[axum::debug_handler(state = ApiContext)]+#[axum::debug_handler(state = crate::api::context::ApiContext)]pub async fn edit_anchor_handler(State(db): State<PgPool>,State(conn_gateway_client): State<Arc<ConnectionGatewayClient>>,diff --git a/rust/cloud-storage/document_storage_service/src/api/annotations/get.rs b/rust/cloud-storage/document_storage_service/src/api/annotations/get.rsindex 65859115d8..dcc9786a66 100644--- a/rust/cloud-storage/document_storage_service/src/api/annotations/get.rs+++ b/rust/cloud-storage/document_storage_service/src/api/annotations/get.rs@@ -1,10 +1,7 @@use std::str::FromStr;use crate::api::context::EntityAccessService;-use crate::{- api::context::ApiContext,- model::response::annotations::{AnchorResponse, ThreadResponse},-};+use crate::model::response::annotations::{AnchorResponse, ThreadResponse};use axum::{Json,extract::{Extension, Path, State},@@ -43,7 +40,7 @@ pub struct Params {(status = 500, body=ErrorResponse),))]-#[axum::debug_handler(state = ApiContext)]+#[axum::debug_handler(state = crate::api::context::ApiContext)]#[tracing::instrument(skip(_access, db))]pub async fn get_document_comments_handler(Path(Params { document_id }): Path<Params>,diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/get_user_documents.rs b/rust/cloud-storage/document_storage_service/src/api/documents/get_user_documents.rsindex d839fe1c25..9d0afe75aa 100644--- a/rust/cloud-storage/document_storage_service/src/api/documents/get_user_documents.rs+++ b/rust/cloud-storage/document_storage_service/src/api/documents/get_user_documents.rs@@ -1,24 +1,17 @@+use crate::model::{+ request::documents::get_user_documents::{GetUserDocumentsParams, GetUserDocumentsQueryParams},+ response::documents::get::{GetDocumentsResponse, UserDocumentsResponse},+};use axum::{Extension,extract::{Query, State},http::StatusCode,response::IntoResponse,};--use model::response::{GenericErrorResponse, GenericResponse};-use sqlx::PgPool;--use crate::{- api::context::ApiContext,- model::{- request::documents::get_user_documents::{- GetUserDocumentsParams, GetUserDocumentsQueryParams,- },- response::documents::get::{GetDocumentsResponse, UserDocumentsResponse},- },-};use macro_db_client::document::get_user_documents;+use model::response::{GenericErrorResponse, GenericResponse};use model::user::UserContext;+use sqlx::PgPool;/// Gets the users documents to populate their recent document list#[utoipa::path(@@ -38,7 +31,7 @@ use model::user::UserContext;))]#[tracing::instrument(skip(db, user_context, params), fields(user_id=?user_context.user_id))]-#[axum::debug_handler(state = ApiContext)]+#[axum::debug_handler(state = crate::api::context::ApiContext)]pub async fn get_user_documents_handler(State(db): State<PgPool>,user_context: Extension<UserContext>,diff --git a/rust/cloud-storage/document_text_extractor/justfile b/rust/cloud-storage/document_text_extractor/justfileindex ff24798a4d..f0f3f2f1fa 100644--- a/rust/cloud-storage/document_text_extractor/justfile+++ b/rust/cloud-storage/document_text_extractor/justfile@@ -10,16 +10,16 @@ deploy-dev:# Prepare databaseprepare:- DATABASE_URL={{ DATABASE_URL }} cargo sqlx prepare+ DATABASE_URL={{ DATABASE_URL }} sqlx prepare# Build lambda for deployment-build:+build compiler="":#!/usr/bin/env bashif [ ! -d "./pdfium-lib/linux" ]; thenecho "ERROR: pdfium-lib/linux not found. pdfium binary must be available locally"exit 1fi- SQLX_OFFLINE=true cargo lambda build --release --bin {{ lambda_name }} --output-format zip --include ./pdfium-lib/linux+ SQLX_OFFLINE=true cargo lambda build {{ if compiler == "" { "" } else { "--compiler " + compiler } }} --release --bin {{ lambda_name }} --output-format zip --include ./pdfium-lib/linux# Run local development server with automatic OS detectionlocal:diff --git a/rust/cloud-storage/document_text_extractor/src/service/db/get_document_file_type.rs b/rust/cloud-storage/document_text_extractor/src/service/db/get_document_file_type.rsindex e37ec6c667..6db77b4ca5 100644--- a/rust/cloud-storage/document_text_extractor/src/service/db/get_document_file_type.rs+++ b/rust/cloud-storage/document_text_extractor/src/service/db/get_document_file_type.rs@@ -3,6 +3,7 @@ use model::document::FileType;use sqlx::{Pool, Postgres};use std::str::FromStr;+#[cfg_attr(test, allow(dead_code))]#[tracing::instrument(skip(db))]pub async fn get_document_file_type(db: &Pool<Postgres>,diff --git a/rust/cloud-storage/document_text_extractor/src/service/db/mod.rs b/rust/cloud-storage/document_text_extractor/src/service/db/mod.rsindex 5e50ee9670..3cec34a805 100644--- a/rust/cloud-storage/document_text_extractor/src/service/db/mod.rs+++ b/rust/cloud-storage/document_text_extractor/src/service/db/mod.rs@@ -15,12 +15,14 @@ pub use MockDBClient as DB;use model::citations::TextReference;+#[cfg_attr(test, allow(dead_code))]#[derive(Clone)]pub struct DBClient {inner: sqlx::Pool<sqlx::Postgres>,}#[cfg_attr(test, automock)]+#[cfg_attr(test, allow(dead_code))]impl DBClient {pub fn new(inner: sqlx::Pool<sqlx::Postgres>) -> Self {Self { inner }diff --git a/rust/cloud-storage/document_text_extractor/src/service/s3/get_document_bytes.rs b/rust/cloud-storage/document_text_extractor/src/service/s3/get_document_bytes.rsindex 6ee544c002..4e0fb9eb97 100644--- a/rust/cloud-storage/document_text_extractor/src/service/s3/get_document_bytes.rs+++ b/rust/cloud-storage/document_text_extractor/src/service/s3/get_document_bytes.rs@@ -2,6 +2,7 @@ use anyhow::Result;use aws_sdk_s3 as s3;use lambda_runtime::tracing;+#[cfg_attr(test, allow(dead_code))]#[tracing::instrument(skip(client))]pub async fn get_document_bytes(client: &s3::Client, bucket: &str, key: &str) -> Result<Vec<u8>> {let resp = client.get_object().bucket(bucket).key(key).send().await?;diff --git a/rust/cloud-storage/document_text_extractor/src/service/s3/mod.rs b/rust/cloud-storage/document_text_extractor/src/service/s3/mod.rsindex 7e7cda245a..0ea53a6cd1 100644--- a/rust/cloud-storage/document_text_extractor/src/service/s3/mod.rs+++ b/rust/cloud-storage/document_text_extractor/src/service/s3/mod.rs@@ -10,6 +10,7 @@ pub use MockS3Client as S3;#[cfg(not(test))]pub use S3Client as S3;+#[cfg_attr(test, allow(dead_code))]#[derive(Clone, Debug)]pub struct S3Client {/// Inner S3 client@@ -17,6 +18,7 @@ pub struct S3Client {}#[cfg_attr(test, automock)]+#[cfg_attr(test, allow(dead_code))]impl S3Client {pub fn new(inner: s3::Client) -> Self {Self { inner }diff --git a/rust/cloud-storage/docx_unzip_handler/justfile b/rust/cloud-storage/docx_unzip_handler/justfileindex 42c5c6aa13..08971ab76c 100644--- a/rust/cloud-storage/docx_unzip_handler/justfile+++ b/rust/cloud-storage/docx_unzip_handler/justfile@@ -3,8 +3,8 @@ lambda_name := file_name(justfile_directory())test:cargo test --all-features-build:- SQLX_OFFLINE=true cargo lambda build --release --bin {{lambda_name}} --output-format zip+build compiler="":+ SQLX_OFFLINE=true cargo lambda build {{ if compiler == "" { "" } else { "--compiler " + compiler } }} --release --bin {{lambda_name}} --output-format zipcreate-localstack:docker run -d --name localstack -p 4566:4566 -e SERVICES=sqs localstack/localstackdiff --git a/rust/cloud-storage/email/src/outbound/email_pg_repo/dynamic/mod.rs b/rust/cloud-storage/email/src/outbound/email_pg_repo/dynamic/mod.rsindex 4612832b3f..95b688be8e 100644--- a/rust/cloud-storage/email/src/outbound/email_pg_repo/dynamic/mod.rs+++ b/rust/cloud-storage/email/src/outbound/email_pg_repo/dynamic/mod.rs@@ -12,6 +12,7 @@ pub(crate) use query::dynamic_email_thread_cursor;// Re-export filter internals so tests.rs can reach them via `use super::*`#[cfg(test)]+#[allow(unused_imports)]pub(crate) use filters::*;use sqlx::{Postgres, QueryBuilder};diff --git a/rust/cloud-storage/email/src/outbound/email_pg_repo/test/dynamic_query.rs b/rust/cloud-storage/email/src/outbound/email_pg_repo/test/dynamic_query.rsindex 0fb9ce54fd..89ba74ca81 100644--- a/rust/cloud-storage/email/src/outbound/email_pg_repo/test/dynamic_query.rs+++ b/rust/cloud-storage/email/src/outbound/email_pg_repo/test/dynamic_query.rs@@ -1,4 +1,5 @@use super::*;+use macro_user_id::cowlike::CowLike;#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS",diff --git a/rust/cloud-storage/email/src/outbound/email_pg_repo/test/mod.rs b/rust/cloud-storage/email/src/outbound/email_pg_repo/test/mod.rsindex 43642494a7..efcea2dd13 100644--- a/rust/cloud-storage/email/src/outbound/email_pg_repo/test/mod.rs+++ b/rust/cloud-storage/email/src/outbound/email_pg_repo/test/mod.rs@@ -10,12 +10,11 @@ mod thread_labels;use std::sync::Arc;use super::*;-use crate::domain::models::{LabelType, PreviewView, PreviewViewStandardLabel, RecipientType};+use crate::domain::models::{LabelType, PreviewView, PreviewViewStandardLabel};use crate::domain::ports::EmailRepo;use filter_ast::Expr;use item_filters::ast::email::{Email, EmailLiteral};use macro_db_migrator::MACRO_DB_MIGRATIONS;-use macro_user_id::cowlike::CowLike;use macro_user_id::email::EmailStr;use macro_user_id::user_id::MacroUserIdStr;use models_pagination::{Cursor, CursorVal, Query, SimpleSortMethod};diff --git a/rust/cloud-storage/email_refresh_handler/justfile b/rust/cloud-storage/email_refresh_handler/justfileindex 8d864c89d7..a9434ae769 100644--- a/rust/cloud-storage/email_refresh_handler/justfile+++ b/rust/cloud-storage/email_refresh_handler/justfile@@ -5,8 +5,8 @@ import '../database.just'test:cargo test --all-features-build:- SQLX_OFFLINE=true cargo lambda build --release --bin {{lambda_name}} --output-format zip+build compiler="":+ SQLX_OFFLINE=true cargo lambda build {{ if compiler == "" { "" } else { "--compiler " + compiler } }} --release --bin {{lambda_name}} --output-format zipcheck:SQLX_OFFLINE=true cargo check@@ -15,4 +15,4 @@ create-queues:AWS_REGION=us-east-1 aws --endpoint-url=http://localhost:4566 sqs create-queue --queue-name my-test-refresh-queueprepare_db:- DATABASE_URL={{ DATABASE_URL }} cargo sqlx prepare\ No newline at end of file+ DATABASE_URL={{ DATABASE_URL }} sqlx prepare\ No newline at end of filediff --git a/rust/cloud-storage/email_scheduled_handler/justfile b/rust/cloud-storage/email_scheduled_handler/justfileindex 23e8a03bd6..de42548179 100644--- a/rust/cloud-storage/email_scheduled_handler/justfile+++ b/rust/cloud-storage/email_scheduled_handler/justfile@@ -5,8 +5,8 @@ import '../database.just'test:cargo test --all-features-build:- SQLX_OFFLINE=true cargo lambda build --release --bin {{lambda_name}} --output-format zip+build compiler="":+ SQLX_OFFLINE=true cargo lambda build {{ if compiler == "" { "" } else { "--compiler " + compiler } }} --release --bin {{lambda_name}} --output-format zipcheck:SQLX_OFFLINE=true cargo check@@ -15,4 +15,4 @@ create-queues:AWS_REGION=us-east-1 aws --endpoint-url=http://localhost:4566 sqs create-queue --queue-name sfs-delete-queue.fifoprepare_db:- DATABASE_URL={{ DATABASE_URL }} cargo sqlx prepare\ No newline at end of file+ DATABASE_URL={{ DATABASE_URL }} sqlx prepare\ No newline at end of filediff --git a/rust/cloud-storage/email_sfs_delete_handler/justfile b/rust/cloud-storage/email_sfs_delete_handler/justfileindex 86400b6097..32ae0456fe 100644--- a/rust/cloud-storage/email_sfs_delete_handler/justfile+++ b/rust/cloud-storage/email_sfs_delete_handler/justfile@@ -5,8 +5,8 @@ import '../database.just'test:cargo test --all-features-build:- SQLX_OFFLINE=true cargo lambda build --release --bin {{lambda_name}} --output-format zip+build compiler="":+ SQLX_OFFLINE=true cargo lambda build {{ if compiler == "" { "" } else { "--compiler " + compiler } }} --release --bin {{lambda_name}} --output-format zipcheck:SQLX_OFFLINE=true cargo check@@ -15,4 +15,4 @@ create-queues:AWS_REGION=us-east-1 aws --endpoint-url=http://localhost:4566 sqs create-queue --queue-name my-test-scheduled-queue.fifoprepare_db:- DATABASE_URL={{ DATABASE_URL }} cargo sqlx prepare\ No newline at end of file+ DATABASE_URL={{ DATABASE_URL }} sqlx prepare\ No newline at end of filediff --git a/rust/cloud-storage/email_suppression_handler/justfile b/rust/cloud-storage/email_suppression_handler/justfileindex 0f56254c29..28dddb5863 100644--- a/rust/cloud-storage/email_suppression_handler/justfile+++ b/rust/cloud-storage/email_suppression_handler/justfile@@ -8,8 +8,8 @@ deploy-dev:test:cargo test --all-features-build:- SQLX_OFFLINE=true cargo lambda build --release --bin {{lambda_name}} --output-format zip+build compiler="":+ SQLX_OFFLINE=true cargo lambda build {{ if compiler == "" { "" } else { "--compiler " + compiler } }} --release --bin {{lambda_name}} --output-format zipcheck:SQLX_OFFLINE=true cargo checkdiff --git a/rust/cloud-storage/entity_access/src/domain/service/test.rs b/rust/cloud-storage/entity_access/src/domain/service/test.rsindex 1d57f6bbc1..2ea587a096 100644--- a/rust/cloud-storage/entity_access/src/domain/service/test.rs+++ b/rust/cloud-storage/entity_access/src/domain/service/test.rs@@ -1,5 +1,6 @@//! Unit tests for the EntityAccessService.+#[allow(unused_imports)]use super::*;use crate::domain::models::{AdminParticipantRole, CallChannelInfo, CommentAccessLevel, EditAccessLevel, EntityAccessAuth,@@ -67,6 +68,7 @@ impl MockRepo {self}+ #[allow(dead_code)]fn with_call_access(mut self, level: AccessLevel) -> Self {self.call_access = Arc::new(Mutex::new(Some(level)));selfdiff --git a/rust/cloud-storage/entity_access/src/outbound/pg_access_repo/queries/call_access/test.rs b/rust/cloud-storage/entity_access/src/outbound/pg_access_repo/queries/call_access/test.rsindex 9f63d7a0b0..df9a305ecb 100644--- a/rust/cloud-storage/entity_access/src/outbound/pg_access_repo/queries/call_access/test.rs+++ b/rust/cloud-storage/entity_access/src/outbound/pg_access_repo/queries/call_access/test.rs@@ -1,3 +1,4 @@+#[allow(unused_imports)]use super::*;use crate::domain::models::AccessLevel;use macro_db_migrator::MACRO_DB_MIGRATIONS;diff --git a/rust/cloud-storage/frecency/src/outbound/mock.rs b/rust/cloud-storage/frecency/src/outbound/mock.rsindex 62ad4d077c..3f1d3a4a5e 100644--- a/rust/cloud-storage/frecency/src/outbound/mock.rs+++ b/rust/cloud-storage/frecency/src/outbound/mock.rs@@ -5,13 +5,6 @@ use mockall::mock;use model_entity::Entity;use std::convert::Infallible;-const _NOT_PROD: () = const {- assert!(- cfg!(debug_assertions),- "You are trying to include mock code in a production build please run `cargo tree -i frecency -e features -p <FAILING_PACKAGE>` to see how the mock feature is being included in [dependencies]"- );-};-mock! {pub FrecencyStorage {}impl AggregateFrecencyStorage for FrecencyStorage {diff --git a/rust/cloud-storage/github/src/domain/service/sync/test.rs b/rust/cloud-storage/github/src/domain/service/sync/test.rsindex 2ae34d797f..594db4344f 100644--- a/rust/cloud-storage/github/src/domain/service/sync/test.rs+++ b/rust/cloud-storage/github/src/domain/service/sync/test.rs@@ -120,11 +120,11 @@ impl DocumentService for StubDocumentService {}async fn get_project_children(&self,- project_id: &str,+ _project_id: &str,) -> Result<Vec<Entity<'static>>, DocumentError> {unimplemented!()}- async fn get_project_name(&self, project_id: &str) -> Result<String, DocumentError> {+ async fn get_project_name(&self, _project_id: &str) -> Result<String, DocumentError> {unimplemented!()}async fn get_document(diff --git a/rust/cloud-storage/gmail_client/src/auth.rs b/rust/cloud-storage/gmail_client/src/auth.rsindex 3a94e03a7b..35ef8ca127 100644--- a/rust/cloud-storage/gmail_client/src/auth.rs+++ b/rust/cloud-storage/gmail_client/src/auth.rs@@ -126,8 +126,6 @@ mod tests {let jwt = std::env::var("GOOGLE_TEST_JWT").context("GOOGLE_TEST_JWT environment variable not set")?;- let expected_audience = gmail_client.audience.as_str();-let claims = verify_google_jwt(&gmail_client, &jwt, public_keys.keys)?;assert_eq!(diff --git a/rust/cloud-storage/image_optimizer/justfile b/rust/cloud-storage/image_optimizer/justfileindex 4f1c35b27e..f856004f6c 100644--- a/rust/cloud-storage/image_optimizer/justfile+++ b/rust/cloud-storage/image_optimizer/justfile@@ -1,4 +1,4 @@lambda_name := file_name(justfile_directory())-build:- cargo lambda build --release --bin {{lambda_name}} --output-format zip+build compiler="":+ cargo lambda build {{ if compiler == "" { "" } else { "--compiler " + compiler } }} --release --bin {{lambda_name}} --output-format zipdiff --git a/rust/cloud-storage/ip_extractor/src/test.rs b/rust/cloud-storage/ip_extractor/src/test.rsindex 8810cf05fe..a3b4bbc5d7 100644--- a/rust/cloud-storage/ip_extractor/src/test.rs+++ b/rust/cloud-storage/ip_extractor/src/test.rs@@ -224,6 +224,7 @@ fn error_response_parse_err_is_400() {#[test]fn error_response_invalid_ascii_is_400() {+ #[expect(invalid_from_utf8)]let err = ClientIpError::InvalidAscii(std::str::from_utf8(b"\xff").unwrap_err());let response = err.into_response();assert_eq!(response.status(), StatusCode::BAD_REQUEST);diff --git a/rust/cloud-storage/justfile b/rust/cloud-storage/justfileindex c9ab5aa114..a688e66f2c 100644--- a/rust/cloud-storage/justfile+++ b/rust/cloud-storage/justfile@@ -29,24 +29,24 @@ build_dev_service_images:docker build -f Dockerfile.search_processing_service.dev --target search_processing_service -t macro-local-search-processing-service:dev .# Build all lambda functions-build_lambdas:- ulimit -n 10240 && just docx_unzip_handler/build- ulimit -n 10240 && just delete_chat_handler/build- ulimit -n 10240 && just organization_retention_handler/build- ulimit -n 10240 && just organization_retention_trigger/build- ulimit -n 10240 && just upload_extractor_lambda_trigger/build- ulimit -n 10240 && just upload_extractor_lambda_handler/build- ulimit -n 10240 && just worker_trigger/build- ulimit -n 10240 && just dataloss_prevention_handler/build- ulimit -n 10240 && just search_upload_handler/build- ulimit -n 10240 && just document_text_extractor/build- ulimit -n 10240 && just email_suppression_handler/build- ulimit -n 10240 && just deleted_item_poller/build- ulimit -n 10240 && just email_refresh_handler/build- ulimit -n 10240 && just user_link_cleanup_handler/build- ulimit -n 10240 && just email_scheduled_handler/build- ulimit -n 10240 && just email_sfs_delete_handler/build- ulimit -n 10240 && just image_optimizer/build+build_lambdas compiler="":+ ulimit -n 10240 && just docx_unzip_handler/build {{compiler}}+ ulimit -n 10240 && just delete_chat_handler/build {{compiler}}+ ulimit -n 10240 && just organization_retention_handler/build {{compiler}}+ ulimit -n 10240 && just organization_retention_trigger/build {{compiler}}+ ulimit -n 10240 && just upload_extractor_lambda_trigger/build {{compiler}}+ ulimit -n 10240 && just upload_extractor_lambda_handler/build {{compiler}}+ ulimit -n 10240 && just worker_trigger/build {{compiler}}+ ulimit -n 10240 && just dataloss_prevention_handler/build {{compiler}}+ ulimit -n 10240 && just search_upload_handler/build {{compiler}}+ ulimit -n 10240 && just document_text_extractor/build {{compiler}}+ ulimit -n 10240 && just email_suppression_handler/build {{compiler}}+ ulimit -n 10240 && just deleted_item_poller/build {{compiler}}+ ulimit -n 10240 && just email_refresh_handler/build {{compiler}}+ ulimit -n 10240 && just user_link_cleanup_handler/build {{compiler}}+ ulimit -n 10240 && just email_scheduled_handler/build {{compiler}}+ ulimit -n 10240 && just email_sfs_delete_handler/build {{compiler}}+ ulimit -n 10240 && just image_optimizer/build {{compiler}}# TESTINGdiff --git a/rust/cloud-storage/macro_auth/src/middleware/decode_jwt.rs b/rust/cloud-storage/macro_auth/src/middleware/decode_jwt.rsindex 550c7c17b8..775a8cb0d0 100644--- a/rust/cloud-storage/macro_auth/src/middleware/decode_jwt.rs+++ b/rust/cloud-storage/macro_auth/src/middleware/decode_jwt.rs@@ -53,6 +53,7 @@ impl JwtValidationArgs {}#[cfg(feature = "testing")]+ #[allow(dead_code)]/// create a new instance of Self with all empty valuespub fn new_testing() -> Self {Self {diff --git a/rust/cloud-storage/macro_db_client/src/document/v2/create.rs b/rust/cloud-storage/macro_db_client/src/document/v2/create.rsindex dba13421d1..09c8813100 100644--- a/rust/cloud-storage/macro_db_client/src/document/v2/create.rs+++ b/rust/cloud-storage/macro_db_client/src/document/v2/create.rs@@ -323,9 +323,9 @@ async fn insert_document_with_id(#[cfg(test)]mod tests {+ #[allow(unused_imports)]use super::*;- use chrono::{TimeZone, Utc};- use model::folder::FileSystemNode::File;+ use chrono::TimeZone;use sqlx::{Pool, Postgres};#[sqlx::test(fixtures(path = "../../../fixtures", scripts("basic_user_with_documents")))]diff --git a/rust/cloud-storage/macro_db_client/src/instructions/get.rs b/rust/cloud-storage/macro_db_client/src/instructions/get.rsindex 5d0c9424ee..0f28a83768 100644--- a/rust/cloud-storage/macro_db_client/src/instructions/get.rs+++ b/rust/cloud-storage/macro_db_client/src/instructions/get.rs@@ -32,6 +32,7 @@ pub async fn get_instructions_document(mod tests {use super::*;use crate::instructions::create::create_instructions_document;+ #[allow(unused_imports)]use macro_user_id::cowlike::CowLike;use sqlx::{Pool, Postgres};diff --git a/rust/cloud-storage/macro_db_client/src/user/get_user_name/tests.rs b/rust/cloud-storage/macro_db_client/src/user/get_user_name/tests.rsindex 8120adc7d4..bef1f34816 100644--- a/rust/cloud-storage/macro_db_client/src/user/get_user_name/tests.rs+++ b/rust/cloud-storage/macro_db_client/src/user/get_user_name/tests.rs@@ -1,3 +1,4 @@+#[allow(unused_imports)]use super::*;use crate::user::get_user_name::get_user_names_with_email;use macro_user_id::cowlike::CowLike;diff --git a/rust/cloud-storage/mcp_service/src/main.rs b/rust/cloud-storage/mcp_service/src/main.rsindex 7773315d89..27e3af96ad 100644--- a/rust/cloud-storage/mcp_service/src/main.rs+++ b/rust/cloud-storage/mcp_service/src/main.rs@@ -37,10 +37,12 @@ async fn main() -> anyhow::Result<()> {))},Arc::new(LocalSessionManager::default()),- StreamableHttpServerConfig {- stateful_mode: false,- json_response: true,- ..Default::default()+ {+ StreamableHttpServerConfig {+ stateful_mode: false,+ json_response: true,+ ..Default::default()+ }},);diff --git a/rust/cloud-storage/notification/src/domain/models/queue_message/test.rs b/rust/cloud-storage/notification/src/domain/models/queue_message/test.rsindex e191d2601f..3596dbf841 100644--- a/rust/cloud-storage/notification/src/domain/models/queue_message/test.rs+++ b/rust/cloud-storage/notification/src/domain/models/queue_message/test.rs@@ -53,7 +53,7 @@ fn test_apns_targets_deserializes_with_per_user_endpoints() {#[test]fn test_ingress_queue_message_round_trip() {- use crate::domain::models::{SendNotificationRequestBuilder, TaggedContent};+ use crate::domain::models::SendNotificationRequestBuilder;use model_entity::EntityType;use std::collections::HashSet;diff --git a/rust/cloud-storage/organization_retention_handler/justfile b/rust/cloud-storage/organization_retention_handler/justfileindex dee71b39a9..30c68a0e79 100644--- a/rust/cloud-storage/organization_retention_handler/justfile+++ b/rust/cloud-storage/organization_retention_handler/justfile@@ -8,5 +8,5 @@ deploy-dev:test:cargo test --all-features-build:- SQLX_OFFLINE=true cargo lambda build --release --bin {{lambda_name}} --output-format zip\ No newline at end of file+build compiler="":+ SQLX_OFFLINE=true cargo lambda build {{ if compiler == "" { "" } else { "--compiler " + compiler } }} --release --bin {{lambda_name}} --output-format zip\ No newline at end of filediff --git a/rust/cloud-storage/organization_retention_trigger/justfile b/rust/cloud-storage/organization_retention_trigger/justfileindex 756e290719..f110259996 100644--- a/rust/cloud-storage/organization_retention_trigger/justfile+++ b/rust/cloud-storage/organization_retention_trigger/justfile@@ -3,5 +3,5 @@ lambda_name := file_name(justfile_directory())test:cargo test --all-features-build:- SQLX_OFFLINE=true cargo lambda build --release --bin {{lambda_name}} --output-format zip\ No newline at end of file+build compiler="":+ SQLX_OFFLINE=true cargo lambda build {{ if compiler == "" { "" } else { "--compiler " + compiler } }} --release --bin {{lambda_name}} --output-format zip\ No newline at end of filediff --git a/rust/cloud-storage/properties/src/domain/test.rs b/rust/cloud-storage/properties/src/domain/test.rsindex fe3569c990..5fab0c0d13 100644--- a/rust/cloud-storage/properties/src/domain/test.rs+++ b/rust/cloud-storage/properties/src/domain/test.rs@@ -539,7 +539,7 @@ async fn check_notifications(test_case: NotificationTestCase) {// Mock: send notificationsif test_case.notification_service_available && test_case.expected_notification_count > 0 {let expected_count = test_case.expected_notification_count;- let expected_recipients = test_case.expected_recipient_ids.clone();+ let _expected_recipients = test_case.expected_recipient_ids.clone();notif_service.expect_send_notification().times(expected_count)diff --git a/rust/cloud-storage/properties/src/inbound/toolset/test.rs b/rust/cloud-storage/properties/src/inbound/toolset/test.rsindex ed869fc839..4ec76267d9 100644--- a/rust/cloud-storage/properties/src/inbound/toolset/test.rs+++ b/rust/cloud-storage/properties/src/inbound/toolset/test.rs@@ -1,3 +1,4 @@+#[allow(unused_imports)]use super::*;use ai::generate_tool_input_schema;use ai::tool::types::tool_object::validate_tool_schema;diff --git a/rust/cloud-storage/scheduled_action/src/bins/service.rs b/rust/cloud-storage/scheduled_action/src/bins/service.rsindex 983ace311d..2bb52ef422 100644--- a/rust/cloud-storage/scheduled_action/src/bins/service.rs+++ b/rust/cloud-storage/scheduled_action/src/bins/service.rs@@ -1,3 +1,4 @@+#![recursion_limit = "256"]use std::sync::Arc;use ai_tools::build_tool_service_context_from_env;diff --git a/rust/cloud-storage/search_upload_handler/justfile b/rust/cloud-storage/search_upload_handler/justfileindex d4f2a174d9..8291c8bba8 100644--- a/rust/cloud-storage/search_upload_handler/justfile+++ b/rust/cloud-storage/search_upload_handler/justfile@@ -8,5 +8,5 @@ deploy-dev:test:cargo test --all-features-build:- cargo lambda build --release --bin {{lambda_name}} --output-format zip\ No newline at end of file+build compiler="":+ cargo lambda build {{ if compiler == "" { "" } else { "--compiler " + compiler } }} --release --bin {{lambda_name}} --output-format zip\ No newline at end of filediff --git a/rust/cloud-storage/seed_cli/src/service/auth/mod.rs b/rust/cloud-storage/seed_cli/src/service/auth/mod.rsindex 79d0b2557c..f6ae5b25be 100644--- a/rust/cloud-storage/seed_cli/src/service/auth/mod.rs+++ b/rust/cloud-storage/seed_cli/src/service/auth/mod.rs@@ -12,12 +12,14 @@ use fusionauth::FusionAuthClient;use mockall::automock;/// Wrapper around the FusionAuth client.+#[cfg_attr(test, allow(dead_code))]pub struct SeedAuth {/// Fusionauth clientinner: FusionAuthClient,}#[cfg_attr(test, automock)]+#[cfg_attr(test, allow(dead_code))]impl SeedAuth {/// Create a new auth wrapper.pub fn new(inner: FusionAuthClient) -> Self {diff --git a/rust/cloud-storage/seed_cli/src/service/db/mod.rs b/rust/cloud-storage/seed_cli/src/service/db/mod.rsindex 4e1d1c8383..0c97f331a2 100644--- a/rust/cloud-storage/seed_cli/src/service/db/mod.rs+++ b/rust/cloud-storage/seed_cli/src/service/db/mod.rs@@ -21,12 +21,14 @@ use models_email::email::service;use models_permissions::share_permission::access_level::AccessLevel;/// Wrapper around the database connection pool.+#[cfg_attr(test, allow(dead_code))]pub struct SeedDb {/// The macrodb poolinner: sqlx::PgPool,}#[cfg_attr(test, automock)]+#[cfg_attr(test, allow(dead_code))]impl SeedDb {/// Create a new database wrapper.pub fn new(inner: sqlx::PgPool) -> Self {diff --git a/rust/cloud-storage/seed_cli/src/service/s3.rs b/rust/cloud-storage/seed_cli/src/service/s3.rsindex 94974802a2..4fdf8b4590 100644--- a/rust/cloud-storage/seed_cli/src/service/s3.rs+++ b/rust/cloud-storage/seed_cli/src/service/s3.rs@@ -10,6 +10,7 @@ use anyhow::Context;use mockall::automock;/// Wrapper around the database connection pool.+#[cfg_attr(test, allow(dead_code))]pub struct SeedS3 {bucket: String,/// The macrodb pool@@ -17,6 +18,7 @@ pub struct SeedS3 {}#[cfg_attr(test, automock)]+#[cfg_attr(test, allow(dead_code))]impl SeedS3 {/// Create a new database wrapper.pub fn new(bucket: &str, inner: aws_sdk_s3::Client) -> Self {diff --git a/rust/cloud-storage/soup/src/inbound/toolset/test.rs b/rust/cloud-storage/soup/src/inbound/toolset/test.rsindex d8e964cf51..9b9ab327dd 100644--- a/rust/cloud-storage/soup/src/inbound/toolset/test.rs+++ b/rust/cloud-storage/soup/src/inbound/toolset/test.rs@@ -1,4 +1,5 @@use super::list_entities::build_summary;+#[allow(unused_imports)]use super::*;use ai::generate_tool_input_schema;use ai::tool::types::tool_object::validate_tool_schema;diff --git a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rsindex 3883743a01..53e4d462bf 100644--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rs+++ b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rs@@ -3117,7 +3117,7 @@ async fn test_exhaustive_paginate_all_sort_methods(pool: Pool<Postgres>) -> anyh] {let mut all_ids: Vec<Uuid> = Vec::new();let mut current_query: Query<Uuid, SimpleSortMethod, ()> = Query::Sort(sort, ());- let mut page_count = 0;+ let mut _page_count = 0;loop {let result =@@ -3128,7 +3128,7 @@ async fn test_exhaustive_paginate_all_sort_methods(pool: Pool<Postgres>) -> anyh.into_page();all_ids.extend(result.items.iter().map(|i| i.id()));- page_count += 1;+ _page_count += 1;match result.next_cursor {Some(cursor) => {diff --git a/rust/cloud-storage/sqlx.just b/rust/cloud-storage/sqlx.justindex 74b52d6bee..ef2aeeb7bc 100644--- a/rust/cloud-storage/sqlx.just+++ b/rust/cloud-storage/sqlx.just@@ -1,6 +1,6 @@[no-cd]create_db $DATABASE_URL:- cargo sqlx database create+ sqlx database create[no-cd]check_db $DATABASE_URL:@@ -8,19 +8,19 @@ check_db $DATABASE_URL:[no-cd]migrate_db $DATABASE_URL:- cargo sqlx migrate run+ sqlx migrate run[no-cd]prepare_db $DATABASE_URL *FLAGS:- cargo sqlx prepare --workspace -- {{ FLAGS }} --all-features+ sqlx prepare --workspace -- {{ FLAGS }} --all-features --tests[no-cd]drop_db $DATABASE_URL *FLAGS:- cargo sqlx database drop {{ FLAGS }}+ sqlx database drop {{ FLAGS }}[no-cd]setup $DATABASE_URL:- cargo sqlx database setup+ sqlx database setup[no-cd]setup_prepare DATABASE_URL: (setup DATABASE_URL) (prepare_db DATABASE_URL)diff --git a/rust/cloud-storage/target/lambda/dataloss_prevention_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/dataloss_prevention_handler/bootstrap.zipindex e75c8715c8..b9fbc1b037 100644Binary files a/rust/cloud-storage/target/lambda/dataloss_prevention_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/dataloss_prevention_handler/bootstrap.zip differdiff --git a/rust/cloud-storage/target/lambda/delete_chat_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/delete_chat_handler/bootstrap.zipindex b305901e9a..253f5c9a61 100644Binary files a/rust/cloud-storage/target/lambda/delete_chat_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/delete_chat_handler/bootstrap.zip differdiff --git a/rust/cloud-storage/target/lambda/deleted_item_poller/bootstrap.zip b/rust/cloud-storage/target/lambda/deleted_item_poller/bootstrap.zipindex f1dc13d5d2..83fea639ef 100644Binary files a/rust/cloud-storage/target/lambda/deleted_item_poller/bootstrap.zip and b/rust/cloud-storage/target/lambda/deleted_item_poller/bootstrap.zip differdiff --git a/rust/cloud-storage/target/lambda/document_text_extractor/bootstrap.zip b/rust/cloud-storage/target/lambda/document_text_extractor/bootstrap.zipindex fe1c29c962..420bb8ecf6 100644Binary files a/rust/cloud-storage/target/lambda/document_text_extractor/bootstrap.zip and b/rust/cloud-storage/target/lambda/document_text_extractor/bootstrap.zip differdiff --git a/rust/cloud-storage/target/lambda/docx_unzip_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/docx_unzip_handler/bootstrap.zipindex fafdc845ff..895652b8bf 100644Binary files a/rust/cloud-storage/target/lambda/docx_unzip_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/docx_unzip_handler/bootstrap.zip differdiff --git a/rust/cloud-storage/target/lambda/email_refresh_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/email_refresh_handler/bootstrap.zipindex 533916d6b9..4a2aecfdc6 100644Binary files a/rust/cloud-storage/target/lambda/email_refresh_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/email_refresh_handler/bootstrap.zip differdiff --git a/rust/cloud-storage/target/lambda/email_scheduled_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/email_scheduled_handler/bootstrap.zipindex 1600af638d..e15f949cb1 100644Binary files a/rust/cloud-storage/target/lambda/email_scheduled_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/email_scheduled_handler/bootstrap.zip differdiff --git a/rust/cloud-storage/target/lambda/email_sfs_delete_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/email_sfs_delete_handler/bootstrap.zipindex f1e42bc12a..23a9466258 100644Binary files a/rust/cloud-storage/target/lambda/email_sfs_delete_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/email_sfs_delete_handler/bootstrap.zip differdiff --git a/rust/cloud-storage/target/lambda/email_suppression_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/email_suppression_handler/bootstrap.zipindex cef39e46a1..f64be1cb5f 100644Binary files a/rust/cloud-storage/target/lambda/email_suppression_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/email_suppression_handler/bootstrap.zip differdiff --git a/rust/cloud-storage/target/lambda/image_optimizer/bootstrap.zip b/rust/cloud-storage/target/lambda/image_optimizer/bootstrap.zipindex eaa68e3bd0..7514c4eb02 100644Binary files a/rust/cloud-storage/target/lambda/image_optimizer/bootstrap.zip and b/rust/cloud-storage/target/lambda/image_optimizer/bootstrap.zip differdiff --git a/rust/cloud-storage/target/lambda/organization_retention_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/organization_retention_handler/bootstrap.zipindex e434eae691..9389db6e97 100644Binary files a/rust/cloud-storage/target/lambda/organization_retention_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/organization_retention_handler/bootstrap.zip differdiff --git a/rust/cloud-storage/target/lambda/organization_retention_trigger/bootstrap.zip b/rust/cloud-storage/target/lambda/organization_retention_trigger/bootstrap.zipindex 1cc3dca60d..ff8bafdb2e 100644Binary files a/rust/cloud-storage/target/lambda/organization_retention_trigger/bootstrap.zip and b/rust/cloud-storage/target/lambda/organization_retention_trigger/bootstrap.zip differdiff --git a/rust/cloud-storage/target/lambda/search_upload_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/search_upload_handler/bootstrap.zipindex 899c01aef3..e3b940f1be 100644Binary files a/rust/cloud-storage/target/lambda/search_upload_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/search_upload_handler/bootstrap.zip differdiff --git a/rust/cloud-storage/target/lambda/upload_extractor_lambda_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/upload_extractor_lambda_handler/bootstrap.zipindex ed61c35d82..a56f72395e 100644Binary files a/rust/cloud-storage/target/lambda/upload_extractor_lambda_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/upload_extractor_lambda_handler/bootstrap.zip differdiff --git a/rust/cloud-storage/target/lambda/upload_extractor_lambda_trigger/bootstrap.zip b/rust/cloud-storage/target/lambda/upload_extractor_lambda_trigger/bootstrap.zipindex 0be33dc684..7044426922 100644Binary files a/rust/cloud-storage/target/lambda/upload_extractor_lambda_trigger/bootstrap.zip and b/rust/cloud-storage/target/lambda/upload_extractor_lambda_trigger/bootstrap.zip differdiff --git a/rust/cloud-storage/target/lambda/user_link_cleanup_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/user_link_cleanup_handler/bootstrap.zipindex 9f654b21fa..4ba61e875e 100644Binary files a/rust/cloud-storage/target/lambda/user_link_cleanup_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/user_link_cleanup_handler/bootstrap.zip differdiff --git a/rust/cloud-storage/target/lambda/worker_trigger/bootstrap.zip b/rust/cloud-storage/target/lambda/worker_trigger/bootstrap.zipindex 4be2371584..3d9c0cf954 100644Binary files a/rust/cloud-storage/target/lambda/worker_trigger/bootstrap.zip and b/rust/cloud-storage/target/lambda/worker_trigger/bootstrap.zip differdiff --git a/rust/cloud-storage/upload_extractor_lambda_handler/justfile b/rust/cloud-storage/upload_extractor_lambda_handler/justfileindex b06fca326a..b104b61c33 100644--- a/rust/cloud-storage/upload_extractor_lambda_handler/justfile+++ b/rust/cloud-storage/upload_extractor_lambda_handler/justfile@@ -3,8 +3,8 @@ lambda_name := file_name(justfile_directory())test:cargo test --all-features-build:- cargo lambda build --release --bin {{lambda_name}} --output-format zip+build compiler="":+ cargo lambda build {{ if compiler == "" { "" } else { "--compiler " + compiler } }} --release --bin {{lambda_name}} --output-format zipwatch:cargo lambda watch -F localdiff --git a/rust/cloud-storage/upload_extractor_lambda_trigger/justfile b/rust/cloud-storage/upload_extractor_lambda_trigger/justfileindex dd63405190..32b94e284a 100644--- a/rust/cloud-storage/upload_extractor_lambda_trigger/justfile+++ b/rust/cloud-storage/upload_extractor_lambda_trigger/justfile@@ -3,8 +3,8 @@ lambda_name := file_name(justfile_directory())test:cargo test --all-features-build:- cargo lambda build --release --bin {{lambda_name}} --output-format zip+build compiler="":+ cargo lambda build {{ if compiler == "" { "" } else { "--compiler " + compiler } }} --release --bin {{lambda_name}} --output-format zipwatch:cargo lambda watchdiff --git a/rust/cloud-storage/user_link_cleanup_handler/justfile b/rust/cloud-storage/user_link_cleanup_handler/justfileindex 50572027f3..7bdd424465 100644--- a/rust/cloud-storage/user_link_cleanup_handler/justfile+++ b/rust/cloud-storage/user_link_cleanup_handler/justfile@@ -8,8 +8,8 @@ deploy-dev:test:cargo test --all-features-build:- SQLX_OFFLINE=true cargo lambda build --release --bin {{lambda_name}} --output-format zip+build compiler="":+ SQLX_OFFLINE=true cargo lambda build {{ if compiler == "" { "" } else { "--compiler " + compiler } }} --release --bin {{lambda_name}} --output-format zipcheck:SQLX_OFFLINE=true cargo checkdiff --git a/rust/cloud-storage/worker_trigger/justfile b/rust/cloud-storage/worker_trigger/justfileindex 64fa64714a..a1e86c5f99 100644--- a/rust/cloud-storage/worker_trigger/justfile+++ b/rust/cloud-storage/worker_trigger/justfile@@ -3,5 +3,5 @@ lambda_name := file_name(justfile_directory())test:cargo test --all-features-build:- cargo lambda build --release --bin {{lambda_name}} --output-format zip\ No newline at end of file+build compiler="":+ cargo lambda build {{ if compiler == "" { "" } else { "--compiler " + compiler } }} --release --bin {{lambda_name}} --output-format zip\ No newline at end of file