# JUJU 0.8.0 — Windows native candidate

> **Current status — superseded by 0.8.2 (2026-09-11): Windows x64 is now supported for the capabilities exercised by the 0.8.2 native acceptance.** This file keeps the original 0.8.0/0.8.1 history below. See [RELEASE_0.8.2](RELEASE_0.8.2.md) and [TEST_REPORT](TEST_REPORT.md) for current evidence.
>
> On the same Windows Server / built-in Administrator environment that exposed the 0.8.0 ACL bug, the 0.8.2 candidate passed private state setup, all ten `juju setup --check` software/backend components, sandboxed Playwright Chromium, Windows SAPI speech, real interactive desktop capture/focus/UI Automation, and Windows SRT confinement (workspace write; outside write, owner-state read and direct network denied; cleanup verified). A real MCP STDIO session listed 74 tools, loaded setup-managed Git and enforced `run_command sandbox:true` with outside writes denied.
>
> Boundaries remain explicit: Windows desktop needs an unlocked interactive session; the SRT sandbox may require one local UAC provisioning prompt; local-drive workspaces are the tested sandbox path. Windows ARM64, external ChatGPT custom-MCP, second-user privacy, enabled 8.3 aliases, Defender/OneDrive permutations and other manual cases are not converted to passes by this evidence.

## แพตช์ 0.8.1 — เจ้าของ state เป็นกลุ่ม Administrators

รายงานจากเจ้าของ: Windows Server, Node v24.21.0, บัญชี Administrator พบว่า
0.8.0 หยุดตั้งแต่สร้าง private state และ `doctor` ขึ้น FAIL config-dir เพราะ
NTFS ตั้ง owner เป็น BUILTIN\\Administrators (`S-1-5-32-544`) แทน SID ผู้ใช้
โค้ดเดิมปฏิเสธก่อนถึงจุด SetOwner

0.8.1 แก้เฉพาะการรับ owner เริ่มต้น: ยอมรับ SID ผู้ใช้ปัจจุบัน หรือกลุ่ม
Administrators **เฉพาะเมื่อ WindowsPrincipal.IsInRole ยืนยันกลุ่มใน effective token**
ไม่ใช้ชื่อบัญชี Administrator ไม่ยกระดับสิทธิ์เอง และไม่รับเจ้าของอื่นรวมถึง SYSTEM
จากนั้นตั้ง owner เป็น SID ผู้ใช้ และอ่าน owner+DACL จากดิสก์ซ้ำหลังตั้งทุกครั้ง

โหมด verify ตรวจ DACL เดิมก่อนซ่อม owner ของไฟล์/ไดเรกทอรีที่เพิ่งสร้าง เช่น
IPC descriptor; ถ้า DACL ไม่เป็น private ให้ปฏิเสธโดยไม่ซ่อม owner หรือ DACL
กรณีที่ซ่อมได้ต้องรักษา DACL เดิมและตรวจ SDDL ซ้ำ ไม่ตาม reparse point
และไม่ลด protection เมื่อ Set-Acl ล้มเหลว Path ยังส่งเป็น environment data เท่านั้น

เพิ่ม `tests/security/windowsAclOwner.test.ts` สำหรับ native Windows ที่มี enabled
Administrators token: protect, verify ทั้งไฟล์และโฟลเดอร์, IPC จริง, foreign owner,
Everyone ACE และ junction; POSIX skips ไม่ใช่ Windows passes ส่วน
`tests/unit/windowsAclContract.test.ts` เป็น source-structure checks ไม่ใช่ NTFS/UAC emulation

หลักฐาน patch และ publication receipt อยู่ใน `release-evidence/0.8.1/`;
อ่าน [RELEASE_0.8.1](RELEASE_0.8.1.md) และ TEST_REPORT สำหรับผลจริง
การตรวจซ้ำบน Windows Server เครื่องที่รายงานยังเป็น **OWNER_PENDING**
ไม่ใช้ผล gate บน Mac แทนผล Windows และไม่เปลี่ยน broad Windows support claim

ข้อมูล candidate 0.8.0 ด้านล่างเป็นประวัติและข้อจำกัดเดิม

วันที่ 10 กันยายน 2026 · สถานะ **EXPERIMENTAL / ยังไม่ผ่านการรับรองบน Windows จริง**

เอกสารนี้ติดตามการลงมือทำตาม [ข้อเสนอ Windows v0.8](WINDOWS_DEV_PROPOSAL_TH.md)
และ [ผล audit เดิม](WINDOWS_PLAN.md) ไม่ใช้ผลบน macOS แทนหลักฐาน Windows
เลขแพ็กเกจใน source เป็น 0.8.0 แต่ไม่ได้หมายความว่าเผยแพร่ npm หรือผ่าน native claim gate แล้ว

## สิ่งที่มีใน implementation

