Commit Graph
180 Commits
Author SHA1 Message Date
YueGuobin 9887e3d5d7 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.
2026-10-17 14:00:23 +08:00
YueGuobin 6734d2d666 feat: add auto_connect flag and disconnect endpoint for computes
Computes can now be flagged auto_connect in the database. The controller
connects to flagged computes in the background at startup (reusing the
one-second delayed fire-and-forget mechanism), and enabling the flag via
PUT /computes/{id} triggers a background connection without the request
ever waiting for it. Disabling the flag does not drop an existing
connection.

Add POST /computes/{id}/disconnect to tear a compute down manually: the
notification stream and HTTP session are closed and every reconnection
path (retry backoff, notification stream reconnect, lazy connection in
http_query) is blocked until connect() is called again or the controller
restarts with auto_connect enabled. Disconnecting a compute used by an
opened project is rejected with 409 unless force=true; forcing only
drops the controller-side control channel, nodes keep running unmanaged.
The local compute cannot be disconnected.

Also make test_compute_list create its own compute (it relied on rows
from earlier tests and failed under reordering), and stop scheduling the
delayed add_compute connection during tests: the timer leaked real
connection attempts into other tests' event loops.
2026-10-15 22:50:22 +08:00
grossmj e0260f27c7 fix(rbac): annotate query variables with Select type for better type checking 2026-10-08 18:39:20 +02:00
Mark Paronyan 852dc5be0f feat(api): add exact-match name filter to list endpoints 2026-10-07 13:40:34 +03:00
Jeremy Grossmann f184883aa7 Merge branch '3.1' into images-nested-folders-support 2026-10-06 16:50:40 +02:00
Cristi 207db770c6 feat(image-manager): Add support for nested image folders and appliance compatibility checks 2026-10-05 18:49:21 +03:00
Mark Paronyan 3135c8b7e3 refactor: use f-strings in remaining modules, scripts and tests 2026-10-03 19:44:02 +03:00
Mark Paronyan 72fae7a1ce refactor: declare new image sync models in the public API 2026-10-03 19:43:59 +03:00
Mark Paronyan b622ccae7b refactor: declare explicit public API in package __init__ modules 2026-10-03 19:43:59 +03:00
Mark Paronyan 306d8fbde4 refactor: remove unused imports 2026-10-03 19:43:58 +03:00
Mark Paronyan b78672a8ca style: sort imports in the new image management modules 2026-10-02 12:43:26 +03:00
Mark Paronyan b9cdac487c style: sort imports in compute, db and services modules 2026-10-02 12:43:26 +03:00
Mark Paronyan a77e06b907 Merge branch '3.1' into ruff/trivia-fixups 2026-10-01 19:58:02 +03:00
Mark Paronyan 95ada23395 refactor: replace percent formatting with format specifiers 2026-10-01 19:57:47 +03:00
Mark Paronyan 06899c92fc refactor: use iterable unpacking instead of concatenation 2026-10-01 19:57:46 +03:00
Mark Paronyan 2dc7479d11 style: remove f-strings without placeholders 2026-10-01 19:57:46 +03:00
Mark Paronyan fdb8d87a64 style: drop useless object inheritance 2026-10-01 19:57:45 +03:00
Mark Paronyan 1a495ab318 refactor: replace getattr with attribute access 2026-10-01 19:57:42 +03:00
grossmj 1456d36bf0 chore(tests): fix mypy errors 2026-10-01 15:22:17 +02:00
Jeremy Grossmann a2cdc14a25 Merge branch '3.1' into image-manager-out-of-sync 2026-10-01 14:44:24 +02:00
Jeremy Grossmann e90be1ebac Merge pull request #2930 from markparonyan/mypy-db-templates-images
fix(typing): resolve the remaining mypy errors (18 modules)
2026-09-29 21:37:14 +02:00
Mark Paronyan 36945daa83 fix(typing): resolve mypy errors in db.repositories.computes 2026-09-29 22:02:22 +03:00
Mark Paronyan 2fe4e39715 fix(typing): resolve mypy errors in db.repositories.api_keys 2026-09-29 22:02:22 +03:00
Mark Paronyan adf9c15e21 fix(typing): resolve mypy errors in api.routes.controller.projects 2026-09-29 22:02:21 +03:00
Mark Paronyan 8f7b895cf4 fix(typing): resolve mypy errors in db.repositories.pools 2026-09-29 22:02:21 +03:00
Mark Paronyan fa9d1cde80 fix(typing): resolve mypy errors in db.repositories.rbac 2026-09-29 22:02:20 +03:00
Mark Paronyan 323055c486 fix(typing): resolve mypy errors in api.routes.controller.templates 2026-09-29 22:02:20 +03:00
Mark Paronyan bbf4e6aa2c fix(typing): resolve mypy errors in api.routes.controller.images 2026-09-29 22:02:20 +03:00
Mark Paronyan 81474b4651 fix(typing): resolve mypy errors in db.repositories.images 2026-09-29 22:02:19 +03:00
Mark Paronyan c048124c21 fix(typing): resolve mypy errors in db.repositories.llm_model_configs 2026-09-29 22:02:19 +03:00
Mark Paronyan b1d13edd2d fix(typing): resolve mypy errors in api.routes.controller.users 2026-09-29 22:02:18 +03:00
Mark Paronyan 8e96f18429 fix(typing): resolve mypy errors in db.repositories.users 2026-09-29 22:02:18 +03:00
Mark Paronyan 1aaf36fc80 fix(typing): resolve mypy errors in db.tasks 2026-09-29 22:02:18 +03:00
Mark Paronyan a3cb73da3d fix(typing): resolve mypy errors in api.routes.controller.dependencies.authentication 2026-09-29 21:48:33 +03:00
Mark Paronyan dfea615248 fix(typing): resolve mypy errors in services.templates 2026-09-29 21:48:32 +03:00
Mark Paronyan e6053dd0a8 fix(typing): resolve mypy errors in services.computes 2026-09-29 09:23:14 +03:00
Cristi 42d30651da Merge origin/3.1 into image-manager-out-of-sync
Preserve image reconciliation, locking, and regression coverage while integrating upstream release, dependency, typing, and formatting updates. Align feature code with the new Ruff checks.
2026-09-28 23:16:24 +03:00
Mark Paronyan db265f9524 fix(typing): resolve mypy errors in db models 2026-09-28 21:48:06 +03:00
Cristi 046dff4d08 fix(images): reconcile the image inventory with filesystem changes 2026-09-28 16:01:36 +03:00
Mark Paronyan a0450b6bce refactor: ruff autofixes 2026-09-27 15:55:10 +03:00
YueGuobin 8a8314ab29 fix: dedupe and report automatic template creation from images
install_appliances_from_image relied on the name+version pair check in
TemplatesService, so the same appliance reached through a second image
(the CSR1000v case) created a second template sharing the name. The auto
path now skips when any template with the same name exists, whatever the
version, and returns a manifest of created and skipped candidates;
POST /images/install replies 200 with that manifest instead of an empty
204, and the image_install MCP tool surfaces it.
2026-08-26 00:04:57 +08:00
YueGuobin e0962a59ed feat: add GET/PUT /v3/settings server settings API
GET returns all settings sections except the deprecated
VirtualBox/VMware ones (Server.Audit privilege); secrets are
masked and Controller.jwt_secret_key is excluded entirely.
PUT applies a partial update (Server.Modify privilege): masked
or empty secrets mean unchanged, null removes the option, the
response carries the new values plus restart_required, and a
settings.updated notification is emitted. New
Server.Audit/Server.Modify privileges are seeded into the
Administrator role at table creation.
2026-08-23 18:54:31 +08:00
YueGuobin 300c53e6fb templates: persist appliance metadata on install
Appliance fields that describe the appliance (vendor information, default
credentials, installation instructions...) were dropped when installing a
template. Keep them in a new appliance_metadata JSON column on the
templates table, filled by the appliance-to-template conversion for both
registry v1-6 and v8 (version level values override the appliance level
ones). The nested schema allows extra fields so future registry fields
persist without a migration.
2026-08-21 21:41:42 +08:00
YueGuobin 9260108f53 templates: add netmiko_device_type for automation tools
Common template field (schema + templates table column + Alembic
migration) holding the Netmiko device type (e.g. 'cisco_xr', 'nokia_srl')
so Netmiko/Nornir based tooling can look up how to reach a node's CLI
without hard-coded vendor mappings. Free-form lowercase string on
purpose: Netmiko's platform list evolves independently of GNS3.
2026-08-21 21:41:35 +08:00
YueGuobin 088f1da77a docker: persist extra_configs in the template DB table
The extra_configs schema field needs a column on the docker_templates table
to actually round-trip through the controller DB (the schema alone is
accepted but dropped by the SQLAlchemy model mapping). Add the JSON column
and an Alembic migration so existing databases get it on upgrade.
2026-08-14 00:20:08 +08:00
Jeremy Grossmann 909ccf8fcd Merge branch '3.1' into base-configs-3.0 2026-08-08 22:11:39 +02:00
YueGuobin 59e5f8dd2f Fix review issues: key_prefix length, count validation, WAL log, timeout comment, pointless temp var 2026-06-16 22:50:22 +08:00
YueGuobin a8cc01af46 Remove database warmup (proven ineffective - real bottleneck was bcrypt blocking event loop) 2026-06-16 00:35:42 +08:00
YueGuobin ccb629f48f Clean up all timing/debug logs
Remove all [MCP-TIMING] and [CTRL-TIMING] log lines, timing middleware,
and related import time statements across 11 files.
2026-06-16 00:34:11 +08:00
YueGuobin 3c41dea48f Replace SELECT 1 warmup with full database file read to warm OS page cache
Reading the entire DB file into OS page cache eliminates the 8-14s
cold-start penalty on the first ORM query (users/templates/api_keys).
Previous SELECT 1 only warmed the connection pool, not the file cache.
2026-06-15 23:43:41 +08:00