Skip to content

v1.0

Choose a tag to compare

@github-actions github-actions released this 05 Dec 00:14
e1efdb9

borgo 1.0 — a promise, in writing

Every release so far has said the same thing in small print: this may change. It was the honest thing to say. A framework that has not yet been leaned on does not know which of its walls are load-bearing, and promising otherwise is how you end up maintaining your mistakes forever.

1.0 is the release where the small print comes off. Not because the work is finished — it is not, and these notes say further down what is missing — but because the surface has now been used hard enough for us to know which parts of it we would defend. So we went through it one entry at a time and decided.

What the number means now

The API reference lists every Go and TypeScript export, environment variable, CLI flag and file convention, each with a marker.

41 entries that said provisional now say stable, which brings the stable total to 186. Stable means what the stability policy says it means: it does not break inside 1.x. Not renamed, not given a different type, not quietly given a new default.

The small print stays on eighteen entries: the things this release adds, which nobody outside the framework's own tests and example app has built on yet. They are supported and documented, but a minor version may still change them, with a migration note. We would rather say that than pretend.

To get there, the open questions in the reference each got an answer instead of a footnote. WriteJSON is deprecated in favour of the writer the typed bridge can read. Two exports that only generated code ever needed have moved from the root entry point to borgo-framework/internal. One helper that existed twice exists once.

We built the app again, and it asked for a frame

The chat app that found eighteen things wrong with 0.22 was rebuilt on 0.30, and its friction log is where most of this release comes from. The loudest entry was about layouts.

A _layout.tsx received children and nothing else. That was deliberate — no waterfall — and it was wrong for any app whose frame is data: which workspace, which rooms, who is here. Every page fetched the same sidebar and wrapped itself in it, so moving from a room to the people list unmounted the frame: two WebSockets closed and reopened, presence restarted, the sidebar lost its scroll position.

A layout can now have a loader.

export async function loader({ api, params }: LoaderContext) {
  const { rooms } = await api("GET /api/w/{slug}/rooms", { params });
  return { rooms };
}

export default function Frame({ children, rooms }: LayoutProps<typeof loader>) {
  return <div><Sidebar rooms={rooms} />{children}</div>;
}

The loaders of a route — every layout's and the page's — start together, so another level of layout does not add a round trip. The layout stays mounted from page to page. And a layout that redirects signed-out visitors does so for every page beneath it and for their form actions.

That last clause was not in the first version. An independent reviewer, handed the guarantees and not the code, found that a layout could refuse a visitor and the page's action would already have run. The same review also found that a page loader could overwrite the layouts' props by returning the right key, and that the error page disappeared when the frame around it was the thing that had failed. All three are tests now. The feature is the better for having been broken first.

The rest of what the app asked for

  • api() in the browser, the same typed client a loader gets, CSRF header attached.
  • navigate() and revalidate(), for the navigation no link expresses.
  • borgo.Disconnect, for the sockets a removed or demoted user still holds open, with borgo.Subscribers and borgo.OnPublish beside it.
  • The login, register and signup routes are typed. They were the three routes every app has and the only ones the bridge returned unknown for. borgogen now reads what your Auth.Principal returns — and leaves the type unknown whenever your code could have changed it after the declaration, because a wrong type is worse than none.
  • borgo.Error, Uploads.SaveReader, ApiError.json(): three helpers the app had written for itself.

What a server gets without asking

A sign-in endpoint that stops listening to an address that keeps failing. A ceiling on open WebSockets and event streams, answered with 503 and Retry-After instead of with memory. Strict-Transport-Security wherever you have told borgo the site is HTTPS. A page cache that will not hold an 8 MiB document for everyone.

None of it needs configuring. All of it can be configured.

Things that were simply broken

A page's server code could reach the client bundle if the app directory was opened through a symlink or with the drive letter in a different case. A tab that had been offline for an hour replayed the hour. A bare <a href="#"> refetched the page. Every scaffolded Dockerfile copied a fixed list of directories, so an app with one more built its image and failed on the first request. A scaffold pinned its Bun half to a version and left its Go half to chance.

The fuzz targets, it turned out, had never been fuzzing in CI: go test runs them on their seeds and stops. They run for real now, on every push — and the first thing real fuzzing found was a test of ours whose property was too strict.

What is not in 1.0

Request IDs, an access log and structured logging. Test helpers for people writing apps. Benchmarks on the new topology, which the 0.30 notes promised and which we still owe. They are the plan for 1.1, and none of them needs a breaking change to arrive.

Upgrading

  1. Bump borgo-framework and the Go module together, as always, and run bun run build.
  2. If tsc now objects to your login or signup call, it has found a form field you were sending without converting it to a string. It is right.
  3. Show a 429 from the login route as "try again in a minute", not as a wrong password.
  4. Read the upgrade guide: it has the full list and a six-line checklist.

Most apps will not need to change a line.

A version number is a promise a framework cannot take back. It took us all of 0.x to be ready to make this one.

— Luigi