Skip to content

fix: align service info and query parameter docs - #316

Merged
uniqueg merged 4 commits into
devfrom
fix/service-info-query-docs
Nov 1, 2026
Merged

uniqueg merged 4 commits into
devfrom
fix/service-info-query-docs

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #313 (findings L5 and L6 of the v1.0.0rc1 whole-repo pre-release review).

  • L5: in mode controlled, users other than admins can't add service types, but /service-info advertised the configured max_unused_service_types (e.g., 10). registration_rules() now serves 0 in that mode, whatever the configured limit (also null), as the schema already promised. The schema, the docstrings, config.yaml, docs/api.md and docs/configuration.md now say the limit applies in modes open and moderated and is served as 0 in controlled; the config example uses moderated, where the limit applies.
  • L6: docs/api.md (Errors) promised 400 for all extra query parameters, but Connexion only checks them on operations with path, query or header parameters. The docs now say so (request bodies don't count; e.g., GET /services, GET /service-info and POST /services/types ignore query parameters). I chose the docs change over a global rejection: a global check would need a hook outside Connexion's validation and could break clients that add cache-busting parameters to reads.

Verification

  • TDD: tests/ga4gh/registry/test_service_info.py::test_registration_rules_controlled failed before the fix; test_registration_rules_follow_config (app level) now keeps the default limit of 10 in controlled and asserts 0; test_extra_query_parameters_without_parameters covers GET /services?x=1, GET /service-info?x=1 and POST /services/types?x=1.
  • coverage run --source cloud_registry,scripts -m pytest: 1590 passed, 262 skipped (Helm/Docker/MongoDB-only tests); coverage 100%.
  • pre-commit run --all-files: passed. mkdocs build --strict: passed.
  • CI: all checks passed (gate CI passed).

Review

Full lane. Round 1: adversarial lows only (a probe confirmed which operations accept ?x=1); quality two mediums (inconsistent "in every mode" wording in the config docs, model and config.yaml; the app-level test passed without the fix), fixed. Round 2 (quality): lows only (config example, POST case), fixed.

Declined review findings

  • Mention the /service-info change in docs/releases/1.0.0rc1.md (low): out of scope here; a separate release-docs PR adds this PR to the rc1 notes.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Align service registration metadata and API documentation with the actual access-control and query-parameter validation behavior.

Bug Fixes:

  • Align /service-info registration rules with controlled service-type access by reporting max_unused_service_types as 0 regardless of its configured value.
  • Correct API documentation to describe when extra query parameters are rejected versus ignored.

Enhancements:

  • Synchronize OpenAPI, configuration comments, model documentation, and user-facing guides with the service-type limit behavior and query-parameter validation semantics.

Documentation:

  • Update API and configuration documentation with the corrected service-type limit and extra-query-parameter behavior.

Tests:

  • Add coverage for controlled-mode registration rules and operations without declared parameters accepting query parameters.

uniqueg and others added 3 commits November 1, 2026 13:14
- In the controlled mode, users other than admins can't add service
  types, but `/service-info` advertised the configured limit of unused
  types (e.g., 10). It now gives `max_unused_service_types: 0`, as the
  schema and docs say (finding L5 of the rc1 pre-release review).
- The API docs promised `400` for all extra query parameters, but
  Connexion only checks those of operations with parameters
  (`GET /services?x=1` returns 200). The docs now say so, and a test
  covers it (finding L6).

Closes #313

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The config reference, `config.yaml` and the config model said the
  limit of unused types applies in every mode; they now say that it
  applies in modes `open` and `moderated`, and is served as `0` in
  mode `controlled`.
- The app-level test keeps the default limit in mode `controlled`, so
  it checks that the service info serves `0`.
- The Errors section says which parameters count (request bodies
  don't), and the test covers `GET /service-info` too.
- Reworded the schema, docstring and API docs.

Refs #313

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`POST /services/types?x=1` is accepted, as the Errors section says
(request bodies don't count as parameters), and the config example of
the unused-types limit uses mode `moderated`, where it applies.
Review findings of round 2.

Refs #313

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg uniqueg added this to the v1.0.0-rc1 milestone Nov 1, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Align service-info registration metadata, configuration/API documentation, and regression tests with controlled-mode service-type enforcement and Connexion’s operation-specific extra-query-parameter validation behavior.

Sequence diagram for controlled-mode registration rules

sequenceDiagram
    participant Client
    participant ServiceInfo as service_info
    participant Config as AccessControlConfig

    Client->>ServiceInfo: registration_rules()
    ServiceInfo->>Config: get_custom_config(CustomConfig)
    Config-->>ServiceInfo: service_types = controlled
    ServiceInfo-->>Client: max_unused_service_types = 0
Loading

Flow diagram for operation-specific extra query validation

flowchart LR
    Request[Request with extra query parameter]
    Operation{Operation has path, query, or header parameters?}
    Reject[400 Bad Request]
    Ignore[Query parameter ignored]

    Request --> Operation
    Operation -->|Yes| Reject
    Operation -->|No| Ignore
Loading

File-Level Changes

Change Details Files
Make service registration metadata accurately represent controlled-mode restrictions.
  • Return an unused-service-type limit of 0 in controlled mode regardless of configured value, including null.
  • Update OpenAPI schema, configuration comments, model docstrings, and API/configuration docs to describe mode-specific behavior.
  • Change the configuration documentation example to use moderated mode, where the limit applies.
cloud_registry/ga4gh/registry/service_info.py
cloud_registry/api/additions.openapi.yaml
cloud_registry/config.yaml
cloud_registry/service_models/custom_config.py
docs/api.md
docs/configuration.md
Document and test Connexion’s actual handling of extra query parameters.
  • Clarify that extra query parameters are rejected only for operations declaring path, query, or header parameters; parameterless operations ignore them.
  • Add coverage for query parameters on services, service-info, and service-type creation endpoints.
docs/api.md
tests/test_app.py
Add regression coverage for controlled-mode registration rules.
  • Verify controlled mode reports a zero unused-type limit with both configured and unlimited settings.
  • Update the application-level configuration-following test to assert the enforced controlled-mode behavior.
tests/ga4gh/registry/test_service_info.py
tests/test_app.py

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (7f1a082) to head (9e0baf7).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #316   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines         2366      2368    +2     
=========================================
+ Hits          2366      2368    +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review November 1, 2026 12:42

@sourcery-ai sourcery-ai 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.

Hey - I've reviewed your changes and they look great!

Linked issues

#313 Align service info and query parameter docs · 4 of 4 met

# Requirement Status Notes
1 Serve max_unused_service_types as 0 in controlled mode, regardless of the configured limit. ✅ Met registration_rules() returns 0 in controlled mode, including when the configured limit is null.
2 Align the schema and documentation with the controlled-mode limit behavior. ✅ Met The schema, docstrings, configuration reference, config.yaml, and API docs describe the mode-specific behavior.
3 Narrow the docs about unknown query parameters to reflect which operations reject them. ✅ Met The Errors section distinguishes operations with path, query, or header parameters from parameterless operations.
4 Test GET /services with an extra query parameter. ✅ Met The added parameterized test covers GET /services?x=1.

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@uniqueg
uniqueg merged commit 6c5f808 into dev Nov 1, 2026
32 checks passed
@uniqueg
uniqueg deleted the fix/service-info-query-docs branch November 1, 2026 13:06
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.

Align service info and query parameter docs

1 participant