建立 AGC 稳定版生命周期基础合同
新增 ClientOperation 状态、身份和 stale-result 规则 让认证 refresh 与首页创建记录统一 operation phase 和 scope 为 dev-stack 与 AGC Vite marker 增加工作树和实例身份门禁 补充稳定版切换主规范、里程碑计划和开发运维踩坑文档
This commit is contained in:
@@ -425,6 +425,7 @@ function buildDevStackSnapshot(runner, updatedAt = new Date().toISOString()) {
|
||||
|
||||
return {
|
||||
schemaVersion: 2,
|
||||
instanceId: runner.instanceId,
|
||||
command: runner.command ?? 'all',
|
||||
repoRoot,
|
||||
database: runner.options.database,
|
||||
@@ -450,6 +451,12 @@ function buildDevStackServiceSnapshot(runner, serviceName, updatedAt) {
|
||||
: null;
|
||||
|
||||
return {
|
||||
repoRoot,
|
||||
instanceId: runner.instanceId,
|
||||
dataDir:
|
||||
serviceName === 'spacetime'
|
||||
? resolve(runner.options.spacetimeDataDir)
|
||||
: null,
|
||||
status,
|
||||
pid:
|
||||
childPid ??
|
||||
@@ -1198,6 +1205,9 @@ class DevRunner {
|
||||
constructor(options, baseEnv = process.env, explicitOptions = new Set()) {
|
||||
this.options = options;
|
||||
this.baseEnv = { ...baseEnv };
|
||||
this.instanceId = `dev-${process.pid}-${randomBytes(12).toString('hex')}`;
|
||||
this.baseEnv.GENARRATIVE_DEV_STACK_INSTANCE_ID = this.instanceId;
|
||||
this.baseEnv.GENARRATIVE_DEV_STACK_REPO_ROOT = repoRoot;
|
||||
this.spacetimeApiToken = String(
|
||||
this.baseEnv.GENARRATIVE_SPACETIME_TOKEN ?? '',
|
||||
).trim();
|
||||
|
||||
@@ -723,6 +723,7 @@ describe('dev scheduler stack state file', () => {
|
||||
test('状态快照记录服务 pid、端口、URL 和当前命令', () => {
|
||||
const updatedAt = '2026-05-29T00:00:00.000Z';
|
||||
const runner = {
|
||||
instanceId: 'test-instance',
|
||||
command: 'web',
|
||||
options: {
|
||||
apiHost: '127.0.0.1',
|
||||
@@ -770,12 +771,16 @@ describe('dev scheduler stack state file', () => {
|
||||
const snapshot = buildDevStackSnapshot(runner, updatedAt);
|
||||
|
||||
expect(snapshot.schemaVersion).toBe(2);
|
||||
expect(snapshot.instanceId).toBe('test-instance');
|
||||
expect(snapshot.command).toBe('web');
|
||||
expect(snapshot.database).toBe('genarrative-test');
|
||||
expect(snapshot.spacetimeDataDir).toBe(
|
||||
resolve('server-rs/.spacetimedb/local/data'),
|
||||
);
|
||||
expect(snapshot.services.web).toMatchObject({
|
||||
repoRoot: resolve('.'),
|
||||
instanceId: 'test-instance',
|
||||
dataDir: null,
|
||||
status: 'running',
|
||||
pid: 4321,
|
||||
host: '0.0.0.0',
|
||||
|
||||
Reference in New Issue
Block a user