Skip to content
This repository was archived by the owner on Jun 9, 2026. It is now read-only.

migration: codo events migration - #106

Merged
sleidig merged 3 commits into
mainfrom
codo-migration
May 13, 2026
Merged

sleidig merged 3 commits into
mainfrom
codo-migration

Conversation

@sleidig

@sleidig sleidig commented May 13, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added migration to introduce the event entity type across the system. The migration automatically configures navigation menus, entity views, related-entity references, and required enumerations.
  • Chores

    • Improved migration infrastructure with new context helper methods and test utilities.
    • Updated TypeScript compiler configuration.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 13, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@sleidig has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 43 minutes and 13 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ed3ace25-a860-4520-9f94-91305e8b1d79

📥 Commits

Reviewing files that changed from the base of the PR and between 862b3e3 and 2cc328f.

📒 Files selected for processing (2)
  • src/migration/config-migration/codo-add-event-type.migration.spec.ts
  • src/migration/tracked-migration-context.ts
📝 Walkthrough

Walkthrough

This PR adds a new migration that introduces event type support to codo system configurations. It extends the migration infrastructure with a reusable addDocIfMissing helper, implements the event migration with comprehensive configuration mutations and view integrations, validates the migration through an extensive test suite, and registers the migration in the system pipeline.

Changes

Event Type Migration for Codo Systems

Layer / File(s) Summary
Migration context infrastructure: addDocIfMissing helper
src/migration/migration-definition.ts, src/migration/tracked-migration-context.ts, src/migration/testing/migration-idempotency.harness.ts
Extends MigrationContext with addDocIfMissing(path, template): Promise<boolean> to conditionally create documents only when missing (returning false if exists, true if created). Implemented in CouchDB context and test harness; test exports are made public (silentLogger, buildTestContext) to support reusable test infrastructure.
Event migration: constants, templates, and helpers
src/migration/config-migration/codo-add-event-type.migration.ts (lines 1–286)
Defines event enum document IDs and configuration templates for event entity, list/detail views, and "Veranstaltungen" related-entities component. Provides helpers to append event to entity relatedEntities.additional, insert event into navigation menu with fallback placement when "Note" entry is absent, and inject related-entities component into mentor/mentee detail views with tab selection via multiple heuristics (title match, content fallback).
Event migration: run control flow
src/migration/config-migration/codo-add-event-type.migration.ts (lines 291–389)
Orchestrates migration execution: loads config document (404-safe), validates data object presence, conditionally creates enum documents, applies config mutations (entity/view templates, related-entities, navigation, mentor/mentee component injection), detects changes, persists only on mutation, returns MigrationResult with status and optional warnings.
Event migration: comprehensive test suite
src/migration/config-migration/codo-add-event-type.migration.spec.ts
Tests first-run application and idempotency, error modes (missing config, missing data), non-overwriting of existing enums and entities, warning scenarios (missing mentor/mentee views, missing relatedEntities attribute, mismatched tab title with fallback verification), and navigation menu append-to-end logic when "Note" is absent.
Migration registration and tooling updates
src/migration/migrations.ts, src/migration/migration-output.ts, tsconfig.json
Registers codoAddEventType in the migrations array alongside latestConfigFormats; adds CLI header line for per-org status summary; enables TypeScript types for jest and node.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

A migration hops through config land, 🐇
Adding events with graceful hand,
Events bloom in codo's care,
Mentor views and menus fair,
All idempotent, warnings in air.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'migration: codo events migration' is directly related to the main change—implementing a migration for codo events across systems.
Linked Issues check ✅ Passed The PR implements the core requirements from issue #302: adds Event type configuration via a migration, applies only to Codo systems, and uses automated migration logic instead of regex substitution.
Out of Scope Changes check ✅ Passed Minor supporting changes (tsconfig.json, migration output formatting, test harness exports) are all in scope as infrastructure supporting the main migration feature.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codo-migration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/migration/tracked-migration-context.ts`:
- Around line 44-56: The catch in addDocIfMissing incorrectly checks
error.status; change the check to read the axios-style status at
error.response?.status (i.e., treat non-404s as rethrows) so that actual
AxiosError objects are handled correctly; alternatively add a small helper like
is404Error(error) that returns (error as { response?: { status?: number }
}).response?.status === 404 and use if (!is404Error(error)) { throw error; } to
keep addDocIfMissing (and other migration helpers that call couchdb.get and put)
consistent.

In `@tsconfig.json`:
- Line 21: The tsconfig.json "types" array is missing installed type packages
(express, lodash, papaparse, supertest) which prevents their ambient typings
from being picked up; update the "types" compiler option to include those names
in the array (in the existing tsconfig.json entry currently containing "jest"
and "node") so TypeScript can resolve imports like Response from 'express' and
types used by lodash, papaparse, and supertest.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d92302cc-dbfc-4b2f-b52a-435d3518b6f0

📥 Commits

Reviewing files that changed from the base of the PR and between d91a707 and 862b3e3.

📒 Files selected for processing (8)
  • src/migration/config-migration/codo-add-event-type.migration.spec.ts
  • src/migration/config-migration/codo-add-event-type.migration.ts
  • src/migration/migration-definition.ts
  • src/migration/migration-output.ts
  • src/migration/migrations.ts
  • src/migration/testing/migration-idempotency.harness.ts
  • src/migration/tracked-migration-context.ts
  • tsconfig.json

Comment thread tsconfig.json Resolved
@sleidig
sleidig merged commit d1e0ab1 into main May 13, 2026
6 checks passed
@sleidig
sleidig deleted the codo-migration branch May 13, 2026 16:49
@coderabbitai coderabbitai Bot mentioned this pull request May 14, 2026
7 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant