Skip to content

Reuse the task model validation schema during cold open and writes - #696

Merged
callumalpass merged 2 commits into
mainfrom
sprint-w25-tasknotes-544-cold-open-p95
Nov 28, 2026
Merged

callumalpass merged 2 commits into
mainfrom
sprint-w25-tasknotes-544-cold-open-p95

Conversation

@callumalpass

@callumalpass callumalpass commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

Refs #602
Refs #544

Two Chromium CPU profiles of the 10,000-task cold open showed repeated construction of Zod optional schema wrappers under validateTask → assertValid → create/update. The model package now reuses the identical partial schema already held by its document validator. Every generated task still runs validation. App and importer resolve the same exact patch through the workspace lock. The demo repository caches the Today badge counts by day and runtime timezone, invalidates them on edits and subtracts pending deletions by ID.

The November 28 sign-in checks on #544 recorded zero fallback errors. The two remaining 401s were browser-generated network messages for SDK requests. The app has no direct callers of either endpoint. Its publisher already writes and verifies the fallback rewrites. There was no fresh production sign-in in this test.

Chromium workflow timings

At 10,000 tasks, cold-open p95 fell by 959 ms (35.7%). At 60 tasks, the median rose by 85.5 ms and p95 rose by 16 ms. Times below are milliseconds in Chromium 149.0.7827.55. Each cell uses 40 observations per build. The median averages ranks 20 and 21. Nearest-rank p95 is rank 38. Each build ran first in 20 pairs. Pairs 1–25 were retained and pairs 26–40 completed after the interruption.

60 tasks Baseline median / p95 Candidate median / p95
Cold open Today 767.5 / 1280 853 / 1296
Cold Month Calendar 95 / 164 94 / 130
Warm task drawer 85 / 131 96.5 / 128
Warm whole-title filter 35 / 43 34.5 / 42
10000 tasks Baseline median / p95 Candidate median / p95
Cold open Today 1537.5 / 2687 998 / 1728
Cold Month Calendar 533 / 1007 511 / 911
Warm task drawer 114.5 / 210 112 / 163
Warm whole-title filter 51 / 82 51 / 69

Local validation passed for 2,382 unit tests with nine skips, typecheck, lint, and production, self-hosted, e2e and importer builds.

Reproduction

Run in Bash on a host with sandboxed Playwright Chromium, pnpm, rpnpm and Python 3. Both origins serve loopback e2e builds. Each pair uses a fresh Chromium process, both sizes, UTC, en-US, 1280 × 800, reduced motion, a fixed clock and blocked service workers. Each cold sample uses a fresh context. Warm workflows reload that context. The timer includes the DOM target and two animation frames.

set -euo pipefail
scratch=$(mktemp -d)
base=50e15225ad3f24b6eefc532a62dcba9de51f22ce
candidate=fca13118a63d61177132b268c9c0c3ac79c09114
git worktree add --detach "$scratch/base" "$base"
git worktree add --detach "$scratch/candidate" "$candidate"
for variant in base candidate; do
  (cd "$scratch/$variant" && rpnpm --pull dist run build:e2e)
done
python3 -m http.server 46271 --bind 127.0.0.1 -d "$scratch/base/dist" >"$scratch/base.log" 2>&1 &
base_pid=$!
python3 -m http.server 46275 --bind 127.0.0.1 -d "$scratch/candidate/dist" >"$scratch/candidate.log" 2>&1 &
candidate_pid=$!
trap 'kill "$base_pid" "$candidate_pid"' EXIT
cd "$scratch/candidate"
pnpm install --frozen-lockfile
for round in {1..40}; do
  origins=(http://127.0.0.1:46271 http://127.0.0.1:46275)
  if ((round % 2 == 0)); then origins=(http://127.0.0.1:46275 http://127.0.0.1:46271); fi
  TASKNOTES_BENCH_ROUNDS=1 TASKNOTES_BENCH_FOCUS=calendar-search \
    node scripts/bench-task-workflow.mjs "${origins[@]}" >"$scratch/round-$round.json"
done

@callumalpass
callumalpass merged commit 69e5e18 into main Nov 28, 2026
8 checks passed
@callumalpass
callumalpass deleted the sprint-w25-tasknotes-544-cold-open-p95 branch November 28, 2026 17:20
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.

1 participant