Skip to content

Hide unlabeled legacy traces from default CLI discovery - #23

Closed
maxdeichmann wants to merge 2 commits into
mainfrom
cursor/hide-legacy-cli-resources-4a43
Closed

maxdeichmann wants to merge 2 commits into
mainfrom
cursor/hide-legacy-cli-resources-4a43

Conversation

@maxdeichmann

@maxdeichmann maxdeichmann commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Agents were treating traces as a current resource because default api schema / help listed it next to observations and legacy-observations, with summaries like “Get list of traces”. There was no legacy-traces-v1 name, so generated clients followed traces list / trace get.

Changes

  • Unversioned deprecated commands now compile to legacy-<resource>-v1 (so GET traces is legacy-traces-v1, matching legacy-observations-v1).
  • Default api help and api schema --json omit deprecated Cloud v3 operations. Pass --include-deprecated to list them, or --api-version 3 for self-hosted v3 snapshots where traces list remains a current command.
  • Help and schema labels for remaining deprecated trace/observation reads use deprecated; Cloud removal 2026-11-16; use observations list / Observations API v2.
  • Deprecated operations still cannot be called on the latest snapshot; aliases such as traces list keep resolving so the error names the replacement instead of “unknown action”.

Out of scope

SDK docstrings (api.trace.*, fetch_trace*) live in the Langfuse SDK repos, not this CLI.

Verification

  • bun test and bun run typecheck
  • bun run goldens:update for 4.10.0 / 4.35.0 command surfaces
  • bun run conformance:all — 596/596
  • Built CLI smoke: default schema has traces delete-only (no list/get), legacy-traces-v1 only with --include-deprecated, and --api-version 3 still exposes traces list/get
Open in Web Open in Cursor 

Rename unversioned deprecated resources to legacy-*-v1, omit them from
default help/schema unless --include-deprecated, and label remaining help
with Cloud removal plus the Observations API v2 recipe. Self-hosted v3
snapshots keep traces as current commands.

Co-authored-by: Max Deichmann <max@langfuse.com>
@maxdeichmann
maxdeichmann marked this pull request as ready for review September 15, 2026 10:38

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Comment thread src/cli.ts Outdated
Comment on lines +364 to +365
.replace(/^\*\*Deprecated:?\*\*\s*/i, "")
.replace(/^Deprecated:?\s*/i, "")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 (optional) Users now see raw **Deprecated.** markdown leak into CLI error and help text for operations whose OpenAPI description uses the period style (e.g. Prompts). The regex was changed from /^\*\*Deprecated\.\*\*\s*/i to /^\*\*Deprecated:?\*\*\s*/i (and similarly for the plain-text variant), which only strips a colon or no punctuation after "Deprecated", not a period, so descriptions like "Deprecated. Use GET /api/public/v3/prompts instead." (still used in src/cli.test.ts:232) are no longer stripped. Fix: match both . …

Extended reasoning...

…and : (or make the punctuation optional/any), e.g. /^\*\*Deprecated[.:]?\*\*\s*/i and /^Deprecated[.:]?\s*/i, so both legacy period-style and new colon-style deprecation descriptions are stripped in assertOperationCallable and printOperationHelp.

explicitDeprecationNote (src/cli.ts:357-366) is called from assertOperationCallable (src/cli.ts:402) and printOperationHelp (src/cli.ts:518). It takes operation.description, splits on blank line, then strips a leading 'Deprecated.' or 'Deprecated.' marker before returning the human note. The new regexes only allow an optional colon between 'Deprecated' and the closing '' (or a colon after plain 'Deprecated'), not a period. For description 'Deprecated. Use GET /api/public/v3/prompts instead.' neither regex matches at position 0 (string starts with '' then 'Deprecated.' — period breaks the :? branch, and the plain-text regex also anchors at '^Deprecated' which fails because the string actually starts with '**'). So the full raw string, including the literal markdown bold markers and period, is returned unstripped…

Verification: normal (cosmetic regression): The diff changed src/cli.ts:364-365 from /^\*\*Deprecated\.\*\*\s*/i + /^Deprecated\.?\s*/i to /^\*\*Deprecated:?\*\*\s*/i + /^Deprecated:?\s*/i. The new markdown-variant regex requires **Deprecated followed by an optional colon and then **; it does NOT match the period style **Deprecated.** (after Deprecated the next char is ., so…

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. explicitDeprecationNote now matches **Deprecated.** and **Deprecated:** (and the plain-text equivalents), and the prompts test asserts the error no longer contains the markdown marker.

The OpenAPI note parser must accept **Deprecated.** as well as
**Deprecated:** so CLI errors do not leak markdown.

Co-authored-by: Max Deichmann <max@langfuse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants