Commit Graph
121 Commits
Author SHA1 Message Date
xphoniex 6f20e93c3c node: Introduce AliasStore trait
httpd: use the `AliasStore` trait

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-06-02 14:48:33 +02:00
xphoniex d0d47f791b node: Add access to routing.db on profile
httpd: Use routing.db to return `trackings` of an RID

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-06-02 13:42:44 +02:00
xphoniex 273a527cd7 httpd: Return alias field on merges of a patch
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-05-29 12:48:11 +02:00
xphoniex c735783246 httpd: Add author to revision of a patch
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-05-29 12:11:13 +02:00
Alexis Sellier cc7fdebb6a cob: Add reviewers field on Patch
We aren't ready to support this yet from an end-user perspective, but
we add it in the COB already to prepare.
2023-05-26 10:31:00 +02:00
Alexis Sellier 3d2e57edcc cob: Remove description from Patch
Since patches always have a "root" revision, use that revision's description
as the patch description.
2023-05-26 10:31:00 +02:00
xphoniex e17e789602 cli: Show alias on rad issue and rad patch
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-05-22 15:13:28 +02:00
Alexis Sellier 90cf62b027 cob: Redesign merge state
Move `merges` from `Revision` to `Patch`, and key them by actor.

This ensures that only one merge is possible per actor. We also make
sure that only one revision can be merged at a time, and signal a
conflict if more than one revision is considered merged.

Finally, we make sure that merges have the same target-branch commit
to be considered equal.
2023-05-19 18:40:46 +02:00
xphoniex 8880c49c1d httpd: Add alias field to certain routes
* `/patches`, `/issues`, `/remotes`

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-05-16 12:40:07 +02:00
Alexis Sellier be9eb3f8e2 Update dependencies
* radicle-surf
* radicle-git-ext
* amplify
2023-05-10 15:56:21 +02:00
Fintan Halpenny c54aa00337 radicle: update radicle-git-ext
This change updates to the latest radicle-git-ext, which required a
few changes within the radicle family of crates.

One set of changes is that the radicle-git-ext crate subsumes
git-commit, git-trailers, and git-ref-format -- so all those imports
go through radicle-git-ext.

The commit code requires that parent `Oid`s point to commits, which
made some tests fail. One of the reasons for these failures is that
the patch tests used fabricated `Oid`s and so the verification would
fail. This is fixed by allowing the test context code to create
`PatchRequest`s that create valid commits.
The other reason for failure was that the identity `Action` passed an
`Oid` that pointed to a blob. This is fixed by removing that code and
making a note of it in documentation.

The final major change was moving the Refspec type into git-ref-format
and removing the AsRefspecs trait. The trait was not required and
could its usage could be replaced by simpler code.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-08 10:36:15 +01:00
Alexis Sellier 32fde2aecf cob: Include head in initial patch entry in DAG
This change ensures that we include as a parent to the initial commit
of a patch COB, the head of the branch we are proposing as a patch.

This was already happening for patch updates, but we forgot to also
include it for the initial patch revision.

This ensures that the code is always fetched alongside the patch.
2023-05-02 09:18:17 +02:00
Alexis Sellier 5971c1c9f9 radicle: Remove delegate from Remote type
It wasn't being set correctly, and it's not the place for it,
so we remove it and set it in `httpd`.

Note that `Remote` is now simply a wrapper around `SignedRefs`.
If we want to remove the type or turn it into an alias, it will
require touching lots of different parts of the codebase. I opted
not to do that here as it's lower priority.
2023-04-26 11:06:55 +02:00
Sebastian Martinez c70252429c httpd: Add cob state to listing endpoints
This commit adds the cob state of either patches or issues to the
corresponding endpoint.

So we can either query a cob listing with the required state or expect
the default state.
And once filtered by cob state we paginate.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-04-20 20:38:15 +02:00
Alexis Sellier 9166a4e349 cob: Deduplicate change parents 2023-04-14 13:54:27 +02:00
Alexis Sellier 7edf4543d5 Include dependencies for certain COB actions
We ensure that for example, the given commits are fetched before the
revision or merge actions in a patch.
2023-04-14 13:22:10 +02:00
Alexis Sellier e713e99e57 Update fastrand dependency to 1.9.0 2023-04-14 13:15:52 +02:00
Alexis Sellier 48105b8b35 Set patch status to merged automatically
When a merge is applied to a patch, we check whether the threshold
of delegates has been reached, at which point we set the patch status
to `merged`.

This requires threading the identity document oid through the "apply"
process.
2023-04-05 10:32:45 +02:00
Sebastian Martinez fff45817bc Reduce pub accessors in patch and issue cob structs
Replaces pub accessors to struct fields with methods
Also creates some methods to compute necessary information

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-31 13:44:37 +02:00
Sebastian Martinez f7fc778c3b Rename patch::State::Proposed to patch::State::Open`
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-30 10:46:57 +02:00
Sebastian Martinez 609bf226e8 httpd: Add patch::Action::Lifecycle
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-30 10:46:57 +02:00
Sebastian Martinez c809bd5b42 cob: Add patch::Action::EditRevision
To be able to change the description of a patch revision, without the
need to create a new revision.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-30 10:42:49 +02:00
Sebastian Martinez 8826ec4f9c httpd: Add reactions to issue and patch json
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-25 12:04:53 +01:00
Sebastian Martinez 5d7a2f19d6 httpd: Add patch head refs to patch output
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-25 11:54:09 +01:00
Sebastian Martinez e4020eaea1 httpd: Add path property to CodeLocation
For the web client to be able to show file we need to provide
the web client with the file path.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-23 11:41:13 +01:00
Sebastian Martinez 27ab41bf3a httpd: Add CorsLayer to /raw endpoint
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-23 11:07:58 +01:00
Sebastian Martinez 2aff899dc2 httpd: Add patch update endpoint
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-22 13:53:19 +01:00
Sebastian Martinez 7dabd58aa5 httpd: Add commit diff endpoint
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-21 18:50:26 +01:00
Sebastian Martinez fcea4aeb7d httpd: Add more revision properties to patch
For display purposes in the web client, we add with this commit the
some needed properties to the revisions in the patch endpoint.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-20 18:43:06 +01:00
Rūdolfs Ošiņš da96a82fc1 httpd: Use camelCase in query params
It's more ergonomic to consume in JS/TS.

Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2023-03-17 17:11:00 +01:00
Sebastian Martinez 3f0141b087 httpd: Add timestamp to revisions json
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-17 13:54:48 +01:00
Rūdolfs Ošiņš caa7078d62 httpd: Fix status code in commit history endpoint
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2023-03-15 10:17:41 +01:00
xphoniex 1c0dd54bbf httpd: Use RID in tests
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-13 16:25:26 +01:00
xphoniex 6ac94ca1d4 httpd: Separate Error types of git route and /raw
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-13 16:25:26 +01:00
xphoniex f68f0af76f httpd: Move 404 test from git to root router
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-13 16:25:26 +01:00
Alexis Sellier 0cf170e6cd Make Patch state field similar to Issue
Since they are similar objects, they should have similar structure.
This also makes it easier to add state metadata like for issues.
2023-03-13 13:55:12 +01:00
xphoniex 44bf989d2e httpd: Add root handlers for /api/v1 and /api
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-12 19:12:40 +01:00
Alexis Sellier 41e151266f httpd: Basic alias support for git
Allows cloning via git using an alias instead of the full RID.

Eg. `git clone https://seed.radicle.xyz/heartwood.git`
2023-03-12 18:31:19 +01:00
Alexis Sellier 2b44ff1b55 cob: Use EntryId as the operation identifier
By introducing a small limitation: only allowing entries in the change
graph to be addressable, instead of individual operations; we
drastically simplify the CRDT implementation.

There are four advantages:

1. Op ids are just regular SHA-1s
2. There's no need for relative IDs, ops never refer to other ops within the
   same commit
3. There's no need for a nonce, since commits can't collide, and neither can op IDs
4. `OpId` can just be an alias of `EntryId`

The disadvantage of course, is that we have to be mindful of how we
create op transactions, since each transaction creates an addressable
unit. For example, we must not include multiple patch revisions in the
same transaction.
2023-03-09 17:08:56 +01:00
xphoniex 79934c3dfe httpd: Run tests off another remote for test::seed
Keep `test::contributor(..)` to test interactions with a contributor node.

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-08 15:27:13 +01:00
xphoniex 0535b0c5c2 httpd: Remove radicle_cli from tests
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-07 15:08:11 +01:00
xphoniex 2b48df9526 httpd: Use radicle-term instead of radicle-cli::terminal
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-07 14:49:18 +01:00
xphoniex 7104cde3e7 httpd: Set a max allowed size of 4 MiB when serving files raw
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-07 09:37:02 +01:00
Alexis Sellier 11ea75f0ca Use commit oid for COB parent
We were using the blob oid, which was causing the commit tree to
be invalid.
2023-03-06 15:39:34 +01:00
Alexis Sellier 1535149dd0 cli: Add --verbose flag to init 2023-03-06 15:38:42 +01:00
Alexis Sellier 5b6ccaf7dc cli: Give more control over init announcement
Instead of always announcing the inventory, by default we don't.
Users can run `rad push` to trigger an announcement.
2023-03-06 15:38:42 +01:00
Alexis Sellier 346737e3f8 Remove need to pass public key in cob store 2023-03-06 10:56:20 +01:00
Sebastian Martinez 970abf96b9 httpd: Add patch creation endpoint
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-06 10:26:38 +01:00
xphoniex 2fdcf85891 httpd: Change format of tracing messages
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-03 16:13:10 +01:00
Alexis Sellier 78132a14ea cob: Don't require a local fork to exist
Before this change, the identity document would be loaded for the
COB signer. This meant that a fork would be needed for that signer.

After this change, it's no longer necessary, since the identity doc
head is computed from available remotes.

While making those changes, it was also apparent that some of the
identity-related functions had bad names and error types, this
was fixed as well.
2023-03-01 15:40:30 +01:00