Skip to content

Commit 0d12ef9

Browse files
dcramercodex
andcommitted
test(junior): Resolve testing cleanup merge
Merge latest main into the testing architecture cleanup. Keep resume, reporting, scheduler, and Slack tests aligned with current testing policy. Co-Authored-By: GPT-5 Codex <codex@openai.com>
2 parents 9f83298 + f9f3f0e commit 0d12ef9

131 files changed

Lines changed: 7311 additions & 720 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: CI
33
permissions:
44
contents: read
55
actions: write
6+
statuses: write
7+
pull-requests: read
68

79
on:
810
push:
@@ -42,10 +44,20 @@ jobs:
4244
- run: pnpm install --frozen-lockfile
4345
- run: pnpm release:check
4446
- run: pnpm lint
45-
- run: pnpm test
47+
- run: pnpm test:ci
4648
- run: pnpm --filter @sentry/junior-example build
4749
- run: pnpm docs:check
4850

51+
- name: Upload coverage and test results
52+
if: ${{ !cancelled() }}
53+
uses: getsentry/codecov-action@03112cc3b486a3397dc8d17a58680008721fc86f # v0.3.7
54+
with:
55+
token: ${{ secrets.GITHUB_TOKEN }}
56+
files: packages/junior/coverage/coverage-final.json,packages/junior-dashboard/coverage/coverage-final.json
57+
coverage-format: istanbul
58+
disable-search: true
59+
junit-xml-pattern: packages/**/coverage/results.junit.xml
60+
4961
- name: Pack release artifacts
5062
if: github.event_name == 'push'
5163
run: |

AGENTS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Co-Authored-By: (agent model name) <email>
6161

