‹ Back to blog

engineering8 min read

Keeping Docs and SDKs in Step with the API

When an engineer changes a GoodMem API, the docs and the SDKs have to change with it. We wrote Reco to list the files that are out of date and to rebuild them when it can.

A technician with a clipboard looks up at seven small wall clocks that hang from a rail beside one large clock. Six of them show three o'clock. The fifth is amber and shows five.
7 examined · 6 fresh, 1 stale

GoodMem has many parts that must stay aligned, including APIs, a CLI, a console, SDKs, examples, and documentation. Some are built from others and committed alongside them. Changing a source does not by itself update the committed files built from it. Tests for that source can pass even while a reference page still shows the old behavior.

This happened with the CLI reference, which is built from the CLI’s command definitions. On September 9, we fixed a CLI connection issue involving HTTPS port 443. As part of that change, we revised the help for its global --server option from “server address” to “server URL.” The code change merged without a rebuild of the CLI reference. Because --server appears on many command pages, the old wording stayed on many pages too.

We found the mismatch on September 25, sixteen days later, while checking the committed reference against the current CLI as we added it to Reco. Rebuilding the reference changed 136 existing pages. On 117 of them, the only edit was the --server description. The rebuild also added three pages and changed one metadata file.

The CLI reference is one example. Suppose an engineer adds a field to a GoodMem API. The server accepts the field, and its tests pass. If the API reference and an SDK are not updated, they still describe a request without that field. To someone reading the reference or using the SDK, the field would appear not to exist. Someone checking only the server change would not see the disagreement.

We could ask an engineer to inspect each of those places after every change. But an API field, a CLI flag, and a model change affect different places. The engineer would still have to work out which entries mattered each time.

Tracing the effects of a change

The API field in that example raised a question. Once the server changed, what else would have to change with it? The reference would need to describe the field. Clients that exposed the request might need to support it. An example might need to show how to use it.

A change to a model GoodMem presents to users would reach different places. Any place that lists, describes, or lets someone select the model might need attention. The destinations differ, but the question stays the same. What depends on the thing that changed?

Each answer can be traced as a path. One change can lead to several components, and some of those components can lead to others. A component may need attention because an upstream source changed, even when none of its own files changed. In the API example, one path reaches the reference and another reaches the SDK.

Putting those paths together revealed the structure behind the updates. The source of truth sat upstream, the affected components sat downstream, and a change could pass through more than one step. What we needed to track was a dependency graph.

  • Changed
  • Downstream of the change
  • Not affected
Sources of truth

A change to the API definition reaches 11 of the other 16 components. The farthest is 3 steps downstream.

Downstream of the API definition: API reference (1 step), Client artifacts (1 step), CLI connect code (1 step), API examples (2 steps), Client examples (2 steps), CLI reference (2 steps), Workflow examples (2 steps), API guide (3 steps), Client guide (3 steps), CLI guide (3 steps), Getting started guide (3 steps).

Illustrative graph. The component names are examples. Point at a component to see the paths that reach it.

Select a source above the graph, or select a node in it, to trace what depends on that component. Some paths branch, while others meet at shared examples and a guide. Following a change means tracing every downstream path, including where the paths meet.

Why build another tool?

Once I saw the graph, I sketched the design on a whiteboard. Muaaz Wahid and I worked on parts of Reco together. We already had GitHub workflows for several generated artifacts. We could add another for the CLI reference, another for the console’s model catalog, and more as GoodMem grew. Each would need its own triggers and setup. The relationships would soon be scattered across workflows, while an engineer working locally would have no single way to follow them.

Gradle and Bazel can coordinate dependent work. Our first need, though, was a fast answer to whether a change had made an artifact out of date. The CLI reference and model catalog have different processes that produce them. We compared both systems while designing Reco. The files Reco tracks are committed to Git. Before merging a change, or when looking back at an older commit, we need to know whether those files match their sources at that point. A check must answer without changing them. Running the processes that produce the files just to inspect a branch would take longer and could rewrite the files we were trying to check.

We needed a separate repair step that could call the processes we already had, then check the result again. Some future components may need a person to edit them. Others might use an LLM to draft an update. Reco had to report those components as stale when their sources changed, then check the edited result instead of letting the repair declare itself finished. The same rules had to work on a laptop and in CI, where they could explain a stale pull request or propose a repair. Neither Gradle nor Bazel supplied that complete workflow for committed artifacts. We could have built it around either one with custom tasks and extensions, but the custom layer would have been much of Reco.

