From 952c4b5f6e629a32b3e15d7095f7bbf72a756af9 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Sat, 7 Nov 2026 19:42:27 +0000 Subject: [PATCH] chore: use mise.toml as the one source for toolchain versions (#9039) --- .devcontainer/Dockerfile | 16 ++- .devcontainer/devcontainer-lock.json | 5 - .devcontainer/devcontainer.json | 10 +- .github/actions/setup-tools/action.yml | 34 +++++ .github/workflows/auto-merge-dependencies.yml | 3 + .github/workflows/build-package.yml | 27 +--- .github/workflows/docs.yml | 6 +- .github/workflows/e2e.yml | 11 +- .github/workflows/locale-sync.yml | 12 +- .github/workflows/scheduled-checks.yml | 6 +- .github/workflows/test-backend.yml | 18 +-- .github/workflows/test-frontend.yml | 13 +- AGENTS.md | 1 + docker/Dockerfile | 6 +- .../developers-guide/starting-dev-server.md | 16 ++- mise.toml | 11 ++ renovate.json | 119 ++++++++++++++++-- tests/unit_tests/test_oidc_ssl.py | 17 ++- 18 files changed, 227 insertions(+), 104 deletions(-) create mode 100644 .github/actions/setup-tools/action.yml create mode 100644 mise.toml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 535a5a5bc..5a325dd2f 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,6 +1,5 @@ # syntax=docker/dockerfile:1 -ARG VARIANT="3.14-trixie" -FROM mcr.microsoft.com/devcontainers/python:${VARIANT} +FROM mcr.microsoft.com/devcontainers/python:3.14-trixie # Install additional OS packages RUN apt-get update \ @@ -13,13 +12,12 @@ RUN apt-get update \ libsasl2-dev libldap2-dev libssl-dev \ gnupg gnupg2 gnupg1 -# Install uv -COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv -ENV UV_LINK_MODE=copy - -# Install Taskfile -RUN curl -1sLf 'https://dl.cloudsmith.io/public/task/task/setup.deb.sh' | sudo -E bash \ - && apt-get install -y task +# Python stays with the base image so the interpreter path in devcontainer.json doesn't move. +COPY --from=jdxcode/mise:2026.10.25 /usr/local/bin/mise /usr/local/bin/mise +ENV MISE_DISABLE_TOOLS=python \ + MISE_TRUSTED_CONFIG_PATHS=/workspaces \ + PATH="/home/vscode/.local/share/mise/shims:${PATH}" \ + UV_LINK_MODE=copy # Create directory for Docker Secrets RUN mkdir -p /run/secrets diff --git a/.devcontainer/devcontainer-lock.json b/.devcontainer/devcontainer-lock.json index d45260ee8..35351e5a1 100644 --- a/.devcontainer/devcontainer-lock.json +++ b/.devcontainer/devcontainer-lock.json @@ -9,11 +9,6 @@ "version": "1.1.0", "resolved": "ghcr.io/devcontainers/features/github-cli@sha256:d22f50b70ed75339b4eed1ba9ecde3a1791f90e88d37936517e3bace0bbad671", "integrity": "sha256:d22f50b70ed75339b4eed1ba9ecde3a1791f90e88d37936517e3bace0bbad671" - }, - "ghcr.io/devcontainers/features/node:2": { - "version": "2.0.0", - "resolved": "ghcr.io/devcontainers/features/node@sha256:fedd4c11f7adfb64283b578dddc7da906728daa25fa293351c9d913231acf12f", - "integrity": "sha256:fedd4c11f7adfb64283b578dddc7da906728daa25fa293351c9d913231acf12f" } } } diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index fe56bde9c..da4fdae2f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,10 +4,7 @@ "name": "Python 3", "build": { "dockerfile": "Dockerfile", - "context": "..", - "args": { - "VARIANT": "3.14-trixie" - } + "context": ".." }, "mounts": [ "source=mealie-devcontainer-workspace,target=/workspaces/mealie/frontend/node_modules,type=volume", @@ -44,12 +41,9 @@ 51204, // used for test coverage report 24678 // used by nuxt when hot-reloading using polling ], - "onCreateCommand": "sudo chown vscode:vscode /workspaces/mealie/.venv && task setup --force", + "onCreateCommand": "sudo chown vscode:vscode /workspaces/mealie/.venv /workspaces/mealie/frontend/node_modules && mise install && task setup --force", "remoteUser": "vscode", "features": { - "ghcr.io/devcontainers/features/node:2": { - "version": "24" - }, "ghcr.io/devcontainers/features/github-cli:1": {}, "ghcr.io/devcontainers/features/docker-in-docker:4": { "moby": false diff --git a/.github/actions/setup-tools/action.yml b/.github/actions/setup-tools/action.yml new file mode 100644 index 000000000..f676e07f2 --- /dev/null +++ b/.github/actions/setup-tools/action.yml @@ -0,0 +1,34 @@ +name: Set up tools +description: Install the dev toolchain from mise.toml (cached) and optionally restore the pnpm store +inputs: + tools: + description: Tools from mise.toml to install, separated by spaces (e.g. "node pnpm"). Empty installs all of them. + required: false + default: "" + cache-pnpm-store: + description: Restore and save the pnpm store, keyed on every pnpm-lock.yaml in the repo. + required: false + default: "false" +runs: + using: composite + steps: + - name: Install tools with mise + uses: jdx/mise-action@v5 + with: + # renovate: datasource=github-releases depName=jdx/mise extractVersion=^v(?.+)$ + version: 2026.10.25 + install_args: ${{ inputs.tools }} + + - name: Find pnpm store + id: pnpm-store + if: inputs.cache-pnpm-store == 'true' + shell: bash + run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT" + + - name: Cache pnpm store + if: inputs.cache-pnpm-store == 'true' + uses: actions/cache@v5 + with: + path: ${{ steps.pnpm-store.outputs.path }} + key: pnpm-store-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: pnpm-store-${{ runner.os }}- diff --git a/.github/workflows/auto-merge-dependencies.yml b/.github/workflows/auto-merge-dependencies.yml index 65e0ec8f5..4bae0a86f 100644 --- a/.github/workflows/auto-merge-dependencies.yml +++ b/.github/workflows/auto-merge-dependencies.yml @@ -47,6 +47,9 @@ jobs: [[ "$file" == "uv.lock" ]] || \ [[ "$file" == "frontend/package.json" ]] || \ [[ "$file" == "frontend/pnpm-lock.yaml" ]] || \ + [[ "$file" == "mise.toml" ]] || \ + [[ "$file" == ".devcontainer/Dockerfile" ]] || \ + [[ "$file" == ".github/actions/setup-tools/action.yml" ]] || \ [[ "$file" =~ ^docker/ ]]; then continue fi diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml index 7324f241d..d31b869c8 100644 --- a/.github/workflows/build-package.yml +++ b/.github/workflows/build-package.yml @@ -16,27 +16,16 @@ jobs: runs-on: ubuntu-latest steps: - - name: Install Task - uses: arduino/setup-task@v2 - with: - version: 3.x - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Check out repository uses: actions/checkout@v6 with: ref: ${{ inputs.ref || github.sha }} - - uses: pnpm/action-setup@v6 + - name: Set up tools + uses: ./.github/actions/setup-tools with: - version: 11 - - - name: Setup node env 🏗 - uses: actions/setup-node@v6 - with: - node-version: 24 - cache: "pnpm" - cache-dependency-path: "**/pnpm-lock.yaml" + tools: python node pnpm uv task + cache-pnpm-store: true - name: Install dependencies 👨🏻‍💻 run: pnpm install --prefer-offline @@ -46,14 +35,6 @@ jobs: run: pnpm generate working-directory: "frontend" - - name: Set up python - uses: actions/setup-python@v6 - with: - python-version: "3.14" - - - name: Install uv - run: pip install uv - - name: Copy the frontend into the package run: | rm -rf mealie/frontend diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2521e04a2..2c0d5299a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -28,8 +28,10 @@ jobs: steps: - uses: actions/checkout@v6 - - name: Install uv - uses: astral-sh/setup-uv@v4 + - name: Set up tools + uses: ./.github/actions/setup-tools + with: + tools: python uv - name: Install dependencies run: uv sync --only-group docs --no-install-project diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 824eedec1..84188cb13 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -11,14 +11,11 @@ jobs: working-directory: ./tests/e2e steps: - uses: actions/checkout@v6 - - uses: pnpm/action-setup@v6 + - name: Set up tools + uses: ./.github/actions/setup-tools with: - version: 11 - - uses: actions/setup-node@v6 - with: - node-version: 24 - cache: "pnpm" - cache-dependency-path: "**/pnpm-lock.yaml" + tools: node pnpm + cache-pnpm-store: true - name: Install dependencies run: pnpm install # This install takes about 50 seconds and needs nothing the image build diff --git a/.github/workflows/locale-sync.yml b/.github/workflows/locale-sync.yml index 4b721b580..2587043f4 100644 --- a/.github/workflows/locale-sync.yml +++ b/.github/workflows/locale-sync.yml @@ -31,20 +31,18 @@ jobs: with: token: ${{ steps.app-token.outputs.token }} - - name: Set up Python - uses: actions/setup-python@v6 + - name: Set up tools + uses: ./.github/actions/setup-tools with: - python-version: "3.14" - - - name: Install uv - run: pip install uv + tools: python uv - name: Load cached venv id: cached-python-dependencies uses: actions/cache@v5 with: + # The venv links to the mise Python, so a Python change in mise.toml must miss the cache path: .venv - key: venv-${{ runner.os }}-${{ hashFiles('**/uv.lock') }} + key: venv-${{ runner.os }}-${{ hashFiles('**/uv.lock', 'mise.toml') }} - name: Check venv cache id: cache-validate diff --git a/.github/workflows/scheduled-checks.yml b/.github/workflows/scheduled-checks.yml index 9c37592ef..6e700e1ca 100644 --- a/.github/workflows/scheduled-checks.yml +++ b/.github/workflows/scheduled-checks.yml @@ -15,10 +15,10 @@ jobs: - name: Checkout 🛎 uses: actions/checkout@v6 - - name: Setup Python - uses: actions/setup-python@v6 + - name: Set up tools + uses: ./.github/actions/setup-tools with: - python-version: "3.14" + tools: python - name: Set PY shell: bash diff --git a/.github/workflows/test-backend.yml b/.github/workflows/test-backend.yml index 23f567a5e..66d8242b8 100644 --- a/.github/workflows/test-backend.yml +++ b/.github/workflows/test-backend.yml @@ -44,24 +44,15 @@ jobs: # Steps steps: - - name: Install Task - uses: arduino/setup-task@v2 - with: - version: 3.x - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Check out repository uses: actions/checkout@v6 with: ref: ${{ inputs.ref || github.sha }} - - name: Set up python - uses: actions/setup-python@v6 + - name: Set up tools + uses: ./.github/actions/setup-tools with: - python-version: "3.14" - - - name: Install uv - run: pip install uv + tools: python uv task # Catches a lockfile resolved by an out-of-date uv, which silently ignores # the `exclude-newer` cooling window instead of erroring. UV_FROZEN must be @@ -73,8 +64,9 @@ jobs: id: cached-python-dependencies uses: actions/cache@v5 with: + # The venv links to the mise Python, so a Python change in mise.toml must miss the cache path: .venv - key: venv-${{ runner.os }}-${{ matrix.Database }}-${{ hashFiles('**/uv.lock') }} + key: venv-${{ runner.os }}-${{ matrix.Database }}-${{ hashFiles('**/uv.lock', 'mise.toml') }} - name: Check venv cache id: cache-validate diff --git a/.github/workflows/test-frontend.yml b/.github/workflows/test-frontend.yml index 306c75ca8..a01ed3b68 100644 --- a/.github/workflows/test-frontend.yml +++ b/.github/workflows/test-frontend.yml @@ -17,16 +17,11 @@ jobs: with: ref: ${{ inputs.ref || github.sha }} - - uses: pnpm/action-setup@v6 + - name: Set up tools + uses: ./.github/actions/setup-tools with: - version: 11 - - - name: Setup node env 🏗 - uses: actions/setup-node@v6 - with: - node-version: 24 - cache: "pnpm" - cache-dependency-path: "**/pnpm-lock.yaml" + tools: node pnpm + cache-pnpm-store: true - name: Install dependencies 👨🏻‍💻 run: pnpm install --prefer-offline diff --git a/AGENTS.md b/AGENTS.md index 0d1cc0dfa..b7eed5653 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -59,6 +59,7 @@ Mealie is a self-hosted recipe manager, meal planner, and shopping list applicat **Development workflow:** ```bash +mise install task setup # Install all dependencies (Python + Node) task dev:services # Start Postgres & Mailpit containers task py # Start FastAPI backend (port 9000) diff --git a/docker/Dockerfile b/docker/Dockerfile index a9a491323..18a66c740 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -4,7 +4,8 @@ FROM node:24@sha256:e7add2a490bb17d97b485b8641bd88455fff7839ade0f5eba493c3508124d413 \ AS frontend-builder -RUN npm install --global pnpm@11 +# renovate: datasource=npm depName=pnpm +RUN npm install --global pnpm@11.23.0 WORKDIR /frontend @@ -51,7 +52,8 @@ RUN apt-get update \ curl \ && rm -rf /var/lib/apt/lists/* -RUN pip install uv +# renovate: datasource=pypi depName=uv +RUN pip install uv==0.13.6 # Install from the committed lockfile; never re-resolve. The rolling # `exclude-newer` cooling window (pyproject [tool.uv]) would otherwise make diff --git a/docs/docs/contributors/developers-guide/starting-dev-server.md b/docs/docs/contributors/developers-guide/starting-dev-server.md index 4756ae74e..405ca6bed 100644 --- a/docs/docs/contributors/developers-guide/starting-dev-server.md +++ b/docs/docs/contributors/developers-guide/starting-dev-server.md @@ -17,6 +17,8 @@ Prerequisites First ensure that docker is running. Then when you clone the repo and open with VS Code you should see a popup asking you to reopen the project inside a development container. Click yes and it will build the development container and run the setup required to run both the backend API and the frontend webserver. This also pre-configures pre-commit hooks to ensure that the code is up to date before committing. +The dev container installs its tools with [mise](https://mise.jdx.dev/) from `mise.toml`, so it uses the same tool versions as a local setup. Python comes from the container's base image. + ### Windows Make sure the VSCode Dev Containers extension is installed, then select "Dev Containers: Clone Repository in Container Volume..." in the command palette (F1). Select your forked repo and choose the `mealie-next` branch, which contains the latest changes. This mounts your repository directly in WSL2, which [greatly improves the performance of the container](https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-a-git-repository-or-github-pr-in-an-isolated-container-volume), and enables hot-reloading for the frontend. Running the container on a mounted volume may not work correctly on Windows due to WSL permission mapping issues. @@ -32,11 +34,15 @@ Make sure the VSCode Dev Containers extension is installed, then select "Dev Con ### Prerequisites -- [Python 3.14](https://www.python.org/downloads/) -- [uv](https://docs.astral.sh/uv/) -- [Node](https://nodejs.org/en/) -- [pnpm](https://pnpm.io/installation) -- [task](https://taskfile.dev/#/installation) +[`mise.toml`](https://github.com/mealie-recipes/mealie/blob/mealie-next/mise.toml) at the root of the repo lists the tools and versions the project needs. The easiest way to install them is [mise](https://mise.jdx.dev/getting-started.html): + +```bash +cd /path/to/project +mise trust # first time only +mise install +``` + +If you'd rather install them yourself, use the versions in `mise.toml`. ### Installing Dependencies diff --git a/mise.toml b/mise.toml new file mode 100644 index 000000000..50853ce0f --- /dev/null +++ b/mise.toml @@ -0,0 +1,11 @@ +[tools] +python = "3.14.10" +node = "24" +pnpm = "11.23.0" +uv = "0.13.6" +task = "3.54.0" +"npm:json-schema-to-typescript" = "16.0.0" + +[settings] +# A mise.lock from a newer mise can't be read by the older mise in the dev container and CI +lockfile = false diff --git a/renovate.json b/renovate.json index 6ebe7d5d1..72d603fdd 100644 --- a/renovate.json +++ b/renovate.json @@ -7,7 +7,9 @@ "enabledManagers": [ "pep621", "dockerfile", - "npm" + "npm", + "mise", + "custom.regex" ], "extends": [ "config:recommended" @@ -17,6 +19,19 @@ "addLabels": [ "dependencies" ], + "customManagers": [ + { + "description": "Versions marked with a `# renovate:` comment on the line above (docker/Dockerfile, the setup-tools action)", + "customType": "regex", + "managerFilePatterns": [ + "/(^|/)Dockerfile$/", + "/^\\.github/actions/.+\\.ya?ml$/" + ], + "matchStrings": [ + "# renovate: datasource=(?\\S+) depName=(?\\S+)(?: extractVersion=(?\\S+))?\\s*\\n[^\\n]*?(?\\d+\\.\\d+\\.\\d+)" + ] + } + ], "packageRules": [ { "matchManagers": [ @@ -67,29 +82,115 @@ "automergeStrategy": "squash" }, { - "description": "Keep requires-python where it is; Python upgrades are done by hand", + "description": "Auto-merge patch and minor toolchain updates (mise.toml and the pins grouped with it below)", "matchManagers": [ - "pep621" + "mise", + "custom.regex" ], + "matchUpdateTypes": [ + "patch", + "minor" + ], + "automerge": true, + "automergeType": "pr", + "automergeStrategy": "squash" + }, + { + "description": "requires-python moves with the Python group by hand (see below), not on its own", "matchPackageNames": [ "python" ], + "matchManagers": [ + "pep621" + ], "enabled": false }, { - "description": "Keep the Docker base on its Python version, but let its digest update so the base gets Debian security fixes", + "description": "One PR per Python version across mise.toml, the dev container, and the production image", + "matchDepNames": [ + "python", + "mcr.microsoft.com/devcontainers/python" + ], "matchManagers": [ + "mise", "dockerfile" ], - "matchPackageNames": [ - "python" + "groupName": "python" + }, + { + "description": "Python minor and major upgrades wait for dashboard approval and merge by hand: they also need requires-python, mypy python_version, and ruff target-version in pyproject.toml updated", + "matchDepNames": [ + "python", + "mcr.microsoft.com/devcontainers/python" + ], + "matchManagers": [ + "mise", + "dockerfile" ], "matchUpdateTypes": [ "major", - "minor", - "patch" + "minor" ], - "enabled": false + "dependencyDashboardApproval": true, + "automerge": false + }, + { + "description": "One PR per Node version across mise.toml and the production image", + "matchDepNames": [ + "node" + ], + "matchManagers": [ + "mise", + "dockerfile" + ], + "groupName": "node" + }, + { + "description": "One PR per pnpm version across mise.toml, frontend/package.json (packageManager and devEngines), and the production image. Exempt from the npm dashboard approval so the pins stay in step.", + "matchDepNames": [ + "pnpm" + ], + "groupName": "pnpm", + "dependencyDashboardApproval": false + }, + { + "description": "Auto-merge patch and minor pnpm updates, including the package.json packageManager pin the npm manager owns", + "matchDepNames": [ + "pnpm" + ], + "matchUpdateTypes": [ + "patch", + "minor" + ], + "automerge": true, + "automergeType": "pr", + "automergeStrategy": "squash" + }, + { + "description": "One PR per uv version across mise.toml and the production image", + "matchDepNames": [ + "uv" + ], + "matchManagers": [ + "mise", + "custom.regex" + ], + "groupName": "uv" + }, + { + "description": "One PR per mise version across the dev container and the CI setup-tools action", + "matchDepNames": [ + "jdx/mise", + "jdxcode/mise" + ], + "groupName": "mise", + "automerge": true, + "automergeType": "pr", + "automergeStrategy": "squash", + "matchUpdateTypes": [ + "patch", + "minor" + ] } ] } diff --git a/tests/unit_tests/test_oidc_ssl.py b/tests/unit_tests/test_oidc_ssl.py index 3cac5987c..0768b4658 100644 --- a/tests/unit_tests/test_oidc_ssl.py +++ b/tests/unit_tests/test_oidc_ssl.py @@ -32,12 +32,25 @@ def test_default_oidc_ssl_context_returns_none(): assert ctx is None -def test_relaxed_strict_default_ca(): +def test_relaxed_strict_default_ca(monkeypatch: MonkeyPatch): """When relaxed strict is requested with default CAs, return an SSLContext with VERIFY_X509_STRICT cleared.""" + # get_ca_certs() can't prove the system CAs are present: when OpenSSL's default location is a + # directory (python-build-standalone on Debian/Ubuntu), certs load lazily during the handshake + # and get_ca_certs() returns []. Check that the context asked for the default certs instead. + loaded_purposes: list[ssl.Purpose] = [] + load_default_certs = ssl.SSLContext.load_default_certs + + def spy(self: ssl.SSLContext, purpose: ssl.Purpose = ssl.Purpose.SERVER_AUTH) -> None: + loaded_purposes.append(purpose) + load_default_certs(self, purpose) + + monkeypatch.setattr(ssl.SSLContext, "load_default_certs", spy) + ctx = auth_routes._create_oidc_ssl_context(cafile=None, verify_strict=False) assert isinstance(ctx, ssl.SSLContext) assert not (ctx.verify_flags & ssl.VERIFY_X509_STRICT) - assert len(ctx.get_ca_certs()) > 0 + assert ctx.verify_mode == ssl.CERT_REQUIRED + assert loaded_purposes == [ssl.Purpose.SERVER_AUTH] def test_custom_ca_strict(tmp_path: Path):