Skip to content

test(consequence): a host denial turns a service-level approval into a decline - #161

Merged
M3gA-Mind merged 2 commits into
tinyhumansai:mainfrom
M3gA-Mind:test/host-denial-declines-approval
Oct 23, 2026
Merged

M3gA-Mind merged 2 commits into
tinyhumansai:mainfrom
M3gA-Mind:test/host-denial-declines-approval

Conversation

@M3gA-Mind

Copy link
Copy Markdown
Contributor

Summary

Test-only. When the host serves ConsequenceHost, ContinueTask asks it to review the action a task is paused on before an approval reaches the task, and a denial turns the approval into a decline (review_approval). The link itself is unit-tested, but nothing exercised it at the service, where the paused action is looked up from the task list. A regression there would let an approved irreversible action run with no host review.

This adds a service-level test. A scripted flow runner stops before pressing "Send"; the task pauses at NeedsApproval; ContinueTask { approve: true } goes through a host that denies. The test asserts the task ends Cancelled, the host was asked exactly once about "Send", and no flow run was allowed to act (allow_destructive never set).

Not changed here: RunFlow { allow_destructive: true } and RunGoal's approval path do not go through this review. Whether they should is an open owner decision, so this PR only pins the ContinueTask path.

Related issue

None.

API or behavior changes

None.

Validation

Commands actually run, with their outcome:

  • N/A: cargo fmt --all -- --check: rustfmt run on the new file only; CI runs the full check
  • N/A: cargo clippy --all-targets --all-features -- -D warnings: left to CI
  • N/A: cargo build --all-targets --all-features: left to CI
  • N/A: cargo test --all-features: only the new test was run locally (below); CI runs the suite

CARGO_INCREMENTAL=0 cargo test -p tinycomputer --lib -- a_host_denial_turns_an_approval_into_a_decline

  • Current code: ok. 1 passed; 0 failed.
  • With review_approval made to return before asking the host (a temporary local break, restored before commit): FAILED, left: Done { answer: "Finished all 2 steps." … } right: Cancelled.

Tests

New tinybus_module_tests/consequence_review_tests.rs::a_host_denial_turns_an_approval_into_a_decline.

Documentation

Not needed.

Checklist

  • The change is focused on one logical change
  • No new #[allow(...)], #[ignore], or relaxed lints
  • No secrets, tokens, or .env contents in the diff or the description

…a decline

Pins review_approval at the service: a task paused at NeedsApproval,
approved over ContinueTask, is declined when the host's consequence
review denies it; the host is asked once and no run is allowed to act.
@tinysweeper

tinysweeper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Reviewed head: 5a29fd0104782a0c460d192ed69552fa1a35daef

Verdict: Ready for maintainer review · Priority: none
Coverage: Reviewed 2 of 2 files.
Pull request purpose (title): test(consequence): a…

Diagnostics and supporting details

Full summary

Pull request purpose (title): test(consequence): a host denial turns a service-level approval into a decline. Test-only change that pins service-level behavior for host consequence review: when a task paused at `NeedsApproval` receives `ContinueTask { approve: true }` and the configured consequence host denies the action, the approval becomes a decline and the task ends `Cancelled`. The scripted `FlowRunResult` is constructed with an explicit empty `BTreeMap` for `vars`. The description notes that `RunFlow { allow_destructive: true }` and `RunGoal`'s approval path are intentionally untouched, leaving whether they should also be reviewed as an open owner decision.

Review snapshot

Change surface Files Review signal Count
Production 0 Active findings 0
Tests 2 Noted findings 0
Documentation 0 Resolved findings 0
Configuration 0 Pending checks/questions 0

Completeness: Complete
Test assessment: No supported feature-to-test mapping was available; this does not mean tests are absent or passed.

What changed

Adds a new test module `crates/tinycomputer/src/tinybus_module/tinybus_module_tests/consequence_review_tests.rs` and registers it via `mod consequence_review_tests;` in `crates/tinycomputer/src/tinybus_module/tinybus_module_tests.rs`. The test builds a real `DesktopService` with `with_consequence_review` and a deny-only `ConsequencePort`, injects a scripted `FlowRunner` that stops before the "Send" action, and drives `START_TASK` → `AWAIT_TASK` → `CONTINUE_TASK { approve: true }` → `AWAIT_TASK`. No production code is changed.

Features

  • Added — Service-level test for host consequence denial on the ContinueTask approval path: Pins that a denial from the host's consequence review on the `ContinueTask` approval path reaches the task as a decline and ends it `Cancelled`, while no flow run is granted `allow_destructive`. This is the behavior the PR description states should be pinned, since a regression here would let an approved irreversible action run with no host review. (crates/tinycomputer/src/tinybus_module/tinybus_module_tests/consequence_review_tests.rs, crates/tinycomputer/src/tinybus_module/tinybus_module_tests.rs use serde_json::json;)

Tests

No supported feature-to-test mapping was produced. Test execution is not inferred.

Findings

No active actionable findings.

Before merge

None.

Agent review details

critique

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: This adds a service-level test that a host denial turns an approval into a cancellation. The test is deterministic, network-free, and asserts both the stage result and that no run was allowed to act; I found no defect worth reporting. Two details I could not check against the reviewed head: the full `FlowRunner` trait in `crates/tinycomputer-engine/src/task/mod.rs` (whether `run` is the only required method and whether `TaskConstraints` is the third parameter type) and whether `serde_json` serialization of `TaskId` in the `awaited` helper matches `TaskId`'s wire form. _The code index is behind this pull request (indexed at `b801cf2bc069`), so retrieved context may be out of date._

security

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The security lane reported no defect: the new test file calls into definitions already visible and contains no attacker-controlled input path or dangerous sink.
  • Lane summary: This new test file adds an integration test for the consequence review path and its fixtures (a fake runner and a denying host). It calls into definitions already visible and contains no attacker-controlled input path or dangerous sink; I found no defect in it. _The code index is behind this pull request (indexed at `b801cf2bc069`), so retrieved context may be out of date._

tests

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The tests lane confirmed the only change is a new test module plus its `mod` declaration, that it exercises the denial branch via a real `DesktopService`, and that the referenced names are consistent with surrounding repository code.
  • Lane summary: The only change in this revision is a new test module, `consequence_review_tests.rs`, plus its `mod` declaration. It drives the real service through `CONTINUE_TASK` with an injected denying `ConsequencePort` and asserts the observable consequence — the task ends `Cancelled`, the host is asked exactly once for target "Send", and no run was ever allowed to act destructively — so it is a genuine behavioural test, not an assertion on a mock call count alone, and it covers the denial branch that `with_consequence_review` introduces. It follows the repo's testing rules (lives in `*_tests/`, has a `//!` header, deterministic, no env vars). I found no defect in the diff: names like `FlowRunResult`, `StepReport`, `Tasks::new`, `service()`, and the `.tasks` field are all referenced consistently with the surrounding repository code shown, and I have no evidence any of them is missing. I did not add lookups, so I cannot vouch for parts of `tinycomputer-engine`'s test-support surface I was not shown, but nothing in the diff suggests a compile or behaviour problem. _The code index is behind this pull request (indexed at `b801cf2bc069`), so retrieved context may be out of date._

commits

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The commits lane found no sensitive content in committed files.
  • Lane summary: No sensitive content in committed files. _The code index is behind this pull request (indexed at `b801cf2bc069`), so retrieved context may be out of date._

description

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The description lane found the change matches the PR body: a deterministic, test-only addition with a module-level `//!` header, describing the same `ContinueTask` denial behavior the diff exercises.
  • Lane summary: Test-only change adding a service-level test that a host denial turns a `ContinueTask` approval into a cancellation; the test is deterministic and matches the described behaviour. One gap: the new test module lacks the module-level `//!` doc its file header rule requires — actually the file has one, so the change looks sound. Wait — I should not hedge; the module file opens with a module-level `//!` description as required, and the diff matches the PR body. _The code index is behind this pull request (indexed at `b801cf2bc069`), so retrieved context may be out of date._
Evidence and run details
  • Models: ladder/vectors-oai3, deepseek-v4.1-flash
  • Spend: $0.000514
  • Tokens: 182738 input · 5085 output · 38912 cached · 302 embedding
  • Updated: 2026-10-23T03:07:54Z
Head State Pass summary
20424fb8fb54 ready for maintainer review 0 active finding(s), 0 resolved finding(s) (at 2026-10-23T01:49:32Z)
5a29fd010478 ready for maintainer review 0 active finding(s), 0 resolved finding(s) (at 2026-10-23T03:07:54Z)

tinysweeper 0.1.2

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d796eeb6-e795-4afd-916a-d1e08817c403
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tinysweeper found nothing blocking. Approving.

Diagnostics

Total spend: $0.0064

clippy::default_trait_access under -D warnings.
@M3gA-Mind
M3gA-Mind merged commit 6388f99 into tinyhumansai:main Oct 23, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant