Skip to content

feat: cache the project TM across CI runs (out of git)#5

Merged
asgeirf merged 1 commit into
mainfrom
feat/tm-cache
Jul 18, 2026
Merged

feat: cache the project TM across CI runs (out of git)#5
asgeirf merged 1 commit into
mainfrom
feat/tm-cache

Conversation

@asgeirf

@asgeirf asgeirf commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

The translation memory is derived state, not committed source (neokapi AD-009): it accumulates leverage across runs but should never be committed to git. This wires that model into CI.

What

A job-cache step (actions/cache@v5, the same pattern already used for the binary and plugin caches) that:

  • restores the latest translation memory for the branch at setup (restore-keys fallback: branch → any), and
  • saves the grown TM back at job end — the key includes github.run_id, so it's always a miss on the exact key and actions/cache's own post step persists the updated state.

Covers .kapi/tm.db and the .kapi/cache/ derived stores. Gated on a *.kapi recipe being present (the .kapi/ state dir is gitignored, so the committed recipe is the signal).

Why this shape

  • No git writes. The TM never gets committed; only translation output does (via kapi-action). This avoids the pull/merge inconsistency and CI-writes-to-repo fragility of committing stores.
  • No locking. The TM is additive and rebuildable, so per-branch keys + last-write-wins are fine — unlike Terraform state, a clobbered cache is a perf hit, not data loss (kapi rebuilds from committed translations).

Inputs

  • cache-tm (default true) — enable; false to disable.
  • project-dir (default .) — where the .kapi project lives.

Implements neokapi#1367. Backward-compatible (new inputs default sensibly; no-op when no recipe is present).

The translation memory is derived state, not committed source (neokapi AD-009):
it accumulates leverage but should never land in git. Add a job-cache step that
restores the latest branch TM at setup and — via a run-unique key — saves the
grown TM back at job end through actions/cache's own post step. No commits, no
locking (per-branch, last-write-wins); a cold cache rebuilds from the committed
translations, so losing it is a perf hit, not data loss.

Covers .kapi/tm.db and the .kapi/cache/ derived stores. Gated on a *.kapi recipe
being present (the .kapi/ state dir is gitignored, so the committed recipe is the
signal). New inputs: cache-tm (default true), project-dir (default ".").

Implements neokapi#1367.
@asgeirf
asgeirf merged commit 7805813 into main Jul 18, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant