rubyforgood / rubyforgood/awbw

Rename organization_status → program_status, then rip out the stored field for computed program status

Open
#2,065 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
15
Forks
26
Avg merge
12h 42m
Merged PRs (30d)
242

Description

🤖 From Claude: Captured from a working session on #1993 (org index/profile program-status rework). Two follow-ups, in order.

Phase 1 — rename organization_statusprogram_status in code (no behavior change)

The org's status concept is really its program status. Rename for clarity while keeping the stored field:

  • Model: belongs_to :organization_status, organization_status_id column, OrganizationStatus model + OrganizationStatusDecorator, the /organization_statuses admin CRUD, PROGRAM_STATUS_BUCKETS.
  • Decorator: organization_status_bucket / organization_status_label / organization_status_classes / organization_status_chip.
  • Scope/params/filter: Organization.program_status scope (already named), program_status filter param, organization_status_id in strong params, @organization_statuses.
  • Note: EventRegistration's look-alike was already renamed to organization_linking_status — leave it.
  • Mostly mechanical; do it as its own PR so the diff is reviewable.

Phase 2 — rip out the stored field; program status becomes fully computed

Program status is already computed from facilitator affiliations and only falls back to the stored status in two places (both already isolated for exactly this):

  1. OrganizationDecorator#organization_status_bucket — delete the "else → stored bucket" fallback branch.
  2. Organization.program_status scope — delete the "OR stored-status" half.

Then remove the field's ecosystem:

  • Migration: drop organizations.organization_status_id (+ FK) and the organization_statuses table.
  • Delete OrganizationStatus + OrganizationStatusDecorator; remove belongs_to + validates :organization_status_id, presence.
  • Delete the /organization_statuses admin CRUD (controller, 5 views, policy, routes) and the "Organization statuses" card in admin_cards_helper.
  • Delete the affiliation sync callbacks (sync_organization_status_with_affiliations, deactivate_organization_if_no_active_people, reactivate_organization_if_inactive) — keep sync_organization_affiliation_dates (dates, not status).
  • Remove status from seeds (db/seeds.rb, db/seeds/dev/organizations.rb, db/seeds/dev/events_management.rb), the org factory association :organization_status, and the organization_status factory.
  • Edit form: remove the status select + facilitator_status_name/status_matches_affiliations/show_status_select + hidden field.
  • event_registrations_controller Organization.create!(…, organization_status: …) — drop the arg.
  • organizations_results.html.erb status_label (shows the stored name on unpublished orgs) — rework/remove.
  • Specs / AGENTS.md — drop everything referencing OrganizationStatus.
Decision made this session

Organization.active / published? (org public visibility) currently means "status Active OR any active affiliation." When the field is removed, it should mean an active facilitator affiliation (i.e., program-status Active). This is the load-bearing/risky change — it changes which orgs are publicly visible.

Before dropping

Export/backfill the manual Pending / Suspended values first if anyone wants that history — the column drop discards them.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin by tracing OrganizationDecorator#organization_status_bucket, the Organization.program_status scope, and the active/published visibility behavior described in the issue. Review the listed models, controllers, views, seeds, factories, routes, policies, migration, and specs before separating the mechanical rename from field removal. Done means the stored status ecosystem is removed, computed facilitator status remains correct, visibility behavior is covered, and the test suite passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend, database
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.