Uh oh!
There was an error while loading. Please reload this page.
fix(org): exclude archived repos from drift detection - #77
Merged
Conversation
The drift-detection query becomes `fork:false archived:false`, so archived repos drop out of both `check "unmanaged_repos"` and the non-fork admin-bypass set. GitHub rejects writes to an archived repo, so a data file for one could not be applied and a bypass on its ruleset would be inert. Reporting it as unmanaged is noise the reader learns to skip, which is how a real unmanaged repo would later go unnoticed. Verified: `org:yo61 fork:false` returns 28, with `archived:false` 27, and `archived:true` returns exactly python-template-archived. Plan is "No changes" with no warning. The data source keeps the name `non_fork` because default_branch_ruleset_non_fork_bypass_actors is part of the module's public interface; the comment records that the set is now narrower than the name suggests. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
GitHub stores template_repository as immutable creation provenance --
PATCH /repos/{owner}/{repo} has no such parameter -- and the provider
reads it back on every refresh, so the plan diff proposing to remove the
template block could never converge. Applying it was tested and the diff
returned on the next plan.
Recreating the repo was the only way to clear the attribution. Records
the sequence used, the alternatives that fix only the plan noise, and
what the archived original still holds.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>There was a problem hiding this comment.
The PR narrows org drift detection to active non-fork repos, updates the bypass description, and records the python-template recreation rationale. I checked the changed Terraform paths and their consumers; the query/result contract remains consistent with the documented trade-off.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
modules/org/data.tfnarrows the drift-detection query fromorg:<org> fork:falsetoorg:<org> fork:false archived:false. Archived reposnow drop out of both
check "unmanaged_repos"and the non-fork admin-bypassset.
Also updates the
default_branch_ruleset_non_fork_bypass_actorsdescriptionand adds a
CLAUDE.mdconvention, so neither describes the old query.Why
yo61/python-templatecarried a permanent one-resource plan diff proposing toremove a
templateblock (owner = "BrianPugh"). It could never converge:template_repositoryis immutable creation provenance.PATCH /repos/{owner}/{repo}accepts 26 body parameters and none of them is
template_repository.resourceGithubRepositoryRead(line 890) unconditionallysets
templatefromrepo.TemplateRepository;resourceGithubRepositoryUpdatenever references the field, and ends by calling
Read.Applying it was tested: the diff returned on the very next plan.
Clearing the attribution therefore required recreating the repo. The original
was renamed to
python-template-archivedand archived rather than deleted,which left a repo with no data file tripping
unmanaged_reposon every plan —the noise this PR removes.
Why not give the archived repo a data file
modules/github-repomanagesgithub_repository_collaboratorsunconditionally,and a minimal file (
builtin_ruleset_names: []) would plan to delete the tworulesets the repo still carries. GitHub rejects writes to archived repos, so
those calls fail at apply time. Managing an archived repo is not something the
module supports.
Verification
task planreportsNo changes. Your infrastructure matches the configuration.with no
unmanaged_reposwarning.The repo swap itself was applied separately:
3 added, 3 changed, 0 destroyed,and needed no state surgery — resources keyed on repo name re-bound on refresh,
while the two rulesets and Pages (keyed on numeric ids) planned as ordinary
creates.
Trade-off
Archiving a managed repo out-of-band now drops it from drift detection silently
instead of flagging it. An archived repo is frozen by definition and its config
can no longer be applied, so there is nothing actionable to report. The reverse
direction is unaffected: its data file is still rendered, so state and config
keep agreeing.
CLAUDE.mddocuments the trap — a managed repo that getsarchived will otherwise plan
archived: true -> false.Decision records
decisions/2026-08-25-exclude-archived-from-drift-detection.mddecisions/2026-08-25-python-template-recreate-to-drop-template-link.md🤖 Generated with Claude Code