Skip to content

test: verify failed opt-in writes roll back in a real CUBRID session #608

Open

Description

@yeongseon

Gap observed

tests/test_integration_readonly.py proves that an explicitly enabled execute_write can commit one valid INSERT and refuses DDL or multi-statement input. tests/test_write_mode.py tests rollback on failure with fake connections. A focused real-CUBRID failed DML transaction and subsequent reuse proof remains useful.

Task

  • Create a run-owned table with a primary key and a known baseline row. Enable CUBRID_MCP_WRITE=1 only inside the isolated test MCP process, not as a repo/global default or live deployment configuration.
  • Via mcp.call_tool("execute_write", ...) or a real stdio MCP client, attempt a single INSERT conflicting with an existing PK. Confirm an error with client-safe wording; separately query CUBRID to prove the failed statement committed zero changes.
  • Then send a valid INSERT through the same MCP connection and verify it commits exactly once and remains visible to an independent observer. Confirm that failed writes do not poison subsequent reads or transaction state.
  • Include a cleanup/error path; do not rely solely on a fake's rollback() call count.

Acceptance

  • Reproducible duplicate-key failure against actual CUBRID 11.4, followed by a successful write and read, with independent SQL checking persisted rows.
  • Normal read-only configuration still does not offer/allow writes; no DDL is exposed as a tool.
  • Only fixture-owned objects are modified or removed; all attempts are restricted to the disposable lab.
  • Integration JUnit/evidence and applicable CI are green. No change to write-mode defaults, public write semantics or schema.

Separate from the already-implemented #451 success/DDL safety path and the fake unit rollback tests.

Required live evidence and safety

  • This is a real-CUBRID task, not an offline/mock-only issue. Use the repository's existing run-owned Docker Compose integration setup (make integration, CUBRID 11.4 by default), or a clearly documented disposable local lab. Do not use production/customer DBs. The public cubrid/cubrid:11.4 Docker image is amd64-only; a supported x86_64 runner is acceptable.
  • Arrange fixtures with a dedicated run-unique mcp_it_... name. Creation must fail rather than silently reuse another table/user; clean up only objects that this test created, including after assertion failures. DBA credentials are permitted solely for local fixture setup/cleanup, never as the MCP read-only user.
  • PR must state the actual SQL/fixture, CUBRID server version, tool-call output/assertions, exact run command and PASS/FAIL/NOT RUN. Existing test-results/integration/summary.json and environment.json can supply sanitized evidence. No tokens, passwords, user data, unredacted logs, or external DB URLs in PR artifacts.
  • Keep MCP's default read-only behavior, current tool schemas, CI security rules, release configuration and API compatibility unchanged. An offline fake may complement the proof but cannot satisfy the live acceptance criterion.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triageNot yet looked at by a maintainertestingTest coverage or test fixes

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions