Migrate remaining legacy operator workflows

This commit is contained in:
2026-07-12 05:39:27 +09:00
parent ffb8f43c19
commit a01836a2d7
132 changed files with 20566 additions and 720 deletions

View File

@@ -0,0 +1,245 @@
#Requires -Version 5.1
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
function Get-RootPrefix {
param(
[Parameter(Mandatory = $true)]
[string] $Root
)
if ($Root.EndsWith([IO.Path]::DirectorySeparatorChar) -or
$Root.EndsWith([IO.Path]::AltDirectorySeparatorChar)) {
return $Root
}
return $Root + [IO.Path]::DirectorySeparatorChar
}
function Test-IsUnderRoot {
param(
[Parameter(Mandatory = $true)]
[string] $Root,
[Parameter(Mandatory = $true)]
[string] $Candidate
)
$prefix = Get-RootPrefix -Root $Root
return $Candidate.StartsWith($prefix, [StringComparison]::OrdinalIgnoreCase)
}
function Find-ReparseAncestor {
param(
[Parameter(Mandatory = $true)]
[string] $Root,
[Parameter(Mandatory = $true)]
[string] $Candidate
)
$rootItem = Get-Item -LiteralPath $Root -Force
if (($rootItem.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) {
return '.'
}
$prefix = Get-RootPrefix -Root $Root
$relative = $Candidate.Substring($prefix.Length)
$current = $Root
foreach ($part in ($relative -split '[\\/]' | Where-Object { $_.Length -ne 0 })) {
$current = Join-Path $current $part
if (-not (Test-Path -LiteralPath $current)) {
break
}
$item = Get-Item -LiteralPath $current -Force
if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) {
return $part
}
}
return $null
}
function Resolve-CoveragePath {
param(
[Parameter(Mandatory = $true)]
[string] $Root,
[Parameter(Mandatory = $true)]
[string] $RelativePath
)
if ([string]::IsNullOrWhiteSpace($RelativePath) -or
[IO.Path]::IsPathRooted($RelativePath)) {
return [pscustomobject][ordered]@{
Status = 'RootEscape'
FullPath = $null
}
}
try {
$candidate = [IO.Path]::GetFullPath((Join-Path $Root $RelativePath))
}
catch {
return [pscustomobject][ordered]@{
Status = 'ManifestInvalid'
FullPath = $null
}
}
if (-not (Test-IsUnderRoot -Root $Root -Candidate $candidate)) {
return [pscustomobject][ordered]@{
Status = 'RootEscape'
FullPath = $null
}
}
$reparse = Find-ReparseAncestor -Root $Root -Candidate $candidate
if (-not [string]::IsNullOrEmpty($reparse)) {
return [pscustomobject][ordered]@{
Status = 'Reparse'
FullPath = $null
}
}
return [pscustomobject][ordered]@{
Status = 'Resolved'
FullPath = $candidate
}
}
function Test-AssetDefinition {
param(
[Parameter(Mandatory = $true)]
[string] $Kind,
[Parameter(Mandatory = $true)]
[string] $RelativePath
)
$allowedExtensions = switch ($Kind) {
'Image' { @('.bmp', '.jpeg', '.jpg', '.png', '.tga') }
'Texture' { @('.bmp', '.jpeg', '.jpg', '.png', '.tga', '.vrv') }
'Video' { @('.vrv') }
default { return $false }
}
$extension = [IO.Path]::GetExtension($RelativePath)
return $allowedExtensions -contains $extension.ToLowerInvariant()
}
function Test-LegacyCutCoverageState {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[string] $CutRoot,
[Parameter(Mandatory = $true)]
[string[]] $Aliases,
[Parameter(Mandatory = $true)]
[object[]] $AssetRequirements,
[Parameter(Mandatory = $true)]
[int] $ReachableBuilders
)
if (-not [IO.Path]::IsPathRooted($CutRoot)) {
throw 'CutRoot must be an absolute path.'
}
$root = [IO.Path]::GetFullPath($CutRoot)
if (-not (Test-Path -LiteralPath $root -PathType Container)) {
throw 'CutRoot does not identify an existing directory.'
}
$aliasFindings = [Collections.Generic.List[object]]::new()
foreach ($alias in $Aliases) {
$relativePath = $alias + '.t2s'
$resolved = Resolve-CoveragePath -Root $root -RelativePath $relativePath
$status = $resolved.Status
if ($status -eq 'Resolved') {
if (-not (Test-Path -LiteralPath $resolved.FullPath -PathType Leaf)) {
$status = 'Missing'
}
else {
$item = Get-Item -LiteralPath $resolved.FullPath -Force
$status = if ($item.Length -le 0) { 'Empty' } else { 'Present' }
}
}
$aliasFindings.Add([pscustomobject][ordered]@{
Alias = $alias
RelativePath = $relativePath
Status = $status
})
}
$assetFindings = [Collections.Generic.List[object]]::new()
foreach ($requirement in $AssetRequirements) {
$builder = [string] $requirement.Builder
$kind = [string] $requirement.Kind
$relativePath = [string] $requirement.Path
$status = 'ManifestInvalid'
if (-not [string]::IsNullOrWhiteSpace($builder) -and
-not [string]::IsNullOrWhiteSpace($relativePath) -and
(Test-AssetDefinition -Kind $kind -RelativePath $relativePath)) {
$resolved = Resolve-CoveragePath -Root $root -RelativePath $relativePath
$status = $resolved.Status
if ($status -eq 'Resolved') {
if (-not (Test-Path -LiteralPath $resolved.FullPath -PathType Leaf)) {
$status = 'Missing'
}
else {
$item = Get-Item -LiteralPath $resolved.FullPath -Force
$status = if ($item.Length -le 0) { 'Empty' } else { 'Present' }
}
}
}
$assetFindings.Add([pscustomobject][ordered]@{
Builder = $builder
Kind = $kind
RelativePath = $relativePath
Status = $status
})
}
$missingAliases = @($aliasFindings | Where-Object Status -eq 'Missing')
$unsafeAliases = @($aliasFindings | Where-Object {
$_.Status -ne 'Present' -and $_.Status -ne 'Missing'
})
$missingAssets = @($assetFindings | Where-Object Status -eq 'Missing')
$unsafeAssets = @($assetFindings | Where-Object {
$_.Status -ne 'Present' -and $_.Status -ne 'Missing'
})
$rootEscapes = @($assetFindings | Where-Object Status -eq 'RootEscape')
$reparseAssets = @($assetFindings | Where-Object Status -eq 'Reparse')
$invalidAssets = @($assetFindings | Where-Object Status -eq 'ManifestInvalid')
$failed = $missingAliases.Count -ne 0 -or
$unsafeAliases.Count -ne 0 -or
$missingAssets.Count -ne 0 -or
$unsafeAssets.Count -ne 0
return [pscustomobject][ordered]@{
Status = if ($failed) { 'Failed' } else { 'Passed' }
ReachableBuilders = $ReachableBuilders
ActiveAliases = $Aliases.Count
Missing = $missingAliases.Count
Unsafe = $unsafeAliases.Count
RequiredAssets = $AssetRequirements.Count
MissingAssets = $missingAssets.Count
UnsafeAssets = $unsafeAssets.Count
RootEscapes = $rootEscapes.Count
ReparseAssets = $reparseAssets.Count
InvalidAssetDefinitions = $invalidAssets.Count
AliasFindings = $aliasFindings.ToArray()
AssetFindings = $assetFindings.ToArray()
}
}
Export-ModuleMember -Function Test-LegacyCutCoverageState

