Merge origin/main into feat/caf-action-values-14254

This commit is contained in:
RickiNano committed 2026-11-18 20:27:01 +01:00
commit 6f952d8a21
13 files changed
+323 -184

No files matched your search

+43
View File
@@ -45,3 +45,46 @@ success-output = "immediate"
# scheduling slots so four independent devices do not compete for the same CPU renderer.
# All cases and the 60-second warning remain unchanged.
threads-required = 2
# Slowest tests start first. nextest starts higher-priority tests first, so a long test no longer
# begins at the end of the run and extends the job. Every test that took over 60 s on the Windows
# runner in the cold run of #15474 (unit and integration legs); the list names the test, so a test
# that gets faster stays harmless and a new slow one is added here. Priority only orders the
# start; it changes no timeout, group or result.
[[profile.ci.overrides]]
platform = 'cfg(target_os = "windows")'
# over 200 s
filter = '''
(package(photocraft-ui-egui) & test(=input::shortcut_dispatch::tests::every_displayed_shortcut_dispatches_from_where_focus_usually_is)) |
(package(photocraft-ui-egui) & test(=tone_targets::review_mask_action_context_matches_the_addressed_layer)) |
(package(photocraft-ui-egui) & test(=tone_targets::grayscale_picker_controls_sample_the_plane_and_change_the_visible_curve)) |
(package(photocraft-ui-egui) & test(=dialogs::adjust_editors::ui_tests::every_adjustment_layer_edits_through_properties)) |
(package(photocraft-ui-egui) & test(=tone_targets::filter_mask_tone_dialogs_preserve_the_target_and_sample_its_own_levels))
'''
priority = 100
[[profile.ci.overrides]]
platform = 'cfg(target_os = "windows")'
# 60 to 200 s
filter = '''
(package(photocraft-gpu) & test(=camera_raw::clarity_texture_and_dehaze_with_shadows_highlights_and_per_pixel_stages)) |
(package(photocraft-engine) & test(=cmd::retouch_cmds::content_aware_move::tests::a_coarse_preview_keeps_a_faint_sparse_selection)) |
(package(photocraft-engine) & test(=crop_content_aware_layers::unmeasured_active_targets_and_delete_off_keep_the_legacy_target)) |
(package(photocraft-engine) & test(=cmd::retouch_cmds::content_aware_move::color_tests::a_flat_patch_matches_the_new_surroundings_at_color_ten)) |
(package(photocraft-ui-egui) & test(=tools::type_tool::canvas_tests::every_paragraph_box_handle_resizes_the_box_with_snapping_on)) |
(package(photocraft-ui-egui) & test(=checker_canvas::pixel_grid_is_solid_and_visible_gpu_2x)) |
(package(photocraft-engine) & test(=cmd::retouch_cmds::tests::content_aware_move_coarse_preview_handles_transform_extend_and_limits)) |
(package(photocraft-ui-egui) & test(=checker_canvas::pixel_grid_is_solid_and_visible_cpu_2x)) |
(package(photocraft-ui-egui) & test(=drag_preview_canvas::marquee_previews_show_while_dragging_on_white_and_black_at_1x_and_2x)) |
(package(photocraft-gpu) & test(=camera_raw::shadows_and_highlights_with_per_pixel_stages)) |
(package(photocraft-engine) & test(=cmd::retouch_cmds::content_aware_move::color_tests::a_brightness_change_shifts_the_middle_only_past_color_five)) |
(package(photocraft-engine) & test(=cmd::retouch_cmds::tests::content_aware_move_previews_large_selections_coarse_then_exact_at_all_depths)) |
(package(photocraft-ui-egui) & test(=live_stroke_canvas::live_tool_camera_navigation_is_visible_in_the_input_frame)) |
(package(photocraft-ui-egui) & test(=live_stroke_canvas::the_canvas_shows_the_committed_stroke_part_0)) |
(package(photocraft-ui-egui) & test(=full_res_preview::adjustment_layer_drag_previews_at_full_resolution_when_low_res_is_off)) |
(package(photocraft-ui-egui) & test(=input::hold_keys::tests::cmd_gives_the_move_tool_only_where_the_tool_does_not_take_cmd)) |
(package(photocraft-ui-egui) & test(=guide_cursor_tests::command_over_a_guide_takes_it_where_command_is_the_move_tool)) |
(package(photocraft-gpu) & test(=parity::documents_larger_than_the_texture_limit)) |
(package(photocraft-engine) & test(=cmd::retouch_cmds::content_aware_move::tests::a_preview_within_the_full_resolution_budget_is_the_plain_solve_bit_for_bit))
'''
priority = 50
+78 -16
View File
@@ -83,6 +83,8 @@ jobs:
# Pull requests run them only when they change the GPU crate, a workspace crate it builds on, any
# package manifest, or a file outside the workspace packages other than documentation
# (scripts/ci-windows-gpu-tests.py, #15247); the Linux gate runs them on every pull request, and main runs them on Windows too.
# `windows_skip`: the platform-neutral packages whose Windows tests a pull request skips because nothing it
# changes reaches them (same script); empty on main and `full-ci`.
platforms:
if: github.event.action != 'labeled' || github.event.label.name == 'full-ci'
timeout-minutes: 10
@@ -91,6 +93,7 @@ jobs:
outputs:
windows: ${{ steps.pick.outputs.windows }}
windows_gpu: ${{ steps.pick.outputs.windows_gpu }}
windows_skip: ${{ steps.pick.outputs.windows_skip }}
web: ${{ steps.pick.outputs.web }}
steps:
- name: Harden runner
@@ -111,6 +114,7 @@ jobs:
{
echo "windows=true"
echo "windows_gpu=true"
echo "windows_skip="
echo "web=true"
} >> "$GITHUB_OUTPUT"
exit 0
@@ -131,6 +135,8 @@ jobs:
fi
gpu=$(python3 scripts/ci-windows-gpu-tests.py "$BASE")
echo "windows_gpu=$gpu" >> "$GITHUB_OUTPUT"
skip=$(python3 scripts/ci-windows-gpu-tests.py --skip-neutral "$BASE")
echo "windows_skip=$skip" >> "$GITHUB_OUTPUT"
# The Linux gate. Its rust-cache entry is the one `test (without heif)` restores.
gate:
@@ -152,6 +158,10 @@ jobs:
PHOTOCRAFT_NO_PRINT=1
LPDEST=photocraft-no-such-printer
timeout-minutes: 100
# On main, a `cache warm` leg builds the tests and saves the dependency cache as soon as the
# build succeeds; the gate legs then only restore, so a failing test cannot keep the entry
# from being saved (craft-common-actions#270). The same targets as the gate's test step (TEST_TARGETS in xtask/src/main.rs).
warm-command: cargo test --workspace --no-run --locked --features heif --lib --bins --tests
# fmt, clippy, layers, panel-commands, scorecard, tests, panic_hunt, doctests and the wasm32 check, with
# `--locked --features heif`, then the missing-translations report (xtask/src/main.rs).
command: python3 scripts/test-ci-gpu-lavapipe.py && python3 scripts/test-ci-windows-gpu-tests.py && cargo xtask ci && python3 scripts/ci-gpu-lavapipe.py
@@ -170,7 +180,9 @@ jobs:
strategy:
fail-fast: false
matrix:
part: [unit, integration]
# `warm` builds everything the other legs build and saves the dependency cache. Only main
# runs it; the other legs only restore.
part: ${{ fromJSON(github.ref == 'refs/heads/main' && '["unit","integration","clippy","warm"]' || '["unit","integration","clippy"]') }}
env:
# Released sccache expands Cargo's response files and exceeds Windows' rustc spawn limit
# (#13543). Let Cargo handle long commands until a release includes mozilla/sccache#3026.
@@ -183,6 +195,11 @@ jobs:
# The Windows compiler command line carries one -L path per built dependency; keep each
# target path short enough for CreateProcess when the graph is large.
CARGO_TARGET_DIR: 'D:\t'
# rust-lld (shipped with the toolchain) links the test binaries instead of link.exe, and the
# test links skip identical-code folding and PDBs. The link arguments in build.rs
# (/DELAYLOAD, delayimp.lib) are lld-link options too.
CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER: rust-lld
CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS: -Clink-arg=/OPT:NOICF -Clink-arg=/DEBUG:NONE
# The all-language UI tests shape real Japanese, Chinese, Korean and Devanagari labels
# with kittest's strict `MissingGlyphPolicy::Panic`. A hosted Windows image has no
# guaranteed Japanese or Simplified Chinese system font, and egui 0.37 panics on a
@@ -236,26 +253,30 @@ jobs:
shell: bash
# Only main saves caches; PRs restore main's, so the repo's 10 GB cache budget keeps main's.
# Both legs share one key (same dependencies); the integration leg saves it, because it also
# runs Clippy and so leaves Clippy's dependency metadata in it. A failed run saves nothing:
# when Clippy fails, the test build never ran, and an entry saved then would lack its
# dependencies. rust-cache never replaces an entry with the same key, so every later run
# All legs share one key (same dependencies). Only the `warm` leg saves it, as soon as the
# build is done and before any test runs, so a failing test never keeps the entry from being
# saved. It also runs Clippy, so the entry holds Clippy's dependency metadata for the `clippy`
# leg. A failed warm run saves nothing: an entry saved from a half-finished build would lack
# dependencies, and rust-cache never replaces an entry with the same key, so every later run
# would restore that half-filled entry until Cargo.lock changes.
- uses: step-security/rust-cache@8871c8ba063416da7c32246932ea6ae08700453e # v2.9.2
# v2.9.1 on purpose: v2.9.2 is an ES-module bundle in which minimatch's `require('path')` fails,
# so it assumes "/" as the path separator and, on Windows, its glob never matches a backslash
# path. The save step then finds no cache paths ("Path Validation Error") and never saves.
# v2.9.1 is the last release with the CommonJS bundle. Move back once a release fixes this.
- uses: step-security/rust-cache@851174d9a2fdc03e0896e02844dcc61d81dd7851 # v2.9.1
with:
workspaces: . -> ${{ steps.cache-target.outputs.relative }}
save-if: ${{ github.ref == 'refs/heads/main' && matrix.part == 'integration' }}
save-if: ${{ github.ref == 'refs/heads/main' && matrix.part == 'warm' }}
cache-on-failure: false
# Clippy has its own parallel leg: after the test build it ran in the integration leg's
# critical path (#15446).
- name: Clippy
if: matrix.part == 'integration'
if: matrix.part == 'clippy'
run: cargo clippy --workspace --all-targets --locked --features heif -- -D warnings
- name: Dependency layering
if: matrix.part == 'integration'
run: cargo xtask layers
- uses: step-security/taiki-e-install-action@76747d22a7567cc4438546a84f11bdf18e670ab8 # v2.87.32
if: matrix.part != 'clippy' && matrix.part != 'warm'
with:
tool: [email protected]
@@ -264,26 +285,67 @@ jobs:
# dependency cache. photocraft-gpu's tests run when the `platforms` job says they can be
# affected (`windows_gpu`); excluding the package also skips building its test binaries.
- name: Test
if: matrix.part != 'clippy'
env:
PART: ${{ matrix.part }}
GPU: ${{ needs.platforms.outputs.windows_gpu }}
SKIP_NEUTRAL: ${{ needs.platforms.outputs.windows_skip }}
run: |
case "$PART" in
unit) targets=(--lib --bins) ;;
warm) targets=(--lib --bins --test '*') ;;
*) targets=(--test '*') ;;
esac
skip=()
# The two browser apps are wasm targets; their native test builds check nothing the web job
# (and the Linux gate's wasm32 check) does not. Excluding them changes no other crate's
# features (`cargo tree -e features --workspace` is identical for every other package).
skip=(--exclude photocraft-web --exclude photocraft-web-boot)
# Only an explicit `false` skips them: a missing output runs everything.
if [ "$GPU" = false ]; then
skip=(--exclude photocraft-gpu)
skip+=(--exclude photocraft-gpu)
echo "::notice::photocraft-gpu's tests are skipped on Windows: this pull request changes nothing they are built from (the Linux gate still runs them)."
fi
cargo nextest run --profile ci --workspace "${skip[@]}" --locked --features heif "${targets[@]}"
# nextest reuses this build. The separate step writes cargo's --timings report for it.
# Pull requests without `full-ci` also skip the packages with no platform-specific code
# that nothing in the pull request reaches (scripts/ci-windows-gpu-tests.py); the Linux
# gate runs them. Main and `full-ci` run everything.
if [ -n "$SKIP_NEUTRAL" ]; then
for package in $SKIP_NEUTRAL; do skip+=(--exclude "$package"); done
echo "::notice::Tests of platform-neutral packages the pull request does not reach are skipped on Windows (the Linux gate still runs them): $SKIP_NEUTRAL"
fi
cargo test --no-run --timings --workspace "${skip[@]}" --locked --features heif "${targets[@]}"
if [ "$PART" != warm ]; then
cargo nextest run --profile ci --workspace "${skip[@]}" --locked --features heif "${targets[@]}"
fi
shell: bash
# Fills the cache entry's Clippy metadata (the `clippy` leg only restores it). A Clippy
# failure is the `clippy` leg's to report, not a reason to skip saving the cache.
- name: Clippy dependency metadata
if: matrix.part == 'warm'
continue-on-error: true
run: cargo clippy --workspace --all-targets --locked --features heif -- -D warnings
# Per-crate compile and link times of this leg's build (open the HTML in a browser).
- name: Upload cargo build timings
if: always() && matrix.part != 'clippy'
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: cargo-timings-windows-${{ matrix.part }}
# CARGO_TARGET_DIR above; the glob needs forward slashes.
path: D:/t/cargo-timings/*.html
if-no-files-found: ignore
retention-days: 14
- name: Doctests
if: matrix.part == 'unit'
run: cargo test --workspace --locked --features heif --doc
env:
SKIP_NEUTRAL: ${{ needs.platforms.outputs.windows_skip }}
run: |
skip=(--exclude photocraft-web --exclude photocraft-web-boot)
for package in $SKIP_NEUTRAL; do skip+=(--exclude "$package"); done
cargo test --workspace "${skip[@]}" --locked --features heif --doc
shell: bash
# The same codecs without the optional decoder: HEIC must stay a clear "not in this build" error
# for distributors who leave it out. Runs beside the gate and restores the gate's dependency
+1 -7
View File
@@ -8,16 +8,10 @@ name: FreeBSD
# The VM build takes one to several hours, so it runs nightly on main rather than on every push
# or dependency change: a drifted dependency still shows up within a day. PRs that change the
# FreeBSD packaging itself still run it.
# Nightly and on demand only: FreeBSD never runs on pull requests or pushes and never blocks a release.
on:
push:
branches: [release]
schedule:
- cron: "17 2 * * *"
pull_request:
paths:
- .github/workflows/freebsd.yml
- packaging/freebsd/**
- packaging/env.sh
workflow_dispatch:
concurrency:
@@ -0,0 +1,77 @@
//! #7366: a background job applies to the layer and channels it started on, whatever the user
//! selects while it runs. A job's result is applied only by `poll_jobs` or `wait_job` on the
//! session's thread, so a selection made after `start` always comes first.
use photocraft_doc::LayerId;
use photocraft_engine::Session;
use photocraft_engine::jobs::Started;
const REMOVE: &str = r#"{"points":[[12,10],[16,12]],"size":6}"#;
fn run(s: &mut Session, id: &str, p: &str) {
s.execute(id, p.parse().unwrap()).unwrap();
}
fn pixels(s: &Session, doc: usize, id: LayerId) -> Vec<f32> {
let d = &s.documents()[doc].doc;
d.layer(id).unwrap().surface().unwrap().read_region(d.bounds())
}
/// Starts a Red-only Remove on the target layer, optionally selects the text layer (what a Type
/// click does) while it is pending, then waits for it.
fn probe(select_text_while_pending: bool) {
let mut a = Session::new();
run(&mut a, "file.new", r#"{"name":"A","width":32,"height":24,"background":"transparent"}"#);
run(&mut a, "type.create", r#"{"text":"X","x":2,"y":18,"size":14}"#);
let text = a.active().unwrap().active_layer.unwrap();
run(&mut a, "layer.new.layer", r#"{"name":"Target"}"#);
let target = a.active().unwrap().active_layer.unwrap();
a.edit("fixture", |d, l| {
let q = d.layer_mut(l.unwrap()).unwrap().surface_mut().unwrap();
for y in 0..24 {
for x in 0..32 {
q.write_pixel(x, y, &[((x * 7 + y * 13) % 31) as f32 / 30., (x % 5) as f32 / 4., (y % 7) as f32 / 6., 1.]);
}
}
Ok(())
})
.unwrap();
run(&mut a, "file.new", r##"{"name":"B","width":32,"height":24,"background":"#6a219c"}"##);
a.set_active(0);
run(&mut a, "channel.target", r#"{"channel":"red"}"#);
let b = a.documents()[1].doc.clone();
let text_before = a.documents()[0].doc.layer(text).unwrap().clone();
// The inline Red-only Remove is the oracle.
let mut inline = Session::new();
inline.add_document(a.documents()[0].doc.as_ref().clone(), None);
inline.select_layer(target).unwrap();
run(&mut inline, "channel.target", r#"{"channel":"red"}"#);
run(&mut inline, "paint.remove", REMOVE);
let expected = pixels(&inline, 0, target);
let job = match a.start("paint.remove", REMOVE.parse().unwrap()).unwrap() {
Started::Job(id) => id,
v => panic!("must start a background job: {v:?}"),
};
let selected = if select_text_while_pending { text } else { target };
if select_text_while_pending {
a.select_layer(text).unwrap();
}
a.set_active(1);
a.wait_job(job).unwrap();
assert_eq!(a.documents()[1].doc, b, "B is unchanged");
let st = &a.documents()[0];
assert_eq!(st.doc.layer(text).unwrap(), &text_before, "the text layer is unchanged");
assert_eq!(st.active_layer, Some(selected), "the user's selection survives the job");
let actual = pixels(&a, 0, target);
let wrong = expected.as_chunks::<4>().0.iter().zip(actual.as_chunks::<4>().0).filter(|(e, r)| e[1..] != r[1..]).count();
assert_eq!(wrong, 0, "pixels with G/B/alpha changed outside the Red target");
assert_eq!(actual, expected);
}
#[test]
fn a_background_job_applies_to_the_layer_and_channels_it_started_on() {
probe(false);
probe(true);
}
+1
View File
@@ -31,6 +31,7 @@ mod atn_v12;
mod atn_video_frames;
mod average_smart;
mod background_and_mask_depth;
mod background_job_target;
mod background_layer_consistency;
mod brush_smoothing;
mod camera_raw_exposure_clamp;
+6 -1
View File
@@ -116,7 +116,12 @@ fn detect_locale() -> Option<String> {
if let Some(v) = env("PHOTOCRAFT_LOCALE") {
return Some(v);
}
if let Some(v) = os_locale() {
// Test processes run by cargo-nextest (`NEXTEST` set) skip the OS query: each test is its own
// process, and on Windows the query starts a `reg.exe` child every time (#15377 did the same
// for the system font scan). They then see the same locale on every machine.
if std::env::var_os("NEXTEST").is_none()
&& let Some(v) = os_locale()
{
return Some(v);
}
["LC_ALL", "LC_MESSAGES", "LANG", "LANGUAGE"].iter().find_map(|k| env(k)).map(|v| v.split(':').next().unwrap_or("").to_string())
+5 -1
View File
@@ -34,7 +34,9 @@ photocraft-codecs = { workspace = true }
photocraft-formats = { workspace = true }
# Reading embedded thumbnail resources (1036/1033) for recent files in Home screen.
craft-psd = { workspace = true }
egui = { workspace = true }
# `serde`: the dialog state the control channel and the saved memories read holds `egui::Id`s. Asked for
# here so this crate builds on its own (`cargo test -p photocraft-ui-egui`) and in the browser build.
egui = { workspace = true, features = ["serde"] }
egui_extras = { version = "0.37", default-features = false, features = ["svg"] }
eframe = { workspace = true, features = ["wgpu", "accesskit", "clipboard"] }
serde = { workspace = true }
@@ -77,6 +79,8 @@ tempfile = "3"
# The framework's test helpers, e.g. the thumbnail and fx badge rects of a Layers panel row
# (`craft::layers::testing`), and the in-memory settings files (`craft::settings::testing`).
craft = { workspace = true, features = ["screen-testing", "settings-testing"] }
# The prefs tests write a saved settings file (`toml::to_string`).
toml = { version = "1.1", default-features = false, features = ["std", "serde", "display"] }
[build-dependencies]
serde_json = { workspace = true }
-1
View File
@@ -33,7 +33,6 @@ mod magnetic_lasso_right_click;
mod paint_bucket_all_layers;
mod pattern_preview_canvas;
mod radial_blur_center;
mod remove_channel_target;
mod system_locale;
mod tone_targets;
mod ui_scale_canvas;
@@ -1,131 +0,0 @@
//! #7366: a background Remove on a Red-only target keeps G/B/alpha intact when a Type click
//! selects another layer while the job is pending.
use photocraft_doc::LayerId;
use photocraft_engine::Session;
use photocraft_engine::jobs::Started;
use photocraft_ui_egui::{PhotocraftApp, Services, control};
const REMOVE: &str = r#"{"points":[[12,10],[16,12]],"size":6}"#;
type Harness = egui_kittest::Harness<'static, Box<PhotocraftApp>>;
fn run(s: &mut Session, id: &str, p: &str) {
s.execute(id, p.parse().unwrap()).unwrap();
}
/// Context for assertion messages: who is active, whether a text edit is open, and whether the job is done.
fn state_line(app: &PhotocraftApp, job: photocraft_engine::jobs::JobId) -> String {
format!(
"active layer {:?}, text-edit session open {}, job finished {}",
app.session.active().and_then(|d| d.active_layer),
app.ui.text_edit.is_some(),
app.session.job(job).is_none()
)
}
fn pixels(s: &Session, doc: usize, id: LayerId) -> Vec<f32> {
let d = &s.documents()[doc].doc;
d.layer(id).unwrap().surface().unwrap().read_region(d.bounds())
}
#[derive(Clone, Copy)]
enum Input {
None,
ControlPointer,
}
fn probe(input: Input) {
let mut a = Session::new();
run(&mut a, "file.new", r#"{"name":"A","width":32,"height":24,"background":"transparent"}"#);
run(&mut a, "type.create", r#"{"text":"X","x":2,"y":18,"size":14}"#);
let text = a.active().unwrap().active_layer.unwrap();
run(&mut a, "layer.new.layer", r#"{"name":"Target"}"#);
let target = a.active().unwrap().active_layer.unwrap();
a.edit("fixture", |d, l| {
let q = d.layer_mut(l.unwrap()).unwrap().surface_mut().unwrap();
for y in 0..24 {
for x in 0..32 {
q.write_pixel(x, y, &[((x * 7 + y * 13) % 31) as f32 / 30., (x % 5) as f32 / 4., (y % 7) as f32 / 6., 1.]);
}
}
Ok(())
})
.unwrap();
run(&mut a, "file.new", r##"{"name":"B","width":32,"height":24,"background":"#6a219c"}"##);
a.set_active(0);
run(&mut a, "channel.target", r#"{"channel":"red"}"#);
let b = a.documents()[1].doc.clone();
let text_before = a.documents()[0].doc.layer(text).unwrap().clone();
// The inline Red-only Remove is the oracle.
let mut inline = Session::new();
inline.add_document(a.documents()[0].doc.as_ref().clone(), None);
inline.select_layer(target).unwrap();
run(&mut inline, "channel.target", r#"{"channel":"red"}"#);
run(&mut inline, "paint.remove", REMOVE);
let expected = pixels(&inline, 0, target);
// The app runs in a harness so the canvas takes the control channel's pointer input on the
// frames after the call.
let mut h = Harness::builder().with_size(egui::vec2(1100.0, 720.0)).with_max_steps(64).build_eframe(move |cc| {
PhotocraftApp::setup_context(&cc.egui_ctx, Default::default());
// The app shares the harness's context, which is where the control channel's pointer input arrives.
PhotocraftApp::with_context(cc.egui_ctx.clone(), a, Services::default())
});
h.run_steps(4);
let job = match h.state_mut().session.start("paint.remove", REMOVE.parse().unwrap()).unwrap() {
Started::Job(id) => id,
v => panic!("must start a background job: {v:?}"),
};
match input {
Input::None => {}
Input::ControlPointer => {
let ctx = h.ctx.clone();
let (req, _rx) = control::ControlRequest::new("ui.pointer", r#"{"tool":"type","events":[{"kind":"down","x":4,"y":14}]}"#.parse().unwrap());
match control::handle(h.state_mut(), &ctx, &req) {
control::Reply::Done(reply) => assert_eq!(reply["ok"], true, "the pointer request is accepted: {reply}"),
_ => panic!("ui.pointer must reply immediately"),
}
// The control channel queues input for the canvas; wait for delivery rather than
// assuming two passes suffice on every host.
let host = craft::ui::runtime::windows::WindowHost::of(&ctx);
for _ in 0..8 {
if host.injected_idle() {
break;
}
h.run_steps(1);
}
let state = state_line(h.state(), job);
assert!(host.injected_idle(), "the canvas consumed the queued pointer input; {state}");
// `injected_idle` is also true when the step was withdrawn (focus change before its
// pass) instead of delivered, so delivery is asserted separately.
assert!(!host.take_injected_withdrawn(), "the injected press was delivered, not withdrawn; {state}");
}
}
let selected = if matches!(input, Input::None) { target } else { text };
assert_eq!(h.state().session.active().unwrap().active_layer, Some(selected), "the input selects the text layer; {}", state_line(h.state(), job));
let a = h.state_mut();
a.session.set_active(1);
a.session.wait_job(job).unwrap();
assert_eq!(a.session.documents()[1].doc, b, "B is unchanged");
let st = &a.session.documents()[0];
assert_eq!(st.doc.layer(text).unwrap(), &text_before, "the text layer is unchanged");
assert_eq!(st.active_layer, Some(selected), "the user's selection survives the job");
let actual = pixels(&a.session, 0, target);
let wrong = expected.as_chunks::<4>().0.iter().zip(actual.as_chunks::<4>().0).filter(|(e, r)| e[1..] != r[1..]).count();
assert_eq!(wrong, 0, "pixels with G/B/alpha changed outside the Red target");
assert_eq!(actual, expected);
}
#[test]
fn no_input_keeps_red_restriction() {
probe(Input::None);
}
#[test]
fn control_pointer_click_keeps_red_restriction() {
probe(Input::ControlPointer);
}
+1 -1
View File
@@ -273,7 +273,7 @@ Menu wiring (`docs/parity-checklist.md`): 664 of 664 menu items live (100.0%). T
| AUTO-219-5 | Batch: subfolders, open documents, naming template, progress/cancel, error log, stop | partial | [#219](https://github.com/storytold/photocraft/issues/219) | file_cmds/batch_run.rs and batch_naming.rs: flat subfolder output and last-result-wins names measured in Photoshop 2026; live open-document source; file naming components and serials; UTF-16 LE error log; stop-on-error; CLI and Batch dialog, #4579. Desktop Esc asks Continue/Stop, retaining one plan and error log; a read-only canvas preview shows each scratch-session input without a progress bar. Inputs are not live tabs with Layers panel content, so full window parity remains open. |
| AUTO-219-6 | Plug-in ABI v2: panel kind, progress/cancel calls, read other layers, Last Filter repeats | missing | [#219](https://github.com/storytold/photocraft/issues/219) | runtime.rs:15 ABI_VERSION = 1; manifest.rs:18 Kind::Filter only |
| AUTO-219-7 | Local ONNX models behind a flag, managed in Preferences; subject select, background removal | missing | [#219](https://github.com/storytold/photocraft/issues/219) | No ONNX runtime dependency |
| AUTO-219-8 | xtask check that every panel button routes through a command id | partial | [#219](https://github.com/storytold/photocraft/issues/219) | cargo xtask panel-commands (run by xtask ci and CI) fails on a shell click handler that changes the document or session directly; 1 allowlisted function left (panels/color.rs color_field assigns the foreground/background colour instead of tools.setColors) |
| AUTO-219-8 | xtask check that every panel button routes through a command id | partial | [#219](https://github.com/storytold/photocraft/issues/219) | cargo xtask panel-commands (run by xtask ci and CI) fails on a shell click handler that changes the document or session directly; no allowlisted function left (the Color panel field dispatches tools.setColors) |
| AUTO-219-9 | Headless commands for in-canvas type editing, Liquify/Puppet strokes, transform handles | done | [#219](https://github.com/storytold/photocraft/issues/219) | type.hitTest, type.caret, type.navigate; filter.liquify strokes, edit.puppetWarp pins, type.edit, edit.transform |
| AUTO-219-10 | Agent acceptance suite grown to 30-50 workflows | partial | [#219](https://github.com/storytold/photocraft/issues/219) | automation/tests/it/agent_tasks.rs runs 10 workflows over MCP |
| AUTO-MCP-LIVE | Connect an MCP client to the running app without a terminal (no flags, ports or tokens to copy) | done | | 2026-11-12 (#5525, #11363, craft-ai-integrations#195): the ArtCraft Launcher's agents switch (the one consent; read through craft-ai-agents) starts and stops the loopback control server while the app runs (no restart) and publishes agent-connection.json; plain photocraft-cli mcp works in the open app on every call while agents are allowed (launch / headless / error while it is closed) and headless otherwise (--headless forces it); the launcher's Add buttons register every Craft app, PhotoCraft writes no client configuration. automation/tests/mcp_live.rs, ui-egui prefs_ui/agents_tests.rs, craft-automation tests/it/agents.rs |
+1 -1
View File
@@ -65,7 +65,7 @@ id = "AUTO-219-8"
target = "xtask check that every panel button routes through a command id"
status = "partial"
issue = 219
note = "cargo xtask panel-commands (run by xtask ci and CI) fails on a shell click handler that changes the document or session directly; 1 allowlisted function left (panels/color.rs color_field assigns the foreground/background colour instead of tools.setColors)"
note = "cargo xtask panel-commands (run by xtask ci and CI) fails on a shell click handler that changes the document or session directly; no allowlisted function left (the Color panel field dispatches tools.setColors)"
[[item]]
id = "AUTO-219-9"
+81 -25
View File
@@ -1,4 +1,5 @@
"""Whether a pull request's Windows legs run photocraft-gpu's tests (.github/workflows/ci.yml).
"""What a pull request's Windows legs skip (.github/workflows/ci.yml): photocraft-gpu's tests, and the
tests of packages with no platform-specific code.
The Windows runners have no GPU: wgpu renders on WARP, the Direct3D 12 software rasterizer, where
photocraft-gpu's parity tests take about half of the integration leg's test time (#15247). The Linux
@@ -14,7 +15,15 @@ legs skip them unless the pull request changes something they are built from:
the shared build inputs (workspace manifest, lockfile, Cargo and nextest config, this workflow,
this script) and any input added later.
Usage: ci-windows-gpu-tests.py BASE prints `true` (run them) or `false` (skip them).
The same rule picks the platform-neutral packages (NEUTRAL) to skip: one is skipped when neither it nor
any workspace package it depends on has a changed file, and nothing shared changed (any manifest, or
a file outside the packages that is not documentation). They have no `cfg(windows)`, `cfg(unix)` or
`cfg(target_os ...)` in their sources, so Windows adds no coverage over the Linux gate for them.
Usage:
ci-windows-gpu-tests.py BASE prints `true` (run photocraft-gpu's tests) or `false`.
ci-windows-gpu-tests.py --skip-neutral BASE prints the neutral packages to skip, space-separated
(nothing when none).
"""
import json
@@ -28,6 +37,38 @@ GPU = 'photocraft-gpu'
UNRELATED_PREFIXES = ('docs/', 'log/', 'contributors/', 'scorecard/')
UNRELATED_SUFFIXES = ('.md',)
# Workspace packages whose sources and tests have no platform-specific code (checked with
# `grep -rE 'cfg\(.*(windows|unix|target_os|target_family)'` over each package; the only `cfg` in their
# manifests is `not(target_arch = "wasm32")`). Add a package only after the same check.
NEUTRAL = (
'photocraft-algo',
'photocraft-color',
'photocraft-compose',
'photocraft-doc',
'photocraft-geom',
'photocraft-ops',
'photocraft-paint',
'photocraft-raw',
'photocraft-vector',
)
def workspace_deps(packages):
"""Each workspace package's workspace dependencies (every kind, from `cargo metadata`)."""
names = {p['name'] for p in packages}
return {p['name']: {d['name'] for d in p['dependencies'] if d['name'] in names} for p in packages}
def inputs_of(name, deps):
"""`name` and every workspace package it depends on, directly or not."""
seen, todo = {name}, [name]
while todo:
for d in deps[todo.pop()]:
if d not in seen:
seen.add(d)
todo.append(d)
return seen
def gpu_inputs(packages):
"""The workspace packages photocraft-gpu is built from (itself included).
@@ -35,17 +76,9 @@ def gpu_inputs(packages):
`packages` is `cargo metadata`'s `packages` list. Raises ValueError when photocraft-gpu is not in
the workspace, so a rename cannot silently turn the selection off.
"""
names = {p['name'] for p in packages}
if GPU not in names:
if GPU not in {p['name'] for p in packages}:
raise ValueError(f'{GPU} is not a workspace package')
deps = {p['name']: {d['name'] for d in p['dependencies'] if d['name'] in names} for p in packages}
seen, todo = {GPU}, [GPU]
while todo:
for d in deps[todo.pop()]:
if d not in seen:
seen.add(d)
todo.append(d)
return seen
return inputs_of(GPU, workspace_deps(packages))
def package_dirs(packages, root):
@@ -60,24 +93,41 @@ def package_dirs(packages, root):
return out
def needs_gpu_tests(changed, packages, root):
"""Whether the changed files (paths relative to the workspace root) can affect the GPU tests."""
inputs = gpu_inputs(packages)
def changed_packages(changed, packages, root):
"""The workspace packages that own a changed file (paths relative to the workspace root), or None
when a change can affect every package: any package manifest, or a file outside the packages that
is not documentation (module docstring)."""
# Longest directory first, so a nested package wins over the one around it.
dirs = sorted(((d, n) for n, d in package_dirs(packages, root).items() if d), key=lambda x: -len(x[0]))
owners = set()
for path in changed:
# Feature unification: any member manifest can change the GPU build (module docstring).
# Feature unification: any member manifest can change the build of every other package.
if path == 'Cargo.toml' or path.endswith('/Cargo.toml'):
return True
return None
owner = next((n for d, n in dirs if path.startswith(d + '/')), None)
if owner is not None:
if owner in inputs:
return True
owners.add(owner)
continue
if path.startswith(UNRELATED_PREFIXES) or path.endswith(UNRELATED_SUFFIXES):
continue
return True
return False
return None
return owners
def needs_gpu_tests(changed, packages, root):
"""Whether the changed files (paths relative to the workspace root) can affect the GPU tests."""
inputs = gpu_inputs(packages)
owners = changed_packages(changed, packages, root)
return owners is None or bool(owners & inputs)
def neutral_to_skip(changed, packages, root):
"""The NEUTRAL packages whose tests the Windows legs skip for these changed files, sorted."""
owners = changed_packages(changed, packages, root)
if owners is None:
return []
deps = workspace_deps(packages)
return sorted(n for n in NEUTRAL if n in deps and not (inputs_of(n, deps) & owners))
def changed_files(base, cwd=None):
@@ -89,13 +139,19 @@ def changed_files(base, cwd=None):
def main(argv):
if len(argv) != 2:
args = argv[1:]
skip_neutral = args[:1] == ['--skip-neutral']
if skip_neutral:
args = args[1:]
if len(args) != 1:
print(__doc__, file=sys.stderr)
return 2
base = argv[1]
changed = changed_files(base)
changed = changed_files(args[0])
meta = json.loads(subprocess.run(['cargo', 'metadata', '--no-deps', '--format-version', '1'], check=True, capture_output=True, text=True).stdout)
print('true' if needs_gpu_tests(changed, meta['packages'], meta['workspace_root']) else 'false')
if skip_neutral:
print(' '.join(neutral_to_skip(changed, meta['packages'], meta['workspace_root'])))
else:
print('true' if needs_gpu_tests(changed, meta['packages'], meta['workspace_root']) else 'false')
return 0
+29
View File
@@ -103,5 +103,34 @@ class Selection(unittest.TestCase):
needs('crates/ui-egui/src/canvas.rs', packages=[p for p in PACKAGES if p['name'] != 'photocraft-gpu'])
class NeutralSelection(unittest.TestCase):
PACKAGES = [
pkg('photocraft-geom', 'crates/geom'),
pkg('photocraft-algo', 'crates/algo', ['photocraft-geom']),
pkg('photocraft-compose', 'crates/compose', ['photocraft-geom']),
pkg('photocraft-engine', 'crates/engine', ['photocraft-compose']),
pkg('photocraft-ui-egui', 'crates/ui-egui', ['photocraft-engine']),
]
def skipped(self, *changed):
return select.neutral_to_skip(list(changed), self.PACKAGES, ROOT)
def test_a_change_elsewhere_skips_every_neutral_package(self):
self.assertEqual(self.skipped('crates/ui-egui/src/lib.rs'), ['photocraft-algo', 'photocraft-compose', 'photocraft-geom'])
def test_a_changed_package_and_its_dependents_are_not_skipped(self):
self.assertEqual(self.skipped('crates/compose/src/lib.rs'), ['photocraft-algo', 'photocraft-geom'])
# geom is a dependency of algo and compose, so its change keeps all three.
self.assertEqual(self.skipped('crates/geom/src/lib.rs'), [])
def test_shared_inputs_skip_nothing(self):
for path in ['crates/ui-egui/Cargo.toml', 'Cargo.lock', '.github/workflows/ci.yml']:
with self.subTest(path=path):
self.assertEqual(self.skipped('crates/ui-egui/src/lib.rs', path), [])
def test_documentation_only_skips_all_of_them(self):
self.assertEqual(self.skipped('docs/a.md'), ['photocraft-algo', 'photocraft-compose', 'photocraft-geom'])
if __name__ == '__main__':
unittest.main()