Repository navigation
Conversation
…expose the actionable cap fetchExecutionsByClass logged a listing error and skipped the class, so a failed actionable query hid every pending approval while the response kept truncated=false. The class fetch now reports failure and fetchExecutionsAsHistory raises the incomplete-results signal (including on the no-executions early return). HistoryResponse gains actionable_executions_limit (config.MaxListLimit) next to executions_limit (terminal cap, DefaultListLimit), so the UI banner can quote the cap that was actually hit instead of always quoting the terminal cap. The banner text itself lives in frontend/ and is left to the UI owner. Refs LeanerCloud#686 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
This was referenced Oct 23, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backend half of #686. Both gaps were left by #632 PR1 (#684).
Root cause
fetchExecutionsByClass(internal/api/handler_history.go) logged aGetExecutionsByStatuseserror and returnednil.fetchExecutionsAsHistoryonly derived its cap signal from row counts, and itslen(executions) == 0early return hard-codedfalse. So if the actionable query failed, every pending approval disappeared from/api/historywhiletruncatedstayedfalse.HistoryResponseexposedexecutions_limit(config.DefaultListLimit, 100), which since fix(history): fetch actionable executions separately so terminal rows cannot starve them #684 caps only the terminal class. The actionable class (pending, notified, scheduled, approved, running, paused) has its own cap,config.MaxListLimit(1000), and the API never returned it. That left the UI banner nothing to quote except 100.Fix
fetchExecutionsByClassnow returns(rows, ok). A new helper,fetchExecutionClasses, fetches both classes and returnsincomplete = actionable listing failed || terminal listing failed || actionable class at MaxListLimit.fetchExecutionsAsHistoryORs that into its cap signal, including on the no-executions early return. The result istruncated=truewhenever a class listing errored, as the issue suggests. Completed history and the other class still render as before. Splitting out the helper keepsfetchExecutionsAsHistoryat gocyclo 10.HistoryResponsegainsactionable_executions_limit(config.MaxListLimit), next tolimitandexecutions_limit. This is the "or the API exposes both caps" option from the issue.truncatedis still a single boolean. No per-class flag or count is added, so a scoped user learns nothing more about other tenants' row volume than before.openapi.yamland theHistoryResponsedoc comments now describe the new field and the listing-error case.Refs #686
This uses
Refs, notCloses: the banner text the user sees is rendered infrontend/src/history.ts, which this PR does not change. The issue should stay open until the frontend follow-up below lands.Verification
Unit tests with mock stores only. This is not a DB-level bug, so I added no integration test.
New and changed tests in
internal/api:TestHandler_getHistory_ClassListingErrorKeepsOtherClass: each subtest now also assertstruncated == true.TestHandler_getHistory_BothClassListingsFailSetTruncated(new): covers the early-return path when both listings fail.TestHandler_getHistory_EmptyClassListingsNotTruncated(new): two successful but empty listings must not raise the banner.TestHandler_getHistory_ActionableExecutionsLimitExposed(new):actionable_executions_limit == MaxListLimit,executions_limit == DefaultListLimit, andtruncatedis set at the actionable cap.Fail-before, run on the unfixed handler:
Pass-after: the same command passes all 4 tests (including both subtests).
Mutation probes, each reverted afterwards. Every one is caught:
!actionableOKfromincompletefailsClassListingErrorKeepsOtherClass/actionable_error_keeps_terminal!terminalOKfailsClassListingErrorKeepsOtherClass/terminal_error_keeps_actionablefalseon the no-executions early return failsBothClassListingsFailSetTruncatedCheap checks, run on this branch with
AWS_CONFIG_FILE=/dev/null AWS_SHARED_CREDENTIALS_FILE=/dev/null AWS_EC2_METADATA_DISABLED=true:Combined-tree verification. This branch was tested together with the other queued branches on a local, never-pushed tree:
queue/platform@936996ad= origin/maina14dc8f2plus these heads, merged in this order:fix/issue-72andfix/issue-312conflict on one line ininternal/api/handler_dashboard.go(both change thecalculateCommitmentMetricscall). The tree used #72's side with #312's validatedprovidervariable; whichever PR merges second takes that same resolution.Linux, Go 1.26.9,
AWS_CONFIG_FILE=/dev/null AWS_SHARED_CREDENTIALS_FILE=/dev/null AWS_EC2_METADATA_DISABLED=true; Docker Postgres via testcontainers:936996ad:go build ./...,go vet ./...,go vet -tags integration ./...and the fullgo test -race -short -count=1 ./....936996ad: golangci-lint v2.10.1 found 0 issues on every changed package, with and without--build-tags integration.tests/e2eis a separate module, so it was vetted under its owne2etag.gocyclo -over 10is silent on the changed non-test files.-tags integration -count=1, 60-minute local timeout because the VM was shared):936996ad, these pass:internal/server,internal/credentials,internal/scheduler,internal/database/postgres/migrations,internal/purchaseandinternal/api.internal/configpasses exceptTestPostgresStoreDB_ResolveStaleRIExchange_ValidatesCloudCheck, which fails the same way on unmodified main (fixed by fix(config): compare resolve checked_at at the database's microsecond precision #1252).26795376, same branches at earlier heads):internal/analytics,internal/auth,internal/commitmentopts,internal/databaseandcmd/lambda/clear-rate-limitall pass. The later fixes don't touch those packages.httpToLambdaRequestsignature change;scripts/setup-git-secrets.shpatterns in a fresh repo with an isolated HOME, found nothing in the changed files, and a planted fake key was flagged.scripts/test-git-secrets-allowlist.sh: 137 PASS, 0 FAIL.Out of scope
frontend/). See below.truncatedis reused for the listing-error case, as the issue proposes, rather than adding a separateincompleteflag. The banner's "capped at" wording is therefore slightly off when the cause is an error rather than a cap. The follow-up below covers this.fix/issue-532changehandler_purchases.goand other files, nothandler_history.goortypes.go.fix/issue-532also editsopenapi.yaml, but in different hunks (around lines 640 and 760; this PR edits about line 4030).Frontend follow-up for the UI owner
frontend/src/history.tsrenderTruncationNotices(around line 398) currently renders:Suggested change, which could be folded into the frontend PR the issue mentions:
actionable_executions_limit?: number;to the history response type infrontend/src/types.ts(next toexecutions_limit, around line 206).truncatedis now also set when an execution listing fails.frontend/src/__tests__/history-truncation-notice.test.tsmocks to includeactionable_executions_limit: 1000, and assert that the banner quotes 1000 for the actionable class.Labels
Maintainer: please mirror the issue's triage labels onto this PR:
triaged,priority/p3,severity/low,urgency/eventually,impact/few,effort/s,type/bug.🤖 Generated with Claude Code