| กลุ่ม | จุดเชื่อมใน source | ขอบเขต |
|---|---|---|
| IPC | `src/ipc/authentication.ts`, `server.ts`, `client.ts`, `ownerControl.ts`, `src/cli/kill.ts` | Unix sockets / Windows named pipes; descriptor ส่วนตัวต่อ listener; challenge/HMAC ทั้งสองทิศทาง; status/stop ไม่มี unauthenticated fallback |
| State | `src/config/paths.ts`, `src/platform/privateFs.ts` | Windows ใช้ LOCALAPPDATA/juju; ตรวจ owner และ DACL; state ใหม่จำกัด current SID, SYSTEM, Administrators; ACL ทำไม่ได้ให้ปฏิเสธ |
| Executables | `src/platform/execResolve.ts` | absolute trusted helper paths, PATHEXT ที่จำกัดรูปแบบ, ตัด cwd/relative/repository PATH และ canonical aliases |
| Shell | `src/platform/shell.ts`, `src/services/jobs/jobManager.ts` | Git for Windows Bash ก่อน; cmd.exe เป็น fallback; batch argv ใช้ validation เข้ม ไม่เดา escape ทุกกรณี |
| Process lifecycle | `src/platform/processTree.ts`, jobs/git/search/LSP/media | Windows ใช้ taskkill.exe /T /F กับ live owned child; ไม่ส่งสัญญาณไป PID เก่าจากฐานข้อมูล |
| NTFS | `src/platform/pathPolicy.ts`, `src/workspace/fs.ts`, `root.ts` | ปฏิเสธ ADS, device names, trailing dot/space, short-name syntax; ตรวจ canonical components และ secret policy ซ้ำ; ไม่เดิน junction/symlink |
| Environment | `src/security/env.ts` | ตัวแปร Windows ที่จำเป็นแบบ case-insensitive; ไม่ส่ง JUJU_* / loader options; browser ใช้ environment ชุดเดียวกัน |
| Git/search/LSP | `src/services/git/`, `search/`, `lsp/` | helpers เป็น absolute path; native argv bounds; Windows LSP รับ .exe ไม่รับ npm batch shim |
| File fidelity | `src/platform/fsRetry.ts`, `src/services/changes/`, `src/util/bytes.ts` | bounded retry สำหรับ sharing locks; ไม่ลบ destination/ถอด read-only เพื่อบังคับ overwrite; เก็บ BOM/CRLF |
| Schedules | `src/services/schedules/scheduleService.ts` | sandbox ที่ร้องขอบน Windows ต้องถูกปฏิเสธ; การใช้ sandbox:false ต้องชัดเจนและยังต้อง owner approval |
| Test infrastructure | `.github/workflows/windows.yml`, `tests/helpers/platform.ts` | Windows Node 22/24 candidate CI และ fixtures แยกจาก state จริง |

รายการนี้เป็น implementation map ไม่ใช่ใบรับรองว่าทุกแถวทำงานบน Windows แล้ว
ยังต้องตรวจ portability ของเทสต์เดิมและเก็บหลักฐาน Windows ตามด่านด้านล่าง

## ข้อจำกัดที่ตั้งใจคงไว้

Windows native v1 ไม่มี JUJU OS command sandbox, ไม่มี native desktop control/capture
และไม่มี macOS `say` speech synthesis. คำสั่งทำงานด้วยสิทธิ์ OS user และการหยุด job
เป็น hard-kill ไม่ใช่ SIGTERM grace period. ไม่อ้าง Job Object confinement หรือรับประกัน
การหยุด descendants ที่หลุดจาก ownership ไปแล้ว. Browser Chromium sandbox ไม่ใช่
JUJU command sandbox และไม่มีการปิด sandbox อัตโนมัติเพื่อทำให้เทสต์ผ่าน

รับ workspace บน local drive เท่านั้น; UNC/device namespace และ Windows ARM64
ไม่อยู่ใน claim ของรุ่นนี้. Folder case-sensitive mode, network filesystems, OneDrive,
Defender/file-lock behavior และการโจมตีจาก OS user คนที่สองต้องมี native evidence
ก่อนขยาย claim. Same-OS-user processes และ Administrators ไม่ใช่ adversary ที่ IPC นี้แยกได้

Batch argv ปฏิเสธ control characters, `%`, `!`, quotes และ shell metacharacters.
ข้อจำกัดนี้รวมถึง path ของ batch script จึงมีบาง installation path ที่ต้องใช้ native
`node.exe` พร้อม JavaScript entrypoint แทน. `run_command` เป็นการรัน shell source โดยตั้งใจ;
ข้อจำกัด argv ไม่ได้เปลี่ยน shell ให้เป็น sandbox. Native command lines จำกัด 32,767 UTF-16 units,
cmd script แต่ละบรรทัดจำกัด 8,000 characters; โค้ดยาวควรเก็บลงไฟล์

## การอัปเกรดโดยไม่ทำ OAuth login หาย

1. สำรองโปรเจ็คและ state ของคุณก่อนเปลี่ยน installation
2. หยุด process 0.7.x ด้วย **CLI รุ่นเดิมที่จับคู่กับ process นั้น** หรือปิดจาก terminal เดิม
   ก่อนแทนที่ CLI. IPC 0.8 ใช้การยืนยันตัวตนใหม่ และไม่ fallback ไปสั่ง stop/status แบบเก่า
3. ติดตั้งจาก local tarball ที่ตรวจแล้ว หรือ build source ด้วย `npm ci` และ `npm run build`
4. เริ่ม process ใหม่และ rescan tools. OAuth clients/grants, workspace ACL, trust และ
   desktop consent ไม่ได้ถูกล้างหรือย้ายด้วยงานแก้ source นี้

การ build checkout ไม่เปลี่ยน global installation และไม่อัปเกรด process ที่กำลังให้บริการ
Windows รุ่นเก่าที่เคยเก็บ state ใน APPDATA/Roaming ต้องย้ายด้วย owner เองหรือใช้
JUJU_CONFIG_DIR ที่เลือกชัดเจน; ไม่มีการค้นหา/คัดลอก OAuth keys จากที่อื่นอัตโนมัติ

## รันจาก source บน Windows เพื่อเก็บหลักฐาน

ติดตั้ง Node x64 ที่ตรง matrix และ Git for Windows ก่อน ใช้ local NTFS workspace ของตัวเอง
จาก PowerShell:

```powershell
npm ci
npm run build
npm run typecheck
npm run lint
npm run test:windows
npm run test:all
node dist/cli/main.js doctor --json
```

ไม่ต้องดาวน์โหลดโมเดลหรือเปิด desktop เพื่อใช้ coding tools. Chromium/FFmpeg/Whisper
ยังเป็น optional components ซึ่งต้องติดตั้งแยกและตรวจการทำงานจริงใน environment เป้าหมาย

## หลักฐานและด่านที่ยังไม่ผ่าน

ผลเดิมใน `release-evidence/0.8.0/` คงไว้เป็นหลักฐานของ snapshot ก่อนหน้า
ผลหลังปรับ rollback path guards, LSP/packaging portability และลบ self-dependency
อยู่ที่ `release-evidence/0.8.0/continuation/verification.json` พร้อม JSON ราย test suite
และ hash ของ source ก่อน–หลังรัน ใน `source-manifest.json`

คำสั่งสำหรับตรวจครบจาก source checkout หลัง build: `node scripts/verify-windows-candidate.mjs`
เครื่องที่ใช้ตรวจครั้งนี้คือ **darwin arm64 / Node 22.23.2** ไม่ใช่ Windows
Windows-only cases ที่ skipped ไม่ใช่ผลผ่าน ส่วน focused platform tests ซ้ำกับ core suite
จึงไม่นำมาบวกซ้ำในยอดรวม ดูผลและ artifact ล่าสุดใน `TEST_REPORT.md`
และ `release-evidence/0.8.0/continuation/`

| ด่าน | สถานะในการแก้ source ครั้งนี้ |
|---|---|
| Windows workflow Node 22/24 | เขียน workflow แล้ว; **ยังไม่ได้รัน CI** |
| Native NTFS ADS/junction/case tests | เขียนเทสต์แล้ว; **ยังไม่รันบน Windows** |
| IPC bad MAC/replay/spoof/bounds | มี automated local evidence; Windows transport/DACL ยังต้องรัน native |
| Actual 8.3 alias on a volume with 8.3 enabled | **MANUAL_NOT_RUN**; parser tests ไม่ใช่หลักฐานเปิด alias จริง |
| Windows full legacy test-suite portability | **NATIVE_NOT_RUN**; ไม่ลบ/skip ชุดเดิมทั้งชุดเพื่อทำให้เขียว |
| Windows 11: fresh install, HTTP/STDIO, client จริง, Defender, OneDrive | **MANUAL_NOT_RUN** |
| OS user คนที่สองเข้าถึง descriptor/IPC ไม่ได้ | **MANUAL_NOT_RUN**; Everyone ACE test เป็น automated fixture เท่านั้น |
| เปลี่ยน candidate CI เป็น required และประกาศ supported | **BLOCKED จนด่านข้างต้นครบ** |
| npm publish / git tag / production deployment | **ไม่ได้ทำ** |

CI Windows เป็น allow-failure ตามเฟส 0 ของข้อเสนอ และเก็บ JSON ทั้ง contracts/core/packaging
แม้เกิด failure. การมีไฟล์ workflow ไม่ใช่หลักฐานว่ารันผ่าน และการเพิ่ม required status checks
ต้องตั้งที่ repository หลังมีผลจริง ไม่ใช่กล่าวอ้างจาก YAML

## แหล่งอ้างอิงสำหรับ platform contracts

- Node child_process: https://nodejs.org/docs/latest-v22.x/api/child_process.html — Windows batch invocation และ environment-key semantics
- Node net: https://nodejs.org/api/net.html — Windows named-pipe transport
- Microsoft file naming: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file — ADS/device/path namespaces

รายละเอียดหลักฐาน source และข้อจำกัดควรอ่านร่วมกับ [SECURITY](SECURITY.md),
[LSP](LSP.md), [Manual acceptance](MANUAL_ACCEPTANCE.md) และ [ADR-030](adr/030-windows-native-candidate.md)
