Skip to content

Generalize defensive design with evidence-driven architecture adaptation - #3

Merged
elkaix merged 5 commits into
mainfrom
improve/universal-defensive-design
Sep 5, 2026
Merged

elkaix merged 5 commits into
mainfrom
improve/universal-defensive-design

Conversation

@elkaix

@elkaix elkaix commented Sep 5, 2026

Copy link
Copy Markdown
Member

Summary

Upgrade the skill from 1.1.0 to 1.2.0 without prescribing a language, framework, database, deployment topology, or agent provider. Preserve existing reference paths, public HTTP result types, and the original 43 reference checks.

Baseline: 109c36dfe9a8202d93bdd64275d8936951d941d7
Final head: 1fa16cfa7f461012e26a3f0c4e82f57d2e6795ae

Confirmed findings and repairs

  • Late completion incorrectly reported as success: synchronous parsing or response cleanup could cross the operation deadline before the event loop ran the timeout callback. The HTTP example now uses the event-loop deadline and checks completion time before returning. Three regressions failed before the repair; all four deadline cases pass afterward. This remains cooperative cancellation, not CPU preemption.
  • Over-broad applicability rules: correct the blanket rejection of process-local synchronization, automatic exclusion of explicit pure-helper audits, and application of I/O/distributed controls to nonexistent surfaces. Consequential pure arithmetic can warrant deep verification without retries or a database.
  • Package validation gap: add offline validation for metadata, local links and headings, resource reachability, optional host metadata, and exact trigger/rubric correspondence. Include malformed YAML, duplicate keys, unsafe tags, excessive nesting, path escape, symlink, and corpus regressions.

Architecture-neutral design

The shortened core discovers contracts, state ownership, authority, lifecycle, consequences, budgets and existing facilities before choosing controls. Optional adaptation guidance covers libraries, CLIs/filesystems, UI/mobile/offline applications, monoliths, distributed services, streams/batches, infrastructure, embedded systems, ML pipelines and agents.

Review, design, implementation and incident modes have explicit action boundaries. Preserve fail-closed security, distinguish domain-approved physical safe states, keep long-lived work resource-bounded, and require evidence-backed findings and proportional implementation slices. Add an optional assessment template, primary-source map, maintenance guidance, changelog, migration/rollback instructions and current work ledger.

Reviewable commits

Commit Scope
8a83354 Pin actions, bound CI and archive checked source/environment
1d27af1 Repair late HTTP completion and add four deterministic regressions
ecb90dc Architecture-neutral core and optional adaptation references
de1d2dd Preserve 32 evaluation cases and add 16 cross-architecture cases
1fa16cf Package validator, 30 validator tests, full CI and maintenance documentation

Verification

Final-head hosted run 33936915044: successful. All six jobs passed: Python 3.11, 3.12, 3.13 and 3.14 reference/package checks, plus HTTPX 0.27.0 and bounded latest-0.x compatibility checks. The four protected-branch check names remain unchanged.

Local final-state verification used Python 3.13.5, HTTPX 0.28.1 and PyYAML 6.0.3:

Check Result
python scripts/validate_skill.py Pass
python scripts/verify_reference.py 43 original checks pass
python -m unittest discover -s tests -v 34 tests pass: four deadline and 30 validator tests
python -O -m unittest discover -s tests -p test_validate_skill.py -v 30 validator tests pass with assertions disabled
python -m compileall -q scripts references tests Pass
git diff --check Pass

All 25 published package files match the locally tested files by Git blob identity. The evaluation corpus has 48 cases, with 40 positive and eight negative triggers and matching behavioral rubrics. Corpus validation is not evidence of successful model runs.

Compatibility, migration and rollback

The text skill has no runtime dependency. Python dependencies apply only to maintainer checks and the optional HTTP example. Install the complete package so new on-demand references remain available. No application schema, infrastructure or durable-data migration is introduced.

Revert the relevant commits or restore the previously reviewed package revision. Keep the deadline repair when rolling back only instructional changes rather than reintroducing the known bug.

Verification limits and publication state

Independent host/model behavioral evaluation was not executed. Ruff and mypy were unavailable locally; no current lint/type-check pass is claimed. Mock-transport/unit tests do not establish real DNS, TLS, proxy, provider, hardware or physical-safety behavior. Generalized guidance is not a guarantee of robustness on every codebase.

Changes are pushed to improve/universal-defensive-design. Main protection remains unchanged. This PR is not merged; no deployment, release tag or host-wide installation was performed.