View File

@@ -0,0 +1,168 @@
{
"schemaVersion": 1,
"reachableBuilders": 34,
"activeAliases": [
"5001",
"N5001",
"5006",
"5011",
"5016",
"50160",
"5023",
"5024",
"5025",
"5026",
"5029",
"8018",
"8032",
"5032",
"5037",
"5074",
"5076",
"5077",
"5078",
"5079",
"5080",
"5081",
"5082",
"5083",
"5084",
"5085",
"5086",
"50860",
"5087",
"5088",
"6001",
"6067",
"8001",
"8002",
"8003",
"8035",
"8061",
"8040",
"8046",
"8051",
"8056",
"8067",
"5068",
"5070",
"5072"
],
"assets": [
{
"builder": "s5006",
"kind": "Video",
"path": "Video\\큐브배경.vrv"
},
{
"builder": "s6001",
"kind": "Video",
"path": "Video\\20201008_미국.vrv"
},
{
"builder": "s6001",
"kind": "Video",
"path": "Video\\20201008_독일.vrv"
},
{
"builder": "s6001",
"kind": "Video",
"path": "Video\\20201008_영국.vrv"
},
{
"builder": "s6001",
"kind": "Video",
"path": "Video\\20201008_프랑스.vrv"
},
{
"builder": "s6001",
"kind": "Video",
"path": "Video\\20201008_일본.vrv"
},
{
"builder": "s6001",
"kind": "Video",
"path": "Video\\20201008_중국.vrv"
},
{
"builder": "s6001",
"kind": "Video",
"path": "Video\\20201008_홍콩.vrv"
},
{
"builder": "s6001",
"kind": "Video",
"path": "Video\\20201008_대만.vrv"
},
{
"builder": "s6001",
"kind": "Video",
"path": "Video\\20201008_싱가포르.vrv"
},
{
"builder": "s6001",
"kind": "Video",
"path": "Video\\20201008_태국.vrv"
},
{
"builder": "s6001",
"kind": "Video",
"path": "Video\\20201008_필리핀.vrv"
},
{
"builder": "s6001",
"kind": "Video",
"path": "Video\\20201008_말레이시아.vrv"
},
{
"builder": "s6001",
"kind": "Video",
"path": "Video\\20201008_인도네시아.vrv"
},
{
"builder": "s6001",
"kind": "Image",
"path": "images\\주유기merge.png"
},
{
"builder": "s6001",
"kind": "Image",
"path": "images\\35752913_l.jpg"
},
{
"builder": "shared-price-direction",
"kind": "Texture",
"path": "Images\\그림_빨강.png"
},
{
"builder": "shared-price-direction",
"kind": "Texture",
"path": "Images\\그림_검정.png"
},
{
"builder": "shared-price-direction",
"kind": "Texture",
"path": "Images\\그림_파랑.png"
},
{
"builder": "s5001/s5074",
"kind": "Image",
"path": "Images\\프리마켓.png"
},
{
"builder": "s5001/s5074",
"kind": "Image",
"path": "Images\\애프터마켓.png"
},
{
"builder": "s8018",
"kind": "Image",
"path": "Images\\KRX.png"
},
{
"builder": "s8018",
"kind": "Image",
"path": "Images\\NXT.png"
}
]
}

