Skip to content

docs(architecture): add ADR-0008 map-file schema specification - #212

Merged
macalbert merged 6 commits into
mainfrom
macalbert/docs/map-file-schema
May 3, 2026
Merged

docs(architecture): add ADR-0008 map-file schema specification#212
macalbert merged 6 commits into
mainfrom
macalbert/docs/map-file-schema

Conversation

@macalbert

@macalbert macalbert commented May 2, 2026

Copy link
Copy Markdown
Owner

Summary

Defines the formal JSON Schema v1 for the map-file format — the universal contract between CLI, GitHub Action, and all runtime SDKs.

Key Decisions

  • Root structure: $schema (IDE autocomplete) + $config (config + metadata) + variables
  • Reserved $ prefix: parsers MUST ignore all $-prefixed keys (replaces exact-match on $config)
  • $config strict fields: provider, profile, vaultUrl, projectId, path, namespace + metadata (name, description, owner, environment)
  • file provider: enables consumer testing without cloud infrastructure via EnvilderOptions.FromFile(path)
  • One file = one provider = one environment
  • Variable name pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$
  • additionalProperties: false on $config to catch typos

Follow-up Work

  • Publish JSON Schema at spec/map-file.v1.json
  • Update parsers (4 stacks) from exact $config match to $ prefix filter
  • Implement file provider in each SDK
  • Implement EnvilderOptions.FromFile in each SDK
  • Host schema at https://envilder.com/schema/map-file.v1.json

Summary by CodeRabbit

  • Documentation
    • Added schema specification documentation (v1) for map files, detailing required structure, configuration options, supported providers, parsing rules, and validation requirements.

macalbert added 2 commits May 3, 2026 00:09
Defines the formal JSON Schema v1 for the map-file format:
- Root structure: $schema (IDE autocomplete) + $config (config/metadata) + variables
- Reserved $ prefix rule: parsers MUST ignore all $-prefixed keys
- $config strict fields: provider, profile, vaultUrl, projectId, path, namespace + metadata
- file provider for consumer testing via EnvilderOptions.FromFile(path)
- One file = one provider = one environment
- Variable name pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$
- additionalProperties: false on $config

Also updates ADR index in common-architecture-decisions SKILL.
Copilot AI review requested due to automatic review settings May 2, 2026 22:11
@coderabbitai

coderabbitai Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@macalbert has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 22 minutes and 43 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a6df590e-81cc-40f3-bd2b-b42f35a3cf18

📥 Commits

Reviewing files that changed from the base of the PR and between b44fd1f and 881f919.

⛔ Files ignored due to path filters (1)
  • .github/skills/common-architecture-decisions/SKILL.md is excluded by none and included by none
📒 Files selected for processing (1)
  • docs/architecture/adr/0008-map-file-schema.md

Walkthrough

This PR adds ADR-0008, a comprehensive architecture decision record documenting Envilder's v1 map-file schema specification. The ADR defines the root structure, optional configuration fields, variable mapping semantics across providers (AWS, Azure, GCP, HashiCorp, and a new file provider for testing), parsing rules for reserved $-prefixed keys, JSON schema publication details, cross-provider validation requirements, and consequences of the schema constraints.

Changes

ADR-0008 Map File Schema Specification

Layer / File(s) Summary
Context & Rationale
docs/architecture/adr/0008-map-file-schema.md (lines 7–26)
Establishes the need for a formal map-file schema contract, current lack of specification, reserved-key handling, variable naming constraints, and testing without real vault infrastructure.
Schema Definition & Structure
docs/architecture/adr/0008-map-file-schema.md (lines 28–58)
Defines v1 map-file JSON structure with required $schema and $config keys, reserved $* prefixes, and at least one variable mapping; provides concrete example.
Configuration & Metadata
docs/architecture/adr/0008-map-file-schema.md (lines 59–83)
Documents optional $config fields for provider setup and informational metadata ignored at runtime; establishes "one file, one provider, one environment" principle.
Provider Mapping Semantics
docs/architecture/adr/0008-map-file-schema.md (lines 99–110)
Specifies how each provider (AWS, Azure, GCP, HashiCorp) interprets variable-to-secret mappings.
File Provider for Testing
docs/architecture/adr/0008-map-file-schema.md (lines 111–154)
Introduces new file provider for development and CI testing via dedicated map file or SDK option overrides; describes WithOverride per-test mechanism.
Parsing Rules & Reserved Prefix
docs/architecture/adr/0008-map-file-schema.md (lines 155–164)
Mandates parsers ignore all $-prefixed keys to future-proof the format; documents backward-compatibility behavior.
Schema Publication & Discovery
docs/architecture/adr/0008-map-file-schema.md (lines 165–172)
Specifies JSON schema versioning via $schema URL, v1 default when absent, and repository location for the schema file.
Cross-Provider Validation
docs/architecture/adr/0008-map-file-schema.md (lines 173–183)
Lists validation rules that reject incompatible $config field and provider combinations.
Consequences & Reconsideration
docs/architecture/adr/0008-map-file-schema.md (lines 184–210)
Enumerates positive outcomes (validation, typo detection, test-friendly file provider, future extensibility) and negative outcomes (coordinated parser updates, strict schema, new SDK adapter); defines conditions for future schema evolution.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding ADR-0008 for the map-file schema specification, which is the primary objective of this pull request.
Description check ✅ Passed The pull request description is comprehensive and covers all required sections from the template: summary of changes, type of change (Documentation), and notes for reviewers including key decisions and follow-up work.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch macalbert/docs/map-file-schema

