Skip to content

Update: Optimize buildSteps for large event counts#48

Merged
FL4TLiN3 merged 1 commit intomainfrom
perf/optimize-build-steps
Dec 4, 2025
Merged

Update: Optimize buildSteps for large event counts#48
FL4TLiN3 merged 1 commit intomainfrom
perf/optimize-build-steps

Conversation

@FL4TLiN3
Copy link
Contributor

@FL4TLiN3 FL4TLiN3 commented Dec 4, 2025

Summary

  • Implement incremental updates for buildSteps in useStepStore
  • Cache stepMap and processedCount in useRef to avoid full rebuilds on every event
  • Only rebuild when events are truncated (MAX_EVENTS=1000) or historical events are loaded

Closes #42

Test plan

  • pnpm typecheck passes
  • pnpm test passes
  • pnpm format-and-lint passes
  • pnpm check-deps passes
  • pnpm build passes
  • E2E tests for long-running sessions with 500+ events

Note

Incremental, cached step map processing in useStepStore, rebuilding only on truncation or historical event loads.

  • tui/hooks (packages/tui/src/hooks/state/use-step-store.ts):
    • Implement incremental processing using cached stepMapRef, processedCountRef, and needsRebuildRef with a useEffect update loop.
    • Add helpers: getOrCreateStep, processEvent, buildStepsFromMap; clone tool entries when building steps.
    • Handle MAX_EVENTS truncation and setHistoricalEvents by marking rebuild; compute completedSteps/currentStep without useMemo.
  • Changeset: add patch note for @perstack/tui describing the optimization.

Written by Cursor Bugbot for commit b7b5782. This will update automatically on new commits. Configure here.

@vercel
Copy link

vercel bot commented Dec 4, 2025

Deployment failed with the following error:

Resource is limited - try again in 11 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/fl4tlin3s-projects?upgradeToPro=build-rate-limit

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@FL4TLiN3 FL4TLiN3 force-pushed the perf/optimize-build-steps branch from 63f9003 to 58411ae Compare December 4, 2025 09:16
@vercel
Copy link

vercel bot commented Dec 4, 2025

Deployment failed with the following error:

Resource is limited - try again in 9 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/fl4tlin3s-projects?upgradeToPro=build-rate-limit

@FL4TLiN3 FL4TLiN3 force-pushed the perf/optimize-build-steps branch from 58411ae to 3e950bd Compare December 4, 2025 09:29
@FL4TLiN3 FL4TLiN3 force-pushed the perf/optimize-build-steps branch from 3e950bd to c3cec99 Compare December 4, 2025 10:23
@vercel
Copy link

vercel bot commented Dec 4, 2025

Deployment failed with the following error:

Resource is limited - try again in 8 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/fl4tlin3s-projects?upgradeToPro=build-rate-limit

@FL4TLiN3 FL4TLiN3 force-pushed the perf/optimize-build-steps branch from c3cec99 to 09e8447 Compare December 4, 2025 17:22
@vercel
Copy link

vercel bot commented Dec 4, 2025

Deployment failed with the following error:

Resource is limited - try again in 1 hour (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/fl4tlin3s-projects?upgradeToPro=build-rate-limit

@FL4TLiN3 FL4TLiN3 force-pushed the perf/optimize-build-steps branch from 09e8447 to 6630f8d Compare December 4, 2025 17:29
@FL4TLiN3 FL4TLiN3 force-pushed the perf/optimize-build-steps branch from 6630f8d to b7b5782 Compare December 4, 2025 17:32
@FL4TLiN3 FL4TLiN3 merged commit 5141845 into main Dec 4, 2025
7 of 8 checks passed
@github-actions github-actions bot mentioned this pull request Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Performance: Optimize buildSteps for large event counts

1 participant