crossplane / crossplane/crossplane-runtime
Reject truncated or incomplete package streams in the Crossplane Runtime parser.
- Dominant language
- Go
- Stars
- 198
- Forks
- 161
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 9
Description
## Summary
Detect incomplete package streams at the `crossplane-runtime` package parser boundary.
## Changes
- Detect truncated or incomplete YAML package documents before returning parsed objects.
- Return a parser error instead of silently returning partially decoded resources.
- Preserve valid package changes, including intentional MRD version removal and optional-field removal.
- Add parser regression tests for truncated and malformed package streams.
- Add tests confirming valid MRD evolution remains supported.
## Why
Crossplane’s package establisher currently receives only decoded objects and cannot distinguish truncated package content from an intentional update. Adding completeness detection in the establisher causes legitimate ManagedResourceDefinition changes, such as removing an API version, to be rejected.
Parser-boundary validation prevents incomplete package data from reaching Crossplane while preserving valid declarative changes. This addresses the truncation data-loss regression tracked by [crossplane/crossplane#7817](https://github.com/crossplane/crossplane/issues/7817) and supports the follow-up work in [crossplane/crossplane#7830](https://github.com/crossplane/crossplane/pull/7830).
## Testing
- Add a test for a complete valid package stream.
- Add a test for a truncated YAML document.
- Add a test confirming malformed/incomplete input returns an error.
- Add a test confirming intentional MRD version removal remains valid.
- Add a test confirming intentional omission of optional MRD fields remains valid.
- Run:
```bash
go test ./pkg/xpkg/parser/...
go test ./...
git diff --check
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in pkg/xpkg/parser/ and read the existing parser tests and package-stream decoding path. Add regression coverage for complete, truncated, malformed, and intentionally evolved MRD streams, then run go test ./pkg/xpkg/parser/..., go test ./..., and git diff --check; done means incomplete input errors without rejecting valid MRD changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100