Skip to content

refactor(analyze): split AnalyzerConfig into type/id/display_name#2376

Draft
ryan-arman wants to merge 2 commits intoryan-arman/analyze-cli-v2from
ryan-arman/analyze-config-v2-naming
Draft

refactor(analyze): split AnalyzerConfig into type/id/display_name#2376
ryan-arman wants to merge 2 commits intoryan-arman/analyze-cli-v2from
ryan-arman/analyze-config-v2-naming

Conversation

@ryan-arman
Copy link
Copy Markdown
Contributor

@ryan-arman ryan-arman commented Apr 17, 2026

Description

Part of the analyze v2 split of #2370 (Phase 2 of 4).

Reshapes AnalyzerConfig into three fields with distinct responsibilities:

Today id always defaults to display_name, so YAMLs that only set display_name keep working unchanged. The split exists so that in the future the API can mint stable asset ids for analyzers while display_name remains purely cosmetic (and need not be unique).

Key behavior changes:

  • Uniqueness is now enforced on id, not display_name. Two analyzers may share a display_name as long as their id values differ.
  • Test metric paths use id: "{id}.{field_name}". When id is omitted, this still equals "{display_name}.{field_name}".
  • Legacy instance_id YAML key still maps to display_name with a DeprecationWarning.
  • Pre-refactor(analyze): split AnalyzerConfig into type/id/display_name #2376 YAMLs that used id in place of type now fail loudly with "type is required" — id has new semantics.

Also:

  • Adds an AnalyzerType enum for the built-in analyzers (length, quality, turn_stats).
  • Updates CLI, example YAML, and analyze docs to the new shape.
  • Expands tests to cover the id/display_name split, duplicate-id detection, and the legacy instance_id alias.

Design doc: docs/superpowers/specs/2026-04-17-analyzer-config-id-design.md (on main).

Dependencies: Stacked on #2375 (Phase 1 — CLI migration). Rebase to main once that lands.

Related issues

Linear Issue: OPE-1868
Towards OPE-1868

Before submitting

  • This PR only changes documentation. (You can ignore the following checks in that case)
  • Did you read the contributor guideline Pull Request guidelines?
  • Did you link the issue(s) related to this PR in the section above?
  • Did you add / update tests where needed?

🤖 Generated with Claude Code

Rename `AnalyzerConfig.id` -> `type` and `AnalyzerConfig.instance_id` ->
`display_name` to align with the API's `AnalyzerConfigInput` shape. The
legacy `id`/`instance_id` YAML keys continue to parse as aliases so
existing configs still work.

Also adds an `AnalyzerType` enum for the built-in analyzers and updates
the CLI, example YAML, docs, and tests to the new field names.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@gitar-bot
Copy link
Copy Markdown

gitar-bot bot commented Apr 17, 2026

Gitar is working

Gitar

Adds a stable `id` field alongside `display_name` on AnalyzerConfig so
results, caches, and test metric paths key on a single canonical
identity that is independent of the human-readable label. When omitted,
`id` defaults to `display_name`, which defaults to `type` — preserving
today's behavior exactly.

The separation makes room for the API's next iteration, where
user-created analyzer assets get a generated `id` and the user is free
to rename `display_name` without invalidating results.

Details:
- AnalyzerConfig: new `id: str` field; `__post_init__` defaults it to
  `display_name`. Field order: `type`, `id`, `display_name`, `params`.
- CLI: `analyzer.analyzer_id = cfg.id` (was `cfg.display_name`).
- `_parse_analyzers`: validates uniqueness on `id`; `display_name` may
  repeat. Drops the legacy `id`->`type` YAML alias (pre-#2376). Keeps
  `instance_id`->`display_name` alias for one release with a
  DeprecationWarning.
- `to_dict`: emits `id` alongside `type` and `display_name`.
- Docs + example YAML: document the new field and relaxed display_name
  uniqueness rule.
- Tests cover default chaining, explicit id, duplicate-id rejection,
  duplicate-display-name-with-distinct-ids acceptance, legacy
  instance_id warning, legacy id-as-type rejection, and to_dict round
  trip.

Spec: docs/superpowers/specs/2026-04-17-analyzer-config-id-design.md

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@ryan-arman ryan-arman changed the title refactor(analyze): rename AnalyzerConfig fields to type/display_name refactor(analyze): split AnalyzerConfig into type/id/display_name Apr 17, 2026
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.

1 participant