# Task 1 Report: Shell 契约测试脚手架 + nginx 失败用例（RED）

## Task Summary

- **Task ID**: Task 1
- **Task Title**: Shell 契约测试脚手架 + nginx 失败用例（RED）
- **Status**: ✅ DONE

## Files Created

| File | Description |
|------|-------------|
| `tests/deploy/baota/fixtures/web-output/.output/server/index.mjs` | Minimal Nuxt SSR stub (`console.log('fixture-nuxt')`) |
| `tests/deploy/baota/run-all.sh` | Runner: executes all `test-*.sh` in baota deploy tests |
| `tests/deploy/baota/test-nginx-web-location.sh` | Nginx `/web` contract test + A11 regression greps |

## Files NOT Modified (per constraints)

- `deploy/baota/nginx.rewrite` — unchanged (no `/web` locations yet)
- `deploy/baota/pack.sh`, `deploy/baota/install.sh` — unchanged
- Plan files — unchanged

## Test Coverage

### TC-N1 / A1 — `/web` nginx contract (expected FAIL at RED)

- `location = /web {` exact match block
- `return 301 /web/;` redirect
- `location ^~ /web/` prefix block
- `proxy_pass http://127.0.0.1:3000;` without trailing slash
- No `proxy_pass http://127.0.0.1:3000/;` with trailing slash
- `/web/` block line number < `location / {` fallback line number

### A11 — regression greps (pass on current nginx.rewrite)

- `location ^~ /api/` still present
- `location ^~ /admin/` still present
- `location ^~ /mobile/` still present

## RED Verification Evidence

### Command

```bash
bash tests/deploy/baota/test-nginx-web-location.sh
```

### Output (exit code 1)

First failing assertion is the `/web` exact-match location grep (no match in current `nginx.rewrite`):

```
$ bash -x tests/deploy/baota/test-nginx-web-location.sh 2>&1 | tail -5
+ NGINX=/Users/arthur/data/httpd/ecshopx-demo/ECShopX/deploy/baota/nginx.rewrite
+ grep -qE 'location[[:space:]]+=[[:space:]]+/web[[:space:]]*\{' .../deploy/baota/nginx.rewrite
# exits 1 — no /web location in nginx.rewrite
```

### run-all.sh

```bash
$ bash tests/deploy/baota/run-all.sh
==> .../tests/deploy/baota/test-nginx-web-location.sh
# exit 1
```

### A11 regression (isolated — all PASS on current file)

```
A11 /api/: PASS
A11 /admin/: PASS
A11 /mobile/: PASS
```

### Fixture stub

```bash
$ node tests/deploy/baota/fixtures/web-output/.output/server/index.mjs
fixture-nuxt
```

## Permissions

- `chmod +x tests/deploy/baota/run-all.sh`
- `chmod +x tests/deploy/baota/test-nginx-web-location.sh`

## Commits

None (per user rule — commit only when requested).

## Concerns

None. RED phase complete; Task 2 (nginx `/web` implementation) should make TC-N1 pass while A11 greps continue to pass.

## Author

developer
