Skip to content

design: feature-gated write-mode - #678

Closed
cdoan1 wants to merge 5 commits into
openshift-online:mainfrom
cdoan1:ROSAENG-61570-design
Closed

design: feature-gated write-mode#678
cdoan1 wants to merge 5 commits into
openshift-online:mainfrom
cdoan1:ROSAENG-61570-design

Conversation

@cdoan1

@cdoan1 cdoan1 commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

doc design for feature-gated write-mode from just visibility

Summary by CodeRabbit

  • Documentation
    • Added a new design proposal for feature-gated write-mode behavior.
    • Defines marker syntax and how per-feature-set write-mode overrides are selected.
    • Includes backward-compatibility guidance, precedence rules, and planned validation/testing coverage for default vs gated outcomes.

cdoan1 and others added 2 commits July 9, 2026 09:28
Add design document for extending the marker system to support
feature-set-specific write-mode overrides. This enables gradual
rollout of customer control over sensitive fields by allowing
different write modes (mutable/immutable/service-set) per feature
set (Default/TechPreview/DevPreview).

Addresses use cases like making etcd config service-set for
production but mutable for TechPreview customers.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d946a9f4-0a90-4fbf-a240-b8f8e8016275

📥 Commits

Reviewing files that changed from the base of the PR and between 22195ba and 6d28a93.

📒 Files selected for processing (1)
  • docs/design/feature-gated-write-mode-design.md
💤 Files with no reviewable changes (1)
  • docs/design/feature-gated-write-mode-design.md

📝 Walkthrough

Walkthrough

This PR adds a design document for feature-gate-aware write-mode overrides, covering marker syntax, metadata changes, implementation phases, runtime validation, examples, compatibility, and rollout guidance. No code or exported entities change.

Changes

Feature-gated write-mode design

Layer / File(s) Summary
Write-mode contract and implementation plan
docs/design/feature-gated-write-mode-design.md
Defines gated marker syntax, allowed modes, ordered metadata overrides, precedence rules, and planned parsing, generation, validation, and test changes.
Examples and rollout guidance
docs/design/feature-gated-write-mode-design.md
Documents opt-in compatibility behavior, usage examples, trade-offs, rejected alternatives, open questions, and related references.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the new design document about feature-gated write-mode.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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

🧹 Nitpick comments (1)
docs/design/feature-gated-write-mode-design.md (1)

1-9: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reframe this as an ADR.

