You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "Phoenix500526 (via GitHub)" <gi...@apache.org> on 2026/09/02 06:02:24 UTC
[PR] perf(desktop): paginate usage activity [maka]
Phoenix500526 opened a new pull request, #4539:
URL: https://github.com/apache/maka/pull/4539
## Summary
Paginate **Settings → Usage → Activity log** at 50 records per page so
revisiting the tab does not rebuild the entire usage history. Searching,
changing status, or clearing filters returns the table to the first page.
Fixes #4531
## Verification
- `npm --workspace @maka/desktop run typecheck`
- `npm exec -- biome lint` on the three changed TypeScript files
- `npm run format:check` (1,857 files)
- `npm run check:renderer-architecture -- --base upstream/main` (61 tests)
- `npm --workspace @maka/desktop run build-storybook`
- `npm --workspace @maka/desktop run smoke:storybook` (502 renders)
- Deterministic 409-record render benchmark, five alternating runs on the
same build: all rows 1,438.4 ms; 50 per page 69.3 ms; 20.8× faster
The benchmark measures Activity log rendering only; it does not include
loading the usage history from the backend.
## AI use
Select exactly one:
- [ ] No generative tool made a substantive contribution
- [x] Generative tooling made a substantive contribution
Tool(s) and scope: OpenAI Codex assisted with implementation, tests,
benchmarking, review, and verification.
## Checklist
- [x] Tests cover the change and fail without it
- [x] Lint, format, typecheck and the affected suites pass locally
Does this PR entail a change in behavior?
- [x] Yes — described under Summary above
- [ ] No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] perf(desktop): paginate usage activity [maka]
Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 commented on PR #4539:
URL: https://github.com/apache/maka/pull/4539#issuecomment-5505999454
Thanks for working on this. The core pagination behavior appears to address #4531, and CI is green. I found the following issues before merge:
## Standards
1. **[P2] The new UI implementation bypasses the Astryx surface inventory.**
`apps/desktop/src/renderer/features/usage-activity/index.tsx` contains a stateful UI component, but the inventory generator excludes every `index.tsx` as a “barrel re-export.” Consequently, `docs/astryx-surface-file-inventory.md` excludes this real surface from its coverage gate. Please move the implementation to a file such as `ui/usage-activity-pagination.tsx` and keep `index.ts` as a true public barrel, or update the generator so non-barrel index files are inspected.
2. **[P2] Preserve full-dataset row semantics for assistive technology.**
The activity table now receives only the current page, but it does not pass Astryx Table's `rowIndexStart` and `rowCount` metadata. On page 2, assistive technology therefore sees a new one-row table rather than row 51 of 51. Please pass the page offset and total filtered count through to `UsageStatsTable`, and add a focused ARIA assertion.
3. **[P3] The reset behavior promised by the PR is not covered by tests.**
The updated story verifies navigation to page 2, but it does not verify that searching, changing status, or clearing filters returns the table to page 1. Please exercise these paths starting from page 2 and assert that first-page rows are shown.
4. **[P3] The PR is missing UI evidence.**
`CONTRIBUTING.md` asks UI changes to include before/after screenshots or a recording. Please add one showing the paginated activity log, including the narrow layout if possible.
5. **[P3] Prefer the public UI entry for shared primitives.**
`HStack` is imported directly from `@astryxdesign/core` even though it is re-exported by `@maka/ui`. The renderer guidance says new code should reach for Astryx-backed `@maka/ui` primitives first. `Pagination` and `paginateData` can remain direct imports if they are not exposed there.
## Spec / verification
6. **[P3] The benchmark does not follow the method requested in #4531.**
The issue asks for at least 10 switches on both revisions and comparison of median and p95. The supplied script records five timed samples per variant and reports only the average. The summary values (`1438.4 ms` / `69.3 ms`) also differ from the pasted output (`1480.8 ms` / `72.1 ms`). Please rerun and report the requested statistics, or reconcile the documented methodology and results.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] perf(desktop): paginate usage activity [maka]
Posted by "Phoenix500526 (via GitHub)" <gi...@apache.org>.
Phoenix500526 commented on PR #4539:
URL: https://github.com/apache/maka/pull/4539#issuecomment-5508303157
> Thanks for working on this. The core pagination behavior appears to address #4531, and CI is green. I found the following issues before merge:
>
> ## Standards
> 1. **[P2] The new UI implementation bypasses the Astryx surface inventory.**
> `apps/desktop/src/renderer/features/usage-activity/index.tsx` contains a stateful UI component, but the inventory generator excludes every `index.tsx` as a “barrel re-export.” Consequently, `docs/astryx-surface-file-inventory.md` excludes this real surface from its coverage gate. Please move the implementation to a file such as `ui/usage-activity-pagination.tsx` and keep `index.ts` as a true public barrel, or update the generator so non-barrel index files are inspected.
> 2. **[P2] Preserve full-dataset row semantics for assistive technology.**
> The activity table now receives only the current page, but it does not pass Astryx Table's `rowIndexStart` and `rowCount` metadata. On page 2, assistive technology therefore sees a new one-row table rather than row 51 of 51. Please pass the page offset and total filtered count through to `UsageStatsTable`, and add a focused ARIA assertion.
> 3. **[P3] The reset behavior promised by the PR is not covered by tests.**
> The updated story verifies navigation to page 2, but it does not verify that searching, changing status, or clearing filters returns the table to page 1. Please exercise these paths starting from page 2 and assert that first-page rows are shown.
> 4. **[P3] The PR is missing UI evidence.**
> `CONTRIBUTING.md` asks UI changes to include before/after screenshots or a recording. Please add one showing the paginated activity log, including the narrow layout if possible.
> 5. **[P3] Prefer the public UI entry for shared primitives.**
> `HStack` is imported directly from `@astryxdesign/core` even though it is re-exported by `@maka/ui`. The renderer guidance says new code should reach for Astryx-backed `@maka/ui` primitives first. `Pagination` and `paginateData` can remain direct imports if they are not exposed there.
>
> ## Spec / verification
> 6. **[P3] The benchmark does not follow the method requested in [perf(desktop): Usage activity log is slow with large histories #4531](https://github.com/apache/maka/issues/4531).**
> The issue asks for at least 10 switches on both revisions and comparison of median and p95. The supplied script records five timed samples per variant and reports only the average. The summary values (`1438.4 ms` / `69.3 ms`) also differ from the pasted output (`1480.8 ms` / `72.1 ms`). Please rerun and report the requested statistics, or reconcile the documented methodology and results.
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] perf(desktop): paginate usage activity [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on PR #4539:
URL: https://github.com/apache/maka/pull/4539#issuecomment-5551124793
Correction to my [review above](https://github.com/apache/maka/pull/4539#pullrequestreview-5120763045): the first non-blocking item ("attribution durability") got the facts wrong.
Commit `8c82780c` **does** carry the `Generated-by: OpenAI Codex` trailer. The commit message ends with:
```
CLOSES #4531
Generated-by: OpenAI Codex
Signed-off-by: Jiawei Zhao <Ph...@163.com>
```
(verified via the commits API and `git log --format=%B`), and with this repository's `squash_merge_commit_message=COMMIT_MESSAGES` setting, that trailer survives a squash merge. Combined with the "AI use" declaration in the PR body, attribution is already durable — no action is needed from the author. Please disregard that item.
The other two non-blocking items (CI observation on the unrelated `quote-selection` e2e failure, and the panel-remount UX observation) are unaffected by this correction.
---
> **Automated review notice:** This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] perf(desktop): paginate usage activity [maka]
Posted by "liuxiaocs7 (via GitHub)" <gi...@apache.org>.
liuxiaocs7 commented on PR #4539:
URL: https://github.com/apache/maka/pull/4539#issuecomment-5512104161
Thank you for the analysis. However, I don’t have permission to rerun the CI checks. Could you please push an empty commit to trigger CI again?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] perf(desktop): paginate usage activity [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on PR #4539:
URL: https://github.com/apache/maka/pull/4539#issuecomment-5550030105
Thanks for moving this into the existing Usage view and Astryx pagination hook. One small cleanup remains: keep one page-reset mechanism instead of the handlers, logs effect, and remount key/revision all doing it. The logs effect looks sufficient; a stable empty-array fallback would also keep its dependency meaningful.
Please preserve page-two row numbering and resets after filter/range/refresh changes. The latest failing check I inspected was `quote-selection.spec.ts:22`, so please check that log before adding any pagination workaround.
AI-assisted review with Codex.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] perf(desktop): paginate usage activity [maka]
Posted by "Phoenix500526 (via GitHub)" <gi...@apache.org>.
Phoenix500526 commented on PR #4539:
URL: https://github.com/apache/maka/pull/4539#issuecomment-5508819756
@liuxiaocs7 The latest CI run failed on the unrelated `partial-history-notice` E2E after 100 other E2E tests passed; this PR does not touch that surface, so it appears to be a timing flake. I do not have permission to rerun Actions—could you please rerun the failed job when convenient? Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] perf(desktop): paginate usage activity [maka]
Posted by "Phoenix500526 (via GitHub)" <gi...@apache.org>.
Phoenix500526 commented on PR #4539:
URL: https://github.com/apache/maka/pull/4539#issuecomment-5505570057
CC @liuxiaocs7
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] perf(desktop): paginate usage activity [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on code in PR #4539:
URL: https://github.com/apache/maka/pull/4539#discussion_r3927062846
##########
apps/desktop/src/renderer/settings/usage-settings-page.tsx:
##########
@@ -383,12 +406,17 @@ function UsageRequestsPanel(props: {
variant="ghost"
size="sm"
label={props.copy.clearFilters}
- onClick={props.onClearFilters}
+ onClick={clearFilters}
/>
) : undefined,
}}
/>
- </>
+ </>;
+ }
+ return (
+ <UsageActivityPagination items={props.logs} pageSize={USAGE_REQUESTS_PAGE_SIZE}>
Review Comment:
P2: changing the time range does not return the table to page 1. `setRange` (line 120) only persists, the surface then refetches, and `UsageActivityPagination` keeps whatever page number it held. A user sitting on page 5 of a 90d history switches to 7d and lands on page 5 of a completely different dataset, or gets silently clamped to its last page. The same applies to Refresh: new records are prepended, so the page 2 window shifts under the reader and boundary rows repeat. The reset wiring added for search, status and clear filters covers the filter paths but not the dataset paths.
Smallest fix: `<UsageActivityPagination key={usageDraft.range} items={props.logs} pageSize={USAGE_REQUESTS_PAGE_SIZE}>`, so a range change remounts and resets. To cover the refetch shift too, also reset when the `items` identity changes.
##########
apps/desktop/src/renderer/features/usage-activity/ui/usage-activity-pagination.tsx:
##########
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { Pagination, paginateData } from '@astryxdesign/core';
+import { HStack } from '@maka/ui';
+import { useState, type ReactNode } from 'react';
+import { parseDesktopSessionKey } from '../../../../shared/runtime-host-identity.js';
+
+export interface UsageActivityPage<Item> {
+ items: Item[];
+ rowIndexStart: number;
+ rowCount: number;
+ reset(): void;
+}
+
+export function UsageActivityPagination<Item>(props: {
+ items: Item[];
+ pageSize: number;
+ children(page: UsageActivityPage<Item>): ReactNode;
+}) {
+ const [page, setPage] = useState(1);
+ const pageCount = Math.max(1, Math.ceil(props.items.length / props.pageSize));
+ const currentPage = Math.min(page, pageCount);
+
+ return (
+ <>
+ {props.children({
+ items: paginateData(props.items, currentPage, props.pageSize),
+ rowIndexStart: (currentPage - 1) * props.pageSize + 1,
+ rowCount: props.items.length,
+ reset: () => setPage(1),
+ })}
+ {pageCount > 1 ? (
+ <HStack hAlign="center">
+ <Pagination
+ page={currentPage}
+ onChange={setPage}
+ totalItems={props.items.length}
+ pageSize={props.pageSize}
+ size="sm"
+ />
+ </HStack>
+ ) : null}
+ </>
+ );
+}
+
+export function shortUsageActivitySessionId(sessionKey: string) {
Review Comment:
P3: this helper is about session ids, not pagination, and its only caller is still `usageSessionDisplayLabel` in `usage-settings-page.tsx`. Keeping it there (along with the `parseDesktopSessionKey` import) avoids a new public export, a barrel entry and a dependency edge in `renderer-architecture.json`.
##########
apps/desktop/src/renderer/features/usage-activity/ui/usage-activity-pagination.tsx:
##########
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { Pagination, paginateData } from '@astryxdesign/core';
+import { HStack } from '@maka/ui';
+import { useState, type ReactNode } from 'react';
+import { parseDesktopSessionKey } from '../../../../shared/runtime-host-identity.js';
+
+export interface UsageActivityPage<Item> {
+ items: Item[];
+ rowIndexStart: number;
+ rowCount: number;
+ reset(): void;
+}
+
+export function UsageActivityPagination<Item>(props: {
Review Comment:
P3: `@astryxdesign/core@0.5.2` already ships the seam this reimplements. `useTablePagination` is the Table plugin for exactly this shape (consumer owns the page state, the plugin renders `Pagination` around the table, with `position`, `align`, `size` and `label`). The PR uses `paginateData` from the same module but routes around the plugin with a render-prop component, a new feature directory and a barrel.
The smaller equivalent: hold `page` in `UsageRequestsPanel` (above the `showDetails` early return), call `paginateData` directly, and pass the plugin through `UsageStatsTable`. That deletes `features/usage-activity/` entirely, the `UsageActivityPage` type, and the `renderer-architecture.json` plus `astryx-surface-file-inventory` churn, and turns the reset into a plain `setPage(1)`. I have not rendered the plugin's chrome to confirm it matches the current `HStack` + `Pagination` layout; if it does not, the fallback is still to move the state into `UsageRequestsPanel` and drop the wrapper while keeping the hand-placed `Pagination`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] perf(desktop): paginate usage activity [maka]
Posted by "Phoenix500526 (via GitHub)" <gi...@apache.org>.
Phoenix500526 commented on PR #4539:
URL: https://github.com/apache/maka/pull/4539#issuecomment-5535929907
@Astro-Han, thanks for the review. I rebased the branch and applied the simplification: the separate usage-activity feature, pagination wrapper, barrel export, and architecture edge are gone, while shortUsageActivitySessionId and parseDesktopSessionKey remain in the existing Usage view. Pagination now uses the Astryx table primitives directly in that view. The story covers returning from page 2 after model search, status changes, clearing filters, range changes, and refresh, and it retains the page-2 rowIndexStart and full rowCount assertions. The PR is now limited to the two existing Usage UI files and their Storybook coverage. The current CI failure is the unrelated transcript-scroll timing test; the pagination and local verification paths are unchanged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] perf(desktop): paginate usage activity [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han merged PR #4539:
URL: https://github.com/apache/maka/pull/4539
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org