Skip to content

fix(component): omitted --project resolves to first configured project - #666

Merged
padak merged 1 commit into
mainfrom
claude/youthful-bhabha-de1811
Aug 23, 2026
Merged

fix(component): omitted --project resolves to first configured project#666
padak merged 1 commit into
mainfrom
claude/youthful-bhabha-de1811

Conversation

@padak

@padak padak commented Aug 23, 2026

Copy link
Copy Markdown
Member

Problem

kbagent component detail --component-id ID without --project fails with

CONFIG_ERROR: Project 'None' not found in .../config.json ...

even though the option's help text says "Project alias (uses first available if not set)". The same reachable bug affects kbagent config new in scaffold-only mode (no --push), whose --project is also documented as optional.

Root cause

commands/component.py::component_detail passes alias=None to ComponentService.get_component_detail, which calls self.resolve_projects([alias]). BaseService.resolve_projects only falls back to "all projects" when the alias list is empty/None[None] is a truthy list, so it takes the strict lookup path and raises project_not_found_error(None). get_config_examples in the same service already implemented the correct normalisation.

Fix

  • New ComponentService._resolve_alias_or_first(alias) helper (returns a frozen ResolvedProject dataclass per CONTRIBUTING's multi-value-return rule): resolves a given alias strictly, falls back to the first configured project when omitted, and raises an actionable ConfigError ("No projects configured...") when the config is empty.
  • get_component_detail and generate_scaffold now use it (signatures widened to alias: str | None); the detail payload's project_alias reports the alias actually used, on both the AI Service and Storage-catalog fallback paths.
  • get_config_examples refactored onto the same helper (behavior unchanged).
  • Checked, deliberately unchanged: run_sync_actioncomponent sync-action's --project is a required Typer option (exit 2 without it) and the serve router resolves a pinned alias before calling, so None can never reach it. Server routers untouched.

Tests

TDD: all four new tests first failed with the reported Project 'None' not found error, then passed after the fix.

  • TestGetComponentDetail: alias=None resolves to the single configured project (and project_alias reports it); no projects configured → ConfigError.
  • TestGenerateScaffold: same two cases for the config new scaffold path.

Full suite: 6026 passed, 181 skipped. Lint/format/ty clean; version-gate-check, skill-check, command-sync-check, check-sentinel-guards all pass.

Docs

gotchas.md gains a (since vNEXT) section and commands-reference.md two one-line notes: on <= 0.89.x these two commands need an explicit --project despite the help text. No version bump, no changelog entry (feature-PR rules per #648).


Open in Devin Review

component detail --component-id ID and config new (scaffold-only) document
--project as optional, but passing the omitted alias through as [None] hit
BaseService.resolve_projects' strict path and failed with CONFIG_ERROR
"Project 'None' not found". Resolve an omitted alias to the first
configured project (the pattern get_config_examples already used), via a
shared ComponentService._resolve_alias_or_first helper returning a
ResolvedProject dataclass; with no projects configured the failure is an
actionable "No projects configured" ConfigError, and project_alias in the
detail payload reports the alias actually used.

component sync-action is unaffected (--project is genuinely required on the
CLI); server routers already resolve a pinned alias and are unchanged.
Gotchas + commands-reference tagged (since vNEXT) per the release process.

@devin-ai-integration devin-ai-integration 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@padak
padak merged commit 458e52d into main Aug 23, 2026
5 checks passed
@padak
padak deleted the claude/youthful-bhabha-de1811 branch August 23, 2026 20:23
@padak padak mentioned this pull request Aug 23, 2026
10 tasks
padak added a commit that referenced this pull request Aug 23, 2026
* chore(release): 0.90.0

Bumps pyproject.toml to 0.90.0 and adds the changelog entry covering every
PR merged since v0.89.0 (#658, #662, #661, #663, #665, #666, #664, #668,
#667, #623), resolves the vNEXT placeholders those PRs left behind, and
adds the curated What's new reel for the release.

* docs(web-server): keep the What's-new anchor stable across releases

The '### What's-new popup *(since vNEXT)*' heading put the version gate in
the heading itself, so resolving the placeholder to 0.90.0 changed the
generated slug to 'whats-new-popup-since-0900' and broke the in-page link
at line 138 -- and would have broken it again on every future release.

Moved the '(since 0.90.0)' tag to the first body line: the anchor is now
the stable 'whats-new-popup', the gate stays visible, and
check_version_gates.py still sees it (it scans the whole file, not just
headings).
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