Skip to content

S154 — migration 104: correct false rescan ENUM COMMENT - #741

Merged
detain merged 2 commits into
masterfrom
s154srv-s154-enum-comment
Sep 9, 2026
Merged

S154 — migration 104: correct false rescan ENUM COMMENT#741
detain merged 2 commits into
masterfrom
s154srv-s154-enum-comment

Conversation

@detain

@detain detain commented Sep 9, 2026

Copy link
Copy Markdown
Owner

S154 — migration 104: correct false rescan ENUM COMMENT

Why

library_scan_jobs.type carries a column COMMENT claiming rescan=purge+rescan.
rescan does not purge the library. It re-reads every file from disk and then
prunes only the items whose source file is gone
(LibraryManager::pruneRemovedItems(), behind a per-root presence guard). S149
corrected this claim across 11 documentation pages; the SQL copy survived because
it lives inside an ALTER, and it is the copy a DBA finds in SHOW FULL COLUMNS.

What

New migration 104 re-issues the MODIFY COLUMN with a corrected COMMENT.

  • Nothing else moves. The nine ENUM members (scan, rescan, metadata, metadata_refresh, prune, clear_metadata, clear_artwork, delete_all, media_assets)
    and their ordinals, NOT NULL, DEFAULT 'scan' and the inherited
    utf8mb4_unicode_ci collation are copied byte-for-byte from the live schema.
    Only the COMMENT text changes.
  • The historical migrations are NOT edited in place. The COMMENT string is
    executable SQL, not a full-line --/# comment, so MigrationRunner::checksum()
    does not strip it. Re-wording 027/030/081/084/101 would change their checksums
    and force the whole ALTER to re-apply on every deployed install. They stay
    byte-identical; 104 corrects the state forward. (Contrast S147/S151, which safely
    edited a full-line header comment in 084.)
  • Sweep: the same falsehood also sits in the executable SQL of 027/030/081/084;
    all are superseded by 101's declaration and in turn by 104. items_removed
    (027) says "items removed (rescan)" — truthful: rescan does remove (prune) gone
    items. No other behavioural COMMENT in the chain was found false.

Proof

tests/Integration/Common/Database/RescanEnumCommentGuardTest.php runs against a
live MySQL and pins:

  • the 9 ENUM members + ordinals are byte-identical before/after (via
    information_schema.COLUMNS.COLUMN_TYPE);
  • NOT NULL / DEFAULT 'scan' / collation / every other column unchanged — only
    type.COLUMN_COMMENT moved, and to exactly the string 104 declares (parsed from
    the migration, not duplicated);
  • re-running 104 is a total no-op (idempotent);
  • migration 084's comment-stripped checksum is still c948944dfc1bbb4e82b0675efdb341e2
    (with a negative control that the stripped hash differs from the raw file md5).

The false "before" state is established by re-applying the real migration-101 file,
so the test proves against the artefact that ships today.

Fileset

  • migrations/104_library_scan_jobs_rescan_comment_correction.sql (new)
  • tests/Integration/Common/Database/RescanEnumCommentGuardTest.php (new)
  • tests/Unit/Common/Database/ScanJobsEnumMigrationTest.php (re-point latest ENUM
    declarer 101 → 104; assertion logic unchanged)
  • tests/Unit/Server/Http/RequestDynamicPropertyCensusExecutableTest.php
    (PHP-file census re-pin 1803 → 1804, measured)
  • CHANGELOG.md (Unreleased / Fixed)

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@codacy-production

codacy-production Bot commented Sep 9, 2026

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 1 high · 2 medium · 54 minor

Alerts:
⚠ 57 issues (≤ 0 issues of at least minor severity)

Results:
57 new issues

Category Results
Compatibility 1 high
BestPractice 1 minor
Documentation 14 minor
Comprehensibility 3 minor
CodeStyle 36 minor
Complexity 2 medium

View in Codacy

🟢 Metrics 29 complexity · 0 duplication

Metric Results
Complexity 29
Duplication 0

View in Codacy

🟢 Coverage ∅ diff coverage · 0.00% coverage variation

Metric Results
Coverage variation 0.00% coverage variation (-1.00%)
Diff coverage diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (148fe3c) 66835 47960 71.76%
Head commit (745df75) 66835 (+0) 47959 (-1) 71.76% (0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#741) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@detain detain added the needs-coordinator PARKED lane: blocked, not failed — coordinator decides next action label Sep 9, 2026
@detain
detain force-pushed the s154srv-s154-enum-comment branch from 70ef324 to 745df75 Compare September 9, 2026 02:00
@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.59%. Comparing base (148fe3c) to head (745df75).

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #741      +/-   ##
============================================
- Coverage     72.59%   72.59%   -0.01%     
  Complexity    22863    22863              
============================================
  Files           711      711              
  Lines         71267    71267              
============================================
- Hits          51738    51737       -1     
- Misses        19529    19530       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@detain
detain merged commit 798adc4 into master Sep 9, 2026
21 of 22 checks passed
@detain
detain deleted the s154srv-s154-enum-comment branch September 9, 2026 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-coordinator PARKED lane: blocked, not failed — coordinator decides next action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant