Skip to content

fix integration test suites under -Dwarnings and CI DB env - #128

Draft
100-tokens wants to merge 8 commits into
masterfrom
cursor/fix-integration-suites-d23c
Draft

fix integration test suites under -Dwarnings and CI DB env#128
100-tokens wants to merge 8 commits into
masterfrom
cursor/fix-integration-suites-d23c

Conversation

@100-tokens

Copy link
Copy Markdown
Contributor

Summary

Fixes compile and runtime failures in crate integration suites so they pass with RUSTFLAGS=-Dwarnings against a local/CI Postgres where the app role may share the superuser URL.

Changes

  • Resolve -Dwarnings failures in auth/governance/db/entra/siem/webhooks integration helpers; rewrite stale identity-merge and micro-cert suites
  • OAuth/import: DbPool::connect_app, correct schema/fixtures, DATABASE_URL_SUPERUSER for setup
  • Token exchange tests: real NHI owner_id users + required actor_token_type form field
  • Align xavyo-db system-tenant test with bootstrap (no seed admin users)
  • Weak-password registration test uses validate_password (handler contract; AuthService::register does not validate)
  • Scope outlier peer-stats source guard to load_peer_group_stats only
  • Desktop UA parser classification (included from related fix)

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Other: test suite repair

Checklist

  • Code compiles (cargo check on touched crates)
  • Tests pass (targeted integration suites below)
  • No clippy warnings (cargo clippy --workspace -- -D warnings)
  • Code formatted (cargo fmt --all --check)
  • Conventional commit messages used
  • Documentation updated (if applicable)
  • Multi-tenancy: all queries include tenant_id filter

Testing

Retested with SQLX_OFFLINE=true, RUSTFLAGS=-Dwarnings, PG on :5432:

Package Result
xavyo-db --features integration PASS
xavyo-api-auth --features integration PASS
xavyo-api-oauth --features integration PASS
xavyo-api-import --features integration PASS
xavyo-governance --features integration PASS
xavyo-api-governance --lib PASS
xavyo-connector-entra / xavyo-siem / xavyo-webhooks --features integration PASS

Notes

Seed SQL remains empty by design; system tenant comes from bootstrap/migrations. Password policy stays at handler/validate_password layer per AuthService::register docs.

Open in Web Open in Cursor 

cursoragent and others added 8 commits August 28, 2026 04:05
Add DbPool::connect_app with automatic SET ROLE xavyo_app for superuser
connections so RLS policies apply when DATABASE_URL points at the xavyo
superuser. Split OAuth test pools so service tests keep the regular pool
while direct RLS SQL tests use the enforced pool with session-level tenant
context.

Align OAuth token isolation inserts with current schema (scope, family_id,
code_challenge). Fix import helpers and tests for tenant_id on errors,
one-active-job-per-tenant constraint, unique token hashes, and empty CSV
rejection behavior.

Co-authored-by: Pascal Le Clech <100-tokens@users.noreply.github.com>
…tests

Prefix unused bindings, add auto_assign_initial_state to lifecycle test
initializers, and allow dead_code/unused_imports in shared integration
test helpers across connector-entra, governance, siem, and webhooks crates.

Co-authored-by: Pascal Le Clech <100-tokens@users.noreply.github.com>
Replace outdated DB-model and service calls with focused tests that
match current IdentityMergeService, MicroCertificationService, and
CreateMicroCertTrigger APIs so integration builds pass under -Dwarnings.

Co-authored-by: Pascal Le Clech <100-tokens@users.noreply.github.com>
detect_device_type returned unknown for all non-mobile UAs, breaking
Chrome/Windows and Firefox/macOS parsing. Treat Windows/macOS/Linux/X11
signals as desktop while keeping unrecognized UAs as unknown.

Co-authored-by: Pascal Le Clech <100-tokens@users.noreply.github.com>
Seed SQL no longer creates admin@test users; assert the system tenant
from bootstrap and RLS readability for a created user instead.

Co-authored-by: Pascal Le Clech <100-tokens@users.noreply.github.com>
AuthService::register documents that callers validate first (handlers
use PasswordPolicyService). Match that contract in the registration
integration test instead of expecting WeakPassword from register().

Co-authored-by: Pascal Le Clech <100-tokens@users.noreply.github.com>
Create real owner users for nhi_identities inserts and send
actor_token_type on token-exchange forms so HTTP cases exercise
delegation instead of failing invalid_request early.

Co-authored-by: Pascal Le Clech <100-tokens@users.noreply.github.com>
The unwrap_or(0.0) check was scanning past load_peer_group_stats into
unrelated trend helpers and failing spuriously.

Co-authored-by: Pascal Le Clech <100-tokens@users.noreply.github.com>
Comment on lines +117 to +118
"expected a special-character error, got {:?}",
no_special.errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants