Skip to content

Backend: add a versioningService compatibility test asserting event-schema version downgrades are rejectedΒ #1733

Description

@Baskarayelu

πŸ“‹ Description

versioningService.ts labels indexed records by contract/event-schema version. There is no test asserting the service rejects a downgrade β€” ingesting an event tagged with an older schema version than already recorded for that stream must be refused or explicitly handled, never silently overwriting newer-version data.

Why this matters: version downgrades during a replay or a misconfigured indexer can corrupt newer state with stale schemas. A focused test pins the monotonic-version guarantee.

🎯 Requirements & Context

  • Add a jest suite covering: accept a higher/equal version; reject (or quarantine) a lower version for the same stream.
  • Assert the recorded version never moves backward.
  • Cover the first-seen version (no prior record) accepted.
  • Cover mixed-version batches processed in order.

Context & constraints

  • TypeScript, jest, better-sqlite3 in-memory. Reuse the version labels in contract.ts types.

πŸ› οΈ Suggested Execution

git checkout -b test/versioning-downgrade-reject
npm --prefix backend test -- versioning
  • Edge cases: equal version (idempotent accept); downgrade by one; downgrade after several upgrades; unknown stream first-seen.

Example commit message

test(backend): assert versioningService rejects schema-version downgrades

Pins the monotonic-version guarantee so replays cannot overwrite newer state
with older schemas.

βœ… Acceptance Criteria & Guidelines

Requirement Target
Downgrade rejection asserted Required
Monotonic version invariant Required
Coverage of versioning logic β‰₯ 95%
jest + lint clean Required
Timeframe 96 hours from assignment

πŸ’¬ Community & Support

Join Discord: https://discord.gg/VpngvTjWa β€” comment to claim. πŸš€

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions