MotirBuilding in public
MOTIR · moooon
onMotir
You’re viewing a public project. Anyone can view it — no account needed. Sign in to submit, upvote, or comment on requests.View-only — you can’t edit work items
MOTIR-27

1.1.11 Migrate `middleware.ts` → `proxy.ts` (Next 16 convention) across all three repos

Done
Description

Estimate: 30m · Depends on: 1.1.8, 1.1.9

Follow-up Subtask added post-1.1.9 to resolve PRODECT_FINDINGS.md finding #2: Next.js 16 deprecates the middleware.ts file convention in favour of proxy.ts. The deprecation warning fires on every pnpm dev boot across all three repos (motir-core + both starters, all carrying the same middleware.ts verbatim) and will become a hard failure in a future Next major.

Why one Subtask, three PRs: the same mechanical change shipped into three repos in parallel. The official Next codemod (npx @next/codemod@canary middleware-to-proxy .) handles the file + function rename in seconds. No coordinated cross-repo dependency, so three independent PRs were the right shape — each repo's CI gates that repo's merge, no cross-repo PR-orchestration overhead.

Why planner_direct, not agent-dispatched: the change is purely mechanical (one codemod invocation per repo + comment-rot cleanup the codemod doesn't touch). Agent-dispatch overhead (worktree creation, prompt-writing, env setup) outweighs the implementation cost — same calibration point as 1.1.10.

What was done: Ran the codemod in each repo's worktree (file rename + export function middlewareexport function proxy). Updated stale doc-comments at the top of the new proxy.ts in each repo to reference the new convention name and Next 16's Node.js runtime default (vs. Middleware's Edge default). Updated cross-references in each repo's README and the app/(authed)/dashboard/page.tsx smoke route. Verified pnpm typecheck, pnpm lint, pnpm format:check, pnpm test, pnpm build, pnpm test:e2e all green in each repo; pnpm dev boots with no deprecation warning. Shipped 2026-05-27 across three PRs: motir-core PR #21 (merge commit c031893); bare starter PR #2 (merge commit a386d38); designed starter PR #2 (merge commit 3d8bbbf). Post-merge, finding #2 in PRODECT_FINDINGS.md received a "Resolved" block matching finding #1's pattern. In the same pass, PRODECT_FINDINGS.md was moved from motir-core/ (where it originated when motir-core was the first concrete repo) to prodect_plan/ (its natural home alongside other planner-workflow artifacts like MOTIR.md and notes.html), since findings now span multiple repos. Move shipped as motir-core PR #22 (merge commit 7fc9831), with the protocol wording in MOTIR.md and notes.html updated to point at the new path.

Acceptance criteria

  • All three repos no longer print the middleware-to-proxy deprecation warning on pnpm dev boot.
  • middleware.ts renamed to proxy.ts in each repo; exported function renamed accordingly. config.matcher, NextRequest / NextResponse imports, and Better-Auth's getSessionCookie are unchanged.
  • Doc comments at the top of each proxy.ts reference the new file convention and the Node.js runtime default that Proxy ships with.
  • Stale middleware.ts references in each repo's README and app/(authed)/dashboard/page.tsx smoke route updated.
  • All quality gates green in each repo: pnpm typecheck, pnpm lint, pnpm format:check, pnpm test (39/39 vitest), pnpm build, pnpm test:e2e (2/2 playwright). Dev-server logs show proxy.ts: …µs firing on protected-route requests.
  • PRODECT_FINDINGS.md finding #2 gets a "Resolved" annotation with the three merge SHAs, matching finding #1's audit-trail convention.

Context refs

Status
Done
Type
Sub-task