Keep dev green after moving the active worktree snapshot
The transferred dev snapshot was not publication-ready yet: full tests still failed because worktree-local docs resolution assumed a repo-root node_modules tree, some protocol expectations no longer matched the refactored request bridges, oauth/account-token route tests reused stale modules after resetting DATA_DIR, and model discovery still fired unawaited default-token writes. This follow-up makes the moved dev branch self-consistent and green again by stabilizing module/test isolation, awaiting token mirroring writes, and aligning narrow tests with the current transformer and request-builder contracts. Constraint: The fix set had to stay narrow and unblock the new dev branch without reworking the broader transferred refactor Rejected: Revert the transferred snapshot | would lose the user's requested dev-branch continuation point Confidence: medium Scope-risk: moderate Reversibility: clean Directive: If more DATA_DIR-scoped API test files start flaking under shared workers, reset modules before importing singleton db/config modules instead of relying on process env mutation alone Tested: git diff --check; npm run typecheck; npm run repo:drift-check; npm test Not-tested: Live OAuth/provider flows outside the mocked test harness
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { existsSync, globSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import { dirname, resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import config from './config';
|
||||
@@ -36,11 +36,21 @@ const getAlias = (aliasConfig: unknown, specifier: string): string | undefined =
|
||||
const repoRoot = fileURLToPath(new URL('../..', import.meta.url));
|
||||
|
||||
const getExpectedEntry = (hoistedRelativePath: string, pnpmPattern: string) => {
|
||||
const hoistedEntry = resolve(repoRoot, hoistedRelativePath);
|
||||
if (existsSync(hoistedEntry)) return hoistedEntry;
|
||||
let currentRoot = repoRoot;
|
||||
|
||||
const [pnpmEntry] = globSync(resolve(repoRoot, pnpmPattern));
|
||||
return pnpmEntry;
|
||||
while (true) {
|
||||
const hoistedEntry = resolve(currentRoot, hoistedRelativePath);
|
||||
if (existsSync(hoistedEntry)) return hoistedEntry;
|
||||
|
||||
const [pnpmEntry] = globSync(resolve(currentRoot, pnpmPattern));
|
||||
if (pnpmEntry) return pnpmEntry;
|
||||
|
||||
const parentRoot = dirname(currentRoot);
|
||||
if (parentRoot === currentRoot) break;
|
||||
currentRoot = parentRoot;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
describe('docs vitepress config', () => {
|
||||
|
||||
@@ -1,17 +1,28 @@
|
||||
import { existsSync, globSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import { dirname, resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { defineConfig } from 'vitepress';
|
||||
import { withMermaid } from 'vitepress-plugin-mermaid';
|
||||
|
||||
const repoRoot = fileURLToPath(new URL('../..', import.meta.url));
|
||||
const resolveDependencyEntry = (hoistedRelativePath: string, pnpmPattern: string) => {
|
||||
const hoistedEntry = resolve(repoRoot, hoistedRelativePath);
|
||||
if (existsSync(hoistedEntry)) return hoistedEntry;
|
||||
|
||||
const [pnpmEntry] = globSync(resolve(repoRoot, pnpmPattern));
|
||||
return pnpmEntry;
|
||||
};
|
||||
function resolveDependencyEntry(hoistedRelativePath: string, pnpmPattern: string) {
|
||||
let currentRoot = repoRoot;
|
||||
|
||||
while (true) {
|
||||
const hoistedEntry = resolve(currentRoot, hoistedRelativePath);
|
||||
if (existsSync(hoistedEntry)) return hoistedEntry;
|
||||
|
||||
const [pnpmEntry] = globSync(resolve(currentRoot, pnpmPattern));
|
||||
if (pnpmEntry) return pnpmEntry;
|
||||
|
||||
const parentRoot = dirname(currentRoot);
|
||||
if (parentRoot === currentRoot) break;
|
||||
currentRoot = parentRoot;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const dayjsEsmEntry = resolveDependencyEntry(
|
||||
'node_modules/dayjs/esm/index.js',
|
||||
|
||||
Reference in New Issue
Block a user