Skip to content

CI: add a protected 25-to-20 indexer cap rollback - #662

Open
khaliqgant wants to merge 2 commits into
feat/hosted-indexer-esm-25from
feat/hosted-indexer-cap-rollback
Open

khaliqgant wants to merge 2 commits into
feat/hosted-indexer-esm-25from
feat/hosted-indexer-cap-rollback

Conversation

@khaliqgant

@khaliqgant khaliqgant commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Change

Add an explicit rollback-indexer-cap operation to the dispatch-only hosted pipeline workflow. It pins the target to 20 and admits only an in-place 25-to-20 change to the existing indexer event source mapping's maximum concurrency. Plan and apply use the existing protected saved-plan requirements for SHA, run, attempt, digest, operation, and owner environment review.

Keep import-only adoption as the default. Document the required state and writer receipts, mapping-only permission, rollback custody, watcher triggers, and readback of DelaySeconds=30.

Verification

All 29 zero-diff gate tests and the hosted CI smoke suite passed. The smoke test checks the target after private tfvars, the gate-binding refusal when either direction is given the other direction’s saved plan, and successful validation of the reverse operation using a mocked provider. Diff checks passed.

Review and rollout

This PR is stacked on #636 at 6a498fb2 to show only the rollback delta. Retarget to main after #636 lands and confirm exact-head checks on the resulting PR. Hold for exact-head D5 static PASS, green CI and Infra Ops review. Both cap directions depend on the deployed exact-mapping apply scope from #663. Infra Ops owns protected execution and the owner approves the exact saved plan before an apply.

@khaliqgant khaliqgant added the merge-train:hold Do not merge without Khaliq's direct OK label Dec 2, 2026
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0c2a420c-aecb-43d2-988a-cbf9f032768c

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@devin-ai-integration devin-ai-integration 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.

🔍 Devin Review: 2 flags

Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

@greptile-apps

greptile-apps Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The reviewed changes appear safe to merge; protected execution still requires the documented rollout approvals and mapping grant.

Summary

Adds a protected rollback-indexer-cap operation for the exact 25-to-20 mapping change.

  • Operators can roll the indexer mapping cap back to 20.

No new actionable issues were found in the changes since the previous review.

Reviews (2) · Last reviewed commit: "Verify both indexer plan direction bindi..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-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.

1 issue found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="terraform/examples/aws-hosted-session-pipeline/README.md">

<violation number="1" location="terraform/examples/aws-hosted-session-pipeline/README.md:107">
P1: This checklist requires a mapping-only apply permission, but the protected apply role used by this workflow can be configured with broad writes to every managed resource. Provision and select a dedicated mapping-only role or add an enforced mapping-only scope before treating this rollback as protected.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic


Before the first raise, attach the successful import-only plan and apply
receipts, the old-writer freeze and transfer receipt, verification of the
mapping-only apply permission, and the protected rollback operator

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.

P1: This checklist requires a mapping-only apply permission, but the protected apply role used by this workflow can be configured with broad writes to every managed resource. Provision and select a dedicated mapping-only role or add an enforced mapping-only scope before treating this rollback as protected.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At terraform/examples/aws-hosted-session-pipeline/README.md, line 107:

<comment>This checklist requires a mapping-only apply permission, but the protected apply role used by this workflow can be configured with broad writes to every managed resource. Provision and select a dedicated mapping-only role or add an enforced mapping-only scope before treating this rollback as protected.</comment>

<file context>
@@ -100,7 +100,21 @@ concurrency headroom, including other mappings on the function. Dispatch
+
+Before the first raise, attach the successful import-only plan and apply
+receipts, the old-writer freeze and transfer receipt, verification of the
+mapping-only apply permission, and the protected rollback operator
+assignment. Confirm `DelaySeconds` is 30 and stays at 30 in the reviewed plan.
+A code landing alone does not authorize an apply.
</file context>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Addressed the deployment dependency in 6e7f2e69. This workflow must use the exact-mapping apply scope from #663 in both directions. The runbook now requires the approved bootstrap run and verified permission on the protected environment's role before use, and excludes the broader full role. #662 stays held for source review. The permission is a separate change and needs its own owner-approved saved plan.

Comment thread scripts/hosted/tests/smoke.sh Resolved

@cubic-dev-ai cubic-dev-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.

2 issues found across 2 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/hosted/tests/smoke.sh">

<violation number="1" location="scripts/hosted/tests/smoke.sh:106">
P2: This mismatch case does not verify that the plan was rejected before claiming its one-time apply attempt. Assert that the `102-1` `apply-attempt.json` object is absent, otherwise a claim-before-validation regression can pass the smoke test and consume the saved plan.</violation>
</file>

<file name="terraform/examples/aws-hosted-session-pipeline/README.md">

<violation number="1" location="terraform/examples/aws-hosted-session-pipeline/README.md:91">
P3: This link points to a nonexistent `indexer-mapping-scope` section, so operators cannot use the runbook to verify the required mapping-only permission. Add the referenced section or link to the actual policy documentation.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

if GATE_ALLOW="$rollback" INDEXER_MAX_CONCURRENCY=20 "$SCRIPT" apply "$T/rollbackfwd" 214-1 102-1 "$sha3" >"$T/rollbackfwd.log" 2>&1; then
echo "FAIL: rollback apply accepted a forward plan"; exit 1
fi
grep -q "GATE_ALLOW changed since the plan" "$T/rollbackfwd.log" \

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.

P2: This mismatch case does not verify that the plan was rejected before claiming its one-time apply attempt. Assert that the 102-1 apply-attempt.json object is absent, otherwise a claim-before-validation regression can pass the smoke test and consume the saved plan.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At scripts/hosted/tests/smoke.sh, line 106:

<comment>This mismatch case does not verify that the plan was rejected before claiming its one-time apply attempt. Assert that the `102-1` `apply-attempt.json` object is absent, otherwise a claim-before-validation regression can pass the smoke test and consume the saved plan.</comment>

<file context>
@@ -97,19 +97,26 @@ if "$SCRIPT" apply "$T/a6" 205-1 102-1 "$sha3" >/dev/null 2>&1; then echo "FAIL:
+if GATE_ALLOW="$rollback" INDEXER_MAX_CONCURRENCY=20 "$SCRIPT" apply "$T/rollbackfwd" 214-1 102-1 "$sha3" >"$T/rollbackfwd.log" 2>&1; then
+  echo "FAIL: rollback apply accepted a forward plan"; exit 1
+fi
+grep -q "GATE_ALLOW changed since the plan" "$T/rollbackfwd.log" \
+  || { echo "FAIL: rollback apply did not check the forward plan's gate binding"; exit 1; }
 okrun 103
</file context>
Suggested change
grep -q "GATE_ALLOW changed since the plan" "$T/rollbackfwd.log" \
grep -q "GATE_ALLOW changed since the plan" "$T/rollbackfwd.log" \
|| { echo "FAIL: rollback apply did not check the forward plan's gate binding"; exit 1; }
[ ! -e "$T/s3/plans_hosted_session-pipeline_102-1_apply-attempt.json" ] \
|| { echo "FAIL: rollback apply claimed an attempt before rejecting the plan"; exit 1; }

zero-diff adoption and the writer handoff, with the existing mapping write
permission in the protected apply role. The operation supplies the target
zero-diff adoption and the writer handoff, with the protected apply role
provisioned in [indexer mapping scope](../aws-hosted-session-pipeline-ci/README.md#indexer-mapping-scope).

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.

P3: This link points to a nonexistent indexer-mapping-scope section, so operators cannot use the runbook to verify the required mapping-only permission. Add the referenced section or link to the actual policy documentation.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At terraform/examples/aws-hosted-session-pipeline/README.md, line 91:

<comment>This link points to a nonexistent `indexer-mapping-scope` section, so operators cannot use the runbook to verify the required mapping-only permission. Add the referenced section or link to the actual policy documentation.</comment>

<file context>
@@ -87,8 +87,9 @@ state (no destroy) and the deploy guard is verified; only then is the freeze lif
-zero-diff adoption and the writer handoff, with the existing mapping write
-permission in the protected apply role. The operation supplies the target
+zero-diff adoption and the writer handoff, with the protected apply role
+provisioned in [indexer mapping scope](../aws-hosted-session-pipeline-ci/README.md#indexer-mapping-scope).
+The operation supplies the target
 after the private tfvars on the Terraform command line. The default `adopt`
</file context>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-train:hold Do not merge without Khaliq's direct OK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant