Skip to content

feat(generic/routing/random): add random routing #7

Closed

Description

@uniqueg

Problem

proTES's TaskDistributionRandom must survive the move to FOCA plugins, so that operators can keep today's behaviour as an explicit pipeline choice. FOCA's default router foca.routing.ordered keeps the order of the backend list and shuffles only the backends of each service registry among themselves.

Proposal

  • Plugin generic.routing.random:
    • distribution foca-plugin-generic-routing-random, apis = {"*"}, on_route only;
    • returns all candidates, shuffled with random.SystemRandom;
    • parameter seed, for reproducible orders in tests, refused unless the admin setting allow_seed is on (as for foca.routing.ordered); with a seed, the order depends only on the seed and the order of the candidates, so the configured order is the stable tie-breaker.
  • Records: FOCA's route provenance already holds the candidates before and after routing, in order (route.candidates_in, route.candidates_out). The plugin adds the annotations candidates (their number) and seeded. Annotation lists hold at most 16 values, so the order itself isn't repeated there.
  • README: the pipeline that restores proTES's old default, [{id: route, alternatives: [{plugin: tes.routing.distance}, {plugin: generic.routing.random}]}]. Distance routing is added in feat(tes/routing/distance): add distance routing #8.

Acceptance criteria

  • Passes FOCA's contract checks (foca.plugins.testing.check_plugin_contract), with 100% coverage.
  • The returned list is a permutation of the input; seeded orders are reproducible; seeds are refused unless allowed.

Surviving the Connexion 3 migration

Neutral model only; works unchanged on FOCA 1.x.

Dependencies

Activity

  1. added
    priority: medium
    status: blocked
    type: feature
    workload: hours
    on Oct 27, 2026
  2. removed
    status: blocked
    on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: mediumtype: featureworkload: hours

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions