feat(environments): sort ephemeral environments by latest operation - #2905
Conversation
|
View your CI Pipeline Execution ↗ for commit 599f3d4
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
2 issues found across 2 files
Confidence score: 4/5
libs/domains/environments/feature/src/lib/environments-table/environments-table.spec.tsxdoes not verify reversing the name sort or clicking the “Last operation” header, leaving sorting regressions possible—extend the tests to cover these interactions.libs/domains/environments/feature/src/lib/environments-table/environment-section/environment-section.tsxchanges sort direction without exposing the active direction to assistive technology, which can make the table’s state unclear—addaria-sortor an equivalent accessible button state.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="libs/domains/environments/feature/src/lib/environments-table/environments-table.spec.tsx">
<violation number="1" location="libs/domains/environments/feature/src/lib/environments-table/environments-table.spec.tsx:103">
P3: The new test covers only the default last-operation (desc) order and one toggle to name (asc). It leaves the reverse-direction toggle (clicking the same header again for desc), the 'Last operation' header click, and the scoping claim (non-PREVIEW sections keep name order) untested. Add assertions for those branches since the sort logic in EnvironmentSection has real logic there that a regression could silently break.</violation>
</file>
<file name="libs/domains/environments/feature/src/lib/environments-table/environment-section/environment-section.tsx">
<violation number="1" location="libs/domains/environments/feature/src/lib/environments-table/environment-section/environment-section.tsx:210">
P3: The sortable header button changes which direction the column is sorted but provides no accessible state. Add aria-sort to the column header (or aria-pressed/aria-label on the button) so assistive tech reports the active sort column and direction.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
| ]) | ||
| }) | ||
|
|
||
| it('should sort ephemeral environments by last operation (newer first) by default and allow sorting by name', async () => { |
There was a problem hiding this comment.
P3: The new test covers only the default last-operation (desc) order and one toggle to name (asc). It leaves the reverse-direction toggle (clicking the same header again for desc), the 'Last operation' header click, and the scoping claim (non-PREVIEW sections keep name order) untested. Add assertions for those branches since the sort logic in EnvironmentSection has real logic there that a regression could silently break.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At libs/domains/environments/feature/src/lib/environments-table/environments-table.spec.tsx, line 103:
<comment>The new test covers only the default last-operation (desc) order and one toggle to name (asc). It leaves the reverse-direction toggle (clicking the same header again for desc), the 'Last operation' header click, and the scoping claim (non-PREVIEW sections keep name order) untested. Add assertions for those branches since the sort logic in EnvironmentSection has real logic there that a regression could silently break.</comment>
<file context>
@@ -94,6 +100,34 @@ describe('EnvironmentsTable', () => {
])
})
+ it('should sort ephemeral environments by last operation (newer first) by default and allow sorting by name', async () => {
+ mockUseProject.mockReturnValue({ data: { name: 'Project Alpha' } })
+ mockUseEnvironmentsOverview.mockReturnValue({
</file context>
| onClick: () => void | ||
| }) { | ||
| return ( | ||
| <button type="button" className="group flex items-center gap-1 truncate" onClick={onClick}> |
There was a problem hiding this comment.
P3: The sortable header button changes which direction the column is sorted but provides no accessible state. Add aria-sort to the column header (or aria-pressed/aria-label on the button) so assistive tech reports the active sort column and direction.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At libs/domains/environments/feature/src/lib/environments-table/environment-section/environment-section.tsx, line 210:
<comment>The sortable header button changes which direction the column is sorted but provides no accessible state. Add aria-sort to the column header (or aria-pressed/aria-label on the button) so assistive tech reports the active sort column and direction.</comment>
<file context>
@@ -187,6 +187,40 @@ function EnvRow({
+ onClick: () => void
+}) {
+ return (
+ <button type="button" className="group flex items-center gap-1 truncate" onClick={onClick}>
+ {label}
+ {active ? (
</file context>
Ephemeral (preview) environments can now be sorted by name or by last operation via clickable column headers. Default sort is by last operation, newest first.
058a71f to
599f3d4
Compare
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Confidence score: 3/5
- In
libs/domains/environments/feature/src/lib/environments-table/environment-section/environment-section.tsx, the table only applies a fixed default order instead of the described interactive sorting; without clickable headers or direction toggling, users cannot change how environments are ordered. Add and test header-driven sorting before relying on this behavior.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="libs/domains/environments/feature/src/lib/environments-table/environment-section/environment-section.tsx">
<violation number="1" location="libs/domains/environments/feature/src/lib/environments-table/environment-section/environment-section.tsx:223">
P2: The delivered code only applies a fixed default ordering (last operation, newest first) and never implements the interactive sorting described in the PR: headers are not clickable, there is no direction toggle, and no sort-direction indicator. The Environment name can't be sorted at all, and the claimed 'name toggle' test is absent. Either implement the header toggle (useState for sort key/direction, clickable headers, indicator), or update the PR scope/title to reflect that only the default newest-first ordering is shipped.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
| } | ||
|
|
||
| return [...items].sort( | ||
| (environmentA, environmentB) => lastOperationTimestamp(environmentB) - lastOperationTimestamp(environmentA) |
There was a problem hiding this comment.
P2: The delivered code only applies a fixed default ordering (last operation, newest first) and never implements the interactive sorting described in the PR: headers are not clickable, there is no direction toggle, and no sort-direction indicator. The Environment name can't be sorted at all, and the claimed 'name toggle' test is absent. Either implement the header toggle (useState for sort key/direction, clickable headers, indicator), or update the PR scope/title to reflect that only the default newest-first ordering is shipped.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At libs/domains/environments/feature/src/lib/environments-table/environment-section/environment-section.tsx, line 223:
<comment>The delivered code only applies a fixed default ordering (last operation, newest first) and never implements the interactive sorting described in the PR: headers are not clickable, there is no direction toggle, and no sort-direction indicator. The Environment name can't be sorted at all, and the claimed 'name toggle' test is absent. Either implement the header toggle (useState for sort key/direction, clickable headers, indicator), or update the PR scope/title to reflect that only the default newest-first ordering is shipped.</comment>
<file context>
@@ -209,6 +214,16 @@ export function EnvironmentSection({
+ }
+
+ return [...items].sort(
+ (environmentA, environmentB) => lastOperationTimestamp(environmentB) - lastOperationTimestamp(environmentA)
+ )
+ }, [items, type])
</file context>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## staging #2905 +/- ##
===========================================
- Coverage 48.46% 42.15% -6.32%
===========================================
Files 1272 248 -1024
Lines 27590 7292 -20298
Branches 8114 2260 -5854
===========================================
- Hits 13372 3074 -10298
+ Misses 11952 3659 -8293
+ Partials 2266 559 -1707
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
🎉 This PR is included in version 1.344.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
Issue:
Sorts the Ephemeral environments section by last operation, newest first, so the most recently updated preview environments appear at the top by default.
EnvironmentSection; no data-layer changes are required.Screenshots / Recordings
No visual control was added; only the default row order changes.
Testing
yarn lintPR Checklist
.cursor/rules)feat(service): add new Terraform service) - required for semantic-releaseSummary by cubic
Sorts ephemeral (preview) environments in the Environments table by last operation, newest first, so the most recently updated previews appear at the top.
Written for commit 599f3d4. Summary will update on new commits.