mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-22 16:51:28 +02:00
## Thinking Path > - Paperclip manages AI agents for work. > - Paperclip includes an observability path that operators can enable for tracing. > - The server loads several OpenTelemetry packages only when tracing is enabled. > - The documentation calls these packages optional peer dependencies, but the server manifest does not declare them. > - This gap hides supported versions and stops Dependabot from maintaining the packages. > - This pull request aligns package metadata, runtime checks, and documentation with the opt-in tracing design. > - The change gives operators clear installation behavior and keeps the no-op default. ## Linked Issues or Issue Description This pull request fixes a package metadata and installation defect. Related observability work appears in [#8476](https://github.com/paperclipai/paperclip/pull/8476) and [#9672](https://github.com/paperclipai/paperclip/pull/9672). The server documentation described optional OpenTelemetry peer dependencies, but `server/package.json` did not declare them. Package managers and Dependabot could not see the supported version ranges. The UI and Claude local adapter also relied on automatic peer installation for `yjs` and `@anthropic-ai/sdk`. The package manifests now declare the optional runtime packages. A default install does not install optional tracing peers. The server keeps its no-op behavior when tracing is disabled or a peer is absent. ## What Changed - Add seven optional OpenTelemetry packages to `server/package.json` and mark each package as optional. - Keep `@opentelemetry/api` as a normal dependency for the no-op interface. - Disable automatic peer installation in `.npmrc`. - Declare `yjs` for the UI package and `@anthropic-ai/sdk` for the Claude local adapter. - Check declared peer versions before the server loads a dynamic OpenTelemetry import. - Keep the endpoint gate, dynamic imports, and fail-open behavior unchanged. - Update the observability and README documentation. - Tell Dependabot that its npm parser does not read `peerDependencies`. ## Verification - Targeted server tests pass: 34 passed and 2 skipped. - The skipped tests require the real OpenTelemetry SDK and remain pre-existing. - The pull request workflow regenerates the lockfile because manifest files and `.npmrc` changed. - The policy job confirms that the pull request does not include `pnpm-lock.yaml`. - GitHub checks pass except `security/snyk (cryppadotta)`, which remains pending after its authorized wait cap. - Greptile Review reports 5/5 with no open findings. - Server typecheck passes. ## Risks - Optional peers can produce a diagnostic when the installed version does not match the declared range. - A missing optional peer does not stop the server. - Disabling automatic peer installation can expose undeclared package use in other workspaces. - This pull request declares the affected packages and adds tests for the changed behavior. - This pull request makes no database or API changes. ## Model Used OpenAI Codex, GPT-5, with repository inspection and pull request preparation. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with Fixes / Closes / Refs OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links - [x] My branch name describes the change and contains no internal Paperclip ticket id - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
54 lines
2.0 KiB
TypeScript
54 lines
2.0 KiB
TypeScript
import { readFileSync } from "node:fs";
|
|
import { fileURLToPath } from "node:url";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
/**
|
|
* The seven OpenTelemetry packages `server/src/instrumentation.ts` loads
|
|
* through a dynamic import. Each one must be an optional peer dependency, not
|
|
* a normal dependency, so a default install never pulls in the SDK. This test
|
|
* guards the manifest half of that contract; `instrumentation.test.ts` guards
|
|
* the runtime half (the bootstrap fails open when a package is absent).
|
|
*/
|
|
|
|
const OPTIONAL_OTEL_PACKAGES = [
|
|
"@opentelemetry/sdk-node",
|
|
"@opentelemetry/auto-instrumentations-node",
|
|
"@opentelemetry/resources",
|
|
"@opentelemetry/semantic-conventions",
|
|
"@opentelemetry/exporter-trace-otlp-grpc",
|
|
"@opentelemetry/exporter-trace-otlp-proto",
|
|
"@opentelemetry/exporter-trace-otlp-http",
|
|
] as const;
|
|
|
|
const packageJsonPath = fileURLToPath(new URL("../../package.json", import.meta.url));
|
|
|
|
describe("server package OpenTelemetry peer metadata", () => {
|
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8")) as {
|
|
dependencies?: Record<string, string>;
|
|
devDependencies?: Record<string, string>;
|
|
peerDependencies?: Record<string, string>;
|
|
peerDependenciesMeta?: Record<string, { optional?: boolean }>;
|
|
};
|
|
|
|
it.each(OPTIONAL_OTEL_PACKAGES)(
|
|
"declares %s as an optional peer dependency",
|
|
(packageName) => {
|
|
expect(packageJson.peerDependencies?.[packageName]).toBeDefined();
|
|
expect(packageJson.peerDependenciesMeta?.[packageName]?.optional).toBe(true);
|
|
},
|
|
);
|
|
|
|
it.each(OPTIONAL_OTEL_PACKAGES)(
|
|
"does not list %s in dependencies or devDependencies",
|
|
(packageName) => {
|
|
expect(packageJson.dependencies?.[packageName]).toBeUndefined();
|
|
expect(packageJson.devDependencies?.[packageName]).toBeUndefined();
|
|
},
|
|
);
|
|
|
|
it("keeps @opentelemetry/api as a normal dependency", () => {
|
|
expect(packageJson.dependencies?.["@opentelemetry/api"]).toBeDefined();
|
|
expect(packageJson.peerDependencies?.["@opentelemetry/api"]).toBeUndefined();
|
|
});
|
|
});
|