Skip to content

Upgrade authlib - #329

Merged
eveleighoj merged 5 commits into
mainfrom
upgrade-authlib
Jul 21, 2026
Merged

Upgrade authlib#329
eveleighoj merged 5 commits into
mainfrom
upgrade-authlib

Conversation

@eveleighoj

@eveleighoj eveleighoj commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

maintenance PR aimed at upgrading authlib, stumbled upon bad front end static management that needed fixing

Related Tickets & Documents

  • Ticket Link
  • Related Issue #
  • Closes #

QA Instructions, Screenshots, Recordings

Please replace this line with instructions on how to test your changes, a note
on the devices and browsers this has been tested on, as well as any relevant
images for UI changes.

Added/updated tests?

We encourage you to keep the code coverage percentage at 80% and above. Please refer to the Digital Land Testing Guidance for more information.

  • Yes
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

[optional] Are there any post deployment tasks we need to perform?

[optional] Are there any dependencies on other PRs or Work?

Summary by CodeRabbit

  • Changes
    • Standardised Node.js 18 and Python 3.10 configuration.
    • Improved build/package workflow with multi-stage frontend asset building and updated asset copy steps.
    • Refreshed dependency installation and requirement compilation workflow.
    • Updated npm and repository ignore settings for a cleaner setup.
  • Removed Features
    • Removed Leaflet map recentring control and related functionality.
    • Removed autocomplete, multi-select, and “create new” input behaviours.
    • Removed cookie consent and analytics preference/tracking handling.
    • Removed related bundled frontend assets, styling, and icon entries.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2baf7183-d2b4-4810-af7c-be1143428c32

📥 Commits

Reviewing files that changed from the base of the PR and between 03371e4 and 717bff0.

📒 Files selected for processing (1)
  • requirements/requirements.txt

Walkthrough

The PR declares Node.js 18 and Python 3.10, changes dependency initialisation and pins, introduces a multi-stage frontend asset build, redirects copied assets into application/static, and removes existing bundled JavaScript, map, cookie, autocomplete, and related static asset files.

Changes

Frontend asset build transition

Layer / File(s) Summary
Toolchain and dependency setup
.nvmrc, .python-version, .npmrc, Makefile, requirements/*.txt
Node.js 18 and Python 3.10 are declared; initialisation synchronises compiled requirements; dependency metadata and pins are refreshed.
Static asset build and image wiring
package.json, Dockerfile, .gitignore, application/static/...
Frontend copy scripts and Docker now build and transfer assets through application/static; existing bundled frontend, map, cookie, autocomplete, and manifest assets are removed.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DockerAssetsStage
  participant PackageScripts
  participant ApplicationStatic
  participant PythonRuntimeImage
  DockerAssetsStage->>PackageScripts: run npm run postinstall
  PackageScripts->>ApplicationStatic: copy and build frontend assets
  DockerAssetsStage->>PythonRuntimeImage: copy application/static
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main dependency upgrade in the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch upgrade-authlib

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Dockerfile`:
- Around line 38-42: Reorder the Dockerfile dependency layers so the
requirements files are copied and both pip install commands run before the broad
COPY . . step. Keep the static assets copy and application source copy after
dependency installation, preserving the existing requirements paths and install
behavior while allowing source changes to reuse the dependency cache.

In `@package.json`:
- Around line 18-20: Update the copy:moj-frontend-css script to create
application/static/stylesheets/vendor before running rsync, ensuring the CSS
copy succeeds on a clean build. Keep the existing CSS source and destination
behavior unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8840accf-2281-4ed4-8fe2-f771ac9ebdbe

📥 Commits

Reviewing files that changed from the base of the PR and between f91dea0 and 03371e4.

⛔ Files ignored due to path filters (39)
  • application/static/govuk/assets/fonts/bold-affa96571d-v2.woff is excluded by !**/*.woff
  • application/static/govuk/assets/fonts/bold-b542beb274-v2.woff2 is excluded by !**/*.woff2
  • application/static/govuk/assets/fonts/light-94a07e06a1-v2.woff2 is excluded by !**/*.woff2
  • application/static/govuk/assets/fonts/light-f591b13f7d-v2.woff is excluded by !**/*.woff
  • application/static/govuk/assets/images/favicon.ico is excluded by !**/*.ico
  • application/static/govuk/assets/images/favicon.svg is excluded by !**/*.svg
  • application/static/govuk/assets/images/govuk-crest.svg is excluded by !**/*.svg
  • application/static/govuk/assets/images/govuk-icon-180.png is excluded by !**/*.png
  • application/static/govuk/assets/images/govuk-icon-192.png is excluded by !**/*.png
  • application/static/govuk/assets/images/govuk-icon-512.png is excluded by !**/*.png
  • application/static/govuk/assets/images/govuk-icon-mask.svg is excluded by !**/*.svg
  • application/static/govuk/assets/images/govuk-opengraph-image.png is excluded by !**/*.png
  • application/static/govuk/assets/rebrand/images/favicon.ico is excluded by !**/*.ico
  • application/static/govuk/assets/rebrand/images/favicon.svg is excluded by !**/*.svg
  • application/static/govuk/assets/rebrand/images/govuk-crest.svg is excluded by !**/*.svg
  • application/static/govuk/assets/rebrand/images/govuk-icon-180.png is excluded by !**/*.png
  • application/static/govuk/assets/rebrand/images/govuk-icon-192.png is excluded by !**/*.png
  • application/static/govuk/assets/rebrand/images/govuk-icon-512.png is excluded by !**/*.png
  • application/static/govuk/assets/rebrand/images/govuk-icon-mask.svg is excluded by !**/*.svg
  • application/static/govuk/assets/rebrand/images/govuk-opengraph-image.png is excluded by !**/*.png
  • application/static/images/dl-apple-touch-icon-152.png is excluded by !**/*.png
  • application/static/images/dl-apple-touch-icon-167.png is excluded by !**/*.png
  • application/static/images/dl-apple-touch-icon-180.png is excluded by !**/*.png
  • application/static/images/dl-apple-touch-icon-192.png is excluded by !**/*.png
  • application/static/images/dl-apple-touch-icon-196.png is excluded by !**/*.png
  • application/static/images/dl-apple-touch-icon.png is excluded by !**/*.png
  • application/static/images/favicon-32.png is excluded by !**/*.png
  • application/static/images/favicon.ico is excluded by !**/*.ico
  • application/static/images/favicon.svg is excluded by !**/*.svg
  • application/static/images/opengraph.png is excluded by !**/*.png
  • application/static/javascripts/vendor/accessible-autocomplete.min.js is excluded by !**/*.min.js
  • application/static/javascripts/vendor/moj-frontend.js.map is excluded by !**/*.map
  • application/static/stylesheets/application.css.map is excluded by !**/*.map
  • application/static/stylesheets/vendor/accessible-autocomplete.css.map is excluded by !**/*.map
  • application/static/stylesheets/vendor/moj-frontend.min.css is excluded by !**/*.min.css
  • application/static/stylesheets/vendor/moj-frontend.min.css.map is excluded by !**/*.map
  • package-lock.json is excluded by !**/package-lock.json
  • src/scss/vendor/moj-frontend.min.css is excluded by !**/*.min.css
  • src/scss/vendor/moj-frontend.min.css.map is excluded by !**/*.map
📒 Files selected for processing (28)
  • .gitignore
  • .npmrc
  • .nvmrc
  • .python-version
  • Dockerfile
  • Makefile
  • application/static/govuk/assets/manifest.json
  • application/static/govuk/assets/rebrand/manifest.json
  • application/static/javascripts/Leaflet.recentre.js
  • application/static/javascripts/application.js
  • application/static/javascripts/base-tile.json
  • application/static/javascripts/digital-land-cookies.js
  • application/static/javascripts/digital-land-frontend.js
  • application/static/javascripts/digital-land-maps.js
  • application/static/javascripts/govuk/govuk-frontend.js
  • application/static/javascripts/modules/cookies.js
  • application/static/javascripts/modules/multi-select-or-new.js
  • application/static/javascripts/modules/multi-select.js
  • application/static/javascripts/modules/select-or-new.js
  • application/static/javascripts/modules/utils.js
  • application/static/javascripts/utils.js
  • application/static/javascripts/vendor/moj-frontend.js
  • application/static/stylesheets/application.css
  • application/static/stylesheets/vendor/accessible-autocomplete.css
  • package.json
  • requirements/dev-requirements.txt
  • requirements/requirements.txt
  • src/javascripts/vendor/moj-frontend.js
💤 Files with no reviewable changes (16)
  • application/static/govuk/assets/manifest.json
  • application/static/govuk/assets/rebrand/manifest.json
  • application/static/stylesheets/vendor/accessible-autocomplete.css
  • application/static/javascripts/utils.js
  • application/static/javascripts/modules/multi-select.js
  • application/static/javascripts/modules/select-or-new.js
  • requirements/requirements.txt
  • application/static/javascripts/modules/multi-select-or-new.js
  • .npmrc
  • application/static/javascripts/application.js
  • application/static/javascripts/digital-land-frontend.js
  • application/static/javascripts/modules/utils.js
  • application/static/javascripts/digital-land-cookies.js
  • application/static/javascripts/digital-land-maps.js
  • application/static/javascripts/modules/cookies.js
  • application/static/javascripts/Leaflet.recentre.js

Comment thread Dockerfile
Comment on lines 38 to 42
COPY . .
COPY --from=assets /app/application/static ./application/static

RUN pip install -r requirements/requirements.txt
RUN pip install -r requirements/dev-requirements.txt

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win

Optimise Docker cache by moving dependency installation before copying source code.

Currently, pip install runs after COPY . .. This means any change to your source code (like editing a .js or .py file) will break the Docker build cache for the Python dependencies, forcing them to re-install on every build.

Copy the requirements files and run pip install before copying the rest of the application code to significantly speed up your build times.

⚡ Proposed fix for better layer caching
+COPY requirements/ ./requirements/
+RUN pip install -r requirements/requirements.txt
+RUN pip install -r requirements/dev-requirements.txt
+
 COPY . .
 COPY --from=assets /app/application/static ./application/static
-
-RUN pip install -r requirements/requirements.txt
-RUN pip install -r requirements/dev-requirements.txt
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
COPY . .
COPY --from=assets /app/application/static ./application/static
RUN pip install -r requirements/requirements.txt
RUN pip install -r requirements/dev-requirements.txt
COPY requirements/ ./requirements/
RUN pip install -r requirements/requirements.txt
RUN pip install -r requirements/dev-requirements.txt
COPY . .
COPY --from=assets /app/application/static ./application/static
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile` around lines 38 - 42, Reorder the Dockerfile dependency layers so
the requirements files are copied and both pip install commands run before the
broad COPY . . step. Keep the static assets copy and application source copy
after dependency installation, preserving the existing requirements paths and
install behavior while allowing source changes to reuse the dependency cache.

Comment thread package.json
Comment on lines +18 to 20
"copy:moj-frontend-js": "rsync -ar ./node_modules/@ministryofjustice/frontend/moj/all.bundle.js application/static/javascripts/vendor/moj-frontend.js && rsync -ar ./node_modules/@ministryofjustice/frontend/moj/all.bundle.js.map application/static/javascripts/vendor/",
"copy:moj-frontend-css": "rsync -ar ./node_modules/@ministryofjustice/frontend/moj/moj-frontend.min.css* application/static/stylesheets/vendor/",
"copy:moj-frontend": "npm run copy:moj-frontend-js && npm run copy:moj-frontend-css",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if vendor source directories exist
ls -d src/javascripts/vendor 2>/dev/null || echo "javascripts/vendor does not exist"
ls -d src/stylesheets/vendor 2>/dev/null || echo "stylesheets/vendor does not exist"

Repository: digital-land/planning-data-design

Length of output: 228


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n[package.json scripts]\n'
cat -n package.json | sed -n '1,80p'

printf '\n[relevant paths]\n'
git ls-files 'application/static/javascripts/vendor' 'application/static/stylesheets/vendor' 'src/javascripts/vendor' 'src/stylesheets/vendor'

printf '\n[rsync destination probe]\n'
tmpdir="$(mktemp -d)"
mkdir -p "$tmpdir/src"
printf 'x' > "$tmpdir/src/file.txt"

# Try a file copy into a missing destination directory.
if rsync -ar "$tmpdir/src/file.txt" "$tmpdir/destdir/file.txt" >/tmp/rsync_probe.out 2>/tmp/rsync_probe.err; then
  echo "rsync_to_missing_dest=success"
else
  echo "rsync_to_missing_dest=failed"
fi
echo "--- stdout ---"
cat /tmp/rsync_probe.out
echo "--- stderr ---"
cat /tmp/rsync_probe.err
echo "--- dest tree ---"
find "$tmpdir" -maxdepth 3 -type f | sort

Repository: digital-land/planning-data-design

Length of output: 2724


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '[tracked vendor paths under application/static]\n'
git ls-files 'application/static/**/vendor/**' | sed -n '1,120p'

printf '\n[files mentioning build.stylesheets or stylesheet vendor]\n'
rg -n '"build\.stylesheets"|stylesheets/vendor|application/static/stylesheets' package.json . -g '!node_modules' -g '!dist' -g '!build'

printf '\n[outline of likely package scripts source if present]\n'
fd -a 'package-scripts.js' .

Repository: digital-land/planning-data-design

Length of output: 1176


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '[Dockerfile]\n'
cat -n Dockerfile | sed -n '1,120p'

printf '\n[Dockerfile.assets]\n'
cat -n Dockerfile.assets | sed -n '1,120p'

printf '\n[package-scripts / config references]\n'
rg -n 'build\.stylesheets|copy\.javascripts|copy\.images|vendor|mkdir -p|rsync -ar' package.json digital-land-frontend.config.json application -g '!node_modules' -g '!dist' -g '!build'

Repository: digital-land/planning-data-design

Length of output: 4188


🏁 Script executed:

#!/bin/bash
set -euo pipefail

cat -n digital-land-frontend.config.json

Repository: digital-land/planning-data-design

Length of output: 535


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n 'application/static/stylesheets/vendor|stylesheets/vendor|javascripts/vendor' . -g '!node_modules' -g '!dist' -g '!build'

Repository: digital-land/planning-data-design

Length of output: 1373


🌐 Web query:

rsync create nested destination parent directories when copying a file to a non-existent path

💡 Result:

To create missing nested parent directories when copying a file with rsync, the recommended approach is to use the --mkpath option [1][2]. The --mkpath option was introduced in rsync version 3.2.3 to explicitly handle this scenario [3]. When this flag is used, rsync creates all missing destination path components, functioning similarly to running mkdir -p on the receiving side [1][4]. For example: rsync --mkpath source_file user@remote:/path/to/non/existent/directory/ If you are using a version of rsync older than 3.2.3, you cannot rely on a single native flag to create arbitrary missing parent directories. In such cases, common workarounds include: 1. Pre-creating the directory: Run an SSH command to create the path before the rsync transfer [5][3]. ssh user@remote "mkdir -p /path/to/non/existent/directory/" rsync source_file user@remote:/path/to/non/existent/directory/ 2. Using the --relative (-R) option: This can be used to replicate source directory structures at the destination, though it behaves differently than --mkpath by including parts of the source path in the destination [1][2]. Note: By default, rsync is designed to permit only the final component of the destination path to be missing [1][6]. If you attempt to copy to a path with multiple missing parents without --mkpath or a workaround, the transfer will typically fail [3].

Citations:


Create application/static/stylesheets/vendor before copying MOJ CSS. copyjs already seeds application/static/javascripts/vendor, but nothing creates the stylesheet vendor directory, so this rsync can fail on a clean build.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` around lines 18 - 20, Update the copy:moj-frontend-css script
to create application/static/stylesheets/vendor before running rsync, ensuring
the CSS copy succeeds on a clean build. Keep the existing CSS source and
destination behavior unchanged.

@eveleighoj
eveleighoj merged commit 385b4a3 into main Jul 21, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant