Files
cleveragents-core/features/postgresql_analyzer_coverage_boost.feature
freemo a808c395f9
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 17s
CI / typecheck (pull_request) Successful in 35s
CI / security (pull_request) Successful in 50s
CI / unit_tests (pull_request) Successful in 2m46s
CI / integration_tests (pull_request) Successful in 3m16s
CI / docker (pull_request) Successful in 40s
CI / coverage (pull_request) Successful in 5m6s
CI / lint (push) Successful in 13s
CI / quality (push) Successful in 16s
CI / build (push) Successful in 18s
CI / security (push) Successful in 32s
CI / typecheck (push) Successful in 35s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 2m52s
CI / integration_tests (push) Successful in 3m8s
CI / docker (push) Successful in 39s
CI / coverage (push) Successful in 5m53s
CI / benchmark-publish (push) Successful in 16m55s
CI / benchmark-regression (pull_request) Successful in 33m0s
test(coverage): add Behave BDD tests to improve unit test coverage across 53 source modules
Add 53 new .feature files and corresponding step definition files targeting
uncovered lines identified in build/coverage.xml. Fix AmbiguousStep conflicts
in 7 pre-existing step files by disambiguating step text.

New tests cover: ACP clients/facade, actor CLI/config, application container,
ACMS service/strategies, async worker, automation profile CLI, autonomy
guardrail, bridge, change model, config CLI/service, context service,
cross-plan correction, database models, decision service, decomposition
clustering/service, discovery handler, langchain chat provider, langgraph
nodes, materializers, multi-project service, plan apply/CLI/lifecycle/model/
preflight/resume/service, PostgreSQL analyzer, project CLI/context CLI,
provider registry, reactive application/route, repositories, resolver handler,
resource registry service, resume model, retry patterns, sandbox protocol,
server CLI, skill CLI/service, skills registry, subplan execution/service,
system CLI, UKO loader, UoW, and YAML template engine.

Closes #645
2026-03-09 13:01:58 -04:00

70 lines
3.2 KiB
Gherkin

@phase2 @acms @analyzer @postgresql_analyzer @coverage_boost
Feature: PostgreSQLAnalyzer coverage boost
Additional scenarios targeting uncovered branches in
src/cleveragents/domain/models/acms/postgresql_analyzer.py.
Background:
Given a fresh PostgreSQLAnalyzer instance
# ---- Line 135: duplicate CREATE SCHEMA is skipped ---------------------
Scenario: Duplicate CREATE SCHEMA statements are deduplicated
When I analyze DDL with duplicate schemas:
"""
CREATE SCHEMA IF NOT EXISTS billing;
CREATE SCHEMA billing;
CREATE TABLE billing.invoices (id SERIAL PRIMARY KEY);
"""
Then exactly 1 Schema type triple should exist
And the result triples should contain predicate "rdfs:label" with value "billing"
# ---- Lines 112-116: exception handler returns partial results ---------
Scenario: Internal parse error returns partial results gracefully
When I analyze DDL that triggers an internal parse error
Then the partial results should be returned without raising
And the parse error should have been logged as a warning
# ---- Line 198: _extract_tables with tables_seen=None ------------------
Scenario: Calling _extract_tables directly with tables_seen defaulting to None
When I call _extract_tables directly without tables_seen on:
"""
CREATE TABLE widgets (id SERIAL PRIMARY KEY, name TEXT);
"""
Then the direct extraction should produce Table triples for "widgets"
# ---- Line 285: CREATE VIEW without trailing semicolon -----------------
Scenario: CREATE VIEW without trailing semicolon captures view definition
When I analyze DDL with a view missing its semicolon:
"""
CREATE VIEW recent_orders AS
SELECT * FROM orders WHERE created_at > NOW() - INTERVAL '7 days'
"""
Then the result triples should contain predicate "rdf:type" with uri "uko-data:View"
And the result triples should contain predicate "uko-data:viewDefinition" present
And the viewDefinition value should contain "SELECT"
# ---- Lines 297-302: schema-qualified CREATE VIEW ----------------------
Scenario: Schema-qualified CREATE VIEW emits schema and uko:contains link
When I analyze DDL with a schema-qualified view:
"""
CREATE VIEW reporting.monthly_sales AS
SELECT * FROM sales WHERE month = EXTRACT(MONTH FROM NOW());
"""
Then the result triples should contain predicate "rdf:type" with uri "uko-data:View"
And the result triples should contain predicate "rdf:type" with uri "uko-data:Schema"
And the result triples should contain predicate "uko:contains" linking schema "reporting" to view "monthly_sales"
Scenario: Schema-qualified OR REPLACE view also emits schema contains link
When I analyze DDL with a schema-qualified view:
"""
CREATE OR REPLACE VIEW analytics.daily_stats AS
SELECT COUNT(*) FROM events GROUP BY date;
"""
Then the result triples should contain predicate "rdf:type" with uri "uko-data:View"
And the result triples should contain predicate "rdf:type" with uri "uko-data:Schema"
And the result triples should contain predicate "uko:contains" linking schema "analytics" to view "daily_stats"