View File

@@ -9,52 +9,58 @@ param(
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
if (-not [IO.Path]::IsPathRooted($CutRoot)) {
throw 'CutRoot must be an absolute path.'
$modulePath = Join-Path $PSScriptRoot 'LegacyCutCoverage.psm1'
$manifestPath = Join-Path $PSScriptRoot 'LegacyCutRequirements.json'
Import-Module -Name $modulePath -Force
if (-not (Test-Path -LiteralPath $manifestPath -PathType Leaf)) {
throw 'The closed legacy cut requirement manifest is missing.'
}
$root = [IO.Path]::GetFullPath($CutRoot)
if (-not (Test-Path -LiteralPath $root -PathType Container)) {
throw 'CutRoot does not identify an existing directory.'
$manifest = Get-Content -LiteralPath $manifestPath -Raw -Encoding UTF8 | ConvertFrom-Json
if ($manifest.schemaVersion -ne 1 -or
$manifest.reachableBuilders -le 0 -or
@($manifest.activeAliases).Count -eq 0 -or
@($manifest.assets).Count -eq 0) {
throw 'The closed legacy cut requirement manifest is invalid.'
}
# Active MainForm aliases for the 34 reachable builders. s8086 intentionally has no alias.
$aliases = @(
'5001', 'N5001', '5006', '5011', '5016', '50160',
'5023', '5024', '5025', '5026', '5029',
'8018', '8032', '5032', '5037',
'5074', '5076', '5077', '5078', '5079',
'5080', '5081', '5082', '5083', '5084', '5085',
'5086', '50860', '5087', '5088',
'6001', '6067', '8001', '8002', '8003',
'8035', '8061', '8040', '8046', '8051', '8056',
'8067', '5068', '5070', '5072'
)
$report = Test-LegacyCutCoverageState `
-CutRoot $CutRoot `
-Aliases @($manifest.activeAliases) `
-AssetRequirements @($manifest.assets) `
-ReachableBuilders $manifest.reachableBuilders
$missing = [Collections.Generic.List[string]]::new()
$unsafe = [Collections.Generic.List[string]]::new()
foreach ($alias in $aliases) {
$path = Join-Path $root ($alias + '.t2s')
if (-not (Test-Path -LiteralPath $path -PathType Leaf)) {
$missing.Add($alias)
continue
}
$item = Get-Item -LiteralPath $path -Force
if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0 -or
$item.Length -le 0) {
$unsafe.Add($alias)
}
$failedAliases = @($report.AliasFindings | Where-Object Status -ne 'Present')
$failedAssets = @($report.AssetFindings | Where-Object Status -ne 'Present')
foreach ($finding in $failedAliases) {
Write-Warning ("CutAlias {0} ({1}) => {2}" -f
$finding.Alias,
$finding.RelativePath,
$finding.Status)
}
foreach ($finding in $failedAssets) {
Write-Warning ("BuilderAsset {0} {1} ({2}) => {3}" -f
$finding.Builder,
$finding.Kind,
$finding.RelativePath,
$finding.Status)
}
if ($missing.Count -ne 0 -or $unsafe.Count -ne 0) {
throw "Legacy cut coverage failed. Missing=$($missing.Count), Unsafe=$($unsafe.Count)."
}
[pscustomobject][ordered]@{
Status = 'Passed'
ReachableBuilders = 34
ActiveAliases = $aliases.Count
Missing = $missing.Count
Unsafe = $unsafe.Count
$report
if ($report.Status -ne 'Passed') {
$assetSummary = @($failedAssets | ForEach-Object {
"{0}|{1}|{2}|{3}" -f $_.Builder, $_.Kind, $_.RelativePath, $_.Status
}) -join '; '
$messageFormat = "Legacy cut coverage failed. Missing={0}, Unsafe={1}, " +
"MissingAssets={2}, UnsafeAssets={3}, RootEscapes={4}, " +
"ReparseAssets={5}. AssetFindings=[{6}]"
throw ($messageFormat -f
$report.Missing,
$report.Unsafe,
$report.MissingAssets,
$report.UnsafeAssets,
$report.RootEscapes,
$report.ReparseAssets,
$assetSummary)
}

View File

@@ -45,10 +45,12 @@ $node = Resolve-NodePath -ExplicitPath $NodePath
$repositoryRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..'))
$scripts = @(
(Join-Path $repositoryRoot 'Web\playout-safety.js'),
(Join-Path $repositoryRoot 'Web\market-nav-reorder.js'),
(Join-Path $repositoryRoot 'Web\operator-workflow.js'),
(Join-Path $repositoryRoot 'Web\legacy-fixed-workflow.js'),
(Join-Path $repositoryRoot 'Web\industry-workflow.js'),
(Join-Path $repositoryRoot 'Web\comparison-workflow.js'),
(Join-Path $repositoryRoot 'Web\comparison-import-workflow.js'),
(Join-Path $repositoryRoot 'Web\theme-workflow.js'),
(Join-Path $repositoryRoot 'Web\overseas-workflow.js'),
(Join-Path $repositoryRoot 'Web\expert-workflow.js'),
@@ -57,6 +59,10 @@ $scripts = @(
(Join-Path $repositoryRoot 'Web\manual-lists-workflow.js'),
(Join-Path $repositoryRoot 'Web\manual-financial-workflow.js'),
(Join-Path $repositoryRoot 'Web\named-manual-restore-workflow.js'),
(Join-Path $repositoryRoot 'Web\named-comparison-restore-workflow.js'),
(Join-Path $repositoryRoot 'Web\legacy-foreign-index-candle-workflow.js'),
(Join-Path $repositoryRoot 'Web\named-nxt-theme-restore-workflow.js'),
(Join-Path $repositoryRoot 'Web\legacy-named-row-workflow.js'),
(Join-Path $repositoryRoot 'Web\operator-catalog-workflow.js'),
(Join-Path $repositoryRoot 'Web\manual-lists-ui.js'),
(Join-Path $repositoryRoot 'Web\manual-financial-ui.js'),
@@ -157,12 +163,17 @@ if ($indexMarkup -notmatch 'id="globalMa5"' -or
throw 'The original global 5-day/20-day candle options are not synchronized across every candle workflow.'
}
foreach ($asset in @(
'manual-lists-workflow.js', 'manual-financial-workflow.js', 'named-manual-restore-workflow.js', 'operator-catalog-workflow.js',
'market-nav-reorder.js', 'manual-lists-workflow.js', 'manual-financial-workflow.js', 'named-manual-restore-workflow.js', 'legacy-foreign-index-candle-workflow.js', 'named-nxt-theme-restore-workflow.js', 'legacy-named-row-workflow.js', 'operator-catalog-workflow.js',
'manual-lists-ui.js', 'manual-financial-ui.js', 'operator-catalog-ui.js')) {
if ($indexMarkup -notmatch [regex]::Escape("<script src=`"$asset`"></script>")) {
throw "Operator UI script is not loaded: $asset"
}
}
if ($appScript -notmatch 'MbnMarketNavReorder' -or
$appScript -notmatch [regex]::Escape('marketNavReorder.createController') -or
$appScript -notmatch [regex]::Escape('hasOpenOperatorModal() || isPlaylistSnapshotLocked()')) {
throw 'The original business-tab drag and keyboard reorder contract is not connected.'
}
foreach ($asset in @('manual-lists-ui.css', 'manual-financial-ui.css', 'operator-catalog-ui.css')) {
if ($indexMarkup -notmatch [regex]::Escape("<link rel=`"stylesheet`" href=`"$asset`">") ) {
throw "Operator UI stylesheet is not loaded: $asset"
@@ -186,7 +197,9 @@ if ($appScript -notmatch 'requestBackgroundSelection' -or
$mainWindowScript -notmatch 'case "choose-background"' -or
$mainWindowScript -notmatch 'case "toggle-background"' -or
$playoutMainScript -notmatch 'MutableLegacySceneCueCompositionOptionsSource' -or
$backgroundScript -notmatch 'OperatorBackgroundExtensions') {
$backgroundScript -notmatch 'CreateOperatorSelection' -or
$backgroundScript -notmatch 'CreateLegacyDefault' -or
$backgroundScript -notmatch 'TryGetTrustedBackgroundDirectory') {
throw 'Legacy F2/F3 native background selection integration is incomplete.'
}
if ($appScript -notmatch 'restoreFixedPlaylistEntry' -or
@@ -263,7 +276,7 @@ if ($appScript -notmatch 'MbnNamedPlaylistWorkflow' -or
$appScript -notmatch 'requestNamedPlaylistReplace' -or
$appScript -notmatch 'requestNamedPlaylistDelete' -or
$appScript -notmatch 'namedPlaylistPrepareBlockers' -or
$appScript -notmatch 'restoreRawRows\(load, resolveNamedPlaylistRawRow\)' -or
$appScript -notmatch 'restoreRawRows\([\s\S]*load,[\s\S]*resolveNamedPlaylistRawRow,[\s\S]*legacyNamedRowWorkflow\.matchesCanonicalEntry' -or
$appScript -notmatch 'requestNamedPlaylistPagePlans' -or
$appScript -notmatch 'normalizePagePlanResponse\(payload, pending\.request\)' -or
$appScript -notmatch 'page-result-empty' -or
@@ -310,6 +323,12 @@ if ($mainWindowScript -notmatch 'OnNavigationStarting' -or
throw 'Reload, navigation, and WebView process failure must quarantine in-flight playout correlation.'
}
$cutCoverageFixturePath = Join-Path $PSScriptRoot '..\tests\Scripts\Test-LegacyCutCoverage.Fixture.ps1'
$cutCoverageFixture = & $cutCoverageFixturePath
if ($cutCoverageFixture.Status -ne 'Passed') {
throw 'Legacy cut and builder asset coverage fixtures failed.'
}
& $node --test @testFiles
if ($LASTEXITCODE -ne 0) {
throw "Web playout tests failed with exit code $LASTEXITCODE."
@@ -321,4 +340,5 @@ if ($LASTEXITCODE -ne 0) {
SceneCatalogEntries = $sceneCatalogMatches.Count
ReachableSelectionPresets = $selectionPresetMatches.Count
TestFiles = $testFiles.Count
CutCoverageFixture = $cutCoverageFixture.Status
}