Skip to content

Conversation

@jgreywolf
Copy link
Contributor

📑 Summary

Resolves #2492

The flowchart parser was incorrectly consuming 'o' or 'x' characters from node names when they appeared after arrows without spaces. For example, dev---ops was parsed as "dev" → "ps" instead of "dev" → "ops".

Changes:

  • Modified lexer patterns in flow.jison to distinguish between:
    • Intentional arrow markers (--o, --x) followed by whitespace or uppercase
    • Node names starting with 'o' or 'x' (lowercase continuation)
  • Added 10 comprehensive tests to flow-arrows.spec.js covering:
    • Bug cases (dev---ops, dev---xerxes)
    • Backwards compatibility (A--oB, A --o B, etc.)
    • All arrow types (solid, thick, dotted)

The fix uses smart pattern matching:

  • --o (with space) → circle arrow marker
  • --oB (uppercase) → circle arrow marker
  • --ops (lowercase) → plain arrow, 'ops' is node name

📏 Design Decisions

Describe the way your implementation works or what design decisions you made if applicable.

📋 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:.

Fixes #2492

The flowchart parser was incorrectly consuming 'o' or 'x' characters from
node names when they appeared after arrows without spaces. For example,
`dev---ops` was parsed as "dev" → "ps" instead of "dev" → "ops".

Changes:
- Modified lexer patterns in flow.jison to distinguish between:
  - Intentional arrow markers (--o, --x) followed by whitespace or uppercase
  - Node names starting with 'o' or 'x' (lowercase continuation)
- Added 10 comprehensive tests to flow-arrows.spec.js covering:
  - Bug cases (dev---ops, dev---xerxes)
  - Backwards compatibility (A--oB, A --o B, etc.)
  - All arrow types (solid, thick, dotted)

The fix uses smart pattern matching:
- `--o ` (with space) → circle arrow marker
- `--oB` (uppercase) → circle arrow marker
- `--ops` (lowercase) → plain arrow, 'ops' is node name

All 24 new tests pass. All 293 existing edge tests pass.
@changeset-bot
Copy link

changeset-bot bot commented Oct 18, 2025

⚠️ No Changeset found

Latest commit: 8127d01

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
Copy link

netlify bot commented Oct 18, 2025

Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit 8127d01
🔍 Latest deploy log https://app.netlify.com/projects/mermaid-js/deploys/68f7e70192481b00087f251f
😎 Deploy Preview https://deploy-preview-7088--mermaid-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@github-actions github-actions bot added the Type: Bug / Error Something isn't working or is incorrect label Oct 18, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 18, 2025

Open in StackBlitz

@mermaid-js/examples

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

mermaid

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

@mermaid-js/layout-elk

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

@mermaid-js/layout-tidy-tree

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

@mermaid-js/mermaid-zenuml

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

@mermaid-js/parser

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

@mermaid-js/tiny

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

commit: 8127d01

@argos-ci
Copy link

argos-ci bot commented Oct 18, 2025

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

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 7 removed, 7 failures Oct 21, 2025, 8:14 PM

@jgreywolf jgreywolf changed the title Bug 2492: HOLD: Bug 2492: first or last letter being dropped Oct 20, 2025
@jgreywolf
Copy link
Contributor Author

Reviewing failures

- Added lookahead patterns for arrows followed by lowercase letters (fixes #2492)
- Added lookahead patterns for arrows followed by digits (fixes Sample 4 & 5)
- Preserved edge text functionality with pipe delimiter lookahead
- Applied fix to all arrow types: solid (--), thick (==), dotted (-.-)
- Added comprehensive test coverage (21 tests total)
@jgreywolf
Copy link
Contributor Author

@sidharthv96 @aloisklink Whats the difference between all of the E2E / e2e checks? I notice that E2E / e2e (2) (pull_request) and E2E / e2e (4) (pull_request) are successful, but 1, 3 and 5 are not.

I also need to look into the screenshot issues, because locally I thought they looked fine.

@antshaykolo
Copy link

Liugiolopoi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug / Error Something isn't working or is incorrect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

first or last letter dropped for links with open arrows

3 participants