Skip to content

fix: reject failed mock server startup - #137

Open
qinyingran-TT wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
qinyingran-TT:contribution/conformance-server-startup-20261118
Open

qinyingran-TT wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
qinyingran-TT:contribution/conformance-server-startup-20261118

Conversation

@qinyingran-TT

Copy link
Copy Markdown

Description

AgentProfileServer.start() and MockWebhookServer.start() treat any HTTP 200 from the configured port's /healthz endpoint as a successful start. If another healthy service already owns that port, Uvicorn fails to bind and its thread exits, but start() can still return successfully. The suite then runs without the intended agent profile server or webhook receiver.

Require this Uvicorn instance to have started before accepting the health response. Stop polling when its thread exits, and stop the instance before raising the existing startup error after polling fails. Successful startup, profile routes, webhook capture and retry responses remain unchanged.

Five regression tests cover both servers: a healthy response before startup, a terminated thread, successful start and stop, connection failure, and a non-200 health response. The module is registered in the runner's common suite so --suite=all runs it.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Category (Required)

  • Core Protocol: Changes to the base communication layer, global context, or breaking refactors. (Requires Technical Council approval)
  • Governance/Contributing: Updates to GOVERNANCE.md, CONTRIBUTING.md, or CODEOWNERS. (Requires Governance Council approval)
  • Capability: New schemas (Discovery, Cart, etc.) or extensions. (Requires Maintainer approval)
  • Documentation: Updates to README, or documentations regarding schema or capabilities. (Requires Maintainer approval)
  • Infrastructure: CI/CD, Linters, or build scripts. (Requires DevOps Maintainer approval)
  • Maintenance: Version bumps, lockfile updates, or minor bug fixes. (Requires DevOps Maintainer approval)
  • SDK: Language-specific SDK updates and releases. (Requires DevOps Maintainer approval)
  • Samples / Conformance: Maintaining samples and the conformance suite. (Requires Maintainer approval)
  • UCP Schema: Changes to the ucp-schema tool (resolver, linter, validator). (Requires Maintainer approval)
  • Community Health (.github): Updates to templates, workflows, or org-level configs. (Requires DevOps Maintainer approval)

Related Issues

N/A.

Is this a Breaking Change or Removal?

Not applicable: no protocol, schema, public API, file or field removal.

  • I have added ! to my PR title (e.g., feat!: remove field).
  • I have added justification below.

Breaking Changes / Removal Justification

Not applicable. This changes the failure path of local mock server startup.

Checklist

  • I have followed the Contributing Guide (including Conventional Commits title requirements and ! for breaking changes).
  • I have updated the documentation (if applicable).
  • My changes pass all local linting and formatting checks.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • (For Core/Capability) I have included/updated the relevant JSON schemas.
  • (For Breaking Schema Changes / Deprecations) I have used the transition annotation rather than changing field visibility or removing a field directly.
  • I have regenerated Python Pydantic models by running generate_models.sh under python_sdk.

Documentation, schema transitions and model generation are not applicable: no documented interface, schema or model changes. Applicable file-level checks pass; the aggregate pre-commit invocation cannot install the pinned Prettier environment, as noted below.

Repository checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

No documentation or downstream dependency changes are required.

Pull Request Title

fix: reject failed mock server startup

Screenshots / Logs (if applicable)

  • Occupied-port reproduction for both servers: the original returns successfully with started=False and a terminated thread; the fix raises the existing RuntimeError. The occupying listener remains healthy.
  • Python 3.10, 3.11 and 3.12: all five regression tests pass. Pytest also reports five tests and ten subtests passing. Against the original modules, eight subtests fail and the successful-start control passes.
  • Real HTTP startup and shutdown checks: both agent profile routes work; webhook capture preserves raw bytes and 500/200 retry responses. Six server instances pass.
  • Full Flower Shop run with SDK 0.4.6: original 83 executed / 81 passed / 2 skipped; fixed 88 executed / 86 passed / 2 skipped. Both have zero failures and zero errors. The unchanged skips are the unadvertised AP2 capability and unpublished discovery URLs.
  • Wheel built successfully; all four changed files match the source and the ucp-conformance entry point is preserved.
  • Ruff 0.14.13 check/format, CSpell 8.17.5, AST parsing, git diff --check, and all applicable pinned file-level pre-commit hooks pass.
  • Aggregate pre-commit exits 3 while installing Prettier: tiny-levenshtein@^1.1.0 is unavailable. That hook matches JSON, Markdown and YAML; this change contains only Python files. Local containerized Super-Linter was not run because no Docker daemon or Podman is available.
  • Bandit reports the same three findings as the original modules: the two existing 0.0.0.0 listeners and a false positive on the runner's all selector. No new findings or suppression comments.

@damaz91 damaz91 added the status:needs-triage Signal that the PR is ready for human triage label Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:needs-triage Signal that the PR is ready for human triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants