Skip to content

Commit 7038b05

Browse files
bloveclaude
andauthored
fix(deploy): restore shared-deployment namespace merge broken by src/__init__.py (#825)
cockpit/langgraph/client-tools shipped an empty src/__init__.py (#642) that turned its src into a regular package; per PEP 420 that wins over every other dep's namespace portion, so c-interrupts' 'from src.aviation_tools import' raised ModuleNotFoundError at startup and every revision since Aug 7 hit DEPLOY_FAILED (production smoke timeouts were the wedged run queue). Delete the file and make the manifest generator throw if any staged dep reintroduces one. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent d2d980b commit 7038b05

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

cockpit/langgraph/client-tools/python/src/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

scripts/generate-shared-deployment-config.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { cpSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'fs';
1+
import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'fs';
22
import { dirname, resolve } from 'path';
33
import { capabilities } from '../apps/cockpit/scripts/capability-registry';
44

@@ -41,6 +41,19 @@ const stageDependency = (sourceRoot: string, alias: string): string => {
4141
const stagedDir = resolve(stagedDependenciesDir, alias);
4242
cpSync(sourceDir, stagedDir, { recursive: true });
4343

44+
// Every dep ships a `src/` package and they must all merge as PEP 420
45+
// namespace portions on the deployment's sys.path. A single
46+
// `src/__init__.py` turns that dep's `src` into a REGULAR package which
47+
// wins exclusively, so every other dep's `from src.x import ...` raises
48+
// ModuleNotFoundError at startup and the whole revision fails to deploy
49+
// (this exact failure shipped in #642 and broke deploys from Aug 7).
50+
const initPy = resolve(stagedDir, 'src/__init__.py');
51+
if (existsSync(initPy)) {
52+
throw new Error(
53+
`${sourceRoot}/src/__init__.py breaks the shared deployment's namespace-package merge — delete it (deps' src dirs must be namespace packages)`,
54+
);
55+
}
56+
4457
const relativePath = `./deps/${alias}`;
4558
stagedDependencyRoots.set(sourceRoot, relativePath);
4659
dependencies.add(relativePath);

0 commit comments

Comments
 (0)