mirror of
https://github.com/penpot/penpot.git
synced 2026-10-28 21:40:34 +00:00
🚧 WIP 25.3 Cleanup: remove manual schema versioning, clean docstrings
AI-assisted-by: deepseek-flash, gpt-6.1-sol
This commit is contained in:
parent
987fc38e6f
commit
7ee69e3927
@ -655,7 +655,7 @@
|
||||
(when analysis-text (t/decode-str analysis-text))))))
|
||||
|
||||
(defn compare-records
|
||||
"Returns Comparison schema2 Transit for two saved runs and Transit options."
|
||||
"Returns schema:comparison Transit for two saved runs and Transit options."
|
||||
[baseline-text candidate-text options-text]
|
||||
(result/encode (compare/compare-runs (result/decode baseline-text)
|
||||
(result/decode candidate-text)
|
||||
@ -667,7 +667,7 @@
|
||||
(format/format-run (summary/summarize (result/decode record-text))))
|
||||
|
||||
(defn format-comparison
|
||||
"Returns text for a Comparison schema2 Transit record."
|
||||
"Returns text for a schema:comparison Transit record."
|
||||
[record-text]
|
||||
(format/format-comparison (result/decode record-text)))
|
||||
|
||||
|
||||
@ -27,7 +27,6 @@
|
||||
;; =>
|
||||
[{:id :rects/load
|
||||
:scene :rects
|
||||
:scene-version 1
|
||||
:scene-description \"Seeded rectangles with translucent fills and centered strokes\"
|
||||
:scene-seed 2602546180
|
||||
:params {:count 1000 :width 1920 :height 1080 :min-size 20 :max-size 100}
|
||||
@ -35,7 +34,7 @@
|
||||
:context :fresh
|
||||
:completion :render-full
|
||||
:batch-size 1
|
||||
:preparation {:version 1}}
|
||||
:preparation {}}
|
||||
{:id :rects/pan ...}
|
||||
{:id :rects/zoom ...}]"
|
||||
(:require
|
||||
@ -102,13 +101,11 @@
|
||||
registered))
|
||||
|
||||
(defn- describe-case
|
||||
"Projects a validated case to its collected descriptor: scene
|
||||
version/description/seed attached, internal keys stripped, transit wire
|
||||
checked."
|
||||
"Projects a validated case to its collected descriptor: scene description
|
||||
and seed attached, internal keys stripped, transit wire checked."
|
||||
[master-seed registered scene-entry]
|
||||
(let [projected (-> (decl/project-case registered)
|
||||
(assoc :scene-version (:version scene-entry)
|
||||
:scene-description (:description scene-entry)
|
||||
(assoc :scene-description (:description scene-entry)
|
||||
:scene-seed (decl/derive-seed master-seed
|
||||
(:scene registered)
|
||||
(:params registered))))]
|
||||
|
||||
@ -30,8 +30,7 @@
|
||||
"Registers a scene and returns its id.
|
||||
|
||||
- `id` (keyword)
|
||||
- `opts` (`schema:scene`): maps `:version`, `:description` and
|
||||
`:params-schema`.
|
||||
- `opts` (`schema:scene`): maps `:description` and `:params-schema`.
|
||||
- `argv` names one scene parameter symbol
|
||||
- `body` builds the snapshot.
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
`defcase` macros in `declarations.clj`. This namespace imports no browser or
|
||||
renderer code.
|
||||
|
||||
- A scene declares an id, a version, a human description, a closed
|
||||
- A scene declares an id, a human description, a closed
|
||||
parameters schema and a one-argument build function.
|
||||
- A case declares an id namespaced by its scene, the scene, base parameters,
|
||||
a view, a context policy, a completion mode and an optional operation
|
||||
@ -96,7 +96,6 @@
|
||||
[:map {:closed true}
|
||||
[:id simple-keyword?]
|
||||
[:ns string?]
|
||||
[:version [:int {:min 1}]]
|
||||
[:description string?]
|
||||
[:params-schema vector?]
|
||||
[:build fn?]])
|
||||
@ -121,7 +120,6 @@
|
||||
[:map {:closed true}
|
||||
[:id qualified-keyword?]
|
||||
[:scene simple-keyword?]
|
||||
[:scene-version [:int {:min 1}]]
|
||||
[:scene-description string?]
|
||||
[:scene-seed [:int {:min 0 :max 4294967295}]]
|
||||
[:params [:map]]
|
||||
@ -356,7 +354,7 @@
|
||||
:operation :preparation])
|
||||
(update :completion #(or % :render-full))
|
||||
(update :batch-size #(or % 1))
|
||||
(update :preparation #(or % {:version 1}))))
|
||||
(update :preparation #(or % {}))))
|
||||
|
||||
(defn check-collected-case
|
||||
"Validates a collected case descriptor and returns it unchanged.
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
|
||||
(ns benches.render-wasm.fingerprint
|
||||
"Scene fingerprints identify validated starting snapshots by content.
|
||||
Encoding version 1 orders unordered representations in production verbose
|
||||
Transit, preserves type tags and ordered collections, and hashes UTF-8 bytes.
|
||||
Canonical production verbose Transit orders unordered representations,
|
||||
preserves type tags and ordered collections, and hashes UTF-8 bytes.
|
||||
Callers validate snapshots and compute fingerprints before upload and timers."
|
||||
(:require
|
||||
[benches.render-wasm.codec :as codec]
|
||||
@ -61,7 +61,7 @@
|
||||
:else value))
|
||||
|
||||
(defn snapshot-text
|
||||
"Returns encoding version 1 text for a validated snapshot.
|
||||
"Returns canonical Transit text for a validated snapshot.
|
||||
Realizing :objects removes ObjectsMap's serialized shape strings while keeping
|
||||
production shape, geometry and path tags in the values."
|
||||
[snapshot]
|
||||
@ -72,10 +72,9 @@
|
||||
(canonical-text)))
|
||||
|
||||
(defn fingerprint
|
||||
"Returns a SHA-256 digest and encoding version for a validated snapshot."
|
||||
"Returns the SHA-256 algorithm and digest for a validated snapshot."
|
||||
[snapshot]
|
||||
(let [hash (goog.crypt.Sha256.)]
|
||||
(.update hash (crypt/stringToUtf8ByteArray (snapshot-text snapshot)))
|
||||
{:encoding-version 1
|
||||
:algorithm :sha-256
|
||||
{:algorithm :sha-256
|
||||
:digest (crypt/byteArrayToHex (.digest hash))}))
|
||||
|
||||
@ -14,11 +14,23 @@
|
||||
(:require
|
||||
["fs" :as fs]
|
||||
["path" :as path]
|
||||
[app.common.schema :as sm]
|
||||
[app.common.transit :as transit]
|
||||
[benches.render-wasm.codec :as codec]
|
||||
[benches.render-wasm.node.files :as files]
|
||||
[clojure.string :as str]))
|
||||
|
||||
(def schema:build
|
||||
"Stored renderer build identity, lifecycle and provenance."
|
||||
[:map
|
||||
[:type [:= :renderer-build]]
|
||||
[:id [:string {:min 1}]]
|
||||
[:status [:enum :building :ready :failed]]
|
||||
[:created-at :string]
|
||||
[:updated-at :string]
|
||||
[:functional :map]
|
||||
[:provenance :map]])
|
||||
|
||||
(def ^:private executable-dir
|
||||
;; CJS boots use __dirname. Node's ESM test boots have an absolute argv[1]
|
||||
;; instead; capture it before a caller changes cwd. Neither uses a cwd root.
|
||||
@ -118,7 +130,6 @@
|
||||
(let [id (str (random-uuid))
|
||||
now (.toISOString (js/Date.))
|
||||
manifest {:type :renderer-build
|
||||
:schema-version 1
|
||||
:id id
|
||||
:status :building
|
||||
:created-at now
|
||||
@ -147,13 +158,9 @@
|
||||
[build manifest]
|
||||
(let [current (transit/decode-str (fs/readFileSync (:manifest-path build) "utf8"))]
|
||||
(when-not (and (= (:id build) (:id current) (:id manifest))
|
||||
(= :renderer-build (:type current))
|
||||
(= 1 (:schema-version current))
|
||||
(contains? #{:building :ready :failed} (:status current))
|
||||
(= :renderer-build (:type manifest))
|
||||
(= 1 (:schema-version manifest))
|
||||
(contains? #{:building :ready :failed} (:status manifest)))
|
||||
(throw (ex-info "invalid renderer build manifest"
|
||||
(sm/validate schema:build current)
|
||||
(sm/validate schema:build manifest))
|
||||
(throw (ex-info "invalid schema:build"
|
||||
{:type ::invalid-manifest :id (:id build)})))
|
||||
(if (contains? #{:ready :failed} (:status current))
|
||||
(if (= current manifest)
|
||||
@ -194,7 +201,7 @@
|
||||
build))
|
||||
|
||||
(defn load-build
|
||||
"Loads a ready schema-1 build and checks every required artifact.
|
||||
"Loads a ready schema:build and checks every required artifact.
|
||||
|
||||
IDs cannot contain path segments. The build, manifest and artifact paths
|
||||
must remain inside the managed root and the selected build after resolving
|
||||
@ -206,10 +213,9 @@
|
||||
dir (checked-path managed (:dir build))
|
||||
file (require-file dir (:manifest-path build))
|
||||
manifest (transit/decode-str (fs/readFileSync file "utf8"))]
|
||||
(when-not (and (= :renderer-build (:type manifest))
|
||||
(= 1 (:schema-version manifest))
|
||||
(when-not (and (sm/validate schema:build manifest)
|
||||
(= id (:id manifest)))
|
||||
(throw (ex-info "unsupported renderer build manifest"
|
||||
(throw (ex-info "invalid schema:build"
|
||||
{:type ::unsupported-manifest :id id})))
|
||||
(when-not (= :ready (:status manifest))
|
||||
(throw (ex-info "renderer build is not ready"
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
;; Copyright (c) KALEIDOS SUBSIDIARY SL
|
||||
|
||||
(ns benches.render-wasm.node.compare
|
||||
"Offline comparison of two saved RunRecords.
|
||||
"Offline comparison of two saved schema:run records.
|
||||
|
||||
Inputs are user file paths resolved from the caller's cwd. The namespace
|
||||
depends only on record decoding and the shared report pipeline; it starts no
|
||||
|
||||
@ -650,7 +650,7 @@
|
||||
|
||||
Options are resolved CLI options. root is the frontend checkout. The record
|
||||
exists before on-created runs, so a browser startup failure still leaves a
|
||||
valid partial record. Returns {:run RunRecord :home home :exit-code n
|
||||
valid partial record. Returns {:run schema:run :home home :exit-code n
|
||||
:error cause-or-nil}."
|
||||
[root home selected-build cases options signal on-progress on-created]
|
||||
(let [opts (assoc (normalize-options options) :run-id (:run-id home))
|
||||
|
||||
@ -85,7 +85,7 @@
|
||||
"ready; errors retain the build.transit and build.log for that ID.\n"
|
||||
"run prints one run ID on stdout. Progress, failures and the summary go\n"
|
||||
"to stderr. Builds and managed runs live under target/performance/render-wasm.\n"
|
||||
"compare reads saved RunRecords and starts no build, host or browser.\n\n"
|
||||
"compare reads saved schema:run records and starts no build, host or browser.\n\n"
|
||||
"Preparation and runs require an idle checkout with dependencies installed.\n"
|
||||
"Keep renderer watchers stopped until preparation ends. purge assumes no\n"
|
||||
"experiment is using the managed paths.\n\n"
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
;; Copyright (c) KALEIDOS SUBSIDIARY SL
|
||||
|
||||
(ns benches.render-wasm.node.runs
|
||||
"Manages saved run destinations, RunRecord persistence and diagnostic logs.
|
||||
"Manages saved run destinations, schema:run persistence and diagnostic logs.
|
||||
|
||||
Runs are saved under <frontend>/target/performance/render-wasm/runs.
|
||||
|
||||
@ -69,7 +69,7 @@
|
||||
:run-id run-id}))
|
||||
|
||||
(defn write-record!
|
||||
"Validates and atomically replaces the saved RunRecord."
|
||||
"Validates schema:run and atomically replaces the saved file."
|
||||
[home run]
|
||||
(files/atomic-write (:record-path home) (result/encode run)))
|
||||
|
||||
|
||||
@ -25,10 +25,7 @@
|
||||
Resampling draws a sample of the original size, allowing repeated values.
|
||||
Repeating this process gives medians whose central :confidence fraction
|
||||
defines a percentile confidence interval. These intervals describe the
|
||||
supplied measurements; evolving caches limit their interpretation.
|
||||
|
||||
:method-version records the calculation version for saved reports.
|
||||
Version 1 is the only supported version."
|
||||
supplied measurements; evolving caches limit their interpretation."
|
||||
(:require
|
||||
[app.common.schema :as sm]
|
||||
[benches.render-wasm.random :as random]))
|
||||
@ -37,10 +34,8 @@
|
||||
"Default settings for report calculations.
|
||||
:draws is the number of replacement samples; :seed controls their generator.
|
||||
:confidence is the fraction between interval bounds. :min-ci, :min-p95 and
|
||||
:min-p99 set the required observation counts for those results.
|
||||
:method-version records the calculation rules, currently version 1."
|
||||
{:method-version 1
|
||||
:draws 2000
|
||||
:min-p99 set the required observation counts for those results."
|
||||
{:draws 2000
|
||||
:seed 0x70656e70
|
||||
:confidence 0.95
|
||||
:min-ci 10
|
||||
@ -48,11 +43,10 @@
|
||||
:min-p99 500})
|
||||
|
||||
(def schema:settings
|
||||
"Valid settings for calculation version, sample draws, seed and report limits.
|
||||
"Valid settings for sample draws, seed and report limits.
|
||||
The seed is an integer in [0, 2^32); confidence lies strictly between 0 and 1.
|
||||
Draw and minimum observation counts are positive integers."
|
||||
[:map {:closed true}
|
||||
[:method-version [:= 1]]
|
||||
[:draws [:int {:min 1 :max 2147483647}]]
|
||||
[:seed [:fn random/seed?]]
|
||||
[:confidence [:fn #(and (number? %) (js/Number.isFinite %) (< 0 % 1))]]
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
;; Copyright (c) KALEIDOS SUBSIDIARY SL
|
||||
|
||||
(ns benches.render-wasm.report.compare
|
||||
"Offline comparisons of paired cases from two saved RunRecords.
|
||||
"Offline comparisons of paired cases from two saved schema:run records.
|
||||
|
||||
By default, comparisons are made between matching cases with equal settings.
|
||||
It is however possible to to explicitly select pairs allowing different case
|
||||
@ -56,7 +56,7 @@
|
||||
(set (map field (preparations run id))))
|
||||
|
||||
(defn- execution-settings
|
||||
"Selects declared execution inputs; recipe versions and text remain provenance."
|
||||
"Selects declared execution inputs; descriptive text remains provenance."
|
||||
[definition]
|
||||
(select-keys definition [:scene :scene-seed :params :view :context :completion
|
||||
:batch-size :preparation :operation]))
|
||||
@ -141,9 +141,9 @@
|
||||
(select-keys run [:run-id :started-at :ended-at :metadata :termination]))
|
||||
|
||||
(defn compare-runs
|
||||
"Creates a `:comparison` from constructed or decoded `:run-record`.
|
||||
"Creates a schema:comparison from constructed or decoded schema:run records.
|
||||
|
||||
Inputs must already satisfy the `:runrecord` contract. Encoding validates the
|
||||
Inputs must already satisfy schema:run. Encoding validates the
|
||||
returned comparison at the boundary.
|
||||
|
||||
Default pairs use identical identifiers. Explicit pairs select cases without
|
||||
@ -167,7 +167,7 @@
|
||||
{:type ::invalid-pairs
|
||||
:baseline (mapv (comp result/case-name :id) (get-in baseline [:plan :cases]))
|
||||
:candidate (mapv (comp result/case-name :id) (get-in candidate [:plan :cases]))})))
|
||||
{:type :comparison :schema-version 2 :analysis analysis
|
||||
{:type :comparison :analysis analysis
|
||||
:baseline (provenance baseline) :candidate (provenance candidate)
|
||||
:forced? (boolean force)
|
||||
:source-coverage summary/source-coverage :interpretation summary/interpretation
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
;; Copyright (c) KALEIDOS SUBSIDIARY SL
|
||||
|
||||
(ns benches.render-wasm.report.summarize
|
||||
"Reports use saved definitions and explicit metrics from raw RunRecords.
|
||||
"Reports use saved definitions and explicit metrics from schema:run records.
|
||||
Warmups and failed attempts supply no observations. A completed attempt can
|
||||
supply valid, invalid or absent metrics independently. Unattempted slots remain
|
||||
separate. Batches and render slices never multiply observation counts."
|
||||
@ -97,10 +97,10 @@
|
||||
(analysis/statistics values analysis))})))
|
||||
|
||||
(defn summarize
|
||||
"Builds a portable report from a constructed or decoded RunRecord.
|
||||
The run must already satisfy the RunRecord contract. Reporting uses one
|
||||
"Builds a portable report from a constructed or decoded schema:run record.
|
||||
The run must already satisfy schema:run. Reporting uses one
|
||||
resolved method.
|
||||
Overrides affect reporting without changing the stored RunRecord."
|
||||
Overrides affect reporting without changing the stored record."
|
||||
([run] (summarize run nil))
|
||||
([run overrides]
|
||||
(let [analysis (analysis/resolve-settings (merge (:analysis run) overrides))]
|
||||
|
||||
@ -41,7 +41,6 @@
|
||||
(def schema:fingerprint
|
||||
"The content digest of the actual validated starting snapshot."
|
||||
[:map {:closed true}
|
||||
[:encoding-version [:= 1]]
|
||||
[:algorithm [:= :sha-256]]
|
||||
[:digest [:re #"^[0-9a-f]{64}$"]]])
|
||||
|
||||
@ -81,11 +80,10 @@
|
||||
[:map [:reason keyword?]])
|
||||
|
||||
(def schema:run
|
||||
"RunRecord schema3. Cases are saved definitions, independent of any registry.
|
||||
"schema:run stores saved case definitions, independent of any registry.
|
||||
Build :functional holds compatibility settings; :provenance holds identities."
|
||||
[:map {:closed true}
|
||||
[:type [:= :run-record]]
|
||||
[:schema-version [:= 3]]
|
||||
[:run-id some?]
|
||||
[:started-at string?]
|
||||
[:ended-at [:maybe string?]]
|
||||
@ -155,10 +153,9 @@
|
||||
[:metadata schema:metadata] [:termination schema:termination]])
|
||||
|
||||
(def schema:comparison
|
||||
"Comparison schema2 retains resolved analysis, differences and per-side reports."
|
||||
"schema:comparison retains resolved analysis, differences and per-side reports."
|
||||
[:map {:closed true}
|
||||
[:type [:= :comparison]]
|
||||
[:schema-version [:= 2]]
|
||||
[:analysis analysis/schema:settings]
|
||||
[:baseline schema:provenance]
|
||||
[:candidate schema:provenance]
|
||||
@ -240,13 +237,9 @@
|
||||
"completed run has failed attempts" {})))
|
||||
|
||||
(defn check-run
|
||||
"Validates schema3 and chronological accounting at a saved-data boundary.
|
||||
Unsupported versions fail without invoking a legacy reader or case registry."
|
||||
"Validates schema:run and chronological accounting at a saved-data boundary."
|
||||
[run]
|
||||
(when-not (and (= :run-record (:type run)) (= 3 (:schema-version run)))
|
||||
(throw (ex-info "unsupported RunRecord format" {:type ::unsupported-format
|
||||
:schema-version (:schema-version run)})))
|
||||
(require-valid! (sm/validate schema:run run) "invalid RunRecord" {})
|
||||
(require-valid! (sm/validate schema:run run) "invalid schema:run" {})
|
||||
(let [case-ids (mapv :id (get-in run [:plan :cases]))
|
||||
preps (:preparations run)
|
||||
prep-ids (mapv :preparation-id preps)
|
||||
@ -277,7 +270,7 @@
|
||||
their slot too; attempts retain chronological order across cases."
|
||||
[{:keys [run-id started-at plan metadata analysis]}]
|
||||
(let [plan (merge {:warmups 3 :repetitions 10 :timeout-policy {:attempt-ms 30000}} plan)]
|
||||
(check-run {:type :run-record :schema-version 3
|
||||
(check-run {:type :run-record
|
||||
:run-id run-id :started-at started-at :ended-at nil
|
||||
:plan plan :metadata metadata :analysis (analysis/resolve-settings analysis)
|
||||
:preparations [] :attempts [] :remaining (initial-remaining plan)
|
||||
@ -330,14 +323,12 @@
|
||||
(assoc run :ended-at ended-at :termination termination))
|
||||
|
||||
(defn check-record
|
||||
"Validates a supported run or comparison at a Transit boundary."
|
||||
"Validates schema:run or schema:comparison at a Transit boundary."
|
||||
[record]
|
||||
(case (:type record)
|
||||
:run-record (check-run record)
|
||||
:comparison (do
|
||||
(when-not (= 2 (:schema-version record))
|
||||
(throw (ex-info "unsupported Comparison format" {:type ::unsupported-format})))
|
||||
(require-valid! (sm/validate schema:comparison record) "invalid Comparison" {})
|
||||
(require-valid! (sm/validate schema:comparison record) "invalid schema:comparison" {})
|
||||
record)
|
||||
(throw (ex-info "unsupported benchmark format" {:type ::unsupported-format}))))
|
||||
|
||||
|
||||
@ -20,8 +20,7 @@
|
||||
[:height [:int {:min 1080}]]])
|
||||
|
||||
(decl/defscene :masks
|
||||
{:version 1
|
||||
:description "Twenty-four circle masks with ordered striped descendants"
|
||||
{:description "Twenty-four circle masks with ordered striped descendants"
|
||||
:params-schema schema:params}
|
||||
[params]
|
||||
(let [params (merge default-params params)]
|
||||
|
||||
@ -47,8 +47,7 @@
|
||||
|
||||
|
||||
(decl/defscene :paths
|
||||
{:version 1
|
||||
:description "Curved paths"
|
||||
{:description "Curved paths"
|
||||
:params-schema schema:params}
|
||||
[params]
|
||||
(let [params (merge default-params params)]
|
||||
|
||||
@ -36,8 +36,7 @@
|
||||
|
||||
|
||||
(decl/defscene :plus
|
||||
{:version 1
|
||||
:description "Plus signs made of two open line subpaths"
|
||||
{:description "Plus signs made of two open line subpaths"
|
||||
:params-schema schema:params}
|
||||
[params]
|
||||
(let [params (merge default-params params)]
|
||||
|
||||
@ -58,8 +58,7 @@
|
||||
:r4 (sb/gen-int 0 24)})
|
||||
|
||||
(decl/defscene :rects
|
||||
{:version 1
|
||||
:description "Seeded rectangles with translucent fills and centered strokes"
|
||||
{:description "Seeded rectangles with translucent fills and centered strokes"
|
||||
:params-schema schema:params}
|
||||
[params]
|
||||
(let [params (merge default-params params)]
|
||||
|
||||
@ -81,8 +81,10 @@
|
||||
(t/is (= (path/join (:dir build) "build.transit") (:manifest-path build)))
|
||||
(t/is (= (path/join (:dir build) "index.html") (:index-path build)))
|
||||
(t/is (= manifest (:manifest build)))
|
||||
(t/is (= {:type :renderer-build :schema-version 1 :status :building}
|
||||
(select-keys manifest [:type :schema-version :status])))
|
||||
(t/is (= #{:type :id :status :created-at :updated-at :functional :provenance}
|
||||
(set (keys manifest))))
|
||||
(t/is (= {:type :renderer-build :status :building}
|
||||
(select-keys manifest [:type :status])))
|
||||
(t/is (= {:mode :release :default-features? false
|
||||
:features ["feature-one" "feature-two"] :cljs-profile-marks false}
|
||||
(:functional manifest)))
|
||||
@ -155,6 +157,19 @@
|
||||
(t/is (= #{"browser" "renderer" "build.log" "build.transit"}
|
||||
(set (array-seq (fs/readdirSync (:dir build))))))))
|
||||
|
||||
(t/deftest malformed-builds-cannot-replace-saved-manifests
|
||||
(doseq [side [:current :replacement]]
|
||||
(let [build (create-build)
|
||||
valid (:manifest build)
|
||||
malformed (dissoc valid :functional)
|
||||
proposed (if (= :replacement side) malformed valid)]
|
||||
(when (= :current side)
|
||||
(fs/writeFileSync (:manifest-path build) (codec/encode-str malformed) "utf8"))
|
||||
(let [saved (fs/readFileSync (:manifest-path build) "utf8")
|
||||
error (failure #(artifacts/write-manifest build proposed))]
|
||||
(t/is (= ::artifacts/invalid-manifest (:type (ex-data error))) (name side))
|
||||
(t/is (= saved (fs/readFileSync (:manifest-path build) "utf8")) (name side))))))
|
||||
|
||||
(def ^:private manifest-reader
|
||||
(str "const {parentPort, workerData} = require('worker_threads');"
|
||||
"const fs = require('fs'); const stop = new Int32Array(workerData.stop);"
|
||||
@ -201,8 +216,9 @@
|
||||
(finally
|
||||
(await (.terminate worker))))))
|
||||
|
||||
(t/deftest unsupported-manifests-and-incomplete-builds-are-rejected
|
||||
(doseq [change [{:schema-version 2} {:type :run-record} {:id "another-build"}]]
|
||||
(t/deftest malformed-manifests-and-incomplete-builds-are-rejected
|
||||
(doseq [change [{:functional []} {:type :run-record} {:id "another-build"}
|
||||
{:status :unknown}]]
|
||||
(let [build (ready-build)]
|
||||
(fs/writeFileSync (:manifest-path build) (codec/encode-str (merge (:manifest build) change))
|
||||
"utf8")
|
||||
@ -214,6 +230,17 @@
|
||||
(fs/unlinkSync (path/join (:dir build) relative))
|
||||
(t/is (some? (failure #(artifacts/load-build @temporary-root (:id build)))) relative))))
|
||||
|
||||
(t/deftest saved-builds-validate-current-shapes
|
||||
(let [build (ready-build)
|
||||
manifest (select-keys (:manifest build)
|
||||
[:type :id :status :created-at :updated-at :functional :provenance])]
|
||||
(fs/writeFileSync (:manifest-path build) (codec/encode-str manifest) "utf8")
|
||||
(t/is (= manifest (:manifest (artifacts/load-build @temporary-root (:id build)))))
|
||||
(fs/writeFileSync (:manifest-path build)
|
||||
(codec/encode-str (dissoc manifest :functional)) "utf8")
|
||||
(t/is (= ::artifacts/unsupported-manifest
|
||||
(:type (ex-data (failure #(artifacts/load-build @temporary-root (:id build)))))))))
|
||||
|
||||
(t/deftest ids-cannot-select-or-delete-outside-paths
|
||||
(let [build (ready-build)
|
||||
outside (path/join @temporary-root "outside.txt")]
|
||||
@ -421,7 +448,6 @@
|
||||
[id]
|
||||
{:id id
|
||||
:scene :artifact-only
|
||||
:scene-version 1
|
||||
:scene-description "A descriptor supplied only by this build"
|
||||
:scene-seed 42
|
||||
:params {}
|
||||
@ -429,7 +455,7 @@
|
||||
:context :fresh
|
||||
:completion :render-full
|
||||
:batch-size 1
|
||||
:preparation {:version 1}})
|
||||
:preparation {}})
|
||||
|
||||
(defn- write-catalog
|
||||
[build loaded-id response]
|
||||
|
||||
@ -139,16 +139,7 @@ function manifestText(id, status, type) {
|
||||
return transit
|
||||
.writer("json")
|
||||
.write(
|
||||
transit.map([
|
||||
k("type"),
|
||||
k(type),
|
||||
k("schema-version"),
|
||||
1,
|
||||
k("id"),
|
||||
id,
|
||||
k("status"),
|
||||
k(status),
|
||||
]),
|
||||
transit.map([k("type"), k(type), k("id"), id, k("status"), k(status)]),
|
||||
);
|
||||
}
|
||||
|
||||
@ -173,7 +164,7 @@ function seedRuns(fixture) {
|
||||
fs.mkdirSync(directory, { recursive: true });
|
||||
fs.writeFileSync(
|
||||
path.join(directory, "run.transit"),
|
||||
manifestText(id, status, "renderer-run"),
|
||||
`${status} run output\n`,
|
||||
);
|
||||
fs.writeFileSync(path.join(directory, "run.log"), "run\n");
|
||||
fs.writeFileSync(path.join(directory, "case-load.PNG"), "screenshot\n");
|
||||
@ -209,14 +200,7 @@ function runFixtureText({
|
||||
k("case-id"),
|
||||
k(caseId),
|
||||
k("fingerprint"),
|
||||
map([
|
||||
k("encoding-version"),
|
||||
1,
|
||||
k("algorithm"),
|
||||
k("sha-256"),
|
||||
k("digest"),
|
||||
"a".repeat(64),
|
||||
]),
|
||||
map([k("algorithm"), k("sha-256"), k("digest"), "a".repeat(64)]),
|
||||
k("effective-graphics"),
|
||||
map([k("webgl2"), true]),
|
||||
k("diagnostics"),
|
||||
@ -241,8 +225,6 @@ function runFixtureText({
|
||||
const record = map([
|
||||
k("type"),
|
||||
k("run-record"),
|
||||
k("schema-version"),
|
||||
3,
|
||||
k("run-id"),
|
||||
runId,
|
||||
k("started-at"),
|
||||
@ -277,8 +259,6 @@ function runFixtureText({
|
||||
]),
|
||||
k("analysis"),
|
||||
map([
|
||||
k("method-version"),
|
||||
1,
|
||||
k("draws"),
|
||||
2000,
|
||||
k("seed"),
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
["fs" :as fs]
|
||||
["os" :as os]
|
||||
["path" :as path]
|
||||
[app.common.transit :as transit]
|
||||
[benches.render-wasm.node.compare :as compare]
|
||||
[benches.render-wasm.report.compare :as report-compare]
|
||||
[benches.render-wasm.result :as result]
|
||||
@ -34,7 +35,6 @@
|
||||
[case-id scene]
|
||||
{:id case-id
|
||||
:scene scene
|
||||
:scene-version 1
|
||||
:scene-description "comparison scene"
|
||||
:scene-seed 7
|
||||
:params {:count 10}
|
||||
@ -42,7 +42,7 @@
|
||||
:context :fresh
|
||||
:completion :render-full
|
||||
:batch-size 1
|
||||
:preparation {:version 1}})
|
||||
:preparation {}})
|
||||
|
||||
(defn- make-run
|
||||
[run-id case-id value & {:keys [environment functional fingerprint scene]
|
||||
@ -66,7 +66,7 @@
|
||||
run
|
||||
{:preparation-id preparation-id
|
||||
:case-id case-id
|
||||
:fingerprint {:encoding-version 1 :algorithm :sha-256
|
||||
:fingerprint {:algorithm :sha-256
|
||||
:digest fingerprint}
|
||||
:effective-graphics {:webgl2 true}
|
||||
:diagnostics {}})
|
||||
@ -92,7 +92,7 @@
|
||||
nil
|
||||
(catch :default cause cause)))
|
||||
|
||||
(t/deftest compares-saved-file-paths-from-the-caller-cwd
|
||||
(t/deftest compares-saved-records-from-the-caller-cwd
|
||||
(write-run (path/join @temporary-root "baseline.transit")
|
||||
(make-run "baseline" :case/load 10))
|
||||
(write-run (path/join @temporary-root "candidate.transit")
|
||||
@ -103,7 +103,7 @@
|
||||
(let [{:keys [comparison text]} (compare/execute "baseline.transit"
|
||||
"candidate.transit" {})]
|
||||
(t/is (= :comparison (:type comparison)))
|
||||
(t/is (= 2 (:schema-version comparison)))
|
||||
(t/is (= 2 (get-in comparison [:pairs 0 :metrics :elapsed :absolute :value])))
|
||||
(t/is (str/includes? text "Baseline"))
|
||||
(t/is (str/includes? text "Candidate"))
|
||||
(t/is (str/includes? text "case/load"))
|
||||
@ -159,6 +159,12 @@
|
||||
(t/is (thrown? js/Error (compare/execute baseline
|
||||
(path/join @temporary-root "broken.transit")
|
||||
{})))
|
||||
(fs/writeFileSync (path/join @temporary-root "malformed.transit")
|
||||
(transit/encode-str (dissoc (make-run "malformed" :case/load 12) :plan)))
|
||||
(t/is (= ::result/invalid-record
|
||||
(:type (ex-data (failure #(compare/execute baseline
|
||||
(path/join @temporary-root "malformed.transit")
|
||||
{}))))))
|
||||
(t/is (thrown? js/Error (compare/execute baseline
|
||||
(path/join @temporary-root "missing.transit")
|
||||
{})))))
|
||||
|
||||
@ -23,8 +23,7 @@
|
||||
rtx)
|
||||
|
||||
(decl/defscene :contracts-scene
|
||||
{:version 1
|
||||
:description "Synthetic scene for contract tests"
|
||||
{:description "Synthetic scene for contract tests"
|
||||
:params-schema [:map {:closed true}]}
|
||||
[params]
|
||||
params)
|
||||
@ -55,7 +54,6 @@
|
||||
[scene-id case-params f]
|
||||
(decl/register-scene! {:id scene-id
|
||||
:ns "contracts-test"
|
||||
:version 1
|
||||
:description "synthetic"
|
||||
:params-schema [:map {:closed true} [:count [:int {:min 1 :max 100000}]]]
|
||||
:build (fn [params] params)})
|
||||
@ -75,7 +73,6 @@
|
||||
(let [scene (decl/registered-scene :rects)]
|
||||
(t/is (= :rects (:id scene)))
|
||||
(t/is (= "benches.render-wasm.scenes.rects" (:ns scene)))
|
||||
(t/is (= 1 (:version scene)))
|
||||
(t/is (= "Seeded rectangles with translucent fills and centered strokes"
|
||||
(:description scene)))
|
||||
(t/is (vector? (:params-schema scene)))
|
||||
@ -93,10 +90,32 @@
|
||||
(t/is (every? #(not (contains? % :run!)) (rect-cases)))))
|
||||
|
||||
(t/deftest collected-cases-survive-the-wire
|
||||
(doseq [case-desc (rect-cases)]
|
||||
(t/is (not (contains? case-desc :run!)) (str (:id case-desc)))
|
||||
(t/is (not (contains? case-desc :ns)) (str (:id case-desc)))
|
||||
(t/is (decl/transit-round-trips? case-desc) (str (:id case-desc)))))
|
||||
(doseq [scene-id [:rects :paths :plus :masks]]
|
||||
(let [collected (cases/collect-cases {:master-seed 42
|
||||
:filter (str (name scene-id) "/")})
|
||||
decoded (transit/decode-str (transit/encode-str collected))]
|
||||
(t/is (= (mapv #(keyword (name scene-id) %) ["load" "pan" "zoom"])
|
||||
(mapv :id collected)))
|
||||
(t/is (= collected decoded))
|
||||
(doseq [case-desc decoded]
|
||||
(t/is (= case-desc (decl/check-collected-case case-desc)))
|
||||
(t/is (not-any? #(contains? case-desc %)
|
||||
[:run! :ns])
|
||||
(str (:id case-desc)))
|
||||
(t/is (= {} (:preparation case-desc)) (str (:id case-desc)))))))
|
||||
|
||||
(t/deftest declared-preparation-survives-collection-and-wire
|
||||
(with-synthetic-scene :contracts-prepared {:count 3}
|
||||
(fn []
|
||||
(let [preparation {:settle-ms 25}
|
||||
registered (decl/registered-case :contracts-prepared/case)]
|
||||
(decl/register-case! (assoc registered :preparation preparation))
|
||||
(let [collected (cases/collect-cases {:master-seed 42 :filter "contracts-prepared/"})
|
||||
decoded (transit/decode-str (transit/encode-str collected))]
|
||||
(t/is (= [:contracts-prepared/case] (mapv :id decoded)))
|
||||
(t/is (= collected decoded))
|
||||
(t/is (= preparation (:preparation (first decoded))))
|
||||
(t/is (= (first decoded) (decl/check-collected-case (first decoded)))))))))
|
||||
|
||||
(t/deftest rects-cases-carry-declared-view-context-and-completion
|
||||
(let [collected (rect-cases)]
|
||||
@ -109,13 +128,12 @@
|
||||
(t/is (= {:scale 1 :x 0 :y 0} (:view case-desc)) (str (:id case-desc)))
|
||||
(t/is (= :render-full (:completion case-desc)) (str (:id case-desc)))
|
||||
(t/is (= 1 (:batch-size case-desc)) (str (:id case-desc)))
|
||||
(t/is (= {:version 1} (:preparation case-desc)) (str (:id case-desc))))))
|
||||
(t/is (= {} (:preparation case-desc)) (str (:id case-desc))))))
|
||||
|
||||
(t/deftest rects-cases-carry-scene-metadata-and-seed
|
||||
(let [collected (rect-cases)]
|
||||
(doseq [case-desc collected]
|
||||
(t/is (= :rects (:scene case-desc)))
|
||||
(t/is (= 1 (:scene-version case-desc)))
|
||||
(t/is (= "Seeded rectangles with translucent fills and centered strokes"
|
||||
(:scene-description case-desc)))
|
||||
(t/is (= 2602546180 (:scene-seed case-desc)) (str (:id case-desc)))))
|
||||
@ -216,7 +234,6 @@
|
||||
(:type (failure-data
|
||||
#(decl/register-scene! {:id :rects
|
||||
:ns "another-namespace"
|
||||
:version 1
|
||||
:description "x"
|
||||
:params-schema [:map]
|
||||
:build (fn [params] params)}))))))
|
||||
@ -225,13 +242,11 @@
|
||||
(try
|
||||
(decl/register-scene! {:id :contracts-replaced
|
||||
:ns "contracts-test"
|
||||
:version 1
|
||||
:description "first"
|
||||
:params-schema [:map]
|
||||
:build (fn [params] params)})
|
||||
(decl/register-scene! {:id :contracts-replaced
|
||||
:ns "contracts-test"
|
||||
:version 2
|
||||
:description "second"
|
||||
:params-schema [:map]
|
||||
:build (fn [params] params)})
|
||||
@ -243,7 +258,6 @@
|
||||
(try
|
||||
(decl/register-scene! {:id :contracts-dup
|
||||
:ns "contracts-test"
|
||||
:version 1
|
||||
:description "x"
|
||||
:params-schema [:map]
|
||||
:build (fn [params] params)})
|
||||
@ -284,7 +298,6 @@
|
||||
(try
|
||||
(decl/register-scene! {:id :contracts-other
|
||||
:ns "contracts-test"
|
||||
:version 1
|
||||
:description "x"
|
||||
:params-schema [:map]
|
||||
:build (fn [params] params)})
|
||||
@ -306,7 +319,6 @@
|
||||
(try
|
||||
(decl/register-scene! {:id :contracts-noschema
|
||||
:ns "contracts-test"
|
||||
:version 1
|
||||
:description "x"
|
||||
:build (fn [params] params)})
|
||||
(t/is (= ::decl/invalid-scene
|
||||
@ -318,7 +330,6 @@
|
||||
(try
|
||||
(decl/register-scene! {:id :contracts-badschema
|
||||
:ns "contracts-test"
|
||||
:version 1
|
||||
:description "x"
|
||||
:params-schema [:map [:count]]
|
||||
:build (fn [params] params)})
|
||||
@ -332,7 +343,6 @@
|
||||
(try
|
||||
(decl/register-scene! {:id :contracts-ns/scene
|
||||
:ns "contracts-test"
|
||||
:version 1
|
||||
:description "x"
|
||||
:params-schema [:map]
|
||||
:build (fn [params] params)})
|
||||
@ -352,7 +362,6 @@
|
||||
(try
|
||||
(decl/register-scene! {:id :contracts-incomplete
|
||||
:ns "contracts-test"
|
||||
:version 1
|
||||
:description "x"
|
||||
:params-schema [:map]
|
||||
:build (fn [params] params)})
|
||||
@ -377,7 +386,6 @@
|
||||
(try
|
||||
(decl/register-scene! {:id :contracts-replacecase
|
||||
:ns "contracts-test"
|
||||
:version 1
|
||||
:description "x"
|
||||
:params-schema [:map]
|
||||
:build (fn [params] params)})
|
||||
|
||||
@ -91,12 +91,10 @@
|
||||
(t/is (= (fingerprint/fingerprint data)
|
||||
(fingerprint/fingerprint (transit/decode-str (transit/encode-str data)))))))
|
||||
|
||||
(t/deftest digest-has-a-fixed-encoding-version-and-known-sha256-vector
|
||||
(t/deftest digest-matches-known-sha256-vector
|
||||
;; The verbose Transit map for {:objects {} :refs {}} is canonical text.
|
||||
(t/is (= "{\"~:objects\":{},\"~:refs\":{}}"
|
||||
(fingerprint/snapshot-text {:objects {} :refs {}})))
|
||||
(let [fp (fingerprint/fingerprint {:objects {} :refs {}})]
|
||||
(t/is (= 1 (:encoding-version fp)))
|
||||
(t/is (= :sha-256 (:algorithm fp)))
|
||||
(t/is (= "ceb57067506683f5a0e80615bc9dd6f6d16325e333864da705fa4916fbdfe52d"
|
||||
(:digest fp)))))
|
||||
(t/is (= {:algorithm :sha-256
|
||||
:digest "ceb57067506683f5a0e80615bc9dd6f6d16325e333864da705fa4916fbdfe52d"}
|
||||
(fingerprint/fingerprint {:objects {} :refs {}}))))
|
||||
|
||||
@ -591,7 +591,6 @@
|
||||
prep (:preparation prepared)
|
||||
request (transit/encode-str {:preparation-id (:preparation-id prep)})]
|
||||
(t/is (= "ok" (:status prepared)))
|
||||
(t/is (= 1 (get-in prep [:fingerprint :encoding-version])))
|
||||
(t/is (seq (get-in prep [:diagnostics :setup-render :slices])))
|
||||
(-> (browser/run-prepared request)
|
||||
(.then (fn [first-text]
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
(def saved-case
|
||||
"A saved definition that requires no current registration."
|
||||
{:id :saved/pan :scene :saved :scene-version 4 :scene-seed 42
|
||||
{:id :saved/pan :scene :saved :scene-seed 42
|
||||
:params {:count 10} :view {:scale 1 :x 0 :y 0}
|
||||
:operation {:steps 3} :context :reuse :completion :render-full
|
||||
:batch-size 1 :preparation {}})
|
||||
@ -38,7 +38,7 @@
|
||||
(def preparation
|
||||
"One content identity and its effective graphics."
|
||||
{:preparation-id :prep/one :case-id :saved/pan
|
||||
:fingerprint {:encoding-version 1 :algorithm :sha-256 :digest (apply str (repeat 64 "a"))}
|
||||
:fingerprint {:algorithm :sha-256 :digest (apply str (repeat 64 "a"))}
|
||||
:effective-graphics {:vendor "vendor" :renderer "hardware" :software false :dpr 2}
|
||||
:diagnostics {:upload-ms 123}})
|
||||
|
||||
@ -135,7 +135,7 @@
|
||||
|
||||
(t/deftest analysis-settings-are-validated-and-recorded
|
||||
(doseq [override [{:draws 0} {:seed -1} {:seed 4294967296} {:confidence 1}
|
||||
{:confidence js/NaN} {:min-ci 0} {:method-version 2} {:unknown 1}]]
|
||||
{:confidence js/NaN} {:min-ci 0} {:unknown 1}]]
|
||||
(t/is (= ::method/invalid-settings (:type (error-data #(method/resolve-settings override))))))
|
||||
(t/is (= 0 (:seed (method/resolve-settings {:seed 0}))))
|
||||
(t/is (= method/defaults (:analysis (run-with [1])))))
|
||||
@ -296,11 +296,16 @@
|
||||
(t/is (= {:cause [{:message "failure"}]} (get-in decoded [:attempts 4 :failure])))
|
||||
(t/is (= 1 (get-in (summary/observations decoded :saved/pan metric-id) [:counts :failed])))))
|
||||
|
||||
(t/deftest unknown-format-and-poisoned-accounting-refuse
|
||||
(t/deftest malformed-records-and-poisoned-accounting-refuse
|
||||
(let [run (run-with [1])]
|
||||
(doseq [bad [(assoc run :schema-version 2) {:schema-version 1}]]
|
||||
(t/is (= ::result/unsupported-format (:type (error-data #(result/decode (transit/encode-str bad)))))))
|
||||
(doseq [bad [(assoc-in run [:attempts 0 :ordinal] 3)
|
||||
(t/is (= ::result/unsupported-format
|
||||
(:type (error-data #(result/decode (transit/encode-str (assoc run :type :unknown)))))))
|
||||
(doseq [bad [(dissoc run :plan)
|
||||
(assoc run :attempts {})
|
||||
(assoc-in run [:analysis :draws] 0)
|
||||
(assoc-in run [:preparations 0 :fingerprint :algorithm] :unknown)
|
||||
(assoc-in run [:preparations 0 :fingerprint :digest] "not a digest")
|
||||
(assoc-in run [:attempts 0 :ordinal] 3)
|
||||
(assoc-in run [:attempts 0 :preparation-id] :unknown)
|
||||
(assoc-in run [:remaining :saved/pan :repetitions] 2)
|
||||
(assoc-in run [:attempts 0 :metrics metric-id :value] js/NaN)]]
|
||||
@ -416,10 +421,14 @@
|
||||
(t/is (= ::result/invalid-record
|
||||
(:type (error-data #(result/decode (transit/encode-str reordered)))))))))
|
||||
|
||||
(t/deftest portable-report-roundtrip-does-not-use-registry
|
||||
(t/deftest records-roundtrip-summarize-and-compare-without-registry
|
||||
(let [run (run-with (vec (range 1 11)))
|
||||
transported (-> run result/encode result/decode)]
|
||||
transported (-> run result/encode result/decode)
|
||||
comparison (-> (compare/compare-runs transported transported)
|
||||
result/encode result/decode)]
|
||||
(t/is (= (summary/summarize run) (summary/summarize transported)))
|
||||
(t/is (= 0 (get-in comparison [:pairs 0 :metrics metric-id :absolute :value])))
|
||||
(t/is (empty? (get-in comparison [:pairs 0 :mismatches])))
|
||||
(t/is (str/includes? (format/format-run (summary/summarize transported)) "runtime-helper identity is unverified"))
|
||||
(t/is (= 99 (get-in (summary/summarize run {:draws 99}) [:analysis :draws])))
|
||||
(t/is (= method/defaults (:analysis run)))))
|
||||
@ -472,13 +481,12 @@
|
||||
|
||||
(t/deftest matching-cases-ignore-provenance-and-repetition-counts
|
||||
(let [baseline (run-with [1 2 3])
|
||||
candidate (run-with [2 3 4 5] {:definition (assoc saved-case :scene-version 99)
|
||||
candidate (run-with [2 3 4 5] {:definition (assoc saved-case :scene-description "Reworded description")
|
||||
:analysis {:seed 99}
|
||||
:facts (-> metadata
|
||||
(assoc :git {:sha "other" :dirty true})
|
||||
(assoc-in [:build :provenance :run-marker] "second"))})
|
||||
comparison (compare/compare-runs baseline (assoc candidate :run-id "other" :started-at "later"))]
|
||||
(t/is (= 2 (:schema-version comparison)))
|
||||
(t/is (= method/defaults (:analysis comparison)))
|
||||
(t/is (empty? (get-in comparison [:pairs 0 :mismatches])))
|
||||
(t/is (= 1.5 (get-in comparison [:pairs 0 :metrics metric-id :absolute :value])))
|
||||
@ -493,7 +501,7 @@
|
||||
[:execution (run-with [3] {:definition (assoc saved-case :batch-size 20)})]
|
||||
[:execution (run-with [3] {:definition (assoc saved-case :completion :call)})]
|
||||
[:execution (run-with [3] {:definition (assoc saved-case :completion :await)})]
|
||||
[:execution (run-with [3] {:definition (assoc saved-case :preparation {:version 2})})]
|
||||
[:execution (run-with [3] {:definition (assoc saved-case :preparation {:settle-ms 25})})]
|
||||
[:environment (run-with [3] {:facts (assoc-in metadata [:environment :browser] "other")})]
|
||||
[:functional-build (run-with [3] {:facts (assoc-in metadata [:build :functional :features] #{:other})})]
|
||||
[:warmups (run-with [3] {:warmups 1})]
|
||||
@ -519,7 +527,7 @@
|
||||
(let [base (run-with [1])
|
||||
other (-> (run-with [2] {:definition (assoc saved-case :id :different/zoom :scene :different
|
||||
:operation {:steps 8} :batch-size 20
|
||||
:completion :call :preparation {:version 2})
|
||||
:completion :call :preparation {:settle-ms 25})
|
||||
:prep (assoc-in preparation [:fingerprint :digest] (apply str (repeat 64 "b")))})
|
||||
result/encode
|
||||
result/decode)
|
||||
@ -542,7 +550,7 @@
|
||||
:batch-size 1 :completion :render-full :preparation {}}
|
||||
(select-keys (:baseline execution) execution-keys)))
|
||||
(t/is (= {:scene :different :operation {:steps 8}
|
||||
:batch-size 20 :completion :call :preparation {:version 2}}
|
||||
:batch-size 20 :completion :call :preparation {:settle-ms 25}}
|
||||
(select-keys (:candidate execution) execution-keys)))
|
||||
(t/is (= ::compare/incompatible
|
||||
(:type (error-data #(compare/compare-runs base (assoc-in other [:metadata :environment :cpu] "other")
|
||||
@ -596,10 +604,10 @@
|
||||
(assoc-in comparison (conj changes-path :absolute-ci) {:lower 2 :upper 1})
|
||||
(assoc-in comparison (conj report-path :counts :valid) -1)
|
||||
(assoc-in comparison (conj report-path :definitions 0 :basis :calls) 0)
|
||||
(assoc-in comparison [:baseline :metadata :scored?] :unknown)]]
|
||||
(t/is (= ::result/invalid-record (:type (error-data #(result/decode (transit/encode-str changed)))))))
|
||||
(t/is (= ::result/unsupported-format
|
||||
(:type (error-data #(result/decode (transit/encode-str (assoc comparison :schema-version 1)))))))))
|
||||
(assoc-in comparison [:baseline :metadata :scored?] :unknown)
|
||||
(dissoc comparison :pairs)
|
||||
(assoc-in comparison [:analysis :confidence] 1)]]
|
||||
(t/is (= ::result/invalid-record (:type (error-data #(result/decode (transit/encode-str changed)))))))))
|
||||
|
||||
(t/deftest force-keeps-invalid-measurements-unusable
|
||||
(let [baseline (run-with [js/NaN js/Infinity :absent :failed] {:repetitions 5})
|
||||
|
||||
@ -41,19 +41,20 @@
|
||||
:dir dir
|
||||
:log-path (path/join dir "build.log")
|
||||
:manifest {:type :renderer-build
|
||||
:schema-version 1
|
||||
:id id
|
||||
:status :ready
|
||||
:created-at "2026-10-27T00:00:00.000Z"
|
||||
:updated-at "2026-10-27T00:00:00.000Z"
|
||||
:functional {:mode :release
|
||||
:default-features? true
|
||||
:features []}
|
||||
:features []
|
||||
:cljs-profile-marks false}
|
||||
:provenance {:git {:sha "build-revision" :dirty false}}}})
|
||||
|
||||
(defn- collected
|
||||
[id context]
|
||||
{:id id
|
||||
:scene :case
|
||||
:scene-version 1
|
||||
:scene-description "test scene"
|
||||
:scene-seed 1
|
||||
:params {}
|
||||
@ -61,7 +62,7 @@
|
||||
:context context
|
||||
:completion :render-full
|
||||
:batch-size 1
|
||||
:preparation {:version 1}})
|
||||
:preparation {}})
|
||||
|
||||
(defn- next-count
|
||||
[state key]
|
||||
@ -127,8 +128,7 @@
|
||||
|
||||
(let [preparation {:preparation-id preparation-id
|
||||
:case-id case-id
|
||||
:fingerprint {:encoding-version 1
|
||||
:algorithm :sha-256
|
||||
:fingerprint {:algorithm :sha-256
|
||||
:digest (apply str (repeat 64 "a"))}
|
||||
:effective-graphics {}
|
||||
:diagnostics {}}]
|
||||
@ -440,7 +440,7 @@
|
||||
diag (get-in run [:metadata :diagnostics])]
|
||||
(t/is (= {:attempt-ms 1234} (get-in run [:plan :timeout-policy])))
|
||||
(t/is (= {:sha "build-revision" :dirty false} (get-in run [:metadata :git])))
|
||||
(t/is (= {:mode :release :default-features? true :features []}
|
||||
(t/is (= {:mode :release :default-features? true :features [] :cljs-profile-marks false}
|
||||
(get-in run [:metadata :build :functional])))
|
||||
(t/is (= "test-build" (get-in run [:metadata :build :provenance :build-id])))
|
||||
(t/is (true? (get-in run [:metadata :scored?])))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user