Common Maintenance Tasks (Task-Based)
Focus: practical scenarios that often occur. All steps below are assumed to be done in a separate branch + non-production environment first.
1) Add a new field in the API response
Purpose: add information without destroying the old client.
Changed files:
- Controller/Resource related endpoint
docs/api-reference.mddocs/request-response-catalog.md
Safe steps:
- Add fields as optional (don't immediately make them mandatory).
- Make sure default/null handling is safe.
- Add test response schema.
- Update endpoint documentation.
Verification:
- Old endpoints still pass the minimum contract.
- The old client didn't parse errors.
Rollback risk:
- If the client has problems, roll back to the previous response.
- Keep compatibility of at least 1 release version.
2) Fix PO state transition bug
Purpose: prevent jump states without authorization.
Changed files:
- Controller/service PO status
- Role validation rules
docs/state-machine.md
Safe steps:
- Mapping current state vs target state.
- Add guard per role.
- Add tests for valid and invalid paths.
Verification:
- Roles are not entitled to 403s.
- Valid paths continue to run.
Rollback risk:
- Revert patch status guard.
- Audit PO data that has changed during the issue window.
3) Add a new internal endpoint
Purpose: provide data requirements for other modules.
Changed files:
- Routes + new endpoint controller
- Middleware access
docs/api-endpoints.md,docs/api-reference.md
Safe steps:
- Define the request/response contract clearly.
- Install minimum access middleware.
- Rate-limit if the endpoint is heavy.
Verification:
- Only authorized roles can access.
- Endpoint latency is still within team limits.
Rollback risk:
- Disable new routes.
- Revert release endpoint.
4) Integration credential rotation
Goal: replace external service credentials without downtime.
Changed files:
- Integration env/config files
docs/integration-points.md
Safe steps:
- Prepare a new credential (dual-valid if possible).
- Deploy with fallback to the old key (temporary).
- Test the read-only connection first.
Verification:
- Integration request successful.
- No spike in auth errors.
Rollback risk:
- Return to the old credential which is still active.
- Document rotation times.
5) Handle failed queue jobs
Objective: recover failed jobs without duplicating side effects.
Changed files:
- Related job handlers
- Configure queue/retry
docs/observability-ops.md
Safe steps:
- Identify the root cause of failed_jobs/log.
- Make sure the job is idempotent before mass retry.
- Retry gradually.
Verification:
- Failed job count goes down.
- No duplicate data.
Rollback risk:
- Stop retry.
- Restore affected data if there is duplication.
6) Slow query patch
Goal: reduce heavy endpoint response time.
Changed files:
- Repository/query builder
- Migration index (if necessary)
docs/database-design-full.md
Safe steps:
- Take a baseline query plan.
- Change the query/index one by one.
- Test performance on representative staging data.
Verification:
- P95 latency improved.
- Query results remain consistent.
Rollback risk:
- Revert new query/index if write performance decreases.
7) Update input validation rules
Purpose: close invalid data entering the system.
Changed files:
- FormRequest/validator
- Validation test
docs/api-cookbook.md
Safe steps:
- Mark new validations that have the potential to be breaking.
- If breaking, gradual release + communication.
- Add valid/invalid payload examples.
Verification:
- Invalid input is rejected with a clear message.
- Long valid input remains safe (if non-breaking).
Rollback risk:
- Restore old rules temporarily.
- Note the impact of invalid data that has already been entered.
8) Adjustment of role permissions
Purpose: adjust access rights without opening loopholes.
Changed files:
- Middleware/Policy/Gate
- Seeder role-permission (if any)
docs/role-access-matrix.md
Safe steps:
- List of affected endpoints.
- Update policy + test access per role.
- Review by senior before merge.
Verification:
- Target roles can be accessed as needed.
- Other roles remain blocked.
Rollback risk:
- Revert mapping permissions.
- Audit access during the change period.
##9) Production bug hotfix (non-schema) Goal: fix critical bugs as quickly as possible but safely.
Changed files:
- Bug source files (controller/service)
- Regression test
docs/changelog.md
Safe steps:
- Reproduce bugs.
- Minimal patch (smallest safe fix).
- Add regression tests before deploying.
Verification:
- Symptoms disappear.
- The main line is not damaged.
Rollback risk:
- Rollback hotfix release.
- Enable temporary workarounds if available.
10) Business enum/state changes
Objective: add/change state without breaking old flow.
Changed files:
- Enum/model/validator status
- State transition logic
docs/state-machine.md,docs/business-flows.md
Safe steps:
- Define a new complete state transition.
- Check the impact on reports, notifications and API.
- Backfill old data if necessary.
Verification:
- Valid state transition according to flow.
- Reports and notifications do not miscalculate.
Rollback risk:
- Disable new status.
- Restore data to old state (according to data playbook).