Skip to content

chore: merge v11.16.1 back to the develop branch - #8029

Merged
pbrolin47 merged 17 commits into
mermaid-js:developfrom
aloisklink:chore/merge-v11.16.1-to-develop
Aug 5, 2026
Merged

pbrolin47 merged 17 commits into
mermaid-js:developfrom
aloisklink:chore/merge-v11.16.1-to-develop

Conversation

@aloisklink

@aloisklink aloisklink commented Aug 5, 2026 •

Copy link
Copy Markdown
Member

📑 Summary

The v11.16.1 hotfixes skipped the develop branch, so we should merge these into develop now to avoid merge conflicts in the future.

📏 Design Decisions

N/A

📋 Tasks

Make sure you

  • 📖 have read the contribution guidelines
  • 💻 have added necessary unit/e2e tests.
  • 📓 have added documentation. Make sure MERMAID_RELEASE_VERSION is used for all new features.
  • 🦋 If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Summary

This PR merges the v11.16.1 hotfixes into develop.

Changes

  • Fixed prototype pollution risks in architecture diagrams, configuration merging, and CSS selector namespacing.
  • Reworked architecture storage to use Map instances and preserve service ordering.
  • Added radar diagram tick limits.
  • Fixed XY chart handling for zero-width ranges and single-point data.
  • Deprecated mermaidAPI.setConfig() and removed the exported updateCurrentConfig.
  • Improved demos/dev/example.html with render timing and error reporting.
  • Updated API documentation, changelogs, package versions, tests, and cspell terms.

API impact

  • assignWithDepth no longer accepts the clobber option.
  • updateCurrentConfig is now module-local.
  • mermaidAPI.setConfig() is deprecated.

aloisklink and others added 16 commits July 31, 2026 20:00
Brings the live-editing in the example.html from the `develop` branch
into the `release/10.9.7` branch, since it makes it much easier to
backport fixes.

Adapted-from: 0ff3ba3
Adapted-from: 5661509
Adapted-from: f135a3a
Currently, if you have a broken diagram when using `dev/example.html`,
then refresh the page, the page breaks.

Changing the `await render()` to happen after the event listeners are
setup fixes this.
This gets us out of quirks mode and uses proper HTML mode.
Conflicts:
- demos/dev/example.html (added the elk layout)
- demos/index.html
This adds some improvements to `demos/dev/example.html` (e.g. error
handling, showing errors, and timing info) that make it easier to test
mermaid locally.
* fix(architecture): handle arbitrary prototype pollution

Update the `ArchitectureGroupAlignments` to use a
`Map<`${string}-${string},` instead of being a
`Record<string, Record<string,`. Not only does this make the code
simpler, but it also means we avoid arbritary prototype pollution
attacks.

Fixes: GHSA-3rrr-jr9j-h3q3
Fixes: cb0a470

* refactor(architecture): use `Map` for registeredIds

* fix(architecture): improve group ID handling

`__proto__`, `constructor`, `toString`, etc. can now be used as a group ID in
architecture diagrams.

* refactor(architecture): use Map for nodes in DB

* refactor(architecture): use Map for spatial maps

* refactor(architecture): use `Set` for visit record

* refactor(architecture): use Map for `adjList`

* refactor(architecture): use Map for elements storage

* refactor(architecture): use Map for alignments

* test(architecture): test for service ID sorting

The old code sorted services by their ID using object iteration order,
which would sort numeric keys before string keys.

Now they are sorted in insertion order, so you can change around the
order of `service` statements in your diagram.

* test(architecture): test for GHSA-3rrr-jr9j-h3q3

Add a modified test to confirm that the prototype pollution in
GHSA-3rrr-jr9j-h3q3 is no longer exploitable.
The current radar diagram renderer adds a very ugly gradient to radar
diagrams, even if the number of ticks goes above 30.

Because of that, I used 32 as the maximum number of ticks, as anything
higher than that doesn't seem to be useable.

Just in case people are using a higher number (e.g. accidentally), I've
made this only a soft warning, and will continue rendering a radar
diagram over the limit, just with 32 ticks instead.

Fixes: GHSA-rhh3-jpg6-66xh
* fix(xyChart): fix incorrect spacing, added e2e-test

Cherry-picked-from: 46fe731

* fix(xychart): support zero-width x-axis ranges

Add support for an x-axis range that has zero-width, e.g.

```
xychart-beta
  x-axis 0 --> 0
  line [1, 2]
