fix: remove destructive migrate rewrite, add replay source attribution and warning drain

This commit is contained in:
John Dvorak
2026-05-22 11:41:43 -07:00
parent 1de735ee08
commit 6e4656add5
6 changed files with 50 additions and 31 deletions
+3 -14
View File
@@ -469,9 +469,9 @@ test('config rewriter replaces legacy fields', () => {
}
});
// ---------------------------------------------------------------------------
// Test 12: Route rewriter detects x-validate-runtime annotation
// Test 12: x-validate-runtime is NOT a legacy annotation (it is the current, active format)
// ---------------------------------------------------------------------------
test('route rewriter detects x-validate-runtime annotation', () => {
test('x-validate-runtime is current annotation, not legacy', () => {
const dir = createTempDir();
try {
const content = `export default {
@@ -481,18 +481,7 @@ test('route rewriter detects x-validate-runtime annotation', () => {
};`;
writeFileSync(resolve(dir, 'test.routes.js'), content);
const items = detectLegacyRouteAnnotations(content, 'test.routes.js');
assert.strictEqual(items.length, 1, 'Should detect 1 legacy annotation');
const firstItem = items[0];
assert.ok(firstItem, 'Expected one migration item');
assert.strictEqual(firstItem.legacy, 'x-validate-runtime');
assert.strictEqual(firstItem.replacement, 'runtime');
const result = rewriteRouteAnnotations(
resolve(dir, 'test.routes.js'),
items,
);
assert.strictEqual(result.modified, true, 'Should modify content');
assert.ok(result.content.includes("'runtime'"), 'Should have runtime');
assert.ok(!result.content.includes('x-validate-runtime'), 'Should not have legacy annotation');
assert.strictEqual(items.length, 0, 'x-validate-runtime must not be detected as legacy — it is the current annotation');
} finally {
cleanup(dir);
}