Skip to content

Commit 5537fa2

Browse files
committed
test: Verify null cannot delete required const trait
Signed-off-by: Aviator 5 <ai.agent.tor@gmail.com>
1 parent cbac189 commit 5537fa2

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

tests/test_op13_schema_traits_validation.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3391,6 +3391,56 @@ def test_start(self):
33913391
]
33923392

33933393

3394+
class TestCaseOp13_Merge_ConstLock_NullDeleteFails(HttpRunner):
3395+
"""ADR-0004 §"Conformance test suite" (g): null cannot delete a required lock.
3396+
3397+
RFC 7396 removes `indexed` from the merged traits object, but the effective
3398+
trait-schema also requires the property. The materialized object therefore
3399+
fails OP#13 instead of bypassing the const constraint.
3400+
"""
3401+
3402+
config = Config("OP#13 ADR-0004: const lock rejects null delete").base_url(
3403+
get_gts_base_url()
3404+
)
3405+
3406+
def test_start(self):
3407+
super().test_start()
3408+
3409+
teststeps = [
3410+
_register(
3411+
"gts://gts.x.test13.mconstdel.event.v1~",
3412+
{
3413+
"type": "object",
3414+
"x-gts-traits-schema": {
3415+
"type": "object",
3416+
"properties": {
3417+
"indexed": {"type": "boolean", "const": True},
3418+
},
3419+
"required": ["indexed"],
3420+
},
3421+
"x-gts-traits": {"indexed": True},
3422+
"required": ["id"],
3423+
"properties": {"id": {"type": "string"}},
3424+
},
3425+
"register base with const-and-required locked indexed=true",
3426+
),
3427+
_register_derived(
3428+
"gts://gts.x.test13.mconstdel.event.v1~x.test13._.kid.v1~",
3429+
"gts://gts.x.test13.mconstdel.event.v1~",
3430+
{
3431+
"type": "object",
3432+
"x-gts-traits": {"indexed": None},
3433+
},
3434+
"register descendant trying to delete indexed",
3435+
),
3436+
_validate_type_schema(
3437+
"gts.x.test13.mconstdel.event.v1~x.test13._.kid.v1~",
3438+
False,
3439+
"validate descendant - required prevents const-lock deletion",
3440+
),
3441+
]
3442+
3443+
33943444
class TestCaseOp13_Merge_ConstLock_IdempotentRestatementOk(HttpRunner):
33953445
"""ADR-0004: descendant restates const-locked value. Passes."""
33963446

0 commit comments

Comments
 (0)