Skip to content

Make Scylla optional so the server can run without item investigation & user strikes #917

Description

@sunilatlas

Problem being solved

The server currently requires a Scylla cluster to boot. Starting without the
SCYLLA_* env vars crashes at startup:
Missing env var SCYLLA_HOSTS

However, Scylla only backs two features : item investigation (item/user
history) and user strikes (repeat-offender counts/thresholds). Operators who
don't need those features, or who deploy on a platform with no managed Scylla
offering, still have to stand up and maintain a Scylla cluster just to start the
app. This is a significant operational burden for a dependency that may be
entirely unused.

Proposed solution

Add an opt-out flag: ITEM_INVESTIGATION_AND_STRIKES_ENABLED (defaults to
true, so existing deployments are unaffected). When set to false, the server
runs without Scylla: the two dependent features degrade gracefully to no-ops
(history/strike reads return empty, writes are dropped) and no SCYLLA_* env
vars are required.

Implementation-wise, gate at the single dependency-injection chokepoint (the
Scylla factory in iocContainer) and return a NoOpScylla when disabled, so
the ~100+ existing call sites keep compiling and running unchanged. This mirrors
the existing NoOpAnalyticsAdapter pattern already used for the
analytics/warehouse feature.

I've opened a PR implementing this: sunilatlas/coop#
(typecheck + lint pass, 8 new unit tests, and I verified the server boots and the
full item-submission → rule → review-queue flow works end-to-end with Scylla off).
Attached SS as a proof that reviewing of video also plays fine.

Alternatives considered

  • Keep Scylla mandatory- rejected: forces operators to run infrastructure
    for features they may not use.
  • Two separate flags (one per feature) - deferred: both features share the
    same single dependency (Scylla), so one flag matches the actual infra
    boundary and keeps configuration simple. Could be split later if needed.
  • Gate each of the ~100+ Scylla call sites individually - rejected: large,
    error-prone diff. Gating the single DI factory is far cleaner and lower-risk.
  • Naming as SCYLLA_ENABLED - chose a feature-oriented name instead so the
    flag reflects the capability, not the datastore. Open to a different name if
    maintainers prefer a convention.

Anything else

Backwards-compatible: default is true, so nothing changes for existing
deployments unless the flag is explicitly set.

One honest trade-off to flag: with the flag off, item-investigation and
user-strike data silently becomes empty (reads) / dropped (writes). Happy to add
a startup warning if strikes/investigation are configured while the flag is off,
if that's preferred.

Screenshots

image.png

Checklist

  • I’ve reviewed and agree to follow the code of conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    Priority

    None yet

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions