mirror of
https://github.com/block/buzz.git
synced 2026-11-14 05:12:27 +00:00
## 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>
58 lines
1.5 KiB
JavaScript
58 lines
1.5 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import { buildProjectsActivityDigest } from "./projectsActivityDigest.ts";
|
|
|
|
const NOW = 2_000_000_000;
|
|
|
|
test("summarizes recent activity in a short highlighted sentence", () => {
|
|
const project = { id: "project-a" };
|
|
const digest = buildProjectsActivityDigest({
|
|
issues: [
|
|
{ project, issue: { createdAt: NOW - 60 } },
|
|
{ project, issue: { createdAt: NOW - 120 } },
|
|
],
|
|
nowSeconds: NOW,
|
|
projects: [project],
|
|
pullRequests: [{ project, pullRequest: { createdAt: NOW - 180 } }],
|
|
snapshots: {
|
|
"project-a": {
|
|
commits: [
|
|
{ timestamp: NOW - 30 },
|
|
{ timestamp: NOW - 90 },
|
|
{ timestamp: NOW - 8 * 24 * 60 * 60 },
|
|
],
|
|
},
|
|
},
|
|
});
|
|
|
|
assert.equal(digest.prefix, "This week:");
|
|
assert.deepEqual(digest.highlights, [
|
|
"2 new commits",
|
|
"2 tasks opened",
|
|
"1 review opened",
|
|
"1 active project",
|
|
]);
|
|
assert.ok(
|
|
`${digest.prefix} ${digest.highlights.join(", ")}${digest.suffix}`.split(
|
|
/\s+/,
|
|
).length <= 30,
|
|
);
|
|
});
|
|
|
|
test("falls back to current totals when no recent activity is loaded", () => {
|
|
const digest = buildProjectsActivityDigest({
|
|
issues: [],
|
|
nowSeconds: NOW,
|
|
projects: [{ id: "a" }, { id: "b" }],
|
|
pullRequests: [],
|
|
summaries: {
|
|
a: { issueCount: 4, prCount: 2 },
|
|
b: { issueCount: 1, prCount: 3 },
|
|
},
|
|
});
|
|
|
|
assert.equal(digest.prefix, "Currently tracking");
|
|
assert.deepEqual(digest.highlights, ["2 projects", "5 tasks", "5 reviews"]);
|
|
});
|