Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: let scoped CI reuse trusted shard test memos
[._.]/ Adam Eivyca6c4ebfd4b1
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex d8ab8c230e..a96ce6068f 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -401,8 +401,9 @@ jobs:# package versions, Node/platform, gating env — is byte-identical to one# a trusted green run verified. Pull requests only read. The scheduled,# dispatched and called full runs save, so the cache holds nothing a PR- # branch wrote. Each job and shard keeps its own lineage under the key- # prefix; a restore takes the newest.+ # branch wrote. Prefer the same shard's lineage, then any shard of this+ # job: scoped 1of1 plans have no full-run seed of their own. Per-test+ # content keys still decide reuse; unmatched files run normally.- name: Restore the test memouses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0with:@@ -410,6 +411,7 @@ jobs:key: test-memo-${{ runner.os }}-${{ runner.arch }}-server-${{ matrix.shard }}of${{ strategy.job-total }}-${{ github.run_id }}restore-keys: |test-memo-${{ runner.os }}-${{ runner.arch }}-server-${{ matrix.shard }}of${{ strategy.job-total }}-+ test-memo-${{ runner.os }}-${{ runner.arch }}-server-- name: Run server testsid: server-tests@@ -534,6 +536,7 @@ jobs:key: test-memo-${{ runner.os }}-${{ runner.arch }}-client-${{ matrix.shard }}of${{ strategy.job-total }}-${{ github.run_id }}restore-keys: |test-memo-${{ runner.os }}-${{ runner.arch }}-client-${{ matrix.shard }}of${{ strategy.job-total }}-+ test-memo-${{ runner.os }}-${{ runner.arch }}-client-- name: Run client testsid: client-tests@@ -1119,6 +1122,7 @@ jobs:key: test-memo-${{ runner.os }}-${{ runner.arch }}-windows-server-${{ matrix.shard }}of${{ strategy.job-total }}-${{ github.run_id }}restore-keys: |test-memo-${{ runner.os }}-${{ runner.arch }}-windows-server-${{ matrix.shard }}of${{ strategy.job-total }}-+ test-memo-${{ runner.os }}-${{ runner.arch }}-windows-server-- name: Run server tests on Windowsid: windows-testsdiff --git a/docs/GITHUB_ACTIONS.md b/docs/GITHUB_ACTIONS.mdindex 4575d24f23..610df6ef71 100644--- a/docs/GITHUB_ACTIONS.md+++ b/docs/GITHUB_ACTIONS.md@@ -1029,6 +1029,13 @@ Vitest itself is never given `--shard`.**CI seeding.** The server, client, browser and Windows jobs restore`${{ runner.temp }}/portos-test-memo` with `actions/cache/restore` under aper-job, per-shard key prefix (`test-memo-<os>-<arch>-<job>-<shard>of<n>-`).+Server, client and Windows restores prefer that partition, then fall back to+the newest memo from any shard of the same OS, architecture and job. Trusted+full runs never seed a scoped `1of1` lineage, so an exact-partition-only lookup+would leave those jobs permanently cold. A fallback contains only one shard's+entries: matching content keys may skip those tests; all other selected tests+still run. Partitioning happens before memo lookup, so changing the memo's+source shard cannot omit or duplicate a selected test.Pull requests only read. The scheduled nightly, `workflow_dispatch` and`workflow_call` runs on the default/release branches save a new entry keyedby run id, and only when the test step itself succeeded, so the cache holdsdiff --git a/scripts/ci-test-memo-cache.test.js b/scripts/ci-test-memo-cache.test.jsnew file mode 100644index 0000000000..237f044326--- /dev/null+++ b/scripts/ci-test-memo-cache.test.js@@ -0,0 +1,45 @@+import { readFileSync } from 'node:fs';+import { describe, expect, it } from 'vitest';+import { FULL_SUITE_SHARDS } from './ci-test-plan.js';+import { workflowJobs } from './lib/workflowJobs.js';++const jobs = workflowJobs(readFileSync(new URL('../.github/workflows/ci.yml', import.meta.url), 'utf8'));+const step = (job, name) => job.split(`- name: ${name}\n`)[1].split('\n - name:')[0];+const expand = (template, context) => template.replace(/\$\{\{\s*([^}]+?)\s*\}\}/g, (_, key) => {+ if (!(key in context)) throw new Error(`Unknown cache input: ${key}`);+ return context[key];+});++describe('trusted CI test-memo cache reuse', () => {+ // A scoped 1of1 job used to request a lineage no trusted full run ever saved.+ it.each([+ ['server', 'server', 'Linux'],+ ['client', 'client', 'Linux'],+ ['windows-server', 'windows', 'Windows'],+ ])('%s can restore a full-run shard without crossing runtime or job families', (jobId, family, os) => {+ const restore = step(jobs[jobId], 'Restore the test memo');+ const save = step(jobs[jobId], 'Save the test memo');+ const key = save.match(/^ +key: (.+)$/m)[1];+ const prefixes = restore.match(/restore-keys: \|\n((?: +test-memo-[^\n]+\n?)+)/)[1].trim().split('\n').map(line => line.trim());+ const context = {+ 'runner.os': os, 'runner.arch': 'X64', 'matrix.shard': 1,+ 'strategy.job-total': 1, 'github.run_id': 123,+ };+ const seeded = Array.from({ length: FULL_SUITE_SHARDS[family] }, (_, index) => expand(key, {+ ...context, 'matrix.shard': index + 1, 'strategy.job-total': FULL_SUITE_SHARDS[family],+ }));+ const restoreFrom = (available, ctx = context) => prefixes+ .map(prefix => available.find(candidate => candidate.startsWith(expand(prefix, ctx))))+ .find(Boolean);++ expect(restoreFrom(seeded)).toBeTruthy();+ // Prefer the matching partition when one exists, even if another shard is newer.+ const exact = expand(key, context);+ expect(restoreFrom([...seeded, exact])).toBe(exact);+ expect(restoreFrom(seeded, { ...context, 'runner.arch': 'ARM64' })).toBeUndefined();+ expect(restoreFrom(seeded, { ...context, 'runner.os': 'OtherOS' })).toBeUndefined();+ const foreign = seeded.map(value => value.replace(`-${jobId}-`, '-other-job-'));+ expect(restoreFrom(foreign)).toBeUndefined();+ expect(save).toContain("github.event_name != 'pull_request'");+ });+});diff --git a/scripts/lib/testMemoRunner.test.js b/scripts/lib/testMemoRunner.test.jsindex f1b3aaecfe..f454461899 100644--- a/scripts/lib/testMemoRunner.test.js+++ b/scripts/lib/testMemoRunner.test.js@@ -145,6 +145,27 @@ describe('planTestMemo and recordTestMemo', () => {expect(plan({ memoDir: null, mode: 'related', repoFiles: [], repoSources: ['server/lib/a.js'] }).selected).toEqual(['server/lib/a.test.js']);});+ it('reuses a full-run shard memo in a scoped partition and reruns changed or unseeded files', () => {+ root = mkdtempSync(join(tmpdir(), 'portos-memo-repo-'));+ memoDir = mkdtempSync(join(tmpdir(), 'portos-memo-store-'));+ writeRepo(root, FILES);++ const seed = plan({ shard: { index: 1, count: 2 } });+ recordTestMemo({ scope: 'server', repoRoot: root, memoDir, plan: seed, passed: seed.slice, source: 'ci' });++ const scoped = plan({ shard: { index: 1, count: 1 } });+ expect(scoped.skipped.map(({ test }) => test).sort()).toEqual([...seed.slice].sort());+ expect(scoped.run).toEqual(scoped.selected.filter(test => !seed.slice.includes(test)));+ expect([...scoped.run, ...scoped.skipped.map(({ test }) => test)].sort()).toEqual(scoped.selected);+ expect(plan({ nodeVersion: '24.2.0' }).skipped).toEqual([]);++ const changed = seed.slice[0];+ writeFileSync(join(root, changed), `${FILES[changed]}\n// Changed after the trusted full run.\n`);+ const after = plan({ shard: { index: 1, count: 1 } });+ expect(after.run).toContain(changed);+ expect(after.skipped.map(({ test }) => test).sort()).toEqual(seed.slice.filter(test => test !== changed).sort());+ });+it('hashes the forward-slashed root-relative path on every platform, like Vitest', () => {// pathe's resolve slashes before the slice, so a Windows root yields the same tail as a POSIX one.expect(vitestShardHashInput('server/lib/x.test.js', { repoRoot: '/repo', scope: 'server', path: posix })).toBe('/lib/x.test.js');