Skip to content

restore daemon error surface for wings 4xx#2325

Open
rxtted wants to merge 2 commits into
pelican-dev:mainfrom
rxtted:daemon-error-surface
Open

restore daemon error surface for wings 4xx#2325
rxtted wants to merge 2 commits into
pelican-dev:mainfrom
rxtted:daemon-error-surface

Conversation

@rxtted
Copy link
Copy Markdown

@rxtted rxtted commented May 8, 2026

follow-up to #1417 which introduced a regression.

before:
the clientError short-circuit returns false on any 4xx error, so throwIf skips $response->throw(). the fire-and-forget callers (delete, sync, reinstall, cancelTransfer, create) return void on 404 against wings beta25. this was identified as it matched reports from our users of "server stuck installing", "config not applied with no error", "delete succeeded but container still running".

additionally getSystemInformation throws a misleading "is not Pelican Wings !" on 4xx, the body-shape check fires on the error body.

change:
drop the short-circuit. file repo's three post-call status checks move into RequestException catches so the typed exceptions still fire.

after:
RequestException throws on 4xx like 5xx already did. previously silent 4xx now surface as filament toasts in the UI. file-manager UX from #1417 unchanged. getSystemInformation throws RequestException with the actual status.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 8, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR refactors HTTP error handling in the Daemon repository layer. DaemonFileRepository methods transition from checking $response->status() conditionally to throwing and catching RequestException for error responses, mapping specific HTTP status codes to domain exceptions. Additionally, DaemonRepository's token validation is fixed to eliminate an early-return that bypassed User-Agent header validation.

Changes

HTTP Error Handling and Token Validation Refactor

Layer / File(s) Summary
Exception Handling Import
app/Repositories/Daemon/DaemonFileRepository.php
Illuminate\Http\Client\RequestException import added to support exception-based HTTP error handling.
File Repository HTTP Error Handling
app/Repositories/Daemon/DaemonFileRepository.php
getContent() wraps GET request in try/catch to convert HTTP 400→FileNotEditableException, HTTP 404→FileNotFoundException; putContent() and createDirectory() wrap POST requests to convert HTTP 400→FileExistsException. Other RequestExceptions are rethrown.
Token Validation Logic Fix
app/Repositories/Daemon/DaemonRepository.php
Removed early-return that treated HTTP client-error responses as token-valid without enforcing User-Agent + daemon_token_id validation.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'restore daemon error surface for wings 4xx' accurately describes the main change: restoring error handling for 4xx HTTP responses in daemon communication, which is the core purpose of this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description clearly explains the regression from #1417, the problem it caused, and the specific changes made to fix it with concrete examples.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@rxtted
Copy link
Copy Markdown
Author

rxtted commented May 8, 2026

I have read the CLA Document and I hereby sign the CLA

Copy link
Copy Markdown

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/Repositories/Daemon/DaemonFileRepository.php`:
- Around line 45-46: The current guard uses truthiness on $notLargerThan which
treats 0 as "no limit"; change the check to an explicit null comparison so a
zero-byte limit is honored (e.g. replace the condition that uses $notLargerThan
in the same block where FileSizeTooLargeException is thrown with an explicit !==
null check before comparing $length to $notLargerThan).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e8bab833-e1b3-44e3-b0c6-b13437cef223

📥 Commits

Reviewing files that changed from the base of the PR and between 38620a9 and 86d3c88.

📒 Files selected for processing (2)
  • app/Repositories/Daemon/DaemonFileRepository.php
  • app/Repositories/Daemon/DaemonRepository.php
💤 Files with no reviewable changes (1)
  • app/Repositories/Daemon/DaemonRepository.php

Comment thread app/Repositories/Daemon/DaemonFileRepository.php
@Boy132 Boy132 requested a review from rmartinoscar May 13, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant