feat: local memory + local vault wiring + autofix-pr + CI mock isolation#444
feat: local memory + local vault wiring + autofix-pr + CI mock isolation#444
Conversation
Squash-merge of feat/autofix-pr-test (69 commits) onto upstream/main with -X ours strategy (upstream as authoritative for content conflicts). Key features brought in from fork: - LocalMemoryRecall + VaultHttpFetch tools (end-to-end wired) - /local-memory, /local-vault, /memory-stores, /skill-store interactive panels - /agents-platform, /schedule, /vault command scaffolding - /login: switch / replace / remove of workspace API key - statusline refactor (built-in status row, /statusline as info command) - autofix-pr command + workflow Conflict resolutions (upstream-wins): - 10 .js command stubs kept from upstream (alongside fork's .ts implementations) - src/components/BuiltinStatusLine.tsx accepted upstream's deletion (fork's wire-up references in StatusLine.tsx will be cleaned up next) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Bare `mock.module('axios', () => ({ default: { stubs } }))` is
process-global last-write-wins and drops `axios.create`, `request`,
`isAxiosError`, etc. that real consumers need. In CI's alphabetical
file order, that produces dozens of polluted failures (AgentsPlatformView,
schedule API, memory-stores API, etc.) that don't reproduce on WSL2.
Introduce `tests/mocks/axios.ts` with `setupAxiosMock()` — `require('axios')`
inside the factory, spread real shape, route each verb through a per-suite
`useStubs` flag. beforeAll flips on, afterAll flips off; the spread
fall-through eliminates cross-file leakage.
Refactored 12 axios mockers in tests/, plus the bare `@anthropic/ink` mocks
in ultrareviewCommand and onboarding suites (same pollution pattern broke
AgentsPlatformView's Box/Text rendering).
Verified: 5339/5345 tests pass locally; remaining 6 failures are
pre-existing isolation issues unrelated to this change.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The long-body draft-save test registered a bare `mock.module( 'node:child_process', ...)` inside the test body. Without spread+flag, that stub leaked process-globally into every later test file in the run. Apply the same pattern used in issue-gh / issue-template / share-* : spread real child_process, route execFile/execFileSync through a `useIssueLongBodyCpStubs` flag, flip on at start of test and off in the finally block. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Same spread+flag pattern as the axios / child_process polluters: the bare
`mock.module('dgram', () => ({ createSocket: () => mockSocket }))` leaked
the stub into every later test file in the run via Bun's last-write-wins
module mock cache. Now we spread real dgram and gate `createSocket`
through `useLanBeaconDgramStubs`, flipped on in beforeAll and off in
afterAll so unrelated UDP-using code in later suites sees real dgram.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two clusters of pre-existing failures fixed by aligning tests with the source they were meant to verify (not by changing source): 1. ultrareviewCommand (4 fails) The 4 "preflight integration" tests assumed `call` makes an axios POST and branches on `action: proceed | blocked | confirm`. That integration was removed; the current `call` branches on `checkOverageGate()`'s four `kind` values. Replaced with 6 tests covering each gate branch (`not-enabled`, `low-balance`, `needs-confirm`, `proceed`), arg pass-through to launchRemoteReview, and the null-launch failure path. 2. autonomy-lifecycle-user-flow (2 fails) The Bun.spawn'd subprocess used cwd=tempDir, where Bun couldn't resolve the `src/*` tsconfig path alias (it's resolved from cwd's tsconfig, not the entrypoint file's). Switched the entrypoint to the bundled dist/cli.js (aliases pre-resolved) and added a beforeAll that lazy-builds the bundle if missing — handles the CI ordering where `bun test` runs before `bun run build`. Local: 5345/5345 pass (was 5339/5345). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ll collision Both `src/commands/schedule/index.ts` (our new UI command) and the upstream `src/skills/bundled/scheduleRemoteAgents.ts` registered `name: 'schedule'`, producing two `/schedule` entries in the slash-command picker — one tagged "(bundled)" with the prompt-skill description, the other our CRUD UI. Rename the primary name to `triggers` (matches the API endpoint `/v1/code/triggers`) and drop `'schedule'` from the alias list. `/cron` alias is preserved. Directory stays `src/commands/schedule/` because renaming the dir would touch every test file's import path for negligible benefit. Updated test that asserted the old name + alias, and the user-facing feature guide that documented `/schedule create ...` examples. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`docs/jira/AUTOFIX-PR-001.md:134` documents that the AUTOFIX_PR flag
"should be added to DEFAULT_BUILD_FEATURES" but the actual addition
to scripts/defines.ts was never made. Result: every build/dev produced
an /autofix-pr command whose isEnabled() returns false (because
src/commands/autofix-pr/index.ts:9 gates on `feature('AUTOFIX_PR')`),
so the command never appeared in /help and was effectively dead code.
The flag is fork-introduced (0 references in upstream/main) so adding
it here doesn't conflict with upstream policy. Other feature() calls
the PR added (KAIROS_GITHUB_WEBHOOKS, etc.) are upstream-owned flags
where we shouldn't override the upstream default.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Important Review skippedToo many files! This PR contains 243 files, which is 93 over the limit of 150. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (243)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| ) | ||
| const { accessToken, orgUUID } = await prepareApiRequest() | ||
| const baseUrl = getOauthConfig().BASE_API_URL | ||
| console.log(`base: ${baseUrl}`) |
| const { accessToken, orgUUID } = await prepareApiRequest() | ||
| const baseUrl = getOauthConfig().BASE_API_URL | ||
| console.log(`base: ${baseUrl}`) | ||
| console.log(`orgUUID: ${orgUUID.slice(0, 8)}…\n`) |
Summary
Integrates fork work onto upstream main: local-memory + local-vault feature wiring, autofix-pr command, and CI mock-pollution isolation. 7 commits, 243 files (~41k+ insertions vs upstream/main).
Functional changes
/local-memory— manage local memory stores in~/.claude/local-memory/, no API key required/local-vault— manage local encrypted secrets (OS keychain or encrypted-file fallback), no API key required/vault,/skill-store,/memory-stores,/agents-platform— workspace-API-key-gated CLI commands for cloud resources (hidden when no key set)/triggers(renamed from/scheduleto avoid collision with upstream bundled skill of same name) — CRUD UI for scheduled remote agent triggers via/v1/code/triggers/autofix-pr— gated byAUTOFIX_PRflag, now inDEFAULT_BUILD_FEATURESso it actually appears in buildsTest infrastructure
tests/mocks/axios.ts— shared spread+flag axios mock helper. Replaces 12 baremock.module('axios', ...)polluters acrosspackages/builtin-tools/andsrc/commands/that leaked stub implementations process-globally in CI's alphabetical file-order runnode:child_process(issue.test.ts),dgram(lanBeacon.test.ts),@anthropic/ink(ultrareviewCommand + onboarding suites)dist/cli.js(Bun.spawn cwd does not resolve src/* tsconfig alias)Verification
Test plan
/local-memoryand/local-vaultwork without API key/vault,/skill-store,/memory-stores,/agents-platform,/triggers) appear whenANTHROPIC_API_KEYorworkspaceApiKeyset/autofix-pris enabled in default build (was previously dead due to missing feature flag)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmithwith what you need.