Skip to content

fix: validate key in files config to avoid cryptic KeyError - #1317

Merged
TimKnight01 merged 4 commits into
gitlabform:mainfrom
rickbrouwer:issue-1312
Jun 23, 2026
Merged

TimKnight01 merged 4 commits into
gitlabform:mainfrom
rickbrouwer:issue-1312

Conversation

@rickbrouwer

Copy link
Copy Markdown
Collaborator

The files processor accessed configuration["files"][file]["branches"] directly, raising KeyError: 'branches' when users omitted the key. The misleading error pointed users at their top-level branches: section instead of the missing sub-key under the file entry.

Now exits with EXIT_INVALID_INPUT and a clear message listing the accepted values (all, protected, or a list of branch names).

Fixes #1312

@rickbrouwer
rickbrouwer had a problem deploying to Integrate Pull Request June 17, 2026 15:29 — with GitHub Actions Failure
@rickbrouwer
rickbrouwer had a problem deploying to Integrate Pull Request June 17, 2026 15:29 — with GitHub Actions Failure
@codecov

codecov Bot commented Jun 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.10%. Comparing base (1146687) to head (7806fef).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1317      +/-   ##
==========================================
+ Coverage   78.04%   78.10%   +0.06%     
==========================================
  Files          83       83              
  Lines        4163     4170       +7     
==========================================
+ Hits         3249     3257       +8     
+ Misses        914      913       -1     
Flag Coverage Δ
integration 74.65% <71.42%> (+0.01%) ⬆️
unittests 43.86% <100.00%> (+0.09%) ⬆️
Files with missing lines Coverage Δ
gitlabform/processors/project/files_processor.py 97.76% <100.00%> (+0.12%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@amimas amimas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for looking into this @rickbrouwer . In general, looks good. Just have a question/suggestion on the approach.

Comment thread gitlabform/processors/project/files_processor.py Outdated
Signed-off-by: Rick Brouwer <[email protected]>
@rickbrouwer
rickbrouwer temporarily deployed to Integrate Pull Request June 19, 2026 08:06 — with GitHub Actions Inactive
@rickbrouwer
rickbrouwer temporarily deployed to Integrate Pull Request June 19, 2026 08:06 — with GitHub Actions Inactive
Signed-off-by: Rick Brouwer <[email protected]>
@rickbrouwer
rickbrouwer temporarily deployed to Integrate Pull Request June 22, 2026 05:58 — with GitHub Actions Inactive
@rickbrouwer
rickbrouwer temporarily deployed to Integrate Pull Request June 22, 2026 05:58 — with GitHub Actions Inactive
@rickbrouwer
rickbrouwer temporarily deployed to Integrate Pull Request June 22, 2026 10:58 — with GitHub Actions Inactive
@rickbrouwer
rickbrouwer temporarily deployed to Integrate Pull Request June 22, 2026 10:58 — with GitHub Actions Inactive
@rickbrouwer
rickbrouwer enabled auto-merge June 22, 2026 10:58
@rickbrouwer
rickbrouwer disabled auto-merge June 22, 2026 10:58
@rickbrouwer
rickbrouwer enabled auto-merge June 22, 2026 10:59
@TimKnight01
TimKnight01 disabled auto-merge June 23, 2026 08:42
@TimKnight01
TimKnight01 merged commit 1159467 into gitlabform:main Jun 23, 2026
26 checks passed
@rickbrouwer
rickbrouwer deleted the issue-1312 branch July 24, 2026 07:37

This branch was previously deployed

1 inactive deployment
Integrate Pull Request — 7806fef6 Deployed Jun 22, 2026 by rickbrouwer via Pipeline / Acceptance Tests / GitLab Premium #18
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.

Error occurred while processing project: exception: 'branches'

3 participants