Skip to content

Add RFC 0001 for field-level environment aliases#354

Open
lodyai[bot] wants to merge 4 commits into
mainfrom
rfc-0001-env-field-aliases
Open

Add RFC 0001 for field-level environment aliases#354
lodyai[bot] wants to merge 4 commits into
mainfrom
rfc-0001-env-field-aliases

Conversation

@lodyai

@lodyai lodyai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

This branch adds the repository's first Request for Comments,
RFC 0001: Field-level environment aliases,
and indexes it from the documentation contents file. The RFC proposes that
ortho_config grow first-class, field-level environment projections: a
declarative env(...) field attribute binding a configuration field to one or
more environment-variable names, with deterministic intra-environment
precedence (the prefixed canonical name shadows aliases by default),
empty-value handling, and secret-redaction metadata. It is motivated by two
consumers — vk (a GITHUB_TOKEN fallback resolved today by bespoke code) and
podbot (a hand-written environment-to-config-path table) — and lets both
delete that hand-rolled machinery without the crate ever scanning the whole
process environment.

This is a documentation-only change carrying a proposal for review. The RFC
status is Proposed; no runtime, derive-macro, or IR code changes in this
branch. There is no associated roadmap task, issue, or execplan: the document
itself is the deliverable, and it is the artefact under review.

Review walkthrough

  • Start with
    docs/rfcs/0001-field-level-environment-aliases.md
    — the proposal itself. Sections 1–4 establish the problem, the current
    single-environment-layer behaviour, and the goals and non-goals.
  • The load-bearing decisions live in
    §5 Proposed design:
    the precedence model and the central invariant that aliases select a single
    value before the one environment layer and never concatenate (§5.4), the
    macro attribute grammar (§5.2), the internal resolver glue (§5.3), the
    Secret<T> plus secret-path-set redaction model (§5.5), and the
    backwards-compatible EnvMetadata IR extension with the honest
    ir_version bump (§5.6).
  • Review
    §7 Compatibility and migration
    for the before/after vk and podbot migrations and the SemVer impact, and
    §9 Alternatives considered
    and §10 Prior art
    for the rejected options and the precedents they draw on.
  • Finish with
    §13 Design-review findings folded in,
    which records the material findings from a multi-perspective review and where
    each was addressed.
  • Then check
    docs/contents.md
    for the new "Requests for comments (RFCs)" section linking the document.

Scope notes

  • The "environment-variable names as configuration values" primitive
    (podbot's env_allowlist, the proposed env_value_names/EnvPassthrough)
    is deliberately deferred to a planned companion, RFC 0002. The conceptual
    separation is settled in §5.7; the concrete design is out of scope here
    because it shares no mechanism with aliasing beyond the secret vocabulary.
  • The document was drafted with assistance from a design-research team and
    prior-art research, then stress-tested through a multi-perspective design
    review before being revised; the panel's verdict was "revise", and the
    material findings are folded into the current draft (see §13).

Validation

  • make markdownlint: 61 files linted, 0 errors.
  • make nixie: all Mermaid diagrams validated successfully.
  • make check-fmt: passed.
  • make lint: passed.
  • make typecheck: passed.
  • RUST_TEST_THREADS=1 make test BUILD_JOBS=-j1: passed. The initial
    unbounded make test run hit rustc thread/process resource exhaustion in
    parallel BDD bridge builds, then passed when serialized.

References

Propose first-class field-level environment projections in ortho_config: a
declarative `env(...)` field attribute binding a field to one or more
environment-variable names, with deterministic intra-environment precedence
(canonical name shadows aliases by default), empty-value handling, and
secret-redaction metadata. Motivated by the vk (GITHUB_TOKEN fallback) and
podbot (hand-written env-to-path table) use cases.

The RFC keeps the orthodox precedence (defaults < files < environment < CLI)
and the single-environment-layer merge model: aliases SELECT one value before
the layer, never concatenate, so collection append strategies are unaffected.
It specifies the macro grammar, internal resolver glue (not public API), the
Secret<T> + secret-path-set redaction model, a backwards-compatible EnvMetadata
IR extension (ir_version 1.1 -> 1.2), and vk/podbot migration. The "env var
names as values" primitive (podbot env_allowlist) is deferred to RFC 0002.

Grounded in prior art (pydantic AliasChoices, Viper BindEnv, clap env, config-rs
ignore_empty, GitHub CLI GH_TOKEN/GITHUB_TOKEN ordering, 12-factor) and revised
after a multi-perspective design review (recorded in section 13).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@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 @LodyAI[bot], you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 321ee965-21d3-4bf3-9093-987473e39e1a

📥 Commits

Reviewing files that changed from the base of the PR and between 3e6f6c8 and f38922e.

📒 Files selected for processing (2)
  • .gitignore
  • docs/rfcs/0001-field-level-environment-aliases.md

Added RFC 0001 documenting field-level environment-variable aliases for ortho_config, including:

  • a new #[ortho_config(env(...))] field attribute grammar for aliasing and precedence
  • empty-value handling, skip behaviour, and secret redaction metadata
  • IR/schema updates (EnvMetadata changes, ir_version bump, legacy compatibility)
  • migration guidance for vk and podbot
  • a testing strategy covering precedence, merge safety, and redaction

Also updated docs/contents.md to link the new RFC, refined an execplan note about PowerShell parsing validation, and added .memdb/ to .gitignore.

Walkthrough

Add a new RFC for field-level environment aliases, link it from the contents page, update one execution plan’s PowerShell validation guidance and Milestone 2 scenario example, and ignore the .memdb/ directory.

Changes

RFC 0001: Field-level environment aliases

Layer / File(s) Summary
RFC specification and index entry
docs/rfcs/0001-field-level-environment-aliases.md, docs/contents.md
Add the RFC 0001 document defining #[ortho_config(env(...))], precedence, empty-value handling, secret redaction, IR changes, migration/testing guidance, and add a contents-page link to it.

Nested command-tree behavioural fixtures

Layer / File(s) Summary
Parse validation guidance
docs/execplans/6-1-2-nested-command-tree-behavioural-fixtures.md
Reword the PowerShell AST-parse note to refer to the standard ParseFile gate and keep it skipped when pwsh is absent.
Milestone 2 scenario binding example
docs/execplans/6-1-2-nested-command-tree-behavioural-fixtures.md
Replace the inline fixture example with the new scenarios! block form using NestedDocsContext for tests/features/docs_ir_nested.feature.

.gitignore maintenance

Layer / File(s) Summary
.memdb ignore entry
.gitignore
Add a new ignore pattern for the .memdb/ directory.

Possibly related PRs

  • leynos/vk#191 — Shares the same docs/contents.md index-structure area and RFC-style documentation organisation.

Suggested reviewers: codescene-delta-analysis

Poem

An RFC unfurled with aliases bright,
A contents page marked it in sight.
One plan learned its parse gate, one snippet found form,
And .memdb/ vanished from norm.

🚥 Pre-merge checks | ✅ 20
✅ Passed checks (20 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately names the main change: adding RFC 0001 for field-level environment aliases.
Description check ✅ Passed The description directly matches the documentation-only RFC change and its documentation index update.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Testing (Overall) ✅ Passed PASS: This branch is documentation-only plus a .gitignore tweak; it adds no runtime behaviour or test code, so the testing gate is not applicable.
User-Facing Documentation ✅ Passed Documentation-only RFC/index changes; no runtime or user-facing behaviour changed, so docs/users-guide.md need not be updated.
Developer Documentation ✅ Passed PASS: the new RFC records the architectural decision, docs/contents links it, roadmap 6.1.2 is checked off, and the execplan progress is current.
Module-Level Documentation ✅ Passed PASS — this PR only changes markdown/docs and .gitignore; no Rust modules were added or modified, so the module docstring rule is unaffected.
Testing (Unit And Behavioural) ✅ Passed Docs-only PR; changed files are documentation and .gitignore only, and no test sources were added or modified, so unit/behavioural coverage is not applicable.
Testing (Property / Proof) ✅ Passed RFC §8.1/8.2 explicitly requires proptest property tests for the resolver’s ordering and no-whole-environment invariants; no proof obligations were introduced.
Testing (Compile-Time / Ui) ✅ Passed PASS: The PR only updates docs and .gitignore; no compile-time or UI code paths changed, so trybuild/snapshot testing is not applicable.
Unit Architecture ✅ Passed PASS: this PR is documentation-only (.md files plus .gitignore); it adds no runtime units, side-effects, or hidden dependencies.
Domain Architecture ✅ Passed PASS: The PR is documentation-only (RFC, index, execplan note) plus .gitignore, so no domain/runtime boundary is changed.
Observability ✅ Passed Docs-only RFC and index update; no runtime, logging, metrics, tracing, or alerting behaviour changed, so observability requirements are not applicable.
Security And Privacy ✅ Passed Docs-only changes; no code paths, credentials, or auth logic changed. Secret mentions are illustrative env names and redaction guidance only.
Performance And Resource Use ✅ Passed PASS: The PR is documentation-only plus a .gitignore update; no runtime code, loops, allocations, I/O, or hot-path logic changed.
Concurrency And State ✅ Passed Docs-only RFC; no shared mutable state or async/task code was introduced, and the test plan serialises env-mutating cases while checking ordering and merge invariants.
Architectural Complexity And Maintainability ✅ Passed PASS: The RFC grounds the abstraction in vk/podbot, keeps runtime glue internal, preserves one environment layer, and defers the unrelated names-as-values primitive to RFC 0002.
Rust Compiler Lint Integrity ✅ Passed PASS: The PR touches only docs and .gitignore; no Rust sources changed, so it adds no lint suppressions, dead-code anchors, or suspicious clones.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rfc-0001-env-field-aliases

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

@pandalump pandalump marked this pull request as ready for review June 19, 2026 18:34
Extend RFC 0001's testing strategy to require property coverage for
resolver precedence, no-whole-environment scanning, and collection merge
safety. These are the ordering and state-transition invariants raised by
review feedback, so the implementation plan now names the generated input
ranges and the oracle for each property.

Shorten two stale execplan lines that blocked the repository Markdown lint
gate while validating this documentation change.
codescene-access[bot]

This comment was marked as outdated.

@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/rfcs/0001-field-level-environment-aliases.md`:
- Around line 830-850: Rewrap the affected paragraphs in §6.2 so they respect
the 80-column Markdown wrapping rule and don’t split clauses awkwardly. In the
list item about runtime behavior, keep “compiles and loads identically” together
instead of leaving “and” dangling, and in the item about runtime glue types,
keep “are internal” with the `#[doc(hidden)]` parenthetical on adjacent lines.
Use the existing prose around the aliases/runtime-glue bullets as the anchor
when reflowing the text.
- Around line 896-909: The migration example uses .as_deref() on Secret<String>,
but Secret<T> in §5.5 does not currently specify any Deref-style access, so fix
the inconsistency by either adding an explicit accessor/Deref behavior to
Secret<T> or changing the example to use the intended secret-exposure method;
update the Secret<T> definition and the token access example together so they
match, using the unique symbols Secret<T> and the github_token example in the
migration section.
- Around line 1246-1284: The RFC still uses named footnotes in the footnote
definitions, which conflicts with the required GitHub-flavoured numeric style.
Update the footnote references and definitions in this section so they use
sequential numeric labels in order of first appearance, and renumber any later
citations consistently; use the existing footnote blocks like ghcli, viper,
figment, pydantic, configrs, clap, twelvefactor, and spring as the set to
convert.
- Around line 559-567: The object-merge example in the RFC uses prime notation
in the pseudocode, which is ambiguous and may be read as a literal key name.
Update the example in the merge semantics section near the
`merge_value`/`declarative/merge.rs` discussion to either replace `url'` with a
clearer placeholder like `url_new` or add a brief parenthetical clarifying that
the prime marks a replaced value, not a field name.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: efc03a1b-b69d-4b1e-bf9e-987c265fe8c5

📥 Commits

Reviewing files that changed from the base of the PR and between 6bb29c1 and 3e6f6c8.

📒 Files selected for processing (3)
  • docs/contents.md
  • docs/execplans/6-1-2-nested-command-tree-behavioural-fixtures.md
  • docs/rfcs/0001-field-level-environment-aliases.md

Comment thread docs/rfcs/0001-field-level-environment-aliases.md
Comment thread docs/rfcs/0001-field-level-environment-aliases.md
Comment thread docs/rfcs/0001-field-level-environment-aliases.md
Comment thread docs/rfcs/0001-field-level-environment-aliases.md Outdated
Clarify the field-level environment alias RFC after review. Keep the
technical requirements wrapped cleanly, define an explicit `Secret<T>`
accessor used by the `vk` migration example, replace ambiguous prime
notation in the merge example, and convert prior-art footnotes to the
numeric style required by the documentation guide.
codescene-access[bot]

This comment was marked as outdated.

Add `.memdb/` to the repository ignore list so local agent memory daemon
state does not leave worktrees dirty after validation runs.
@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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