Summary by CodeRabbit

  • New Features

    • Added offline validation for skill packages, including metadata, links, evaluation files, and safety checks.
    • Added structured defensive-design assessment templates, architecture guidance, checklists, and verification resources.
    • Expanded behavioral evaluation coverage for authorization, synchronization, lifecycle, cancellation, provenance, and evidence handling.
  • Bug Fixes

    • Improved deadline handling so operations crossing their deadline are correctly reported as cancelled.
    • Clarified retry, timeout, authority, and untrusted-content safeguards.
  • Documentation

    • Updated installation, usage, maintenance, compatibility, verification, rollout, and rollback guidance.
    • Added the 1.2.0 changelog and development requirements documentation.
  • Tests

    • Added regression coverage for deadline behavior and comprehensive package validation.

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: c747e71e-e135-4398-a0f0-793b105f2862

📥 Commits

Reviewing files that changed from the base of the PR and between 109c36d and 1fa16cf.

⛔ Files ignored due to path filters (1)
  • evals/defensive-design.prompts.csv is excluded by !**/*.csv
📒 Files selected for processing (20)
  • .github/workflows/verify.yml
  • AGENTS.md
  • CHANGELOG.md
  • README.md
  • SKILL.md
  • agents/openai.yaml
  • assets/assessment-template.md
  • evals/README.md
  • evals/behavior-rubric.md
  • references/architecture-adaptation.md
  • references/defensive-checklists.md
  • references/resilient_http_example.py
  • references/secure-coding-overlay.md
  • references/sources.md
  • references/verification-and-chaos.md
  • requirements-dev.txt
  • scripts/validate_skill.py
  • tasks/todo.md
  • tests/test_reference_deadline.py
  • tests/test_validate_skill.py

📝 Walkthrough

Walkthrough

This change updates the Defensive Design skill and repository guidance, adds offline package validation, corrects cooperative deadline handling, expands evaluation and evidence documentation, and strengthens CI with pinned actions, artifacts, timeouts, and HTTPX compatibility checks.

Changes

Defensive Design 1.2.0

Layer / File(s) Summary
Skill contract and defensive guidance
AGENTS.md, SKILL.md, README.md, references/*, agents/openai.yaml
Defines evidence-based scope, authority boundaries, architecture adaptation, proportional controls, verification limits, and package usage.
Package validator and validation tests
scripts/validate_skill.py, tests/test_validate_skill.py, requirements-dev.txt
Adds offline validation for metadata, links, package structure, host wiring, evaluation data, unsafe paths, and resource limits.
Cooperative deadline behavior
references/resilient_http_example.py, tests/test_reference_deadline.py
Uses an absolute deadline, rejects late completion, documents cooperative cancellation limits, and tests parsing and cleanup boundary cases.
Evaluation, assessment, and release evidence
assets/assessment-template.md, evals/*, CHANGELOG.md, tasks/todo.md
Adds expanded evaluation cases, structured assessment and evidence records, verification boundaries, rollout guidance, and 1.2.0 release status.
Pinned and matrix CI verification
.github/workflows/verify.yml
Adds run cancellation, job timeouts, pinned actions, package checks, verification artifacts, and HTTPX compatibility testing.

Estimated code review effort: 4 (Complex) | ~45 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improve/universal-defensive-design

Comment @coderabbitai help to get the list of available commands.

Recheck the event-loop clock after parsing and response cleanup. Preserve the
public result contract and distinguish cooperative cancellation from CPU
preemption. Add four deterministic deadline regressions; three failed before
the repair and all four now pass alongside the 43 existing checks.
…utral

Shorten the core and route depth to optional adapters. Preserve security and
resilience invariants while correcting blanket local-lock, timeout and
pure-computation rules. Add explicit action scope, evidence limits, primary
sources, and an optional implementation/verification/rollback template.
…ures

Preserve all 32 existing trigger cases and add 16 cases for explicit local
audits, numerical correctness, local locks, long-lived streams, cooperative
timeouts, offline/UI state, filesystems, devices, infrastructure, data and agents.
Keep every case paired with an observable outcome rubric; structure checks do
not imply that model behavior has been evaluated.
Add safe YAML, bounded local-link, resource and eval/rubric validation with
30 package regression tests. Preserve four required Python checks; add pinned
baseline dependencies and separate minimum/latest HTTPX compatibility jobs.
Document architecture-neutral use, maintenance, migration, rollback and
unexecuted model/integration evaluation boundaries in the current work ledger.
@elkaix
elkaix marked this pull request as ready for review September 5, 2026 01:44
@elkaix
elkaix merged commit 3fd605e into main Sep 5, 2026
6 of 7 checks passed
@elkaix
elkaix deleted the improve/universal-defensive-design branch September 5, 2026 01:46
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.

1 participant