Skip to content

fix: bound the sync interval and fill doc gaps - #396

Merged
uniqueg merged 2 commits into
devfrom
fix/389-rc2-review
Nov 9, 2026
Merged

uniqueg merged 2 commits into
devfrom
fix/389-rc2-review

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Summary

Small fixes from the pre-release review of 1.0.0rc2, before the tag:

  • Sync interval bounds: custom.endpoints.services.service_info.sync_interval_hours must now be finite and from 1 to 8760 hours (MIN_SYNC_INTERVAL_HOURS, MAX_SYNC_INTERVAL_HOURS in cloud_registry/service_models/custom_config.py). Very large values failed every worker at startup with an OverflowError. Very small ones fetched from the registered services far more often than needed, with the scheduler checking every second. Values outside the range now stop the app at startup, through FOCA's config validation. Sync is new in 1.0.0rc2, so no earlier configuration is affected. The bounds are documented in docs/configuration.md, docs/api.md, the comment in config.yaml and the description of intervalHours in the additions spec.

  • Left-behind versions: docs/configuration.md (Service types) now says at what rate syncs can leave type versions behind that stop counting for max_unused_service_types:

    • in mode open, one per sync: per service and interval for the app's syncs, and up to fetches_per_hour per hour and user for PUT /services/{serviceId}/sync;
    • in mode moderated, pending versions still count;
    • in mode controlled, or with the limit 0, syncs add no types.

    It also says that the release only applies to versions that the user the service counts for added. I didn't change the code to limit the rate: releasing only for background syncs would make owners who sync by hand use up their limit, so that their services stop syncing.

  • Chart README (To app version 1.0.0rc2): values files that give the policies as a list must add the seven new rules (import-service-info, owners-sync-services, maintainers-sync-services, get-service-sync, list-syncs, list-notifications, dismiss-notifications), as docs/upgrading.md already says.

Closes #389

Full lane: adversarial-reviewer and quality-reviewer ran on the first commit; their findings are fixed in the second commit (see below).

Verification

Locally, Python 3.13, locked dependencies:

  • New boundary tests first: they failed on the old model and pass now (tests/test_sync.py::test_settings: 0, -1, 0.5, 0.9999, 8760.0001, 1e9, inf and nan are rejected; 1 and 8760 are accepted).
  • tests/test_sync.py: 88 passed.
  • Full suite on mongomock, with coverage: 2119 passed and 11 skipped. 71 tests failed, all in tests/test_config.py::TestChartOverlay plus one in tests/test_chart.py: they need the chart's dependencies (helm dependency build), and Helm isn't installed here. Because they didn't run, coverage of custom_config.py was below 100% locally. CI runs them, in the Chart and Test jobs.
  • pre-commit run --all-files: passed, after ruff reformatted one line.
  • mkdocs build --strict: passed.

CI: see the checks of this PR.

Review

  • Quality review: the bounds are now in the spec, the API docs and the comment in config.yaml; a change-detector test is replaced by boundary tests with literal values; the line over 88 characters is wrapped; the passage on the type limit is split into a list.
  • Adversarial review: no blocking findings. The doc claim that left-behind versions "count for nobody" was too broad, as only versions the service's user added are released; it is narrowed. The chart README now says that the read rules get-service-sync and list-syncs only matter where login is required for reads.

Declined review findings

  • minimum/maximum on intervalHours in the spec (quality, medium): the bounds are in the description instead. Responses are validated, and tests set intervals below an hour directly on the config, so schema bounds could turn their GET /service-info into 500 responses.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Enforce safe service sync interval bounds and close documentation gaps for synchronization behavior and the 1.0.0rc2 upgrade.

Bug Fixes:

  • Bound service-info sync intervals to finite values between 1 and 8760 hours, preventing invalid startup configuration and scheduler overflow or excessive polling.

Enhancements:

  • Document how synchronized type versions affect unused-type limits across registration modes and sync paths.
  • Document the required service sync and notification permissions when upgrading Helm values files to 1.0.0rc2.

Documentation:

  • Update API, configuration, OpenAPI, and deployment documentation with sync interval bounds, left-behind type version behavior, and new policy requirements.

Tests:

  • Replace sync interval positivity checks with boundary and non-finite value validation coverage.

uniqueg and others added 2 commits November 9, 2026 21:37
- `sync_interval_hours` must be from 1 to 8760 hours (finite): larger
  values overflowed the times of next attempts on startup, and smaller
  ones fetched from services far more often than needed.
- Configuration: the rate at which syncs can leave versions behind
  that don't count for `max_unused_service_types`.
- Chart README (to 1.0.0rc2): the new policy rules that values files
  with list-form policies must add.

Closes #389

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The interval's bounds in the config comment, the spec and the API
  docs; boundary tests with literal values instead of a test that
  repeats the constants; the long field line wrapped.
- Configuration: left-behind versions only stop counting for the user
  the service counts for, if that user added them; one list per mode.
- Chart README: the read rules of syncs only matter where login is
  required for reads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg uniqueg added this to the v1.0.0-rc2 milestone Nov 9, 2026
@uniqueg
uniqueg marked this pull request as ready for review November 9, 2026 21:08
@sourcery-ai

sourcery-ai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Add finite 1-to-8760-hour bounds to the service-info configuration model and document those bounds alongside the field.

  • cloud_registry/service_models/custom_config.py L72-78, L119-124 (+4 small edits)

API

Document the supported interval range for the public intervalHours field in the additions specification.

  • cloud_registry/api/additions.openapi.yaml L1900

Configuration

State the supported sync-interval range in the default configuration comment.

  • cloud_registry/config.yaml L467

Documentation

Explain the sync interval bounds and clarify how sync-created type versions affect unused-type limits by registration mode and service user.

  • docs/api.md L125
  • docs/configuration.md L289-296, L394, L402-416

Document the additional policy rules needed when upgrading chart values that use list-form policies.

  • deployment/README.md L954-959

Tests

Test rejection of non-finite and out-of-range intervals and acceptance of the supported boundary values.

  • tests/test_sync.py L24-25, L1512-1521

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

@sourcery-ai

sourcery-ai Bot commented Nov 9, 2026

Copy link
Copy Markdown

Linked issues

Checked at commit 7009a20

#389 fix: small fixes from the 1.0.0rc2 review · 3 of 3 met

# Requirement Status Notes
1 Document the seven new policy rules required in list-form chart values files. ✅ Met deployment/README.md lists all seven rules and explains the resulting 403s.
2 Bound sync_interval_hours and add tests and documentation. ✅ Met The config model rejects non-finite values and values outside 1–8760 hours; tests cover boundaries and invalid values, and the range is documented.
3 Document the rate at which syncs can leave versions behind: user-triggered syncs by fetches_per_hour per account, background syncs by one per service per interval. ✅ Met docs/configuration.md describes both rates and clarifies how modes and the user's ownership of a type affect whether it stops counting.

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

Sourcery assessment

Approved.


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

uniqueg added a commit that referenced this pull request Nov 9, 2026
The sync interval's bounds and the documentation of left-behind type
versions and of the chart's new policy rules (#389, #396).

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

codecov Bot commented Nov 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (4e38426) to head (7009a20).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #396   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           27        27           
  Lines         3265      3343   +78     
=========================================
+ Hits          3265      3343   +78     

☔ 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 merged commit a3e7275 into dev Nov 9, 2026
40 of 44 checks passed
@uniqueg
uniqueg deleted the fix/389-rc2-review branch November 9, 2026 21:36
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.

fix: small fixes from the 1.0.0rc2 review

1 participant