From 9887e3d5d7bbb820860b0c7bb437603cec1ddcd0 Mon Sep 17 00:00:00 2001 From: YueGuobin Date: Sat, 17 Oct 2026 14:00:23 +0800 Subject: [PATCH 1/2] fix: type User.username as str via Mapped-style column mypy 2.4 (native parser by default) flags _jwt_username_var.set(user.username) in agent/mcp/__init__.py: with the legacy `username = Column(String)` declaration, instance access is typed Column[str], not str. Migrate the column to the Mapped/mapped_column style already used by token_version and last_login in the same table, with an explicit nullable=True so the schema stays identical to the former Column(String) declaration. --- gns3server/db/models/users.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gns3server/db/models/users.py b/gns3server/db/models/users.py index 6c74a720c..28cca8e11 100644 --- a/gns3server/db/models/users.py +++ b/gns3server/db/models/users.py @@ -42,7 +42,9 @@ class User(BaseTable): __tablename__ = "users" user_id = Column(GUID, primary_key=True, default=generate_uuid) - username = Column(String, unique=True, index=True) + # Mapped style so type checkers see `str` instead of `Column[str]`; the explicit + # nullable=True keeps the schema identical to the former Column(String) declaration. + username: Mapped[str] = mapped_column(String, unique=True, index=True, nullable=True) email = Column(String, unique=True, index=True) full_name = Column(String) hashed_password = Column(String) From c557324bcb53935249b0f1836fc4b097c1eb33a4 Mon Sep 17 00:00:00 2001 From: YueGuobin Date: Sat, 17 Oct 2026 14:00:23 +0800 Subject: [PATCH 2/2] chore: bump mypy to 2.4.0 Supersedes the dependabot bump in #2998; the tree is mypy 2.4-clean after the previous commit. --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 2f2d2c10b..03642922f 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -6,5 +6,5 @@ httpx_ws==0.7.2 # upgrading leads to failures in tests pytest-random-order==1.2.0 # opt-in: --random-order --random-order-bucket=global (legacy suites are not shuffle-clean yet, see .claude/skills/gns3-api-test-writing) pytest-cov==7.1.0 ruff==0.16.9 -mypy==2.3.1 +mypy==2.4.0 rust-just==1.58.0 # provides the `just` command runner, see justfile