Skip to content

Cherry-pick: Add package resource file sizes to PackageRevision interface (#954)#1015

Open
JamesMcDermott wants to merge 1 commit into
kptdev:1.5from
Nordix:feature-resources-size
Open

Cherry-pick: Add package resource file sizes to PackageRevision interface (#954)#1015
JamesMcDermott wants to merge 1 commit into
kptdev:1.5from
Nordix:feature-resources-size

Conversation

@JamesMcDermott
Copy link
Copy Markdown
Contributor

Title

Cherry-pick to 1.5: Add package resource file sizes to PackageRevision interface (#954)


Description

  • What changed:
  • Why it’s needed:
  • How it works:

Related Issue(s)

  • Closes/Fixes #

Type of Change

  • Cherry-pick
  • Bug fix
  • New feature
  • Enhancement
  • Refactor
  • Documentation
  • Tests
  • Other: ________

Checklist

  • Code follows project style guidelines
  • Self-reviewed changes
  • Tests added/updated
  • Documentation added/updated
  • All tests and gating checks pass

Testing Instructions (Optional)


Additional Notes (Optional)

  • Known issues:
  • Further improvements:
  • Review notes:

Copilot AI review requested due to automatic review settings May 29, 2026 10:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new ResourcesSizeBytes field to PackageRevisionStatus that exposes the total size of a package revision's resource files (currently computed only by the DB cache), along with supporting schema migrations, end-to-end test helpers, and assorted comment/typo cleanups.

Changes:

  • Adds resources_size column to the package_revisions table (schema + migration scripts) and threads a new resourcesSizeBytes field through dbPackageRevision so the API surfaces it in PackageRevisionStatus.
  • Introduces TestSuite.UsingDBCache (driven by the DB_CACHE env var) and a shared validatePackageResourcesSize helper used across e2e tests; also adds tests for placeholder/main package revision edit/upgrade rejection.
  • Cleans up assorted typos, comments, and copyright headers in API, docs, and engine code.

Reviewed changes

Copilot reviewed 25 out of 27 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
api/porch/types.go Adds ResourcesSizeBytes to status; fixes comment typos.
api/porch/v1alpha1/types.go Mirrors above for v1alpha1.
api/sql/porch-db.sql Adds resources_size column to base schema.
api/sql/porch-db-1.5.9-1.5.10.sql New forward migration adding/backfilling resources_size.
api/sql/porch-db-1.5.10-1.5.9.sql New rollback migration dropping resources_size.
api/sql/porch-db-1.5.9-1.6.0.sql Duplicate forward migration for 1.6.0.
api/sql/porch-db-1.6.0-1.5.9.sql Duplicate rollback for 1.6.0.
controllers/.../packagevariant_controller-with-workspacename_test.go Copyright year bump.
deployments/porch/3-porch-postgres-bundle.yaml Mirrors schema column addition for bundled deployment.
docs/.../package-revisions.md Cleans up sample YAML/CLI output.
docs/.../db-cache.md Documents draft close size summation.
docs/.../api-ref.md Documents new resourcesSizeBytes field.
pkg/cache/dbcache/dbpackagerevision.go Stores/propagates resourcesSizeBytes; minor fixes.
pkg/cache/dbcache/dbpackagerevisionsql.go SQL read/insert/update statements include resources_size.
pkg/cache/dbcache/dbrepository.go Recomputes size on ClosePackageRevisionDraft.
pkg/cache/dbcache/dbreposync.go Computes size during external PR sync.
pkg/engine/engine.go Comment fixes.
pkg/externalrepo/git/doc.go Comment typo fix.
pkg/task/generictaskhandler.go Error message typo fix.
test/e2e/api/*.go New validatePackageResourcesSize helper and additional placeholder edit/upgrade tests.
test/e2e/suiteutils/suite.go Adds UsingDBCache and repoControllerInCluster fields.
Files not reviewed (1)
  • api/porch/v1alpha1/zz_generated.conversion.go: Language not supported

Comment thread api/sql/porch-db-1.5.10-1.6.0.sql
Comment thread test/e2e/suiteutils/suite.go
Comment thread pkg/cache/dbcache/dbpackagerevision.go
Comment thread pkg/cache/dbcache/dbrepository.go
Comment thread api/sql/porch-db-1.5.10-1.5.11.sql
Comment thread test/e2e/api/rpkg_init_test.go Outdated
@JamesMcDermott JamesMcDermott force-pushed the feature-resources-size branch 2 times, most recently from a2eceed to 4959501 Compare May 29, 2026 14:37
Copilot AI review requested due to automatic review settings May 29, 2026 14:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 28 changed files in this pull request and generated 10 comments.

Files not reviewed (1)
  • api/porch/v1alpha1/zz_generated.conversion.go: Language not supported

Comment thread api/sql/porch-db-1.5.10-1.5.11.sql
Comment thread api/sql/porch-db-1.5.10-1.6.0.sql
Comment thread test/e2e/suiteutils/suite.go
Comment thread test/e2e/api/rpkg_lifecycle_test.go Outdated
Comment thread test/e2e/api/rpkg_init_test.go
Comment thread pkg/cache/dbcache/dbrepository.go
Comment thread pkg/cache/dbcache/dbreposync.go
Comment thread pkg/cache/dbcache/dbpackagerevision.go Outdated
Comment thread docs/content/en/docs/2_concepts/package-revisions.md
Comment thread go.mod Outdated
)

* Feat: add package resource file sizes to PackageRevision interface

- on ClosePackageRevisionDraft:
  - add up individual sizes of PackageRevisionResources
  - store total as a separate metadata field in package_revisions
    table
- on get/list PackageRevision, include total resources size in status
  field of returned API object

kptdev#811
Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* Update documentation to include new size-on-disk field

- document new API field `prrSizeOnDisk`
- include new "SIZE ON DISK" table column in `rpkg get` output examples

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* missed some generated bits

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* Fix tests, revert "Size on Disk" column from PackageRevision table

- fix E2E tests by excluding package-size testing from E2E tests for CR cache
  - new mechanism in test suite to detect DB cache when in use
    - can be used in test cases to exclude/include portions depending on cache
- remove "Size on Disk" column from `kubectl get packagerevisions` table
  - agreed not essential information, may set precedent to overload table output
  - also removes need for updates to E2E CLI tests

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* unit test fixes after table column reversion

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* update e2e tests' expectations

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* Address review comments

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* Address review comments part 2

- also remove restriction that meant size didn't get updated
  on PackageRevisionResources update

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* fix failing CR-cache E2E tests

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* comment nitpick to retrigger CI

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* comment nitpick to retrigger CI

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* comment nitpick to retrigger CI

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* nitpick to retrigger CI

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* replace missed nephio-project imports with kptdev

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* Address Copilot review comments

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* Address Copilot review comments part 2

Signed-off-by: ezmcdja <james.j.mcdermott@ericsson.com>

* ssimplify tests' DB cache detection - missed Copilot review comment

Signed-off-by: ezmcdja <james.j.mcdermott@ericsson.com>

* nitpick to retrigger CI

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* Address Copilot review comments part 3

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* nitpick to retrigger CI

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* comment nitpick to retrigger CI

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* comment nitpick to retrigger CI

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* nitpick to retrigger CI

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* comment nitpick to retrigger CI

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* Address Copilot review comments part 4

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* nitpick to retrigger CI

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* Address Copilot review comments part 5

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

* Address Copilot review comments part 6

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>

---------

Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com>
Signed-off-by: ezmcdja <james.j.mcdermott@ericsson.com>
@JamesMcDermott JamesMcDermott force-pushed the feature-resources-size branch from 4959501 to 0e49526 Compare May 29, 2026 15:20
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.

2 participants