Skip to content

:valid-at appears to filter by transaction time instead of a fact's actual valid-from date #303

Closed

Description

@adityamukho

Summary

Per the wiki (Datalog-Reference), :valid-at is documented as the valid-time axis — "query facts that were valid on a specific date" — distinct from :as-of, which operates on transaction time. In practice, :valid-at does not appear to filter by a fact's actual stored :valid-from; it behaves as though bound to real-world transaction time instead.

Reproduction

Using temporal_reasoning's git-ingestion feature against a real repo (arangodb), which correctly transacts facts with :valid-from set to the git commit's actual historical timestamp:

(transact [...] {:valid-from "2012-04-25T12:33:35Z"})

(confirmed directly in temporal_reasoning's _ingest_transact, which passes the commit's real authored-date timestamp, not wall-clock ingestion time — so the input side is correct).

Querying for that exact fact (a commit entity with :hash "0e5e9569949fc94ea2bf2e6dab0657325f537470") with various :valid-at values:

:valid-at value Found?
"2012-04-25T12:33:35Z" (its actual, correctly-stored :valid-from) No
"2020-01-01T00:00:00Z" No
"2026-07-01T00:00:00Z" No
"2026-07-05T00:00:00Z" (today, during the real ingestion session) Yes
"9999-01-01T00:00:00Z" (far future) Yes

A [:find (count ?e) :valid-at "9999-01-01T00:00:00Z" :where [?e :entity-type :type/function]] query correctly returns the full current count (94635), confirming :valid-at does bound on something consistently — but the boundary where a fact "becomes visible" sits in the real-world ingestion window (this session's actual wall-clock activity, ~July 1-5 2026), not anywhere near the fact's documented, correctly-supplied :valid-from (2012-04-25).

Why this rules out the client side

temporal_reasoning's ingestion code passes :valid-from correctly (verified by reading _ingest_transact directly — it interpolates the commit's real ISO timestamp into the :valid-from map on every transact call). The write path is correct; the read path (:valid-at filtering) is not reflecting what was written.

Impact

This breaks the core bi-temporal use case: reconstructing what a fact set (e.g. code structure) looked like at a specific point in its own modeled history, independent of when it was actually ingested. Right now :valid-at seems to only distinguish "before this ingestion session" vs. "after," rather than genuinely slicing by each fact's individual valid-time window.

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions