Skip to content

Commit 18ff1da

Browse files
os-helpclaude
andauthored
docs(adr): repair 8 dead source-tree links in ADR-0004/ADR-0020 and empty the link-gate baseline (#7343)
Fixes #6726 Claude-Session: https://claude.ai/code/session_01YS2qzDAn3CpWdY7uBX9bFQ Co-authored-by: Claude <noreply@anthropic.com>
1 parent b0c16a5 commit 18ff1da

3 files changed

Lines changed: 18 additions & 54 deletions

File tree

docs/adr/0004-cloud-multi-kernel.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ Two deployable applications:
6464

6565
### 2. `KernelManager` + `ProjectKernelFactory` (new in `@objectstack/runtime`)
6666

67-
- **`KernelManager`** ([`packages/runtime/src/kernel-manager.ts`](../../packages/runtime/src/kernel-manager.ts)): LRU+TTL cache of `Map<projectId, CachedKernel>`. Exposes `getOrCreate(projectId)` (concurrent-safe, single-flight per id) and `evict(projectId)` (calls `kernel.shutdown()`). Configurable `maxSize` and `ttlMs`.
68-
- **`DefaultProjectKernelFactory`** ([`packages/runtime/src/project-kernel-factory.ts`](../../packages/runtime/src/project-kernel-factory.ts)): given a `projectId`, reads project + credential + package-install rows from the control-plane driver, clones the base stack config, overrides the `default` datasource mapping to point at the project's driver, instantiates an `AppPlugin` per installed bundle, and calls `kernel.bootstrap()`.
67+
> **Path note (2026-08):** the two paths below are historical and deliberately unlinked — neither file is in this repository any more. `kernel-manager.ts` was moved to `packages/runtime/src/cloud/` on 2026-05-18 (`7dcde27c1`, "decouple runtime from service-cloud"), where `project-kernel-factory.ts` was also superseded by `cloud/artifact-kernel-factory.ts`; the whole `packages/runtime/src/cloud/` tree was then removed by #1600 (`feat(runtime)!: remove multi-tenant runtime; keep single-env + contracts`). Multi-kernel runtime code is no longer maintained here.
68+
69+
- **`KernelManager`** (`packages/runtime/src/kernel-manager.ts`): LRU+TTL cache of `Map<projectId, CachedKernel>`. Exposes `getOrCreate(projectId)` (concurrent-safe, single-flight per id) and `evict(projectId)` (calls `kernel.shutdown()`). Configurable `maxSize` and `ttlMs`.
70+
- **`DefaultProjectKernelFactory`** (`packages/runtime/src/project-kernel-factory.ts`): given a `projectId`, reads project + credential + package-install rows from the control-plane driver, clones the base stack config, overrides the `default` datasource mapping to point at the project's driver, instantiates an `AppPlugin` per installed bundle, and calls `kernel.bootstrap()`.
6971

7072
Both are exported from `@objectstack/runtime`. Self-hosted mode never imports `KernelManager`.
7173

@@ -90,8 +92,10 @@ Custom domains and multi-hostname binding (ACME certificates, `sys_domain` table
9092

9193
### 5. Studio surfaces hostname as a first-class field
9294

93-
- Project list ([`apps/studio/src/routes/projects.index.tsx`](../../apps/studio/src/routes/projects.index.tsx)) renders a globe icon + hostname inline with the project card.
94-
- Project detail ([`apps/studio/src/routes/projects.$projectId.index.tsx`](../../apps/studio/src/routes/projects.$projectId.index.tsx)) adds a **Domains** card with inline edit (Enter to save, Escape to cancel, toast on success/conflict).
95+
> **Path note (2026-08):** the two route paths below are historical and deliberately unlinked — Studio is not in this repository any more. `apps/studio/` was collapsed to a single-package metadata browser on 2026-05-22 (`6bacbced2`) and then migrated to the upstream `@object-ui/studio` package on 2026-05-24 (`06ad57f63`); `apps/` here now holds only `docs/`.
96+
97+
- Project list (`apps/studio/src/routes/projects.index.tsx`) renders a globe icon + hostname inline with the project card.
98+
- Project detail (`apps/studio/src/routes/projects.$projectId.index.tsx`) adds a **Domains** card with inline edit (Enter to save, Escape to cancel, toast on success/conflict).
9599

96100
---
97101

docs/adr/0020-state-machine-converge-and-enforce.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ The design intent is a **runtime guardrail**: declare which `status` transitions
4040

4141
**Zero enforcement — verified across `packages/{runtime,objectql,services,core,metadata*,plugins}` and the whole repo:**
4242

43-
- `IWorkflowService` ([`workflow-service.ts:58`](../../packages/spec/src/contracts/workflow-service.ts#L58)) has **no concrete implementation**.
43+
- `IWorkflowService` (`packages/spec/src/contracts/workflow-service.ts:58` — unlinked: the contract file was deleted on 2026-08-01 by #4451 / #4473, which retired the `workflow` service slot outright, closing the follow-up this record left open below) has **no concrete implementation**.
4444
- There is **no XState interpreter** anywhere (no `createMachine` / `interpret` / transition engine).
4545
- The write-path validator [`validateRecord`](../../packages/objectql/src/validation/record-validator.ts#L198) reads only `objectSchema.fields` and validates **field data types** (string/number/date/…). It **never reads `objectSchema.validations`** at all — so *not one* of the nine validation-rule types (`state_machine`, `cross_field`, `script`, `unique`, `format`, `json_schema`, `async`, `custom`, `conditional`) is enforced by it.
4646
- **Nothing reads `object.stateMachines`.**
4747

48-
So the guardrail goal is currently unmet at runtime. The only artefacts that exist are declarations — e.g. [`examples/app-crm/src/workflows/stale-opportunity.workflow.ts:19`](../../examples/app-crm/src/workflows/stale-opportunity.workflow.ts#L19) (`StateMachineConfig`), which additionally **mixes orchestration into the machine** (it carries `email_alert` / `task_creation` actions that no engine executes — that orchestration belongs to a record-triggered Flow per ADR-0019).
48+
So the guardrail goal is currently unmet at runtime. The only artefacts that exist are declarations — e.g. `examples/app-crm/src/workflows/stale-opportunity.workflow.ts:19` (`StateMachineConfig`; unlinked — this file describes the pre-ADR state and was itself removed by this record's own implementation, see the checklist below), which additionally **mixes orchestration into the machine** (it carries `email_alert` / `task_creation` actions that no engine executes — that orchestration belongs to a record-triggered Flow per ADR-0019).
4949

5050
#### The prior-state plumbing gap (the real implementation constraint)
5151

@@ -135,7 +135,7 @@ The transition declaration stays a flat, recognizable FSM (`field` + `{ from: [t
135135
- [~] `spec`: `IWorkflowService`**kept as a documented follow-up**, not removed (see Implementation notes).
136136
- [x] `objectql`: wire the `validations` union into the write path — new [`rule-validator.ts`](../../packages/objectql/src/validation/rule-validator.ts) (`evaluateValidationRules` / `needsPriorRecord` / `legalNextStates`), with the prior record plumbed into [`engine.ts`](../../packages/objectql/src/engine.ts) on single-row update. Enforces `state_machine`, `cross_field`, and `script` together.
137137
- [x] `metadata-collection.zod.ts`: dropped the `workflows` collection key + `workflows: 'workflow'` plural mapping ([`metadata-collection.zod.ts`](../../packages/spec/src/shared/metadata-collection.zod.ts)).
138-
- [x] `examples/app-crm`: rewrote `src/workflows/*.workflow.ts` — transition tables already live as the `opp_stage_transitions` `state_machine` rule on the opportunity object; side-effect actions became record-triggered / scheduled Flows ([`high-value-deal.flow.ts`](../../examples/app-crm/src/flows/high-value-deal.flow.ts), [`stale-opportunity.flow.ts`](../../examples/app-crm/src/flows/stale-opportunity.flow.ts)); removed the `workflows` registration from `objectstack.config.ts`.
138+
- [x] `examples/app-crm`: rewrote `src/workflows/*.workflow.ts` — transition tables already live as the `opp_stage_transitions` `state_machine` rule on the opportunity object; side-effect actions became record-triggered / scheduled Flows (`examples/app-crm/src/flows/high-value-deal.flow.ts`, `examples/app-crm/src/flows/stale-opportunity.flow.ts` — unlinked: both flow files were later dropped on 2026-07-05 by `751cf0161`, "refactor(crm): slim back to the loading-pipeline smoke core", which trimmed the CRM example to its loading-pipeline core; the surviving `state_machine` rule is unaffected); removed the `workflows` registration from `objectstack.config.ts`.
139139
- [x] `examples/app-showcase`: carries the surviving shape — `state_machine` rules on `Task`, `Project`, `Account`. Predicate conditions corrected to the `record.<field>` CEL scope form so enforcement actually fires.
140140
- [x] Tests: [`rule-validator.test.ts`](../../packages/objectql/src/validation/rule-validator.test.ts) (16 cases — allow/reject/no-op transitions, execution-control, predicate fail-open, introspection). Updated `object.test.ts`, `metadata-plugin.test.ts`, `metadata-collection.test.ts`, `overlay-precedence.test.ts` for the retired shapes.
141141

scripts/check-adr-links.mjs

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -139,54 +139,14 @@ const CONVENTION_ILLUSTRATIVE_TARGETS = [
139139
* longer matches a live finding fails as STALE, so a fixed link cannot silently
140140
* regress back under cover of its own grandfather clause.
141141
*
142-
* All 8 are ADR → source-tree links, not ADR → ADR links: the cross-record
143-
* surface this gate was filed for is clean at the time of writing. Their fix
144-
* is not mechanical — `apps/studio/**` moved to the `cloud` repository and the
145-
* runtime/spec files were deleted outright — so it is tracked separately in
146-
* **#6726** rather than guessed at here. Closing that issue empties this list.
142+
* **The list is EMPTY, and that is the finished state.** The 8 ADR → source-tree
143+
* links it was seeded with (#6592) were repaired under #6726: each target had
144+
* genuinely left this repository, so each link became a plain unlinked path plus
145+
* a short note saying where the code went. The ADR → ADR surface this gate was
146+
* filed for was already clean. An empty baseline means the gate is now a gate
147+
* rather than a grandfather clause — do not re-seed it.
147148
*/
148-
const KNOWN_DEAD_TARGETS = [
149-
{
150-
file: `${ADR_DIR}/0004-cloud-multi-kernel.md`,
151-
target: '../../packages/runtime/src/kernel-manager.ts',
152-
why: 'KernelManager was never a file at this path in this repo; cloud multi-kernel code lives in the cloud repo',
153-
},
154-
{
155-
file: `${ADR_DIR}/0004-cloud-multi-kernel.md`,
156-
target: '../../packages/runtime/src/project-kernel-factory.ts',
157-
why: 'same move as kernel-manager.ts',
158-
},
159-
{
160-
file: `${ADR_DIR}/0004-cloud-multi-kernel.md`,
161-
target: '../../apps/studio/src/routes/projects.index.tsx',
162-
why: 'apps/studio/ is not in this repository (apps/ holds only docs/)',
163-
},
164-
{
165-
file: `${ADR_DIR}/0004-cloud-multi-kernel.md`,
166-
target: '../../apps/studio/src/routes/projects.$projectId.index.tsx',
167-
why: 'apps/studio/ is not in this repository (apps/ holds only docs/)',
168-
},
169-
{
170-
file: `${ADR_DIR}/0020-state-machine-converge-and-enforce.md`,
171-
target: '../../packages/spec/src/contracts/workflow-service.ts#L58',
172-
why: 'no workflow-service.ts under packages/spec/src/contracts/ any more',
173-
},
174-
{
175-
file: `${ADR_DIR}/0020-state-machine-converge-and-enforce.md`,
176-
target: '../../examples/app-crm/src/workflows/stale-opportunity.workflow.ts#L19',
177-
why: 'examples/app-crm has no src/workflows/ directory any more',
178-
},
179-
{
180-
file: `${ADR_DIR}/0020-state-machine-converge-and-enforce.md`,
181-
target: '../../examples/app-crm/src/flows/high-value-deal.flow.ts',
182-
why: 'examples/app-crm/src/flows/ no longer carries this flow file',
183-
},
184-
{
185-
file: `${ADR_DIR}/0020-state-machine-converge-and-enforce.md`,
186-
target: '../../examples/app-crm/src/flows/stale-opportunity.flow.ts',
187-
why: 'examples/app-crm/src/flows/ no longer carries this flow file',
188-
},
189-
];
149+
const KNOWN_DEAD_TARGETS = [];
190150

191151
/**
192152
* Blank out fenced code blocks, preserving line count so findings keep their

0 commit comments

Comments
 (0)