Skip to content

refactor(core): move lifecycle model into Core-internal leaf - #721

Merged
Drswith merged 2 commits into
mainfrom
cursor/lifecycle-model-core-internal-l1-90a0
Sep 7, 2026
Merged

refactor(core): move lifecycle model into Core-internal leaf#721
Drswith merged 2 commits into
mainfrom
cursor/lifecycle-model-core-internal-l1-90a0

Conversation

@Drswith

@Drswith Drswith commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Summary

L1 lifecycle internalization: move receipt/observation types and LIFECYCLE_RECEIPT_SCHEMA_VERSION from src/lifecycle/model into a Core-internal leaf at src/core/lifecycle/model.ts. This removes the start of the Core → src/lifecycle reverse dependency without expanding the published SDK.

P8 (#717) kept the file outside Core because a naive fold would invert state → Core. The architecture conclusion (ADR 0011): state may import the leaf, never Core runtime. The leaf has zero imports, so Core → state → leaf is a chain, not a cycle. Remaining src/lifecycle/* engines stay in place for L2+.

Before / after import map

Importer Before After
src/core/installation-production.ts ../lifecycle/model (+ receipt version from state/schema) ./lifecycle/model
src/core/installation-state-record.ts ../lifecycle/model ./lifecycle/model
src/core/uninstall-executor.ts ../lifecycle/model ./lifecycle/model
src/core/update-executor.ts model types/constant from ../lifecycle barrel ./lifecycle/model (planner types still from ../lifecycle)
src/core/execution-executor.ts model types from ../lifecycle barrel ./lifecycle/model (preflight still from ../lifecycle)
src/state/{schema,store,index}.ts ../lifecycle/model ../core/lifecycle/model only (no Core runtime)
src/package-manager/index.ts ../lifecycle/model ../core/lifecycle/model
remaining src/lifecycle/* ./model ../core/lifecycle/model
src/lifecycle/index.ts barrel ./model re-exports leaf (existing non-SDK path)
tests that imported src/lifecycle/model that path src/core/lifecycle/model

Unchanged for L2+: Core still imports provider-binding, observation, update-planner, agent-execution, uninstall-postcondition, and the barrel.

SDK non-export checklist

  • src/core/index.ts does not export LifecycleReceipt, LifecycleObservation, LIFECYCLE_RECEIPT_SCHEMA_VERSION, or ./lifecycle
  • packages/core/src/index.ts does not export those symbols
  • Runtime export remains createQuantex only (test/core/import-purity.test.ts)
  • No new packages/core export subpath
  • Existing non-SDK re-exports only: src/lifecycle barrel and src/state/schema (LIFECYCLE_RECEIPT_SCHEMA_VERSION)

Freeze checklist

  • State schema remains v2; receipt JSON field names/requiredness/meanings unchanged
  • --json / NDJSON still omit engine / route (existing command tests)
  • Aliases and exit codes untouched
  • No command/SDK expansion; no fold of config/capabilities/commands/schema
  • YAML / release-core.yml / protect-main untouched
  • Shelved OpenSpec changes untouched: release-one-line-delivery, release-pr-skip-human-heuristics, windows-ci-advisory-merge-gate
  • Did not start L2+ (no move/delete of remaining src/lifecycle/*)

Linked Artifacts

Validation

  • bun run memory:check
  • bun run lint
  • bun run format:check
  • bun run typecheck
  • bun run test — 176 files / 2141 passed / 5 skipped
  • bun run openspec:validate
  • Freeze smoke: install/ensure --dry-run --jsonok=true, warnings[0].code=DRY_RUN, data.changed=false, exit 0, no engine/route
  • SDK import keys remain ["createQuantex"]
  • CI green on head 7503e24: lint, governance, test (ubuntu/windows/macos)

Release Intent

  • Release: not applicable - internal type relocation; no user-facing CLI or SDK change. Changelog framing is refactor: / Internal Improvements and does not bump on its own.

Release Summary

BEGIN_COMMIT_OVERRIDE
refactor(core): move lifecycle model into Core-internal leaf
END_COMMIT_OVERRIDE

Docs Updated

  • openspec/changes/lifecycle-model-core-internal-l1/
  • docs/adr/0011-core-internal-lifecycle-model-leaf.md
  • AGENTS.md (thin pointer to src/core/lifecycle/ and runtime-boundaries)

Scope Check

  • I did not add a new ad hoc root-level Markdown file.
  • I updated the relevant ADR, OpenSpec change, and AGENTS.md pointer.
  • I did not silently expand into L2+, SDK exports, YAML, or shelved OpenSpec changes.

Closure Check

  • Working tree was clean after commit.
  • Branch was pushed and this PR is the active delivery artifact.
  • OpenSpec change lifecycle-model-core-internal-l1 is still active until this merge, then queued for agent-driven archive closure.
  • Release is not applicable (internal refactor; no version bump from this knife).

Notes

  • Draft kept after CI (requested as draft — do not mark ready).
  • Ownership tests now lock: src/lifecycle/model.ts absent; src/core/lifecycle/ contains only model.ts; src/state Core imports are leaf-only.
  • Archive closure waits on merge; this is a complete L1 change, not an umbrella milestone.
Open in Web Open in Cursor 

Own receipt/observation types in src/core/lifecycle/model so Core no longer
imports them from src/lifecycle. State may share that leaf without depending
on Core runtime. Remaining lifecycle engines stay in place for L2+.
Validation, tests, and draft PR delivery for lifecycle-model-core-internal-l1
are done; keep the change active until merge and archive closure.
@Drswith
Drswith marked this pull request as ready for review September 7, 2026 03:45
@Drswith
Drswith merged commit 7e69c18 into main Sep 7, 2026
19 of 23 checks passed
@Drswith
Drswith deleted the cursor/lifecycle-model-core-internal-l1-90a0 branch September 7, 2026 03:45
Drswith added a commit that referenced this pull request Sep 7, 2026
Sync accepted L1 lifecycle-model deltas into living specs after #721,
and drop the completed change from the working tree without committing the
generated archive directory.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants