Skip to content

Enforce contract invariants with clippy.toml, architecture tests, and UI lints - #379

Merged
d41sys merged 1 commit into
mainfrom
issue-372-contract-lints
Dec 4, 2026
Merged

d41sys merged 1 commit into
mainfrom
issue-372-contract-lints

Conversation

@d41sys

@d41sys d41sys commented Dec 4, 2026

Copy link
Copy Markdown
Owner

Summary

Moves standing rules from docs/agents/contract.md into deterministic compile-time, test-time, and workflow checks:

  • Adds clippy.toml + [workspace.lints.clippy] disallowed_methods = "deny" (inherited by all 6 workspace crates) disallowing std::env::set_current_dir and unapproved std::process::exit. Refactors native/src/main.rs and helper/src/main.rs main() to return ExitCode, and annotates the remaining documented top-level exit points (appd, agentcore, helper::send, window Tauri macro, proto test watchdog).
  • Adds appd/tests/architecture.rs enforcing that core crates (proto, appd, agentcore, helper) never pull in an async runtime (tokio, async-std, smol), every workspace crate inherits [lints] workspace = true, and AGENTS.md stays compact with valid doc links.
  • Extends window/ui/standin/standin.test.mjs to fail on as any, @ts-ignore, @ts-nocheck, and focused .only( tests in window/ui/src.
  • Sets explicit least-privilege top-level permissions: { contents: read } in .github/workflows/ci.yml.

Closes #372.

Evidence

  • cd window/ui && npm ci && npm run build && npm test: passed (including the new UI hygiene test in standin.test.mjs).
  • cargo fmt --all --check: passed.
  • cargo clippy --workspace --all-targets --locked -- -D warnings: passed (and verified that disallowed_methods triggers across workspace crates when unannotated).
  • cargo test --workspace --locked --no-fail-fast: passed (all workspace crates + 3 new tests in appd/tests/architecture.rs).

Merge Danger

Low. No runtime protocol, schema, or UI behavior changed; native and helper main() preserve exit codes 0/1, and existing top-level exit(...) calls keep their exact exit semantics.

Device decision

No new or changed service commands or fields; paired Device permissions (ALLOWED_OVER_LAN) are unchanged.

@d41sys
d41sys merged commit 506afec into main Dec 4, 2026
5 checks passed
@d41sys
d41sys deleted the issue-372-contract-lints branch December 4, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mechanical contract enforcement: clippy.toml, architecture invariants, and UI lints

1 participant