Files
agent-pet-companion/script/validate_source_syntax.sh
T
xjxandgd-ops 80f7912026 Fix Control Center presentation and time-dependent tests (#28)
## Summary / 摘要

- Make one coordinator the sole owner of Control Center presentation,
activation, exact-window registration, and key-window state across cold
launch, reopen, menu, overlay, and update paths.
- Remove the startup alpha/input gate; appearance hydration now applies
only `NSAppearance` while the window stays visible and interactive.
- Keep overlay panels passive by default and grant the session bubble
keyboard focus only through an explicit, revocable lease.
- Add bounded lifecycle diagnostics and a fail-closed cold-launch
release gate that rebuilds the exact worktree App and proves singleton
identity, layer, alpha, nonblank pixels, overlay ordering, and retained
focus.
- Replace every retention-sensitive fixed Rust event timestamp with one
current UTC fixture base plus relative offsets; the audit removed 25
calendar-dependent timestamps, including the failing 2026-07-17 cases,
imminent 2026-07-20 cases, and 2099 escape fixtures.
- Add a CI-enforced Rust source validator that follows same-file fixture
helpers, rejects fixed RFC 3339 timestamps crossing real event-retention
APIs, and permits isolated deterministic schema/serialization/migration
samples.

## Validation / 验证

- `cargo test --workspace --locked` — complete Rust workspace passed
(petcore unit 279; integration A/B/C/D 96/40/66/160; CLI and type suites
passed).
- `cargo clippy -p petcore --all-targets --locked -- -D warnings`
passed.
- `python3 script/validate_time_independent_tests.py --root .` passed;
running the same validator against the unfixed main tree reports all 25
risky timestamps.
- `python3 script/tests/test_validation_tooling.py` — 56 tests passed.
- `./script/validate_swift_tests.sh --scope all` — 749 tests passed.
- `./script/validate_app_lifecycle_contract.sh` — 16/16 passed.
- `APC_VALIDATE_HOST_UI=1 APC_MAIN_UI_COLD_LAUNCH_ITERATIONS=20
./script/validate_main_window_ui.sh` — 20/20 cold launches passed.
- Computer Use acceptance — five destinations, three bundled pets,
action preview, pet hide/show, Control Center close/reopen, and two
consecutive quit/relaunch cycles passed.
- `./script/validate_pre_push.sh` passed after the Rust and source-gate
update.
- `./script/validate_test_isolation.sh` and
`./script/validate_build_scripts_safety.sh --static-only` passed.

This PR updates the release-control-plane inventory, so it must complete
PR CI and then receive a trusted manual squash merge.

## Development claim / 开发声明

- Domain: `release-control-plane`
- Claim: `control-plane`
- Base commit: `e216a4fd13af88902cf2bd77d23939fe606c9383`
- Release preparation: `no`
- Focused validation:
  - `python3 script/tests/test_validation_tooling.py`
  - `./script/validate_build_scripts_safety.sh --static-only`

<!-- apc-engineering-coordination-v1
{"claim_overlap_rejections":1,"merge_tree_conflicts":0,"schema_version":"apc.engineering-coordination.v1","task_created_at":"2026-08-16T12:09:52Z","train_conflict_resolutions":0}
-->

---------

Co-authored-by: gd-ops <gd-ops@xmfunny.com>
2026-08-17 14:43:39 +08:00

61 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
while IFS= read -r -d '' path; do
bash -n "$path"
done < <(find "$ROOT_DIR/script" "$ROOT_DIR/skills" -type f -name '*.sh' -print0)
python3 - "$ROOT_DIR" <<'PY'
import ast
import json
import pathlib
import re
import sys
import urllib.parse
root = pathlib.Path(sys.argv[1])
for base in (root / "script", root / "skills"):
for path in sorted(base.rglob("*.py")):
ast.parse(path.read_text(encoding="utf-8"), filename=str(path))
for base in (root / "schemas", root / "fixtures", root / "plugins"):
if not base.exists():
continue
for path in sorted(base.rglob("*.json")):
with path.open(encoding="utf-8") as file:
json.load(file)
for path in sorted((root / "apps").rglob("*.xcstrings")):
with path.open(encoding="utf-8") as file:
json.load(file)
ignored_parts = {".git", ".build", "dist", "target"}
markdown_link = re.compile(r"\[[^\]]*\]\(([^)]+)\)")
broken_links = []
for path in sorted(root.rglob("*.md")):
if ignored_parts.intersection(path.relative_to(root).parts):
continue
source = path.read_text(encoding="utf-8")
for match in markdown_link.finditer(source):
value = match.group(1).strip()
if value.startswith("<") and ">" in value:
value = value[1:value.index(">")]
elif value:
value = value.split(maxsplit=1)[0]
if not value or value.startswith(("#", "http://", "https://", "mailto:", "app://")):
continue
local_path = urllib.parse.unquote(value.split("#", 1)[0])
if not (path.parent / local_path).resolve().exists():
line = source.count("\n", 0, match.start()) + 1
broken_links.append(f"{path.relative_to(root)}:{line}: {value}")
if broken_links:
raise SystemExit("broken local Markdown links:\n" + "\n".join(broken_links))
PY
python3 "$ROOT_DIR/script/validate_time_independent_tests.py" --root "$ROOT_DIR"
echo 'Shell, Python, JSON and local Markdown link syntax ok'