Skip to content

[WIP] Lingo: Plain Variable Assignments#3673

Draft
KPrasch wants to merge 9 commits intonucypher:v7.7.xfrom
KPrasch:assignment
Draft

[WIP] Lingo: Plain Variable Assignments#3673
KPrasch wants to merge 9 commits intonucypher:v7.7.xfrom
KPrasch:assignment

Conversation

@KPrasch
Copy link
Member

@KPrasch KPrasch commented Nov 27, 2025

Type of PR:
Feature

Required reviews:
2

Update BaseExecConditionDict and SigningObjectAttributeCondition
TypedDict classes to use NotRequired for returnValueTest field.
This is a type-only change preparing for optional returnValueTest
support in condition variables.
When validating objects created via Python constructor (not from
user JSON), set direct_construction flag so schemas can allow
optional fields like returnValueTest to be None.
Update ConditionVariable.Schema to set in_condition_variable flag
during deserialization, and update _ConditionField to propagate
this context to nested condition schemas. This allows conditions
inside ConditionVariable to have optional returnValueTest.

Also update ExecutionCallCondition to make returnValueTest optional
when inside a ConditionVariable or when directly constructed.
Update ContextVariableCondition, JsonCondition, and
SigningObjectAttributeCondition to allow returnValueTest to be
omitted when inside a ConditionVariable or when directly constructed.

When returnValueTest is None, verify() returns (True, value),
treating successful extraction as a passing condition.
Update RPCCondition, ContractCondition, TimeCondition, and
BaseJsonRequestCondition to handle None returnValueTest:
- Skip return type validation when returnValueTest is None
- Return (True, result) from verify() when no test is defined
- Update TimeCondition repr and timestamp property for None case
Test that conditions inside ConditionVariable can omit returnValueTest
for pure value extraction, while standalone conditions still require it.
Covers JsonCondition, ContextVariableCondition, SequentialCondition,
operations, and serialization roundtrips.
Convert unittest-style test class to pytest standard format to match
the rest of the test file. Moved inline imports to top of file.
Fixed incorrect assertion in test_json_condition_without_return_value_test_with_operations.
- test_context_var_condition.py: Update to reflect that direct
  construction without returnValueTest is now allowed, but
  from_dict (standalone) still requires it
- test_optional_return_value_test.py: Fix invalid string values
  in ReturnValueTest that don't pass ast.literal_eval
@codecov
Copy link

codecov bot commented Nov 27, 2025

Codecov Report

❌ Patch coverage is 89.18919% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.63%. Comparing base (0467910) to head (088524d).

Files with missing lines Patch % Lines
nucypher/policy/conditions/signing/base.py 75.00% 3 Missing ⚠️
nucypher/policy/conditions/lingo.py 90.00% 2 Missing ⚠️
nucypher/policy/conditions/evm.py 85.71% 1 Missing ⚠️
nucypher/policy/conditions/json/base.py 50.00% 1 Missing ⚠️
nucypher/policy/conditions/time.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           v7.7.x    #3673      +/-   ##
==========================================
- Coverage   86.72%   86.63%   -0.10%     
==========================================
  Files         151      151              
  Lines       15270    15330      +60     
==========================================
+ Hits        13243    13281      +38     
- Misses       2027     2049      +22     
Flag Coverage Δ
acceptance 97.24% <ø> (-0.45%) ⬇️
integration 86.63% <89.18%> (-0.10%) ⬇️
unit 86.63% <89.18%> (-0.10%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Convert unittest-style test classes to module-level functions to match
project conventions. Tests are now organized with comment section headers
instead of class groupings.
@derekpierre
Copy link
Member

derekpierre commented Nov 28, 2025

Interesting. Still processing but some things that jump out at me:

  1. Taking a step back, philosophically, what is a "Condition" without a returnValueTest? It feels like this is no longer a "Condition" but something different i.e. the resulting value is not compared against some other value

  2. Building on 1) some time ago we did this separation of a "Condition" into an ExecutionCall and a returnValueTest (on the Python side), so it feels like ExecutionCall is an existing abstraction that can be leveraged for execution without a returnValueTest. See background information in the description of Sequential Conditions #3500 - we just didn't take it that far since it was out of scope at the time.

  3. Building on 2) there was a prior musing about SequentialConditions possibly being made up of a combination of "Condition Variables" based on "Conditions" and "Execution Variables" based on "Execution Calls" - see Additional SequentialConditions considerations #3555 for an earlier exploration of that idea that you and I chatted about.

  4. Any validation logic we have in python needs to be repeatable in taco-web. So I would recommend having PRs for both to ensure that whatever logic we employ is repeatable in both codebases.

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