islandflow/docs/turns/2026-05-29-add-typecheck-to-ci.html
dirtydishes 739a534ac2
Some checks are pending
CI / Validate (push) Waiting to run
run typecheck in ci
2026-05-29 02:29:45 -04:00

226 lines
7 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Add typecheck to CI</title>
<style>
:root {
color-scheme: light;
--bg: oklch(0.984 0.006 230);
--ink: oklch(0.22 0.018 240);
--muted: oklch(0.46 0.018 240);
--line: oklch(0.88 0.012 240);
--panel: oklch(0.998 0.003 240);
--accent: oklch(0.5 0.115 230);
--accent-soft: oklch(0.93 0.034 230);
}
* {
box-sizing: border-box;
}
body {
margin: 0;
background: var(--bg);
color: var(--ink);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
line-height: 1.58;
}
main {
width: min(1040px, calc(100% - 40px));
margin: 0 auto;
padding: 56px 0 72px;
}
header {
border-bottom: 1px solid var(--line);
margin-bottom: 34px;
padding-bottom: 28px;
}
.eyebrow {
color: var(--accent);
font-size: 0.78rem;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
}
h1 {
font-size: clamp(2rem, 5vw, 4rem);
line-height: 1;
margin: 10px 0 18px;
max-width: 900px;
}
h2 {
border-top: 1px solid var(--line);
font-size: 1.15rem;
margin: 34px 0 10px;
padding-top: 22px;
}
p,
li {
color: var(--muted);
max-width: 76ch;
}
strong {
color: var(--ink);
}
code {
color: oklch(0.25 0.025 240);
font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
font-size: 0.92em;
}
pre {
background: var(--panel);
border: 1px solid var(--line);
border-radius: 8px;
overflow-x: auto;
padding: 16px;
}
.summary {
background: var(--accent-soft);
border: 1px solid oklch(0.83 0.04 230);
border-radius: 8px;
padding: 18px 20px;
}
.meta {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-top: 20px;
}
.pill {
background: var(--panel);
border: 1px solid var(--line);
border-radius: 999px;
color: var(--muted);
font-size: 0.85rem;
padding: 6px 10px;
}
</style>
</head>
<body>
<main>
<header>
<div class="eyebrow">Turn document</div>
<h1>Add typecheck to Forgejo CI</h1>
<p class="summary">
Updated the Forgejo CI workflow so PRs and pushes to <code>main</code> install dependencies, run the
repository-wide typecheck, run tests, verify the Docker workspace snapshot, and build the production web app.
</p>
<div class="meta">
<span class="pill">Created: 2026-05-29 02:28 EDT</span>
<span class="pill">Beads: islandflow-444</span>
<span class="pill">Validation: full CI-equivalent gates passed locally</span>
</div>
</header>
<section>
<h2>Summary</h2>
<p>
The existing Forgejo CI workflow already ran on pull requests and pushes to <code>main</code>. This change adds
the new <code>bun run typecheck</code> command before tests so TypeScript drift fails early.
</p>
</section>
<section>
<h2>Changes Made</h2>
<ul>
<li>Added a <code>Run typecheck</code> step to <code>.forgejo/workflows/ci.yml</code>.</li>
<li>Kept the existing CI order otherwise: dependency install, tests, Docker workspace snapshot check, web production build.</li>
<li>Synced <code>deployment/docker/workspace-root</code> so the Docker snapshot check includes the new typecheck script and dev dependencies from the root workspace.</li>
</ul>
</section>
<section>
<h2>Context</h2>
<p>
The repo now has a root typecheck command. CI needed to run that command automatically for PRs and pushes to
<code>main</code>, matching the validation sequence discussed for normal development and release readiness.
</p>
</section>
<section>
<h2>Important Implementation Details</h2>
<p>
Typecheck runs immediately after <code>bun install --frozen-lockfile</code>. That placement keeps failures
clear and quick: dependency resolution is proven first, then TypeScript correctness, then behavior tests and
production web build validation.
</p>
</section>
<section>
<h2>Relevant Diff Snippets</h2>
<p>
Attempted to use <code>@pierre/diffs</code> previously, but the installed package exposes library exports and
no executable CLI. These snippets use the plain diff fallback.
</p>
<pre><code>diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml
@@
- name: Install dependencies
run: ~/.bun/bin/bun install --frozen-lockfile
+ - name: Run typecheck
+ run: ~/.bun/bin/bun run typecheck
+
- name: Run tests
run: ~/.bun/bin/bun test</code></pre>
<pre><code>diff --git a/deployment/docker/workspace-root/package.json b/deployment/docker/workspace-root/package.json
@@
+ "typecheck": "bun run scripts/typecheck.ts",
@@
+ "@types/bun": "^1.3.3",
+ "@types/ws": "^8.18.1",
+ "typescript": "^5.9.3",</code></pre>
</section>
<section>
<h2>Expected Impact for End-Users</h2>
<p>
Contributors get faster feedback when a PR or <code>main</code> push breaks TypeScript. Production web build
validation remains part of the same workflow, so UI deploy readiness is still checked before the workflow
succeeds.
</p>
</section>
<section>
<h2>Validation</h2>
<ul>
<li><code>bun run typecheck</code> passed.</li>
<li><code>bun test</code> passed: 250 tests, 0 failures.</li>
<li><code>bun run check:docker-workspace</code> passed after syncing the snapshot.</li>
<li><code>bun --cwd=apps/web run build</code> passed.</li>
</ul>
</section>
<section>
<h2>Issues, Limitations, and Mitigations</h2>
<p>
This is still a single validation job rather than multiple independent jobs. That keeps the workflow simple and
preserves ordering, but it means later checks wait for earlier checks to finish. Parallelization can be added
later if runtime becomes a problem.
</p>
</section>
<section>
<h2>Follow-up Work</h2>
<p>
No required follow-up remains for this task. Existing issue <code>islandflow-3ys</code> still tracks broader CI
expansion such as Docker image builds and service-container integration tests.
</p>
</section>
</main>
</body>
</html>