Skip to content

Partial date-property TTL updates reset an omitted offset to zero #2170

Description

@HuaTNA

Description

Reconfigure.ObjectTTL.delete_by_date_property() changes an omitted ttl_offset to 0. A call that only supplies filter_expired_objects consequently includes an explicit defaultTtl: 0 in the generated TTL update block. Other TTL update helpers leave an omitted offset as None.

Reproduction

This inspects the TTL update block locally; it does not test the complete collection update request or server behavior:

from weaviate.classes.config import Reconfigure

update = Reconfigure.ObjectTTL.delete_by_date_property(filter_expired_objects=True)
print(update.defaultTtl)
print(update.merge_with_existing({}))
# Actual: 0 and {'enabled': True, 'filterExpiredObjects': True, 'defaultTtl': 0}
# Expected: None and {'enabled': True, 'filterExpiredObjects': True}

existing = {
    'enabled': True,
    'filterExpiredObjects': False,
    'deleteOn': 'expiresAt',
    'defaultTtl': 3600,
}
print(update.merge_with_existing(existing))

The direct TTL-block merge overwrites defaultTtl with zero even though no offset was supplied. An explicit ttl_offset=0 should still reset it. Negative existing offsets have the same issue.

Scope clarification from review

Review on #2171 identified a separate casing mismatch: the collection update path uses objectTTLConfig, while creation and reading use objectTtlConfig. A local collection merge with the latter spelling produces two blocks. The original reproduction above operates on an individual TTL block and cannot establish server-side preservation. The delete_by_* factories also set enabled=True, even for a filter-only call. Those existing behaviors need a maintainer decision before the offset fix lands.

Environment and validation

Originally reproduced on main commit 142d798, Python 3.13.13, macOS arm64. The offset coercion and related collection-key/activation paths remain present in upstream eb5546a8 inspected on 2026-09-29.

PR #2171 leaves None unchanged in the update factory; creation still defaults to zero. Revised regression tests verify offset omission directly, positive/negative TTL-block merges, explicit integer/timedelta offsets including zero, and the creation default. Restoring the coercion gives two failures; with the fix both configuration test modules pass (233 tests). No live-server integration test was run.

AI assistance was used to investigate, implement, and test this patch and review follow-up.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions