Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 这些现有夹具共享真实设置文件;进程内 Mutex 在 nextest 多进程模型下不再互斥。
# 只还原该夹具组的串行合同,其余测试继续使用 runner 的并行度。
[test-groups]
theme-studio = { max-threads = 1 }

[[profile.default.overrides]]
filter = 'test(gpui_shell::settings_pane::theme_studio_tests::)'
test-group = 'theme-studio'
47 changes: 37 additions & 10 deletions .github/actions/rust-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ inputs:
extra-key:
description: Additional inputs for native build tools stored with this target
default: ""
revision:
description: Snapshot suffix; empty uses the source SHA, dependency snapshots use a fixed generation
default: ""
save-if:
description: Allow publishing caches; PR consumers can restore without competing with the default branch
default: "true"

outputs:
cache-key:
Expand All @@ -25,6 +31,9 @@ outputs:
cache-matched-key:
description: The compiled target cache key actually restored by actions/cache
value: ${{ steps.target.outputs.cache-matched-key }}
save-enabled:
description: Whether the caller permits publishing cache snapshots
value: ${{ inputs.save-if }}
legacy-fallback-invoked:
description: Whether the optional legacy cache fallback action was invoked
value: ${{ steps.cache-summary.outputs.legacy-fallback-invoked }}
Expand All @@ -42,7 +51,7 @@ runs:
CACHE_OS: ${{ runner.os }}
CACHE_ARCH: ${{ runner.arch }}
CACHE_WORKLOAD: ${{ inputs.key }}
CACHE_REVISION: ${{ github.sha }}
CACHE_REVISION: ${{ inputs.revision || github.sha }}
CACHE_MANIFESTS: ${{ hashFiles('Cargo.lock', '**/Cargo.toml', 'rust-toolchain.toml', '**/.cargo/config.toml', '.github/ci-profile.toml') }}${{ inputs.extra-key }}
run: |
python - <<'PY'
Expand All @@ -66,8 +75,8 @@ runs:
("CACHE_OS", "CACHE_ARCH", "CACHE_WORKLOAD"))
prefix += "-" + fingerprint + "-"
with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as output:
# Immutable caches need a new entry after a source change, including
# when the prior revision failed before it compiled every profile.
# 发布任务按源码刷新;原生 CI 可固定代次,只在依赖或工具链变化后新建快照。
# 缓存命中只复用编译输入,调用方仍须执行当前提交的全部检查。
output.write("key=" + prefix + os.environ["CACHE_MANIFESTS"] + "-" + os.environ["CACHE_REVISION"] + "\n")
output.write("manifest-key=" + prefix + os.environ["CACHE_MANIFESTS"] + "\n")
output.write("restore-key=" + prefix + "\n")
Expand All @@ -92,8 +101,11 @@ runs:
${{ steps.identity.outputs.cargo-home }}/registry/cache
${{ steps.identity.outputs.cargo-home }}/git/db
${{ steps.identity.outputs.cargo-home }}/git/checkouts
key: cargo-downloads-v2-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Cargo.lock', '**/Cargo.toml') }}
restore-keys: cargo-downloads-v2-${{ runner.os }}-${{ runner.arch }}-
# 同一 OS 的两种架构共享源码,编译产物仍按架构隔离。
key: cargo-downloads-v3-${{ runner.os }}-${{ hashFiles('Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
cargo-downloads-v3-${{ runner.os }}-
cargo-downloads-v2-${{ runner.os }}-${{ runner.arch }}-
- name: Restore compiled targets
id: target
uses: actions/cache/restore@v4
Expand Down Expand Up @@ -127,6 +139,7 @@ runs:
CACHE_WORKLOAD: ${{ inputs.key }}
RUNNER_OS_VALUE: ${{ runner.os }}
RUNNER_ARCH_VALUE: ${{ runner.arch }}
CACHE_SAVE_ENABLED: ${{ inputs.save-if }}
run: |
set -euo pipefail

Expand All @@ -148,6 +161,7 @@ runs:
echo "- Target cache exact hit: \`$target_cache_hit\`"
echo "- Target cache matched key: \`$target_cache_matched_key\`"
echo "- Save key: \`$save_key\`"
echo "- Cache publishing enabled: \`$CACHE_SAVE_ENABLED\`"
echo "- Legacy fallback configured: \`$legacy_configured\`"
echo "- Legacy fallback invoked: \`$legacy_invoked\`"
echo "- Legacy fallback outcome: \`$legacy_outcome\`"
Expand All @@ -159,14 +173,27 @@ runs:
echo "legacy-fallback-outcome=$legacy_outcome"
} >> "$GITHUB_OUTPUT"
- name: Populate complete downloads before sharing the cache
if: steps.downloads.outputs.cache-hit != 'true'
if: inputs.save-if == 'true' && steps.downloads.outputs.cache-hit != 'true'
shell: bash
env:
CACHE_OS: ${{ runner.os }}
run: |
host_target="$(rustc -vV | sed -n 's/^host: //p')"
test -n "$host_target"
cargo fetch --locked --target "$host_target"
# 缓存由先完成的架构写入,必须预取两者的源码,不能把半份下载标成精确命中。
case "$CACHE_OS" in
Windows)
cargo fetch --locked --target x86_64-pc-windows-msvc --target aarch64-pc-windows-msvc
;;
macOS)
cargo fetch --locked --target x86_64-apple-darwin --target aarch64-apple-darwin
;;
*)
host_target="$(rustc -vV | sed -n 's/^host: //p')"
test -n "$host_target"
cargo fetch --locked --target "$host_target"
;;
esac
- name: Save complete shared Cargo downloads
if: steps.downloads.outputs.cache-hit != 'true'
if: inputs.save-if == 'true' && steps.downloads.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
Expand Down
28 changes: 17 additions & 11 deletions .github/workflows/linux-lua.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ on:
push:
branches: [main]
# Include docs, catalogs, assets and workflow edits: every PR gets test results.
# ready_for_review starts the scarce-runner jobs that draft pushes skip.
# 草稿已跑完整矩阵,转为 Ready 而没有新提交时不重复申请七个原生 runner。
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
types: [opened, synchronize, reopened]
merge_group:

concurrency:
group: native-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
# main 的过期验证也应释放 runner;手动诊断和发布调用不互相取消。
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}

permissions:
contents: read
Expand Down Expand Up @@ -75,9 +76,7 @@ jobs:
--output "$GITHUB_OUTPUT"

# The required lint job validates the matrix before heavy runners are
# requested. Draft PRs omit deferred platforms entirely; ready PRs and
# release callers require the full matrix. Deferred checks remain missing
# on drafts instead of being reported as successful tests.
# requested. Every PR, including a draft, requires the complete matrix.
native-tests:
needs: lint
if: ${{ inputs.windows_diagnostics_run == '' }}
Expand Down Expand Up @@ -131,6 +130,10 @@ jobs:
if ($LASTEXITCODE -ne 0 -or $compiler -notcontains 'host: aarch64-pc-windows-msvc') {
throw 'The Windows ARM job must compile and run ARM64 tests.'
}
- name: Install the pinned native test runner
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest@0.9.146
- uses: ./.github/actions/rust-cache
id: rust-cache
with:
Expand All @@ -139,7 +142,9 @@ jobs:
target: |
target/ci
${{ runner.os != 'macOS' && 'target/release' || '' }}
legacy-key: ${{ runner.os == 'Windows' && 'windows' || runner.os == 'Linux' && 'linux' || 'macos' }}
# PR merge-ref 缓存不与其他 PR 共享;只由默认分支维护可复用的依赖快照。
revision: dependencies-v1
save-if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
- name: Prepare pinned Windows console runtime
if: ${{ runner.os == 'Windows' }}
shell: pwsh
Expand All @@ -148,7 +153,7 @@ jobs:
./scripts/prepare-windows-runtime.ps1 -Destination assets/windows/conhost -Architecture $architecture
./scripts/tests/windows-runtime.tests.ps1 -Architecture $architecture
- name: Test complete workspace and native harness
run: python scripts/ci_native_tests.py
run: python scripts/ci_native_tests.py --runner nextest
- name: Check source architecture
if: ${{ !cancelled() && runner.os == 'Linux' }}
run: python scripts/check_architecture.py
Expand All @@ -159,7 +164,7 @@ jobs:
if: ${{ !cancelled() && runner.os != 'macOS' }}
run: cargo check --locked --workspace --release
- name: Save compiled workload
if: ${{ always() && steps.rust-cache.outcome == 'success' && steps.rust-cache.outputs.cache-hit != 'true' }}
if: ${{ success() && steps.rust-cache.outputs.save-enabled == 'true' && steps.rust-cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v4
with:
path: |
Expand Down Expand Up @@ -214,11 +219,12 @@ jobs:
with:
key: native-release-check
target: target/release
legacy-key: macos
revision: dependencies-v1
save-if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
- name: Check the release workspace
run: cargo check --locked --workspace --release --timings
- name: Save compiled workload
if: ${{ always() && steps.rust-cache.outcome == 'success' && steps.rust-cache.outputs.cache-hit != 'true' }}
if: ${{ success() && steps.rust-cache.outputs.save-enabled == 'true' && steps.rust-cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v4
with:
path: target/release
Expand Down
21 changes: 13 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,18 @@ compile check into a claim that UI tests or a packaged application were run.
`Tests (<os>)` jobs and both `Release workspace (<os>)` jobs are required checks
on `main`, together with Code Owner approval; see the
[activation checklist](docs/project-constraints.md#server-side-activation).
Open pull requests as drafts while iterating: drafts run Linux, Windows x64 and
Apple Silicon tests plus the Apple Silicon release-profile compile check. The
required lint job validates the event and selects the matrix before requesting
platform runners. Drafts omit Intel Mac and Windows ARM64 jobs entirely, so their
required contexts may be missing until the PR is marked ready. Ready PRs run the
full matrix; every required check must succeed before merging. The ready event
still reruns core validation rather than reusing an earlier check conclusion.
Draft and ready pull requests both run all five native platforms and both macOS
release-profile compile checks. The required lint job validates the event and
selects the matrix before requesting platform runners. Every required check must
succeed before merging. Marking a draft ready without changing its commits does
not repeat the matrix; source updates and reopen events run it again. Native CI
uses pinned `cargo-nextest` for unit and
integration tests, followed by `cargo test --doc` with the same workspace features;
the production feature graph and release workspace are still checked separately.
PRs restore Cargo caches without uploading merge-ref snapshots. The default branch
publishes reusable snapshots per dependency/toolchain configuration; a cache hit
never skips current-commit tests. Downloads are shared between architectures of
the same OS, while compiled targets remain isolated by architecture and SDK.
Local hooks are convenient, but bypassable; they are not the enforcement boundary.
Submitting a workflow or `CODEOWNERS` file does not configure server-side rules.

Expand All @@ -150,7 +155,7 @@ feature work; there is no routine `--skip-architecture` option.

- 先读架构图、工程合同和决策记录;按职责拆分,不按行号切片。
- 一个 PR 只做一件事;改动超过 1500 行源码(不计文档、lockfile、资源)`pr-size` 会失败,请拆分。
- Draft PR 先运行必需的格式检查和矩阵规划,再创建 Linux / Windows x64 / Apple Silicon 测试及 Apple Silicon release 编译检查;不创建 Intel Mac / Windows ARM64 任务。Ready 后运行完整矩阵,十项必需检查全绿才能合并。
- Draft 和 Ready PR 都先运行必需的格式检查和矩阵规划,再执行五平台原生测试及两项 macOS release 编译检查;十项必需检查全绿才能合并。提速使用共享缓存与并行测试,不省略平台或 doctest。
- 2000 行是现有仓库的防灾上限,800 行只提示审查,不是“大厂标准”。
- 普通功能 PR 不得增加存量债务;有问题的规则可以修订,但要有反例、测试和维护者审批。
- 新增核心抽象、依赖方向、持久化或线程模型改变要先说明设计,不强迫每个小修复写 ADR。
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Windows Acrylic controller ownership and compatibility

## Status

Implemented on the GPUI Windows path; local native acceptance on Windows 11
build 26200.9457, x64 Windows App Runtime 1.8 version 8000.946.1701.0.

## Context

AccentPolicy Acrylic leaves a measurable pattern near screen edges. Dark edge
overlays hide that pattern by changing the visual design. DesktopAcrylicController
reduces it, but its default target policy falls back to opaque gray on deactivation.
Pebrel must retain its existing pixel-alpha opacity model and fast opacity slider.

## Evidence

- A local 2560x1600 / 150% DPI comparison used colored bands and an 8 px checker
behind floating, screen-edge-aligned and maximized GPUI windows. Configuration
applied before SetTarget alone still went gray. Applying it after SetTarget,
followed by zero tint/luminosity opacity, preserved the blurred background.
- The production build's clean background ROI matched that successful prototype
pixel-for-pixel, including active/inactive/reactivated states. It is slightly
brighter than Accent, not a promise of identical pixels across implementations.
- The original 16 valid alternating prototype measurements isolated the target
PID/window-thread CPU and PID GPU counters. Window-thread cycles medians rose
about 5–10%, working set about 3 MiB; CPU time was noisy. Shared DWM cost cannot
be attributed reliably to this HWND. These are local prototype observations,
not a product performance guarantee.
- GPUI's pinned Windows platform runs its quit callback after GetMessage exits;
App shutdown borrows App and its async wait does not pump Windows messages.
- [SetTarget requirements](https://learn.microsoft.com/en-us/windows/windows-app-sdk/api/winrt/microsoft.ui.composition.systembackdrops.desktopacryliccontroller.settarget?view=windows-app-sdk-1.8)
require a DispatcherQueue and host backdrop opt-in. The
[native dynamic dependency API](https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/framework-packages/use-the-dynamic-dependency-api)
supports an installed Windows App SDK framework on Windows 11 22H2+.

## Decision

- [acrylic.rs](../../../../nebula_app/src/platform/acrylic.rs) owns controller/target
pairs by GPUI WindowId on the UI thread. One optional compositor/queue is shared
across material changes; there is no worker, frame callback or focus polling.
- Clear Accent, blur-behind and system backdrop before attaching the lower
DesktopWindowTarget. GPUI keeps its upper target. Configuration sets input
active after attachment; tint and luminosity opacity are zero. Window pixel
alpha continues to supply the user's opacity and theme color.
- Close per-window resources before changing material or destroying the HWND.
The synchronous app-quit callback closes remaining targets. A guard around
Application::run drains the owned queue only after run returns, outside the
App borrow. Its own RoInitialize reference survives GPUI's OleUninitialize.
An existing external queue is borrowed and never shut down here.
- Keep runtime activation valid until owned resources are released. Queue drain
failure retains the context until process exit instead of invalidating pending
callbacks. The drain has a two-second deadline; it is not on the render path.
- Resolve native package-graph APIs from the already loaded OS module. Require
build 22621+, the 1.8 framework family and minimum tested 8000.946.1701.0. Select
a matching installed architecture/version; never install or search for DLLs.
Missing runtime, unsupported API or failed attachment uses existing Accent.
- Use a private, narrow WinAppSDK 1.8 ABI plus existing Windows crate projections.
No bootstrap DLL, new NuGet build step or bundled runtime enters the installer.
SDK activation factories are local rather than process-cached interface pointers.
- Keep the existing per-mode/per-window application gate. Failed GPUI updates
are not cached as successful; opacity changes do not recreate native resources.

## Rejected alternatives

- Edge masks, larger opaque borders and CPU/capture blur change the visual design
or add recurring work.
- DWMSBT_TRANSIENTWINDOW/default controller policy does not preserve unfocused
transparency. Reapplying focus policy before SetTarget does not fix that order.
- Bundling the complete runtime exceeds the existing installer budget. Bootstrap
alone still requires runtime deployment. An opportunistic installed-runtime
path preserves startup compatibility without introducing an installer action.
- A new composition thread complicates HWND teardown and adds a thread lifetime.
- Pumping a shutdown queue inside on_app_quit can reenter an already borrowed App.

## Consequences

Machines without the supported runtime retain the old edge behavior. Windows 10,
other GPUs, mixed-DPI monitors, accessibility and system transparency-policy
changes need their own native acceptance; this local run does not certify them.
The selected minimum may be widened only with evidence for that runtime version.

## Validation

- `cargo build -p nebula --locked`
- `cargo test -p nebula --bin pebrel platform::acrylic:: -- --include-ignored --test-threads=1`
exercises missing-package failure, invalid HWND rollback, independent targets,
repeated close/reattach, full-size roots and actual DispatcherQueue shutdown.
- `cargo test -p nebula --bin pebrel native_acrylic_gpui_material_switches_and_window_lifecycle -- --ignored --test-threads=1`
opens real GPUI windows, switches all five material modes, creates a second
window under an unchanged mode, verifies opacity refreshes do not reattach,
closes one window and quits with the other still alive.
- Production captures cover floating/left/right/maximized and focus transitions;
isolated processes exited normally and removed their runtime endpoints.
- Architecture gate uses the upstream-synchronized base commit.

## Supersedes

None. Accent remains the compatibility implementation.

## Revisit when

GPUI owns a system-backdrop lifecycle, the supported runtime changes, or portable
runtime distribution can meet the existing size and platform contracts.
Loading
Loading