Consider an engineer adding a CLI flag. They run reco check before opening a pull request and learn that the CLI reference is out of date. They can then run reco repair, review the rebuilt reference, and commit it with its pin.

The same graph drives Reco locally and in CI/CD. Adding a component means declaring its relationships once, so the workflow and the engineer’s laptop follow the same rules.

How Reco works

Each Reco component declares its sources, the files it owns, and how to rebuild them. Reco follows those relationships in order. It keeps a pin with each artifact, recording the contents of its sources and outputs when the artifact was last built or accepted. The pins are committed with the files they describe.

That pin lets reco check identify drift without running every build. When a declared source changes, Reco can identify the affected components. reco repair rebuilds those with repair steps and updates their pins. It checks the results after the repair, rather than taking the repair’s word that the artifact is current. Work it cannot repair remains visible rather than being counted as finished.

Suppose an engineer adds a CLI flag and runs reco check. A shortened, illustrative report with example component names would look like this.

$ reco check
reco  0abc123de → working tree  ·  1 changed path(s)

  ok     cli-commands
  ok     cli-connect-code
  STALE  cli-reference      · cli/cmd/root.go changed since pin
  block  workflow-examples  · upstream stale, check not run
  block  cli-guide          · upstream stale, check not run
  block  getting-started    · upstream stale, check not run

6 examined · 2 fresh, 1 stale, 3 blocked

The command and connection code check out, but the reference was pinned before the command changed. Reco reports that difference without rebuilding the reference. The blocked lines mean Reco has not checked the examples or guides yet. Once the reference is current, it can check those components and say whether they need updates.

Today all 22 declared components have repair scripts. Reco also has a way to track work that a script cannot finish. With repair: none, a change to a component’s source still makes it stale, but Reco leaves the edit to a person. For example, an article that explains a feature could declare the feature’s code as its source. If that code changed, Reco would flag the article for review until an editor revised it and ran reco stamp to record the new version.

With generator: llm, a repair script could ask an LLM to draft an update. Reco would check the result independently, and a person would review the proposed change. Neither mode is used by the 22 components we have declared today.

From a change to a reviewed result

When an engineer adds an API field, they can run Reco before opening a pull request. It shows which reference and client artifacts the change affects. They rebuild what Reco can repair and review the results.

If they miss something, the pull request gets one Reco comment. It names what is still out of date, explains why the change affects it, and tells the engineer what to do next. The comment updates as the branch changes, so the reviewer sees the remaining work rather than an old warning.

The check is advisory, so a person can still merge the pull request.

The same question can be asked later. If someone wants to know whether a particular commit included the updates it required, they can check out that commit and run Reco there. After a merge, Reco checks again. When automatic repair is enabled, it can put missing generated updates into a pull request for review. Work it cannot repair stays visible.

The impact on our engineering workflow

Reco gives our automation pipelines the same understanding of dependencies that an engineer has locally. When a declared source of truth changes, a pipeline can find the affected artifacts, rebuild the ones it can, and propose the results in a reviewable pull request. It does not need a separate GitHub workflow with its own list of paths for each artifact.

That makes automation easier to extend as GoodMem grows. A new component joins the graph used by local checks, pull request checks, and repair pipelines. Authors get earlier feedback, reviewers see what remains unfinished, and generated updates have a path to completion. Engineers still judge whether the result is right.

The October 15 cutover put that shared graph in place of the older workflows. We removed clients-regeneration.yml, a 995-line workflow for client updates. Reco now carries those dependencies in the same configuration that engineers use locally.

That local check has to be quick enough to run before a pull request. Checking all 22 components on a laptop took about seven seconds. In a sample of the 20 most recent successful pull request runs, the median reco check step took four seconds. The median full gate job took four minutes and sixteen seconds, including checkout and setup. The check can answer which artifacts need attention without first running the processes that rebuild them.

Between October 15 and November 10, Reco reported stale artifacts on 13 distinct pull requests across 24 gate runs. Post-merge automation opened one repair pull request in that period.

A change to one part of GoodMem often reaches beyond the files an engineer edited. Reco gives us a shared way to see what else must follow and to keep that work visible until it is finished. That gives us a better basis for trusting that the API, SDKs, and documentation describe the same behavior.