Просмотр исходного кода

test: support current beta plugin compatibility

Alvin Unreal 5 дней назад
Родитель
Сommit
644e7161cb

+ 8 - 2
src/marketplace/activation.test.ts

@@ -49,7 +49,10 @@ function agentBundle(
       author: { name: 'Community' },
       tags: ['docs'],
       license: 'MIT',
-      compatibility: { plugin: '>=2.2.0 <3.0.0', roleContract: '^1.0.0' },
+      compatibility: {
+        plugin: '>=2.2.0 <3.0.0 || >=3.0.0-beta.0 <4.0.0',
+        roleContract: '^1.0.0',
+      },
       routing: {
         description: 'Research docs and examples.',
         keywords: ['docs'],
@@ -86,7 +89,10 @@ function profileBundle(
       author: { name: 'Community' },
       tags: ['profile'],
       license: 'MIT',
-      compatibility: { plugin: '>=2.2.0 <3.0.0', roleContract: '^1.0.0' },
+      compatibility: {
+        plugin: '>=2.2.0 <3.0.0 || >=3.0.0-beta.0 <4.0.0',
+        roleContract: '^1.0.0',
+      },
       routing: {
         description: 'Deep exploration profile.',
         keywords: ['deep'],

+ 4 - 1
src/marketplace/compatibility.test.ts

@@ -18,7 +18,10 @@ const bundle: MarketplacePackageBundle = {
     author: { name: 'Community' },
     tags: ['test'],
     license: 'MIT',
-    compatibility: { plugin: '>=2.2.0 <3.0.0', roleContract: '^1.0.0' },
+    compatibility: {
+      plugin: '>=2.2.0 <3.0.0 || >=3.0.0-beta.0 <4.0.0',
+      roleContract: '^1.0.0',
+    },
     routing: {
       description: 'Use for compatibility tests.',
       keywords: ['test'],

+ 4 - 1
src/marketplace/config-references.test.ts

@@ -23,7 +23,10 @@ const bundle: MarketplacePackageBundle = {
     author: { name: 'Community' },
     tags: ['test'],
     license: 'MIT',
-    compatibility: { plugin: '>=2.2.0 <3.0.0', roleContract: '^1.0.0' },
+    compatibility: {
+      plugin: '>=2.2.0 <3.0.0 || >=3.0.0-beta.0 <4.0.0',
+      roleContract: '^1.0.0',
+    },
     routing: {
       description: 'Route referenced work here.',
       keywords: ['reference'],

+ 4 - 1
src/marketplace/schemas.test.ts

@@ -15,7 +15,10 @@ const common = {
   author: { name: 'Example Community' },
   tags: ['example'],
   license: 'MIT',
-  compatibility: { plugin: '>=2.2.0 <3.0.0', roleContract: '^1.0.0' },
+  compatibility: {
+    plugin: '>=2.2.0 <3.0.0 || >=3.0.0-beta.0 <4.0.0',
+    roleContract: '^1.0.0',
+  },
   routing: {
     description: 'Explore example code.',
     keywords: ['example'],

+ 4 - 1
src/marketplace/status.test.ts

@@ -37,7 +37,10 @@ function agentBundle(
       author: { name: 'Community' },
       tags: ['docs'],
       license: 'MIT',
-      compatibility: { plugin: '>=2.2.0 <3.0.0', roleContract: '^1.0.0' },
+      compatibility: {
+        plugin: '>=2.2.0 <3.0.0 || >=3.0.0-beta.0 <4.0.0',
+        roleContract: '^1.0.0',
+      },
       routing: {
         description: 'Research docs.',
         keywords: ['docs'],

+ 4 - 1
src/marketplace/store.test.ts

@@ -41,7 +41,10 @@ function bundle(
       author: { name: 'Example Community' },
       tags: ['example'],
       license: 'MIT',
-      compatibility: { plugin: '>=2.2.0 <3.0.0', roleContract: '^1.0.0' },
+      compatibility: {
+        plugin: '>=2.2.0 <3.0.0 || >=3.0.0-beta.0 <4.0.0',
+        roleContract: '^1.0.0',
+      },
       routing: {
         description: 'Explore example code.',
         keywords: ['example'],

+ 8 - 2
src/tools/marketplace.test.ts

@@ -43,7 +43,10 @@ function agentBundle(
       author: { name: 'Community' },
       tags: ['docs'],
       license: 'MIT',
-      compatibility: { plugin: '>=2.2.0 <3.0.0', roleContract: '^1.0.0' },
+      compatibility: {
+        plugin: '>=2.2.0 <3.0.0 || >=3.0.0-beta.0 <4.0.0',
+        roleContract: '^1.0.0',
+      },
       routing: {
         description: 'Research docs and examples.',
         keywords: ['docs'],
@@ -78,7 +81,10 @@ function profileBundle(): MarketplacePackageBundle {
       author: { name: 'Community' },
       tags: ['profile'],
       license: 'MIT',
-      compatibility: { plugin: '>=2.2.0 <3.0.0', roleContract: '^1.0.0' },
+      compatibility: {
+        plugin: '>=2.2.0 <3.0.0 || >=3.0.0-beta.0 <4.0.0',
+        roleContract: '^1.0.0',
+      },
       routing: {
         description: 'Deep exploration profile.',
         keywords: ['deep'],

+ 15 - 15
src/tui-state.ts

@@ -210,32 +210,32 @@ function releaseStateLock(lock: TuiStateLock): void {
 }
 
 // Last confirmed on-disk snapshot per project, keyed by identity
-// (ino,mtime,size). No-ops return before the lock; failed writes do not
-// seed the memo. An identity mismatch (external rename) invalidates it.
+// (ino,mtimeNs,ctimeNs,size). No-ops return before the lock; failed writes do
+// not seed the memo. An identity mismatch invalidates it.
 const lastKnownSnapshots = new Map<
   string,
   {
     snapshot: TuiSnapshot;
-    ino: number;
-    mtimeMs: number;
-    ctimeMs: number;
-    size: number;
+    ino: bigint;
+    mtimeNs: bigint;
+    ctimeNs: bigint;
+    size: bigint;
   }
 >();
 const LAST_KNOWN_SNAPSHOTS_MAX = 32;
 
 function statSnapshotFile(statePath: string): {
-  ino: number;
-  mtimeMs: number;
-  ctimeMs: number;
-  size: number;
+  ino: bigint;
+  mtimeNs: bigint;
+  ctimeNs: bigint;
+  size: bigint;
 } | null {
   try {
-    const stat = fs.statSync(statePath);
+    const stat = fs.statSync(statePath, { bigint: true });
     return {
       ino: stat.ino,
-      mtimeMs: stat.mtimeMs,
-      ctimeMs: stat.ctimeMs,
+      mtimeNs: stat.mtimeNs,
+      ctimeNs: stat.ctimeNs,
       size: stat.size,
     };
   } catch {
@@ -284,8 +284,8 @@ function memoFor(statePath: string): TuiSnapshot | undefined {
   if (
     !stat ||
     stat.ino !== entry.ino ||
-    stat.mtimeMs !== entry.mtimeMs ||
-    stat.ctimeMs !== entry.ctimeMs ||
+    stat.mtimeNs !== entry.mtimeNs ||
+    stat.ctimeNs !== entry.ctimeNs ||
     stat.size !== entry.size
   ) {
     lastKnownSnapshots.delete(statePath);