From c4973290a68010ddffb0714f0da1a9d4351452b7 Mon Sep 17 00:00:00 2001 From: Chris Coutinho Date: Sat, 17 Jan 2026 10:56:36 +0100 Subject: [PATCH] fix(astrolabe): resolve CI failures for code quality checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix PHP CS Fixer issues (single quotes, indentation) - Add typed property declarations to ApiController - Add Psalm baseline to suppress 517 pre-existing errors - Fix workflow name references (astroglobe → astrolabe) The CI workflow was previously watching a non-existent path and never ran. After fixing the path trigger, these pre-existing code quality issues were discovered. The Psalm baseline allows CI to pass while tracking technical debt for incremental resolution. Co-Authored-By: Claude Opus 4.5 --- .../{astroglobe-ci.yml => astrolabe-ci.yml} | 12 +- .../lib/Controller/ApiController.php | 14 +- .../lib/Controller/CredentialsController.php | 2 +- third_party/astrolabe/psalm-baseline.xml | 774 ++++++++++++++++++ third_party/astrolabe/psalm.xml | 1 + .../astrolabe/templates/settings/personal.php | 10 +- 6 files changed, 794 insertions(+), 19 deletions(-) rename .github/workflows/{astroglobe-ci.yml => astrolabe-ci.yml} (97%) create mode 100644 third_party/astrolabe/psalm-baseline.xml diff --git a/.github/workflows/astroglobe-ci.yml b/.github/workflows/astrolabe-ci.yml similarity index 97% rename from .github/workflows/astroglobe-ci.yml rename to .github/workflows/astrolabe-ci.yml index a87a562..8d7afd8 100644 --- a/.github/workflows/astroglobe-ci.yml +++ b/.github/workflows/astrolabe-ci.yml @@ -1,24 +1,24 @@ -# Consolidated CI workflow for Astroglobe Nextcloud app +# Consolidated CI workflow for Astrolabe Nextcloud app # -# Runs on PRs that modify the astroglobe directory +# Runs on PRs that modify the astrolabe directory # Based on Nextcloud app skeleton workflows # # SPDX-FileCopyrightText: 2025 Nextcloud MCP Server contributors # SPDX-License-Identifier: MIT -name: Astroglobe CI +name: Astrolabe CI on: pull_request: paths: - 'third_party/astrolabe/**' - - '.github/workflows/astroglobe-ci.yml' + - '.github/workflows/astrolabe-ci.yml' permissions: contents: read concurrency: - group: astroglobe-ci-${{ github.head_ref || github.run_id }} + group: astrolabe-ci-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: @@ -308,7 +308,7 @@ jobs: runs-on: ubuntu-latest needs: [changes, node-build, eslint, stylelint, php-cs, psalm, phpunit] if: always() - name: astroglobe-ci-summary + name: astrolabe-ci-summary steps: - name: Summary status run: | diff --git a/third_party/astrolabe/lib/Controller/ApiController.php b/third_party/astrolabe/lib/Controller/ApiController.php index 5dbd6ec..a2139b9 100644 --- a/third_party/astrolabe/lib/Controller/ApiController.php +++ b/third_party/astrolabe/lib/Controller/ApiController.php @@ -26,13 +26,13 @@ use Psr\Log\LoggerInterface; * Handles form submissions and AJAX requests from settings panels. */ class ApiController extends Controller { - private $client; - private $userSession; - private $urlGenerator; - private $logger; - private $tokenStorage; - private $config; - private $tokenRefresher; + private McpServerClient $client; + private IUserSession $userSession; + private IURLGenerator $urlGenerator; + private LoggerInterface $logger; + private McpTokenStorage $tokenStorage; + private IConfig $config; + private IdpTokenRefresher $tokenRefresher; public function __construct( string $appName, diff --git a/third_party/astrolabe/lib/Controller/CredentialsController.php b/third_party/astrolabe/lib/Controller/CredentialsController.php index 9786e9f..2ba87ff 100644 --- a/third_party/astrolabe/lib/Controller/CredentialsController.php +++ b/third_party/astrolabe/lib/Controller/CredentialsController.php @@ -112,7 +112,7 @@ class CredentialsController extends Controller { // Get MCP server URL from system config (set in config.php) $mcpServerUrl = $this->config->getSystemValue('mcp_server_url', ''); if (empty($mcpServerUrl)) { - $this->logger->warning("MCP server URL not configured, app password stored locally only"); + $this->logger->warning('MCP server URL not configured, app password stored locally only'); return new JSONResponse([ 'success' => true, 'partial_success' => true, diff --git a/third_party/astrolabe/psalm-baseline.xml b/third_party/astrolabe/psalm-baseline.xml new file mode 100644 index 0000000..8cd76ea --- /dev/null +++ b/third_party/astrolabe/psalm-baseline.xml @@ -0,0 +1,774 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + getBody()]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + getBody()]]> + getBody()]]> + + getBody()]]> + getBody()]]> + urlGenerator->linkToRoute('settings.PersonalSettings.index', [ + 'section' => 'astrolabe', + 'error' => urlencode($e->getMessage()) + ])]]> + urlGenerator->linkToRoute('settings.PersonalSettings.index', ['section' => 'astrolabe'])]]> + urlGenerator->linkToRoute('settings.PersonalSettings.index', ['section' => 'astrolabe'])]]> + urlGenerator->linkToRoute('settings.PersonalSettings.index', ['section' => 'astrolabe'])]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + getUID()]]> + getUID()]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + getBody()]]> + + getBody()]]> + getBody()]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + getBody()]]> + getBody()]]> + getBody()]]> + getBody()]]> + getBody()]]> + getBody()]]> + getBody()]]> + getBody()]]> + getBody()]]> + getBody()]]> + getBody()]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + , + * error?: string + * }]]> + + + , + * total_found?: int, + * algorithm_used?: string, + * error?: string + * }]]> + + + + , + * error?: string + * }]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + baseUrl]]> + baseUrl]]> + baseUrl]]> + baseUrl]]> + baseUrl]]> + baseUrl]]> + baseUrl]]> + baseUrl]]> + baseUrl]]> + baseUrl]]> + baseUrl]]> + + + + + + + + + + + + + + baseUrl]]> + config->getSystemValue('mcp_server_public_url', $this->baseUrl)]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $eventConfig['event']]]> + + + + + + + + + ]]> + $eventConfig['event'], + $preset['events'] + )]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third_party/astrolabe/psalm.xml b/third_party/astrolabe/psalm.xml index e2853b7..920055b 100644 --- a/third_party/astrolabe/psalm.xml +++ b/third_party/astrolabe/psalm.xml @@ -8,6 +8,7 @@ findUnusedBaselineEntry="true" findUnusedCode="true" phpVersion="8.1" + errorBaseline="psalm-baseline.xml" > diff --git a/third_party/astrolabe/templates/settings/personal.php b/third_party/astrolabe/templates/settings/personal.php index 61db152..9efdd7a 100644 --- a/third_party/astrolabe/templates/settings/personal.php +++ b/third_party/astrolabe/templates/settings/personal.php @@ -47,12 +47,12 @@ style('astrolabe', 'astrolabe-main'); // All CSS bundled into main // Determine if hybrid mode (multi_user_basic + app passwords) // In hybrid mode, user needs BOTH OAuth AND app password to be "fully configured" $isHybridMode = ($_['authMode'] ?? '') === 'multi_user_basic' && !empty($_['supportsAppPasswords']); - $hasOAuthToken = !empty($_['hasOAuthToken']); - $hasBackgroundAccess = !empty($_['hasBackgroundAccess']) || !empty($_['backgroundAccessGranted']); +$hasOAuthToken = !empty($_['hasOAuthToken']); +$hasBackgroundAccess = !empty($_['hasBackgroundAccess']) || !empty($_['backgroundAccessGranted']); - // In hybrid mode: both credentials required; otherwise just background access - $isFullyConfigured = $isHybridMode ? ($hasOAuthToken && $hasBackgroundAccess) : $hasBackgroundAccess; - ?> +// In hybrid mode: both credentials required; otherwise just background access +$isFullyConfigured = $isHybridMode ? ($hasOAuthToken && $hasBackgroundAccess) : $hasBackgroundAccess; +?>