Skip to content

feat(policy): unify root layout and module contract (three-root parity) - #53

Merged
donbeave merged 1 commit into
mainfrom
unify/policy-unification
Oct 11, 2026
Merged

donbeave merged 1 commit into
mainfrom
unify/policy-unification

Conversation

@donbeave

Copy link
Copy Markdown
Member

Plan-only unification change per the approved three-root plan (Steps 2-6). No applies; no .github/.velnor changes.

What changed: provider.tf->providers.tf (owner=var.github_organization, nullable sensitive token); branch-protection.tf->repositories.tf (content unchanged); deleted tests/verify-policy.sh + tests/ dir; deleted migrations.tf (drained: moved blocks from merged #44, no local state file present); variables.tf canonical schema (drop disposition, add no_ci_reason=optional(string), visibility + XOR validations); locals.tf check_templates {standard=[Required,DCO], policy=[Policy]} as copy-paste source — variable defaults MUST be literals in Terraform so entries repeat the lists verbatim; module rewritten to contract (single managed_repositories set, managed visibility NOT in ignore_changes, rulesets reference managed_settings names, squash-only PR_TITLE/PR_BODY, allow_update_branch=false, delete_branch_on_merge=true, prevent_destroy, strict=false, zero bypass); outputs managed_repositories/repository_settings/required_check_contexts/repository_ids + ruleset_enforcement (shared name/shape with sibling roots); checks.tf: mandatory-set == full 9 keys (fixes 8-vs-9 skew), self-protection = key present, CI-gate [Required,DCO], XOR match, allow_update_branch/squash/thread-resolution+active-enforcement/zero-bypass, empty no_ci allowlist; imports.tf restored (9 triples = 27 blocks); new outputs.tf + minimal README.md. Kept old jackin-github-terraform inventory key (rename is a later step).

Verification: tofu fmt -check -recursive pass; tofu init -backend=false -lockfile=readonly pass; tofu validate pass; grep RepoSettingsOnly/disposition/.sh in *.tf empty; fresh-state tofu plan: 27 to import, 0 to add/change/destroy.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T09:00:14.121101Z d1030fa PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com>
@donbeave
donbeave force-pushed the unify/policy-unification branch from d1030fa to b339e05 Compare October 11, 2026 08:57
@sonarqubecloud

Copy link
Copy Markdown

@donbeave
donbeave merged commit 66b4ea0 into main Oct 11, 2026
7 checks passed
@donbeave
donbeave deleted the unify/policy-unification branch October 11, 2026 08:58

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

ℹ️ 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".

Comment thread checks.tf
Comment on lines +8 to +9
condition = toset(keys(var.repository_policies)) == toset(["homebrew-tap", "jackin", "jackin-agent-smith", "jackin-dev", "jackin-github-terraform", "jackin-marketplace", "jackin-role-action", "jackin-sentinel", "jackin-the-architect"])
error_message = "repository_policies must contain exactly the 9 managed jackin-project repositories (8 standard plus jackin-marketplace)."

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 Make the inventory assertion operation-blocking

When repository_policies contains an extra or misspelled key, this assertion only produces a warning because OpenTofu check failures do not stop planning or applying. The module subsequently iterates over that key and can create or manage an unintended GitHub repository despite the message claiming that exactly nine repositories are allowed; enforce this through variable validation or a resource/module precondition instead.

Useful? React with 👍 / 👎.

Comment thread imports.tf
Comment on lines +10 to +11
to = module.repository_policy.github_repository_ruleset.protect_main["homebrew-tap"]
id = "homebrew-tap:15170998"

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 Scope bootstrap imports to the configured organization

When github_organization is overridden for another owner, fresh-state planning still attempts to import this ruleset using a numeric ID taken from jackin-project; the repository-name import resolves under the configured owner, but its ruleset IDs do not. Consequently the newly configurable provider cannot bootstrap another organization and the import fails, so either keep the owner fixed or make the import IDs owner-specific.

Useful? React with 👍 / 👎.

Comment thread outputs.tf
Comment on lines +19 to +22
output "repository_ids" {
description = "Map of repository name to repository ID"
value = module.repository_policy.repository_ids
}

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 Expose ruleset enforcement from the root contract

The module adds ruleset_enforcement, but the root passes through only the other four newly standardized outputs. Root consumers therefore cannot inspect branch/tag enforcement, review-thread resolution, or bypass actors, leaving this root inconsistent with the stated shared output contract; add a root ruleset_enforcement output alongside these passthroughs.

Useful? React with 👍 / 👎.

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.

1 participant