Initial import of streamline
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { readFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
function source(name: string): string {
|
||||
return readFileSync(path.join(import.meta.dir, "..", "src", name), "utf8");
|
||||
}
|
||||
|
||||
describe("security Cursor account monitoring wiring", () => {
|
||||
test("evaluate and run both classify exhaustion and probe quota after success", () => {
|
||||
for (const file of ["security_evaluator.ts", "security_runner.ts"]) {
|
||||
const text = source(file);
|
||||
expect(text).toContain("handleSecurityAccountExhausted");
|
||||
expect(text).toContain("monitorSecurityAccountAfterSuccess");
|
||||
expect(text).toContain('"AGENT_USAGE_LIMIT"');
|
||||
expect(text).toContain("providerFailure");
|
||||
expect(text).toContain('AGENT_PROVIDER === "cursor"');
|
||||
}
|
||||
});
|
||||
|
||||
test("the persistent account drain guards both unified claim loops", () => {
|
||||
expect(source("evaluator.ts")).toContain("isAgentAccountClaimDrained()");
|
||||
expect(source("runner.ts")).toContain("isAgentAccountClaimDrained()");
|
||||
});
|
||||
|
||||
test("quota probing stays out of feature and bug execution paths", () => {
|
||||
for (const file of ["feature_evaluator.ts", "feature_runner.ts"]) {
|
||||
const text = source(file);
|
||||
expect(text).not.toContain("monitorSecurityAccountAfterSuccess");
|
||||
expect(text).not.toContain("handleSecurityAccountExhausted");
|
||||
}
|
||||
});
|
||||
|
||||
test("only security evaluate opts into Cursor CLI diagnostics without a session ledger", () => {
|
||||
expect(source("security_evaluator.ts")).toContain('[AGENT_SESSION_KIND_ENV]: "security"');
|
||||
for (const file of ["evaluator.ts", "feature_evaluator.ts", "asking.ts"]) {
|
||||
expect(source(file)).not.toContain('[AGENT_SESSION_KIND_ENV]: "security"');
|
||||
}
|
||||
});
|
||||
|
||||
test("security uses the validated startup pre hook and records the business workaround", () => {
|
||||
const text = source("security_runner.ts");
|
||||
expect(text).toContain("security-tiktok-run-pre_2610131148.sh");
|
||||
expect(text).toContain("STREAMLINE_SECURITY_PATCH_URL: _securityPatchUrl");
|
||||
expect(text).toContain("SecurityPreparation.json");
|
||||
expect(text).toContain("live_hot_update_fix");
|
||||
expect(text).toContain("original targetRef's behavior");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user