From 0838346907232e2e2905cc3f42ef968696406410 Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Sun, 22 Nov 2026 02:56:15 +1100 Subject: [PATCH 1/3] usb: schedule the T8140 proxy carrier with a delay it accepts usb_init() on the T8140 schedules the deferred CDC carrier transition for a stage that is about to run the proxy, with a delay of 0. usb_cdc_state_schedule() takes 1 to 15 s and refuses anything else, so the schedule always failed: the proxy got no CDC carrier, and usb_cdc_schedule() never armed the CDC watchdog that resets a proxy no host opens. A stage with no watchdog of its own (any Stage 2, or a Stage 1 without the boot watchdog) then stays in the proxy until someone holds the power button. Schedule it with the shortest delay the state machine accepts, as the Stage 1 window already does. Signed-off-by: Ryan Murray --- src/usb.c | 8 +++- tests/python/test_t8140_proxy_transport.py | 49 ++++++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 tests/python/test_t8140_proxy_transport.py diff --git a/src/usb.c b/src/usb.c index 27f2a0b58..833d24906 100644 --- a/src/usb.c +++ b/src/usb.c @@ -551,9 +551,13 @@ void usb_init(void) return; /* This PHY requires a deferred carrier transition; normal boots never - * enter this fallback path before handing over to the OS. */ + * enter this fallback path before handing over to the OS. The schedule + * takes 1 to 15 s (usb_cdc_state_schedule()); a shorter delay is refused, + * which left a host-less proxy here with no carrier and without the CDC + * watchdog (usb_cdc_arm_watchdog()) that resets a proxy nobody opens. */ if (chip_id == T8140) { - if (!usb_cdc_ready() && !usb_cdc_owns_carrier() && usb_cdc_schedule(0, 0, BIT(1) | BIT(2))) + if (!usb_cdc_ready() && !usb_cdc_owns_carrier() && + usb_cdc_schedule(1000, 0, BIT(1) | BIT(2))) printf("usb: unable to schedule proxy transport\n"); return; } diff --git a/tests/python/test_t8140_proxy_transport.py b/tests/python/test_t8140_proxy_transport.py new file mode 100644 index 000000000..1a09841d1 --- /dev/null +++ b/tests/python/test_t8140_proxy_transport.py @@ -0,0 +1,49 @@ +# SPDX-License-Identifier: GPL-2.0-only +"""usb_init() on a SoC whose USB PHY needs the deferred CDC carrier transition (the T8140 branch) +schedules that transition for a stage that is about to run the proxy. usb_cdc_schedule() arms the +CDC watchdog only when the schedule is accepted, and usb_cdc_state_schedule() accepts 1 to 15 s: +a refused schedule leaves the proxy with no carrier and no watchdog, so a Mac with no host stays +there until someone holds the power button. Run the real state machine on the arguments usb.c +passes.""" + +import ctypes +import re +from pathlib import Path + +from test_cdc_state import State, state_lib + +ROOT = Path(__file__).resolve().parents[2] + + +def _usb_init_schedule_args(): + usb = (ROOT / "src/usb.c").read_text() + body = usb[usb.index("void usb_init(void)"):] + body = body[:body.index("\n}\n")] + branch = body[body.index("if (chip_id == T8140) {"):] + m = re.search(r"usb_cdc_schedule\(\s*(\d+)\s*,\s*(\d+)\s*,\s*BIT\(1\)\s*\|\s*BIT\(2\)\s*\)", branch) + assert m, "usb_init() no longer schedules the CDC transition the way this test reads it" + return int(m.group(1)), int(m.group(2)), (1 << 1) | (1 << 2) + + +def test_usb_init_schedule_is_accepted(tmp_path): + lib = state_lib(tmp_path) + delay, reserved, flags = _usb_init_schedule_args() + state = State() + assert lib.usb_cdc_state_schedule(ctypes.byref(state), delay, reserved, flags, 10) == 0 + # It runs once its deadline has passed, as the Stage 1 window's schedule does. + assert not lib.usb_cdc_state_due(ctypes.byref(state), 10 + delay - 1) + assert lib.usb_cdc_state_due(ctypes.byref(state), 10 + delay) + + +def test_control_delay_zero_is_refused(tmp_path): + """The call as it was: no transition and, in usb_cdc_schedule(), no watchdog.""" + lib = state_lib(tmp_path) + state = State() + assert lib.usb_cdc_state_schedule(ctypes.byref(state), 0, 0, 6, 10) == -1 + + +def test_watchdog_follows_an_accepted_schedule_only(): + cdc = (ROOT / "src/usb_cdc.c").read_text() + sched = cdc[cdc.index("int usb_cdc_schedule("):] + sched = sched[:sched.index("\n}\n")] + assert re.search(r"if \(!ret && usb_cdc_arm_watchdog\(\)\)", sched) From c9f0977de46b8b7845e5f8487df54fdc689d8fdd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 22 Nov 2026 11:39:55 +0000 Subject: [PATCH 2/3] gfya Aurora agent policy: remove assistant instruction files that are not copies of .github/aurora/AGENTS.md on main, and keep the copies on policy branches identical to it. --- .github/copilot-instructions.md | 28 ---------------------------- AGENTS.md | 28 ---------------------------- CLAUDE.md | 28 ---------------------------- GEMINI.md | 28 ---------------------------- 4 files changed, 112 deletions(-) delete mode 100644 .github/copilot-instructions.md delete mode 100644 AGENTS.md delete mode 100644 CLAUDE.md delete mode 100644 GEMINI.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md deleted file mode 100644 index 95c6d4574..000000000 --- a/.github/copilot-instructions.md +++ /dev/null @@ -1,28 +0,0 @@ -# Aurora Silicon assistant policy - -This is Aurora Silicon's own policy for AI coding assistants working in -this repository. It is the only assistant instruction file this tree -carries. Upstream projects' instruction files are never carried here. - -AGENTS.md, CLAUDE.md, GEMINI.md and .github/copilot-instructions.md are -copies of .github/aurora/AGENTS.md. The aurora-agent-policy workflow -puts them back if anything else replaces them, including an upstream -merge. To change the policy, edit .github/aurora/AGENTS.md. - -## Rules - -- Only public code goes in. Never copy code from proprietary sources. -- Changes are tested on the hardware they affect before they are merged. - -## Testing and collaboration - -- Use the Context Mode plugin whenever it can reduce low-signal output. -- Fan independent work out to isolated agents and preserve unrelated worktrees. -- Never write unit tests after you write code. -- Highly prefer E2E tests as the sole testing mechanism. Use them to verify - complex features work. At the end of E2E tests, produce a verifiable and - repeatable artifact. -- If you must test a system in isolation, first write down all the ways it - could fail, then write the code. -- Delete low-signal unit tests that would not catch a real bug missed by E2E - tests. Preserve tests that provide distinct failure coverage. diff --git a/AGENTS.md b/AGENTS.md deleted file mode 100644 index 95c6d4574..000000000 --- a/AGENTS.md +++ /dev/null @@ -1,28 +0,0 @@ -# Aurora Silicon assistant policy - -This is Aurora Silicon's own policy for AI coding assistants working in -this repository. It is the only assistant instruction file this tree -carries. Upstream projects' instruction files are never carried here. - -AGENTS.md, CLAUDE.md, GEMINI.md and .github/copilot-instructions.md are -copies of .github/aurora/AGENTS.md. The aurora-agent-policy workflow -puts them back if anything else replaces them, including an upstream -merge. To change the policy, edit .github/aurora/AGENTS.md. - -## Rules - -- Only public code goes in. Never copy code from proprietary sources. -- Changes are tested on the hardware they affect before they are merged. - -## Testing and collaboration - -- Use the Context Mode plugin whenever it can reduce low-signal output. -- Fan independent work out to isolated agents and preserve unrelated worktrees. -- Never write unit tests after you write code. -- Highly prefer E2E tests as the sole testing mechanism. Use them to verify - complex features work. At the end of E2E tests, produce a verifiable and - repeatable artifact. -- If you must test a system in isolation, first write down all the ways it - could fail, then write the code. -- Delete low-signal unit tests that would not catch a real bug missed by E2E - tests. Preserve tests that provide distinct failure coverage. diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index 95c6d4574..000000000 --- a/CLAUDE.md +++ /dev/null @@ -1,28 +0,0 @@ -# Aurora Silicon assistant policy - -This is Aurora Silicon's own policy for AI coding assistants working in -this repository. It is the only assistant instruction file this tree -carries. Upstream projects' instruction files are never carried here. - -AGENTS.md, CLAUDE.md, GEMINI.md and .github/copilot-instructions.md are -copies of .github/aurora/AGENTS.md. The aurora-agent-policy workflow -puts them back if anything else replaces them, including an upstream -merge. To change the policy, edit .github/aurora/AGENTS.md. - -## Rules - -- Only public code goes in. Never copy code from proprietary sources. -- Changes are tested on the hardware they affect before they are merged. - -## Testing and collaboration - -- Use the Context Mode plugin whenever it can reduce low-signal output. -- Fan independent work out to isolated agents and preserve unrelated worktrees. -- Never write unit tests after you write code. -- Highly prefer E2E tests as the sole testing mechanism. Use them to verify - complex features work. At the end of E2E tests, produce a verifiable and - repeatable artifact. -- If you must test a system in isolation, first write down all the ways it - could fail, then write the code. -- Delete low-signal unit tests that would not catch a real bug missed by E2E - tests. Preserve tests that provide distinct failure coverage. diff --git a/GEMINI.md b/GEMINI.md deleted file mode 100644 index 95c6d4574..000000000 --- a/GEMINI.md +++ /dev/null @@ -1,28 +0,0 @@ -# Aurora Silicon assistant policy - -This is Aurora Silicon's own policy for AI coding assistants working in -this repository. It is the only assistant instruction file this tree -carries. Upstream projects' instruction files are never carried here. - -AGENTS.md, CLAUDE.md, GEMINI.md and .github/copilot-instructions.md are -copies of .github/aurora/AGENTS.md. The aurora-agent-policy workflow -puts them back if anything else replaces them, including an upstream -merge. To change the policy, edit .github/aurora/AGENTS.md. - -## Rules - -- Only public code goes in. Never copy code from proprietary sources. -- Changes are tested on the hardware they affect before they are merged. - -## Testing and collaboration - -- Use the Context Mode plugin whenever it can reduce low-signal output. -- Fan independent work out to isolated agents and preserve unrelated worktrees. -- Never write unit tests after you write code. -- Highly prefer E2E tests as the sole testing mechanism. Use them to verify - complex features work. At the end of E2E tests, produce a verifiable and - repeatable artifact. -- If you must test a system in isolation, first write down all the ways it - could fail, then write the code. -- Delete low-signal unit tests that would not catch a real bug missed by E2E - tests. Preserve tests that provide distinct failure coverage. From 7e430174cd3381e5efdbdcc44dc2a5f2051ba5c4 Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Mon, 23 Nov 2026 02:12:36 +1100 Subject: [PATCH 3/3] Restore the assistant policy copies from the default branch An automated policy commit deleted AGENTS.md, CLAUDE.md, GEMINI.md and .github/copilot-instructions.md on this branch after the policy file changed on the default branch. Restore them as copies of its .github/aurora/AGENTS.md so the branch merges cleanly again. Signed-off-by: Ryan Murray --- .github/copilot-instructions.md | 73 +++++++++++++++++++++++++++++++++ AGENTS.md | 73 +++++++++++++++++++++++++++++++++ CLAUDE.md | 73 +++++++++++++++++++++++++++++++++ GEMINI.md | 73 +++++++++++++++++++++++++++++++++ 4 files changed, 292 insertions(+) create mode 100644 .github/copilot-instructions.md create mode 100644 AGENTS.md create mode 100644 CLAUDE.md create mode 100644 GEMINI.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 000000000..f3c1f9a44 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,73 @@ +# Aurora Silicon assistant policy + +This is Aurora Silicon's own policy for AI coding assistants working in +this repository. It is the only assistant instruction file this tree +carries. Upstream projects' instruction files are never carried here. + +AGENTS.md, CLAUDE.md, GEMINI.md and .github/copilot-instructions.md are +copies of .github/aurora/AGENTS.md. The aurora-agent-policy workflow +puts them back if anything else replaces them, including an upstream +merge. To change the policy, edit .github/aurora/AGENTS.md. + +## Rules + +- Only public code goes in. Never copy code from proprietary sources. +- Changes are tested on the hardware they affect before they are merged. + +## Pre-PR checklist + +Synced from [aurora-silicon/agent-guidelines](https://github.com/aurora-silicon/agent-guidelines/blob/8c0f9c227cd7/pre-pr-checklist.md) +at 8c0f9c227cd7. Change it there, then sync the copy here; do not edit this section +on its own. These are the checks Aurora's review agents apply. + +Each item is a hard rule unless it says "default". If your change fails one, fix the change, or say in the PR why it can't be done yet and keep the PR a draft. + +### 1. No model gating: works on every Mac that has the hardware (hard) + +- **No chip, SoC, board or firmware-version gates** unless truly unavoidable. Decide from what the machine reports: ADT/DT properties of the block, its compatible, capability or feature bits, probed registers, firmware capability fields, ALSA control ranges. Never `if chip == …`, `if board == …`, `if fw == 27.2`, or a per-chip table where a property can carry the value. +- If a gate really is unavoidable, the commit message says why, and the gate uses the narrowest hardware property. +- Prove the change on every Mac you have that contains the block, not only the one you wrote it for. Ask for test runs on the ones you don't have. +- **Chicken and egg:** if the property must first come from the boot loader or DT, land that side first. The consumer reads it with today's behaviour as the fallback when it is absent, and the fallback is removed after a release has carried the property. + +### 2. Production-ready, no hacks (hard) + +- Works on the **default kernel command line**: no new cmdline or module parameters, environment variables or manual steps needed for a feature to work. +- No sleeps or retries over a race, no magic delay or depth ("the value that worked"), no disabled checks, no lab-only code paths. +- Development boots (one-shot test boots) may use extra parameters. Remove them and re-prove on the default command line before the PR. +- One kernel tree and one command line for every Mac. Only the devicetrees differ. + +### 3. Safety (hard) + +- **Safety values come from the machine, never from hardcoding.** Limits, caps, thresholds, timings and filters that protect hardware (speaker excursion and thermal limits, gain caps, high-pass corners, power and thermal limits, voltage and current ceilings) are read from what the Mac hands over: its ADT/DT, its own firmware or tuning bundle on the ESP, or control ranges the driver reports. No per-model safety tables or magic numbers in code. If the machine doesn't provide a value, the feature stays off or muted; it never falls back to a guessed constant. +- Speakers: **speakerguardd v2 only**. Never weaken or bypass protection. If a capability or limit can't be established from the machine, stay muted. +- Every test boot has a dead-man. Read registers before writing them. +- No Stage 1, boot-object, LocalPolicy or 1TR change without the machine's owner. +- Before any USB-C VDM or HPM reset, confirm which Mac is on the far end of the cable. + +### 4. Clean-room and attribution (hard) + +- No Apple code, strings, firmware, disassembly output or Apple tuning values in public code, PRs, issues or channels. Our own traces and measurements are fine. +- Commits carry human identity only, with a human `Signed-off-by`. No agent co-author or sign-off and no `Assisted-by` in commits. When an agent helped, the PR body's last line is `Assisted-by: LLM (:)`. +- Carry other people's commits unchanged. No force pushes to shared branches. + +### 5. Evidence (default, high bar) + +- A run on the affected hardware with the numbers: what ran, on which Mac, kernel and build, and the result. Include a regression run: 0 SELinux denials, 0 failed units, 0 new kernel errors. +- Performance claims: a same-machine A/B with conformance unchanged on every GPU generation the change applies to. + +### 6. Naming (hard) + +- The Vulkan driver is **Borealis** (Aurora Silicon's Vulkan driver, in Mesa). Never call our work Honeykrisp or "hk". The code prefix is `brl_`; the rename is tracked in [aurora-silicon/mesa#591](https://github.com/aurora-silicon/mesa/issues/591). Use Aurora paths and names, not Asahi or m1n1. + +## Testing and collaboration + +- Use the Context Mode plugin whenever it can reduce low-signal output. +- Fan independent work out to isolated agents and preserve unrelated worktrees. +- Never write unit tests after you write code. +- Highly prefer E2E tests as the sole testing mechanism. Use them to verify + complex features work. At the end of E2E tests, produce a verifiable and + repeatable artifact. +- If you must test a system in isolation, first write down all the ways it + could fail, then write the code. +- Delete low-signal unit tests that would not catch a real bug missed by E2E + tests. Preserve tests that provide distinct failure coverage. diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..f3c1f9a44 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,73 @@ +# Aurora Silicon assistant policy + +This is Aurora Silicon's own policy for AI coding assistants working in +this repository. It is the only assistant instruction file this tree +carries. Upstream projects' instruction files are never carried here. + +AGENTS.md, CLAUDE.md, GEMINI.md and .github/copilot-instructions.md are +copies of .github/aurora/AGENTS.md. The aurora-agent-policy workflow +puts them back if anything else replaces them, including an upstream +merge. To change the policy, edit .github/aurora/AGENTS.md. + +## Rules + +- Only public code goes in. Never copy code from proprietary sources. +- Changes are tested on the hardware they affect before they are merged. + +## Pre-PR checklist + +Synced from [aurora-silicon/agent-guidelines](https://github.com/aurora-silicon/agent-guidelines/blob/8c0f9c227cd7/pre-pr-checklist.md) +at 8c0f9c227cd7. Change it there, then sync the copy here; do not edit this section +on its own. These are the checks Aurora's review agents apply. + +Each item is a hard rule unless it says "default". If your change fails one, fix the change, or say in the PR why it can't be done yet and keep the PR a draft. + +### 1. No model gating: works on every Mac that has the hardware (hard) + +- **No chip, SoC, board or firmware-version gates** unless truly unavoidable. Decide from what the machine reports: ADT/DT properties of the block, its compatible, capability or feature bits, probed registers, firmware capability fields, ALSA control ranges. Never `if chip == …`, `if board == …`, `if fw == 27.2`, or a per-chip table where a property can carry the value. +- If a gate really is unavoidable, the commit message says why, and the gate uses the narrowest hardware property. +- Prove the change on every Mac you have that contains the block, not only the one you wrote it for. Ask for test runs on the ones you don't have. +- **Chicken and egg:** if the property must first come from the boot loader or DT, land that side first. The consumer reads it with today's behaviour as the fallback when it is absent, and the fallback is removed after a release has carried the property. + +### 2. Production-ready, no hacks (hard) + +- Works on the **default kernel command line**: no new cmdline or module parameters, environment variables or manual steps needed for a feature to work. +- No sleeps or retries over a race, no magic delay or depth ("the value that worked"), no disabled checks, no lab-only code paths. +- Development boots (one-shot test boots) may use extra parameters. Remove them and re-prove on the default command line before the PR. +- One kernel tree and one command line for every Mac. Only the devicetrees differ. + +### 3. Safety (hard) + +- **Safety values come from the machine, never from hardcoding.** Limits, caps, thresholds, timings and filters that protect hardware (speaker excursion and thermal limits, gain caps, high-pass corners, power and thermal limits, voltage and current ceilings) are read from what the Mac hands over: its ADT/DT, its own firmware or tuning bundle on the ESP, or control ranges the driver reports. No per-model safety tables or magic numbers in code. If the machine doesn't provide a value, the feature stays off or muted; it never falls back to a guessed constant. +- Speakers: **speakerguardd v2 only**. Never weaken or bypass protection. If a capability or limit can't be established from the machine, stay muted. +- Every test boot has a dead-man. Read registers before writing them. +- No Stage 1, boot-object, LocalPolicy or 1TR change without the machine's owner. +- Before any USB-C VDM or HPM reset, confirm which Mac is on the far end of the cable. + +### 4. Clean-room and attribution (hard) + +- No Apple code, strings, firmware, disassembly output or Apple tuning values in public code, PRs, issues or channels. Our own traces and measurements are fine. +- Commits carry human identity only, with a human `Signed-off-by`. No agent co-author or sign-off and no `Assisted-by` in commits. When an agent helped, the PR body's last line is `Assisted-by: LLM (:)`. +- Carry other people's commits unchanged. No force pushes to shared branches. + +### 5. Evidence (default, high bar) + +- A run on the affected hardware with the numbers: what ran, on which Mac, kernel and build, and the result. Include a regression run: 0 SELinux denials, 0 failed units, 0 new kernel errors. +- Performance claims: a same-machine A/B with conformance unchanged on every GPU generation the change applies to. + +### 6. Naming (hard) + +- The Vulkan driver is **Borealis** (Aurora Silicon's Vulkan driver, in Mesa). Never call our work Honeykrisp or "hk". The code prefix is `brl_`; the rename is tracked in [aurora-silicon/mesa#591](https://github.com/aurora-silicon/mesa/issues/591). Use Aurora paths and names, not Asahi or m1n1. + +## Testing and collaboration + +- Use the Context Mode plugin whenever it can reduce low-signal output. +- Fan independent work out to isolated agents and preserve unrelated worktrees. +- Never write unit tests after you write code. +- Highly prefer E2E tests as the sole testing mechanism. Use them to verify + complex features work. At the end of E2E tests, produce a verifiable and + repeatable artifact. +- If you must test a system in isolation, first write down all the ways it + could fail, then write the code. +- Delete low-signal unit tests that would not catch a real bug missed by E2E + tests. Preserve tests that provide distinct failure coverage. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 000000000..f3c1f9a44 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,73 @@ +# Aurora Silicon assistant policy + +This is Aurora Silicon's own policy for AI coding assistants working in +this repository. It is the only assistant instruction file this tree +carries. Upstream projects' instruction files are never carried here. + +AGENTS.md, CLAUDE.md, GEMINI.md and .github/copilot-instructions.md are +copies of .github/aurora/AGENTS.md. The aurora-agent-policy workflow +puts them back if anything else replaces them, including an upstream +merge. To change the policy, edit .github/aurora/AGENTS.md. + +## Rules + +- Only public code goes in. Never copy code from proprietary sources. +- Changes are tested on the hardware they affect before they are merged. + +## Pre-PR checklist + +Synced from [aurora-silicon/agent-guidelines](https://github.com/aurora-silicon/agent-guidelines/blob/8c0f9c227cd7/pre-pr-checklist.md) +at 8c0f9c227cd7. Change it there, then sync the copy here; do not edit this section +on its own. These are the checks Aurora's review agents apply. + +Each item is a hard rule unless it says "default". If your change fails one, fix the change, or say in the PR why it can't be done yet and keep the PR a draft. + +### 1. No model gating: works on every Mac that has the hardware (hard) + +- **No chip, SoC, board or firmware-version gates** unless truly unavoidable. Decide from what the machine reports: ADT/DT properties of the block, its compatible, capability or feature bits, probed registers, firmware capability fields, ALSA control ranges. Never `if chip == …`, `if board == …`, `if fw == 27.2`, or a per-chip table where a property can carry the value. +- If a gate really is unavoidable, the commit message says why, and the gate uses the narrowest hardware property. +- Prove the change on every Mac you have that contains the block, not only the one you wrote it for. Ask for test runs on the ones you don't have. +- **Chicken and egg:** if the property must first come from the boot loader or DT, land that side first. The consumer reads it with today's behaviour as the fallback when it is absent, and the fallback is removed after a release has carried the property. + +### 2. Production-ready, no hacks (hard) + +- Works on the **default kernel command line**: no new cmdline or module parameters, environment variables or manual steps needed for a feature to work. +- No sleeps or retries over a race, no magic delay or depth ("the value that worked"), no disabled checks, no lab-only code paths. +- Development boots (one-shot test boots) may use extra parameters. Remove them and re-prove on the default command line before the PR. +- One kernel tree and one command line for every Mac. Only the devicetrees differ. + +### 3. Safety (hard) + +- **Safety values come from the machine, never from hardcoding.** Limits, caps, thresholds, timings and filters that protect hardware (speaker excursion and thermal limits, gain caps, high-pass corners, power and thermal limits, voltage and current ceilings) are read from what the Mac hands over: its ADT/DT, its own firmware or tuning bundle on the ESP, or control ranges the driver reports. No per-model safety tables or magic numbers in code. If the machine doesn't provide a value, the feature stays off or muted; it never falls back to a guessed constant. +- Speakers: **speakerguardd v2 only**. Never weaken or bypass protection. If a capability or limit can't be established from the machine, stay muted. +- Every test boot has a dead-man. Read registers before writing them. +- No Stage 1, boot-object, LocalPolicy or 1TR change without the machine's owner. +- Before any USB-C VDM or HPM reset, confirm which Mac is on the far end of the cable. + +### 4. Clean-room and attribution (hard) + +- No Apple code, strings, firmware, disassembly output or Apple tuning values in public code, PRs, issues or channels. Our own traces and measurements are fine. +- Commits carry human identity only, with a human `Signed-off-by`. No agent co-author or sign-off and no `Assisted-by` in commits. When an agent helped, the PR body's last line is `Assisted-by: LLM (:)`. +- Carry other people's commits unchanged. No force pushes to shared branches. + +### 5. Evidence (default, high bar) + +- A run on the affected hardware with the numbers: what ran, on which Mac, kernel and build, and the result. Include a regression run: 0 SELinux denials, 0 failed units, 0 new kernel errors. +- Performance claims: a same-machine A/B with conformance unchanged on every GPU generation the change applies to. + +### 6. Naming (hard) + +- The Vulkan driver is **Borealis** (Aurora Silicon's Vulkan driver, in Mesa). Never call our work Honeykrisp or "hk". The code prefix is `brl_`; the rename is tracked in [aurora-silicon/mesa#591](https://github.com/aurora-silicon/mesa/issues/591). Use Aurora paths and names, not Asahi or m1n1. + +## Testing and collaboration + +- Use the Context Mode plugin whenever it can reduce low-signal output. +- Fan independent work out to isolated agents and preserve unrelated worktrees. +- Never write unit tests after you write code. +- Highly prefer E2E tests as the sole testing mechanism. Use them to verify + complex features work. At the end of E2E tests, produce a verifiable and + repeatable artifact. +- If you must test a system in isolation, first write down all the ways it + could fail, then write the code. +- Delete low-signal unit tests that would not catch a real bug missed by E2E + tests. Preserve tests that provide distinct failure coverage. diff --git a/GEMINI.md b/GEMINI.md new file mode 100644 index 000000000..f3c1f9a44 --- /dev/null +++ b/GEMINI.md @@ -0,0 +1,73 @@ +# Aurora Silicon assistant policy + +This is Aurora Silicon's own policy for AI coding assistants working in +this repository. It is the only assistant instruction file this tree +carries. Upstream projects' instruction files are never carried here. + +AGENTS.md, CLAUDE.md, GEMINI.md and .github/copilot-instructions.md are +copies of .github/aurora/AGENTS.md. The aurora-agent-policy workflow +puts them back if anything else replaces them, including an upstream +merge. To change the policy, edit .github/aurora/AGENTS.md. + +## Rules + +- Only public code goes in. Never copy code from proprietary sources. +- Changes are tested on the hardware they affect before they are merged. + +## Pre-PR checklist + +Synced from [aurora-silicon/agent-guidelines](https://github.com/aurora-silicon/agent-guidelines/blob/8c0f9c227cd7/pre-pr-checklist.md) +at 8c0f9c227cd7. Change it there, then sync the copy here; do not edit this section +on its own. These are the checks Aurora's review agents apply. + +Each item is a hard rule unless it says "default". If your change fails one, fix the change, or say in the PR why it can't be done yet and keep the PR a draft. + +### 1. No model gating: works on every Mac that has the hardware (hard) + +- **No chip, SoC, board or firmware-version gates** unless truly unavoidable. Decide from what the machine reports: ADT/DT properties of the block, its compatible, capability or feature bits, probed registers, firmware capability fields, ALSA control ranges. Never `if chip == …`, `if board == …`, `if fw == 27.2`, or a per-chip table where a property can carry the value. +- If a gate really is unavoidable, the commit message says why, and the gate uses the narrowest hardware property. +- Prove the change on every Mac you have that contains the block, not only the one you wrote it for. Ask for test runs on the ones you don't have. +- **Chicken and egg:** if the property must first come from the boot loader or DT, land that side first. The consumer reads it with today's behaviour as the fallback when it is absent, and the fallback is removed after a release has carried the property. + +### 2. Production-ready, no hacks (hard) + +- Works on the **default kernel command line**: no new cmdline or module parameters, environment variables or manual steps needed for a feature to work. +- No sleeps or retries over a race, no magic delay or depth ("the value that worked"), no disabled checks, no lab-only code paths. +- Development boots (one-shot test boots) may use extra parameters. Remove them and re-prove on the default command line before the PR. +- One kernel tree and one command line for every Mac. Only the devicetrees differ. + +### 3. Safety (hard) + +- **Safety values come from the machine, never from hardcoding.** Limits, caps, thresholds, timings and filters that protect hardware (speaker excursion and thermal limits, gain caps, high-pass corners, power and thermal limits, voltage and current ceilings) are read from what the Mac hands over: its ADT/DT, its own firmware or tuning bundle on the ESP, or control ranges the driver reports. No per-model safety tables or magic numbers in code. If the machine doesn't provide a value, the feature stays off or muted; it never falls back to a guessed constant. +- Speakers: **speakerguardd v2 only**. Never weaken or bypass protection. If a capability or limit can't be established from the machine, stay muted. +- Every test boot has a dead-man. Read registers before writing them. +- No Stage 1, boot-object, LocalPolicy or 1TR change without the machine's owner. +- Before any USB-C VDM or HPM reset, confirm which Mac is on the far end of the cable. + +### 4. Clean-room and attribution (hard) + +- No Apple code, strings, firmware, disassembly output or Apple tuning values in public code, PRs, issues or channels. Our own traces and measurements are fine. +- Commits carry human identity only, with a human `Signed-off-by`. No agent co-author or sign-off and no `Assisted-by` in commits. When an agent helped, the PR body's last line is `Assisted-by: LLM (:)`. +- Carry other people's commits unchanged. No force pushes to shared branches. + +### 5. Evidence (default, high bar) + +- A run on the affected hardware with the numbers: what ran, on which Mac, kernel and build, and the result. Include a regression run: 0 SELinux denials, 0 failed units, 0 new kernel errors. +- Performance claims: a same-machine A/B with conformance unchanged on every GPU generation the change applies to. + +### 6. Naming (hard) + +- The Vulkan driver is **Borealis** (Aurora Silicon's Vulkan driver, in Mesa). Never call our work Honeykrisp or "hk". The code prefix is `brl_`; the rename is tracked in [aurora-silicon/mesa#591](https://github.com/aurora-silicon/mesa/issues/591). Use Aurora paths and names, not Asahi or m1n1. + +## Testing and collaboration + +- Use the Context Mode plugin whenever it can reduce low-signal output. +- Fan independent work out to isolated agents and preserve unrelated worktrees. +- Never write unit tests after you write code. +- Highly prefer E2E tests as the sole testing mechanism. Use them to verify + complex features work. At the end of E2E tests, produce a verifiable and + repeatable artifact. +- If you must test a system in isolation, first write down all the ways it + could fail, then write the code. +- Delete low-signal unit tests that would not catch a real bug missed by E2E + tests. Preserve tests that provide distinct failure coverage.