Skip to content

feat: centralize operation inference, validate explicit vs inferred mismatch#6

Merged
zemanlx merged 1 commit into
mainfrom
feat/operation-inference
Apr 24, 2026
Merged

feat: centralize operation inference, validate explicit vs inferred mismatch#6
zemanlx merged 1 commit into
mainfrom
feat/operation-inference

Conversation

@zemanlx

@zemanlx zemanlx commented Apr 24, 2026

Copy link
Copy Markdown
Owner

Operation inference (CREATE/UPDATE/DELETE) now works consistently regardless of whether test fixtures are in separate files or consolidated in .request.yaml.

Changes:

  • parseObjectYAML and parseOldObjectYAML no longer hardcode the operation (CREATE/DELETE). They build a partial AdmissionRequest with resource metadata only.
  • New inferOrValidateOperation() runs after all files are merged:
    • Empty operation: inferred from object/oldObject presence
    • Explicit operation matching inference: accepted
    • Explicit operation conflicting with inference: error
    • Explicit operation with no objects (e.g. CONNECT): accepted
  • InferOperation renamed to inferOperation (unexported, only used internally by inferOrValidateOperation).
  • Added ErrOperationMismatch sentinel error.
  • README Operations section updated to reflect that inference works the same way for both split files and .request.yaml.
  • go fix applied (evaluator, reporter).

…ismatch

Operation inference (CREATE/UPDATE/DELETE) now works consistently
regardless of whether test fixtures are in separate files or
consolidated in .request.yaml.

Changes:
- parseObjectYAML and parseOldObjectYAML no longer hardcode the
  operation (CREATE/DELETE). They build a partial AdmissionRequest
  with resource metadata only.
- New inferOrValidateOperation() runs after all files are merged:
  - Empty operation: inferred from object/oldObject presence
  - Explicit operation matching inference: accepted
  - Explicit operation conflicting with inference: error
  - Explicit operation with no objects (e.g. CONNECT): accepted
- InferOperation renamed to inferOperation (unexported, only used
  internally by inferOrValidateOperation).
- Added ErrOperationMismatch sentinel error.
- README Operations section updated to reflect that inference works
  the same way for both split files and .request.yaml.
- go fix applied (evaluator, reporter).
@zemanlx zemanlx merged commit 8a862b6 into main Apr 24, 2026
2 checks passed
@zemanlx zemanlx deleted the feat/operation-inference branch April 24, 2026 15:44
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