Skip to content

Library bugs found by the revived integration tests (archive, batch, web) #14

Closed

Description

@CodingAnarchy

Found while making the tests/ targets compile and run against real PostgreSQL 16 and MySQL 8 (#12). Each bug has a test gated with #[ignore = "bug: …"] that also returns early unless HAMMERWORK_TEST_KNOWN_BUGS=1 is set. CI runs with --include-ignored, so a plain ignore would still fail the build. To reproduce: HAMMERWORK_TEST_KNOWN_BUGS=1 cargo test --all-features --test <file> -- --include-ignored. Fixing a bug means removing the gate on its tests.

Archive

  • archive_jobs never moves or marks the job. It copies the row to hammerwork_jobs_archive but only sets archived_at on the original (src/queue/postgres.rs ~2277, src/queue/mysql.rs ~2106). get_job still returns Completed, contradicting docs/archiving.md. Tests: test_postgres_policy_based_archival, test_postgres_different_job_statuses_archival, test_mysql_basic_archival_flow, test_postgres_job_restoration.
  • restore_archived_job fails with a duplicate primary key. It re-inserts an id that is still in hammerwork_jobs (postgres.rs ~2413; same code in mysql.rs ~2244). Postgres error 23505. Test: test_postgres_compression_verification.
  • list_archived_jobs always reports ArchivalReason::Automatic. The reason is stored as plain text (Manual) but parsed with serde_json::from_str, which falls back to the default (postgres.rs ~2507, mysql.rs ~2324). Tests: test_postgres_list_archived_jobs_reason, test_mysql_list_archived_jobs_reason.
  • MySQL get_archival_stats fails to decode. SUM() returns DECIMAL, which is decoded as i64 (mysql.rs ~2372). Test: test_mysql_archival_stats.
  • JobArchiver::archive_jobs_with_progress / _with_events archive only one batch. Each makes a single archive_jobs call, which is capped at policy.batch_size (src/archive.rs ~860/~920). Tests: test_jobarchiver_event_publishing_comprehensive, test_jobarchiver_progress_tracking_comprehensive, test_jobarchiver_performance_with_public_pool.

Batch

  • Postgres get_batch_status fails to decode status. impl Type<Postgres> for BatchStatus (src/batch.rs ~62) lacks compatible(), so decoding the VARCHAR column errors with ColumnDecode … BatchStatus (TEXT) not compatible with VARCHAR (postgres.rs ~1085). Tests: 4 Postgres tests in batch_tests.rs, 2 in worker_batch_tests.rs.

hammerwork-web

  • WebDashboard::start() panics when CORS is disabled. warp::cors().allow_origin("none") panics with "missing scheme" (hammerwork-web/src/server.rs start). Test: test_dashboard_startup_without_cors.
  • The dashboard rejects MySQL URLs when both DB features are on. create_job_queue_with_type returns "MySQL database URL provided but PostgreSQL is the default when both features are enabled" (server.rs ~239). Test: test_dashboard_startup_with_mysql.
  • hammerwork-web fails to compile with no database feature enabled. Either make that work or emit a clear compile_error!.

cargo-hammerwork

  • 3 Postgres failures in cargo-hammerwork/tests/sql_query_tests.rs: test_postgres_spawn_list_queries, test_postgres_spawn_stats_queries, test_postgres_job_list_queries.

Part of #7.

Metadata

Metadata

Assignees

No one assigned

    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