cli/inspect: Show feature level of sigrefs
In order for users to be able to inspect the feature level of Signed References in a repository, have `rad inspect --sigrefs` attempt to load Signed References, and, if successful, print the feature level.
This commit is contained in:
parent
404fe33a88
commit
7fb032da9b
|
|
@ -23,6 +23,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
attacks.
|
attacks.
|
||||||
Note that this means that a node which upgrades, and subsequently downgrades
|
Note that this means that a node which upgrades, and subsequently downgrades
|
||||||
will appear as a downgrade attacker.
|
will appear as a downgrade attacker.
|
||||||
|
- The `rad inspect --sigrefs` command will now output the feature level of the
|
||||||
|
signed references entry for each node.
|
||||||
|
|
||||||
## 1.7.1
|
## 1.7.1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ Let's also inspect what remotes are in the repository:
|
||||||
|
|
||||||
``` ~alice
|
``` ~alice
|
||||||
$ rad inspect --sigrefs
|
$ rad inspect --sigrefs
|
||||||
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi 99c549702e2bcfe02b0e68d4a2224fb7a1524529
|
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi 99c549702e2bcfe02b0e68d4a2224fb7a1524529 parent
|
||||||
z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk e9f48ef90fe8592e1b1c95f96c21a59ca1495300
|
z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk e9f48ef90fe8592e1b1c95f96c21a59ca1495300 parent
|
||||||
```
|
```
|
||||||
|
|
||||||
Now let's clean the `heartwood` project:
|
Now let's clean the `heartwood` project:
|
||||||
|
|
@ -34,7 +34,7 @@ Inspecting the remotes again, we see that Bob is now gone:
|
||||||
|
|
||||||
``` ~alice
|
``` ~alice
|
||||||
$ rad inspect --sigrefs
|
$ rad inspect --sigrefs
|
||||||
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi 99c549702e2bcfe02b0e68d4a2224fb7a1524529
|
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi 99c549702e2bcfe02b0e68d4a2224fb7a1524529 parent
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that Bob will be fetched again if we do not untrack his
|
Note that Bob will be fetched again if we do not untrack his
|
||||||
|
|
|
||||||
|
|
@ -162,9 +162,9 @@ $ rad sync --timeout 3s
|
||||||
✓ Fetched repository from 2 seed(s)
|
✓ Fetched repository from 2 seed(s)
|
||||||
✓ Synced with 3 node(s)
|
✓ Synced with 3 node(s)
|
||||||
$ rad inspect rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --sigrefs
|
$ rad inspect rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --sigrefs
|
||||||
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi 1f716870f890be0c13fdd0af9f527af849fec792
|
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi 1f716870f890be0c13fdd0af9f527af849fec792 parent
|
||||||
z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk c40018821dc1b41cad75e91e0c9d00827e815324
|
z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk c40018821dc1b41cad75e91e0c9d00827e815324 parent
|
||||||
z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z 95cd447c57de8d232c6154f5dba0451aa593520e
|
z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z 95cd447c57de8d232c6154f5dba0451aa593520e parent
|
||||||
```
|
```
|
||||||
|
|
||||||
Since the network is eventually consistent, if Eve decides to `sync`
|
Since the network is eventually consistent, if Eve decides to `sync`
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,9 @@ $ rad id --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
||||||
│ ● 0656c21 Initial revision alice z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi accepted now │
|
│ ● 0656c21 Initial revision alice z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi accepted now │
|
||||||
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||||
$ rad inspect rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --sigrefs
|
$ rad inspect rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --sigrefs
|
||||||
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi [..]
|
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi [..] parent
|
||||||
z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk [..]
|
z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk [..] parent
|
||||||
z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z [..]
|
z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z [..] parent
|
||||||
$ rad inspect rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --delegates
|
$ rad inspect rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --delegates
|
||||||
did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (alice)
|
did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (alice)
|
||||||
did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk (bob)
|
did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk (bob)
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ Similarly, she still does not have Bob's `rad/sigrefs`:
|
||||||
|
|
||||||
``` ~alice
|
``` ~alice
|
||||||
$ rad inspect --sigrefs
|
$ rad inspect --sigrefs
|
||||||
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi e0e55994a9a234f0b1cd36d8812e2948e2672b7a
|
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi e0e55994a9a234f0b1cd36d8812e2948e2672b7a parent
|
||||||
```
|
```
|
||||||
|
|
||||||
And she can still list the project, without any worries:
|
And she can still list the project, without any worries:
|
||||||
|
|
@ -198,6 +198,6 @@ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential s
|
||||||
🌱 Fetched from z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z
|
🌱 Fetched from z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z
|
||||||
🌱 Fetched from z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
|
🌱 Fetched from z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
|
||||||
$ rad inspect --sigrefs
|
$ rad inspect --sigrefs
|
||||||
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi e0e55994a9a234f0b1cd36d8812e2948e2672b7a
|
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi e0e55994a9a234f0b1cd36d8812e2948e2672b7a parent
|
||||||
z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk dace6fe948548168a2bb687718949d9b5d9076ee
|
z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk dace6fe948548168a2bb687718949d9b5d9076ee parent
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ And sigrefs:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ rad inspect --sigrefs
|
$ rad inspect --sigrefs
|
||||||
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi 99c549702e2bcfe02b0e68d4a2224fb7a1524529
|
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi 99c549702e2bcfe02b0e68d4a2224fb7a1524529 parent
|
||||||
```
|
```
|
||||||
|
|
||||||
Or display the repository identity's payload and delegates:
|
Or display the repository identity's payload and delegates:
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ use radicle::identity::{DocAt, Identity};
|
||||||
use radicle::node::policy::SeedingPolicy;
|
use radicle::node::policy::SeedingPolicy;
|
||||||
use radicle::node::AliasStore as _;
|
use radicle::node::AliasStore as _;
|
||||||
use radicle::storage::git::{Repository, Storage};
|
use radicle::storage::git::{Repository, Storage};
|
||||||
use radicle::storage::refs::RefsAt;
|
use radicle::storage::refs::{FeatureLevel, RefsAt};
|
||||||
use radicle::storage::{ReadRepository, ReadStorage};
|
use radicle::storage::{ReadRepository, ReadStorage};
|
||||||
|
|
||||||
use crate::terminal as term;
|
use crate::terminal as term;
|
||||||
|
|
@ -68,11 +68,27 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
for remote in repo.remote_ids()? {
|
for remote in repo.remote_ids()? {
|
||||||
let remote = remote?;
|
let remote = remote?;
|
||||||
let refs = RefsAt::new(&repo, remote)?;
|
let refs = RefsAt::new(&repo, remote)?;
|
||||||
|
let sigrefs = refs.load(&repo);
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"{:<48} {}",
|
"{:<48} {} {}",
|
||||||
term::format::tertiary(remote.to_human()),
|
term::format::tertiary(remote.to_human()),
|
||||||
term::format::secondary(refs.at)
|
term::format::secondary(refs.at),
|
||||||
|
match sigrefs {
|
||||||
|
Ok(refs) => {
|
||||||
|
let level = refs.feature_level();
|
||||||
|
let s = level.to_string();
|
||||||
|
match level {
|
||||||
|
FeatureLevel::None => term::format::negative(s),
|
||||||
|
FeatureLevel::Root => term::format::yellow(s),
|
||||||
|
FeatureLevel::Parent => term::format::positive(s),
|
||||||
|
_ => term::format::faint(s),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
term::format::negative(err.to_string())
|
||||||
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue