mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-01 01:24:30 +01:00
test(server): drop heartbeat run-log cases duplicated by the module suite (#23191)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The heartbeat run-log pipeline redacts secrets and images from chunks with `compactRunLogChunk`, then truncates oversized chunks. > - Two suites cover this function: `server/src/__tests__/heartbeat-run-log.test.ts` and the module suite `server/src/services/heartbeat/run-log.test.ts`. Both run in the default general-server lane. > - Two of the four cases in the `__tests__` file repeat contracts the module suite already proves with stronger, exact assertions (image-data redaction with the exact 1024-character threshold and consistency; truncation with exact head/tail/omission output and a redaction-before-truncation ordering check). > - This pull request deletes the two duplicated cases and keeps the two cases with unique coverage (Paperclip credential-shape redaction and the long-base64 performance guard). > - The benefit is less duplicated test code and two fewer executions of the same production path with no loss of failure detection. ## Linked Issues or Issue Description No public issue exists. Problem description: duplicated test coverage for `compactRunLogChunk`. The `__tests__/heartbeat-run-log.test.ts` suite was checking image-data redaction and chunk truncation through `compactRunLogChunk`, while `services/heartbeat/run-log.test.ts` proves the same contracts with exact boundary assertions. ## What Changed - Deleted "redacts inline base64 image data from structured log chunks" from `server/src/__tests__/heartbeat-run-log.test.ts`. Retained coverage: `services/heartbeat/run-log.test.ts` "preserves the image omission threshold at %i characters" (exact 1023/1024 boundary) and "omits every large image consistently across repeated calls". - Deleted "truncates oversized chunks after sanitizing them" from the same file. Retained coverage: "keeps the existing head, tail, and omission count for a custom limit" (exact truncation output) and "redacts credentials and image data before deciding whether a chunk needs truncation" (ordering proof). - Kept "redacts Paperclip credential shapes before persisting run-log chunks" (unique PAPERCLIP_API_KEY env/JSON/flag and refresh-token shapes) and "redacts a tool call that writes base64 of source text without stalling" (performance guard) unchanged. ## Verification - `npx vitest run src/__tests__/heartbeat-run-log.test.ts src/services/heartbeat/run-log.test.ts` (in `server/`): 2 files, 26 tests passed. - `npx tsc --noEmit -p .` (server package): clean. - Both files are selected in the default general-server lane per `scripts/general-server-shard-durations.json`. - Full CI (typecheck, all lanes, Greptile) runs on this PR; local runs of the full suite were not performed. ## Risks Low risk. Deletion-only change to one test file; production code is untouched. If a future regression removes image redaction or truncation, the retained services-level cases fail at their assertions. ## Model Used GLM (Z.ai) — openrouter/z-ai/glm-5.3, used via the Paperclip runner for test-suite analysis and this change. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes: #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [ ] I will address all Greptile and reviewer comments before requesting merge Co-Authored-By: Paperclip <Paperclip-Paperclip@users.noreply.github.com>
This commit is contained in:
1 parent
1847abcd91
commit
63fffa8fcb
1 file changed
-20
@@ -2,26 +2,6 @@ import { describe, expect, it } from "vitest";
|
||||
import { compactRunLogChunk } from "../services/heartbeat.js";
|
||||
|
||||
describe("compactRunLogChunk", () => {
|
||||
it("redacts inline base64 image data from structured log chunks", () => {
|
||||
const base64 = "A".repeat(4096);
|
||||
const chunk = `{"type":"user","message":{"content":[{"type":"image","source":{"type":"base64","data":"${base64}"}}]}}\n`;
|
||||
|
||||
const compacted = compactRunLogChunk(chunk);
|
||||
|
||||
expect(compacted).not.toContain(base64);
|
||||
expect(compacted).toContain("[omitted base64 image data: 4096 chars]");
|
||||
});
|
||||
|
||||
it("truncates oversized chunks after sanitizing them", () => {
|
||||
const chunk = `${"x".repeat(90_000)}tail`;
|
||||
|
||||
const compacted = compactRunLogChunk(chunk, 16_384);
|
||||
|
||||
expect(compacted.length).toBeLessThan(chunk.length);
|
||||
expect(compacted).toContain("[paperclip truncated run log chunk:");
|
||||
expect(compacted.endsWith("tail")).toBe(true);
|
||||
});
|
||||
|
||||
it("redacts Paperclip credential shapes before persisting run-log chunks", () => {
|
||||
const chunk = [
|
||||
"Authorization: Bearer live-bearer-token-value",
|
||||
|
||||
Reference in new issue
Block a user