chore(cleanup): remove dead and stray code from src/ tree #218

Merged
David merged 3 commits from chore/pms-201-remove-dead-stray-code into main 2026-06-14 00:33:10 +02:00
Owner

Remove #[allow(dead_code)] items, unused exports, permanent stubs, and stale comments that masked real unused-code warnings. Pure cleanup, no behavior change.

  • router.rs: drop unused AppState struct and the StubModule/module_stub_routes/stub_handler 501 scaffold (every placeholder module has graduated).
  • db: remove TenantContext + the db/tenant.rs module and its pub use (default_tenant_id was already removed in PMS-262).
  • utils/validation.rs: remove unused validators (validate_timezone, validate_hex_color, validate_not_blank, validate_uuid, sanitize_html, truncate) and their tests.
  • utils/pagination.rs: remove FilterParams + tags_vec/has_filters (used only by their own tests).
  • main.rs: remove the now-single, never-called AppConfig::is_multi_tenant.
  • tickets/service.rs: remove dead list_tickets (callers use list_ticket_responses) and zero-caller get_ticket_by_number; fix the intra-doc link left dangling.
  • tenants/service.rs: remove zero-caller get_tenant_by_slug.
  • calendar: remove the permanent empty-list list_events stub, its route, and the orphaned CalendarEvent/CalendarEventFilter types; stop binding-and-discarding v in the on_call_now weekly/daily arms.
  • billing/service.rs: remove the _force_use import-suppression shim (AppError is used directly throughout).
  • portal: remove unwired PortalAuthService::set_password and the no-caller CurrentContact::full_name.
  • auth/middleware.rs: remove the unregistered require_auth free fn and the no-caller get_tenant_id/get_current_user free fns.
  • auth/google_login.rs: remove the never-constructed StateCookieError::Missing variant.
  • auth/oidc_rs.rs: remove the stale file-level #![allow(dead_code)] (module is wired via with_bunyip) and the write-only JwksCache.jwks_uri field; correct the stale "not yet wired" docs in oidc_rs.rs and auth/mod.rs.

Two audit items were verified against current main and deliberately not actioned, because the audit was captured at an older revision (9cd4103) and the codebase has moved on:

  • db/pool.rs begin_with_tenant + TenantTransaction are NOT dead. The RLS work (parent PMS-255, migration 038) since wired them through nearly every service module; removing them would break the build.
  • error.rs CoreError::is_client_error/is_server_error + its IntoResponse were already removed by the merged architecture-convergence work (PMS-198); no such code remains.

Deferred: dropping the unused user_sessions.token_hash column. The column is NOT NULL with an index, so removal needs a new migration (outside this issue's src/-tree scope), and the audit flags it for coordination with the separate legacy-auth plaintext-token fix, which may repurpose or hash the column. Left in place to avoid colliding with that in-flight change.

#PMS-201

Remove #[allow(dead_code)] items, unused exports, permanent stubs, and stale comments that masked real unused-code warnings. Pure cleanup, no behavior change. - router.rs: drop unused AppState struct and the StubModule/module_stub_routes/stub_handler 501 scaffold (every placeholder module has graduated). - db: remove TenantContext + the db/tenant.rs module and its pub use (default_tenant_id was already removed in PMS-262). - utils/validation.rs: remove unused validators (validate_timezone, validate_hex_color, validate_not_blank, validate_uuid, sanitize_html, truncate) and their tests. - utils/pagination.rs: remove FilterParams + tags_vec/has_filters (used only by their own tests). - main.rs: remove the now-single, never-called AppConfig::is_multi_tenant. - tickets/service.rs: remove dead list_tickets (callers use list_ticket_responses) and zero-caller get_ticket_by_number; fix the intra-doc link left dangling. - tenants/service.rs: remove zero-caller get_tenant_by_slug. - calendar: remove the permanent empty-list list_events stub, its route, and the orphaned CalendarEvent/CalendarEventFilter types; stop binding-and-discarding v in the on_call_now weekly/daily arms. - billing/service.rs: remove the _force_use import-suppression shim (AppError is used directly throughout). - portal: remove unwired PortalAuthService::set_password and the no-caller CurrentContact::full_name. - auth/middleware.rs: remove the unregistered require_auth free fn and the no-caller get_tenant_id/get_current_user free fns. - auth/google_login.rs: remove the never-constructed StateCookieError::Missing variant. - auth/oidc_rs.rs: remove the stale file-level #![allow(dead_code)] (module is wired via with_bunyip) and the write-only JwksCache.jwks_uri field; correct the stale "not yet wired" docs in oidc_rs.rs and auth/mod.rs. Two audit items were verified against current main and deliberately not actioned, because the audit was captured at an older revision (9cd4103) and the codebase has moved on: - db/pool.rs begin_with_tenant + TenantTransaction are NOT dead. The RLS work (parent PMS-255, migration 038) since wired them through nearly every service module; removing them would break the build. - error.rs CoreError::is_client_error/is_server_error + its IntoResponse were already removed by the merged architecture-convergence work (PMS-198); no such code remains. Deferred: dropping the unused user_sessions.token_hash column. The column is NOT NULL with an index, so removal needs a new migration (outside this issue's src/-tree scope), and the audit flags it for coordination with the separate legacy-auth plaintext-token fix, which may repurpose or hash the column. Left in place to avoid colliding with that in-flight change. #PMS-201
chore(cleanup): remove dead and stray code from src/ tree
Some checks failed
E2E / Playwright against staging (pull_request) Failing after 34s
Check / fmt + clippy + compile + tests (pull_request) Failing after 2m29s
842b18f65e
Remove #[allow(dead_code)] items, unused exports, permanent stubs, and stale comments that masked real unused-code warnings. Pure cleanup, no behavior change.

- router.rs: drop unused AppState struct and the StubModule/module_stub_routes/stub_handler 501 scaffold (every placeholder module has graduated).
- db: remove TenantContext + the db/tenant.rs module and its pub use (default_tenant_id was already removed in PMS-262).
- utils/validation.rs: remove unused validators (validate_timezone, validate_hex_color, validate_not_blank, validate_uuid, sanitize_html, truncate) and their tests.
- utils/pagination.rs: remove FilterParams + tags_vec/has_filters (used only by their own tests).
- main.rs: remove the now-single, never-called AppConfig::is_multi_tenant.
- tickets/service.rs: remove dead list_tickets (callers use list_ticket_responses) and zero-caller get_ticket_by_number; fix the intra-doc link left dangling.
- tenants/service.rs: remove zero-caller get_tenant_by_slug.
- calendar: remove the permanent empty-list list_events stub, its route, and the orphaned CalendarEvent/CalendarEventFilter types; stop binding-and-discarding v in the on_call_now weekly/daily arms.
- billing/service.rs: remove the _force_use import-suppression shim (AppError is used directly throughout).
- portal: remove unwired PortalAuthService::set_password and the no-caller CurrentContact::full_name.
- auth/middleware.rs: remove the unregistered require_auth free fn and the no-caller get_tenant_id/get_current_user free fns.
- auth/google_login.rs: remove the never-constructed StateCookieError::Missing variant.
- auth/oidc_rs.rs: remove the stale file-level #![allow(dead_code)] (module is wired via with_bunyip) and the write-only JwksCache.jwks_uri field; correct the stale "not yet wired" docs in oidc_rs.rs and auth/mod.rs.

Two audit items were verified against current main and deliberately not actioned, because the audit was captured at an older revision (9cd4103) and the codebase has moved on:
- db/pool.rs begin_with_tenant + TenantTransaction are NOT dead. The RLS work (parent PMS-255, migration 038) since wired them through nearly every service module; removing them would break the build.
- error.rs CoreError::is_client_error/is_server_error + its IntoResponse were already removed by the merged architecture-convergence work (PMS-198); no such code remains.

Deferred: dropping the unused user_sessions.token_hash column. The column is NOT NULL with an index, so removal needs a new migration (outside this issue's src/-tree scope), and the audit flags it for coordination with the separate legacy-auth plaintext-token fix, which may repurpose or hash the column. Left in place to avoid colliding with that in-flight change.

#PMS-201
Merge branch 'main' into chore/pms-201-remove-dead-stray-code
Some checks failed
E2E / Playwright against staging (pull_request) Failing after 1m2s
Check / fmt + clippy + compile + tests (pull_request) Failing after 4m36s
8d564e01e2
Merge origin/main into chore/pms-201-remove-dead-stray-code
Some checks failed
E2E / Playwright against staging (pull_request) Failing after 17s
Check / fmt + clippy + compile + tests (pull_request) Successful in 3m14s
Create release / Create release from merged PR (pull_request) Has been skipped
57558520f1
Resolve 4 conflicts where this dead-code-removal branch collided with
newer merged work. Kept main's version in each, since the targeted code was
modified/added after this branch was cut:
- src/main.rs: keep is_dev_or_test (used by cookie_secure) and is_multi_tenant (PMS-262).
- src/modules/portal/service.rs: keep setup_password (live PMS-136 token redemption) and set_password; restore the hash_password import.
- src/modules/tickets/service.rs: keep list_tickets (refactored by PMS-197) and get_ticket_by_number.
- src/utils/validation.rs: keep truncate (hardened by PMS-196) and sanitize_html plus their tests.

The branch's non-conflicting dead-code removals (~640 lines across 18 files) still apply.

#PMS-201
David merged commit e1e04e2f38 into main 2026-06-14 00:33:10 +02:00
David deleted branch chore/pms-201-remove-dead-stray-code 2026-06-14 00:33:10 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-server!218
No description provided.