TestWarnPromptTmpPaths tests the /tmp path heuristic used by the compiler.
(t *testing.T)
| 505 | |
| 506 | // TestWarnPromptTmpPaths tests the /tmp path heuristic used by the compiler. |
| 507 | func TestWarnPromptTmpPaths(t *testing.T) { |
| 508 | tests := []struct { |
| 509 | name string |
| 510 | content string |
| 511 | expectWarning bool |
| 512 | }{ |
| 513 | { |
| 514 | name: "no tmp reference", |
| 515 | content: "# Workflow\n\nDo some work.", |
| 516 | expectWarning: false, |
| 517 | }, |
| 518 | { |
| 519 | name: "correct path /tmp/gh-aw/agent/ only", |
| 520 | content: "Store output in /tmp/gh-aw/agent/result.txt", |
| 521 | expectWarning: false, |
| 522 | }, |
| 523 | { |
| 524 | name: "correct path /tmp/gh-aw/agent/ subdirectory", |
| 525 | content: "Write to /tmp/gh-aw/agent/logs/output.log for later inspection.", |
| 526 | expectWarning: false, |
| 527 | }, |
| 528 | { |
| 529 | name: "bare /tmp/ reference", |
| 530 | content: "Save the file to /tmp/myfile.txt", |
| 531 | expectWarning: true, |
| 532 | }, |
| 533 | { |
| 534 | name: "/tmp/gh-aw/ subpath is safe", |
| 535 | content: "Write your output to /tmp/gh-aw/result.json", |
| 536 | expectWarning: false, |
| 537 | }, |
| 538 | { |
| 539 | name: "/tmp/ root only", |
| 540 | content: "Use /tmp/ for temporary storage.", |
| 541 | expectWarning: true, |
| 542 | }, |
| 543 | { |
| 544 | name: "mix of correct and raw /tmp/ reference", |
| 545 | content: "Prefer /tmp/gh-aw/agent/ but avoid plain /tmp/foo paths.", |
| 546 | expectWarning: true, |
| 547 | }, |
| 548 | { |
| 549 | name: "cache-memory path is safe", |
| 550 | content: "Read state from /tmp/gh-aw/cache-memory/my-workflow/state.json", |
| 551 | expectWarning: false, |
| 552 | }, |
| 553 | { |
| 554 | name: "named cache-memory path is safe", |
| 555 | content: "Use /tmp/gh-aw/cache-memory-focus-areas/ for storage.", |
| 556 | expectWarning: false, |
| 557 | }, |
| 558 | { |
| 559 | name: "repo-memory path is safe", |
| 560 | content: "Access shared memory at /tmp/gh-aw/repo-memory/default/metrics.json", |
| 561 | expectWarning: false, |
| 562 | }, |
| 563 | { |
| 564 | name: "comment-memory path is safe", |
nothing calls this directly
no test coverage detected