Skip to content

TimeGate waits for the commit of a document's latest change - #511

Merged
namedgraph merged 2 commits into
developfrom
feature/timegate-pending
Nov 3, 2026
Merged

namedgraph merged 2 commits into
developfrom
feature/timegate-pending

Conversation

@namedgraph

Copy link
Copy Markdown
Member

Problem

A version is committed after the write that made it (VersioningFilter → commitAsync, queued per branch), and the write's response names no version. Right after a write the TimeGate therefore redirected to the version before it. A client that needs the version equal to the state it read, such as an approval that pins a version, had to poll the TimeMap and compare graphs. It also could not tell "not committed yet" from "commit failed" (failures are only logged).

Change

  • GraphVersioningService counts each document's queued and running commits (isCommitPending) and remembers whether its last commit failed (isCommitFailed, cleared by a later success). The failure is recorded before the commit stops counting as pending.
  • The TimeGate (?timegate) answers 503 with Retry-After: 1 (no-store) while a commit is pending, and 500 when the last one failed. Otherwise it redirects as before.
  • Unchanged: writes and their responses, every other response, and dataspaces without a versioning repository (VersioningFilter schedules nothing for them, so ?timegate stays 404).
  • ldh get --timemap/--timegate follow the document's Link (rel="timemap"/"timegate"), falling back to the query parameters. --timegate waits as a 503 with Retry-After asks, up to 30 tries; a 503 without Retry-After fails as before.
  • Lean (formal/http/LdhHttp/Memento.lean): reconcileFails, Versioning.timeGate, and timeGate_current, which proves that a redirect without a datetime is always to the document's graph, never an older version.

Synchronous commits were considered and not taken: they would add a GitHub commit to every write and serialise bulk loads.

Tests

  • GraphVersioningServiceTest: pending until the commit ends; failure kept until a later success; an unversioned application has no commit state. 591 unit tests pass.
  • CLI CommandOutputTest: Link discovery for both roles; a 503 with Retry-After is asked again; a 503 without it fails. 120 tests pass.
  • HTTP:
    • versioning/GET-timegate-after-write.sh: after a write, the TimeGate waits or redirects to the new commit, never the previous one.
    • versioning/GET-timegate-unversioned.sh: the unversioned admin dataspace still answers 404, with no Retry-After.
    • GET-timegate.sh and memento-conformance.sh wait out the brief window between GitHub recording a commit and the service ending it.
    • These run in CI against the versioning repository. They have not been run locally.
  • lake build of formal/http passes.

🤖 Generated with Claude Code

namedgraph and others added 2 commits November 2, 2026 14:44
Versions are committed after the write that made them, and the write's
response names none, so right after a write the TimeGate redirected to
the version before it. GraphVersioningService now counts a document's
queued and running commits and remembers whether its last one failed.
While one is pending the TimeGate answers 503 with Retry-After; after a
failed one, 500. Writes, every other response, and dataspaces without
versioning are unchanged.

ldh get --timemap/--timegate follow the Link the document advertises,
falling back to the query parameters, and --timegate waits as the 503
asks. The Lean model gains failed reconciles and the TimeGate's answer,
with timeGate_current: a redirect without a datetime is always to the
document's graph.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Commits are made one at a time per repository branch, about a second each:
after a bulk write a document's commit can wait behind dozens of others,
longer than a flat one-second Retry-After times a client's attempts.
Retry-After is now a second per commit queued on the branch, at most a
minute (GraphVersioningService.getCommitBacklog), and ldh get --timegate
asks up to 120 times.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@namedgraph
namedgraph merged commit b1933c0 into develop Nov 3, 2026
5 checks passed
@namedgraph
namedgraph deleted the feature/timegate-pending branch November 3, 2026 20:43
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