Files
buzz/desktop/src/features/projects/projectChannelRequest.test.mjs
thomaspblock de188ebf06 feat(projects): add agent and CLI project-home support (#6590)
## Summary
- inject bounded project-home identity and repository context into
managed agent sessions
- add project-aware CLI flows for creating projects, repositories,
issues, and related channels
- match project homes through the existing relay query surface, then
filter channel metadata client-side

This is Part 1 of the channel-first Projects stack. Part 2 contains
project creation and model foundations.

## Testing
- `cargo fmt --all -- --check`
- `cargo clippy -p buzz-cli -p buzz-acp --all-targets -- -D warnings`
- `cargo test -p buzz-cli -p buzz-acp` — 1,184 tests passed, 1 doc test
ignored
- full pre-push gate passed

## Post-Deploy Monitoring & Validation
- validate project-home agent context and project-aware CLI commands
against a staging relay
- healthy signals: project context matches the active channel, explicit
repo coordinates remain stable, and normal channels receive no project
block
- failure signals: cross-channel project context, duplicate project
creation, or commands targeting an unrelated repository; mitigate by
reverting this PR

---------

Signed-off-by: Thomas Petersen <thomasp@squareup.com>
Signed-off-by: Wrench <0eabe6ea5758c1e4c5b68cea4ac42b32c479072883cb28da8110b4a47c32b9a1@buzz.block.builderlab.xyz>
Co-authored-by: Wrench <0eabe6ea5758c1e4c5b68cea4ac42b32c479072883cb28da8110b4a47c32b9a1@buzz.block.builderlab.xyz>
2026-08-26 12:09:06 -07:00

71 lines
1.6 KiB
JavaScript

import assert from "node:assert/strict";
import test from "node:test";
import {
parseProjectChannelRequest,
PROJECT_CHANNEL_REQUEST,
} from "./projectChannelRequest.ts";
const HOME_CHANNEL = "11111111-1111-4111-8111-111111111111";
test("parses a narrow project channel request", () => {
assert.deepEqual(
parseProjectChannelRequest({
type: PROJECT_CHANNEL_REQUEST,
action: "create",
requestId: "request-1",
request: {
homeChannelId: HOME_CHANNEL,
name: "release-planning",
description: "Coordinate the release.",
visibility: "private",
ttlSeconds: 3600,
templateName: "Release team",
},
}),
{
type: PROJECT_CHANNEL_REQUEST,
action: "create",
requestId: "request-1",
request: {
homeChannelId: HOME_CHANNEL,
name: "release-planning",
description: "Coordinate the release.",
visibility: "private",
ttlSeconds: 3600,
templateName: "Release team",
},
},
);
});
test("rejects unknown fields and invalid values", () => {
assert.equal(
parseProjectChannelRequest({
type: PROJECT_CHANNEL_REQUEST,
action: "create",
requestId: "request-1",
request: {
homeChannelId: HOME_CHANNEL,
name: "release",
visibility: "public",
},
}),
null,
);
assert.equal(
parseProjectChannelRequest({
type: PROJECT_CHANNEL_REQUEST,
action: "create",
requestId: "request-1",
request: {
homeChannelId: HOME_CHANNEL,
name: "release",
visibility: "open",
secret: "nope",
},
}),
null,
);
});