feat(persona-kit): add IntegrationConfig.source discriminator (deployer_user | workspace | workspace_service_account)#97
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR introduces an ChangesIntegration Source Type System
Sequence Diagram(s)sequenceDiagram
participant Parser as parseIntegrationConfig
participant SourceParser as parseIntegrationSource
participant Result as Validated Config
Parser->>Parser: Destructure source field
alt source provided
Parser->>SourceParser: Validate source object
SourceParser->>SourceParser: Check kind membership
alt workspace_service_account
SourceParser->>SourceParser: Validate name (kebab-case, length)
SourceParser-->>Parser: Returns validated source
else other kind
SourceParser-->>Parser: Returns source as-is
end
else source omitted
Parser->>Parser: Default to deployer_user
end
Parser-->>Result: out.source populated
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
4f1dc8c to
11e6df5
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/plans/deploy-v1-schema-cascade-spec.md`:
- Line 47: Several fenced code blocks in the document are unlabeled and trigger
markdownlint MD040; update each unlabeled triple-backtick fence (examples
containing "HOME=/Users/khaliqgant", "GITHUB_TOKEN", and the "persona_versions"
schema block) to include an appropriate language tag (e.g., ```bash for shell
snippets, ```text for plain tokens like GITHUB_TOKEN, ```sql for schema blocks).
Apply the same fix to all other unlabeled fences listed (lines with the same
patterns) so every ``` fence has a language label.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 52558f0e-29fc-4c92-ba10-c574efba60fc
⛔ Files ignored due to path filters (1)
workflows/generated/ricky-ricky-workflow-spec-deploy-v1-schema-cascade-persona-refactor-status-ready-for-r.tsis excluded by!**/generated/**
📒 Files selected for processing (8)
docs/plans/deploy-v1-schema-cascade-spec.mdpackages/persona-kit/src/__fixtures__/personas/integration-source-deployer.jsonpackages/persona-kit/src/__fixtures__/personas/integration-source-service-account.jsonpackages/persona-kit/src/__fixtures__/personas/integration-source-workspace.jsonpackages/persona-kit/src/index.tspackages/persona-kit/src/parse.test.tspackages/persona-kit/src/parse.tspackages/persona-kit/src/types.ts
|
|
||
| ### Required env | ||
|
|
||
| ``` |
There was a problem hiding this comment.
Add fenced code block languages to satisfy markdownlint MD040.
Line 47 and the other listed lines use unlabeled fenced blocks; this will keep triggering lint warnings.
Proposed fix pattern
-```
+```bash
HOME=/Users/khaliqgant
ROOT=$HOME/Projects/AgentWorkforce
...- +text
GITHUB_TOKEN
-```
+```sql
persona_versions
id uuid PK
...
Apply the same language-tag pattern to all remaining unlabeled fences in this file.
</details>
Also applies to: 58-58, 75-75, 255-255, 273-273, 294-294, 613-613, 617-617, 688-688, 723-723, 788-788, 1362-1362
<details>
<summary>🧰 Tools</summary>
<details>
<summary>🪛 markdownlint-cli2 (0.22.1)</summary>
[warning] 47-47: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
</details>
</details>
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @docs/plans/deploy-v1-schema-cascade-spec.md at line 47, Several fenced code
blocks in the document are unlabeled and trigger markdownlint MD040; update each
unlabeled triple-backtick fence (examples containing "HOME=/Users/khaliqgant",
"GITHUB_TOKEN", and the "persona_versions" schema block) to include an
appropriate language tag (e.g., bash for shell snippets, text for plain
tokens like GITHUB_TOKEN, sql for schema blocks). Apply the same fix to all other unlabeled fences listed (lines with the same patterns) so every fence
has a language label.
</details>
<!-- fingerprinting:phantom:poseidon:hawk -->
<!-- d98c2f50 -->
<!-- This is an auto-generated comment by CodeRabbit -->
Introduce an `IntegrationSource` discriminated union (`deployer_user` |
`workspace` | `workspace_service_account`) and add an optional `source`
field on `PersonaIntegrationConfig`. The parser default-injects
`{ kind: 'deployer_user' }` when `source` is omitted, so existing
personas keep their pre-discriminator behavior.
This unblocks the cloud-side two-table integration resolver
(cloud#553): without `source`, the resolver cannot know whether a
persona's declared integration should look up `user_integrations` or
`workspace_integrations`.
Surface stays types + parse + fixtures only — runtime resolution
wiring waits for workforce#92 to land.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
11e6df5 to
2be5f77
Compare
…ion-source # Conflicts: # packages/persona-kit/src/parse.test.ts # packages/persona-kit/src/types.ts
`emit-schema.test` failed on main because PR #97 (IntegrationConfig.source discriminator) added three new fixtures but they were missing two schema-required fields (`onEvent` for cloud personas, `skills`) and the test's hardcoded expected-filename list wasn't updated. Three small fixes: 1. `emit-schema.test.ts`: add the three new fixture names to the expected-filenames deepEqual. 2. `integration-source-{deployer,workspace,service-account}.json`: add `"onEvent": "./agent.ts"` and `"skills": []` to each, matching the pattern used in `full.json` / `cron-only.json`. The fixtures still exercise their intended IntegrationSource shapes (no-source default-inject, explicit `workspace`, explicit `workspace_service_account`) — only the cross-cutting required-for-cloud fields were added. Verified: `pnpm -F @agentworkforce/persona-kit test` → 162/162 pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…p-workforce build (#104) * chore(publish): add runtime + deploy + mcp-workforce to the publish allow-list The publish.yml allow-list was last updated when the workspace had 5 packages (persona-kit, workload-router, cli, daytona-runner, agentworkforce). The deploy-v1 cascade shipped 3 more under @agentworkforce/* that the existing cli already depends on: - @agentworkforce/runtime (consumed by deploy, mcp-workforce) - @agentworkforce/deploy (consumed by cli) - @agentworkforce/mcp-workforce (consumed by harness CLIs via MCP) cli@3.0.1 already declares `@agentworkforce/deploy@0.0.0` as a runtime dep, but deploy was never published — the 0.0.0 on npm is a placeholder, so `npm i agentworkforce` today pulls a stub for `workforce deploy`. The same applies to deploy/mcp-workforce's runtime dep. This change preserves lockstep umbrella semantics and orders the publish in topological order (runtime before deploy/mcp-workforce, deploy before cli, cli before agentworkforce). personas-core stays on publish-personas.yml as before — not added here. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(mcp-workforce): align memory scope enum with PersonaMemoryScope mcp-workforce was landed in #91 against an older `PersonaMemoryScope` shape (`session | user | workspace | org | object`). #94 then tightened the type to `workspace | user | global`. Both PRs passed CI independently, but main is now broken at build time because the zod enum in `server.ts` and the runtime `VALID_SCOPES` Set in `tools/memory.ts` still reference the removed literals. Aligning both call sites to the canonical persona-kit shape: - `MEMORY_SCOPE_ENUM` → z.enum(['workspace', 'user', 'global']) - `VALID_SCOPES` → new Set(['workspace', 'user', 'global']) - memory.save tool description updated to match The default scope stays `workspace`. Callers that previously passed `'session'`/`'org'`/`'object'` will now get a validation error from the zod schema before the runtime check — preferable to silently mapping them to a different scope. Verified: `pnpm -F @agentworkforce/mcp-workforce typecheck` + `build` + `test` (23/23) all pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(publish): sync release-notes packageOrder with expanded allow-list CodeRabbit + Devin both flagged that the `packageOrder` array used to sort release-note entries was not updated alongside the publish allow-list, so `runtime` / `deploy` / `mcp-workforce` would have `indexOf === -1` and sort first (or in an arbitrary order depending on the sort impl). Mirror the topological order from "Resolve target packages": persona-kit → runtime → workload-router → deploy → mcp-workforce → daytona-runner → cli → agentworkforce Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(examples): linear-shipper read spec metadata from inputSpecs `ctx.persona.inputs` is `Record<string, string>` (resolved values) on WorkforcePersonaContext; the raw `PersonaInputSpec` with `.env` and `.default` lives at `ctx.persona.inputSpecs`. The earlier env-var- precedence patch on PR #93 read .env / .default off `.inputs`, which only worked while the type was loose. The post-cascade readonly tightening exposed the bug at typecheck time and broke the examples typecheck job. Also fold the runtime-resolved value into the fallback chain so we prefer env > resolved > spec.default — matching `resolvePersonaInputs`. Verified: `pnpm run typecheck` + `pnpm run typecheck:examples` both clean after rebuilding @agentworkforce/deploy dist. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(persona-kit): make integration-source fixtures pass the schema test `emit-schema.test` failed on main because PR #97 (IntegrationConfig.source discriminator) added three new fixtures but they were missing two schema-required fields (`onEvent` for cloud personas, `skills`) and the test's hardcoded expected-filename list wasn't updated. Three small fixes: 1. `emit-schema.test.ts`: add the three new fixture names to the expected-filenames deepEqual. 2. `integration-source-{deployer,workspace,service-account}.json`: add `"onEvent": "./agent.ts"` and `"skills": []` to each, matching the pattern used in `full.json` / `cron-only.json`. The fixtures still exercise their intended IntegrationSource shapes (no-source default-inject, explicit `workspace`, explicit `workspace_service_account`) — only the cross-cutting required-for-cloud fields were added. Verified: `pnpm -F @agentworkforce/persona-kit test` → 162/162 pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Ricky Schema Cascade <ricky@agent-relay.com> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Summary
Spec reference
Source spec: workforce/docs/plans/deploy-v1-schema-cascade-spec.md
Track section: Track E5 — rebase #97 (feat/persona-integration-source)
Final signoff
Final gate (typecheck + tests)
Self-reflection report
Known gaps after this PR
Co-Authored-By: Ricky deploy-v1 schema cascade noreply@agentworkforce.com