Skip to content

Commit 573448c

Browse files
Address CLI PR review feedback
1 parent 2ee9dff commit 573448c

18 files changed

Lines changed: 624 additions & 381 deletions

File tree

.github/workflows/format.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches: [main]
66
pull_request:
7-
branches: [main]
87

98
permissions:
109
contents: read
@@ -27,7 +26,7 @@ jobs:
2726
toolchain: ${{ steps.rust-version.outputs.rust-version }}
2827
target: wasm32-wasip1
2928
components: "clippy, rustfmt"
30-
cache-shared-key: cargo-${{ runner.os }}
29+
cache-shared-key: cargo-${{ runner.os }}-wasm
3130

3231
- name: Run cargo fmt
3332
uses: actions-rust-lang/rustfmt@v1
@@ -52,7 +51,7 @@ jobs:
5251
toolchain: ${{ steps.rust-version-cli.outputs.rust-version }}
5352
target: wasm32-wasip1
5453
components: "clippy, rustfmt"
55-
cache-shared-key: cargo-${{ runner.os }}
54+
cache-shared-key: cargo-${{ runner.os }}-host
5655

5756
- name: Retrieve Rust host target
5857
id: rust-host-target

.github/workflows/test.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
push:
88
branches: [main]
99
pull_request:
10-
branches: [main]
1110

1211
jobs:
1312
test-rust:
@@ -35,7 +34,7 @@ jobs:
3534
with:
3635
toolchain: ${{ steps.rust-version.outputs.rust-version }}
3736
target: wasm32-wasip1
38-
cache-shared-key: cargo-${{ runner.os }}
37+
cache-shared-key: cargo-${{ runner.os }}-wasm
3938

4039
- name: Cache Viceroy binary
4140
id: cache-viceroy
@@ -67,7 +66,7 @@ jobs:
6766
with:
6867
toolchain: ${{ steps.rust-version-cli.outputs.rust-version }}
6968
target: wasm32-wasip1
70-
cache-shared-key: cargo-${{ runner.os }}
69+
cache-shared-key: cargo-${{ runner.os }}-host
7170

7271
- name: Retrieve Rust host target
7372
id: rust-host-target

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ build-print = "1.0.1"
5353
bytes = "1.11"
5454
chacha20poly1305 = "0.10"
5555
chrono = "0.4.44"
56+
chromiumoxide = "0.9.1"
5657
config = "0.15.19"
5758
cookie = "0.18.1"
5859
derive_more = { version = "2.0", features = ["display", "error"] }

crates/integration-tests/Cargo.lock

Lines changed: 31 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/integration-tests/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ harness = true
1212
[dev-dependencies]
1313
testcontainers = { version = "0.25", features = ["blocking"] }
1414
reqwest = { version = "0.12", features = ["blocking"] }
15-
scraper = "0.21"
15+
scraper = "0.24"
1616
log = "0.4.29"
1717
serde_json = "1.0.149"
1818
error-stack = "0.6"

crates/trusted-server-cli/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ reqwest = { workspace = true }
2222
scraper = { workspace = true }
2323
serde = { workspace = true }
2424
futures = { workspace = true }
25-
tokio = { workspace = true, features = ["rt-multi-thread", "time"] }
25+
tokio = { workspace = true }
2626
which = { workspace = true }
27-
chromiumoxide = "0.9.1"
27+
chromiumoxide = { workspace = true }
2828
serde_json = { workspace = true }
2929
tempfile = { workspace = true }
3030
toml = { workspace = true }
@@ -34,4 +34,5 @@ keyring = { workspace = true }
3434
uuid = { workspace = true }
3535

3636
[dev-dependencies]
37+
temp-env = { workspace = true }
3738
tempfile = { workspace = true }

crates/trusted-server-cli/src/audit.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
mod analyzer;
22
mod browser_collector;
33
mod collector;
4-
mod http_collector;
54

65
use std::collections::BTreeSet;
76
use std::fs;
@@ -56,11 +55,6 @@ pub struct AuditOutputs {
5655
pub draft_config_toml: String,
5756
}
5857

59-
#[cfg_attr(not(test), allow(dead_code))]
60-
pub fn analyze_html(target_url: &Url, html: &str) -> Result<AuditArtifact, Report<CliError>> {
61-
analyzer::analyze_html(target_url, html)
62-
}
63-
6458
pub fn perform_audit(target_url: &Url) -> Result<AuditOutputs, Report<CliError>> {
6559
let collected = browser_collector::collect_page_via_browser(target_url)?;
6660
build_audit_outputs(&collected)
@@ -228,7 +222,17 @@ mod tests {
228222
</html>
229223
"#;
230224

231-
let artifact = analyze_html(&url, html).expect("should analyze HTML");
225+
let collected = collector::CollectedPage {
226+
requested_url: url.to_string(),
227+
final_url: url.to_string(),
228+
page_title: None,
229+
html: html.to_string(),
230+
script_tags: Vec::new(),
231+
network_requests: Vec::new(),
232+
warnings: Vec::new(),
233+
};
234+
235+
let artifact = analyze_collected_page(&collected).expect("should analyze HTML");
232236

233237
assert_eq!(artifact.page_title.as_deref(), Some("Example Publisher"));
234238
assert_eq!(artifact.js_asset_count, 2, "should count script assets");

0 commit comments

Comments
 (0)