6262
- `policies/README.md` (when to add a policy doc and how policy docs should stay scoped)
6363
- `policies/code-comments.md` (repo default for code comments, docstrings, and exported-function JSDoc)
64+
- `policies/context-bound-systems.md` (explicit actor/destination/context propagation across runtime boundaries)
6465
- `policies/evals.md` (evals as behavior integration tests and rubric authoring boundaries)
6566
- `policies/frontend-components.md` (Tailwind colocation and component-owned frontend styling)
6667
- `policies/interface-design.md` (naming, module paths, and minimal interface boundaries)
@@ -85,7 +86,7 @@ Co-Authored-By: (agent model name) <email>
8586
- Do not leak third-party SDK types across chat subsystem boundaries when a small local interface will do; keep vendor SDKs inside infrastructure modules.
8687
- Service modules must depend on small injected ports for Slack behavior, not import Slack infrastructure directly.
8788
- Slack modules must not import runtime modules.
88-
- `runtime/` orchestrates turns and turn-scoped formatting, `services/` do domain work (reply policy, delivery planning, channel intent, attachment validation), `state/` persists by concern, `ingress/` only normalizes/routes.
89+
- `runtime/` orchestrates turns and turn-scoped formatting, `services/` do domain work (reply policy, delivery planning, channel intent, attachment validation), `state/` persists by concern, `ingress/` only parses, classifies, and routes source events.
8990
- **Feature-based colocation**: group files by domain feature, not by technical role. Within a module, create subdirectories for each feature domain (e.g., `tools/slack/`, `tools/web/`, `tools/sandbox/`, `tools/skill/`). Shared contracts and cross-cutting utilities live at the module root. Only extract to a shared location when 2+ features need the same code.
9091
- Do not use barrel `index.ts` re-exports inside feature subdirectories — import directly from the source file. A module-root `index.ts` is acceptable as a composition root that wires features together.
9192
- Queue and worker paths must depend on injected runtime interfaces or factories, not import the production singleton from `@/chat/app/production`.
@@ -115,6 +116,7 @@ Co-Authored-By: (agent model name) <email>
115116
- `specs/agent-turn-handling.md` (agent user-message response policy: reply/silence, tool use, Slack side effects, resumed turns, and completion)
116117
- `specs/slack-agent-delivery.md` (Slack entry surfaces, reply delivery, continuation, files, images, and resume behavior contract)
117118
- `specs/slack-outbound-contract.md` (Slack outbound boundary, message/file/reaction safety rules, and markdown-to-`mrkdwn` ownership)
119+
- `specs/identity.md` (current actor, system actor, requester, author, creator, credential subject, service principal, and display identity contract)
118120
- `specs/credential-injection.md` (requester-bound provider credential injection contract)
119121
- `specs/oauth-flows.md` (OAuth authorization code flow + Slack UX contract)
120122
- `specs/agent-prompt.md` (core prompt ownership, execution-bias, and bloat-control contract)

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "junior-monorepo",
33
"private": true,
4-
"packageManager": "pnpm@10.33.0",
4+
"packageManager": "pnpm@10.30.2+sha512.36cdc707e7b7940a988c9c1ecf88d084f8514b5c3f085f53a2e244c2921d3b2545bc20dd4ebe1fc245feec463bb298aecea7a63ed1f7680b877dc6379d8d0cb4",
55
"scripts": {
66
"dev": "node scripts/dev-server.mjs",
77
"dev:env": "pnpx vercel env pull .env.local --environment=development && pnpm run cloudflare:token",
@@ -23,7 +23,8 @@
2323
"evals": "pnpm --filter @sentry/junior-evals evals",
2424
"evals:record": "pnpm --filter @sentry/junior-evals evals:record",
2525
"typecheck": "pnpm --filter @sentry/junior-plugin-api typecheck && pnpm --filter @sentry/junior-scheduler typecheck && pnpm --filter @sentry/junior typecheck && pnpm --filter @sentry/junior-dashboard typecheck && pnpm --filter @sentry/junior-testing typecheck && pnpm --filter @sentry/junior-example typecheck",
26-
"skills:check": "pnpm --filter @sentry/junior skills:check"
26+
"skills:check": "pnpm --filter @sentry/junior skills:check",
27+
"test:ci": "pnpm --filter @sentry/junior build && pnpm --filter @sentry/junior-dashboard build && pnpm --filter @sentry/junior test:coverage && pnpm --filter @sentry/junior-dashboard test:coverage"
2728
},
2829
"simple-git-hooks": {
2930
"pre-commit": "pnpm lint-staged"

packages/docs/src/content/docs/operate/dashboard.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ The dashboard package owns these routes:
8181
| ------------------ | --------------------------------------- |
8282
| `/` | Authenticated command-center UI. |
8383
| `/conversations` | Authenticated conversation-history UI. |
84+
| `/plugins` | Authenticated plugin reporting UI. |
8485
| `/api/dashboard/*` | Authenticated dashboard JSON APIs. |
8586
| `/api/auth/*` | Better Auth Google login and callbacks. |
8687

@@ -95,12 +96,15 @@ The current dashboard API slices are:
9596
| `/api/dashboard/plugins` | Loaded plugin list. |
9697
| `/api/dashboard/skills` | Discovered skill list. |
9798
| `/api/dashboard/sessions` | Recent conversation feed from turn-session checkpoints. |
99+
| `/api/dashboard/conversation-stats` | Aggregate conversation stats, people/place leaderboards, and sampling metadata. |
100+
| `/api/dashboard/plugin-reports` | Sanitized trusted-plugin operational summaries. |
98101
| `/api/dashboard/conversations/:conversation` | Expiring conversation transcript; private conversations return redacted metadata only. |
99102
| `/api/dashboard/config` | Safe dashboard config signals and feature readiness. |
100103
| `/api/dashboard/me` | Signed-in dashboard identity. |
101104

102-
The dashboard UI is a React client using React Router for browser views and TanStack Query to poll dashboard APIs. `/` shows command-center health and recent turn durations; `/conversations` shows conversation history; `/conversations/:conversation` shows the transcript and turn/tool-call detail for one conversation. The dashboard does not wrap Slack webhooks, provider OAuth callbacks, sandbox egress, or `/api/internal/*`.
105+
The dashboard UI is a React client using React Router for browser views and TanStack Query to poll dashboard APIs. `/` shows command-center health, aggregate conversation stats, and recent turn durations; `/conversations` shows conversation history; `/conversations/:conversation` shows the transcript and turn/tool-call detail for one conversation; `/plugins` shows loaded plugin inventory and trusted plugin operational summaries. The dashboard does not wrap Slack webhooks, provider OAuth callbacks, sandbox egress, or `/api/internal/*`.
103106
The conversation feed is a bounded metadata index with the same expiration policy as turn-session checkpoints. Conversation detail reads transcript data from the expiring checkpoint message store, so old transcripts disappear when checkpoint state expires. When `SENTRY_DSN` initializes the runtime and `SENTRY_ORG_SLUG` is set, conversation rows include a Sentry conversation link; when the runtime captures a trace ID, conversation detail shows it with the turn metadata.
107+
The conversation stats endpoint is separate from the recent feed and includes `sampleLimit`, `sampleSize`, and `truncated` fields so the UI can mark bounded aggregates.
104108
Dashboard dates use `JUNIOR_TIMEZONE`, defaulting to `America/Los_Angeles`.
105109

106110
For local dashboard visual QA, pass `mockConversations: true` to `juniorDashboardPlugin()` or set `JUNIOR_DASHBOARD_MOCK_CONVERSATIONS=true` for the env-configured path. The sample conversations are read-only reporting fixtures and appear before real session records.

packages/docs/src/content/docs/reference/config-and-env.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ related:
1919
| `REDIS_URL` | Yes | Queue and runtime state storage. |
2020
| `JUNIOR_SECRET` | Yes | Signs internal timeout-resume and agent-dispatch callbacks, plus sandbox egress requester context. |
2121
| `JUNIOR_BOT_NAME` | No | Bot display/config naming. |
22+
| `JUNIOR_SLASH_COMMAND` | No | Slack slash command for account-management flows. Defaults to `/jr`; the Slack app command must match this value. |
2223
| `AI_MODEL` | No | Primary model selection override for main assistant turns. Defaults to `openai/gpt-5.4`; Junior chooses the reasoning effort per turn automatically. |
2324
| `AI_FAST_MODEL` | No | Faster model for lightweight tasks and routing/classification passes before the main turn begins. Defaults to `openai/gpt-5.4-mini`. |
2425
| `AI_VISION_MODEL` | No | Dedicated image-understanding model; unset disables vision features. |

packages/docs/src/content/docs/start-here/deploy-to-vercel.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Apply the URL to:
107107

108108
- Event Subscriptions
109109
- Interactivity
110-
- `/jr` slash command
110+
- Slash command configured by `JUNIOR_SLASH_COMMAND` (defaults to `/jr`)
111111

112112
Reinstall the Slack app if scopes changed.
113113

packages/docs/src/content/docs/start-here/quickstart.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Set these values before running real turns:
6363
| `REDIS_URL` | Yes | Queue and runtime state storage. |
6464
| `JUNIOR_SECRET` | Yes | Signs internal resume callbacks and sandbox requester context. |
6565
| `JUNIOR_BOT_NAME` | No | Bot display/config name. |
66+
| `JUNIOR_SLASH_COMMAND` | No | Slack slash command name. Defaults to `/jr`. |
6667
| `AI_MODEL` | No | Primary assistant model override. |
6768
| `AI_FAST_MODEL` | No | Lightweight routing/classification model override. |
6869
| `AI_VISION_MODEL` | No | Enables image understanding when set. |

packages/docs/src/content/docs/start-here/slack-app-setup.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ Use `SLACK_BOT_TOKEN` for normal bot replies. Use `SLACK_BOT_USER_TOKEN` only wh
3434

3535
Grant the smallest scopes that cover the Slack features you enable. A typical Junior installation needs scopes for mentions, posting replies, reading thread context, reactions, user lookup, file workflows, and slash command handling.
3636

37-
| Capability | Slack scopes to verify |
38-
| ------------------------------------------------- | ---------------------------------------------------------------------------- |
39-
| Mentions | `app_mentions:read` |
40-
| Thread replies and private auth prompts | `chat:write` |
41-
| Processing reactions | `reactions:write` |
42-
| User lookup and App Home ownership | `users:read` |
43-
| Slash command `/jr` | `commands` |
44-
| Thread context in public/private channels and DMs | `channels:history`, `groups:history`, `im:history`, `mpim:history` as needed |
45-
| File/image context and generated files | `files:read`, `files:write` when file workflows are enabled |
46-
| Slack assistant status/title surfaces | Assistant scopes required by your Slack app configuration |
37+
| Capability | Slack scopes to verify |
38+
| -------------------------------------------------- | ---------------------------------------------------------------------------- |
39+
| Mentions | `app_mentions:read` |
40+
| Thread replies and private auth prompts | `chat:write` |
41+
| Processing reactions | `reactions:write` |
42+
| User lookup and App Home ownership | `users:read` |
43+
| Slash command configured by `JUNIOR_SLASH_COMMAND` | `commands` |
44+
| Thread context in public/private channels and DMs | `channels:history`, `groups:history`, `im:history`, `mpim:history` as needed |
45+
| File/image context and generated files | `files:read`, `files:write` when file workflows are enabled |
46+
| Slack assistant status/title surfaces | Assistant scopes required by your Slack app configuration |
4747

4848
Slack requires reinstalling the app after scope changes. Reinstall before debugging runtime behavior.
4949

@@ -78,15 +78,15 @@ https://<your-domain>/api/webhooks/slack
7878

7979
Junior uses interactivity for App Home actions such as disconnecting provider accounts.
8080

81-
## Add the `/jr` slash command
81+
## Add the slash command
8282

83-
Create a `/jr` slash command with this request URL:
83+
Create the slash command configured by `JUNIOR_SLASH_COMMAND` with this request URL. The default command is `/jr`:
8484

8585
```text
8686
https://<your-domain>/api/webhooks/slack
8787
```
8888

89-
Junior uses `/jr link` and `/jr unlink` for provider account management flows.
89+
Junior uses `<command> link` and `<command> unlink` for provider account management flows.
9090

9191
## Verify locally
9292

@@ -96,7 +96,7 @@ For local development, expose your dev server with a tunnel:
9696
cloudflared tunnel --url http://localhost:3000
9797
```
9898

99-
Then set Slack Event Subscriptions, Interactivity, and `/jr` to the tunnel URL plus `/api/webhooks/slack`.
99+
Then set Slack Event Subscriptions, Interactivity, and the configured slash command to the tunnel URL plus `/api/webhooks/slack`.
100100

101101
Verify the setup:
102102

packages/junior-agent-browser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sentry/junior-agent-browser",
3-
"version": "0.66.0",
3+
"version": "0.68.0",
44
"private": false,
55
"publishConfig": {
66
"access": "public"

packages/junior-dashboard/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sentry/junior-dashboard",
3-
"version": "0.66.0",
3+
"version": "0.68.0",
44
"private": false,
55
"publishConfig": {
66
"access": "public"
@@ -37,7 +37,8 @@
3737
"prepare": "pnpm run build",
3838
"prepack": "pnpm run build",
3939
"test": "vitest run -c vitest.config.ts",
40-
"typecheck": "tsc --noEmit"
40+
"typecheck": "tsc --noEmit",
41+
"test:coverage": "vitest run -c vitest.config.ts --coverage --reporter=default --reporter=junit --outputFile.junit=coverage/results.junit.xml"
4142
},
4243
"dependencies": {
4344
"@sentry/junior": "workspace:*",
@@ -58,6 +59,7 @@
5859
"@types/node": "^25.9.1",
5960
"@types/react": "^19.2.15",
6061
"@types/react-dom": "^19.2.3",
62+
"@vitest/coverage-v8": "^4.1.7",
6163
"tailwindcss": "^4.3.0",
6264
"tsup": "^8.5.1",
6365
"typescript": "^6.0.3",

0 commit comments

Comments
 (0)