Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 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 |
Reviewer's GuideMakes session inspection commands ( Sequence diagram for writable vs read-only session runtime bootstrapsequenceDiagram
actor User
participant CLI as CamCLI
participant SessionCmd as runSession
participant Runtime as buildRuntimeContext
participant Store as SessionContinuityStore
rect rgb(230,250,230)
User->>CLI: cam session save|refresh
CLI->>SessionCmd: runSession(action=save|refresh)
SessionCmd->>Runtime: buildRuntimeContext(cwd)
Runtime-->>SessionCmd: runtime (writable, ensureMemoryLayout=true)
SessionCmd->>SessionCmd: prepareSessionPersistenceRequest(runtime, action, scope)
SessionCmd->>Store: write session continuity
Store-->>SessionCmd: persistence result
SessionCmd-->>CLI: output message
CLI-->>User: show save|refresh result
end
rect rgb(230,230,250)
User->>CLI: cam session clear
CLI->>SessionCmd: runSession(action=clear)
SessionCmd->>Runtime: buildRuntimeContext(cwd)
Runtime-->>SessionCmd: runtime (writable, ensureMemoryLayout=true)
SessionCmd->>Store: clear(scope)
Store-->>SessionCmd: cleared boolean
SessionCmd-->>CLI: output cleared result
CLI-->>User: show clear result
end
rect rgb(250,230,230)
User->>CLI: cam session open
CLI->>SessionCmd: runSession(action=open)
SessionCmd->>Runtime: buildRuntimeContext(cwd)
Runtime-->>SessionCmd: runtime (writable, ensureMemoryLayout=true)
SessionCmd->>Store: ensureLocalLayout()
Store-->>SessionCmd: layout ensured
SessionCmd->>CLI: localDir path
CLI-->>User: open continuity directory
end
rect rgb(250,250,200)
User->>CLI: cam session status|load
CLI->>SessionCmd: runSession(action=status|load)
Note over SessionCmd: No earlier writable runtime bootstrap
SessionCmd->>Runtime: buildRuntimeContext(cwd, {}, { ensureMemoryLayout: false })
Runtime-->>SessionCmd: runtime (readOnly, no layout creation)
SessionCmd->>SessionCmd: loadSessionInspectionView(runtime)
SessionCmd-->>CLI: inspection payload
CLI-->>User: show status or apply load
end
Class diagram for runtime context and read-only session inspectionclassDiagram
class RuntimeContext {
+SessionContinuityStore sessionContinuityStore
}
class SessionContinuityStore {
+paths paths
+clear(scope) Promise~boolean~
+ensureLocalLayout() Promise~void~
}
class SessionContinuityPaths {
+string localDir
}
class BuildRuntimeContextOptions {
+boolean ensureMemoryLayout
}
class BuildRuntimeContextConfig {
}
class BuildRuntimeContext {
+buildRuntimeContext(cwd, config, options) Promise~RuntimeContext~
}
class SessionCommand {
+runSession(action, options) Promise~string~
-loadSessionInspectionView(runtime) Promise~string~
}
RuntimeContext --> SessionContinuityStore
SessionContinuityStore --> SessionContinuityPaths : uses
BuildRuntimeContext --> RuntimeContext : creates
SessionCommand --> RuntimeContext : uses
SessionCommand ..> BuildRuntimeContext : calls
BuildRuntimeContextOptions <.. BuildRuntimeContext : parameter
BuildRuntimeContextConfig <.. BuildRuntimeContext : parameter
note for SessionCommand "Writable actions: save, refresh, clear, open call buildRuntimeContext(cwd) with default ensureMemoryLayout=true"
note for SessionCommand "Read-only actions: status, load call buildRuntimeContext(cwd, {}, { ensureMemoryLayout: false })"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The
pathExistshelper is duplicated in bothdist-cli-smoke.test.tsandsession-command.test.ts; consider extracting it into a shared test utility to keep the tests DRY and consistent. - In
runSession,buildRuntimeContextis now called multiple times with different options depending on the action; consider centralizing this branching (e.g., a small helper or a lookup by action) to avoid repeated logic and make the read-only vs. writable behavior easier to reason about. - The JSON
toMatchObjectexpectations forstatusandloadare identical in both new tests; factoring this expected payload into a reusable helper would simplify the tests and reduce the chance of the assertions drifting apart.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `pathExists` helper is duplicated in both `dist-cli-smoke.test.ts` and `session-command.test.ts`; consider extracting it into a shared test utility to keep the tests DRY and consistent.
- In `runSession`, `buildRuntimeContext` is now called multiple times with different options depending on the action; consider centralizing this branching (e.g., a small helper or a lookup by action) to avoid repeated logic and make the read-only vs. writable behavior easier to reason about.
- The JSON `toMatchObject` expectations for `status` and `load` are identical in both new tests; factoring this expected payload into a reusable helper would simplify the tests and reduce the chance of the assertions drifting apart.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
b2ecfc9 to
9c539a3
Compare
046a1a7 to
9aa9e07
Compare
9aa9e07 to
cc2ea2f
Compare
9c539a3 to
fad8b57
Compare
…2026-04-11 issue5 tail closeout blocker fixes
issue5 tail invalid cwd closure
issue5 close remaining runtime and extractor seams
…on-parity issue5 release gate isolation parity
issue5 init idempotency and force semantics
50f6bc2
into
pr/issue5-14-runtime-safety-closure
…sure issue5 keep session inspection read-only
Summary
cam session statusandcam session loadtruly read-only by avoiding implicit durable-memory layout creation during inspectionMEMORY.md,ARCHIVE.md, or retrieval sidecarsIncluded
save/refresh/clear/openkeep the writable runtime path whilestatus/loaduse a read-only runtime bootstraptest/session-command.test.tsfor uninitialized-projectstatus/loadbehaviortest/dist-cli-smoke.test.tsfor the same read-only session inspection contractExcluded
cam initidempotency or--forceredesign yet.worktrees/**isolation changes yetVerification
pnpm exec vitest run test/session-command.test.tspnpm lintpnpm buildpnpm exec vitest run test/dist-cli-smoke.test.ts -t "keeps session inspection read-only"Stack Notes
pr/issue5-15-session-readonly-closurepr/issue5-14-runtime-safety-closure046a1a7backup/2026-04-10-pr15-start-pr14-20260410-234202backup-tag/2026-04-10-pr15-start-pr14-20260410-234202Review Order
Summary by Sourcery
Ensure session inspection commands operate in a read-only mode and add regression coverage for compiled and source CLIs.
Bug Fixes:
cam session statusandcam session loadfrom implicitly creating durable memory layouts during inspection, keeping uninitialized projects read-only.Enhancements:
Tests:
session statusandsession loadremain read-only for uninitialized projects in the source CLI.Summary by cubic
Keeps session inspection read-only and tightens runtime safety across init, integrations, and extractor. Adds an explicit, idempotent
initwith--force, and hardens--cwdhandling.session status/loadthrough a read-only runtime (ensureMemoryLayout: false); add source and compiled CLI tests to confirm no memory layout creation and temporary continuity.cam initexplicit and idempotent:--forceoverwrites; by default keep valid project/local configs, ignore invalid global/managed configs, and don’t create memory layout during init.--cwdforintegrations/hooks/skills(empty/whitespace/missing);mcp doctorresolves and validates--cwd; add dist and tarball smoke coverage.Written for commit 076eccb. Summary will update on new commits.