Skip to content

refactor!: drop build log fields and keep typed package errors - #229

Merged
QaidVoid merged 1 commit into
mainfrom
refactor/api-cleanup
Oct 19, 2026
Merged

QaidVoid merged 1 commit into
mainfrom
refactor/api-cleanup

Conversation

@QaidVoid

@QaidVoid QaidVoid commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

What it does

Breaking changes to the public crate API, removing what was only kept for compatibility.

Build log and build script removed. No repository publishes them anymore. They are gone from RemotePackage (soar-registry), the metadata Package and NewPackage models and schema (soar-db), and Package (soar-core). A metadata migration drops the two columns. Metadata JSON that still carries the keys is accepted, and the keys are ignored.

RegistryError::MissingEtag removed. Nothing returns it: a response without an ETag is accepted and refetched on the next sync.

PackageError keeps the underlying error. Config and filesystem errors were flattened to strings, which dropped the cause and the diagnostic help. They are now wrapped transparently:

  • PackageError::ConfigError(String) becomes PackageError::Config(ConfigError).
  • FileSystemError becomes PackageError::FileSystem(FileSystemError) instead of PackageError::Custom(String).
  • Reading the current directory while setting up portable dirs now keeps its I/O error.

Before and after, for a filesystem error:

soar_package::custom

  × Failed to read file '/x/y'
soar_utils::fs::read_file

  × Failed to read file '/x/y'
  ╰─▶ permission denied
  help: Check if the file exists and you have read permissions

What it does not do

  • install_patterns stays deprecated rather than removed. It is a config file key, so removing it would affect users' config files, not only the crate API.

Downgrades

Once the migration has run, an older soar fails to search that repository with no such column: packages.build_script. soar sync does not fix it while the repository reports no change. It recovers when the repository publishes new metadata, or when the metadata database is deleted and synced again.

Verification

End to end against four live repositories, covering a new repository and the legacy pkgforge ones:

  • soarpkgs: signed .sdb.zstd.
  • bincache and pkgcache: legacy .sdb.zstd, built by older tooling with the build columns.
  • bincache: legacy JSON that still carries the keys.
Scenario Result
Fresh sync All four import with every package (1370, 3927, 302, 3927) and no build columns
Search, query, install one package from each repository, info, run, remove All succeed
Upgrade: sync and install with main, then this build Columns dropped on first use with every package kept. Search, update, install and a full refetch succeed.
Downgrade: back to main after the upgrade Search fails with no such column: packages.build_script, as described above. info, sync and remove succeed.
Combined with the maintainer link fix Same results, both migrations applied

Applying up.sql and then down.sql to a copy of the legacy pkgcache database removes and restores the columns.

New tests:

  • upgrading_metadata_drops_build_fields_and_keeps_packages: upgrades a database at the old schema holding a build log. It fails with the migration removed.
  • a_filesystem_error_keeps_its_cause_and_help and a_config_error_keeps_its_own_diagnostic: check the cause, help and code of wrapped errors.

Gate: cargo +nightly fmt --check, clippy with -D warnings on stable and nightly, cargo +1.93.1 check, cargo deny check, and 648 tests passing.

Summary by CodeRabbit

  • Changes
    • Package records no longer include the obsolete build script and build log metadata. Database upgrades remove these fields while retaining existing packages.
    • Package-related errors now preserve configuration and filesystem error details, including their diagnostic information.
    • The obsolete missing-ETag registry error has been removed.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b0761901-9f40-4bd0-87ef-9c256f6ae606
📥 Commits

Reviewing files that changed from the base of the PR and between 70c64ee and 23a3fc4.

📒 Files selected for processing: 3
  • crates/soar-db/migrations/metadata/2026-10-19-000200-0000_drop_build_fields/down.sql
  • crates/soar-db/migrations/metadata/2026-10-19-000200-0000_drop_build_fields/up.sql
  • crates/soar-db/src/connection.rs
+----------------------------------------+
| C*deR*bb*t: The uncensored bug hunter. |
+----------------------------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 07b8cc34-834a-41d5-8532-11825afa841b
📥 Commits

Reviewing files that changed from the base of the PR and between 5f0b825 and 70c64ee.

📒 Files selected for processing: 11
  • crates/soar-core/src/database/models.rs
  • crates/soar-db/migrations/metadata/2026-10-19-000000-0000_drop_build_fields/down.sql
  • crates/soar-db/migrations/metadata/2026-10-19-000000-0000_drop_build_fields/up.sql
  • crates/soar-db/src/connection.rs
  • crates/soar-db/src/models/metadata.rs
  • crates/soar-db/src/repository/metadata.rs
  • crates/soar-db/src/schema/metadata.rs
  • crates/soar-package/src/error.rs
  • crates/soar-package/src/formats/common.rs
  • crates/soar-registry/src/error.rs
  • crates/soar-registry/src/package.rs
💤 Files with no reviewable changes: 5
  • crates/soar-registry/src/error.rs
  • crates/soar-core/src/database/models.rs
  • crates/soar-db/src/schema/metadata.rs
  • crates/soar-db/src/repository/metadata.rs
  • crates/soar-registry/src/package.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

📝 Walkthrough

The changes remove deprecated build fields from package models and database metadata, add a migration and upgrade test, update package error handling, and remove a deprecated registry error variant.

Changes: Package build metadata removal

Layer / File(s) Summary
Remove build fields from package representations
crates/soar-db/src/schema/metadata.rs, crates/soar-db/src/models/metadata.rs, crates/soar-db/src/repository/metadata.rs, crates/soar-core/src/database/models.rs, crates/soar-registry/src/package.rs
Package models and database mappings no longer declare or pass through build_script and build_log.
Drop database columns and verify upgrade
crates/soar-db/migrations/metadata/2026-10-19-000000-0000_drop_build_fields/*.sql, crates/soar-db/src/connection.rs
The migration drops the columns, the rollback restores them, and a regression test checks that opening an upgraded database preserves its package and removes the columns.

Package error handling

Layer / File(s) Summary
Wrap package errors and add context
crates/soar-package/src/error.rs, crates/soar-package/src/formats/common.rs
PackageError wraps configuration and filesystem errors. Tests check preserved error details. Current-directory lookup failures receive contextual error information.

Remove deprecated registry error

Layer / File(s) Summary
Remove MissingEtag
crates/soar-registry/src/error.rs
RegistryError no longer declares MissingEtag or its diagnostic code and help text.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 70c64

No unresolved issue identified here prevents merging after normal checks. Older clients remain incompatible with migrated metadata until updated or resynced, as acknowledged for this breaking change.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 4 files. (2 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the two primary changes: removing build log fields and preserving typed package errors. It is concise and specific.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 4 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Deploying soar-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 23a3fc4
Status: ✅  Deploy successful!
Preview URL: https://bcf887f7.soar-docs.pages.dev
Branch Preview URL: https://refactor-api-cleanup.soar-docs.pages.dev

View logs

@QaidVoid
QaidVoid force-pushed the refactor/api-cleanup branch from 70c64ee to 23a3fc4 Compare October 19, 2026 12:24
@QaidVoid
QaidVoid merged commit e5fce6d into main Oct 19, 2026
8 of 9 checks passed
@QaidVoid QaidVoid mentioned this pull request Oct 19, 2026
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