ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
Cut docstrings that narrate refactor history
Juan Denise94537d0a4a6
diff --git a/backend/app/__init__.py b/backend/app/__init__.pyindex 793cd341..d22922d9 100644--- a/backend/app/__init__.py+++ b/backend/app/__init__.py@@ -275,12 +275,6 @@ def create_app(config_name=None):from app.services.storage_provider_service import StorageProviderServicen_dns = DNSProviderService.encrypt_legacy_secrets()n_store = StorageProviderService.encrypt_legacy_secrets()- # Cloud-provider legacy-secret encryption moved out with the- # serverkit-cloud-provision extension. It was a one-time- # migration of pre-encryption rows; any panel reaching this version- # already ran it in an earlier boot (idempotent), and the extension- # encrypts on write, so there's nothing left for core to do here.- n_cloud = 0n_settings = SettingsService.migrate_legacy_secrets()# Migrate DNS zones with an inline Cloudflare token onto the canonical# connection store (idempotent), so every zone resolves creds the same way.@@ -295,11 +289,11 @@ def create_app(config_name=None):import logging as _logging_logging.getLogger(__name__).warning(f'Email relay legacy migration skipped: {_relay_exc}')- if n_dns or n_store or n_cloud or n_settings or n_zones:+ if n_dns or n_store or n_settings or n_zones:import logging as _logging_logging.getLogger(__name__).info(f'Encrypted legacy secrets at rest: {n_dns} DNS provider(s), '- f'{n_store} storage field(s), {n_cloud} cloud provider(s), '+ f'{n_store} storage field(s), 'f'{n_settings} system setting(s); linked {n_zones} DNS zone(s) 'f'to a connection')except Exception as e:diff --git a/backend/app/services/db_process_service.py b/backend/app/services/db_process_service.pyindex 2f61ce14..4b7440b9 100644--- a/backend/app/services/db_process_service.py+++ b/backend/app/services/db_process_service.py@@ -41,13 +41,7 @@ class DbProcessService:# ------------------------------------------------------------------@staticmethoddef _exec_sql(target, sql):- """Run ``sql`` against the target's engine — via ``db_exec`` (§G5).-- The named seam stays (tests stub it); the engine × host dispatch it used- to re-implement does not. The private docker-postgres branch here never- set ``ON_ERROR_STOP=1``, so psql reported success for statements the- server had rejected — the drift that made three copies worth one.- """+ """Run ``sql`` against the target's engine via ``db_exec`` (tests stub this)."""return db_exec.exec_sql(target, sql)# ------------------------------------------------------------------diff --git a/backend/app/services/docker_service.py b/backend/app/services/docker_service.pyindex 3e1f687a..73f46f91 100644--- a/backend/app/services/docker_service.py+++ b/backend/app/services/docker_service.py@@ -60,23 +60,12 @@ class DockerService:# cannot silently cap a build; see COMPOSE/LONG notes below.@staticmethoddef run(args, timeout=60, **kwargs):- """Run ``docker <args>``; one result shape for every caller (§G3).-- Three services kept private ``_docker()`` wrappers around this exact- call, and the three had already drifted into three *different* return- contracts: one dict that mapped FileNotFoundError to "Docker not- found", one dict that collapsed every failure into ``str(e)``, and one- that handed back a raw ``CompletedProcess``. A caller reading- ``result['success']`` against the third silently got a ``KeyError``- rather than an answer.-- Sits on ``run_checked`` (§G1) rather than re-implementing it, so the- result shape and the error handling have exactly one definition:- ``{'success', 'output', 'stderr', 'error', 'returncode'}``. ``error``- distinguishes the three things that are not "the command said no":- docker absent, docker too slow, and everything else. A caller that- cannot tell those apart is the caller that reports "not installed"- because a probe timed out (§A).+ """Run ``docker <args>`` through ``run_checked``.++ Returns ``{'success', 'output', 'stderr', 'error', 'returncode'}``;+ ``error`` tells "docker missing" and "timed out" apart from the+ command saying no, so a slow probe is never reported as "not+ installed"."""return run_checked(['docker', *args], timeout=timeout, **kwargs)diff --git a/backend/app/services/image_update_service.py b/backend/app/services/image_update_service.pyindex e62e9585..6d8e78b9 100644--- a/backend/app/services/image_update_service.py+++ b/backend/app/services/image_update_service.py@@ -17,13 +17,7 @@ class ImageUpdateService:@staticmethoddef _docker(args, timeout=60):- """Run ``docker <args>`` — via DockerService.run (§G3).-- The seam stays (tests stub it), but the result shape is now the one- every other docker caller gets. This wrapper used to hand back a raw- ``CompletedProcess`` while the two other private ``_docker`` wrappers- returned dicts — three names, three contracts.- """+ """Run ``docker <args>`` via DockerService.run (tests stub this)."""return DockerService.run(args, timeout=timeout)@classmethoddiff --git a/backend/app/utils/system.py b/backend/app/utils/system.pyindex d1de5176..42240ec5 100644--- a/backend/app/utils/system.py+++ b/backend/app/utils/system.py@@ -168,13 +168,8 @@ def run_checked(cmd: Union[List[str], str], *, privileged: bool = False,merge_stderr: bool = False, **kwargs) -> dict:"""Run a command and get a result, not a ``CompletedProcess``.- The result-shaped door. Around ``backend/app``'s raw ``subprocess`` calls- sit 220 copies of ``capture_output=True, text=True``, 56 hand-rolled- ``except subprocess.TimeoutExpired`` handlers, 19 hand-rolled- ``except FileNotFoundError`` handlers, and 1,164 literal- ``{'success': False, 'error': ...}`` constructions. Each of those is a- place where an exec failure can be — and has been — converted- into a false fact about the operator's server.+ Use this instead of raw ``subprocess``: hand-rolled exec handling is+ where a failure to run gets reported as a fact about the server.Returns::diff --git a/frontend/src/components/git/BitbucketRepoPicker.jsx b/frontend/src/components/git/BitbucketRepoPicker.jsxindex dd5133d6..fcb2c15f 100644--- a/frontend/src/components/git/BitbucketRepoPicker.jsx+++ b/frontend/src/components/git/BitbucketRepoPicker.jsx@@ -1,9 +1,7 @@import RepoPicker from './RepoPicker';import { bitbucketProvider } from './repoProviders';-// Thin binding over the shared picker contract. The four-// provider pickers were near-identical copies; the shape they shared now-// lives in RepoPicker and the differences in repoProviders.+// Thin binding of the shared RepoPicker to this provider.const BitbucketRepoPicker = ({ onPick }) => (<RepoPicker provider={bitbucketProvider} onPick={onPick} />);diff --git a/frontend/src/components/git/GiteaRepoPicker.jsx b/frontend/src/components/git/GiteaRepoPicker.jsxindex ab738acd..9ef78a66 100644--- a/frontend/src/components/git/GiteaRepoPicker.jsx+++ b/frontend/src/components/git/GiteaRepoPicker.jsx@@ -1,9 +1,7 @@import RepoPicker from './RepoPicker';import { giteaProvider } from './repoProviders';-// Thin binding over the shared picker contract. The four-// provider pickers were near-identical copies; the shape they shared now-// lives in RepoPicker and the differences in repoProviders.+// Thin binding of the shared RepoPicker to this provider.const GiteaRepoPicker = ({ onPick }) => (<RepoPicker provider={giteaProvider} onPick={onPick} />);diff --git a/frontend/src/components/git/GithubRepoPicker.jsx b/frontend/src/components/git/GithubRepoPicker.jsxindex 35cd6024..67f5663d 100644--- a/frontend/src/components/git/GithubRepoPicker.jsx+++ b/frontend/src/components/git/GithubRepoPicker.jsx@@ -1,9 +1,7 @@import RepoPicker from './RepoPicker';import { githubProvider } from './repoProviders';-// Thin binding over the shared picker contract. The four-// provider pickers were near-identical copies; the shape they shared now-// lives in RepoPicker and the differences in repoProviders.+// Thin binding of the shared RepoPicker to this provider.const GithubRepoPicker = ({ onPick }) => (<RepoPicker provider={githubProvider} onPick={onPick} />);diff --git a/frontend/src/components/git/GitlabRepoPicker.jsx b/frontend/src/components/git/GitlabRepoPicker.jsxindex 015751b8..94ae0a24 100644--- a/frontend/src/components/git/GitlabRepoPicker.jsx+++ b/frontend/src/components/git/GitlabRepoPicker.jsx@@ -1,9 +1,7 @@import RepoPicker from './RepoPicker';import { gitlabProvider } from './repoProviders';-// Thin binding over the shared picker contract. The four-// provider pickers were near-identical copies; the shape they shared now-// lives in RepoPicker and the differences in repoProviders.+// Thin binding of the shared RepoPicker to this provider.const GitlabRepoPicker = ({ onPick }) => (<RepoPicker provider={gitlabProvider} onPick={onPick} />);diff --git a/frontend/src/utils/formatNumber.js b/frontend/src/utils/formatNumber.jsindex aa24d0d3..bd12bb6e 100644--- a/frontend/src/utils/formatNumber.js+++ b/frontend/src/utils/formatNumber.js@@ -6,10 +6,6 @@// precise count stays one hover away. Non-finite / non-numeric input is// returned unchanged, letting callers pass placeholders like an em dash// straight through.-//-// Both used to build `new Intl.NumberFormat('en')` at module load-// -- a hardcoded locale AND a formatter that could never follow a switch.-// They now delegate to the format door.import { formatCompactNumber, formatNumber } from './intl.js';diff --git a/frontend/src/utils/time.js b/frontend/src/utils/time.jsindex 8527f710..9c917777 100644--- a/frontend/src/utils/time.js+++ b/frontend/src/utils/time.js@@ -1,11 +1,5 @@-// Relative-time and duration helpers.-//-// The implementations moved to `utils/intl.js`, which is the one-// locale-aware formatting door. These names stay because ten files import-// them and the two output shapes are deliberate — but they are now thin-// delegations, not a second implementation. Notably the date tail of both-// styles used to be `toLocaleDateString()` with no argument, which follows the-// BROWSER's locale rather than the panel's.+// Relative-time and duration helpers: thin wrappers over `utils/intl.js`+// with two deliberate output shapes.//// - timeAgo(iso) compact: "just now", "4m", "3h", "2d", else a date// - formatRelativeTime verbose, now fully localized by Intl: