appsmithorg / appsmithorg/appsmith

actioncollections: archiveGivenActionCollection swallows child action errors - orphaned NewAction documents accumulate in MongoDB

Đang mở
#42,116 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
40.9k
Fork
4.8k
Merge trung bình
1 ngày 22 giờ
Pull request đã merge (30 ngày)
45

Mô tả

## Bug Description

rchiveGivenActionCollection iterates child JS actions and calls rchiveGivenNewAction on each. Errors from that call are caught and swallowed via onErrorResume(throwable -> Mono.empty()). The parent ActionCollection is then archived unconditionally, regardless of how many child actions actually failed. Failed child actions remain as orphaned NewAction documents in MongoDB.

## Affected file

pp/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/base/ActionCollectionServiceCEImpl.java, lines 443-465:

`java
return unpublishedJsActionsFlux
.mergeWith(publishedJsActionsFlux)
.flatMap(toArchive -> newActionService
.archiveGivenNewAction(toArchive)
.onErrorResume(throwable -> {
log.debug("Failed to delete action ...");
log.error(throwable.getMessage());
return Mono.empty(); // action NOT archived, error silently dropped
}))
.collectList()
...
.then(repository.archive(actionCollection).thenReturn(actionCollection)); // archived regardless
`

The same pattern exists in deleteUnpublishedActionCollection at lines 310-323.

## Failure scenario

1. User deletes a JS query collection containing 5 actions.
2. rchiveGivenNewAction fails for action 3 (transient MongoDB error).
3. The error is logged but swallowed - action 3 remains in the
ewAction collection.
4. The parent ActionCollection is archived.
5. Action 3 is now orphaned: invisible in the UI, unreachable through normal delete flows, but still returned by indByCollectionId queries and counted in analytics/audit logs.
6. Over time these orphaned documents accumulate, inflating collection sizes and causing phantom results in action queries.

## Fix

Propagate the error instead of swallowing it, or collect failures and surface them after the bulk operation:

`java
.flatMap(toArchive -> newActionService
.archiveGivenNewAction(toArchive)
.onErrorMap(throwable -> new AppsmithException(
AppsmithError.REPOSITORY_SAVE_FAILED, toArchive.getId(), throwable.getMessage()
)))
`

If partial failure is acceptable, collect failed IDs and return them in the response so callers can retry or surface the information to users.

## Environment

Appsmith elease branch (2026-08-13), Java/Spring WebFlux, MongoDB.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start in app/server/appsmith-server/src/main/java/com/appsmith/server/actioncollections/base/ActionCollectionServiceCEImpl.java at archiveGivenActionCollection lines 443-465 and compare the same error-swallowing pattern in deleteUnpublishedActionCollection lines 310-323. Done means failures from archiveGivenNewAction are no longer silently dropped, and the parent collection is not archived as if all children succeeded unless failures are deliberately surfaced.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java, mongodb, spring
Lĩnh vực
backend, database
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
72/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.