Repository navigation
feat!: serve service info from config only - #107
Conversation
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]>
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]>
Reviewer's GuideService 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 retrievalsequenceDiagram
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
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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
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]>
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-infois removed, with its controller, theservice_infocollection and its index, and the precedence logic of fix!: service info id, precedence and headers #96 (_writtenAt,_configHash). Requests now get405 Method Not Allowed.GET /service-infois built fromcustom.endpoints.service_info, without the database:versiondefaults to the version of the installed package (importlib.metadata), unless the config sets it;createdAtandupdatedAtare served only if configured. The default config keeps them as a commented example;nullare dropped. Config overlays merge mappings, so this is how deployments remove optional fields of the default (e.g.,contactUrl: null).Serviceschema 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'.jsonschemachecksurianddate-timeonly with optional packages, which aren't installed. So the module brings its own checks: an absolute URI (scheme, no whitespace, somailto:passes) and an RFC 3339 date-time withTas separator, whose parts exist (leap seconds allowed).ServiceInfoConfig,TypeConfigandOrganizationConfigare 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.get_service_info()andcheck_service_info()take aruntime_fieldshook (default: the package version), and the config takes precedence over it.jsonschemaandPyYAML, now imported directly, are declared inrequirements.txt(ranges compatible with Connexion and FOCA).types-jsonschemawas added to the dev requirements for mypy.deployment/README.md(setting service info via theconfigvalue; pods restart when it changes),values.yaml, andNOTES.txt(/service-infoneeds no token).Closes #100. Addresses #79.
Breaking changes
POST /service-infois removed, and service info stored in the database is no longer served. Set it in the config instead (custom.endpoints.service_info; with Helm, theconfigvalue). Theservice_infocollection can be dropped.contactUrlwithout a scheme) no longer start.Verification
pytest(Helm 3.18.6 on PATH, package installed): 148 passed, 100% coverage ofcloud_registry. New and adapted tests cover:405forPOST, which is also gone from the served spec;mailto:URIs, offsets, fractional seconds and extension fields;nullfields (nested, in lists, and overriding runtime fields);main()logging the service info and failing for invalid service info;configvalue, 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.nullfrom an overlay failed the startup check;version(package metadata) is0.2.0for every image. Release: single version source, traceable images #81 derives the version from Git tags.nulllist items were served. Both fixes were reviewed again (adversarial and quality: no findings above low).Open questions
None.
🤖 Generated with Claude Code