Skip to content

feat(spp_cel_domain): SQL CASE compiler, read-only smart-op lookup, translator cache tests (re-land from #76)#275

Open
gonzalesedwin1123 wants to merge 3 commits into
19.0from
reland/cel-domain
Open

feat(spp_cel_domain): SQL CASE compiler, read-only smart-op lookup, translator cache tests (re-land from #76)#275
gonzalesedwin1123 wants to merge 3 commits into
19.0from
reland/cel-domain

Conversation

@gonzalesedwin1123

Copy link
Copy Markdown
Member

Re-lands the spp_cel_domain portion of reverted PR #76 (revert: #271).

Summary

Verification

  • ./spp t spp_cel_domain: 621 passed, 0 failed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the compilation of CEL ternary expressions into SQL CASE WHEN expressions via the new to_sql_case method, supported by new helper methods in SQLBuilder and a right-associative parsing fix in the CEL parser. Additionally, it updates the _smart_op_domain method to perform read-only lookups for gender labels instead of creating records on the fly, and adds comprehensive unit tests covering the new SQL compilation logic, read-only lookups, and translation cache helpers. There are no review comments to assess, and the changes appear solid and well-tested.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.32886% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 68.90%. Comparing base (bf61488) to head (ce126f7).
⚠️ Report is 1 commits behind head on 19.0.

Files with missing lines Patch % Lines
spp_cel_domain/models/cel_translator.py 99.28% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             19.0     #275      +/-   ##
==========================================
- Coverage   74.86%   68.90%   -5.96%     
==========================================
  Files        1093      279     -814     
  Lines       63718    20393   -43325     
==========================================
- Hits        47701    14052   -33649     
+ Misses      16017     6341    -9676     
Flag Coverage Δ
endpoint_route_handler ?
fastapi ?
spp_aggregation ?
spp_alerts ?
spp_analytics 93.13% <ø> (ø)
spp_api_v2 ?
spp_api_v2_change_request 66.41% <ø> (ø)
spp_api_v2_cycles 70.65% <ø> (ø)
spp_api_v2_data 77.43% <ø> (ø)
spp_api_v2_entitlements 69.96% <ø> (ø)
spp_api_v2_gis 71.52% <ø> (ø)
spp_api_v2_products ?
spp_api_v2_programs 92.03% <ø> (ø)
spp_api_v2_service_points ?
spp_api_v2_simulation 71.12% <ø> (ø)
spp_api_v2_vocabulary ?
spp_approval 50.29% <ø> (ø)
spp_area ?
spp_area_hdx ?
spp_attachment_av_scan ?
spp_audit ?
spp_audit_programs 0.00% <ø> (ø)
spp_banking ?
spp_base_common 90.26% <ø> (ø)
spp_base_setting ?
spp_case_base ?
spp_case_cel 89.01% <ø> (ø)
spp_case_demo ?
spp_case_entitlements 97.61% <ø> (ø)
spp_case_graduation ?
spp_case_programs 97.14% <ø> (ø)
spp_case_registry ?
spp_case_session ?
spp_cel_domain 63.77% <99.32%> (+1.54%) ⬆️
spp_cel_event 85.23% <ø> (ø)
spp_cel_registry_search 0.00% <ø> (ø)
spp_cel_vocabulary ?
spp_change_request_v2 ?
spp_claim_169 ?
spp_cr_type_assign_program ?
spp_cr_types_advanced ?
spp_cr_types_base ?
spp_dci ?
spp_dci_client ?
spp_dci_client_dr ?
spp_dci_client_ibr ?
spp_dci_client_sr ?
spp_dci_compliance ?
spp_dci_demo ?
spp_dci_indicators ?
spp_dci_server ?
spp_dci_server_social ?
spp_demo ?
spp_demo_phl_luzon ?
spp_disability_registry ?
spp_drims ?
spp_drims_sl ?
spp_drims_sl_demo ?
spp_encryption ?
spp_farmer_registry ?
spp_farmer_registry_cr ?
spp_farmer_registry_demo ?
spp_farmer_registry_vocabularies ?
spp_gis ?
spp_gis_indicators ?
spp_gis_report ?
spp_graduation ?
spp_grm ?
spp_grm_case_link ?
spp_grm_demo ?
spp_hazard ?
spp_hazard_programs ?
spp_hxl_area ?
spp_import_match ?
spp_indicator ?
spp_irrigation ?
spp_land_record ?
spp_metric ?
spp_metric_service ?
spp_metrics_core ?
spp_metrics_services ?
spp_mis_demo_v2 ?
spp_oauth ?
spp_program_geofence ?
spp_programs 65.27% <ø> (ø)
spp_registrant_gis ?
spp_registry 86.83% <ø> (ø)
spp_registry_group_hierarchy ?
spp_scoring ?
spp_scoring_programs ?
spp_security 66.66% <ø> (ø)
spp_service_points ?
spp_simulation ?
spp_starter_disability_registry ?
spp_starter_farmer_registry ?
spp_starter_social_registry ?
spp_starter_sp_mis ?
spp_statistic ?
spp_storage_backend ?
spp_studio ?
spp_studio_change_requests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
spp_cel_domain/__manifest__.py 0.00% <ø> (ø)
spp_cel_domain/models/cel_sql_builder.py 95.27% <100.00%> (+0.31%) ⬆️
spp_cel_domain/services/cel_parser.py 82.44% <100.00%> (ø)
spp_cel_domain/models/cel_translator.py 46.94% <99.28%> (+11.36%) ⬆️

... and 814 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…SQL CASE (from #76)

Re-lands the spp_cel_domain portion of reverted PR #76:
- SQL CASE support: to_sql_case compiler for CEL ternaries, case_when/
  comparison builders, right-associative ternary parsing fix
- Read-only smart operator label lookup (no record creation, no sudo
  during compilation)
- Tests for the translation cache helpers

tests/__init__.py was merged by hand to keep imports added by later
security PRs (#251/#257/#223). Version bumped to 19.0.2.1.0 with a
HISTORY entry.
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.

1 participant