Skip to content

Protect reserved cost-adjustment diagnostics key - #4291

Closed
FlorianPfaff wants to merge 17 commits into
mainfrom
agent/protect-adjustment-order-diagnostics-20260713
Closed

Protect reserved cost-adjustment diagnostics key#4291
FlorianPfaff wants to merge 17 commits into
mainfrom
agent/protect-adjustment-order-diagnostics-20260713

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Summary

  • reserve the adjustment_order diagnostics key during cost-adjustment name disambiguation
  • prevent user-provided adjustment names from overwriting the ordered diagnostics list
  • add a regression with a reserved-name adjustment followed by a second adjustment

Bug

compose_cost_matrix_adjustments() initializes its diagnostics mapping with an adjustment_order list, but its collision tracker started empty.

An adjustment named adjustment_order was therefore accepted without renaming. After appending the name to the order list, the implementation stored that adjustment's diagnostics under the same key and replaced the list with a dictionary. With another adjustment in the sequence, the next .append() call failed because diagnostics["adjustment_order"] was no longer a list. Even with one adjustment, the returned diagnostics silently lost the execution order.

Fix

Initialize the collision tracker from the reserved diagnostics keys already present in the result mapping. A user adjustment named adjustment_order is now disambiguated to adjustment_order_2, using the same suffixing behavior already applied to duplicate adjustment names.

Validation

  • regression composes a reserved-name adjustment and a following adjustment
  • verifies the adjusted matrix remains correct
  • verifies the order list is preserved as ["adjustment_order_2", "following"]
  • verifies both adjustment diagnostics remain accessible under distinct keys
  • branch is two commits ahead of current main, zero behind
  • final diff is limited to one production-line change and one focused regression

The full repository test matrix is delegated to GitHub Actions.

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 26.45s
✅ JSON prettier 7 0 0 0 1.17s
✅ JSON v8r 7 0 0 4.47s
✅ MARKDOWN markdownlint 68 0 0 0 1.9s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.71s
✅ PYTHON black 1489 182 0 0 96.96s
✅ PYTHON isort 1489 327 0 0 2.66s
✅ REPOSITORY betterleaks yes no no 2.6s
✅ REPOSITORY checkov yes no no 55.48s
✅ REPOSITORY gitleaks yes no no 15.12s
✅ REPOSITORY git_diff yes no no 0.2s
✅ REPOSITORY secretlint yes no no 62.21s
✅ REPOSITORY syft yes no no 6.46s
✅ REPOSITORY trivy-sbom yes no no 7.67s
✅ REPOSITORY trufflehog yes no no 33.11s
✅ YAML prettier 11 0 0 0 0.7s
✅ YAML v8r 11 0 0 11.42s
✅ YAML yamllint 11 0 0 0.64s

Notices

📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.6.0 --custom-flavor-setup --custom-flavor-linters PYTHON_BLACK,PYTHON_ISORT,COPYPASTE_JSCPD,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_GITLEAKS,REPOSITORY_BETTERLEAKS,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@FlorianPfaff
FlorianPfaff force-pushed the agent/protect-adjustment-order-diagnostics-20260713 branch from 9f7421e to b5f6d5f Compare July 13, 2026 16:31
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