Skip to content

fix(api-aco): log FLP task triggers that fail - #5983

Merged
adrians5j merged 2 commits into
nextfrom
claude/log-flp-trigger-failures
Oct 13, 2026
Merged

adrians5j merged 2 commits into
nextfrom
claude/log-flp-trigger-failures

Conversation

@adrians5j

@adrians5j adrians5j commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

What was wrong

When a folder is created, updated or deleted, an event handler triggers a background task that writes the folder's FLP (folder level permission) records. If that trigger failed, the handlers dropped the failure:

  • TaskService.trigger() reports most failures as a failed Result, for example a step function that could not be started. The handlers never checked the result.
  • Anything thrown went into catch { // Ignore errors }.

The folder change still succeeded, but depending on the event the folder had no FLP record, kept its old permissions across its subtree, or left an orphaned record behind. Nothing was logged.

What changed

CreateFlpOnFolderCreatedHandler, UpdateFlpOnFolderUpdatedHandler and DeleteFlpOnFolderDeletedHandler check the trigger result and log both failed results and thrown errors through the DI Logger, along with the folder id. The folder change still succeeds as before, since it's already saved when the handler runs.

The websocket notify handler for deletes is unchanged: when that send fails, an open tab shows a deleted folder until it reloads, which isn't worth an error log.

Tests

  • New folder.flp.triggerFailures.test.ts swaps in a task service whose trigger fails, once with a failed Result and once by throwing, for create, update and delete. Each test checks that the folder change succeeds and the failure is logged. All three tests fail against the old handlers.
  • api-aco 127 passed on DynamoDB and on SQL. api-file-manager-aco, api-headless-cms-aco, api-audit-logs and the website-builder folder test pass.

Workspace: wby-next1 · ✨ AI CHAT

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Errors encountered while starting folder-related processing tasks are now logged with the affected folder’s ID, making failures easier to diagnose. Folder create, update, and delete operations continue to complete successfully when these tasks fail.

The create, update and delete FLP handlers ignored a trigger that failed.
TaskService.trigger() reports most failures as a failed Result, which the
handlers never checked, and the catch around it dropped anything thrown.
Either way the folder change stood while its FLP records were missing,
out of date or left behind, with nothing in the logs.

Both cases are now logged through the DI Logger with the folder id. The
folder change still succeeds, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

🚓 Slop Cop

✅ Nothing worth flagging. The diff looks consistent with the PR's stated intent and the code-style rules.

Automated, non-blocking heads-up from an LLM. It can be wrong — use your judgment. Regenerates on every push.

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b31c7c29-cc87-44b4-886a-e6deedfaee0e
📥 Commits

Reviewing files that changed from the base of the PR and between a7020eb and 3cc4ff3.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bb0873cb-835d-4bd4-871d-d52dededc763
📥 Commits

Reviewing files that changed from the base of the PR and between 38efa2c and a7020eb.

📒 Files selected for processing (4)
  • packages/api-aco/__tests__/folder.flp.triggerFailures.test.ts
  • packages/api-aco/src/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.ts
  • packages/api-aco/src/features/flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.ts
  • packages/api-aco/src/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

📝 Walkthrough

The folder FLP create, update, and delete handlers now log task-trigger failures, including failed results and thrown errors. Tests cover the logged error, folder ID, operation-specific message, and operation results.

Changes: Folder FLP trigger failure logging

Layer / File(s) Summary
Log and test task-trigger failures
packages/api-aco/src/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.ts, packages/api-aco/src/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.ts, packages/api-aco/src/features/flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.ts, packages/api-aco/__tests__/folder.flp.triggerFailures.test.ts
The handlers receive a logger and log failed trigger results and thrown errors with the error and folder ID. Tests check these log details and confirm the operation results.

Priority: ➖ Normal

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to a7020

This change logs failed folder permission record tasks that were previously ignored, while folder changes still succeed. No merge-blocking risk was found.

Pre-merge checks · Passed 5
Passed Passed checks (5 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: logging failed FLP task triggers.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4…
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.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@adrians5j
adrians5j merged commit 09b67f6 into next Oct 13, 2026
19 checks passed
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