docs/solutions/logic-errors/reject-degraded-china-macro-seed-publication.md
The China macro adapter can intentionally return a degraded snapshot when a required price, activity, policy, or FX indicator is stale or unavailable. The original seed validator checked only that the payload contained at least four indicator slots, so a structurally complete but non-launch-ready snapshot could reach the publish path.
launchReady: false and status: "degraded" still satisfied the count-based validator.economic:china:macro:v1.indicators.length >= 4 verified payload shape, not data readiness. Unavailable or stale indicators remain present as slots, so their count does not prove that all required categories are usable.Keep the adapter's readiness decision as the source of truth and repeat it at the irreversible seed publication boundary:
export function validateChinaMacroSnapshot(snapshot) {
return snapshot?.launchReady === true
&& snapshot?.status === 'ready'
&& Array.isArray(snapshot?.indicators)
&& snapshot.indicators.length >= 4;
}
Pass that validator to runSeed in scripts/seed-china-macro.mjs. Add a regression assertion in tests/china-macro-seed.test.mjs that marks a required activity indicator stale, rebuilds the snapshot, and verifies both launchReady === false and validator rejection.
buildChinaMacroSnapshot derives launchReady from the required price, activity, policy, and FX categories and assigns status: "ready" only when all four are usable. runSeed passes the fetched payload to atomicPublish, which invokes validateFn before writing the canonical Redis key. When validation fails, the publish is skipped and the existing cache TTL is extended, preserving the last-good snapshot.