Skip to content

feat: remove Unraid API log download functionality#1793

Merged
elibosley merged 4 commits intomainfrom
codex/remove-download-unraid-api-logs-helper
Nov 19, 2025
Merged

feat: remove Unraid API log download functionality#1793
elibosley merged 4 commits intomainfrom
codex/remove-download-unraid-api-logs-helper

Conversation

@elibosley
Copy link
Copy Markdown
Member

@elibosley elibosley commented Nov 19, 2025

Summary

  • remove the REST API log download helper and associated service wiring
  • drop the Download API Logs UI component and related registrations and test references
  • update tests and type declarations to reflect the removal

Testing

  • Not run (not requested)

Codex Task

Summary by CodeRabbit

  • Removed Features

    • Removed the API logs download feature — the UI download component and the corresponding public API endpoint are no longer available.
  • Chores

    • Cleaned up related tests, component registrations, and unused integration/dependency wiring tied to the removed logs feature.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 19, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Removed the API logs download feature across backend and frontend: deleted the GET /graphql/api/logs controller endpoint and its service methods/dependencies, removed the DownloadApiLogs UI component and registry entry, and cleaned up related tests and type declarations.

Changes

Cohort / File(s) Summary
Controller endpoint
api/src/unraid-api/rest/rest.controller.ts
Removed getLogs(@res() res: FastifyReply) endpoint and its routing/guard/error-handling logic.
Service implementation
api/src/unraid-api/rest/rest.service.ts
Removed logging/reporting functionality: deleted getLogs, saveApiReport, Logger/ApiReportService/execa/fs/promises usages; retained getCustomizationPath and getCustomizationStream.
Module wiring
api/src/unraid-api/rest/rest.module.ts
Removed CliServicesModule from @Module imports.
Backend tests — modified
api/src/unraid-api/rest/rest.controller.test.ts, api/src/unraid-api/rest/rest.service.spec.ts
Adjusted mocks: removed getLogs/ApiReportService mocks; added fs/image-file-helpers mocks; new/updated tests focused on customization path/stream behavior.
Backend tests — deleted
api/src/unraid-api/rest/rest.service.test.ts, api/src/unraid-api/rest/__test__/rest-module-dependencies.test.ts, api/src/unraid-api/rest/__test__/rest-module.integration.test.ts
Deleted multiple RestService integration/unit tests that covered log/report generation and module wiring.
Frontend component — deleted
web/src/components/DownloadApiLogs.standalone.vue
Component removed (download button, computed CSRF URL, external links).
Frontend component registry
web/src/components/Wrapper/component-registry.ts
Removed mapping entry for DownloadApiLogs (selector: 'unraid-download-api-logs', appId: 'download-api-logs').
Frontend usage removal
web/src/components/ConnectSettings/ConnectSettings.standalone.vue, web/test-pages/pages/api-developer.njk, web/_webGui/testWebComponents.page, web/src/pages/index.vue
Removed imports/usage or commented block references to the DownloadApiLogs component / unraid-download-api-logs element.
Frontend tests — deleted / modified
web/__test__/components/DownloadApiLogs.test.ts, web/__test__/components/Wrapper/component-registry.test.ts, web/__test__/components/component-registry.test.ts
Deleted DownloadApiLogs test file; removed its mock from component-registry tests and updated expected appIds.
Types
web/types/window.d.ts
Removed mountDownloadApiLogs?: (selector?: string) => unknown from global Window augmentation.
Misc backend tests
api/src/unraid-api/app/__test__/module-dependencies.integration.spec.ts, api/src/unraid-api/graph/resolvers/sso/core/oidc-base.module.ts
Test module now imports ConfigModule.forRoot(...); added ConfigModule to oidc-base.module.ts imports.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client
  participant RestController
  participant RestService
  participant ApiReportService
  participant Filesystem

  Note over Client,RestController: Previous flow (before removal)
  Client->>RestController: GET /graphql/api/logs
  RestController->>RestService: getLogs()
  RestService->>ApiReportService: generateReport() / run execa to tar/zip
  ApiReportService-->>RestService: report stream / path
  RestService->>Filesystem: read stream
  RestService-->>RestController: ReadStream
  RestController-->>Client: 200 application/x-gtar (stream)
Loading
sequenceDiagram
  autonumber
  participant Client
  participant RestController

  Note over Client,RestController: New flow (after removal)
  Client->>RestController: GET /graphql/api/logs
  RestController--xClient: 404 / route not present (request won't reach controller)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Attention areas:
    • Ensure no remaining references to getLogs, ApiReportService, or removed CLI services across imports.
    • Validate Nest module imports after removing CliServicesModule.
    • Confirm test coverage expectations and update CI to reflect deleted tests.
    • Verify frontend dynamic component resolution where registry entry was removed.

Suggested reviewers

  • pujitm

Poem

🐇 I hopped through code with eager paws,
Removed the logs and cleaned the claws.
Streams and buttons gently gone,
Simpler burrows greet the dawn. 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and accurately summarizes the main change: removal of the Unraid API log download functionality. This is directly reflected throughout the changeset with deletions of the DownloadApiLogs component, REST endpoint, service methods, and related tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/remove-download-unraid-api-logs-helper

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d28cb42 and f49fdf0.

📒 Files selected for processing (21)
  • api/src/unraid-api/app/__test__/module-dependencies.integration.spec.ts (2 hunks)
  • api/src/unraid-api/graph/resolvers/sso/core/oidc-base.module.ts (2 hunks)
  • api/src/unraid-api/rest/__test__/rest-module-dependencies.test.ts (0 hunks)
  • api/src/unraid-api/rest/__test__/rest-module.integration.test.ts (0 hunks)
  • api/src/unraid-api/rest/__test__/rest.service.test.ts (0 hunks)
  • api/src/unraid-api/rest/rest.controller.test.ts (0 hunks)
  • api/src/unraid-api/rest/rest.controller.ts (0 hunks)
  • api/src/unraid-api/rest/rest.module.ts (1 hunks)
  • api/src/unraid-api/rest/rest.service.spec.ts (1 hunks)
  • api/src/unraid-api/rest/rest.service.test.ts (0 hunks)
  • api/src/unraid-api/rest/rest.service.ts (1 hunks)
  • web/__test__/components/DownloadApiLogs.test.ts (0 hunks)
  • web/__test__/components/Wrapper/component-registry.test.ts (0 hunks)
  • web/__test__/components/component-registry.test.ts (0 hunks)
  • web/_webGui/testWebComponents.page (0 hunks)
  • web/src/components/ConnectSettings/ConnectSettings.standalone.vue (0 hunks)
  • web/src/components/DownloadApiLogs.standalone.vue (0 hunks)
  • web/src/components/Wrapper/component-registry.ts (0 hunks)
  • web/src/pages/index.vue (0 hunks)
  • web/test-pages/pages/api-developer.njk (0 hunks)
  • web/types/window.d.ts (0 hunks)
💤 Files with no reviewable changes (16)
  • api/src/unraid-api/rest/rest.controller.ts
  • api/src/unraid-api/rest/test/rest-module.integration.test.ts
  • web/src/components/DownloadApiLogs.standalone.vue
  • web/test-pages/pages/api-developer.njk
  • web/types/window.d.ts
  • api/src/unraid-api/rest/rest.controller.test.ts
  • api/src/unraid-api/rest/test/rest-module-dependencies.test.ts
  • web/src/pages/index.vue
  • api/src/unraid-api/rest/test/rest.service.test.ts
  • web/test/components/Wrapper/component-registry.test.ts
  • web/_webGui/testWebComponents.page
  • web/src/components/ConnectSettings/ConnectSettings.standalone.vue
  • api/src/unraid-api/rest/rest.service.test.ts
  • web/test/components/DownloadApiLogs.test.ts
  • web/src/components/Wrapper/component-registry.ts
  • web/test/components/component-registry.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • api/src/unraid-api/rest/rest.module.ts
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2025-04-23T20:19:42.542Z
Learnt from: pujitm
Repo: unraid/api PR: 1367
File: packages/unraid-api-plugin-connect/src/pubsub/user.service.ts:44-52
Timestamp: 2025-04-23T20:19:42.542Z
Learning: The project uses a custom or extended implementation of NestJS ConfigService that includes a `set()` method for runtime configuration mutation, unlike the standard nestjs/config package which only provides getter methods.

Applied to files:

  • api/src/unraid-api/graph/resolvers/sso/core/oidc-base.module.ts
  • api/src/unraid-api/app/__test__/module-dependencies.integration.spec.ts
📚 Learning: 2025-04-23T20:19:42.542Z
Learnt from: pujitm
Repo: unraid/api PR: 1367
File: packages/unraid-api-plugin-connect/src/pubsub/user.service.ts:44-52
Timestamp: 2025-04-23T20:19:42.542Z
Learning: The project uses a custom ConfigService implementation that includes a `set()` method for runtime configuration mutation, unlike the standard nestjs/config package which only provides getter methods.

Applied to files:

  • api/src/unraid-api/graph/resolvers/sso/core/oidc-base.module.ts
📚 Learning: 2025-08-09T01:03:29.676Z
Learnt from: elibosley
Repo: unraid/api PR: 1575
File: packages/unraid-shared/src/services/socket-config.service.spec.ts:10-13
Timestamp: 2025-08-09T01:03:29.676Z
Learning: Vitest is used for all testing across all repositories in the unraid organization, not Jest. Always use `vi` for mocking utilities, not `jest`.

Applied to files:

  • api/src/unraid-api/rest/rest.service.spec.ts
📚 Learning: 2025-01-29T16:36:04.777Z
Learnt from: elibosley
Repo: unraid/api PR: 1082
File: api/src/unraid-api/unraid-file-modifier/modifications/log-rotate.modification.ts:33-37
Timestamp: 2025-01-29T16:36:04.777Z
Learning: The UnraidFileModifierService in the Unraid API provides comprehensive error handling for all FileModification implementations. It includes try/catch blocks, detailed error logging, and safe rollback mechanisms. Individual FileModification implementations (like LogRotateModification) should allow errors to propagate to this service layer rather than handling them internally.

Applied to files:

  • api/src/unraid-api/rest/rest.service.ts
📚 Learning: 2025-01-29T16:35:43.699Z
Learnt from: elibosley
Repo: unraid/api PR: 1082
File: api/src/unraid-api/unraid-file-modifier/modifications/log-rotate.modification.ts:39-41
Timestamp: 2025-01-29T16:35:43.699Z
Learning: The UnraidFileModifierService in the Unraid API provides comprehensive error handling for all FileModification implementations, including detailed error logging with stack traces and modification IDs. Individual FileModification implementations should focus on their core functionality without duplicating error handling.

Applied to files:

  • api/src/unraid-api/rest/rest.service.ts
📚 Learning: 2024-11-15T16:22:03.485Z
Learnt from: elibosley
Repo: unraid/api PR: 942
File: api/src/unraid-api/auth/api-key.service.ts:176-188
Timestamp: 2024-11-15T16:22:03.485Z
Learning: Atomic writes are not required for the `saveApiKey` method in `ApiKeyService` (`api/src/unraid-api/auth/api-key.service.ts`) unless specifically needed.

Applied to files:

  • api/src/unraid-api/rest/rest.service.ts
🔇 Additional comments (10)
api/src/unraid-api/rest/rest.service.spec.ts (5)

1-18: LGTM! Mocking setup follows best practices.

The imports and mock setup correctly use Vitest's vi.mock and properly mock both node:fs and the image file helpers. This aligns with the project's testing standards.


23-31: LGTM! Test setup is clean and properly configured.

The beforeEach correctly clears mocks and the test module now only provides RestService, aligning with the removal of ApiReportService dependency.


33-55: LGTM! Comprehensive test coverage for getCustomizationPath.

The test suite thoroughly covers all scenarios: banner path, case path, and null returns when resources are unavailable. The mocking strategy correctly isolates dependencies.


57-87: LGTM! Thorough testing of stream creation and error handling.

The test suite comprehensively verifies stream creation for both banner and case resources, ensures createReadStream is called with the correct path, and validates error throwing with descriptive messages when resources are unavailable.


1-88: No cleanup issues found—removal of saveApiReport and getLogs is complete.

Verification confirms all references to the removed RestService methods have been properly cleaned up across the codebase:

  • No remaining saveApiReport references in production code
  • No remaining getLogs references in RestService context
  • The old test file path no longer exists; the current test file (rest.service.spec.ts) is properly structured
api/src/unraid-api/rest/rest.service.ts (3)

1-11: LGTM! Clean service implementation with focused responsibilities.

The service correctly removes all log-related dependencies and imports, now focusing solely on customization resource handling. The @Injectable decorator without a constructor is appropriate since the service has no dependencies.


12-19: LGTM! Type-safe path resolution.

The getCustomizationPath method correctly delegates to the appropriate helper functions based on the type parameter. The exhaustive switch statement is type-safe with the 'banner' | 'case' union type, eliminating the need for a default case.


21-27: LGTM! Proper error handling and stream creation.

The getCustomizationStream method correctly validates the path exists before creating the stream. The descriptive error message (No ${type} found) aligns with the test expectations and provides clear feedback to callers.

api/src/unraid-api/graph/resolvers/sso/core/oidc-base.module.ts (1)

2-2: Clarify the connection to PR objectives.

This PR is focused on removing API log download functionality, but this change adds ConfigModule support to OidcBaseModule. While the change appears technically sound, it's unclear how it relates to removing the log download feature.

Is this a side effect where the removed code (e.g., CliServicesModule or related REST modules) was previously providing ConfigModule globally, necessitating explicit imports in dependent modules?

Please clarify:

  1. Why does OidcBaseModule now require an explicit ConfigModule import?
  2. How does this relate to removing the log download functionality?
  3. Should this change be in a separate PR if it's unrelated dependency cleanup?

Also applies to: 11-11

api/src/unraid-api/app/__test__/module-dependencies.integration.spec.ts (1)

2-2: ConfigModule dependency verified as necessary.

The code change is correct. RestModule transitively requires ConfigModule through its dependency chain: RestModule → SsoModule → OidcCoreModule → OidcBaseModule (which imports ConfigModule). The configuration with ignoreEnvFile: true and isGlobal: true is appropriate for isolated testing.

However, the verification checklist cannot be fully completed due to sandbox limitations:

  • ✅ ConfigModule dependency is necessary (confirmed via module dependency tracing)
  • ❌ Test pass/fail status cannot be verified (vitest environment unavailable in sandbox)
  • ❌ Impact on other tests cannot be verified (test execution failed)

Manual verification of actual test execution is recommended.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 3 to 10
import { RCloneModule } from '@app/unraid-api/graph/resolvers/rclone/rclone.module.js';
import { SsoModule } from '@app/unraid-api/graph/resolvers/sso/sso.module.js';
import { RestController } from '@app/unraid-api/rest/rest.controller.js';
import { RestService } from '@app/unraid-api/rest/rest.service.js';

@Module({
imports: [RCloneModule, CliServicesModule, SsoModule],
imports: [RCloneModule, SsoModule],
controllers: [RestController],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep ApiReportService wiring aligned with RestModule tests

RestModule now imports only the rclone and SSO modules (lines 3–10), so ApiReportService is no longer provided. The existing integration suites in api/src/unraid-api/rest/__test__/rest-module.integration.test.ts and rest-module-dependencies.test.ts still call Test.createTestingModule({ imports: [RestModule] }) and then retrieve ApiReportService, which will now fail with a missing provider error. Running the test suite will therefore fail immediately; either reintroduce the CliServicesModule provider/export chain or update those tests to reflect the removal.

Useful? React with 👍 / 👎.

Comment on lines 8 to 11
export class RestService {
protected logger = new Logger(RestService.name);

constructor(private readonly apiReportService: ApiReportService) {}

async saveApiReport(pathToReport: string) {
try {
const apiReport = await this.apiReportService.generateReport();
this.logger.debug('Report object %o', apiReport);
await writeFile(pathToReport, JSON.stringify(apiReport, null, 2), 'utf-8');
} catch (error) {
this.logger.warn('Could not generate report for zip with error %o', error);
}
}

async getLogs(): Promise<ReadStream> {
const logPath = getters.paths()['log-base'];
const graphqlApiLog = '/var/log/graphql-api.log';

try {
await this.saveApiReport(join(logPath, 'report.json'));
} catch (error) {
this.logger.warn('Could not generate report for zip with error %o', error);
}
const zipToWrite = join(logPath, '../unraid-api.tar.gz');

const logPathExists = Boolean(await stat(logPath).catch(() => null));
if (logPathExists) {
try {
// Build tar command arguments
const tarArgs = ['-czf', zipToWrite, logPath];

// Check if graphql-api.log exists and add it to the archive
const graphqlLogExists = Boolean(await stat(graphqlApiLog).catch(() => null));
if (graphqlLogExists) {
tarArgs.push(graphqlApiLog);
this.logger.debug('Including graphql-api.log in archive');
}

// Execute tar with timeout and capture output
await execa('tar', tarArgs, {
timeout: 60000, // 60 seconds timeout for tar operation
reject: true, // Throw on non-zero exit (default behavior)
});

const tarFileExists = Boolean(await stat(zipToWrite).catch(() => null));

if (tarFileExists) {
return createReadStream(zipToWrite);
} else {
throw new Error(
'Failed to create log zip - tar file not found after successful command'
);
}
} catch (error) {
// Build detailed error message with execa's built-in error info
let errorMessage = 'Failed to create logs archive';

if (error && typeof error === 'object' && 'command' in error) {
const execaError = error as ExecaError;

if (execaError.timedOut) {
errorMessage = `Tar command timed out after 60 seconds. Command: ${execaError.command}`;
} else if (execaError.exitCode !== undefined) {
errorMessage = `Tar command failed with exit code ${execaError.exitCode}. Command: ${execaError.command}`;
}

// Add stderr/stdout if available
if (execaError.stderr) {
errorMessage += `. Stderr: ${execaError.stderr}`;
}
if (execaError.stdout) {
errorMessage += `. Stdout: ${execaError.stdout}`;
}

// Include the short message from execa
if (execaError.shortMessage) {
errorMessage += `. Details: ${execaError.shortMessage}`;
}
} else if (error instanceof Error) {
errorMessage += `: ${error.message}`;
}

this.logger.error(errorMessage, error);
throw new Error(errorMessage);
}
} else {
throw new Error('No logs to download');
}
}

async getCustomizationPath(type: 'banner' | 'case'): Promise<string | null> {
switch (type) {
case 'banner':
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Address removal of saveApiReport from RestService

RestService now only exposes customization helpers (lines 8–23) and no longer defines saveApiReport. The api/src/unraid-api/rest/__test__/rest.service.test.ts suite still calls restService.saveApiReport(...), which now throws restService.saveApiReport is not a function, causing that test file to fail whenever the suite runs. Reintroducing the method or updating the dependent tests/callers is needed to keep the tests passing.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
api/src/unraid-api/rest/rest.service.ts (1)

1-25: RestService customization methods look good; adjust import formatting for Prettier

The getCustomizationPath / getCustomizationStream logic is simple and correct, and the type restriction to 'banner' | 'case' matches the controller validation.

The Test API check is complaining about the import formatting on line 5; to satisfy Prettier you can expand this named import:

-import { getBannerPathIfPresent, getCasePathIfPresent } from '@app/core/utils/images/image-file-helpers.js';
+import {
+    getBannerPathIfPresent,
+    getCasePathIfPresent,
+} from '@app/core/utils/images/image-file-helpers.js';
api/src/unraid-api/rest/rest.service.spec.ts (1)

4-4: Vitest import usage is consistent and sufficient for this spec

Using beforeEach, describe, expect, and it from Vitest is aligned with the repo’s test setup, and there’s no need to import vi here since this spec doesn’t mock anything. Given behavior tests live in rest.service.test.ts, this lightweight “service is defined” spec is fine.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d4f193 and d28cb42.

📒 Files selected for processing (16)
  • api/src/unraid-api/rest/rest.controller.test.ts (0 hunks)
  • api/src/unraid-api/rest/rest.controller.ts (1 hunks)
  • api/src/unraid-api/rest/rest.module.ts (1 hunks)
  • api/src/unraid-api/rest/rest.service.spec.ts (1 hunks)
  • api/src/unraid-api/rest/rest.service.test.ts (1 hunks)
  • api/src/unraid-api/rest/rest.service.ts (1 hunks)
  • web/__test__/components/DownloadApiLogs.test.ts (0 hunks)
  • web/__test__/components/Wrapper/component-registry.test.ts (0 hunks)
  • web/__test__/components/component-registry.test.ts (0 hunks)
  • web/_webGui/testWebComponents.page (0 hunks)
  • web/src/components/ConnectSettings/ConnectSettings.standalone.vue (0 hunks)
  • web/src/components/DownloadApiLogs.standalone.vue (0 hunks)
  • web/src/components/Wrapper/component-registry.ts (0 hunks)
  • web/src/pages/index.vue (0 hunks)
  • web/test-pages/pages/api-developer.njk (0 hunks)
  • web/types/window.d.ts (0 hunks)
💤 Files with no reviewable changes (11)
  • web/src/components/Wrapper/component-registry.ts
  • api/src/unraid-api/rest/rest.controller.test.ts
  • web/test/components/component-registry.test.ts
  • web/types/window.d.ts
  • web/test/components/Wrapper/component-registry.test.ts
  • web/test/components/DownloadApiLogs.test.ts
  • web/src/pages/index.vue
  • web/src/components/DownloadApiLogs.standalone.vue
  • web/src/components/ConnectSettings/ConnectSettings.standalone.vue
  • web/test-pages/pages/api-developer.njk
  • web/_webGui/testWebComponents.page
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-09T01:03:29.676Z
Learnt from: elibosley
Repo: unraid/api PR: 1575
File: packages/unraid-shared/src/services/socket-config.service.spec.ts:10-13
Timestamp: 2025-08-09T01:03:29.676Z
Learning: Vitest is used for all testing across all repositories in the unraid organization, not Jest. Always use `vi` for mocking utilities, not `jest`.

Applied to files:

  • api/src/unraid-api/rest/rest.service.test.ts
  • api/src/unraid-api/rest/rest.service.spec.ts
📚 Learning: 2024-11-06T20:59:25.809Z
Learnt from: mdatelle
Repo: unraid/api PR: 942
File: api/src/unraid-api/graph/resolvers/auth/auth.resolver.ts:111-113
Timestamp: 2024-11-06T20:59:25.809Z
Learning: In the Unraid API project, error handling for mutations is handled at the service level rather than in the GraphQL resolvers. Specifically, in `api/src/unraid-api/graph/resolvers/auth/auth.resolver.ts`, methods like `removeRoleFromApiKey` rely on service-level error handling.

Applied to files:

  • api/src/unraid-api/rest/rest.controller.ts
🪛 GitHub Actions: CI - Main (API)
api/src/unraid-api/rest/rest.controller.ts

[error] 2-2: prettier/prettier: Delete import escapeHtml from 'escape-html'; (eslint config with prettier).

🪛 GitHub Check: Test API
api/src/unraid-api/rest/rest.service.test.ts

[failure] 8-8:
Replace ·getBannerPathIfPresent,·getCasePathIfPresent· with ⏎····getBannerPathIfPresent,⏎····getCasePathIfPresent,⏎

api/src/unraid-api/rest/rest.controller.ts

[failure] 2-2:
Delete import·escapeHtml·from·'escape-html';⏎

api/src/unraid-api/rest/rest.service.ts

[failure] 5-5:
Replace ·getBannerPathIfPresent,·getCasePathIfPresent· with ⏎····getBannerPathIfPresent,⏎····getCasePathIfPresent,⏎

🔇 Additional comments (3)
api/src/unraid-api/rest/rest.controller.ts (1)

2-2: Keep the escapeHtml import; it is actively used

The verification confirms that escapeHtml is used on line 97 to safely escape user-controlled values in the invalid redirect_uri error message. The import is necessary and should not be removed.

api/src/unraid-api/rest/rest.module.ts (1)

8-12: RestModule correctly isolates CliServicesModule removal; no dangling references

Verification confirms the removal of CliServicesModule from RestModule imports is complete and isolated. The remaining references to CliServicesModule are only within the CLI module itself (cli-services.module.ts) and its test file (cli.module.spec.ts), which is expected and correct. The change poses no risk to other modules.

api/src/unraid-api/rest/rest.service.test.ts (1)

2-83: The review comment does not match the actual code in this file.

The review comment references tests for getCustomizationPath() and getCustomizationStream() with imports for getBannerPathIfPresent, getCasePathIfPresent, ReadStream, and Readable. However, the actual file at api/src/unraid-api/rest/rest.service.test.ts contains tests for saveApiReport() with entirely different mocking and imports (including ApiReportService).

The provided code snippet appears to be from a different version, branch, or file than what currently exists in the repository. The suggested Prettier formatting fix is not applicable to the current code.

Verify that the review is being applied to the correct file and branch, or retrieve the correct review comment for the current test file.

Likely an incorrect or invalid review comment.

@coderabbitai coderabbitai bot requested a review from pujitm November 19, 2025 11:35
@elibosley elibosley changed the title Remove Unraid API log download functionality feat: remove Unraid API log download functionality Nov 19, 2025
- Updated `rest.service.spec.ts` to include new tests for `getCustomizationPath` and `getCustomizationStream` methods, ensuring proper handling of banner and case paths.
- Removed obsolete test files: `rest.service.test.ts`, `rest-module-dependencies.test.ts`, and `rest-module.integration.test.ts` to streamline the test suite.
- Added necessary mocks for file system operations and image file helper functions to enhance test reliability.
- Integrated `ConfigModule` into the OIDC base module to enhance configuration management capabilities.
- This addition supports better handling of environment variables and application settings.
- Added `ConfigModule` to the imports in the module dependencies integration test to enhance configuration management during testing.
- This change supports better handling of environment variables and application settings in the test environment.
@elibosley elibosley force-pushed the codex/remove-download-unraid-api-logs-helper branch from 54dc3b6 to f49fdf0 Compare November 19, 2025 11:36
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.15%. Comparing base (e2fdf6c) to head (f49fdf0).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1793      +/-   ##
==========================================
- Coverage   52.28%   52.15%   -0.14%     
==========================================
  Files         874      873       -1     
  Lines       50576    50413     -163     
  Branches     5063     5032      -31     
==========================================
- Hits        26445    26294     -151     
+ Misses      24056    24044      -12     
  Partials       75       75              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

This plugin has been deployed to Cloudflare R2 and is available for testing.
Download it at this URL:

https://preview.dl.unraid.net/unraid-api/tag/PR1793/dynamix.unraid.net.plg

@elibosley elibosley merged commit e4a9b82 into main Nov 19, 2025
12 of 13 checks passed
@elibosley elibosley deleted the codex/remove-download-unraid-api-logs-helper branch November 19, 2025 14:17
elibosley pushed a commit that referenced this pull request Nov 19, 2025
🤖 I have created a release *beep* *boop*
---


## [4.27.0](v4.26.2...v4.27.0)
(2025-11-19)


### Features

* remove Unraid API log download functionality
([#1793](#1793))
([e4a9b82](e4a9b82))


### Bug Fixes

* auto-uninstallation of connect api plugin
([#1791](#1791))
([e734043](e734043))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant