Skip to content

refactor: move the container order code from lib.php into lib.order.php - #198

Merged
chodeus merged 4 commits into
betafrom
refactor/lib-order
Nov 16, 2026
Merged

chodeus merged 4 commits into
betafrom
refactor/lib-order

Conversation

@chodeus

@chodeus chodeus commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner
  • Moves the order code out of server/lib.php into a new server/lib.order.php: userprefs.cfg and FV3's snapshot of it, the autostart file and mode, folder membership, the page order and syncContainerOrder() (32 functions, Docker and VM). lib.php requires it beside its other lib.*.php files.
  • No code line changes: every function matches beta's once comments are ignored. Seven moved comment blocks over the 2-line cap are trimmed, each keeping its warning or pointer. lib.php goes from 2,131 to 1,472 lines.
  • name_order_test.js now requires the real lib.order.php instead of lifting fv3_name_cmp out with a regex; the harness exports its plugin path for it.
  • Pointers follow the move: the watcher's UserPrefs.php contract and a comment in lib.foreign_import.php.
  • Tested: PHP and page suites, watcher tests and watch.py check. With the new require_once removed, page_order_test.php and docker_saved_places_test.js fail; the built package holds lib.order.php.

Summary by CodeRabbit

  • Bug Fixes
    • Docker and folder ordering now better preserves saved order and folder membership, with alphabetical ordering used when saved preferences are unavailable or invalid.
    • Missing folder entries can be restored from a valid saved snapshot without overwriting preferences that changed during recovery.
    • Autostart settings now handle invalid or unreadable configuration more safely, and wait values are limited to 0–3600 seconds. Failures to apply autostart changes are reported as warnings.

A pure move: 32 functions, each byte-identical, and lib.php requires the new file. lib.php goes from 2,131 to 1,471 lines.
…llow the move

The watcher's UserPrefs.php contract and lib.php's require block now point at lib.order.php, whose header names the VM order too.
Seven blocks ran three to nine lines. Each keeps its warning or pointer; the tri-state note moves above fv3_export_order_snapshot, the function it describes. No code line changes.
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Order-management logic moves from lib.php to lib.order.php. The change updates the loading path, related references, and the name-order test.

Changes: Order management

Layer / File(s) Summary
Move order management logic
src/folder.view3/usr/local/emhttp/plugins/folder.view3/server/lib.order.php, src/folder.view3/usr/local/emhttp/plugins/folder.view3/server/lib.php
lib.order.php now contains order preference and snapshot handling, Docker and VM ordering, folder membership, autostart configuration, synchronization, and import-time order updates. lib.php removes the previous implementations and requires lib.order.php.
Update references and name-order test
.github/scripts/name_order_test.js, .github/scripts/preview_pages_harness.js, .github/unraid-watch/watch.json, src/folder.view3/usr/local/emhttp/plugins/folder.view3/server/lib.foreign_import.php
The test loads lib.order.php and uses the harness exports. The contract reference and foreign-import comment point to the new implementation location.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • chodeus/folder.view3#167: It changes ordering logic that this PR moves to lib.order.php, including name matching and shared comparison behavior.
Merge Risk: Minimal · up to 4c92b

Merge Risk: ⚪ Minimal · up to 4c92b

This change reorganizes the container, folder, VM and autostart ordering code into its own server file without intending behavior changes. The existing pages and endpoints still load that code through the same entry point. The name-order test now exercises the real shipped implementation. No concrete regressions were identified, and the change is ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "refactor: move the container order code from lib.php into lib.order.php" matches the main change. The PR moves 32 container-order functions from server/lib.php into server/lib.order.php, an…
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: Title check

Explanation

The title "refactor: move the container order code from lib.php into lib.order.php" matches the main change. The PR moves 32 container-order functions from server/lib.php into server/lib.order.php, and the raw summary confirms lib.php drops the ordering helpers while lib.order.php gains them. The title is specific and does not cover test or reference-pointer updates, which is acceptable.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9cd4d47 and 17e431c.

Files selected for processing: 6

  • .github/scripts/name_order_test.js
  • .github/scripts/preview_pages_harness.js
  • .github/unraid-watch/watch.json
  • src/folder.view3/usr/local/emhttp/plugins/folder.view3/server/lib.foreign_import.php
  • src/folder.view3/usr/local/emhttp/plugins/folder.view3/server/lib.order.php
  • src/folder.view3/usr/local/emhttp/plugins/folder.view3/server/lib.php

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

@chodeus

chodeus commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Action performed

Full review finished.

@chodeus
chodeus marked this pull request as ready for review November 16, 2026 11:01
@chodeus
chodeus merged commit a13f213 into beta Nov 16, 2026
19 checks passed
@chodeus
chodeus deleted the refactor/lib-order branch November 16, 2026 11:25
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