Repository navigation
Model entity tags and Memento in the graph store model - #500
Merged
Merged
Conversation
ETag.lean takes the entity tag as a function of the document and its graph, collision-free by assumption, resolves If-Match against the stored graph as evaluatePreconditions does, and proves that a write guarded by the tag of the graph a client read changes the store only if the document still holds that graph. Memento.lean transcribes the TimeGate (the closest commit, the more recent of two as close, the most recent with no datetime), the TimeMap (the history, each Memento a revision of the next one down it), the commit queue (once drained, the newest version is the document's graph) and the version file, where the root document and a top-level document named root collide. The TimeGate is replayed against the Java on 500 cases ldh-http --select-cases generates, which GraphVersioningServiceTest checks and the Formal workflow regenerates, and against the server by tests/http/versioning/memento-conformance.sh on a versioned dataspace. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A section after the test suite's: what the graph store and access control models prove, how the Formal workflow and the HTTP replay keep them tied to the code, and a link to the roadmap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #499: it's based on
formal/http-status, and GitHub retargets it as the stack merges. It is the follow-up to step 4 of the formal roadmap (formal/README.md).Entity tags (
formal/http/LdhHttp/ETag.lean)ETags). It is the same for the same set of triples, sincetoSortedNTriplessorts them. The model's one assumption is that different graphs get different tags, i.e. that the 128 bits of SHA-256EntityTags.entityTagkeeps are collision-free on the graphs that occur.Cond.resolve: readsIf-Matchagainst the stored graph, asevaluatePreconditionsdoes.no_lost_update: a write guarded byIf-Matchwith the tag of the graph a client read changes the store only if the document still holds that graph.concurrent_write_changes_nothing: once another write has changed that graph, the client's write changes nothing.Memento (
formal/http/LdhHttp/Memento.lean)selectMementotranscribed. The server picks the commit closest in time, the more recent of two equally close, and the most recent when no datetime is given. RFC 7089 leaves the choice to the server. Proven: the Memento is one of the document's commits (select_mem,select_none_iff), the newest with no datetime (select_latest), and none is closer while every more recent commit is further away (select_closest).toTimeMaptranscribed. Each Memento is aprov:wasRevisionOfof exactly the one before it in the history (mem_revisions).VersioningFilter,commitAsyncandreconcile. Whenever no reconcile is queued, the newest version is the document's graph (drained_is_current). Versions are snapshots taken when a reconcile runs, not one per write.pathtranscribed. It has a collision:versionFile_root_collides. The root document and a top-level document namedroot/both map tographs/root.nt, which I confirmed by calling the realGraphVersioningService.path. On a versioned dataspace they share one file, TimeMap and TimeGate.versionFile_injproves this is the only collision. The Java is unchanged: a fix would rename the root document's file, and existing repositories'root.nthistories would need migrating.Checked in CI
ldh-http --select-casesprints 500 generated histories and datetimes, 64 of them with a tie, together with the model's choice for each. They are committed assrc/test/resources/.../memento-cases.tsv.GraphVersioningServiceTest.testSelectMementoAgreesWithTheModelchecks the Java against every case.Formalworkflow regenerates the file and fails if it differs from the model.tests/http/versioning/memento-conformance.shwrites a document four times on a versioned dataspace and reads its history from GitHub. It then checks the TimeMap's members and revision links, and the TimeGate at no datetime, at each commit, midway between two, and outside the history, againstldh-http --select.http-testsnow also buildsldh-http.formal/http/tracks-code.shnow also watchesEntityTags,GraphVersioningService,VersioningFilterandGitHubClient.Testing
lake buildof both packages: nosorry; the axioms arepropext,Quot.soundandClassical.choicetracks-code.shfor both packagesGraphVersioningServiceTest: 15 tests pass, including the 500 golden cases. Corrupting one expected index makes the new test fail on that case.ldh-http --select-casesmemento-conformance.sh, not yet run. It needs the versioning test repo, so it skips locally and runs in CI whereVERSIONING_TEST_TOKENis set.🤖 Generated with Claude Code