docs/design/** is supposed to use ADR format, but this reads more like a proposal summary. Please add explicit Context / Decision / Consequences sections so the chosen syntax and rollout trade-offs are easy to review and maintain.

As per path instructions, docs/design/**: Review design decisions for ADR format compliance. Ensure decisions are well-justified and align with the regional architecture goals.

🤖 Prompt for 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.

In `@docs/design/feature-gated-write-mode-design.md` around lines 1 - 9, Reframe
the document headed by Feature-Gated Write-Mode Control into ADR format instead
of a proposal summary. Update the top-level structure in this design doc to
include explicit Context, Decision, and Consequences sections, and move the
current problem statement and review details into the appropriate ADR sections.
Keep the description centered on the chosen syntax and rollout trade-offs so the
decision is easy to review and maintain.

Source: Path instructions

🤖 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/design/feature-gated-write-mode-design.md`:
- Around line 110-119: The parser loop that builds gatedModes from
writeModeGatedPattern currently overwrites earlier entries when the same
featureSet appears more than once, which makes comment order affect the result.
Update the parsing logic around the gatedModes map population to detect
duplicate featureSet keys and return a parse error instead of assigning the
later WriteMode, then only assign meta.GatedWriteModes when the collected
entries are unique.
- Around line 174-201: The proposed validator test matrix only covers Default
and TechPreview, so it does not verify the documented base-mode fallback for an
unspecified feature set. Update TestValidator_GatedWriteMode in the
feature-gated write mode design tests to include a DevPreview or equivalent
non-overridden FeatureSet case for spec.etcd, and assert the expected write
behavior there. Keep the existing ServiceSet/Default and TechPreview coverage,
but add this fallback case so the validator logic cannot accidentally inherit
the wrong override.

---

Nitpick comments:
In `@docs/design/feature-gated-write-mode-design.md`:
- Around line 1-9: Reframe the document headed by Feature-Gated Write-Mode
Control into ADR format instead of a proposal summary. Update the top-level
structure in this design doc to include explicit Context, Decision, and
Consequences sections, and move the current problem statement and review details
into the appropriate ADR sections. Keep the description centered on the chosen
syntax and rollout trade-offs so the decision is easy to review and maintain.
🪄 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: Enterprise

Run ID: dd287bc9-fcda-48f9-b10c-256d2f737a0b

📥 Commits

Reviewing files that changed from the base of the PR and between 942b09d and f16b4da.

📒 Files selected for processing (1)
  • docs/design/feature-gated-write-mode-design.md

Comment thread docs/design/feature-gated-write-mode-design.md Outdated
Comment thread docs/design/feature-gated-write-mode-design.md
cdoan1 pushed a commit to cdoan1/hyperfleet-api-codegen that referenced this pull request Jul 9, 2026
Incorporated feedback from ROSAENG-61570 Jira comments and Slack discussion:

**Key Changes:**

1. **Marker Syntax** - Changed from bracket syntax to OpenShift multi-argument pattern:
   - Before: `+hyperfleet:write-mode[FeatureSetName]=mutable`
   - After: `+hyperfleet:validation:FeatureGateAwareWriteMode:featureGate="GateName",writeMode="mutable"`
   - Follows existing patterns: FeatureGateAwareEnum, FeatureGateAwareXValidation

2. **Primary Use Case** - Clarified that write-mode control works independently of feature gating:
   - GA fields (no FeatureGate marker) can use it for customer-tier control
   - Example: Standard customers get immutable, Premium customers get mutable
   - Not limited to fields behind feature gates

3. **Data Model** - Changed from map to slice:
   - Before: `GatedWriteModes map[string]WriteMode`
   - After: `FeatureGateAwareWriteModes []FeatureGateWriteMode`
   - Preserves marker order, supports empty-string default

4. **Validation Logic** - Updated to check customer's enabled feature gates:
   - Request needs `EnabledFeatureGates []string` field
   - Validation checks if specific gate is enabled for customer
   - Priority: specific gate match > default ("") > base WriteMode

**New Examples:**
- GA field with customer-tier control (no FeatureGate required)
- Progressive write-mode rollout for gated fields
- Multiple gate-based overrides

**Feedback Source:**
- Jira: https://redhat.atlassian.net/browse/ROSAENG-61570
- Slack: https://redhat-internal.slack.com/archives/C0A819QK7M5/p1783585582976459
- PR reference: openshift-online/rosa-hyperfleet#678

**Open Questions:**
- Marker namespace choice
- Multiple-gate priority behavior
- Customer gate enablement mechanism

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Major revisions based on Slack/Jira feedback:

- Change marker syntax from bracket notation to follow OpenShift
  conventions: +hyperfleet:validation:FeatureGateAwareWriteMode
- Clarify primary use case: GA fields with customer-tier control,
  not just gated fields
- Update data model to use list of FeatureGateWriteMode instead of map
- Add validation logic for checking customer's enabled feature gates
- Include detailed feedback section documenting design evolution
- Add more comprehensive examples covering GA and gated fields

References OpenShift patterns: FeatureGateAwareEnum and
FeatureGateAwareXValidation for multi-argument marker syntax.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/design/feature-gated-write-mode-design.md (1)

183-189: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Keep the generated overrides ordered end-to-end.

map[string]string drops declaration order and conflicts with the earlier list-based FeatureGateAwareWriteModes model. That makes precedence depend on serialization rather than the marker order the spec promises.

Suggested shape
-    GatedWriteModes map[string]string  // NEW
+    GatedWriteModes []FeatureGateWriteMode
🤖 Prompt for 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.

In `@docs/design/feature-gated-write-mode-design.md` around lines 183 - 189, The
new GatedWriteModes field on templateField should preserve marker order instead
of using a map, because map[string]string loses declaration order and breaks the
intended precedence from FeatureGateAwareWriteModes. Update the templateField
shape and any related generation logic to use an ordered list or slice-based
structure, and make sure the code that builds and consumes GatedWriteModes in
the feature-gated write mode flow keeps overrides in the same end-to-end order
as the source markers.
🤖 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/design/feature-gated-write-mode-design.md`:
- Around line 401-403: Define a deterministic precedence rule for multiple
enabled gates in the feature-gated write-mode design, instead of selecting the
first specific match in source order. Update the multi-gate behavior guidance in
the design doc to state an explicit priority based on write-mode specificity or
permissiveness, and reference the write-mode selection logic consistently so
reordering annotations cannot change the outcome.
- Around line 414-417: The customer gate enablement section currently presents
an explicit Platform API request parameter as a viable option, but gate
membership must be derived server-side from trusted auth or subscription state.
Update the design in the “Customer gate enablement” discussion to remove or
clearly reject Option C, and emphasize using the request auth/authorization
context or subscription lookup as the source of truth in the relevant design
section.

---

Outside diff comments:
In `@docs/design/feature-gated-write-mode-design.md`:
- Around line 183-189: The new GatedWriteModes field on templateField should
preserve marker order instead of using a map, because map[string]string loses
declaration order and breaks the intended precedence from
FeatureGateAwareWriteModes. Update the templateField shape and any related
generation logic to use an ordered list or slice-based structure, and make sure
the code that builds and consumes GatedWriteModes in the feature-gated write
mode flow keeps overrides in the same end-to-end order as the source markers.
🪄 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: Enterprise

Run ID: 2a82349b-ef75-4318-ad35-1fcbf80d027e

📥 Commits

Reviewing files that changed from the base of the PR and between f16b4da and c3135ec.

📒 Files selected for processing (1)
  • docs/design/feature-gated-write-mode-design.md

Comment thread docs/design/feature-gated-write-mode-design.md Outdated
Comment thread docs/design/feature-gated-write-mode-design.md Outdated
// Override: mutable when MyPremiumFeature gate is enabled
// +hyperfleet:write-mode=immutable
// +hyperfleet:validation:FeatureGateAwareWriteMode:featureGate="",writeMode="immutable"
// +hyperfleet:validation:FeatureGateAwareWriteMode:featureGate="MyPremiumFeature",writeMode="mutable"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

featureGate is a tag/label/flag that is linked with the AWS account level, right?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yes

@cdoan1 cdoan1 added the review-ready Indicates that a PR is ready for human review. label Jul 14, 2026
Comment thread docs/design/feature-gated-write-mode-design.md
Comment thread docs/design/feature-gated-write-mode-design.md
Comment thread docs/design/feature-gated-write-mode-design.md Outdated
Comment thread docs/design/feature-gated-write-mode-design.md Outdated
Comment thread docs/design/feature-gated-write-mode-design.md Outdated
Comment thread docs/design/feature-gated-write-mode-design.md
Comment thread docs/design/feature-gated-write-mode-design.md Outdated
Comment thread docs/design/feature-gated-write-mode-design.md Outdated
Comment thread docs/design/feature-gated-write-mode-design.md Outdated
@typeid typeid removed the review-ready Indicates that a PR is ready for human review. label Jul 14, 2026
Remove Slack/Jira references per reviewer request, remove redundant
featureGate="" entries, add restrictive override example, and remove
incorporated feedback/next-steps sections.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci

openshift-ci Bot commented Jul 14, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from typeid. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
docs/design/feature-gated-write-mode-design.md (2)

107-110: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Reject empty feature-gate names for override entries. The parser allows featureGate="", but IsFeatureGateEnabled only matches a real gate name, so that override never applies in normal requests. WriteMode already provides the fallback, so require a non-empty gate and drop the empty-string convention.

🤖 Prompt for 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.

In `@docs/design/feature-gated-write-mode-design.md` around lines 107 - 110,
Update FeatureGateWriteMode to require a non-empty FeatureGate for override
entries, removing the empty-string-as-default convention from its documentation
and validation/parsing behavior. Preserve WriteMode as the fallback for requests
without a matching feature gate, and ensure IsFeatureGateEnabled only processes
real gate names.

176-185: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Preserve override order in the registry data model.
FieldMeta.FeatureGateAwareWriteModes is ordered and validateWriteMode() uses the first matching gate, so templateField.GatedWriteModes map[string]string would drop ordering and duplicates and can change which override wins. Use an ordered slice or another ordered representation end-to-end.

🤖 Prompt for 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.

In `@docs/design/feature-gated-write-mode-design.md` around lines 176 - 185,
Replace templateField.GatedWriteModes with an ordered representation and
propagate that representation through template generation and validation,
preserving the original order and duplicate entries from
FieldMeta.FeatureGateAwareWriteModes so validateWriteMode() continues using the
first matching gate.
🤖 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/design/feature-gated-write-mode-design.md`:
- Line 4: Remove the Jira link metadata near the document header and delete the
Jira entries in the References section around the referenced locations. Ensure
no Jira references remain in the design document while preserving all other
documentation content.

---

Outside diff comments:
In `@docs/design/feature-gated-write-mode-design.md`:
- Around line 107-110: Update FeatureGateWriteMode to require a non-empty
FeatureGate for override entries, removing the empty-string-as-default
convention from its documentation and validation/parsing behavior. Preserve
WriteMode as the fallback for requests without a matching feature gate, and
ensure IsFeatureGateEnabled only processes real gate names.
- Around line 176-185: Replace templateField.GatedWriteModes with an ordered
representation and propagate that representation through template generation and
validation, preserving the original order and duplicate entries from
FieldMeta.FeatureGateAwareWriteModes so validateWriteMode() continues using the
first matching gate.
🪄 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: Enterprise

Run ID: 1583c08e-3ae5-453f-a6a4-7b49a8672c18

📥 Commits

Reviewing files that changed from the base of the PR and between c3135ec and 22195ba.

📒 Files selected for processing (1)
  • docs/design/feature-gated-write-mode-design.md

Comment thread docs/design/feature-gated-write-mode-design.md Outdated
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cdoan1 cdoan1 closed this Jul 18, 2026
@cdoan1

cdoan1 commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator Author

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