Skip to content

refactor(spec): use local diagnostics in reports and CLI - #841

Merged
yeongseon merged 1 commit into
mainfrom
refactor/spec-report-cli-local-diagnostics-819
Oct 26, 2026
Merged

yeongseon merged 1 commit into
mainfrom
refactor/spec-report-cli-local-diagnostics-819

Conversation

@yeongseon

@yeongseon yeongseon commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

Use diagnostics from each specification-generation call in reports and the CLI instead of rereading mutable registry state.

Changes

  • Introduce an internal immutable generation result with its document, diagnostics, and validation metadata.
  • Reuse pre-transformation validation when operation traversal is unchanged; validate the final document when method relocation or removal changes it.
  • Preserve standalone warning collection, CLI mock-document compatibility, public interfaces, warning messages, and runtime serialization behavior.
  • Add 19 regression cases for report isolation, validation ordering, CLI exit codes, custom operations, and runtime overhead.
  • Update DESIGN.md with diagnostic ownership and the generation flow.

Validation

  • make format-check, make lint, make typecheck, make test, make check-all, make build, and make perf passed.
  • Final test suite: 1,633 passed, 30 skipped, 22 deselected, 95.22% coverage; existing expected warnings unchanged.
  • Performance budgets passed at 10/50/200/500 operations; this PR did not measure a separate before/after speedup.
  • Editor LSP diagnostics could not resolve some Hatch dependencies; repository strict mypy passed.

Related Issues

Refs #819

Stacked on #840, which is stacked on #838. Retarget and rebase after both prerequisite PRs merge; this is not the closing PR.

Copilot AI 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.

🔵 Needs a closer look

The stacked refactor still needs integration review and authoritative final-head CI verification after its prerequisites merge and it is retargeted.

No open issues 🎉

What changed in this PR

This phase of #819 moves report and CLI diagnostics into an invocation-local generation result, reducing reliance on mutable registry state while preserving public APIs and compatibility publication.

Changes:

  • Capture local diagnostics and reuse validation when operation traversal is unchanged.
  • Update reports and the CLI to consume the result while preserving standalone collection and runtime serialization behavior.
  • Add characterization tests and document diagnostic ownership and call flow.
File Description
tests/​test_spec_report_local_diagnostics.py Tests diagnostic isolation, validation counts, warning parity, and CLI behavior.
src/​azure_functions_openapi/​spec.py Produces local generation results and conditionally reuses validation.
src/​azure_functions_openapi/​cli.py Consumes local results while retaining plain-document compatibility.
src/​azure_functions_openapi/​_generation_result.py Defines the internal frozen generation-result container.
DESIGN.md Documents diagnostic ownership and before/after generation flow.

Review effort: Balanced

@yeongseon yeongseon changed the title refactor(spec): let reports and the CLI consume diagnostics from their own generation refactor(spec): use local diagnostics in reports and CLI Oct 25, 2026
Base automatically changed from refactor/spec-local-generation-diagnostics-819 to main October 26, 2026 10:57
@yeongseon
yeongseon force-pushed the refactor/spec-report-cli-local-diagnostics-819 branch from 273ef5b to 3603b5f Compare October 26, 2026 10:59
@yeongseon
yeongseon merged commit 0866c02 into main Oct 26, 2026
28 of 29 checks passed
@yeongseon
yeongseon deleted the refactor/spec-report-cli-local-diagnostics-819 branch October 26, 2026 11:01
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