Files
cleveragents-core/features/postgresql_helpers_coverage.feature
T
freemo 051ee7c290
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 21s
CI / quality (pull_request) Successful in 31s
CI / typecheck (pull_request) Successful in 47s
CI / security (pull_request) Successful in 52s
CI / build (pull_request) Successful in 56s
CI / e2e_tests (pull_request) Successful in 5m1s
CI / integration_tests (pull_request) Successful in 5m30s
CI / unit_tests (pull_request) Successful in 5m42s
CI / docker (pull_request) Successful in 58s
CI / coverage (pull_request) Successful in 7m35s
CI / build (push) Successful in 21s
CI / docker (push) Has been skipped
CI / benchmark-regression (pull_request) Failing after 49m24s
CI / lint (push) Successful in 22s
CI / quality (push) Successful in 39s
CI / security (push) Successful in 48s
CI / typecheck (push) Successful in 1m26s
CI / benchmark-regression (push) Has been skipped
CI / e2e_tests (push) Successful in 5m53s
CI / coverage (push) Successful in 9m4s
CI / benchmark-publish (push) Successful in 19m10s
CI / integration_tests (push) Failing after 19m18s
CI / unit_tests (push) Failing after 19m20s
test(coverage): add Behave BDD tests to improve coverage across 52 source files
Added 52 new .feature files and corresponding _steps.py files targeting
previously uncovered code paths in the following areas:

- TUI layer: app, commands, persona (state/schema/registry), widgets,
  input (shell_exec, reference_parser)
- Application services: plan lifecycle/service/executor, session,
  project, repo indexing, correction, checkpoint, actor, llm_actors,
  strategy coordinator, resource file watcher, service retry wiring
- CLI commands: session, resource, repl, plan, db, automation_profile
- Domain models: retry_policy, resource_type, cost_budget,
  docker_compose_analyzer, detail_level, _sql_string_aware,
  _postgresql_helpers
- Core: circuit_breaker, retry_service_patterns
- Infrastructure: repositories, transaction_sandbox, strategy_registry,
  plugins/loader, container
- Config: settings
- Agents: plan_generation, context_analysis, auto_debug
- A2A: facade

All new tests follow the Behave/Gherkin BDD standard. Resolved step
definition collisions with unique prefixes. Fixed Alembic fileConfig
logger disabling issue (disable_existing_loggers=False).

ISSUES CLOSED: #1068
2026-03-20 21:22:10 +00:00

96 lines
4.7 KiB
Gherkin

Feature: PostgreSQL Helpers Coverage
Additional scenarios that exercise previously uncovered code paths
in the _postgresql_helpers module (lines 50, 192, 197-204, 215, 230, 384-388, 434).
Background:
Given the postgresql helpers module is imported
# --- ident_pair: quoted identifier with escaped double-quotes (line 50) ---
Scenario: ident_pair returns unescaped quoted identifier
Given a regex match with a quoted identifier containing escaped double-quotes
When I call ident_pair on the quoted match
Then the result should have double-quotes unescaped
# --- _skip_quoted: escaped quote inside string (line 192) ---
Scenario: extract_body handles escaped single-quotes inside strings
Given SQL content with parenthesized body containing escaped single-quotes
When I call extract_body on the content
Then the body should be extracted correctly with the quoted string intact
Scenario: split_entries handles escaped double-quotes inside identifiers
Given a table body with escaped double-quotes in an identifier
When I call split_entries on the body
Then the entries should be split correctly preserving the identifier
# --- _skip_quoted: unclosed quote returns end of string (line 197) ---
Scenario: extract_body handles unclosed single-quote gracefully
Given SQL content with an unclosed single-quote inside parentheses
When I call extract_body on the unclosed-quote content
Then extract_body should return an empty string for unbalanced parens
# --- _skip_quoted: dollar-quoting (lines 198-203) ---
Scenario: extract_body handles dollar-quoted strings
Given SQL content with a dollar-quoted string inside parentheses
When I call extract_body on the dollar-quoted content
Then the body should be extracted correctly ignoring dollar-quoted content
Scenario: split_entries handles dollar-quoted strings with commas inside
Given a table body containing a dollar-quoted string with commas
When I call split_entries on the dollar-quoted body
Then the comma inside the dollar-quoted string should not split entries
Scenario: extract_body handles unclosed dollar-quoted string
Given SQL content with an unclosed dollar-quoted string
When I call extract_body on the unclosed dollar-quote content
Then extract_body should handle the unclosed dollar-quote gracefully
# --- _skip_quoted: lone dollar sign not forming dollar-quote (line 204) ---
Scenario: extract_body handles lone dollar sign not forming dollar-quote
Given SQL content with a lone dollar sign that is not a dollar-quote tag
When I call extract_body on the lone-dollar content
Then the body should be extracted correctly ignoring the lone dollar
# --- extract_body: invalid paren_start (line 215) ---
Scenario: extract_body returns empty string for out-of-bounds paren_start
When I call extract_body with paren_start beyond content length
Then extract_body should return an empty string for invalid start
Scenario: extract_body returns empty string when paren_start is not a paren
When I call extract_body with paren_start pointing at a non-paren character
Then extract_body should return an empty string for non-paren start
# --- extract_body: unbalanced parentheses (line 230) ---
Scenario: extract_body returns empty string for unbalanced opening paren
Given SQL content with an opening paren but no closing paren
When I call extract_body on the unbalanced content
Then extract_body should return an empty string for missing close paren
# --- extract_fk_triples: column count mismatch (lines 384-388) ---
Scenario: extract_fk_triples warns on source/target column count mismatch
Given a FOREIGN KEY clause with mismatched source and target column counts
When I extract FK triples from the mismatched clause
Then a warning should be logged about the column count mismatch
And triples should be generated only for the shorter column list
# --- parse_table_body: empty entry triggers continue (line 434) ---
Scenario: parse_table_body skips empty entries in the table body
Given a table body string with empty entries between commas
When I call parse_table_body on the body with empty entries
Then parse_table_body should produce triples only for valid column definitions
# --- Combined: FK with quoted schema containing escaped double-quotes (line 50 via extract_fk_triples) ---
Scenario: extract_fk_triples handles quoted schema with escaped double-quotes
Given a FOREIGN KEY clause referencing a quoted schema with escaped double-quotes
When I extract FK triples from the quoted-schema clause
Then the triples should reference the correctly unescaped schema name