Skip to content

refactor(artifact): extract info operation - #4882

Merged
mnriem merged 3 commits into
github:mainfrom
mnriem:mnriem-artifact-info-operation
Oct 8, 2026
Merged

mnriem merged 3 commits into
github:mainfrom
mnriem:mnriem-artifact-info-operation

Conversation

@mnriem

@mnriem mnriem commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • extract the typed, transport-independent artifact.info logical operation beneath specify artifact info
  • refactor the existing CLI command into a thin adapter while preserving its exact JSON, stream, error, and exit-code behavior
  • add positive, negative, parity, isolation, Unicode, hook, layering, and error-conversion coverage

Architecture

The new operation uses explicit project context and does not depend on process cwd, SPECIFY_INIT_DIR, Typer, Rich, MCP, CLI consoles, subprocesses, or os.chdir().

  • operation ID: artifact.info
  • contract version: 1
  • capability: local-read
  • network access: none
  • request: explicit absolute project directory, artifact identifier, and optional established artifact kind
  • result: typed named-artifact or hook-artifact data preserving the complete ordered composition stack
  • expected failures: project path/project validation, invalid kind or identifier, unknown/ambiguous artifacts, unknown hooks, resolution/filesystem failures, and invalid catalog results

Pure request validation, including identifier grammar, runs before state-dependent Spec Kit project validation. This deliberately does not add or register an MCP adapter. The artifact MCP inventory keeps artifact.info unavailable while sourcing its contract version, capabilities, and network metadata from the shared descriptor.

Validation

  • .venv/bin/python -m pytest -q tests/specify_cli/artifacts/test_operation_info.py tests/specify_cli/artifacts/test_command_info.py --cov=specify_cli.artifacts._operation_info --cov=specify_cli.artifacts.command_info --cov-report=term-missing --cov-branch — 69 passed; 100% statements and 100% branches
  • LC_ALL=en_US.UTF-8 .venv/bin/python -m pytest -q tests/specify_cli/artifacts tests/specify_cli/test_command_mcp.py tests/specify_cli/test_mcp_version.py — 288 passed
  • LC_ALL=en_US.UTF-8 .venv/bin/python -m pytest -q — 10,136 passed, 19 skipped
  • uvx ruff check src/specify_cli/artifacts/_operation_info.py tests/specify_cli/artifacts/test_operation_info.py — passed
  • uvx ruff format --check src/specify_cli/artifacts/_operation_info.py tests/specify_cli/artifacts/test_operation_info.py — passed
  • git diff --check — passed
  • full pytest collection increased from 10,087 to 10,155 after rebasing onto current upstream/main

Scope audit

No changes were made to artifact list pagination or MCP response budgets, artifacts/mcp_list.py, artifacts/_operation_list.py, artifact lookup, MCP tool registration, or JSON contract normalization. The only MCP inventory change keeps artifact.info unavailable while aligning its static metadata and reason with the new shared descriptor.

AI disclosure

This pull request and its review fixes were implemented and validated autonomously by GitHub Copilot using GPT-5.6 Sol on behalf of @mnriem. The maintainer explicitly approved opening this fourth concurrent pull request after being informed that repository policy may assign it lower review priority.

Copilot AI balanced review requested due to automatic review settings October 8, 2026 13:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Error classification and MCP inventory metadata remain inconsistent with the new operation contract.

3 open findings
What changed in this PR

Extracts artifact.info into a typed, transport-independent operation while retaining the CLI adapter.

Changes:

  • Adds typed request, result, descriptor, and error contracts.
  • Refactors the CLI command to dispatch through the shared operation.
  • Adds operation and CLI parity/error coverage.
File Description
src/​specify_cli/​artifacts/​_operation_info.py Implements the shared operation and contracts.
src/​specify_cli/​artifacts/​command_info.py Converts the CLI into a thin adapter.
tests/​specify_cli/​artifacts/​test_operation_info.py Tests operation behavior and validation.
tests/​specify_cli/​artifacts/​test_command_info.py Tests CLI mapping and output compatibility.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread src/specify_cli/artifacts/_operation_info.py Outdated
Comment thread src/specify_cli/artifacts/_operation_info.py Outdated
Comment thread src/specify_cli/artifacts/_operation_info.py
mnriem and others added 2 commits October 8, 2026 08:32
Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 8, 2026 13:41
@mnriem
mnriem force-pushed the mnriem-artifact-info-operation branch from aa27210 to c4c6aa3 Compare October 8, 2026 13:41
@mnriem

mnriem commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed all findings from review 5457087760 in c4c6aa3667e359cbd649ae5f7c08d9da0d2bbe51:

  • explicit non-hook kinds now take precedence over conflicting hook: shorthand when classifying not-found errors
  • accepted artifact identifier grammar is validated before catalog lookup, including unknown prefixes and malformed named/hook IDs, while explicit hook event:command identifiers remain supported
  • the unavailable artifact.info MCP inventory entry now sources contract version, capabilities, and network metadata from the shared descriptor and states that the adapter is not yet implemented

Validation after rebasing onto current upstream/main: 68 focused tests with 100% statement/branch coverage, 287 artifact/MCP regressions, and the full suite at 10,135 passed / 19 skipped. Ruff, formatting, and git diff --check pass.

AI disclosure: this review round was implemented, validated, and summarized autonomously by GitHub Copilot using GPT-5.6 Sol on behalf of @mnriem.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Structural identifier validation must precede state-dependent project validation to follow the shared operation lifecycle.

1 open finding
3 resolved since last review

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread src/specify_cli/artifacts/_operation_info.py Outdated
Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 8, 2026 15:54
@mnriem

mnriem commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed review 5457561822 in a10794f4699b39ff9323bc92903a9b4f89b2a811 by moving structural identifier validation ahead of the .specify project-state check. A malformed identifier now deterministically returns invalid_artifact_identifier even when the selected directory is not a Spec Kit project. Added a regression proving the catalog is not reached and pure request validation takes precedence.

Validation: 69 focused tests with 100% statement/branch coverage, 288 artifact/MCP regressions, and the full suite at 10,136 passed / 19 skipped. Ruff, formatting, and git diff --check pass.

AI disclosure: this review round was implemented, validated, and summarized autonomously by GitHub Copilot using GPT-5.6 Sol on behalf of @mnriem.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The implementation follows the shared-operation architecture and includes thorough positive, negative, parity, and isolation coverage.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@mnriem
mnriem merged commit 41eecf8 into github:main Oct 8, 2026
15 checks passed
@mnriem
mnriem deleted the mnriem-artifact-info-operation branch October 8, 2026 16:22
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