arch: define stable core review and task and resource proposals
This commit is contained in:
1 parent
d67f54c1f5
commit
099ff8ba02
5 files changed
+162
-2
No files matched your search
@@ -0,0 +1,42 @@
|
||||
# ADR-0064 — Stable core and extension boundary
|
||||
|
||||
Status: Accepted for the post-beta development line. Input is [RFC-GPL-0004,
|
||||
issue #4](https://git.cflmy.cn/cflmy/marqdo-cli/issues/4).
|
||||
|
||||
## Decision
|
||||
|
||||
The frontend owns the single Markdown-to-IR mapping and static callable binding.
|
||||
The runtime owns evaluation and run-local state. The Capability Host owns
|
||||
authority, resource identity, budgets and observable effects. Tool v1 dispatches
|
||||
independent processes. Domain code goes in a Marqdo package, a Callable Plugin,
|
||||
a Resource Provider, a Foreign Kernel, or a Tool, according to which existing
|
||||
interface it needs.
|
||||
|
||||
Keep the core surface inventory under review. A change to the builtin catalogue,
|
||||
HostOp, Value or top-level command set requires a new accepted ADR, the relevant
|
||||
specification changes, and evidence from at least three unrelated use cases
|
||||
that need the same primitive. Include a working composition example or explain
|
||||
why the existing interfaces cannot express one. Describe authority, ownership,
|
||||
cleanup, performance, compatibility, and positive and negative tests.
|
||||
The reviewed resource operations remain governed by ADR-0062 and Foreign F-A
|
||||
by ADR-0063.
|
||||
|
||||
The Linux check builds the release CLI and its shipped provider worker, installs
|
||||
the archive, and runs a pinned external conformance repository against it.
|
||||
The evidence identifies the core and fixture commits and the executable
|
||||
digests. New extension use cases should enter that repository first. The
|
||||
stock package, Worker Callable, Foreign Kernel, Resource Provider, and
|
||||
registered Tool cases continue to exercise the same prebuilt CLI.
|
||||
|
||||
Feature work that depends on new runtime primitives follows
|
||||
[Resource Control](0065-resource-control-vnext.md) and
|
||||
[Task v1](0066-structured-tasks-v1.md) as independent milestones. Each proposal
|
||||
has its own adoption and acceptance criteria. HTTP and model-specific behavior
|
||||
belongs to independent reference packages using the published interfaces.
|
||||
|
||||
## Consequences
|
||||
|
||||
Extension packages depend on public contracts. The source and ABI for those
|
||||
contracts keep their existing release policy. The inventory gate covers changes
|
||||
to the named surfaces and the external tests cover composition at runtime.
|
||||
Review still checks changes inside an existing dispatch branch.
|
||||
@@ -0,0 +1,51 @@
|
||||
# ADR-0065 — Declarative Resource Control
|
||||
|
||||
Status: Proposed. Follow-up to RFC-GPL-0004 §4 and ADR-0062.
|
||||
|
||||
## First milestone
|
||||
|
||||
Introduce a versioned provider contract for control on a live resource. Keep
|
||||
Provider v2 stream transport and its schema supported. Select control-capable
|
||||
providers explicitly through the manifest and lock, pinning both descriptor
|
||||
content and the platform artifact. The check/inspect path reads declarations
|
||||
without starting a worker. Dynamic action names and argument values also need
|
||||
full validation at dispatch.
|
||||
|
||||
A manifest declares actions by resource kind. Each action has a unique name,
|
||||
ordered argument shapes, a required right and a result kind. The result is
|
||||
either a bounded Value Wire value or a child kind declared by the same provider.
|
||||
Begin with positional arguments and a closed set of wire shapes. A handle always
|
||||
selects the provider and kind that issued it. The caller cannot override either.
|
||||
The dispatcher checks the live run-owned handle, provider grant, handle rights,
|
||||
registered action, arity and shapes before sending a worker request. Both the
|
||||
request and validated response are auditable without recording arguments.
|
||||
|
||||
Child creation returns an opaque provider token over the transport. The Host
|
||||
validates the result envelope, kind, freshness and quota before minting a
|
||||
run-owned Resource. Child rights are bounded by the action declaration and the
|
||||
operator's grant. Validation and handle publication form one transaction. If
|
||||
the Host cannot adopt a freshly allocated token, it releases the token or
|
||||
tears down the faulted worker. It invalidates worker-owned handles on transport
|
||||
failure and reaps them on run teardown. Raw host handles are excluded from all
|
||||
wire values. Timeout, malformed frames and worker exit have bounded cleanup.
|
||||
|
||||
## Later milestone
|
||||
|
||||
Specify `resource.wait` separately after the control path works. Readiness
|
||||
needs a monotonic deadline, a cancellation source and a bounded batch of
|
||||
run-owned handles. Unsupported interests return a defined error. The
|
||||
implementation must state how it interrupts each supported transport and what
|
||||
happens to outstanding control requests on cancellation. A synchronous Worker
|
||||
continues to provide process isolation from faults and needs a separate policy
|
||||
for OS containment.
|
||||
|
||||
## Before acceptance
|
||||
|
||||
Use a counter for bounded state mutations, a queue for acknowledgments, and a
|
||||
listener for child adoption. Test authorization before worker effects, unknown
|
||||
actions, wrong shapes, untrusted or closed handles, repeated or mismatched
|
||||
tokens, artifact substitution, malformed and oversized messages, worker loss
|
||||
and teardown. Run the same stream-only Provider v2 suite on the new binary.
|
||||
The initial implementation should register the three test kinds as external
|
||||
fixtures. The host's closed `resource.request` catalogue remains governed by
|
||||
ADR-0062.
|
||||
@@ -0,0 +1,56 @@
|
||||
# ADR-0066 — Structured Tasks and bounded Channels
|
||||
|
||||
Status: Proposed. Follow-up to RFC-GPL-0004 §§5, 7 and 10.
|
||||
|
||||
## Execution and authority
|
||||
|
||||
Use a shared immutable prepared program and the existing callable resolution.
|
||||
Spawn initially accepts a prepared FunctionRef with positional input. Each task
|
||||
has its own interpreter frames, MemoryStore and Host resources. All spawned
|
||||
tasks belong to the run. Task identities are opaque and scoped to that run.
|
||||
Only an owning task may join or cancel its child. Supervisors finish by
|
||||
reaping all children, including when the parent itself fails.
|
||||
|
||||
A child gets the intersection of its parent's effective grants and a requested
|
||||
subset. If the subset is omitted, the child starts with no optional effect
|
||||
grants. Charge every task, including descendants, to shared run quotas for
|
||||
live tasks, queued work, fuel, memory, messages and output. A child deadline
|
||||
cannot exceed its parent's. Bound scheduling admission before starting any
|
||||
effect. The scheduler needs a defined strategy for joins and blocking sends
|
||||
with a saturated worker pool. Prove progress for nested spawn with a two-worker
|
||||
limit before freezing the design.
|
||||
|
||||
Transfer bounded snapshots of ordinary values. At every nesting level reject
|
||||
Memory, Resource, PluginHandle, task handles and channel endpoints unless a
|
||||
separate typed endpoint-transfer rule is specified. FunctionRef is resolved
|
||||
against the same immutable prepared program. Table, Code and Formula transfers
|
||||
need size and depth accounting. Channel queues are bounded by count and bytes.
|
||||
Send is initially nonblocking with a full or closed result. Receive waits
|
||||
until a value, closure, deadline or cancellation. Specify channel endpoint
|
||||
ownership during the prototype before choosing any public syntax.
|
||||
|
||||
## Join, cancellation and observations
|
||||
|
||||
Join returns a structured outcome for completion, ordinary child failure and
|
||||
cancellation. A join wait timeout leaves the child joinable. Explicit cancel
|
||||
propagates to descendants and wakes waits. Capability denials and budget
|
||||
violations terminate the offending task and remain distinguishable from
|
||||
ordinary application failures. No task can use Join to resume an unauthorized
|
||||
effect.
|
||||
|
||||
Cancellation is cooperative at interpreter safe points. Bound or exclude Host
|
||||
operations that cannot honor run teardown, including uncancellable native
|
||||
calls. Where a worker can be interrupted, termination and reap have separate
|
||||
deadlines and must account for descendants. Task and parent IDs belong to a
|
||||
versioned observability contract. Ordering is defined per task, with explicit
|
||||
causal links across spawn, message delivery and join.
|
||||
|
||||
## Before acceptance
|
||||
|
||||
Exercise CPU recursion, concurrent mock network calls and batch orchestration
|
||||
with an independent failure, deadline and success. Test nested joins under
|
||||
pool saturation, queue and budget exhaustion, resource cleanup on parent exit,
|
||||
permission attenuation and rejection of nested live handles. Compare the
|
||||
existing single-task behavior and performance on the same workloads. Freeze
|
||||
public names, Value/Handle representation and schema versions only after this
|
||||
prototype. Shared memory and async syntax need separate decisions.
|
||||
@@ -59,3 +59,9 @@ Files: `0001`–`0050`, plus:
|
||||
* `0063-foreign-kernel-transition-fa.md` — retain the permission-gated one-shot
|
||||
foreign primitive as F-A; F-B removal requires a versioned generic
|
||||
process/worker capability.
|
||||
* [0064](0064-stable-core-extension-boundary.md) — core surface review and
|
||||
frozen external conformance;
|
||||
* [0065](0065-resource-control-vnext.md) — proposed manifest-driven stateful
|
||||
operations and child resources;
|
||||
* [0066](0066-structured-tasks-v1.md) — proposed task isolation, bounded
|
||||
communication and cancellation.
|
||||
+7
-2
@@ -208,8 +208,13 @@ resource.request(operation: Text, arguments: List) -> Result
|
||||
|
||||
### 3.4 Resource operations (ADR-0041)
|
||||
|
||||
`resource.request(operation, arguments)` is the non-streaming control plane for
|
||||
operations that are not byte streams. This build registers only `fs.*`:
|
||||
`resource.request(operation, arguments)` is a closed compatibility catalogue
|
||||
of non-streaming operations. The [reviewed operation table](../docs/architecture/resource-operations.md)
|
||||
lists every operation. New domain operations live in explicit packages, Callable
|
||||
Plugins or Resource Providers. Add a core primitive only through the review
|
||||
recorded in [ADR-0064](../docs/adr/0064-stable-core-extension-boundary.md).
|
||||
|
||||
File operations:
|
||||
|
||||
```text
|
||||
resource.request("fs.exists", [path]) -> {ok:true, value:Bool}
|
||||
|
||||
Reference in new issue
Block a user