mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-06 08:24:46 +00:00
fix(usage): preserve platform test contracts
This commit is contained in:
@@ -11,6 +11,7 @@ interface PageLayoutProps {
|
||||
/** Compact back button. Defaults to navigating back. */
|
||||
onBack?: () => void;
|
||||
testID?: string;
|
||||
titleTestID?: string;
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
@@ -19,7 +20,7 @@ interface PageLayoutProps {
|
||||
* document heading inside the page and the header only keeps the titlebar drag
|
||||
* region and window controls; on compact the title moves into a back header.
|
||||
*/
|
||||
export function PageLayout({ title, onBack, testID, children }: PageLayoutProps) {
|
||||
export function PageLayout({ title, onBack, testID, titleTestID, children }: PageLayoutProps) {
|
||||
const isCompact = useIsCompactFormFactor();
|
||||
const insets = useSafeAreaInsets();
|
||||
const scrollContentStyle = useMemo(() => ({ paddingBottom: insets.bottom }), [insets.bottom]);
|
||||
@@ -31,7 +32,7 @@ export function PageLayout({ title, onBack, testID, children }: PageLayoutProps)
|
||||
<ScrollView style={styles.scroll} contentContainerStyle={scrollContentStyle} testID={testID}>
|
||||
<View style={styles.content}>
|
||||
{showTitle ? (
|
||||
<Text style={styles.title} testID="page-title">
|
||||
<Text style={styles.title} testID={titleTestID ?? "page-title"}>
|
||||
{title}
|
||||
</Text>
|
||||
) : null}
|
||||
|
||||
@@ -1478,7 +1478,9 @@ export default function SettingsScreen({ view, openAddHostIntent = null }: Setti
|
||||
</WindowChromeRegion>
|
||||
<WindowChromeRegion corners="top-right">
|
||||
<View style={desktopStyles.contentPane} testID="settings-detail-pane">
|
||||
<PageLayout title={detailTitle}>{content}</PageLayout>
|
||||
<PageLayout title={detailTitle} titleTestID="settings-detail-header-title">
|
||||
{content}
|
||||
</PageLayout>
|
||||
</View>
|
||||
</WindowChromeRegion>
|
||||
</View>
|
||||
|
||||
@@ -242,13 +242,18 @@ test("named profile ignores agent override and uses existing XDG profile data",
|
||||
);
|
||||
profileDb.close();
|
||||
expect(
|
||||
resolveOmpUsageReference("session-1", "openai-codex", {
|
||||
OMP_PROFILE: "work",
|
||||
PI_PROFILE: "other",
|
||||
PI_CODING_AGENT_DIR: f.agentDir,
|
||||
PI_CONFIG_DIR: join(root, "config"),
|
||||
XDG_DATA_HOME: join(root, "xdg"),
|
||||
}),
|
||||
resolveOmpUsageReference(
|
||||
"session-1",
|
||||
"openai-codex",
|
||||
{
|
||||
OMP_PROFILE: "work",
|
||||
PI_PROFILE: "other",
|
||||
PI_CODING_AGENT_DIR: f.agentDir,
|
||||
PI_CONFIG_DIR: join(root, "config"),
|
||||
XDG_DATA_HOME: join(root, "xdg"),
|
||||
},
|
||||
"linux",
|
||||
),
|
||||
).toEqual({ source: "codex", input: { accessToken: "profile-token" } });
|
||||
});
|
||||
|
||||
|
||||
@@ -129,6 +129,7 @@ export function resolveOmpUsageReference(
|
||||
sessionId: string,
|
||||
provider: string,
|
||||
env: NodeJS.ProcessEnv,
|
||||
platform: NodeJS.Platform = process.platform,
|
||||
): UsageReference | null {
|
||||
let source: string;
|
||||
if (provider === "openai-codex") source = "codex";
|
||||
@@ -136,7 +137,7 @@ export function resolveOmpUsageReference(
|
||||
else return null;
|
||||
if (!sessionId) return null;
|
||||
// Upstream: packages/utils/src/dirs.ts:82-94,330-343,583-585 (profile, override, agent dir).
|
||||
const paths = resolveOmpDiagnosticPaths(env);
|
||||
const paths = resolveOmpDiagnosticPaths(env, undefined, platform);
|
||||
if (hasKeyOverride(provider, env, paths.agentDir)) return null;
|
||||
let db: UsageDb;
|
||||
try {
|
||||
|
||||
@@ -29,7 +29,7 @@ async function checkInternalPluginBoundary(directory: string): Promise<void> {
|
||||
if (hostModules.has(specifier) || isBuiltin(specifier)) continue;
|
||||
const resolved = reader.resolve(specifier, file, dependency.kind);
|
||||
const relative = resolved && path.relative(directory, resolved);
|
||||
const owned = relative && /^(server|shared)\//.test(relative);
|
||||
const owned = relative && /^(server|shared)[\\/]/.test(relative);
|
||||
if (!specifier.startsWith(".") || !owned) {
|
||||
throw new Error(`Internal plugin import boundary: ${file} imports ${specifier}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user