Now let's take a silly one
0

Configure Feed

Select the types of activity you want to include in your feed.

at main 5.9 kB View raw
1set shell := ["bash", "-eu", "-o", "pipefail", "-c"] 2 3default: 4 @just --list 5 6gen-config: 7 cargo run -p knot-server -- config-template > example.toml 8 9fmt: 10 cargo fmt 11 12fmt-check: 13 cargo fmt --check 14 15clippy: 16 cargo clippy --workspace --all-targets -- -D warnings 17 18test: 19 cargo test --workspace 20 21fuzz crate='knot-pack' target='pack' time='60': 22 cd crates/{{crate}}/fuzz && RUSTUP_TOOLCHAIN=nightly cargo fuzz run {{target}} -- -max_total_time={{time}} 23 24fuzz-ci: (fuzz "knot-pack" "pkt" "30") (fuzz "knot-pack" "pack" "30") (fuzz "knot-pack" "receive_commands" "30") (fuzz "knot-pack" "upload_args" "30") (fuzz "knot-git" "patch" "30") (fuzz "knot-cobs" "cob_change" "30") (fuzz "knot-cobs" "cob_ref" "30") (fuzz "knot-atproto" "pubkey" "30") (fuzz "knot-atproto" "did_document" "30") 25 26bench filter='': 27 cargo bench -p knot-bench --bench pack -- {{filter}} 28 cargo bench -p knot-bench --bench cob -- {{filter}} 29 cargo bench -p knot-bench --bench projection -- {{filter}} 30 31bench-scaling: 32 cargo bench -p knot-bench --bench coldstart 33 34bench-gate: 35 cargo test -p knot-bench --features instrument --test gate 36 37bench-gate-registry: 38 cargo test -p knot-bench --features instrument --test registry_gate 39 40differential: 41 cargo test -p knot-pack --test differential 42 43t55xx *tests: 44 internal_docs/t55xx/run.sh {{tests}} 45 46ci: fmt-check clippy test gates bench-gate fuzz-ci 47 48gates: gate-no-subprocess gate-no-sql gate-no-native-git gate-no-string-ids gate-no-unguarded-receive gate-fuzz-targets-enumerated 49 50gate-no-subprocess: 51 #!/usr/bin/env bash 52 set -euo pipefail 53 hits=$(grep -rn "process::Command" crates/*/src --include="*.rs" | grep -v "/_lex/" || true) 54 if [ -n "$hits" ]; then 55 echo "no-subprocess gate failed: server source spawns processes" >&2 56 echo "$hits" >&2 57 exit 1 58 fi 59 echo "ok: no process spawning in server source" 60 61gate-no-sql: 62 #!/usr/bin/env bash 63 set -euo pipefail 64 hits=$(grep -inE '^name = "(rusqlite|libsqlite3-sys|sqlx|sqlx-core|sled|fjall|redb)"' Cargo.lock || true) 65 if [ -n "$hits" ]; then 66 echo "no-sql gate failed: an embedded database is in the dependency tree" >&2 67 echo "$hits" >&2 68 exit 1 69 fi 70 echo "ok: no embedded database in the dependency tree" 71 72gate-no-native-git: 73 #!/usr/bin/env bash 74 set -euo pipefail 75 hits=$(grep -inE '^name = "(git2|libgit2-sys|openssl-sys|zlib-ng|zlib-ng-sys)"' Cargo.lock || true) 76 if [ -n "$hits" ]; then 77 echo "no-native-git gate failed: a native git or TLS shim is in the dependency tree" >&2 78 echo "$hits" >&2 79 exit 1 80 fi 81 echo "ok: no native git or TLS shim in the dependency tree" 82 83gate-no-string-ids: 84 #!/usr/bin/env bash 85 set -euo pipefail 86 hits=$(grep -nE 'pub fn .*(-> *String|: *String\b)' crates/knot-types/src/ids.rs | grep -v 'fn to_hex' || true) 87 if [ -n "$hits" ]; then 88 echo "no-string-ids gate failed: a String-typed id crosses the knot-types boundary" >&2 89 echo "$hits" >&2 90 exit 1 91 fi 92 echo "ok: no String-typed id crosses the knot-types boundary" 93 94gate-no-unguarded-receive: 95 #!/usr/bin/env bash 96 set -euo pipefail 97 hits=$(grep -rn 'receive_pack(\|receive_pack_with_limits(' crates/*/src --include="*.rs" | grep -v 'pub fn ' || true) 98 if [ -n "$hits" ]; then 99 echo "no-unguarded-receive gate failed: server source calls the unguarded receive path, use receive_pack_guarded" >&2 100 echo "$hits" >&2 101 exit 1 102 fi 103 echo "ok: the unguarded receive path is reached only from tests" 104 105gate-fuzz-targets-enumerated: 106 #!/usr/bin/env bash 107 set -euo pipefail 108 disk=$(mktemp) 109 recipe=$(mktemp) 110 triplet=$(mktemp) 111 trap 'rm -f "$disk" "$recipe" "$triplet"' EXIT 112 find crates -path '*/fuzz/fuzz_targets/*.rs' -not -path '*/target/*' | sed -E 's#crates/([^/]+)/fuzz/fuzz_targets/(.+)\.rs#\1 \2#' | sort -u > "$disk" 113 just --show fuzz-ci | grep -oE '\(fuzz "[^"]+" "[^"]+" "[^"]+"' | sed -E 's#\(fuzz "([^"]+)" "([^"]+)" "([^"]+)"#\1 \2 \3#' | sort -u > "$triplet" 114 cut -d' ' -f1,2 "$triplet" > "$recipe" 115 while read -r crate target secs; do 116 if ! [[ "$secs" =~ ^[1-9][0-9]*$ ]]; then 117 echo "fuzz-targets-enumerated gate failed: target '$crate $target' runs for '$secs', not a positive number of seconds" >&2 118 exit 1 119 fi 120 done < "$triplet" 121 missing=$(comm -23 "$disk" "$recipe" || true) 122 extra=$(comm -13 "$disk" "$recipe" || true) 123 if [ -n "$missing" ] || [ -n "$extra" ]; then 124 echo "fuzz-targets-enumerated gate failed: the fuzz-ci recipe and the targets on disk disagree" >&2 125 if [ -n "$missing" ]; then 126 echo "on disk but absent from fuzz-ci:" >&2 127 echo "$missing" >&2 128 fi 129 if [ -n "$extra" ]; then 130 echo "in fuzz-ci but no matching target on disk:" >&2 131 echo "$extra" >&2 132 fi 133 exit 1 134 fi 135 while read -r crate target; do 136 manifest="crates/$crate/fuzz/Cargo.toml" 137 if ! grep -qF "name = \"$target\"" "$manifest" || ! grep -qF "path = \"fuzz_targets/$target.rs\"" "$manifest"; then 138 echo "fuzz-targets-enumerated gate failed: $manifest has no [[bin]] declaring target '$target'" >&2 139 exit 1 140 fi 141 entry=$(grep -oE 'knot_[a-z0-9_]+::fuzz::[a-z0-9_]+' "crates/$crate/fuzz/fuzz_targets/$target.rs" | head -1 | sed -E 's#.*::fuzz::##' || true) 142 smoke="crates/$crate/tests/fuzz_smoke.rs" 143 if [ -z "$entry" ] || ! grep -qE "fuzz::${entry}\(" "$smoke"; then 144 echo "fuzz-targets-enumerated gate failed: target '$target' entry point $(echo "$crate" | tr - _)::fuzz::$entry has no smoke-test coverage in $smoke" >&2 145 exit 1 146 fi 147 done < "$disk" 148 echo "ok: every fuzz target is enumerated in fuzz-ci, declared in its fuzz manifest, and smoke-tested"