Skip to content

Increase CopiWeb.SessionStore coverage with focused branch tests#3247

Closed
sydseter with Copilot wants to merge 6 commits into
masterfrom
copilot/increase-test-coverage-session-store
Closed

Increase CopiWeb.SessionStore coverage with focused branch tests#3247
sydseter with Copilot wants to merge 6 commits into
masterfrom
copilot/increase-test-coverage-session-store

Conversation

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

The failing Copi CI job was a coverage-gate failure, not a functional regression: total coverage was 93.6% vs. the 95% minimum, with copi_web/session_store.ex called out at 93.1%. This change adds direct tests for the session-store branches that were previously undercovered without modifying production code or runtime behavior.

  • What changed

    • Added a dedicated CopiWeb.SessionStoreTest for direct branch coverage of the custom session store.
    • Kept the change scoped to tests under copi.owasp.org/test/copi_web/.
  • Cookie-backed session paths

    • Covers get/3, put/4, and delete/3 when PostgreSQL session storage is disabled.
    • Verifies round-trip cookie session persistence and cookie deletion semantics.
  • PostgreSQL-backed session paths

    • Covers put/4 storing encrypted session data and returning a cookie containing the PostgreSQL session id.
    • Covers get/3 restoring a valid persisted session.
    • Covers put/4 updating an existing session id and pruning expired rows.
    • Covers delete/3 removing the backing SessionRecord.
  • Failure and fallback branches

    • Covers missing cookie / missing session record behavior.
    • Covers expired persisted sessions.
    • Covers invalid encrypted payloads that fail decryption.
    • Covers decrypted payloads that are not valid serialized Erlang terms, exercising the rescue path in decrypt_database_session/1.
  • Representative example

    raw_cookie = postgres_cookie(conn, opts, "missing-session")
    
    assert {nil, %{}} = SessionStore.get(conn, raw_cookie, opts)

Copilot AI changed the title [WIP] Improve CI job by increasing test coverage for session store Increase CopiWeb.SessionStore coverage with focused branch tests Jul 17, 2026
Copilot AI requested a review from sydseter July 17, 2026 15:21
@sydseter sydseter closed this Jul 17, 2026
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.

2 participants