Skip to content

RFCs: structured execution contexts and manifest composition - #600

Open
leynos wants to merge 10 commits into
docs/rfc-0001-structured-command-blocksfrom
docs/rfc-manifest-composition-bundles
Open

RFCs: structured execution contexts and manifest composition#600
leynos wants to merge 10 commits into
docs/rfc-0001-structured-command-blocksfrom
docs/rfc-manifest-composition-bundles

Conversation

@leynos

@leynos leynos commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Summary

Adds the staged manifest-composition RFC sequence requested for the v0.2.0 design gate:

  • RFC 0002: repository-relative includes with literal capability-scoped paths, deterministic depth-first composition, cycle detection, namespaces, retained provenance, and duplicate rejection;
  • RFC 0003: versioned local bundles with Semantic Versioning, typed parameters, private-by-default exports, deterministic local catalogue resolution, canonical content digests, and lock records;
  • RFC 0004: later digest-pinned external Git bundles with exact tagged Git resolution, annotated/lightweight tag handling, peeled commit provenance, bounded acquisition, content-addressed caching, lock verification, and offline operation.

It also adds two normative amendments to RFC 0001:

  1. first-class capability-scoped cwd for direct, shell, sequence, and pipeline execution;
  2. action-local runtime bindings and secure execution contexts, including:
    • bounded UTF-8 stdout capture into a named child-environment binding;
    • pipe: stderr to connect one stage's standard error to the next stage's standard input;
    • cwd: { env: NAME } with text-versus-directory-capability enforcement; and
    • runner-created private temporary working directories, optionally bound to an environment name for later commands and always cleaned on completion.

Sequencing

This PR is intentionally stacked on #573 so its RFC numbering and documentation index build on RFC 0001. The implementation order remains:

  1. local repository-relative includes;
  2. versioned local bundles;
  3. only later, external digest-pinned acquisition.

Tagged Git references are supported in the external RFC as exact refs/tags/... resolution. Tags are discovery handles, not trust anchors: the lock record stores tag-object and peeled-commit identities, while the reviewed canonical bundle digest binds the bytes.

The structured-command amendments should be folded into RFC 0001 before that RFC moves from Proposed to Accepted.

Structured runtime contract

The new runtime-binding amendment deliberately avoids parent-process environment mutation. Captures and secure-directory bindings live only in one action-runner sequence and enter later child environments through an owned overlay.

Captured stdout is bounded before strict UTF-8 decoding, redacted by default, and committed only after successful execution. A text binding cannot grant authority to an absolute external directory merely by containing its path. Runner-created secure tempdirs carry a separate typed directory capability, receive owner-only permissions before child access, and are removed after success, failure, cancellation, or spawn error.

pipe: stderr selects standard error as the raw byte stream for the next stage's stdin. It does not merge stdout and stderr, and it never connects a process's own writable stderr handle to its own readable stdin.

Scope

Documentation and design only. This PR does not implement composition, bundle resolution, networking, caching, locking, structured-command working directories, runtime captures, stream selection, or secure tempdirs.

Review focus

  • deterministic merge and duplicate semantics in RFC 0002;
  • bundle parameter/export/version boundaries in RFC 0003;
  • exact tag normalization, retagging detection, digest pinning, and offline behaviour in RFC 0004;
  • RFC 0001 cwd resolution, capability, and stream-path semantics;
  • the lifetime and precedence of action-local environment bindings;
  • capture bounds, UTF-8/chomp behaviour, and redaction;
  • pipe: stderr validation and pipeline cleanup;
  • separation of text paths from typed secure-directory authority; and
  • secure tempdir creation, permissions, cross-stage use, and mandatory cleanup.

Related work

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @leynos, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 10 hours and 31 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: cb61324c-bd5d-41ed-a537-3566894fa556

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Warning

Your free Security trial is over. An organization admin can activate billing to continue.


Comment @coderabbitai help to get the list of available commands.

@sourcery-ai

sourcery-ai Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

This documentation-only PR establishes a staged manifest-composition design: RFC 0002 provides deterministic local includes, RFC 0003 layers typed and versioned local bundles with exports, digests, and locks, and RFC 0004 later extends the model to exact, digest-pinned Git acquisition; an RFC 0001 amendment independently standardizes capability-scoped structured-command working directories.

Sequence diagram for local bundle resolution and locking

sequenceDiagram
    participant Manifest
    participant Resolver
    participant Catalogue
    participant Bundle
    participant Lock

    Manifest->>Resolver: resolve bundle source and version
    Resolver->>Catalogue: enumerate candidates in sorted order
    Catalogue-->>Resolver: bundle descriptors
    Resolver->>Resolver: select highest compatible SemVer
    Resolver->>Bundle: validate parameters and exports
    Bundle-->>Resolver: canonical content digest
    Resolver->>Lock: verify selected version and digests
    Lock-->>Resolver: lock status
    Resolver-->>Manifest: namespaced exported declarations
Loading

Sequence diagram for digest-pinned external Git bundle verification

sequenceDiagram
    participant Manifest
    participant GitResolver
    participant GitRemote
    participant Cache
    participant Verifier
    participant Lock

    Manifest->>GitResolver: resolve exact tag or commit
    GitResolver->>GitRemote: fetch normalized refs/tags/... or full commit
    GitRemote-->>GitResolver: Git objects and tag provenance
    GitResolver->>Verifier: verify subdir, metadata, SemVer, and canonical digest
    Verifier->>Cache: read or publish content-addressed bundle
    Cache-->>Verifier: verified content
    Verifier->>Lock: compare tag, peeled commit, and digest
    Lock-->>Verifier: lock verification result
    Verifier-->>Manifest: verified bundle instance
Loading

Sequence diagram for structured command cwd execution

sequenceDiagram
    participant Compiler
    participant ActionRunner
    participant WorkspaceCapability
    participant ChildProcess

    Compiler->>ActionRunner: provide ProcessSpec with cwd
    ActionRunner->>WorkspaceCapability: resolve and validate cwd
    WorkspaceCapability-->>ActionRunner: capability-relative directory
    ActionRunner->>ChildProcess: spawn with current_dir(cwd)
    ChildProcess-->>ActionRunner: process result
Loading

Flow diagram for deterministic local manifest composition

flowchart TD
    ROOT[Root manifest]
    PARSE[Parse literal includes]
    RESOLVE[Resolve relative to including file]
    CHECK[Check workspace boundary and canonical identity]
    RECURSE[Compose nested includes depth-first]
    MERGE[Append declarations in post-order]
    VALIDATE[Reject cycles and duplicates]
    PROVENANCE[Retain source spans and include chains]
    GRAPH[Build deterministic manifest graph]

    ROOT --> PARSE
    PARSE --> RESOLVE
    RESOLVE --> CHECK
    CHECK --> RECURSE
    RECURSE --> MERGE
    MERGE --> VALIDATE
    VALIDATE --> PROVENANCE
    PROVENANCE --> GRAPH
Loading

File-Level Changes

Change Details Files
Adds a normative cwd contract for structured commands.
  • Defines workspace-root-relative rendering and capability confinement.
  • Specifies direct, shell, adjacent-command, and per-pipeline-stage behavior.
  • Keeps stream paths workspace-relative and extends IR, diagnostics, validation, and tests.
docs/rfcs/0001-amendment-command-working-directories.md
Defines deterministic repository-local manifest composition.
  • Adds literal repository-relative includes with depth-first post-order traversal.
  • Adds canonical identity checks, cycle and repeated-include rejection, namespaces, and typed section merge rules.
  • Retains source provenance and includes composed content in graph fingerprints and metadata.
docs/rfcs/0002-repository-relative-includes.md
Introduces versioned local bundle semantics above includes.
  • Defines bundle descriptors, SemVer constraints, deterministic catalogue selection, and typed parameters.
  • Makes exports explicit and private-by-default, with namespace-scoped instantiation and bundle-local capability boundaries.
  • Adds canonical content and parameter digests, lock verification, provenance, and offline-only local resolution.
docs/rfcs/0003-versioned-local-bundles.md
Specifies a later digest-pinned external Git bundle boundary.
  • Restricts external sources to exact tags or full commit IDs with strict ref normalization and annotated/lightweight tag provenance.
  • Requires canonical bundle digests, lock records, retagging detection, bounded acquisition, and verification of selected subtrees.
  • Defines content-addressed caching, offline/locked/update modes, transport security, credential redaction, and disabled Git side effects.
docs/rfcs/0004-digest-pinned-external-bundles.md
Indexes the new RFC documents in the documentation contents.
  • Adds links and concise descriptions for the cwd amendment and RFCs 0002–0004.
docs/contents.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

codescene-access[bot]

This comment was marked as outdated.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9304b658e5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -0,0 +1,501 @@
# RFC 0001 amendment: Structured-command working directories

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Allocate a unique RFC number to the amendment

This creates a second document identified as RFC 0001 alongside the existing 0001-structured-command-blocks.md, despite the documentation style guide requiring sequentially allocated RFC numbers, the # RFC NNNN: ... title form, and an RFC-number preamble entry. References to “RFC 0001” are consequently ambiguous, so either fold this proposal into the original as described later in the document or allocate it its own number before publishing it.

AGENTS.md reference: AGENTS.md:L57-L58

Useful? React with 👍 / 👎.

Comment on lines +175 to +178
- source:
catalogue: build/bundle-catalogue/rust-quality
version: "^1.4"
as: rust

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Name the bundle selected from a catalogue

When a catalogue contains descriptors for more than one declared bundle name, this import supplies only a version range and namespace, while the resolution algorithm groups candidates by bundle name and then says to select the highest matching version. There is no rule for choosing among those groups, so implementations can select different bundle identities from the same catalogue. Add an expected bundle name to the import or require and validate that every candidate has one identity.

Useful? React with 👍 / 👎.

Comment on lines +357 to +358
- files not reachable from the bundle composition unless the descriptor lists
them as runtime resources; and

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Bind every executable bundle resource into the digest

A bundle recipe can invoke a bundled script or consume a data file that is not reachable through the manifest include graph, but this exclusion leaves that file outside the content digest. The descriptor schema defines no runtime-resource field—the mechanism is still an open question—so changing such a script would continue to satisfy local lock verification and RFC 0004's mandatory external digest even though executed behaviour changed. Define and require a resource declaration now, or hash the complete selected bundle tree.

Useful? React with 👍 / 👎.

codescene-access[bot]

This comment was marked as outdated.

@leynos leynos changed the title RFCs: deterministic manifest composition and bundle provenance RFCs: structured execution contexts and manifest composition Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant