-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Proposal] Host test vectors on GH #214
Comments
Thanks for taking the time to go over the current approach and presenting this. I do go back and fourth on hosting vectors on sdk-development only and then having the unit tests do network calls. Some thoughts I have on the proposed items:
One of the most important aspects for me is that we keep it as simple as possible so developers actually use this without slowdown and creates lots and lots of test vectors. With the current approach developers can produce a feature, add a test vector locally, create a basically normal unit test locally and be on the way. (we can even make another process to update sdk-development automatically so they dont have to update this later) Also, There are still a lot of cases where you will probably still be copy pasting and having a local test vector on the file system when manually creating and using these vectors when developing. So you will be doing things locally, then deleting and putting it on github. To implement a new feature and new test vector you will have to repeditly update 2 repos, and then things can still get out of sync, you can have a situation where mainline tbdex pointing to a dev branch in sdk-development. We have checks on if sdk-development test-vectors folder vs the other repos gets out of sync, and it will open PRs automatically if you have any concern about things getting out of sync. I do think that web5-* and tbdex-* repos should use as the exact same approach as possible for test vectors to keep things consistent and uniform across repos if possible. We did decide on having local with scripts to make sure things are in sync in meetings a while back, but super happy to revise if needed. If we truly want to have test vectors not be local and only in the sdk-development repo we can change a few lines in our current test vector impls: Current local test vector impl:
Remote test vector impl:
If the tbdex-* repo is truly that different then the web5-* then I guess we can have a split in the way we do test vectors, but I really think we should keep all test vector impls the same across all repos |
Just as a clean example on how the current process works: new test vector: (2 files changed) After merge we will get a new checkmark here (no action needed from dev): |
Made a few changes to my proposal based on feedback:
|
Agreed it adds complexity, but I think it's necessary. If the hosted vectors get out of sync with the implementation, implementation repos will want to pin which version of vectors the implementation supports. The GH action y'all mentioned sounds like it checks that test vectors in the impl repo are the same as in |
Here are some reference implementations for how The caching done in the |
@mistermoe Pointed out to me that TBD54566975/tbdex-js#125 is essentially reimplementing git submodules. So, I decided to try using git submodules and it's honestly way simpler than the stuff I was cooking up. Instead of fetching test vectors dynamically from github, I'm now convinced that git submodules best allow implementation repos to have fast local access to specific versions of implementation repos. |
Disregard. We decided in this Discord thread not to extract hosted stuff into a new repo |
* Compile test vectors into one file * Dont compile test vectors into one big file * Replace hosted/ with tbdex-interop-suite submodule * Revert "Replace hosted/ with tbdex-interop-suite submodule" This reverts commit c3e3327. * Update test-vector README
Implemented here and in tbdex-js and tbdex-kt with these PRs |
Overview
TBDex will host test vectors on github and can be fetched and cached by implementation repos in a
.gitignore
'd place. Implementation repos will NOT need to git commit the vectors themselves; implementation repos will only commit a git ref of thetbdex
repo containing the desired version of the test vectors.Hosting on Github
The github
tbdex
repo will host all test vectors for the protocol in the directorytest-vectors/protocol/
. An implementation repo can fetch the test vectors at a given git ref like so:Each vector file will follow this JSON schema:
description
: A human readable description of the scenario being tested.input
: A stringified JSON TBDex objectoutput
: If the input contains a valid TBDex object: A JSON object of the the expected parsed input.error
: boolean. True if an error is expected, false if not. No error message/detail is provided in the test vectors because different languages/implementations may handle errors quite differently. So, it's better not to be too prescriptive of implementation.NOTE: This is nearly identical to the current test vector structure. The only difference is standardizing the type of
error
.Benefits of Hosting on Github
Some reviewers will prefer the approach to hosting test vectors taken by Web5 — that is, copy-pasting each test vector file into an implementation repo. I really really don’t want to do that. Here’s my hot takes:
tbdex-kt
is fetching JSON schemas of message kinds from tbdex.dev. There is already a precedent for making network calls while running tests. (IMO we should host these on GH as well, but that’s a separate issue).Recommendations for implementation repos
An implementation repo should NOT always fetch the test vectors in
tbdex
’smain
branch. Each repo should specify a specific version oftbdex
to get a deterministic set of vectors. This will both 1) clarify what version of the TBDex protocol an implementation supports and 2) prevent confusion and CI flakiness iftbdex
main
gets ahead of the implementation.It is also useful to add a flag for running a set of test vectors locally. I'm going to write a reference implementation in tbdex-js soon.
Generating Test Vectors
test-vectors/protocol
input
andoutput
if applicable.tbdex
and get the URL of your branch on GH to use the new test vector in your implementation repo.tbdex
.Types of TBDex test vectors
Protocol
In contrast to Web5, which deals with many types of data structures and actions, TBDex protocol implementations have one simple interoperability question to answer: do we accept valid TBDex messages and reject invalid TBDex messages?
Http server and client
TODO(diehuxx): More detail or a separate issue is needed. This is not as high priority right now.
Broadly, the client should create requests and accept responses whereas the server should accept requests and create responses in accordance with the spec.
Reference Implementations
tbdex
-- hosting: #215tbdex-js
-- fetching from Github and caching efficiently: TBD54566975/tbdex-js#125The text was updated successfully, but these errors were encountered: