Skip to content

feat: support user_facing_error_messages for report result for task#450

Open
lukasdotcom wants to merge 2 commits into
cloud-py-api:mainfrom
lukasdotcom:user-facing-exception
Open

feat: support user_facing_error_messages for report result for task#450
lukasdotcom wants to merge 2 commits into
cloud-py-api:mainfrom
lukasdotcom:user-facing-exception

Conversation

@lukasdotcom

@lukasdotcom lukasdotcom commented Jul 16, 2026

Copy link
Copy Markdown

Changes proposed in this pull request:

  • Support user facing error messages for taskprocessing tasks.

Summary by CodeRabbit

  • New Features
    • Added support for providing an optional user-facing error message when reporting task results.
    • Available in both synchronous and asynchronous task-processing APIs.
    • User-facing error details are now included with submitted task results.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

report_result now accepts an optional user-facing error message in synchronous and asynchronous task-processing providers and includes it in the result-submission payload.

Changes

Task result reporting

Layer / File(s) Summary
Extend report result payloads
nc_py_api/ex_app/providers/task_processing.py
Synchronous and asynchronous report_result methods accept user_facing_error_message and submit it as userFacingErrorMessage.

Estimated code review effort: 2 (Simple) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the new support for user-facing error messages in task report_result payloads.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
@lukasdotcom
lukasdotcom force-pushed the user-facing-exception branch from 2291990 to fd84de5 Compare July 16, 2026 20:24

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 `@nc_py_api/ex_app/providers/task_processing.py`:
- Around line 172-179: The public synchronous and asynchronous result-reporting
methods need to document the new user_facing_error_message parameter. Update the
docstrings for both report_result methods to explain its purpose, how it relates
to error_message, and when it is shown to users; leave the existing typing and
forwarding behavior unchanged.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5cea4338-bc09-4229-b947-be0b868ff4ec

📥 Commits

Reviewing files that changed from the base of the PR and between a343e7f and e858ce6.

📒 Files selected for processing (1)
  • nc_py_api/ex_app/providers/task_processing.py

Comment on lines +172 to +179
user_facing_error_message: str | None = None,
) -> dict[str, typing.Any]:
"""Report result of the task processing to Nextcloud."""
with contextlib.suppress(NextcloudException):
if r := self._session.ocs(
"POST",
f"/ocs/v2.php/taskprocessing/tasks_provider/{task_id}/result",
json={"taskId": task_id, "output": output, "errorMessage": error_message},
json={"taskId": task_id, "output": output, "errorMessage": error_message, "userFacingErrorMessage": user_facing_error_message},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Document user_facing_error_message in both public methods.

The new public parameter is correctly typed and forwarded, but neither report_result docstring explains its purpose or relationship to error_message. Add parameter documentation to both synchronous and asynchronous methods so generated API docs accurately describe when this user-facing message is shown.

As per path instructions, public methods in nc_py_api/ex_app/** require attention to docstring quality.

Also applies to: 253-260

🤖 Prompt for 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.

In `@nc_py_api/ex_app/providers/task_processing.py` around lines 172 - 179, The
public synchronous and asynchronous result-reporting methods need to document
the new user_facing_error_message parameter. Update the docstrings for both
report_result methods to explain its purpose, how it relates to error_message,
and when it is shown to users; leave the existing typing and forwarding behavior
unchanged.

Source: Path instructions

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 `@nc_py_api/ex_app/providers/task_processing.py`:
- Around line 189-201: Extend the sync and async task-result API tests for their
respective result-reporting methods to pass user_facing_error_message and assert
the request payload contains it serialized as userFacingErrorMessage. Keep the
existing error_message assertions and cover both APIs with focused payload
checks.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: f56318ba-9eda-4586-89d0-bf60afd940ed

📥 Commits

Reviewing files that changed from the base of the PR and between e858ce6 and f34ee87.

📒 Files selected for processing (1)
  • nc_py_api/ex_app/providers/task_processing.py

Comment on lines +189 to +201
user_facing_error_message: str | None = None,
) -> dict[str, typing.Any]:
"""Report result of the task processing to Nextcloud."""
with contextlib.suppress(NextcloudException):
if r := self._session.ocs(
"POST",
f"/ocs/v2.php/taskprocessing/tasks_provider/{task_id}/result",
json={"taskId": task_id, "output": output, "errorMessage": error_message},
json={
"taskId": task_id,
"output": output,
"errorMessage": error_message,
"userFacingErrorMessage": user_facing_error_message,
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Add coverage for the new payload field in both APIs.

The supplied sync and async tests only pass error_message; they do not verify that user_facing_error_message is serialized as userFacingErrorMessage. Add focused tests for both methods.

Also applies to: 292-304

🤖 Prompt for 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.

In `@nc_py_api/ex_app/providers/task_processing.py` around lines 189 - 201, Extend
the sync and async task-result API tests for their respective result-reporting
methods to pass user_facing_error_message and assert the request payload
contains it serialized as userFacingErrorMessage. Keep the existing
error_message assertions and cover both APIs with focused payload checks.

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