Skip to content

πŸ”§ Audit polish: migration test scoping, dead fallback, OAuth guard test, failure counterΒ #3954

Description

@PierreBrisorgueil

What β€” Small test-quality and observability cleanups from the latest audit, batched.

Scope β€”

  • modules/billing/tests/billing.migration.backfill-signup-grant.integration.tests.js: the test runs the real up() unscoped over the shared organizations collection (filtered only by plan) β€” leftover free-plan orgs from other test files silently get credited. Scope the migration run/assertions to the seeded fixture ids.
  • modules/organizations/services/organizations.crud.service.js:128: the result.plan || 'free' fallback is unreachable (plan: 'free' is set unconditionally above) and its unit test forces the branch with a repository return shape the real repo cannot produce β€” drop the branch + test, or make the test realistic.
  • isEnabledOAuthProvider (auth): rests on passport's private _strategy API and every test mocks/stubs it β€” add one test against a really-registered strategy so a passport upgrade that renames the private API fails in CI instead of silently 404-ing OAuth logins.
  • modules/billing/migrations/20260707100000-backfill-missing-signup-grant-credits.js: the failed counter conflates plan-not-found, guard-stripped and genuine runtime errors (all null returns from grantOnSignup) β€” differentiate the three cases in the completion log.

Refs: internal audit 2026-07-16 (M3, L2, L3, L4).
Created via /dev:issue

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions