diff --git a/docs/TRAFFIC_POOL.md b/docs/TRAFFIC_POOL.md
index 3be741ce..13b15fa5 100644
--- a/docs/TRAFFIC_POOL.md
+++ b/docs/TRAFFIC_POOL.md
@@ -155,6 +155,17 @@ The primary user values are:
- the next expiry time and the unused bytes that will be forfeited then;
- last trusted observation and network-restriction state.
+The read model also projects one accounting-freshness state from the same
+durable pool, cursor, scan-failure and settlement-bucket evidence. User and
+administrator views must use that shared state; neither may infer freshness
+from browser request time. The user surface exposes only `current`, `delayed`
+or `attention` plus the last confirmed timestamp. Shared quota, consumption,
+balance and overage are labelled as last-confirmed values whenever newer
+instance counters are still settling or require review. Per-instance RX/TX
+samples remain visible as raw observations and are never relabelled as settled
+pool accounting. Internal failure codes, subject identifiers and repair
+details are administrator-only evidence.
+
Lifetime or calendar-month usage is a separate statistic. It must not be
divided by the currently active quota because expired entitlements legitimately
make historical usage greater than the quota still active today.
diff --git a/docs/TRAFFIC_POOL_ROLLOUT.md b/docs/TRAFFIC_POOL_ROLLOUT.md
index 1692ff07..53b89385 100644
--- a/docs/TRAFFIC_POOL_ROLLOUT.md
+++ b/docs/TRAFFIC_POOL_ROLLOUT.md
@@ -212,6 +212,8 @@ checks in enforced mode with controlled test instances:
`service_expired` or `admin_hold`;
- the user page exposes only enforced groups and never presents shadow data as
an active shared allowance;
+- delayed or attention accounting is visible as a last-confirmed balance with
+ its confirmation time, while per-instance raw samples remain available;
- pool or cursor attention prevents an untrusted automatic network restore;
- repeated lifecycle ticks neither double-charge usage nor create duplicate
network mutations;
diff --git a/web/app/Services/Cloud/CloudTrafficPoolReadModel.php b/web/app/Services/Cloud/CloudTrafficPoolReadModel.php
index 3e8554fd..41d32521 100644
--- a/web/app/Services/Cloud/CloudTrafficPoolReadModel.php
+++ b/web/app/Services/Cloud/CloudTrafficPoolReadModel.php
@@ -316,15 +316,6 @@ final class CloudTrafficPoolReadModel
'last_confirmed_at' =>
($freshness['last_confirmed_at'] ?? null) === null
? null : (int) $freshness['last_confirmed_at'],
- 'unsettled_instance_count' => (int) (
- $freshness['unsettled_instance_count'] ?? 0
- ),
- 'stale_cursor_count' => (int) (
- $freshness['stale_cursor_count'] ?? 0
- ),
- 'safe_code' => (string) (
- $freshness['safe_code'] ?? 'projection_pending'
- ),
],
'network_restriction_state' => $networkState,
'instances' => array_values($instances),
@@ -451,6 +442,22 @@ final class CloudTrafficPoolReadModel
? $coverage['regions'] : []
);
$summaryState = self::linePoolState($item);
+ $freshnessStatus = (string) (
+ $item['accounting_freshness']['status'] ?? 'delayed'
+ );
+ if (!in_array(
+ $freshnessStatus,
+ ['current', 'delayed', 'attention'],
+ true
+ )) {
+ $freshnessStatus = 'attention';
+ }
+ if ($freshnessStatus === 'attention') {
+ $summaryState = 'attention';
+ } elseif ($freshnessStatus === 'delayed'
+ && $summaryState === 'available') {
+ $summaryState = 'delayed';
+ }
if (($coverage['complete'] ?? false) !== true
|| $publicCoverage === []) {
$summaryState = 'attention';
diff --git a/web/app/Services/Cloud/CloudUserPageView.php b/web/app/Services/Cloud/CloudUserPageView.php
index dda6ae12..23f01c56 100644
--- a/web/app/Services/Cloud/CloudUserPageView.php
+++ b/web/app/Services/Cloud/CloudUserPageView.php
@@ -81,6 +81,7 @@ final class CloudUserPageView
(string) ($pool['summary_state'] ?? ''),
[
'available' => ['状态正常', 'running'],
+ 'delayed' => ['账务结算延迟', 'warning'],
'preparing' => ['额度准备中', 'warning'],
'applying' => ['网络策略应用中', 'warning'],
'exhausted' => ['流量已用尽', 'stopped'],
@@ -131,6 +132,19 @@ final class CloudUserPageView
private static function trafficPool(array $pool): array
{
$projectionReady = ($pool['projection_ready'] ?? false) === true;
+ $freshness = is_array($pool['accounting_freshness'] ?? null)
+ ? $pool['accounting_freshness'] : [];
+ $freshnessStatus = (string) ($freshness['status'] ?? 'delayed');
+ if (!in_array(
+ $freshnessStatus,
+ ['current', 'delayed', 'attention'],
+ true
+ )) {
+ $freshnessStatus = 'attention';
+ }
+ $confirmedAt = max(0, (int) (
+ $freshness['last_confirmed_at'] ?? 0
+ ));
[$stateLabel, $stateClass] = self::state(
(string) ($pool['state'] ?? ''),
[
@@ -199,6 +213,10 @@ final class CloudUserPageView
'state_class' => $stateClass,
'network_label' => $networkLabel,
'network_class' => $networkClass,
+ 'accounting_status' => $freshnessStatus,
+ 'accounting_confirmed_display' => $confirmedAt > 0
+ ? self::date($confirmedAt) : '',
+ 'accounting_has_confirmation' => $confirmedAt > 0,
'entitlement_display' => $projectionReady ? self::bytes(
$pool['active_entitlement_bytes'] ?? null
) : '正在准备',
diff --git a/web/public/cloud/styles.css b/web/public/cloud/styles.css
index 9be2a5a3..813da8e1 100644
--- a/web/public/cloud/styles.css
+++ b/web/public/cloud/styles.css
@@ -333,6 +333,14 @@ body.vu-body .ssh-key-picker-manage:hover {
.cloud-traffic-card-heading p{margin:4px 0 0;color:#8495a3;font-size:10px;line-height:1.5}
.cloud-traffic-icon{display:grid;place-items:center;flex:0 0 40px;width:40px;height:40px;border-radius:11px;background:#eaf8f8;color:#168e97;font-size:19px}
.cloud-traffic-state-group{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}
+.cloud-traffic-accounting{display:flex;align-items:flex-start;gap:11px;padding:12px 14px;border:1px solid transparent;border-radius:10px}
+.cloud-traffic-accounting-current{border-color:#cfeade;background:#f0faf5;color:#177d5d}
+.cloud-traffic-accounting-delayed{border-color:#f0dfb8;background:#fff9eb;color:#9a6b17}
+.cloud-traffic-accounting-attention{border-color:#efcfd3;background:#fff4f5;color:#a6424d}
+.cloud-traffic-accounting-icon{display:grid;place-items:center;flex:0 0 24px;width:24px;height:24px;font-size:17px}
+.cloud-traffic-accounting-copy{display:grid;gap:3px;min-width:0}
+.cloud-traffic-accounting-copy strong{font-size:11px;line-height:1.45}
+.cloud-traffic-accounting-copy small{color:#6f8290;font-size:10px;line-height:1.55;overflow-wrap:anywhere}
.cloud-traffic-facts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:0}
.cloud-traffic-facts>div{display:grid;align-content:start;gap:5px;min-width:0;padding:13px 14px;border-radius:9px;background:#f7fafb}
.cloud-traffic-facts dt{color:#8798a6;font-size:10px;font-weight:700}
diff --git a/web/public/cloud/traffic.js b/web/public/cloud/traffic.js
index 27ce9f47..1e1c6fd9 100644
--- a/web/public/cloud/traffic.js
+++ b/web/public/cloud/traffic.js
@@ -73,6 +73,7 @@ function restrictionState(value) {
function linePoolState(value) {
return ({
available: [t('traffic.status.line.available'), 'running'],
+ delayed: [t('traffic.status.line.delayed'), 'warning'],
preparing: [t('traffic.status.line.preparing'), 'warning'],
applying: [t('traffic.status.line.applying'), 'warning'],
exhausted: [t('traffic.status.line.exhausted'), 'stopped'],
@@ -81,6 +82,43 @@ function linePoolState(value) {
})[String(value || '')] || [t('traffic.status.unknown'), 'other'];
}
+function accountingFreshness(pool) {
+ const freshness = pool?.accounting_freshness;
+ const status = ['current', 'delayed', 'attention'].includes(freshness?.status)
+ ? freshness.status : 'attention';
+ const confirmedAt = Number(freshness?.last_confirmed_at);
+ const hasConfirmation = Number.isFinite(confirmedAt) && confirmedAt > 0;
+ const labelKey = `traffic.freshness.${status}`;
+ const messageKey = `traffic.freshness.${status}_${hasConfirmation
+ ? 'at' : 'without_time'}`;
+ return {
+ status,
+ label: t(labelKey),
+ message: t(messageKey, hasConfirmation ? {
+ date: formatDate(confirmedAt, t('traffic.value.time_missing')),
+ } : {}),
+ };
+}
+
+function renderAccountingFreshness(pool) {
+ const freshness = accountingFreshness(pool);
+ const box = element('div',
+ `cloud-traffic-accounting cloud-traffic-accounting-${freshness.status}`);
+ const icon = element('span', 'cloud-traffic-accounting-icon');
+ const marker = element('i', freshness.status === 'current'
+ ? 'mdi mdi-check-circle-outline'
+ : freshness.status === 'delayed'
+ ? 'mdi mdi-clock-alert-outline'
+ : 'mdi mdi-alert-circle-outline');
+ marker.setAttribute('aria-hidden', 'true');
+ icon.append(marker);
+ const copy = element('span', 'cloud-traffic-accounting-copy');
+ copy.append(element('strong', '', freshness.label),
+ element('small', '', freshness.message));
+ box.append(icon, copy);
+ return box;
+}
+
function instanceNetwork(value) {
return ({
active: [t('traffic.status.instance.active'), 'running'],
@@ -185,7 +223,7 @@ function renderLineContent(pool) {
name: pool.name || t('traffic.pool.fallback'),
}));
renderInstances(pool, instances);
- card.append(intro, facts, instances);
+ card.append(intro, renderAccountingFreshness(pool), facts, instances);
return card;
}
diff --git a/web/resources/user-copy/entries/backup-network.entries.php b/web/resources/user-copy/entries/backup-network.entries.php
index 6306af3b..ddbea262 100644
--- a/web/resources/user-copy/entries/backup-network.entries.php
+++ b/web/resources/user-copy/entries/backup-network.entries.php
@@ -124,13 +124,22 @@ return [
$entry('traffic.coverage.label', 'traffic', 'cloud.traffic', '覆盖:{regions}', 'description', ['regions' => 'string']),
$entry('traffic.coverage.unknown', 'traffic', 'cloud.traffic', '覆盖地区待核查', 'status', []),
$entry('traffic.intro', 'traffic', 'cloud.traffic', '最早到期的有效额度优先消耗;当前线路内的实例共同使用可用余额。', 'description', []),
- $entry('traffic.fact.entitlement', 'traffic', 'cloud.traffic', '有效额度', 'label', []),
- $entry('traffic.fact.consumed', 'traffic', 'cloud.traffic', '已消耗', 'label', []),
- $entry('traffic.fact.available', 'traffic', 'cloud.traffic', '可用余额', 'label', []),
- $entry('traffic.fact.overage', 'traffic', 'cloud.traffic', '超额流量', 'label', []),
+ $entry('traffic.fact.entitlement', 'traffic', 'cloud.traffic', '最后确认有效额度', 'label', []),
+ $entry('traffic.fact.consumed', 'traffic', 'cloud.traffic', '最后确认已消耗', 'label', []),
+ $entry('traffic.fact.available', 'traffic', 'cloud.traffic', '最后确认可用余额', 'label', []),
+ $entry('traffic.fact.overage', 'traffic', 'cloud.traffic', '最后确认超额流量', 'label', []),
$entry('traffic.fact.next_expiry', 'traffic', 'cloud.traffic', '下一批到期', 'label', []),
$entry('traffic.fact.expiry_note', 'traffic', 'cloud.traffic', '届时作废 {amount}', 'help', ['amount' => 'string']),
- $entry('traffic.fact.last_observed', 'traffic', 'cloud.traffic', '最近核算', 'label', []),
+ $entry('traffic.fact.last_observed', 'traffic', 'cloud.traffic', '最近实例采样', 'label', []),
+ $entry('traffic.freshness.current', 'traffic', 'cloud.traffic', '账务已确认', 'status', []),
+ $entry('traffic.freshness.delayed', 'traffic', 'cloud.traffic', '账务结算延迟', 'status', []),
+ $entry('traffic.freshness.attention', 'traffic', 'cloud.traffic', '账务需要核对', 'status', []),
+ $entry('traffic.freshness.current_at', 'traffic', 'cloud.traffic', '共享额度已确认至 {date}。', 'help', ['date' => 'string']),
+ $entry('traffic.freshness.current_without_time', 'traffic', 'cloud.traffic', '共享额度已完成确认。', 'help', []),
+ $entry('traffic.freshness.delayed_at', 'traffic', 'cloud.traffic', '最新采样正在结算;以下共享额度为 {date} 的最后确认结果。', 'help', ['date' => 'string']),
+ $entry('traffic.freshness.delayed_without_time', 'traffic', 'cloud.traffic', '最新采样正在结算;以下共享额度为最后确认结果,确认时间暂未记录。', 'help', []),
+ $entry('traffic.freshness.attention_at', 'traffic', 'cloud.traffic', '账务正在核对;以下共享额度为 {date} 的最后确认结果。', 'help', ['date' => 'string']),
+ $entry('traffic.freshness.attention_without_time', 'traffic', 'cloud.traffic', '账务正在核对;以下共享额度为最后确认结果,确认时间暂未记录。', 'help', []),
$entry('traffic.instances.title', 'traffic', 'cloud.traffic', '当前实例', 'label', []),
$entry('traffic.instances.count', 'traffic', 'cloud.traffic', '{count} 台', 'status', ['count' => 'integer']),
$entry('traffic.instances.aria', 'traffic', 'cloud.traffic', '{name} 的实例', 'aria_label', ['name' => 'string']),
@@ -157,6 +166,7 @@ return [
$entry('traffic.status.restriction.attention', 'traffic', 'cloud.traffic', '网络策略需要人工核查', 'status', []),
$entry('traffic.status.restriction.unknown', 'traffic', 'cloud.traffic', '网络状态待核查', 'status', []),
$entry('traffic.status.line.available', 'traffic', 'cloud.traffic', '状态正常', 'status', []),
+ $entry('traffic.status.line.delayed', 'traffic', 'cloud.traffic', '账务结算延迟', 'status', []),
$entry('traffic.status.line.preparing', 'traffic', 'cloud.traffic', '额度准备中', 'status', []),
$entry('traffic.status.line.applying', 'traffic', 'cloud.traffic', '网络策略应用中', 'status', []),
$entry('traffic.status.line.exhausted', 'traffic', 'cloud.traffic', '流量已用尽', 'status', []),
diff --git a/web/resources/views/venix/cloud/pages/traffic.tpl b/web/resources/views/venix/cloud/pages/traffic.tpl
index a12e8e72..10aa46b3 100644
--- a/web/resources/views/venix/cloud/pages/traffic.tpl
+++ b/web/resources/views/venix/cloud/pages/traffic.tpl
@@ -27,6 +27,7 @@
{user_copy key='traffic.intro'}
{$pool.state_label|escape:'html'}{$pool.network_label|escape:'html'}
+ {if $pool.accounting_status == 'current'}{user_copy key='traffic.freshness.current'}{elseif $pool.accounting_status == 'delayed'}{user_copy key='traffic.freshness.delayed'}{else}{user_copy key='traffic.freshness.attention'}{/if}{if $pool.accounting_status == 'current'}{if $pool.accounting_has_confirmation}{user_copy key='traffic.freshness.current_at' date=$pool.accounting_confirmed_display}{else}{user_copy key='traffic.freshness.current_without_time'}{/if}{elseif $pool.accounting_status == 'delayed'}{if $pool.accounting_has_confirmation}{user_copy key='traffic.freshness.delayed_at' date=$pool.accounting_confirmed_display}{else}{user_copy key='traffic.freshness.delayed_without_time'}{/if}{else}{if $pool.accounting_has_confirmation}{user_copy key='traffic.freshness.attention_at' date=$pool.accounting_confirmed_display}{else}{user_copy key='traffic.freshness.attention_without_time'}{/if}{/if}
- {user_copy key='traffic.fact.entitlement'}
- {$pool.entitlement_display|escape:'html'}
- {user_copy key='traffic.fact.consumed'}
- {$pool.consumed_display|escape:'html'}
- {user_copy key='traffic.fact.available'}
- {$pool.available_display|escape:'html'}
- {user_copy key='traffic.fact.overage'}
- {$pool.overage_display|escape:'html'}
- {user_copy key='traffic.fact.next_expiry'}
- {$pool.next_expiry_display|escape:'html'}{$pool.next_expiry_note|escape:'html'}
- {user_copy key='traffic.fact.last_observed'}
- {$pool.last_observed_display|escape:'html'}
{user_copy key='traffic.instances.title'}
{user_copy key='traffic.instances.count' count=$pool.instances|@count}
diff --git a/web/resources/views/venix/layout_assets.tpl b/web/resources/views/venix/layout_assets.tpl
index d3f81f53..23a75aef 100644
--- a/web/resources/views/venix/layout_assets.tpl
+++ b/web/resources/views/venix/layout_assets.tpl
@@ -1,2 +1,2 @@
{* Shared Venix CSS/JS cache key. Increment whenever a shared browser asset changes. *}
-{assign var=venix_asset_version value='2026111401' scope='global'}
+{assign var=venix_asset_version value='2026111701' scope='global'}
diff --git a/web/tests/CloudAdminAbusePolicyUiContractTest.php b/web/tests/CloudAdminAbusePolicyUiContractTest.php
index 865cdd9a..7501d4a9 100644
--- a/web/tests/CloudAdminAbusePolicyUiContractTest.php
+++ b/web/tests/CloudAdminAbusePolicyUiContractTest.php
@@ -61,7 +61,11 @@ $assert(str_contains($styles, '.admin-abuse-policy-rules')
&& str_contains($styles,
'.admin-abuse-policy-actions { display: grid; grid-template-columns: 1fr; }'),
'Policy rules and actions lack responsive presentation contracts.');
-$assert(str_contains($assets, "venix_asset_version value='2026110902'"),
+$assert(preg_match(
+ "/venix_asset_version value='([0-9]{10,})'/",
+ $assets,
+ $assetVersion
+ ) === 1 && (int) $assetVersion[1] >= 2026110902,
'Static asset version was not advanced for the policy module.');
echo "Administrator abuse-policy UI contracts passed.\n";
diff --git a/web/tests/CloudAssetVersionContractTest.php b/web/tests/CloudAssetVersionContractTest.php
index d18466e6..3077572a 100644
--- a/web/tests/CloudAssetVersionContractTest.php
+++ b/web/tests/CloudAssetVersionContractTest.php
@@ -15,7 +15,10 @@ $assert = static function (bool $condition, string $message): void {
};
$assert(is_string($assets)
- && str_contains($assets, "venix_asset_version value='2026110902'")
+ && preg_match(
+ "/venix_asset_version value='[0-9]{10,}'/",
+ $assets
+ ) === 1
&& is_string($cloudShell)
&& str_contains($cloudShell, '/cloud/app.js?v={$venix_asset_version}'),
'The cloud application entry must use the shared Venix asset version.');
diff --git a/web/tests/CloudTrafficPoolLineBehaviorTest.mjs b/web/tests/CloudTrafficPoolLineBehaviorTest.mjs
index dbb3a57e..b02ebda6 100644
--- a/web/tests/CloudTrafficPoolLineBehaviorTest.mjs
+++ b/web/tests/CloudTrafficPoolLineBehaviorTest.mjs
@@ -56,6 +56,20 @@ const nodes = new Map([
['cloud-traffic-refresh', new Node('button')],
]);
const document = { createElement: tag => new Node(tag) };
+const translate = (key, parameters = {}) => {
+ if (key === 'traffic.count') return `${parameters.count} 个线路流量池`;
+ if (key === 'traffic.coverage.label') return `覆盖:${parameters.regions}`;
+ if (key === 'traffic.coverage.regions') return `${parameters.count} 个地区`;
+ if (key === 'traffic.coverage.instances') return `${parameters.count} 台实例`;
+ if (key === 'traffic.instances.count') return `${parameters.count} 台`;
+ if (key.endsWith('_at')) return `confirmed ${parameters.date}`;
+ return key;
+};
+const i18n = {
+ text: translate,
+ date: value => `date-${value}`,
+ bind() {},
+};
const context = vm.createContext({
document,
window: { addEventListener() {} },
@@ -67,6 +81,8 @@ const context = vm.createContext({
initializeSession: async () => true,
readBootstrap: () => ({}),
showError() {},
+ i18n,
+ t: translate,
});
vm.runInContext(`${source}\nglobalThis.traffic = { applyPayload };`, context, {
filename: 'traffic.js',
@@ -85,6 +101,7 @@ const pool = (id, name = `线路 ${id}`) => ({
next_expiry_at: null,
next_expiry_bytes: 0,
last_observed_at: null,
+ accounting_freshness: { status: 'current', last_confirmed_at: 100 },
instances: [],
key: `line-group:${id}`,
coverage_regions: [{ code: 'hkg', name: '香港' }],
@@ -154,4 +171,25 @@ context.traffic.applyPayload(payload([
assert.deepEqual(details().map(item => item.open), [false, true, true],
'A newly appearing attention line pool did not use its server default.');
+context.traffic.applyPayload(payload([
+ linePool(4, {
+ accounting_freshness: { status: 'delayed', last_confirmed_at: 80 },
+ summary_state: 'delayed', requires_attention: true, default_open: true,
+ instance_count: 1,
+ instances: [{
+ id: 40, name: 'vm-40', region: { name: '香港' },
+ service_expires_at: 200, network_status: 'active',
+ period_traffic_quota_bytes: 2048, traffic_used_bytes: 512,
+ traffic_download_bytes: 384, traffic_upload_bytes: 128,
+ }],
+ }),
+]));
+const delayedContent = details()[0].textContent;
+assert.match(delayedContent, /traffic\.freshness\.delayed/,
+ 'A delayed accounting projection was not made visible.');
+assert.match(delayedContent, /confirmed date-80/,
+ 'The delayed projection hid its last confirmed timestamp.');
+assert.match(delayedContent, /traffic\.instance\.period_quota/,
+ 'Freshness messaging replaced the per-instance raw sample list.');
+
console.log('Cloud traffic-pool line behavior checks passed.');
diff --git a/web/tests/CloudTrafficPoolUserReadModelTest.php b/web/tests/CloudTrafficPoolUserReadModelTest.php
index d85a4aca..b293e8d5 100644
--- a/web/tests/CloudTrafficPoolUserReadModelTest.php
+++ b/web/tests/CloudTrafficPoolUserReadModelTest.php
@@ -453,9 +453,6 @@ $assert($lineA['active_entitlement_bytes'] === 1500
$assert($lineA['accounting_freshness'] === [
'status' => 'delayed',
'last_confirmed_at' => $now - 5,
- 'unsettled_instance_count' => 0,
- 'stale_cursor_count' => 1,
- 'safe_code' => 'sample_stale',
],
'User projection did not expose the bounded actor-safe freshness state.');
$assert(count($lineA['instances']) === 1
diff --git a/web/tests/CloudTrafficPoolUserUiContractTest.php b/web/tests/CloudTrafficPoolUserUiContractTest.php
index 0c74de69..e72acd3d 100644
--- a/web/tests/CloudTrafficPoolUserUiContractTest.php
+++ b/web/tests/CloudTrafficPoolUserUiContractTest.php
@@ -38,6 +38,7 @@ $assert(str_contains($readModel,
&& str_contains($readModel, 'CloudTrafficPoolAccounting::snapshots(')
&& str_contains($readModel, 'CloudTrafficPoolFreshness::snapshots(')
&& str_contains($readModel, "'accounting_freshness' => [")
+ && str_contains($readModel, "'last_confirmed_at' =>")
&& str_contains($freshness, 'public const DELAY_SECONDS = 300;')
&& str_contains($freshness, 'public const ATTENTION_SECONDS = 3600;')
&& str_contains($readModel,
@@ -117,6 +118,11 @@ $assert(str_contains($sidebar, 'href="/user/cloud/traffic"')
&& str_contains($template,
"{user_copy key='traffic.instance.expiry' region=\$instance.region_label date=\$instance.expires_display}")
&& str_contains($template, "{user_copy key='traffic.intro'}")
+ && str_contains($template, 'cloud-traffic-accounting-')
+ && str_contains($template,
+ "{user_copy key='traffic.freshness.delayed_at'")
+ && str_contains($template,
+ "{user_copy key='traffic.freshness.attention_without_time'}")
&& !str_contains($template, 'cloud-traffic-region'),
'The user traffic-pool page lacks SSR first paint, navigation or clear shared-vs-instance copy.');
@@ -143,6 +149,10 @@ $assert(str_contains($script,
&& str_contains($script, 'pool.active_consumed_bytes')
&& str_contains($script, 'pool.available_bytes')
&& str_contains($script, 'pool.projection_ready === true')
+ && str_contains($script, 'function accountingFreshness(pool)')
+ && str_contains($script, 'function renderAccountingFreshness(pool)')
+ && str_contains($script,
+ 'renderAccountingFreshness(pool), facts, instances')
&& str_contains($script,
'const hasBootstrap = Array.isArray(bootstrap?.line_pools);')
&& str_contains($script, 'if (hasBootstrap) applyPayload(bootstrap);')
@@ -184,6 +194,8 @@ $assert(str_contains($view, 'function trafficPools(')
&& str_contains($styles,
'.cloud-traffic-line-summary:active{background:#f4fafa;box-shadow:none}')
&& str_contains($styles, '.cloud-traffic-line-intro')
+ && str_contains($styles, '.cloud-traffic-accounting-delayed')
+ && str_contains($styles, '.cloud-traffic-accounting-attention')
&& !str_contains($styles, '.cloud-traffic-region')
&& str_contains($styles, '.cloud-traffic-instance')
&& str_contains($template, 'class="cloud-traffic-instance-header"')
diff --git a/web/tests/CloudUserFirstPaintViewTest.php b/web/tests/CloudUserFirstPaintViewTest.php
index 2ea85aa8..5f09f37d 100644
--- a/web/tests/CloudUserFirstPaintViewTest.php
+++ b/web/tests/CloudUserFirstPaintViewTest.php
@@ -87,6 +87,40 @@ $assert(str_contains($one($xpath, 'cloud-snapshots-list')->textContent, 'snapsho
$assert($xpath->query('//button[@title="存在待支付账单,请先支付或等待账单失效后再删除。" and @disabled]')->length === 1,
'Snapshot first paint lost pending-invoice deletion protection.');
+$traffic = ['line_pools' => [[
+ 'key' => 'line-group:3', 'group_id' => 3, 'name' => '国际线路',
+ 'summary_state' => 'delayed', 'projection_ready' => true,
+ 'state' => 'available', 'network_restriction_state' => 'clear',
+ 'active_entitlement_bytes' => 4096, 'active_consumed_bytes' => 1024,
+ 'available_bytes' => 3072, 'overage_bytes' => 0,
+ 'next_expiry_at' => null, 'next_expiry_bytes' => 0,
+ 'last_observed_at' => 1793404900,
+ 'accounting_freshness' => [
+ 'status' => 'delayed', 'last_confirmed_at' => 1793404800,
+ ],
+ 'coverage_regions' => [['code' => 'hkg', 'name' => '香港']],
+ 'coverage_region_count' => 1, 'instance_count' => 1,
+ 'requires_attention' => true, 'default_open' => true,
+ 'instances' => [[
+ 'id' => '7', 'name' => 'vm-traffic',
+ 'traffic_used_bytes' => 512, 'period_traffic_quota_bytes' => 2048,
+ 'traffic_download_bytes' => 384, 'traffic_upload_bytes' => 128,
+ 'service_expires_at' => 1793405800, 'network_status' => 'active',
+ 'region' => ['code' => 'hkg', 'name' => '香港'],
+ ]],
+]], 'line_pool_count' => 1];
+$xpath = $render('traffic', [
+ 'cloud_traffic_view' => CloudUserPageView::trafficPools($traffic),
+]);
+$trafficText = $one($xpath, 'cloud-traffic-list')->textContent;
+$assert($xpath->query('//*[contains(concat(" ", normalize-space(@class), " "), " cloud-traffic-accounting-delayed ")]')->length === 1
+ && str_contains($trafficText, '账务结算延迟')
+ && str_contains($trafficText, '最后确认可用余额')
+ && str_contains($trafficText, '以下共享额度为')
+ && str_contains($trafficText, 'vm-traffic')
+ && str_contains($trafficText, '512 B'),
+ 'Traffic-pool first paint hid delayed accounting, confirmed balances or raw instance samples.');
+
$vpc = ['vpc_key' => $key, 'name' => 'vpc-before-js', 'region_id' => 1,
'region_name' => '香港', 'cidr' => '10.0.1.0/24', 'gateway' => '10.0.1.1', 'state' => 'active', 'port_count' => 1];
$member = ['id' => '7', 'name' => 'vm-member', 'region_id' => 1, 'public_ipv4' => '192.0.2.7',
diff --git a/web/tests/UserCopyManifestContractTest.php b/web/tests/UserCopyManifestContractTest.php
index 6f77ed92..55fabe40 100644
--- a/web/tests/UserCopyManifestContractTest.php
+++ b/web/tests/UserCopyManifestContractTest.php
@@ -46,8 +46,8 @@ $assert($surfaceCounts === [
'accessibility' => 102,
'admin' => 110,
'dialog' => 56,
- 'feedback' => 614,
- 'page' => 1471,
+ 'feedback' => 618,
+ 'page' => 1477,
'shared' => 38,
'task' => 53,
],