Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

docs(testing): add scenario testing standard package

cyhadae3da53d3b
diff --git a/AGENTS.md b/AGENTS.md
index 1b103aa63..5fdc7cf3a 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -202,6 +202,7 @@ Testing guidance:
- use pytest-style tests (`test_<feature>.py`) colocated or under `tests/`
- for IM integrations, stub/mock platform clients and validate outbound payload/schema behavior
+- for reusable capability-first testing guidance, use `standards/scenario-testing/AGENTS.md` as the entrypoint; project-specific scenario coverage should follow that standard
- for multi-step auth/setup flows, add or update a closed-loop scenario harness case under `tests/test_agent_auth_setup_scenarios.py`; keep provider-specific parsing and heuristics in focused unit tests
- for UI changes, run `npm run build` in `ui/`
- for cross-platform or user-facing verification, use the Docker regression workflow
diff --git a/standards/scenario-testing/AGENTS.md b/standards/scenario-testing/AGENTS.md
new file mode 100644
index 000000000..42248e009
--- /dev/null
+++ b/standards/scenario-testing/AGENTS.md
@@ -0,0 +1,64 @@
+# Scenario Testing Standard
+
+This directory is a portable standard package for capability-first, scenario-driven testing.
+
+Treat this folder as the entrypoint when you are doing any of the following:
+
+- designing or refactoring a project's testing architecture
+- introducing scenario-harness or closed-loop flow testing
+- defining reusable testing standards that should survive beyond one repository
+- translating recurring manual regressions into stable automated coverage
+
+## Mission
+
+Build a testing system where feature work and bug fixes are validated as user-visible capability flows, not only as isolated unit behaviors.
+
+The goal is not to replace unit tests or E2E tests.
+The goal is to add a reusable middle layer that answers:
+
+- what capability is being changed
+- what scenarios define its success and failure boundaries
+- what parts can be simulated deterministically
+- what still requires contract, smoke, or manual verification
+
+## Operating Rules
+
+1. Start from capabilities, not files, modules, or bugs.
+2. Require stable scenario IDs and reusable scenario catalogs.
+3. Prefer shared harness primitives over one-off mocks.
+4. Keep the harness light enough for everyday development use.
+5. Turn the standard into delivery rules, not just reference docs.
+
+## Folder Map
+
+- `README.md`
+ Overview and intended reuse model.
+- `STANDARD.md`
+ The core methodology and testing pyramid.
+- `WORKFLOW.md`
+ The day-to-day workflow for feature work, bug fixes, reviews, and CI.
+- `templates/`
+ Reusable templates for capability specs, scenario catalogs, and PR checklists.
+- `examples/`
+ Concrete project mappings. These explain how one repo applies the standard without redefining the standard itself.
+
+## Expected Outputs
+
+For a project adopting this standard, the normal outputs are:
+
+- a capability spec
+- a scenario catalog with stable IDs
+- a reusable scenario harness layer
+- project-specific reference scenarios
+- PR/CI rules that enforce the standard
+
+## Non-Goals
+
+- inventing a heavy generic workflow engine up front
+- forcing all real-world verification into automation
+- replacing focused unit tests with giant scenario tests
+- coupling the standard to Vibe Remote specifics
+
+## Adoption Rule
+
+When you add or modify a testing standard in this repository, update the project-specific guidance to point back to this folder rather than duplicating the standard elsewhere.
diff --git a/standards/scenario-testing/README.md b/standards/scenario-testing/README.md
new file mode 100644
index 000000000..704202c74
--- /dev/null
+++ b/standards/scenario-testing/README.md
@@ -0,0 +1,74 @@
+# Scenario Testing Standard
+
+This package is intended to become a standalone, reusable standard for capability-first testing.
+
+It is being incubated inside this repository first because Vibe Remote already has the right kind of system pressure:
+
+- multi-step user flows
+- external CLIs and SDKs
+- real IM transport boundaries
+- partial automation plus unavoidable manual verification
+
+That makes it a good proving ground, but the standard itself is not Vibe Remote-specific.
+
+## What This Standard Solves
+
+Many teams already have:
+
+- unit tests for local logic
+- integration tests for selected adapters
+- manual regression for full user journeys
+
+The gap is the middle layer:
+
+- a feature can pass unit tests but still fail as a complete flow
+- a bug fix can address one branch but silently break the surrounding journey
+- reviewers can validate local diffs but still miss flow closure regressions
+
+This standard fills that gap with scenario-driven, closed-loop capability testing.
+
+## Core Idea
+
+The primary development object is a **capability**, not a file or helper function.
+
+Each capability owns:
+
+- a capability spec
+- a scenario catalog
+- a reusable scenario harness
+- a delivery rule for PRs and CI
+
+## Package Layout
+
+- `AGENTS.md`
+ Entry instructions for future agents or subagents working on this standard.
+- `STANDARD.md`
+ The testing model and terminology.
+- `WORKFLOW.md`
+ The recommended development and review process.
+- `templates/`
+ Reusable authoring templates.
+- `examples/`
+ Project-specific mappings and reference implementations.
+
+## How To Adopt It In A Project
+
+1. Define capabilities in user-visible terms.
+2. Create a scenario catalog with stable IDs.
+3. Build a lightweight harness layer with reusable fakes and probes.
+4. Map the project's existing tests into:
+ - unit
+ - contract
+ - scenario
+ - smoke/manual
+5. Make scenario coverage part of feature and bug-fix delivery.
+
+## Why It Is Package-Shaped
+
+This directory is structured so it can later be moved into its own repository with minimal changes.
+
+The intended future is:
+
+- a standalone repo for the standard
+- a dedicated subagent that helps teams apply it
+- one or more project adapters or examples layered on top
diff --git a/standards/scenario-testing/STANDARD.md b/standards/scenario-testing/STANDARD.md
new file mode 100644
index 000000000..39779dda7
--- /dev/null
+++ b/standards/scenario-testing/STANDARD.md
@@ -0,0 +1,178 @@
+# Standard
+
+## 1. Testing Model
+
+The testing model is capability-first.
+
+The development question is not:
+
+- which function changed
+- which module changed
+- which backend changed
+
+The development question is:
+
+- which user-visible capability changed
+- what scenarios define correctness for that capability
+- which layers of evidence now need to be updated
+
+## 2. Layers Of Evidence
+
+Every capability should be validated through four distinct layers.
+
+### Unit
+
+Purpose:
+
+- local logic
+- parsing
+- heuristics
+- invariant enforcement
+
+Typical traits:
+
+- fast
+- deterministic
+- narrow
+- implementation-proximate
+
+### Contract
+
+Purpose:
+
+- validate the boundary between the system and a dependency or adapter
+
+Typical examples:
+
+- CLI wrapper request shape
+- SDK control-channel payload shape
+- HTTP auth endpoint contract
+- platform adapter message schema
+
+### Scenario
+
+Purpose:
+
+- prove that a capability closes as a user journey inside the service boundary
+
+Typical scope:
+
+- start flow
+- accept follow-up input
+- simulate external completion
+- verify terminal state
+- assert user-visible outputs
+
+Scenario tests should be:
+
+- capability-shaped
+- deterministic
+- built on reusable harness primitives
+
+### Smoke / Manual
+
+Purpose:
+
+- real external systems
+- real accounts
+- real transports
+- final integration confidence
+
+These are still required when the project depends on OAuth pages, IM platforms, or vendor CLIs that cannot be fully simulated with high confidence.
+
+## 3. Core Objects
+
+### Capability
+
+A user-visible behavior the system owns.
+
+Examples:
+
+- IM-driven backend auth recovery
+- upload and attach a local file to an IM conversation
+- schedule a delayed follow-up and deliver it into the correct thread
+
+### Scenario
+
+A stable, named flow that demonstrates one meaningful behavior of a capability.
+
+Scenarios should have:
+
+- stable ID
+- short name
+- actor
+- trigger
+- external conditions
+- expected outputs
+
+### Harness
+
+The reusable test apparatus that drives scenarios.
+
+Harness primitives should be shared, not rewritten per scenario.
+
+Examples:
+
+- fake transport
+- fake process runner
+- fake OAuth callback source
+- fake persistence store
+- probes for sent messages, state transitions, refresh hooks
+
+## 4. Scenario Catalog Rules
+
+Each capability must maintain a scenario catalog.
+
+Scenario IDs should be stable and human-usable:
+
+- `AUTH-SETUP-001`
+- `AUTH-SETUP-101`
+- `ATTACHMENT-002`
+
+Recommended bands:
+
+- `001-099` happy paths
+- `100-199` negative or validation paths
+- `200-299` recovery or retry paths
+- `900+` known historical regressions
+
+Each scenario entry should describe:
+
+- `Given`
+- `When`
+- `Then`
+- automation layer
+- current test owner
+
+## 5. Harness Design Rules
+
+### Preferred Design
+
+Use a lightweight scenario harness made of reusable ports and fakes.
+
+Good harnesses:
+
+- drive real public service APIs where possible
+- simulate only the external boundary
+- capture transcripts and terminal outputs
+- are cheap to extend
+
+### Avoid
+
+- giant one-off mocks per test
+- hardcoded assertions copied across scenarios
+- harnesses that mirror the production implementation too closely
+- full E2E infrastructure when a service-boundary scenario would do
+
+## 6. Delivery Standard
+
+Every feature or bug fix that changes a capability must update the relevant testing evidence.
+
+Minimum rule:
+
+1. update the capability/scenario definition if behavior changed
+2. add or update unit tests for local logic changes
+3. add or update scenario coverage when the capability flow changed
+4. document remaining manual validation explicitly
+
+This standard is only complete when PR review and CI both treat scenario coverage as a first-class requirement.
diff --git a/standards/scenario-testing/WORKFLOW.md b/standards/scenario-testing/WORKFLOW.md
new file mode 100644
index 000000000..00533c24a
--- /dev/null
+++ b/standards/scenario-testing/WORKFLOW.md
@@ -0,0 +1,66 @@
+# Workflow
+
+## Feature Workflow
+
+When adding a feature:
+
+1. Identify the capability being introduced or changed.
+2. Update or create the capability spec.
+3. Update or create the scenario catalog.
+4. Implement the smallest relevant unit and contract tests.
+5. Add or update at least one closed-loop scenario.
+6. Record any residual manual checks.
+
+## Bug Fix Workflow
+
+When fixing a bug:
+
+1. Identify the capability that failed.
+2. Map the bug to an existing scenario ID, or create a new regression scenario ID.
+3. Add the narrow unit/contract test if the root cause is local.
+4. Add or update the scenario test that proves the user journey now closes.
+5. Document why the previous test layers did not catch it.
+
+## Review Workflow
+
+Reviewers should ask:
+
+1. What capability changed?
+2. Which scenario IDs were affected?
+3. Does the PR update the right layer of evidence?
+4. If the bug was flow-level, where is the scenario coverage?
+5. What remains intentionally manual?
+
+## CI Workflow
+
+Projects adopting this standard should evolve toward:
+
+- fast unit and contract checks on every change
+- targeted scenario suites for affected capabilities
+- smaller smoke/manual matrices for external systems
+
+CI does not need to run all scenario suites at once on day one.
+It does need a path toward capability-aware regression gates.
+
+## Change Management
+
+Avoid introducing the standard as a single giant migration.
+
+Preferred rollout:
+
+1. choose one high-pain capability
+2. create the first scenario catalog
+3. build the smallest reusable harness layer
+4. prove value through one or two regressions caught earlier
+5. generalize the harness only after repeated reuse
+
+## Documentation Rule
+
+Do not hide scenario knowledge only in PR comments or issue threads.
+
+By the time a change is merged, the durable artifacts should live in:
+
+- the capability spec
+- the scenario catalog
+- the scenario tests
+- the PR/testing checklist
diff --git a/standards/scenario-testing/examples/vibe-remote-auth-setup.md b/standards/scenario-testing/examples/vibe-remote-auth-setup.md
new file mode 100644
index 000000000..abedceb25
--- /dev/null
+++ b/standards/scenario-testing/examples/vibe-remote-auth-setup.md
@@ -0,0 +1,54 @@
+# Vibe Remote Example: Auth Setup
+
+This is a reference mapping of the standard onto one Vibe Remote capability.
+
+It is intentionally an example, not the standard itself.
+
+## Capability
+
+`IM-driven backend auth recovery`
+
+## Why This Capability Matters
+
+This capability spans:
+
+- IM command handling
+- backend-specific auth setup flows
+- external CLIs and SDKs
+- runtime refresh after auth success
+- user-visible success and failure messaging
+
+It is exactly the kind of cross-cutting flow that can pass unit tests while still failing as a user journey.
+
+## Reference Scenario IDs
+
+- `AUTH-SETUP-001` Codex device auth happy path
+- `AUTH-SETUP-002` Claude manual callback happy path
+- `AUTH-SETUP-003` OpenCode direct key happy path
+- `AUTH-SETUP-101` plain chat must not be consumed as setup input
+- `AUTH-SETUP-201` expired auth recovery must emit the reset path
+- `AUTH-SETUP-901` setup starts but never emits terminal completion
+
+## Current Project Mapping
+
+Reference implementation currently lives in:
+
+- `tests/test_agent_auth_setup_scenarios.py`
+- `docs/regression/AUTH_SETUP_SCENARIOS.md`
+
+These are project artifacts, not the reusable standard package itself.
+
+## Example Harness Boundary
+
+Inside the scenario harness:
+
+- fake IM client
+- fake process completion
+- fake control-channel completion
+- fake runtime refresh hooks
+
+Outside the scenario harness:
+
+- real provider OAuth pages
+- real IM platform transports
+- real external accounts and credentials
diff --git a/standards/scenario-testing/templates/capability-spec.md b/standards/scenario-testing/templates/capability-spec.md
new file mode 100644
index 000000000..044fc14c8
--- /dev/null
+++ b/standards/scenario-testing/templates/capability-spec.md
@@ -0,0 +1,52 @@
+# Capability Spec Template
+
+## Capability
+
+Name:
+
+Owner area:
+
+## User Goal
+
+What user-visible outcome does this capability provide?
+
+## Actors
+
+- primary user
+- system components
+- external services
+
+## Triggers
+
+What starts the capability?
+
+## Success Outputs
+
+What does success look like to the user?
+
+## Failure Outputs
+
+What does failure look like to the user?
+
+## Key State Transitions
+
+- state A -> state B
+- state B -> state C
+
+## External Dependencies
+
+- CLI
+- SDK
+- provider API
+- IM platform
+
+## Observability
+
+What logs, events, probes, or persisted state help verify behavior?
+
+## Test Mapping
+
+- unit:
+- contract:
+- scenario:
+- smoke/manual:
diff --git a/standards/scenario-testing/templates/pr-checklist.md b/standards/scenario-testing/templates/pr-checklist.md
new file mode 100644
index 000000000..26381bd07
--- /dev/null
+++ b/standards/scenario-testing/templates/pr-checklist.md
@@ -0,0 +1,9 @@
+# Scenario Testing PR Checklist
+
+- Capability identified in user-visible terms
+- Scenario IDs listed in PR description
+- Unit tests added or updated for local logic changes
+- Contract tests added or updated for boundary changes
+- Scenario coverage added or updated for flow-level changes
+- Residual smoke/manual checks explicitly listed
+- Historical regression scenario added when fixing a flow-level bug
diff --git a/standards/scenario-testing/templates/scenario-catalog.md b/standards/scenario-testing/templates/scenario-catalog.md
new file mode 100644
index 000000000..608ab7cdf
--- /dev/null
+++ b/standards/scenario-testing/templates/scenario-catalog.md
@@ -0,0 +1,34 @@
+# Scenario Catalog Template
+
+## Capability
+
+Capability name:
+
+## Scenarios
+
+### `<CAPABILITY>-001 <short name>`
+
+- Type: happy path
+- Layer: scenario
+- Given:
+- When:
+- Then:
+- Notes:
+
+### `<CAPABILITY>-101 <short name>`
+
+- Type: negative path
+- Layer: unit / scenario / contract
+- Given:
+- When:
+- Then:
+- Notes:
+
+### `<CAPABILITY>-201 <short name>`
+
+- Type: recovery / retry
+- Layer: scenario
+- Given:
+- When:
+- Then:
+- Notes: