Skip to content

feat!: serve service info from config only - #107

Merged
uniqueg merged 5 commits into
devfrom
feat/service-info-config
Oct 20, 2026
Merged

uniqueg merged 5 commits into
devfrom
feat/service-info-config

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Service info comes from the config only (#100). This also aligns the service-info config with the GA4GH spec (#79, which will be closed as a duplicate).

  • POST /service-info is removed, with its controller, the service_info collection and its index, and the precedence logic of fix!: service info id, precedence and headers #96 (_writtenAt, _configHash). Requests now get 405 Method Not Allowed.
  • GET /service-info is built from custom.endpoints.service_info, without the database:
    • version defaults to the version of the installed package (importlib.metadata), unless the config sets it;
    • createdAt and updatedAt are served only if configured. The default config keeps them as a commented example;
    • fields and list items set to null are dropped. Config overlays merge mappings, so this is how deployments remove optional fields of the default (e.g., contactUrl: null).
  • Startup check: the service info, with the package version, is validated against the GA4GH Service schema of the bundled spec. The app refuses to start if it is invalid, and the error names the field, e.g. Invalid service info in `custom.endpoints.service_info.contactUrl`: 'support' is not a 'uri'.
    • jsonschema checks uri and date-time only with optional packages, which aren't installed. So the module brings its own checks: an absolute URI (scheme, no whitespace, so mailto: passes) and an RFC 3339 date-time with T as separator, whose parts exist (leap seconds allowed).
  • Config model: the hand-copied ServiceInfoConfig, TypeConfig and OrganizationConfig are replaced by a mapping. The schema is now the single source, which removes the duplication, the all-required fields and the unchecked URLs and timestamps of Config: align service-info model with the spec #79.
  • Generic code, so that it can move to FOCA (feat: serve service info from config foca#314): get_service_info() and check_service_info() take a runtime_fields hook (default: the package version), and the config takes precedence over it.
  • jsonschema and PyYAML, now imported directly, are declared in requirements.txt (ranges compatible with Connexion and FOCA). types-jsonschema was added to the dev requirements for mypy.
  • Docs: README ("Service info", with a migration note), deployment/README.md (setting service info via the config value; pods restart when it changes), values.yaml, and NOTES.txt (/service-info needs no token).

Closes #100. Addresses #79.

Breaking changes

  • POST /service-info is removed, and service info stored in the database is no longer served. Set it in the config instead (custom.endpoints.service_info; with Helm, the config value). The service_info collection can be dropped.
  • The default config no longer sets a version (the app version is used) or timestamps.
  • Deployments whose service info is invalid according to the GA4GH schema (e.g., a contactUrl without a scheme) no longer start.

Verification

  • pytest (Helm 3.18.6 on PATH, package installed): 148 passed, 100% coverage of cloud_registry. New and adapted tests cover:
    • service info from the config, with the package version, and without unconfigured timestamps;
    • configured versions and timestamps;
    • 405 for POST, which is also gone from the served spec;
    • the startup check: valid service info, required fields only, every required field missing, and invalid URLs, date-times, nested fields and types (each naming the field);
    • valid edge cases: mailto: URIs, offsets, fractional seconds and extension fields;
    • the runtime-fields hook, its precedence, copies, and null fields (nested, in lists, and overriding runtime fields);
    • main() logging the service info and failing for invalid service info;
    • Helm: service info merged from the config value, and the config checksum (pod restart) changing with it.
  • ruff check, ruff format --check, mypy cloud_registry tests: clean.
  • helm lint --strict: passes. gitleaks dir .: no leaks. ast-grep scan: clean.
  • Adversarial and quality review, 2 rounds.
    • Fixed:
      • optional fields of the default couldn't be removed: null from an overlay failed the startup check;
      • impossible date-times passed, leap seconds failed, and offsets with minutes over 59 or non-ASCII digits passed;
      • direct dependencies were only transitive;
      • the returned service info shared lists with the config;
      • a test assertion that couldn't fail;
      • docstrings and docs.
    • Declined:
      • The default version (package metadata) is 0.2.0 for every image. Release: single version source, traceable images #81 derives the version from Git tags.
      • A separate "Upgrading" section: the README has a migration paragraph, and the base config always sets the service info.
      • Splitting the commits: the PR is squash-merged.
  • Sourcery (2 findings, both fixed and replied to; then approved): date-times with a space as separator passed (RFC 3339 allows it only in a note); null list items were served. Both fixes were reviewed again (adversarial and quality: no findings above low).
  • CI on 8f1dc4c: all checks pass, including the Docker Compose run, the tests on Python 3.10 and 3.12, the Helm chart checks and Codecov (patch and project).

Open questions

None.

🤖 Generated with Claude Code

uniqueg and others added 4 commits October 20, 2026 18:26
Remove POST /service-info, its controller and the service_info
collection: GET /service-info builds the service info from
custom.endpoints.service_info, without the database. The version
defaults to the installed package's version, and createdAt/updatedAt
are served only if configured.

On startup, the service info is checked against the GA4GH Service
schema of the bundled specification (with URI and RFC 3339 date-time
checks), and the app refuses to start if it is invalid, naming the
field. The hand-copied config models are replaced by a mapping.

The code is generic (runtime fields as a hook), so that it can move to
FOCA (elixir-cloud-aai/foca#314).

Closes #100.

BREAKING CHANGE: POST /service-info is removed (405), and service info
stored in the database is no longer served; set it in the config
(custom.endpoints.service_info, with Helm the config value). The
default config no longer sets a version or timestamps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Config overlays merge mappings, so deployments could only remove
optional fields of the default service info by setting them to null,
which then failed the startup check. Fields set to null are now
omitted, recursively.

Also check that date-times exist (not only their format), declare
jsonschema and PyYAML as direct dependencies, and tidy docstrings,
comments and docs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Check the parts of date-times instead of parsing them: accept leap
seconds, reject offsets with minutes over 59 and non-ASCII digits.
Return a full copy of the service info, dropping nulls in lists too.
Reflow docs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Service info is now a read-only, config-derived GA4GH Service document: database persistence and POST updates are removed, package-version/runtime defaults and null filtering are added, and startup validation uses the bundled schema plus explicit URI/date-time checks; Helm and documentation are updated for config-driven deployments.

Sequence diagram for config-derived service info startup and retrieval

sequenceDiagram
    participant App
    participant Config
    participant ServiceInfo
    participant PackageMetadata
    participant Schema
    participant Client

    App->>ServiceInfo: check_service_info()
    ServiceInfo->>PackageMetadata: package_fields()
    PackageMetadata-->>ServiceInfo: version
    ServiceInfo->>Config: get_custom_config()
    Config-->>ServiceInfo: custom.endpoints.service_info
    ServiceInfo->>ServiceInfo: get_service_info()
    ServiceInfo->>Schema: validate Service document
    Schema-->>ServiceInfo: valid or validation error
    ServiceInfo-->>App: start or InvalidServiceInfo
    Client->>ServiceInfo: GET /service-info
    ServiceInfo->>ServiceInfo: get_service_info()
    ServiceInfo-->>Client: config fields plus runtime version, without nulls
Loading

File-Level Changes

Change Details Files
Replaced database-backed, writable service-info handling with read-only config-backed serving and removed the write API.
  • Serve GET responses directly from custom.endpoints.service_info without database reads or writes.
  • Remove the POST controller, OpenAPI operation, persistence collection/index, precedence metadata, and related access-control behavior; POST now returns 405.
  • Update startup and tests to validate/read service info without registration side effects.
cloud_registry/ga4gh/registry/server.py
cloud_registry/ga4gh/registry/service_info.py
cloud_registry/api/additions.openapi.yaml
cloud_registry/config.yaml
cloud_registry/app.py
tests/ga4gh/registry/test_server.py
tests/ga4gh/registry/test_service_info.py
tests/test_app.py
tests/conftest.py
tests/mock_data.py
tests/test_access_control.py
tests/test_utils.py
Added schema-driven service-info composition and startup validation.
  • Use the bundled GA4GH Service schema as the validation source instead of duplicated Pydantic models.
  • Supply the installed package version as a runtime default while allowing configured fields to take precedence.
  • Recursively remove null fields and copy nested mappings/lists so responses cannot mutate configuration.
  • Add custom absolute-URI and RFC 3339 date-time checks and report the invalid configuration path.
  • Expose a generic runtime-fields hook for reuse outside this application.
cloud_registry/ga4gh/registry/service_info.py
cloud_registry/service_models/custom_config.py
cloud_registry/app.py
tests/ga4gh/registry/test_service_info.py
requirements.txt
requirements_dev.txt
Updated deployment configuration and documentation for config-only service info.
  • Document configuration, migration, validation, optional timestamps, null-based field removal, and restart behavior.
  • Ensure Helm config changes alter the pod template checksum and therefore restart deployments.
  • Remove obsolete comments and database configuration for service-info persistence.
README.md
deployment/README.md
deployment/values.yaml
deployment/templates/NOTES.txt
cloud_registry/config.yaml
config.dev.yaml
tests/test_chart.py
tests/test_config.py

Assessment against linked issues

Issue Objective Addressed Explanation
#100 Make service info config-only: serve GET /service-info from custom.endpoints.service_info with a package-version default, remove POST /service-info, and eliminate service-info database storage and precedence logic. ✅
#100 Validate configured service info at startup against the GA4GH Service schema and fail clearly when it is invalid. ✅
#100 Document migration to config-based service info and support Helm config changes taking effect after rollout. ✅

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 Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a807793) to head (8f1dc4c).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #107   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         8           
  Lines          365       336   -29     
=========================================
- Hits           365       336   -29     

☔ 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 October 20, 2026 16:52

@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 found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="cloud_registry/ga4gh/registry/service_info.py" line_range="32" />
<code_context>
+URI = re.compile(r"[A-Za-z][A-Za-z0-9+.-]*:\S*")
+# RFC 3339, section 5.6 (ASCII digits only)
+DATE_TIME = re.compile(
+    r"(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})[Tt ]"
+    r"(?P<hour>\d{2}):(?P<minute>\d{2}):(?P<second>\d{2})(\.\d+)?"
+    r"([Zz]|[+-](?P<offset_hour>\d{2}):(?P<offset_minute>\d{2}))",
</code_context>
<issue_to_address>
**Invalid timestamps are served**

When a configured timestamp uses a space instead of `T` or `t` between the date and time, `_is_date_time` accepts the space because `DATE_TIME` allows it, so startup validation passes and the app serves a timestamp that does not match the RFC 3339 date-time format.

Remove the space from the date/time separator alternatives in `DATE_TIME`.

Also at `cloud_registry/ga4gh/registry/service_info.py:33`.
</issue_to_address>

### Comment 2
<location path="cloud_registry/ga4gh/registry/service_info.py" line_range="115" />
<code_context>
+            if value is not None
         }
+    if isinstance(data, list):
+        return [_without_nulls(item) for item in data]
+    return data
+
</code_context>
<issue_to_address>
**Null list entries remain served**

When a service-info list contains a null element, `_without_nulls` recursively processes list items but does not filter `None`, so a configured extension value such as `["link", null]` still includes `null` in the `GET /service-info` response.

Filter out `None` list items while recursively copying the remaining items.
</issue_to_address>

Sourcery assessment

Approval pending. 2 findings to address first.

Blocking findings: cloud_registry/ga4gh/registry/service_info.py:32, cloud_registry/ga4gh/registry/service_info.py:115


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

RFC 3339 allows a space instead of T only in a note; the JSON Schema
date-time format follows its grammar. Null list items are dropped like
null values of mappings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

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

Sourcery assessment

Approved.

@uniqueg
uniqueg merged commit 6fec73c into dev Oct 20, 2026
11 checks passed
@uniqueg
uniqueg deleted the feat/service-info-config branch October 20, 2026 17: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.

feat!: serve service info from config only

1 participant