Skip to content

Conversation

@joslane
Copy link
Contributor

@joslane joslane commented Oct 23, 2025

This update modifies the following files to include support for new boolean fields (autoPublishAfterRebuild and autoRebuildOnSoftwareUpdate) in the project import process:

src/routes/(authenticated)/projects/import/[id=idNumber]/+page.server.ts

  • Updated schema validation to accept the new boolean fields when parsing uploaded JSON files.

src/lib/projects/index.ts

These changes ensure that importing projects with the new automation settings succeeds without errors and that old field (AutomaticBuilds) is no longer expected.

Summary by CodeRabbit

  • New Features
    • Added two optional project settings: "Auto-publish after rebuild" and "Rebuild on software update" — both default to false when not specified.
    • Import now respects an "Allow downloads" setting, defaulting to true during project import.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 23, 2025

Walkthrough

Adds two optional boolean fields (AutoPublishOnRebuild, RebuildOnSoftwareUpdate) to the Projects import JSON schema and adds those plus AllowDownloads to the project creation payload (with defaults) used during import. No other control-flow changes.

Changes

Cohort / File(s) Summary
Project Import Schema
src/lib/projects/index.ts
Added optional boolean fields AutoPublishOnRebuild and RebuildOnSoftwareUpdate to each Project entry in importJSONSchema.
Project Creation Payload
src/routes/(authenticated)/projects/import/[id=idNumber]/+page.server.ts
Passed AllowDownloads (default true), AutoPublishOnRebuild (default false), and RebuildOnSoftwareUpdate (default false) into the DatabaseWrites.projects.createMany payload during import.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Check importJSONSchema additions for correct validation naming and optionality.
  • Verify defaults and mappings in the createMany payload align with DB/prisma schema (field names/casing).

Possibly related issues

Possibly related PRs

Suggested reviewers

  • FyreByrd
  • chrisvire

Poem

🐰 I hopped through code with tiny paws,
New toggles tucked in project laws.
AllowDownloads set to true,
Rebuild and Publish—defaults false too.
A quiet hop to keep imports snug 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "Add support for new auto-publish and rebuild fields in JSON import" accurately and clearly describes the main changes in the pull request. The modifications add two new optional boolean fields (AutoPublishOnRebuild and RebuildOnSoftwareUpdate) to the project schema and update the import route to handle these fields with appropriate defaults. The title directly references both the new "auto-publish and rebuild fields" and the "JSON import" context, making it specific and informative without unnecessary verbosity. A teammate reviewing the commit history would immediately understand that this change introduces new automation-related functionality to the JSON import process.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d41d63a and 6baeb43.

📒 Files selected for processing (2)
  • src/lib/projects/index.ts (1 hunks)
  • src/routes/(authenticated)/projects/import/[id=idNumber]/+page.server.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-22T14:59:53.366Z
Learnt from: FyreByrd
PR: sillsdev/appbuilder-portal#1297
File: src/routes/(authenticated)/projects/[filter=projectSelector]/[orgId=idNumber]/+page.server.ts:214-221
Timestamp: 2025-09-22T14:59:53.366Z
Learning: In the AppBuilder portal, bulk project actions in the route `/projects/[filter=projectSelector]/[orgId=idNumber]/+page.server.ts` are organization-scoped by design. The route parameter `[orgId=idNumber]` ensures all operations happen within a single organization context, so using the route-level orgId for all projects in bulk actions like `doProjectAction` is correct and safe.

Applied to files:

  • src/routes/(authenticated)/projects/import/[id=idNumber]/+page.server.ts
📚 Learning: 2025-09-12T14:07:02.200Z
Learnt from: FyreByrd
PR: sillsdev/appbuilder-portal#1283
File: src/routes/(authenticated)/tasks/[product_id]/+page.server.ts:285-303
Timestamp: 2025-09-12T14:07:02.200Z
Learning: In src/routes/(authenticated)/tasks/[product_id]/+page.server.ts, FyreByrd prefers to optimize filterAvailableActions by creating Sets at the caller level rather than inside the function, so the function would take Set<number> arguments instead of arrays for better performance and separation of concerns.

Applied to files:

  • src/routes/(authenticated)/projects/import/[id=idNumber]/+page.server.ts
📚 Learning: 2025-09-10T13:51:14.948Z
Learnt from: FyreByrd
PR: sillsdev/appbuilder-portal#1275
File: src/routes/(authenticated)/projects/[id=idNumber]/+page.svelte:191-193
Timestamp: 2025-09-10T13:51:14.948Z
Learning: In the appbuilder-portal codebase, the `productsToAdd` property in project data is guaranteed to always be an array (possibly empty), never undefined.

Applied to files:

  • src/lib/projects/index.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: checks / build-and-test
🔇 Additional comments (2)
src/routes/(authenticated)/projects/import/[id=idNumber]/+page.server.ts (1)

221-223: LGTM! Previous critical issue resolved.

The implementation now correctly persists all three fields (AllowDownloads, AutoPublishOnRebuild, RebuildOnSoftwareUpdate) with appropriate defaults, addressing the critical issue flagged in the previous review where AllowDownloads was validated but not saved. The default values are sensible: downloads allowed by default, automation features opt-in only.

However, ensure the field names match the database schema (see comment on src/lib/projects/index.ts lines 136-138).

src/lib/projects/index.ts (1)

136-138: No changes needed—field names are correctly aligned.

Verification confirms the field names in the import schema at lines 136-138 exactly match the Prisma schema: AllowDownloads, AutoPublishOnRebuild, and RebuildOnSoftwareUpdate. The import will correctly validate JSON files using these field names with no mismatches.


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 and usage tips.

@joslane
Copy link
Contributor Author

joslane commented Oct 23, 2025

Connected to part 2 of issue #1303

@joslane joslane marked this pull request as ready for review October 23, 2025 17:22
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0839e17 and d41d63a.

📒 Files selected for processing (2)
  • src/lib/projects/index.ts (1 hunks)
  • src/routes/(authenticated)/projects/import/[id=idNumber]/+page.server.ts (1 hunks)
🔇 Additional comments (1)
src/routes/(authenticated)/projects/import/[id=idNumber]/+page.server.ts (1)

221-222: Implementation looks correct; verify AllowDownloads is intentionally excluded.

The two new fields are properly implemented:

  • Both default to false when not provided in the import JSON (appropriate for opt-in automation features)
  • Field names match the schema validation in src/lib/projects/index.ts

However, note that AllowDownloads (line 136 in the schema) is accepted during validation but not persisted here. Ensure this is intentional.

@FyreByrd FyreByrd linked an issue Oct 30, 2025 that may be closed by this pull request
@FyreByrd FyreByrd merged commit c8db790 into sillsdev:develop Oct 30, 2025
4 checks passed
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.

Rebuilds: Support new Project fields in import JSON

2 participants