Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 93 additions & 2 deletions .github/playwright/impact-map.generated.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/playwright/timing-baseline.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Task lists page newest first by creation time

- **Status:** Accepted
- **Revisions:** v1 2026-10-28 (initial)
- **Revisions:** v1 2026-10-28 (initial) · v2 2026-11-19 (opt-in update-time paging)
- **Deciders:** Ram Narayan Balaji
- **Guard:** `TaskListOrderTest`; `TaskResourceIT#testListPagesNewestFirstBothWays`,
`#testListSearchPagesNewestFirstBothWays`, `#testScopedListsReturnNewestFirst`,
`#testListRejectsNameCursorAndUnknownSortOrder`
`#testListRejectsNameCursorAndUnknownSortOrder`, `#testListPagesRecentTaskUpdates`
- **Related:** `TaskListOrder`, `FeedDAOs.TaskDAO`

## Context
Expand All @@ -32,3 +32,15 @@ that held one across the upgrade must list again from the first page. A new call
`TaskRepository.listAfter` gets name order unless it applies `TaskListOrder`. Changing the
repository-wide default instead would break reindex cursor seeding. Revisit this if tasks gain a
numeric sequence column that can be sorted directly.

## Amendment

v2 2026-11-19: `GET /v1/tasks` accepts `sortBy=updatedAt` to page by `(updatedAt, id)` and
`updatedSince` as an inclusive lower bound in epoch milliseconds. Clients reuse the same sort
field across a cursor walk: cursors contain a timestamp without the field name, so switching
fields interprets the old timestamp in the new order and can skip or repeat tasks. Start a new walk
when changing the field. Rows updated during a walk can move above its cursor and be skipped;
this is a live feed, not a snapshot. Inbox refreshes start from the first page with the same
`updatedSince` window, so the next refresh can recover those rows. Inbox task mentions use the updated-time bound because a new comment
can arrive on a task created outside the Inbox window. The client still filters individual
comments by their own timestamps, since task edits can also advance `updatedAt`.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# A capped Inbox feed is cut at its oldest item, and its shortest window is Today

- **Status:** Accepted
- **Revisions:** v1 2026-11-16 (initial) · v2 2026-11-16 (the Mentions feed is not cut)
- **Revisions:** v1 2026-11-16 (initial) · v2 2026-11-16 (the Mentions feed is not cut) · v3 2026-11-19 (older task mentions in All) · v4 2026-11-20 (bounded task mentions and seen marks)
- **Deciders:** Harsh Vador
- **Guard:** `useInboxActivity.test.tsx` ("cuts the conversations at the oldest event of a capped
activity list", "cuts the events at the oldest conversation of a capped conversation list",
Expand Down Expand Up @@ -44,3 +44,14 @@ events older than its oldest conversation. The day marked "N+" is the one where
not the day of its last card: for Mentions, where its conversations stop. When only its events are
capped no day is marked, since their times don't say where the mentions stop; the end-of-feed note
still shows. Every other feed is cut as above.

v3 2026-11-19: All retains task-comment mentions before the cutoff for activity and conversations.
Each visible day at or before that cutoff displays its count as a lower bound, including days
that contain only task mentions.

v4 2026-11-20: Inbox task mentions keep at most 100 comments, matching the conversation cap.
A full task-mention result marks the feed as capped; its oldest comment also bounds the complete
span of All's activity and conversations. Mentions retains older event cards because their event
time is not their mention time. The sidebar counts at most 100 task mentions and displays 99+.
The cached mention result carries the time its first request started. Opening it advances the
seen mark only through that time, never through the later time the view was opened.
14 changes: 12 additions & 2 deletions docs/decisions/2026-11-17-resolved-incidents-are-final.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# A resolved incident is final and a subsequent test failure opens a new incident

- **Status:** Accepted
- **Revisions:** v1 2026-11-17 (initial) · v2 2026-11-17 (link the clarified return-to-triage assignment rule)
- **Revisions:** v1 2026-11-17 (initial) · v2 2026-11-17 (link the clarified return-to-triage assignment rule) · v3 2026-11-25 (a Resolved record keeps the assignee at resolution)
- **Deciders:** Teddy Crepineau
- **Guard:** `IncidentTaskIntegrationIT`, `AutoAssignIncidentIT`, `TestCaseResourceIT`
- **Related:** [Issue #36717](https://github.com/open-metadata/OpenMetadata/issues/36717), [PR #37613](https://github.com/open-metadata/OpenMetadata/pull/37613)
- **Related:** [Issue #36717](https://github.com/open-metadata/OpenMetadata/issues/36717), [PR #37613](https://github.com/open-metadata/OpenMetadata/pull/37613), [PR #38233](https://github.com/open-metadata/OpenMetadata/pull/38233)

## Context

Expand Down Expand Up @@ -36,3 +36,13 @@ instead report a subsequent failure when there is one.
The assignment recomputation described above is superseded by
ADR:2026-11-17-returning-incidents-to-triage-clears-assignees. Assigned incidents can also return
to Ack. Both return paths clear the current assignee while retaining all earlier Assigned records.

## Amendment — 2026-11-25

A Resolved record carries the incident's assignee at resolution in
`testCaseResolutionStatusDetails.assignee` (`resolved.json`), the task's first assignee when it
resolves. It is a frozen snapshot: later task edits append no record for it, and deleting a user
cleans up only the latest Assigned record of the current incident, never a Resolved one. Readers of
`testCaseResolutionStatusDetails.assignee`, including the incident index and
ADR:2026-10-29-incident-assignee-filter-lists-aggregated-assignees, therefore see that assignee on
Resolved records too.
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,12 @@ void autoCloseEnabled_testPasses_incidentResolved(TestNamespace ns) {
"Resolution reason should be AutoResolved");

// Verify the Task was resolved by autoResolveIncident
Task resolvedTask = client.tasks().get(task.getId().toString(), "resolution");
Task resolvedTask = client.tasks().get(task.getId().toString(), "resolution,comments");
assertEquals(TaskEntityStatus.Completed, resolvedTask.getStatus());
assertNotNull(resolvedTask.getResolution());
assertTrue(
resolvedTask.getComments() == null || resolvedTask.getComments().isEmpty(),
"An automatic resolution must not post a system marker as a comment");

// Workflow should reach FINISHED (outbox delivers Completed to ManualTask)
String workflowInstanceId = task.getWorkflowInstanceId().toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.openmetadata.service.tasks.IncidentWorkflowStages.RESOLVED_STAGE_ID;
Expand Down Expand Up @@ -46,14 +47,17 @@
import org.openmetadata.it.util.TestNamespaceExtension;
import org.openmetadata.schema.api.tasks.Payload;
import org.openmetadata.schema.api.tasks.ResolveTask;
import org.openmetadata.schema.api.teams.CreateUser;
import org.openmetadata.schema.api.tests.CreateTestCaseResolutionStatus;
import org.openmetadata.schema.api.tests.CreateTestCaseResult;
import org.openmetadata.schema.entity.data.DatabaseSchema;
import org.openmetadata.schema.entity.data.Table;
import org.openmetadata.schema.entity.services.DatabaseService;
import org.openmetadata.schema.entity.tasks.Task;
import org.openmetadata.schema.entity.teams.User;
import org.openmetadata.schema.tests.TestCase;
import org.openmetadata.schema.tests.type.Assigned;
import org.openmetadata.schema.tests.type.Resolved;
import org.openmetadata.schema.tests.type.Severity;
import org.openmetadata.schema.tests.type.TestCaseFailureReasonType;
import org.openmetadata.schema.tests.type.TestCaseResolutionStatus;
Expand All @@ -62,8 +66,10 @@
import org.openmetadata.schema.tests.type.TestCaseStatus;
import org.openmetadata.schema.type.EntityReference;
import org.openmetadata.schema.type.TaskCategory;
import org.openmetadata.schema.type.TaskComment;
import org.openmetadata.schema.type.TaskEntityStatus;
import org.openmetadata.schema.type.TaskEntityType;
import org.openmetadata.schema.type.TaskResolution;
import org.openmetadata.schema.type.TaskResolutionType;
import org.openmetadata.schema.type.TestCaseResolutionPayload;
import org.openmetadata.schema.type.api.BulkOperationResult;
Expand Down Expand Up @@ -142,6 +148,81 @@ void testPatch_PreservesComments(TestNamespace ns) {
assertEquals("keep me across a patch", afterPatch.getComments().get(0).getMessage());
}

@Test
void testAppendingCommentKeepsEditsMadeAfterTaskWasLoaded(TestNamespace ns) {
OpenMetadataClient client = SdkClients.adminClient();
TestCase testCase = createTestCase(client, ns, "incident-comment-stale-task");
createFailedTestResult(client, testCase);
Task staleTask = awaitIncidentTaskForTestCase(client, testCase);
String taskId = staleTask.getId().toString();
TaskRepository repository = (TaskRepository) Entity.getEntityRepository(Entity.TASK);

client.tasks().addComment(taskId, "Concurrent note");
client
.tasks()
.patch(
taskId,
JsonUtils.readTree(
"[{\"op\":\"replace\",\"path\":\"/description\",\"value\":\"Updated description\"}]"));
repository.addComment(
staleTask,
new TaskComment()
.withId(UUID.randomUUID())
.withAuthor(staleTask.getCreatedBy())
.withCreatedAt(System.currentTimeMillis())
.withMessage("Resolution note"));

Task stored = client.tasks().get(taskId, "comments");
assertEquals("Updated description", stored.getDescription());
assertEquals(2, stored.getCommentCount());
assertEquals(
List.of("Concurrent note", "Resolution note"),
stored.getComments().stream().map(TaskComment::getMessage).toList());
}

@ParameterizedTest
@CsvSource({"edit", "delete"})
void testCommentMutationKeepsResolutionSavedAfterTaskWasLoaded(
String operation, TestNamespace ns) {
OpenMetadataClient client = SdkClients.adminClient();
TestCase testCase = createTestCase(client, ns, "incident-resolve-comment-" + operation);
createFailedTestResult(client, testCase);
Task incident = awaitIncidentTaskForTestCase(client, testCase);
String taskId = incident.getId().toString();
client.tasks().addComment(taskId, "Investigation note");
Task staleTask = client.tasks().get(taskId, "comments");
TaskComment note = staleTask.getComments().getFirst();

client
.tasks()
.resolve(
taskId,
new ResolveTask()
.withTransitionId("resolve")
.withResolutionType(TaskResolutionType.Completed)
.withComment("Resolution note")
.withPayload(
resolutionPayload(
"Other", "Resolution note", TestCaseFailureReasonType.Other)));

TaskRepository repository = (TaskRepository) Entity.getEntityRepository(Entity.TASK);
if (operation.equals("edit")) {
repository.editComment(staleTask, note.getId(), "Edited note", note.getAuthor().getName());
} else {
repository.deleteComment(staleTask, note.getId(), note.getAuthor().getName(), false);
}

Task stored = client.tasks().get(taskId, "comments,resolution");
assertEquals(TaskEntityStatus.Completed, stored.getStatus());
assertEquals("Resolution note", stored.getResolution().getComment());
List<String> expected =
operation.equals("edit")
? List.of("Edited note", "Resolution note")
: List.of("Resolution note");
assertEquals(expected.size(), stored.getCommentCount());
assertEquals(expected, stored.getComments().stream().map(TaskComment::getMessage).toList());
}

@Test
void testFullIncidentWorkflow_TaskTransitionsMirrorTcrs(TestNamespace ns) {
OpenMetadataClient client = SdkClients.adminClient();
Expand Down Expand Up @@ -188,7 +269,29 @@ void testFullIncidentWorkflow_TaskTransitionsMirrorTcrs(TestNamespace ns) {
Task completedTask =
awaitIncidentTask(client, stateId, TaskEntityStatus.Completed, "resolved", null);
assertNotNull(completedTask.getResolution());
assertLatestTcrsEventually(client, stateId, TestCaseResolutionStatusTypes.Resolved, null);
assertEquals(
assignedTask.getAssignees().stream().map(EntityReference::getId).toList(),
completedTask.getAssignees().stream().map(EntityReference::getId).toList());
assertEquals(List.of(shared.USER1.getName()), assignedAssigneeNames(client, stateId));
await()
.atMost(TASK_TIMEOUT)
.untilAsserted(
() -> {
TestCaseResolutionStatus latest = tcrsTimeline(client, stateId).getLast();
assertEquals(
TestCaseResolutionStatusTypes.Resolved, latest.getTestCaseResolutionStatusType());
Resolved details =
JsonUtils.convertValue(
latest.getTestCaseResolutionStatusDetails(), Resolved.class);
assertEquals(shared.USER1.getId(), details.getAssignee().getId());
assertEquals(
completedTask.getResolution().getResolvedBy().getId(),
details.getResolvedBy().getId());
});
Task withComments = client.tasks().get(stateId.toString(), "comments");
assertEquals(1, withComments.getComments().size());
assertEquals(
"Resolved via integration test", withComments.getComments().getFirst().getMessage());
}

@Test
Expand Down Expand Up @@ -323,6 +426,98 @@ void testUpdatesThatDoNotChangeTheMirror_AppendNothing(TestNamespace ns) {
recordsAfterResolve,
tcrsTimeline(client, stateId).size(),
"commenting on a resolved incident must not duplicate the Resolved record");

JsonNode reassignment =
JsonUtils.valueToTree(
List.of(
Map.of("op", "replace", "path", "/assignees", "value", List.of(shared.USER2_REF))));
client.tasks().patch(stateId.toString(), reassignment);
Task reassigned = client.tasks().get(stateId.toString(), "assignees");
assertEquals(shared.USER2.getId(), reassigned.getAssignees().getFirst().getId());

List<TestCaseResolutionStatus> history = tcrsTimeline(client, stateId);
assertEquals(recordsAfterResolve, history.size(), "the resolution is a historical snapshot");
Resolved details =
JsonUtils.convertValue(
history.getLast().getTestCaseResolutionStatusDetails(), Resolved.class);
assertEquals(shared.USER1.getId(), details.getAssignee().getId());
}

@Test
void testResolutionCommentFailure_RollsBackResolution(TestNamespace ns) {
OpenMetadataClient client = SdkClients.adminClient();
TestCase testCase = createTestCase(client, ns, "resolution-comment-rollback");
createFailedTestResult(client, testCase);
Task task = awaitIncidentTaskForTestCase(client, testCase);
TaskRepository repository = (TaskRepository) Entity.getEntityRepository(Entity.TASK);
// The lifecycle JSON accepts the note; the comment's mention write rejects its invalid FQN.
String invalidMention = "<#E::table::broken..name>";
TaskResolution resolution =
new TaskResolution()
.withType(TaskResolutionType.Completed)
.withComment(invalidMention)
.withResolvedBy(task.getCreatedBy())
.withResolvedAt(System.currentTimeMillis());

assertThrows(
IllegalArgumentException.class, () -> repository.resolveTask(task, resolution, "admin"));

Task unchanged = client.tasks().get(task.getId().toString(), "resolution,comments");
assertEquals(TaskEntityStatus.Open, unchanged.getStatus());
assertNull(unchanged.getResolution());
assertEquals(task.getVersion(), unchanged.getVersion());
resolution.setComment("Resolution note");
Task retried = repository.resolveTask(unchanged, resolution, "admin");
assertEquals(TaskEntityStatus.Completed, retried.getStatus());
assertEquals("Resolution note", retried.getComments().getLast().getMessage());
}

@Test
void testDeletingResolvedAssignee_DoesNotChangeNewIncident(TestNamespace ns) {
OpenMetadataClient client = SdkClients.adminClient();
String name = ns.shortPrefix("former-assignee");
User assignee =
client.users().create(new CreateUser().withName(name).withEmail(name + "@example.com"));
TestCase testCase = createTestCase(client, ns, "deleted-resolved-assignee");
createFailedTestResult(client, testCase);
Task first = awaitIncidentTaskForTestCase(client, testCase);
client
.tasks()
.resolve(
first.getId().toString(),
new ResolveTask()
.withTransitionId("assign")
.withPayload(assigneePayload(assignee.getEntityReference())));
awaitIncidentTask(client, first.getId(), TaskEntityStatus.InProgress, "assigned", name);
client
.tasks()
.resolve(
first.getId().toString(),
new ResolveTask()
.withTransitionId("resolve")
.withResolutionType(TaskResolutionType.Completed)
.withComment("Fixed")
.withPayload(
resolutionPayload("Fixed", "Fixed", TestCaseFailureReasonType.FalsePositive)));
awaitIncidentTask(client, first.getId(), TaskEntityStatus.Completed, "resolved", null);
assertLatestTcrsEventually(client, first.getId(), TestCaseResolutionStatusTypes.Resolved, null);
createFailedTestResult(client, testCase);
Task second = awaitIncidentTaskForTestCase(client, testCase);
assertNotEquals(first.getId(), second.getId());
List<TestCaseResolutionStatus> before = tcrsTimeline(client, second.getId());

client.users().delete(assignee.getId().toString());

Task stillOpen = client.tasks().get(second.getId().toString());
assertEquals(TaskEntityStatus.Open, stillOpen.getStatus());
assertEquals("new", stillOpen.getWorkflowStageId());
assertEquals(
second.getId(),
client.testCases().get(testCase.getId().toString(), "incidentId").getIncidentId());
assertEquals(before, tcrsTimeline(client, second.getId()));
assertEquals(
TestCaseResolutionStatusTypes.Resolved,
tcrsTimeline(client, first.getId()).getLast().getTestCaseResolutionStatusType());
}

@Test
Expand Down Expand Up @@ -351,7 +546,15 @@ void testDirectResolution_NewToResolved_CompletesExistingTask(TestNamespace ns)
Task completedTask =
awaitIncidentTask(client, task.getId(), TaskEntityStatus.Completed, "resolved", null);
assertEquals(task.getId(), completedTask.getId());
assertTrue(completedTask.getAssignees() == null || completedTask.getAssignees().isEmpty());
assertLatestTcrsEventually(client, task.getId(), TestCaseResolutionStatusTypes.Resolved, null);
Resolved details =
JsonUtils.convertValue(
tcrsTimeline(client, task.getId()).getLast().getTestCaseResolutionStatusDetails(),
Resolved.class);
assertNull(details.getAssignee());
assertNotNull(details.getResolvedBy());
assertTrue(assignedAssigneeNames(client, task.getId()).isEmpty());
}

@Test
Expand Down
Loading
Loading