fix: honor underscore-unused convention and make durability fsyncs cross-platform
- eslint: respect the repo's existing _-prefix convention for unused vars - phase-one-blockers: derive projectRoot via import.meta.dirname so Windows checkouts stop producing C:\C:\... paths - backup/release-evidence/cutover-orchestrator: skip POSIX-only directory fsync on win32 and fsync read-only handles through a writable handle
This commit is contained in:
@@ -289,12 +289,15 @@ async function durableState(plan: CutoverPlan, state: CutoverState): Promise<voi
|
|||||||
await handle.close();
|
await handle.close();
|
||||||
}
|
}
|
||||||
await rename(temporary, target);
|
await rename(temporary, target);
|
||||||
|
if (process.platform !== 'win32') {
|
||||||
|
// directory fsync only exists on POSIX
|
||||||
const directory = await open(plan.stateDir, constants.O_RDONLY);
|
const directory = await open(plan.stateDir, constants.O_RDONLY);
|
||||||
try {
|
try {
|
||||||
await directory.sync();
|
await directory.sync();
|
||||||
} finally {
|
} finally {
|
||||||
await directory.close();
|
await directory.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function preparedState(plan: CutoverPlan): CutoverState {
|
function preparedState(plan: CutoverPlan): CutoverState {
|
||||||
|
|||||||
@@ -159,7 +159,8 @@ async function digestFileHandle(handle: FileHandle): Promise<string> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function syncFile(path: string): Promise<void> {
|
async function syncFile(path: string): Promise<void> {
|
||||||
const handle = await open(path, 'r');
|
// Windows FlushFileBuffers requires a writable handle; POSIX allows fsync on 'r'.
|
||||||
|
const handle = await open(path, process.platform === 'win32' ? 'r+' : 'r');
|
||||||
try {
|
try {
|
||||||
await handle.sync();
|
await handle.sync();
|
||||||
} finally {
|
} finally {
|
||||||
@@ -168,6 +169,7 @@ async function syncFile(path: string): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function syncDirectory(path: string): Promise<void> {
|
async function syncDirectory(path: string): Promise<void> {
|
||||||
|
if (process.platform === 'win32') return; // directory fsync only exists on POSIX
|
||||||
const handle = await open(path, 'r');
|
const handle = await open(path, 'r');
|
||||||
try {
|
try {
|
||||||
await handle.sync();
|
await handle.sync();
|
||||||
|
|||||||
@@ -254,12 +254,15 @@ export async function appendReleaseEvidence(
|
|||||||
await handle.close();
|
await handle.close();
|
||||||
}
|
}
|
||||||
await rename(temporary, absolute);
|
await rename(temporary, absolute);
|
||||||
|
if (process.platform !== 'win32') {
|
||||||
|
// directory fsync only exists on POSIX
|
||||||
const directory = await open(parent, 'r');
|
const directory = await open(parent, 'r');
|
||||||
try {
|
try {
|
||||||
await directory.sync();
|
await directory.sync();
|
||||||
} finally {
|
} finally {
|
||||||
await directory.close();
|
await directory.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return Object.freeze(record);
|
return Object.freeze(record);
|
||||||
} finally {
|
} finally {
|
||||||
await lock.close();
|
await lock.close();
|
||||||
|
|||||||
@@ -30,6 +30,14 @@ export default defineConfig(
|
|||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'no-undef': 'off',
|
'no-undef': 'off',
|
||||||
|
'@typescript-eslint/no-unused-vars': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
argsIgnorePattern: '^_',
|
||||||
|
varsIgnorePattern: '^_',
|
||||||
|
caughtErrorsIgnorePattern: '^_',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { RequestCoordinator } from '../public/state/request-coordinator.js'
|
|||||||
import { createApiClient } from '../public/infrastructure/api-client.js'
|
import { createApiClient } from '../public/infrastructure/api-client.js'
|
||||||
import { createViewRouter } from '../public/router/view-router.js'
|
import { createViewRouter } from '../public/router/view-router.js'
|
||||||
|
|
||||||
const projectRoot = path.resolve(path.dirname(new URL(import.meta.url).pathname), '..')
|
const projectRoot = path.resolve(import.meta.dirname, '..')
|
||||||
|
|
||||||
async function files(instances = []) {
|
async function files(instances = []) {
|
||||||
const dir = await mkdtemp(path.join(tmpdir(), 'msa-blockers-'))
|
const dir = await mkdtemp(path.join(tmpdir(), 'msa-blockers-'))
|
||||||
|
|||||||
Reference in New Issue
Block a user