Tip

💬 Introducing Slack Agent: Turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get your free trial and get 200 agent minutes per Slack user (a $50 value).


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 22 minutes and 43 seconds.

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

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces ADR-0008, which formalizes the Map-File Schema Specification for Envilder. The new specification defines a JSON schema, reserved keys (prefixed with $), and a new file provider to facilitate local testing without cloud infrastructure. Review feedback identified several areas for improvement, including correcting terminology inconsistencies between documentation and code examples, fixing a typo in the backward compatibility section, addressing a potential breaking change regarding variable naming constraints, and suggesting a more comprehensive approach to cross-provider validation rules.

Comment thread docs/architecture/adr/0008-map-file-schema.md Outdated
Comment thread docs/architecture/adr/0008-map-file-schema.md Outdated
Comment thread docs/architecture/adr/0008-map-file-schema.md Outdated
Comment thread docs/architecture/adr/0008-map-file-schema.md Outdated

@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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/architecture/adr/0008-map-file-schema.md`:
- Around line 167-171: The ADR currently states the schema "is published" at
`https://envilder.com/schema/map-file.v1.json` and "lives in the repository at
`spec/map-file.v1.json`" but the PR intends publication as a follow-up; update
the wording to future/planned tense (e.g., "will be published" / "will live") or
add an "implementation status" note indicating publication is pending, and
preserve the references to `$schema` and absence of a `version` field so readers
know files without a `$schema` are assumed v1 until the schema URL and
`spec/map-file.v1.json` are actually published.
- Around line 75-87: Section 4's "One File, One Provider, One Environment" claim
conflicts with the `environment` metadata being optional/ignored; update the ADR
text to be explicit: either state this is a non-enforced convention (leave
`environment` optional/ignored) or mandate enforcement and describe the
mechanism (e.g., add schema validation that requires `environment`, runtime
validation in map-loading code, or a filename/naming convention that tooling
enforces). Reference the `environment` field and the Section 4 heading ("One
File, One Provider, One Environment") in your change and include the chosen
enforcement details (schema key name, validation step, or naming rule) so
readers know whether the rule is contractual or merely advisory.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: dd246dbe-d3c9-4776-9bc2-ac2db36e9f58

📥 Commits

Reviewing files that changed from the base of the PR and between 50d4d80 and b44fd1f.

⛔ Files ignored due to path filters (1)
  • .github/skills/common-architecture-decisions/SKILL.md is excluded by none and included by none
📒 Files selected for processing (1)
  • docs/architecture/adr/0008-map-file-schema.md

Comment thread docs/architecture/adr/0008-map-file-schema.md Outdated
Comment thread docs/architecture/adr/0008-map-file-schema.md Outdated

Copilot AI 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.

Pull request overview

This PR adds ADR-0008 to formally define the map-file schema as a shared contract across Envilder’s CLI, GitHub Action, and SDKs, and updates the architecture skill index to reference the new decision. It is primarily documentation/architecture work that sets direction for later implementation across stacks.

Changes:

  • Add ADR-0008 describing the proposed map-file JSON Schema v1, reserved-key rules, provider/config fields, and testing-oriented file provider design.
  • Document cross-provider validation and publication/versioning expectations for the schema.
  • Update the architecture decision skill index to include newer ADR entries, including ADR-0008.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
docs/architecture/adr/0008-map-file-schema.md New ADR defining the proposed map-file schema, provider fields, reserved $ behavior, and follow-on implementation direction.
.github/skills/common-architecture-decisions/SKILL.md Expands the ADR index so the shared architecture skill references newer decision records.

Comment thread docs/architecture/adr/0008-map-file-schema.md Outdated
Comment thread docs/architecture/adr/0008-map-file-schema.md
Comment thread docs/architecture/adr/0008-map-file-schema.md
Comment thread docs/architecture/adr/0008-map-file-schema.md Outdated
Comment thread docs/architecture/adr/0008-map-file-schema.md Outdated
Comment thread .github/skills/common-architecture-decisions/SKILL.md
@macalbert

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

Copilot AI commented May 3, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

The merge conflicts were already resolved in commit 285bdef ("Merge branch 'main' into macalbert/docs/map-file-schema"). The branch is now up to date with main, and all CI checks (Lint, CodeQL) are passing with a green status.

…le-schema

# Conflicts:
#	.github/skills/common-architecture-decisions/SKILL.md
Copilot AI review requested due to automatic review settings May 3, 2026 00:46

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

Comment thread docs/architecture/adr/0008-map-file-schema.md Outdated
Comment thread .github/skills/common-architecture-decisions/SKILL.md Outdated
Comment thread docs/architecture/adr/0008-map-file-schema.md Outdated
Comment thread docs/architecture/adr/0008-map-file-schema.md
Comment thread docs/architecture/adr/0008-map-file-schema.md Outdated
macalbert added 2 commits May 3, 2026 03:04
- Fix WithDefaults → WithOverride terminology consistency
- Fix  →  typo in backward compatibility section
- Relax variable naming regex to advisory SHOULD (non-breaking)
- Add general cross-provider validation rule with exhaustive field table
- Clarify 'One Environment' as organizational convention, not enforced
- Change schema publication to future tense (pending follow-up)
- Note gcp/hashicorp providers as planned, not yet implemented
- Add Node.js implementation note for overload resolution
- Add proposed API note to section 6 (file provider examples)
- Mark SKILL.md ADR-0008 entry with (planned) for unimplemented APIs
Copilot AI review requested due to automatic review settings May 3, 2026 01:15
@macalbert
macalbert merged commit 12a4271 into main May 3, 2026
8 checks passed
@macalbert
macalbert deleted the macalbert/docs/map-file-schema branch May 3, 2026 01:17

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

Comment on lines +179 to +181
**Backward compatibility:** Existing map files (without `$schema` or `$config`)
work identically. The only behavioral change: SDKs stop making vault calls for
`$schema` values that would previously leak through as variable mappings.
Comment on lines +148 to +150
```python
# Python
Envilder.load("param-map.json", EnvilderOptions.from_file(".env.test"))
| [ADR-0005](../../../docs/architecture/adr/0005-sdk-integration-tiers.md) | SDK Integration Tiers | All SDKs | Three tiers (Facade, Builder, Framework); Tier 3 separate package; .NET exception; community-driven |
| [ADR-0006](../../../docs/architecture/adr/0006-monorepo-structure.md) | Monorepo Structure | All components | Single repo, independent releases per component via version-bump detection, no orchestrator |
| [ADR-0007](../../../docs/architecture/adr/0007-trunk-based-development.md) | Trunk-Based Development | All components | Single main branch, short-lived feature branches, squash merge, feature flags for incomplete work |
| [ADR-0008](../../../docs/architecture/adr/0008-map-file-schema.md) | Map-File Schema Specification | All components | JSON Schema v1, `$` prefix reserved, `$config` strict fields, `file` provider for testing (planned), `EnvilderOptions.FromFile` (planned) |
Comment on lines +196 to +205
SDKs MUST reject any provider-specific `$config` field that does not belong to
the active provider. Each field has exactly one valid provider:

| Field | Valid provider(s) |
| ----- | ----------------- |
| `profile` | `aws` |
| `vaultUrl` | `azure`, `hashicorp` |
| `projectId` | `gcp` |
| `namespace` | `hashicorp` |
| `path` | `file` |
Comment on lines +73 to +79
| `provider` | enum | `aws`, `azure`, `gcp`, `hashicorp`, `file` | Secret provider. Default: `aws`. Note: `gcp` and `hashicorp` are planned — not yet implemented in CLI or SDKs |
| `profile` | string | AWS-only | AWS CLI profile name |
| `vaultUrl` | string (URI) | Azure/HashiCorp-only | Vault endpoint URL |
| `projectId` | string | GCP-only | GCP project identifier |
| `path` | string | File-only | Path to `.env` source file |
| `namespace` | string | HashiCorp-only | Vault namespace |

Comment on lines +66 to +67
All fields are optional. `additionalProperties: false` — unknown fields are
rejected to catch typos.
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.

3 participants