fix(aws): stop guard review round 1

The stop guard's choice now reaches the workspace: after a successful
push (or for Stop without pushing) the app records pushed/discard in
/run/triple-c/stop-reason as root, and the entrypoint's shutdown hook
then skips its own push; a marker that can't be written is reported
and the stop goes on. The push runs before the auth bridge is stopped;
a guarded stop of a workspace that already stopped succeeds. The
Fargate table allows only 512/1024/2048 MiB with 256 CPU, pinned on
both sides by a shared fixture. Removal's missing-connection refusal
carries a stable prefix. OpenAI Compatible is allowed on AWS, with a
warning for local addresses and the app's own gateway. HostSection
locks resource actions unless Stopped, the add dialog drops the
environment on a region change, and the repository editor keeps rows
in progress across a refresh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shadowdaoandClaude Opus 5.5 committed 2026-11-15 10:26:53 -08:00
1 parent eb7c6c7b21
commit 8441a096c8
26 files changed
+780 -193

No files matched your search

@@ -875,6 +875,34 @@ fn aws_stop_runs_the_wip_push_with_the_recorded_reason_once() {
assert!(!log.exists(), "WIP push off");
}
#[test]
fn aws_stop_skips_its_push_when_the_app_already_pushed_or_the_user_declined() {
let tmp = tempfile::tempdir().unwrap();
let log = tmp.path().join("calls");
let fake = write_script(
tmp.path(),
"triple-c-wip-push",
&format!("#!/bin/bash\necho \"$*\" >> '{}'\n", log.display()),
);
let reason = tmp.path().join("reason");
let blocks = aws_blocks(&["aws_env", "aws_stop"])
.replace("/usr/local/bin/triple-c-wip-push", fake.to_str().unwrap())
.replace("/run/triple-c/stop-reason", reason.to_str().unwrap());
let script = format!("{blocks}\naws_before_stop\n");
for marker in ["pushed", "discard"] {
fs::write(&reason, format!("{marker}\n")).unwrap();
let out = bash(&script, &[], &[("TRIPLEC_HOST", "aws"), ("TRIPLEC_WIP_PUSH", "1")], &[]);
assert!(out.status.success(), "{}", text(&out));
assert!(!log.exists(), "{marker}: no second push");
assert!(text(&out).contains(&format!("already handled by Triple-C ({marker})")), "{}", text(&out));
}
// Anything else is not a marker the app writes: the push still runs.
fs::write(&reason, "something-else\n").unwrap();
let out = bash(&script, &[], &[("TRIPLEC_HOST", "aws"), ("TRIPLEC_WIP_PUSH", "1")], &[]);
assert!(out.status.success(), "{}", text(&out));
assert_eq!(fs::read_to_string(&log).unwrap(), "--reason sigterm\n");
}
#[test]
fn docker_mode_never_reaches_the_aws_blocks() {
// Every new step sits behind TRIPLEC_HOST=aws; the scripts are only