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:
cita-777
2026-04-17 19:59:14 +08:00
parent 88f40e91f7
commit f67ade2e59
8 changed files with 44 additions and 17 deletions
@@ -100,7 +100,7 @@ describe('proxy route architecture boundaries', () => {
it('keeps codex responses normalization behind transformer helpers', () => {
const source = readSource('./upstreamEndpoint.ts');
expect(source).toContain("from '../../transformers/openai/responses/codexCompatibility.js'");
expect(source).toContain("from '../../services/upstreamRequestBuilder.js'");
expect(source).not.toContain('function ensureCodexResponsesInstructions(');
expect(source).not.toContain('function ensureCodexResponsesStoreFalse(');
expect(source).not.toContain('function stripCodexUnsupportedResponsesFields(');
-1
View File
@@ -867,7 +867,6 @@ describe('gemini native proxy routes', () => {
expect(JSON.parse(String(requestInit.body))).toEqual({
model: 'gpt-4.1',
stream: false,
max_output_tokens: 4096,
input: [
{
type: 'message',