[#1352] Derive codev's build closure from the pnpm graph, not a hand-list - #1355
Conversation
…hand-list packages/codev's build never built its workspace deps, so a missing dep dist/ surfaced as convincing false TS errors (TS2339/TS2307) in codev's own sources. The root chain papered over it with a hand-maintained list that had already drifted (built artifact-canvas, not in the closure; omitted apps/web, which is). - packages/codev build now starts with the graph-derived closure: pnpm --filter "@cluesmith/codev^..." build. build:dashboard collapses to copy-dashboard (the closure builds apps/web in topo order, so the old step would double-build the dashboard). - Root build drops the hand-list: check-main-fresh + artifact-canvas (kept explicitly for the VS Code extension; zero workspace deps) + the now self-sufficient codev build. - CLAUDE.md/AGENTS.md Local Build Testing + Directory Map lines updated (byte-identical, enforced by governance-sweep test). - New build-scripts.test.ts guards the closure prefix and the absence of hand-listed deps at root.
Consult (claude lane, REQUEST_CHANGES) caught two stale build-wiring lines in arch.md: the build:dashboard reference and the deleted hand-list build order with its types-first rationale. Same doc-misdirection class the issue targets. The types/dist rationale for the VS Code extension still holds; it is now guaranteed by the closure rather than by hand-ordering. Thread records verdicts + dispositions.
Architect ReviewAPPROVE. Implementation verified: the graph-derived Process record, worth its weight: the gate initially arrived with the AIR consult skipped (builder misread the 'optional' clause as discretion — honestly confessed, nothing to reconstruct). Held the gate; the consult then earned its keep on the spot — claude's REQUEST_CHANGES caught two further stale build-wiring lines in Non-blocking follow-up candidates recorded in the PR body, correctly not expanded into: CI workflows still hand-build sdk/core (not blindly deletable — test.yml's dep builds feed unit-test steps), and the root guard test is absence-only. Consult UX note: auto-detect failed with 'Multiple projects found' from the worktree, needing Architect review |
Closes #1352
Summary
After the sdk split, building from
packages/codev(or viapnpm --filter @cluesmith/codev build) failed with convincing false TS errors (TS2339 onTowerClient, TS2307 on@cluesmith/codev-sdk/constants) whenever workspace deps had no freshdist. The root chain papered over this with a hand-maintained package list that had already drifted from the dependency graph.This PR implements the issue's fix A + D:
packages/codev's build now starts withpnpm --filter "@cluesmith/codev^..." build, so its workspace deps (types, sdk, core, apps/web) are built in topological order straight from the pnpm graph. The root chain drops the hand-list entirely and calls the now self-sufficient codev build.CLAUDE.mdandAGENTS.mdare updated; the two files remain byte-identical (enforced by the existing governance-sweep test).Key decisions
build:dashboardcollapsed tocopy-dashboard. The issue flagged this nuance for reconciliation: the closure now buildsapps/web(its package build istsc -b && vite build, exactly whatbuild:dashboardran viacd ../../apps/web && pnpm build). Keeping the old step would double-build the dashboard, so the codev-side step is now copy-only (apps/web/disttodashboard-dist).build:dashboardhad no other callers (verified by grep).apps/vscode, so it is not part of codev's closure and not dep-closure drift; the root builds it for the extension dev flow. This is documented in the updated CLAUDE.md/AGENTS.md bullet.check-main-fresh.shuntouched. It is a no-op offmain, so worktree and builder-branch root builds are unaffected.scripts/local-install.shpacks core, sdk, and codev; packing does not triggerprepublishOnly, andprepublishOnly(pnpm build) still works frompackages/codevsince pnpm resolves the workspace from any member directory.Test plan
packages/codev/src/__tests__/build-scripts.test.ts: asserts codev's build script carries the graph-derived closure prefix, and that the root build script no longer hand-lists any codev workspace dep (types, sdk, core, web). This encodes the invariant "dep closure comes from the graph, not a hand-list".governance-sweep.test.tscontinues to enforce CLAUDE.md and AGENTS.md byte-identity over the doc edits.rm -rf packages/*/dist apps/web/dist packages/codev/dashboard-dist):pnpm --filter @cluesmith/codev buildfrom the repo root: PASSpnpm buildfrompackages/codev/: PASSpnpm buildon the builder branch: PASSporch check 1352: build and unit tests green.Follow-up (out of scope per architect guidance)
TypeScript project references (
composite+tsc -b) would additionally catch the STALE-dist case (deps built but outdated), which neither the closure prefix nor a preflight guard catches. The closure prefix mitigates it in practice (every codev build re-runs the deps' builds, so theirdistis refreshed), but incremental correctness across packages without full rebuilds would need project references. Worth weighing against the build-tooling churn in a separate issue if stale-dist bites again.Consultation (AIR 3-way at PR,
consult --protocol air --type pr --issue 1352)codev/resources/arch.md(819, 1143)Dispositions:
build:dashboardreference) and arch.md:1143 (deleted hand-list build order): fixed in commit1db87032. This is the same doc-misdirection class the issue was filed about, so it belongs in this PR. The types-first rationale for the VS Code extension's esbuild bundle still holds and is now stated as a guarantee of the closure rather than of hand-ordering. A repo-wide grep confirmed the only remainingbuild:dashboardmentions are historical artifacts (past plans, reviews, release notes), left untouched as history.test.ymlthose builds also feed their own unit-test steps, so they cannot be deleted blindly. Flagged as a follow-up candidate rather than expanded here (AIR scope).--filter ./packages/sdkwould slip through). Accepted as minor; the positive closure-prefix assertion is the load-bearing guard.Note: the consult ran at the architect's direction at the PR gate; the first attempt failed on project auto-detection ("Multiple projects found") and produced no verdicts, re-run with
--issue 1352.