Unit tests for the task activity limit and cursor rules
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 95/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Read app/packages/core/src/work/task-activity.ts, the limits in app/packages/contracts/src/work.ts, and the pattern in app/tests/app/search-core.test.ts. Add the specified cases to app/tests/app/task-activity-window-core.test.ts, then run the provided Docker test command and repository checks. Done means the tests pass with no production changes.
Written by the indexing model from the issue text.
Description
Context
A task's activity list (#488) is paged by limit and an opaque before cursor. The rule is strict on purpose: a limit outside 1 to 50 or a cursor that is not exactly what an earlier page returned is refused, never clamped. A client that sends limit=500 must learn it is wrong, not silently get 50. The rule lives in two small pure functions that are only exercised through the API suite, which needs a database.
Found on main at 75df7fffd: nothing in app/tests names activityWindow.
Files
app/packages/core/src/work/task-activity.tsencodeActivityCursor(position)(line 14) and the privatedecodeActivityCursor(line 16): a base64url JSON{ t: <timestamp with 6 fractional digits>Z, i: <uuid> }.activityWindow(query)(line 29):limit1 to 50, 30 when omitted;beforeoptional.- The limits come from
TASK_ACTIVITY_PAGEinapp/packages/contracts/src/work.ts(line 73).
- Errors are
InvalidInputErrorwith codeINVALID_CURSORfor a bad cursor (app/packages/core/src/access/errors.ts). - Pattern to copy:
app/tests/app/search-core.test.ts(pure functions,refusal(code)helper withassert.throws). Import the two functions from../../packages/core/src/work/task-activity.jsif@flux/coredoes not re-export them.
Checked before filing: a draft of the cases below passed against main at cb25512e6 in the test image, so the tests describe today's behaviour and need no production change.
Acceptance criteria
- A new file
app/tests/app/task-activity-window-core.test.tscovers:- no query and an empty query give
{ limit: 30, before: null }; limit1 and 50 are accepted; 0, 51, 1.5,-1andNaNare refused withInvalidInputError(not clamped);- a cursor made by
encodeActivityCursorround-trips into the same{ position, id }; - refused with code
INVALID_CURSOR: an empty string, a string with characters outside base64url, a valid base64url string that is not JSON, JSON with a wrong timestamp shape (three fractional digits), JSON with anithat is not a UUID, and a non-stringbefore.
- no query and an empty query give
- No production code changes. A failing case that shows a real bug gets its own issue.
- The tests pass, and the repository checks stay green.
How to check
docker build --file docker/Dockerfile --target test --tag flux-unit app
docker run --rm --network none flux-unit node_modules/.bin/tsx --test tests/app/task-activity-window-core.test.ts
docker image rm flux-unit
python3 scripts/check_agent_setup.py
git diff --check
See CONTRIBUTING for the fork and PR steps. Put Closes #<this issue> in the PR description.
- Dominant language
- TypeScript
- Stars
- 3
- Forks
- 0
- Avg merge
- 11h 54m
- Merged PRs (30d)
- 371
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ColdPhase/flux
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Flaky: agent-runtime-console-core 'on disconnect' fails with ENOTEMPTY on rmdir of its temp slotOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Closing a thread panel: no visible exitPossibly taken @PelikanFix16 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ColdPhase/flux#901 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
Similar issues
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
openclaw/openclaw#195577 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
EKKOLearnAI/ekko-studio#3729 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
Supportseal/SupportSeal-app#98 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
eliasstravik/herdr-projects#845 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
cloudflare/skills#279 ·
Maintainers usually reply within 1 day