Enforce recipient-bound single-use invites and fix issue card layout; clean release tooling
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$repoRoot = Resolve-Path "$PSScriptRoot\\.."
|
||||
Set-Location $repoRoot
|
||||
|
||||
powershell -ExecutionPolicy Bypass -File (Join-Path $repoRoot "scripts\run_backend_quality_gate.ps1")
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "scripts/run_backend_quality_gate.ps1 failed with exit code $LASTEXITCODE."
|
||||
}
|
||||
|
||||
$now = Get-Date
|
||||
$buildNumber = "{0}{1}{2}{3}{4}" -f $now.ToString("dd"), $now.ToString("MM"), $now.ToString("yy"), $now.ToString("HH"), $now.ToString("mm")
|
||||
|
||||
Write-Host "Build number: $buildNumber"
|
||||
|
||||
git tag $buildNumber
|
||||
git push origin $buildNumber
|
||||
|
||||
$backendImage = "rephl3xnz/magent-backend:$buildNumber"
|
||||
$frontendImage = "rephl3xnz/magent-frontend:$buildNumber"
|
||||
|
||||
docker build -f backend/Dockerfile -t $backendImage --build-arg BUILD_NUMBER=$buildNumber .
|
||||
docker build -f frontend/Dockerfile -t $frontendImage frontend
|
||||
|
||||
docker tag $backendImage rephl3xnz/magent-backend:latest
|
||||
docker tag $frontendImage rephl3xnz/magent-frontend:latest
|
||||
|
||||
docker push $backendImage
|
||||
docker push $frontendImage
|
||||
docker push rephl3xnz/magent-backend:latest
|
||||
docker push rephl3xnz/magent-frontend:latest
|
||||
@@ -0,0 +1,10 @@
|
||||
function Set-EnvBuildNumber {
|
||||
param(
|
||||
[AllowEmptyString()][string]$Content,
|
||||
[Parameter(Mandatory = $true)][string]$BuildNumber
|
||||
)
|
||||
if ($BuildNumber -notmatch '^\d+$') { throw 'Build number must contain digits only.' }
|
||||
$newline = if ($Content.Contains("`r`n")) { "`r`n" } else { "`n" }
|
||||
$remaining = [regex]::Replace($Content, '(?m)^[\t ]*(?:export[\t ]+)?BUILD_NUMBER[\t ]*=[^\r\n]*(?:\r?\n|$)', '')
|
||||
return "BUILD_NUMBER=$BuildNumber$newline$remaining"
|
||||
}
|
||||
+3
-10
@@ -5,6 +5,7 @@ param(
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
. (Join-Path $PSScriptRoot 'env_build_number.ps1')
|
||||
|
||||
$repoRoot = Resolve-Path "$PSScriptRoot\.."
|
||||
Set-Location $repoRoot
|
||||
@@ -172,16 +173,8 @@ function Update-BuildFiles {
|
||||
$envPath = Join-Path $repoRoot ".env"
|
||||
if (Test-Path $envPath) {
|
||||
$envContent = Read-TextFile -Path ".env"
|
||||
if ($envContent -match '^BUILD_NUMBER=.*$') {
|
||||
$updatedEnv = [regex]::Replace(
|
||||
$envContent,
|
||||
'^BUILD_NUMBER=.*$',
|
||||
"BUILD_NUMBER=$BuildNumber",
|
||||
[System.Text.RegularExpressions.RegexOptions]::Multiline
|
||||
)
|
||||
} else {
|
||||
$updatedEnv = "BUILD_NUMBER=$BuildNumber`n$envContent"
|
||||
}
|
||||
# Remove previous assignments before adding exactly one build number.
|
||||
$updatedEnv = Set-EnvBuildNumber -Content $envContent -BuildNumber $BuildNumber
|
||||
Write-TextFile -Path ".env" -Content $updatedEnv
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
const { chromium } = require(process.env.REVIEW_PLAYWRIGHT);
|
||||
const fs = require('node:fs');
|
||||
const assert = require('node:assert/strict');
|
||||
(async () => {
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
try {
|
||||
const page = await browser.newPage();
|
||||
const css = ['globals.css', 'ops-redesign.css', 'admin/config.css', 'account.css', 'workspace.css', 'portal/issue-flow.css'].map(p => fs.readFileSync(`frontend/app/${p}`, 'utf8')).join('\n');
|
||||
for (const width of [320, 390, 1440]) {
|
||||
await page.setViewportSize({ width, height: 900 });
|
||||
await page.setContent(`<style>${css}</style><main class="issue-portal-page" style="display:block;width:100%;margin:0"><section class="portal-list-panel" style="width: min(100%, 360px);height:600px"><div class="portal-item-list">${Array.from({length: 8}, (_, i) => `<button class="portal-item-row"><div class="portal-item-row-main"><div class="portal-item-row-title"><strong>Issue ${i}: A long movie title with a missing episode and more details</strong><span class="small-pill">Broken media</span><span class="small-pill">Normal</span></div><p>Two lines of issue description to make sure this card expands correctly and does not overlap its neighbours.</p><div class="issue-card-progress">Reported — Step 1 of 6</div><div class="portal-item-row-meta"><span>#${i}</span><span>By: long-test-account@example.invalid</span><span>Updated: 9/7/2026, 10:00:00 PM</span></div></div></button>`).join('')}</div></section></main>`);
|
||||
const bounds = await page.locator('.portal-item-row').evaluateAll(rows => rows.map(row => {
|
||||
const r = row.getBoundingClientRect(), content = row.firstElementChild.getBoundingClientRect();
|
||||
return {top:r.top,bottom:r.bottom,innerTop:content.top,innerBottom:content.bottom};
|
||||
}));
|
||||
bounds.forEach((r,i) => { assert(r.innerTop >= r.top); assert(r.innerBottom <= r.bottom); if(i) assert(r.top >= bounds[i-1].bottom + 7); });
|
||||
console.log(`Issue card content and spacing passed at ${width}px`);
|
||||
}
|
||||
} finally { await browser.close(); }
|
||||
})().catch(e => { console.error(e); process.exit(1); });
|
||||
@@ -0,0 +1,14 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
. (Join-Path $PSScriptRoot 'env_build_number.ps1')
|
||||
|
||||
foreach ($newline in @("`n", "`r`n")) {
|
||||
foreach ($content in @('', 'BUILD_NUMBER=1', "# keep$newline`BUILD_NUMBER=1$newline`TOKEN=example=unchanged$newline`BUILD_NUMBER=2$newline", "export BUILD_NUMBER=3$newline`OTHER=value$newline")) {
|
||||
$result = Set-EnvBuildNumber -Content $content -BuildNumber '0803262237'
|
||||
if ([regex]::Matches($result, '(?m)^BUILD_NUMBER=').Count -ne 1) { throw 'Duplicate build numbers remain' }
|
||||
if ((Set-EnvBuildNumber -Content $result -BuildNumber '0803262237') -cne $result) { throw 'Update is not idempotent' }
|
||||
$expected = [regex]::Replace($content, '(?m)^(?:export )?BUILD_NUMBER=[^\r\n]*(?:\r?\n|$)', '')
|
||||
$actual = [regex]::Replace($result, '(?m)^BUILD_NUMBER=[^\r\n]*(?:\r?\n|$)', '')
|
||||
if ($actual -cne $expected) { throw 'Unrelated settings changed' }
|
||||
}
|
||||
}
|
||||
Write-Host 'Build-number tests passed: empty, existing, duplicates, LF/CRLF, preservation and repeat updates.'
|
||||
Reference in New Issue
Block a user