```

This also fixes floating-point rounding issues for very large ranges.

Fixes: GHSA-2v8p-3f2j-5mp7

---------

Co-authored-by: OG-NI <in.neu@online.de>
* refactor: remove unused `clobber` from `assignWithDepth`

* docs: improve `assignWithDepth` documentation

Fixes the formatting of the `assignWithDepth` function's TSDoc.

* fix: refactor `assignWithDepth`

This makes it prototype pollution resistant, and it also handles `null`
values like `undefined`. Additionally, I've got rid of more of the `any`
types, so it's slightly safer.

Fixes: GHSA-c4c3-pg64-4m4v

* deprecate: deprecate public `setConfig` function

Deprecate the existing `mermaidAPI.setConfig()` function.

Calling this function has no observable effect, as the next time a
`render()` or `parse()` is called, the `currentConfig` is cleared.

* docs: rewrite config function doc comments

The function documentation comments in `config.ts` are still using the
old pre-typedoc [`documentation`][1] strings.

[1]: https://www.npmjs.com/package/documentation

* refactor: stop exporting `updateCurrentConfig`

This function is only ever exported for one unit test, but since it's
exported from this file, it shows up in
<https://mermaid.js.org/config/setup/config/README.html> unnecessarily,
since it's not exposed anywhere as part of the public mermaid API.

* test: test and doc assignWithDepth pollution fix
Stylis compiles `& ~ *` and `& + *` to `#svgId ~ *` / `#svgId + *`,
which select DOM siblings of the SVG element (aka outside of the SVG
boundary).

This commit changes the `addNamespace` middleware to detect when a
selector uses one of these, and namespaces it properly, e.g.
`#svgId ~ *` into `#svgId #svgId ~ *`.

I've also added support for handling the [column combinator `||`][1].
It's experimental, but there's no reason not to handle it.

For `& {`, I had to do some special handling. Technically, it's not
namespaced, but namespacing it with `& &` breaks, and replacing it with
`& > *` overwrites some SVG presentation attributes, so it breaks
existing diagrams. Instead, I've just added a quick check that allows it
if-and-only-if it only has `font-family`, `font-size`, or `fill` rules.

[1]: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/Column_combinator

Reported-by: h3ri0s <rohitprasanth8@gmail.com>
See: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/Next-sibling_combinator
See: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/Subsequent-sibling_combinator
Fixes: 6476973
We used squash merges, so the original commit IDs no longer exist.
Technically, under semver, deprecations are supposed to be `minor`
version bumps, but considering that this function is currently broken
and not doing anything, and has been broken for a while, I think we can
make this a `patch` version instead.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
The v11.16.1 hotfixes skipped the `develop` branch, so we should merge
these in now to avoid merge conflicts in the future.
@aloisklink
aloisklink requested a review from pbrolin47 August 5, 2026 11:39
@changeset-bot

changeset-bot Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 45dcb84

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@netlify

netlify Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit 45dcb84
🔍 Latest deploy log https://app.netlify.com/projects/mermaid-js/deploys/6a7322169e3de10008128409
😎 Deploy Preview https://deploy-preview-8029--mermaid-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the Type: Other Not an enhancement or a bug label Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

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 Plus

Run ID: 69f3737d-f1ae-46cb-87bf-edd9a2c5d215

📥 Commits

Reviewing files that changed from the base of the PR and between 35133f2 and 45dcb84.

📒 Files selected for processing (3)
  • docs/config/setup/mermaid/functions/createCommonLayoutRenderer.md
  • docs/config/setup/mermaid/interfaces/CommonLayoutPaintContext.md
  • docs/config/setup/mermaid/interfaces/CommonLayoutRenderContext.md

📝 Walkthrough

Walkthrough

Mermaid 11.16.1 updates configuration handling, architecture data structures, CSS namespacing, XYChart and radar rendering, the development page, API documentation, tests, and package metadata.

Changes

Mermaid 11.16.1

Layer / File(s) Summary
Configuration and recursive merge behavior
packages/mermaid/src/assignWithDepth.ts, packages/mermaid/src/config.ts, packages/mermaid/src/config.spec.ts, packages/mermaid/src/utils.spec.ts, docs/config/setup/config/..., docs/config/setup/mermaid/...
Recursive merging now handles null, undefined, arrays, and __proto__ safely. updateCurrentConfig is internal. Configuration tests and API documentation reflect the updated API.
Architecture map-based storage and traversal
packages/mermaid/src/diagrams/architecture/...
Architecture state, alignment, spatial lookup, and traversal use Map and Set structures. Tests cover special identifiers, missing groups, and service order.
Diagram rendering and CSS fixes
packages/mermaid/src/diagrams/xychart/..., cypress/integration/rendering/xychart/xyChart.spec.js, packages/mermaid/src/diagrams/radar/..., packages/mermaid/src/mermaidAPI.*, packages/mermaid/src/styles.ts
XYChart handles zero-width ranges. Radar tick counts are capped at 32. CSS namespacing handles supported combinators and root declarations.
Development page render status
demos/dev/example.html
The development page displays render errors and duration, updates status after rendering, and restores saved editor content.
Release metadata and spelling support
packages/mermaid/package.json, packages/tiny/package.json, packages/mermaid/CHANGELOG.md, packages/tiny/CHANGELOG.md, .cspell/misc-terms.txt
Both packages advance to version 11.16.1. Changelogs and spelling terms are updated.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • mermaid-js/mermaid#7509: Modifies the same XYChart data transformation and Cypress test areas, but addresses grouped and stacked bar behavior.

Suggested reviewers: pbrolin47

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies merging the v11.16.1 hotfixes into the develop branch.
Description check ✅ Passed The description explains the merge purpose, records design decisions, and completes all template task checks.
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

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.

@pkg-pr-new

pkg-pr-new Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@mermaid-js/examples

npm i https://pkg.pr.new/@mermaid-js/examples@8029

mermaid

npm i https://pkg.pr.new/mermaid@8029

@mermaid-js/layout-elk

npm i https://pkg.pr.new/@mermaid-js/layout-elk@8029

@mermaid-js/layout-tidy-tree

npm i https://pkg.pr.new/@mermaid-js/layout-tidy-tree@8029

@mermaid-js/mermaid-zenuml

npm i https://pkg.pr.new/@mermaid-js/mermaid-zenuml@8029

@mermaid-js/parser

npm i https://pkg.pr.new/@mermaid-js/parser@8029

@mermaid-js/tiny

npm i https://pkg.pr.new/@mermaid-js/tiny@8029

commit: 45dcb84

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (2)
packages/mermaid/src/diagrams/architecture/architectureRenderer.ts (1)

321-347: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider a Set for visited to match the surrounding Map/Set migration.

visited at line 331 is still a plain object used as a lookup table. The keys are generated from posToStr, so they always match ${number},${number} and cannot collide with prototype keys. There is no correctness or security defect here. A Set<string> would align this last structure with the rest of the migration and remove the Record index type.

♻️ Proposed refactor
-    const visited: Record<ReturnType<typeof posToStr>, number> = {};
+    const visited = new Set<ReturnType<typeof posToStr>>();

Then update the two use sites:

-        visited[curr] = 1;
+        visited.add(curr);
-            if (newId && !visited[newPos]) {
+            if (newId && !visited.has(newPos)) {
🤖 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 `@packages/mermaid/src/diagrams/architecture/architectureRenderer.ts` around
lines 321 - 347, Replace the plain-object visited lookup in the BFS around
spatialMaps with a Set<string>, initializing it without the Record type; update
both visited write and membership-check sites to use Set operations while
preserving the existing traversal behavior.
demos/dev/example.html (1)

1-1: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep the development-page warning after the doctype.

<!doctype html> must remain first for standards mode. Restore the existing instructions that tell developers to duplicate this file before editing it.

🤖 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 `@demos/dev/example.html` at line 1, Keep <!doctype html> as the first line of
the development page, then restore the existing developer warning and
instructions to duplicate the file before editing it.
🤖 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 `@demos/dev/example.html`:
- Around line 82-85: Update the render failure handler’s catch block to clear
the existing content in `#dynamicDiagram` before displaying the error in `#errors`,
while preserving the setRenderTime(start, end) call.

In `@packages/mermaid/CHANGELOG.md`:
- Around line 25-27: Update the 11.16.1 entries in packages/mermaid/CHANGELOG.md
at lines 25-27 and packages/tiny/CHANGELOG.md at lines 25-27 to document the
missing XYChart spacing and floating-point rounding fixes, while retaining the
existing zero-width x-axis range entry. Keep both changelogs aligned with the
shipped XYChart fixes.

In `@packages/mermaid/src/assignWithDepth.ts`:
- Around line 48-53: The depth-boundary branch in assignWithDepth must avoid
Object.assign, which can trigger a source __proto__ setter. In
packages/mermaid/src/assignWithDepth.ts lines 48-53, replace that copy with an
own-enumerable-property iteration that safely handles __proto__ without mutating
dst’s prototype; preserve the existing return behavior for non-object values. In
packages/mermaid/src/utils.spec.ts lines 84-95, update or add coverage for an
own enumerable __proto__ source property and verify the destination prototype
remains unchanged.

In `@packages/mermaid/src/diagrams/architecture/architectureDb.ts`:
- Around line 214-226: Update addEdge to safely resolve lhsGroupId and
rhsGroupId when an endpoint exists only in groups: treat this.nodes.get(lhsId)
or this.nodes.get(rhsId) as optional before reading .in, while preserving
group-id handling for downstream rendering and existing validation.

---

Nitpick comments:
In `@demos/dev/example.html`:
- Line 1: Keep <!doctype html> as the first line of the development page, then
restore the existing developer warning and instructions to duplicate the file
before editing it.

In `@packages/mermaid/src/diagrams/architecture/architectureRenderer.ts`:
- Around line 321-347: Replace the plain-object visited lookup in the BFS around
spatialMaps with a Set<string>, initializing it without the Record type; update
both visited write and membership-check sites to use Set operations while
preserving the existing traversal behavior.
🪄 Autofix

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 Plus

Run ID: 49fa2176-0730-4d31-8ea5-4af0e738be58

📥 Commits

Reviewing files that changed from the base of the PR and between f0f96c0 and 35133f2.

📒 Files selected for processing (34)
  • .cspell/misc-terms.txt
  • cypress/integration/rendering/xychart/xyChart.spec.js
  • demos/dev/example.html
  • docs/config/setup/config/README.md
  • docs/config/setup/config/functions/addDirective.md
  • docs/config/setup/config/functions/getConfig.md
  • docs/config/setup/config/functions/getEffectiveHtmlLabels.md
  • docs/config/setup/config/functions/getSiteConfig.md
  • docs/config/setup/config/functions/getUserDefinedConfig.md
  • docs/config/setup/config/functions/reset.md
  • docs/config/setup/config/functions/sanitize.md
  • docs/config/setup/config/functions/saveConfigFromInitialize.md
  • docs/config/setup/config/functions/setConfig.md
  • docs/config/setup/config/functions/setSiteConfig.md
  • docs/config/setup/config/functions/updateCurrentConfig.md
  • docs/config/setup/config/functions/updateSiteConfig.md
  • packages/mermaid/CHANGELOG.md
  • packages/mermaid/package.json
  • packages/mermaid/src/assignWithDepth.ts
  • packages/mermaid/src/config.spec.ts
  • packages/mermaid/src/config.ts
  • packages/mermaid/src/diagrams/architecture/architecture.spec.ts
  • packages/mermaid/src/diagrams/architecture/architectureDb.ts
  • packages/mermaid/src/diagrams/architecture/architectureRenderer.ts
  • packages/mermaid/src/diagrams/architecture/architectureTypes.ts
  • packages/mermaid/src/diagrams/radar/db.ts
  • packages/mermaid/src/diagrams/radar/radar.spec.ts
  • packages/mermaid/src/diagrams/xychart/xychartDb.ts
  • packages/mermaid/src/mermaidAPI.spec.ts
  • packages/mermaid/src/mermaidAPI.ts
  • packages/mermaid/src/styles.ts
  • packages/mermaid/src/utils.spec.ts
  • packages/tiny/CHANGELOG.md
  • packages/tiny/package.json
💤 Files with no reviewable changes (1)
  • docs/config/setup/config/functions/updateCurrentConfig.md

Comment thread demos/dev/example.html
Comment thread packages/mermaid/CHANGELOG.md
Comment thread packages/mermaid/src/assignWithDepth.ts
Comment thread packages/mermaid/src/diagrams/architecture/architectureDb.ts
@codecov

codecov Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.33962% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.67%. Comparing base (f0f96c0) to head (45dcb84).

Files with missing lines Patch % Lines
...ermaid/src/diagrams/architecture/architectureDb.ts 88.75% 9 Missing ⚠️
.../src/diagrams/architecture/architectureRenderer.ts 94.44% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #8029      +/-   ##
===========================================
+ Coverage    77.66%   77.67%   +0.01%     
===========================================
  Files          567      567              
  Lines        74906    74968      +62     
  Branches     12657    12682      +25     
===========================================
+ Hits         58172    58234      +62     
- Misses       15739    15740       +1     
+ Partials       995      994       -1     
Flag Coverage Δ
e2e 70.70% <82.78%> (+<0.01%) ⬆️
unit 75.04% <87.26%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/mermaid/src/assignWithDepth.ts 100.00% <100.00%> (ø)
packages/mermaid/src/config.ts 93.57% <100.00%> (+2.08%) ⬆️
...aid/src/diagrams/architecture/architectureTypes.ts 91.73% <100.00%> (+3.70%) ⬆️
packages/mermaid/src/diagrams/radar/db.ts 96.90% <100.00%> (+0.24%) ⬆️
packages/mermaid/src/diagrams/xychart/xychartDb.ts 93.29% <100.00%> (-0.52%) ⬇️
packages/mermaid/src/mermaidAPI.ts 91.58% <100.00%> (+0.41%) ⬆️
packages/mermaid/src/styles.ts 100.00% <100.00%> (ø)
.../src/diagrams/architecture/architectureRenderer.ts 88.53% <94.44%> (-0.05%) ⬇️
...ermaid/src/diagrams/architecture/architectureDb.ts 85.34% <88.75%> (+0.62%) ⬆️

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@argos-ci

argos-ci Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) 👍 Approved by pbrolin47 1 changed Aug 5, 2026, 12:03 PM

@pbrolin47
pbrolin47 added this pull request to the merge queue Aug 5, 2026
Merged via the queue into mermaid-js:develop with commit 372fe05 Aug 5, 2026
32 checks passed
@aloisklink
aloisklink deleted the chore/merge-v11.16.1-to-develop branch August 5, 2026 12:42
@filipsajdak filipsajdak mentioned this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Other Not an enhancement or a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants