fix(step097): complete A2 clock and GPU field correctness
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled

This commit is contained in:
tei
2026-09-26 15:17:43 +09:00
parent 5bb1a0e635
commit f49ffa68a1
26 changed files with 610 additions and 86 deletions

View File

@@ -0,0 +1 @@
{"contractSchemaVersion":1,"profileID":"wind","profileVersion":1,"allowAdditionalPlanes":true,"sharedValidityRequired":true,"timeRelation":"VALID_GTE_REFERENCE","requiredPlanes":[{"semanticID":1,"valueClass":"VELOCITY_COMPONENT","unitID":1,"groupID":1,"component":"U_EAST","requiredFlag":true},{"semanticID":2,"valueClass":"VELOCITY_COMPONENT","unitID":1,"groupID":1,"component":"V_NORTH","requiredFlag":true},{"semanticID":3,"valueClass":"VALIDITY","unitID":0,"groupID":0,"component":"NONE","requiredFlag":true}]}

View File

@@ -46,6 +46,7 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
private var timeWindowMode = false
private var productionFeedMode = false
private var hostSubmissionMode = false
private var step097V4GoldenReady = false // Test-App-only state; never a Core window mirror.
private var realWeatherMode = false
private var pureParticleMode = false
private var purePbfMode = false
@@ -998,7 +999,7 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
private fun showTimeMenu(anchor: android.view.View) {
PopupMenu(this, anchor).apply {
val labels = arrayOf("SCENARIO NORMAL", "PLAY / RESTART", "PAUSE", "SPEED 0.5x", "SPEED 1x", "SPEED 2x", "STEP PREV", "STEP NEXT", "SEEK START", "SEEK MID", "SEEK END", "SCENARIO GAP", "SCENARIO INVALID NEXT", "RECOVER NEXT")
val labels = arrayOf("SCENARIO NORMAL", "PLAY / RESTART", "PAUSE", "SPEED 0.5x", "SPEED 1x", "SPEED 2x", "STEP PREV", "STEP NEXT", "SEEK START", "SEEK MID", "SEEK END", "SCENARIO GAP", "SCENARIO INVALID NEXT", "RECOVER NEXT", "A2 V4 WIND TEST")
labels.forEachIndexed { index, label -> menu.add(0, index, index, label) }
setOnMenuItemClickListener { item ->
when (item.itemId) {
@@ -1016,12 +1017,69 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
11 -> controlTimeline(6, 0.0f)
12 -> controlTimeline(7, 0.0f)
13 -> controlTimeline(8, 0.0f)
14 -> showStep097V4Menu(anchor)
}; true
}
show()
}
}
private fun showStep097V4Menu(anchor: android.view.View) {
PopupMenu(this, anchor).apply {
val labels = arrayOf("LOAD WIND T0/T1", "PLAY", "PAUSE", "SEEK 25%", "SEEK 75%", "SPEED 2x", "SPEED 1x", "CLEAR")
labels.forEachIndexed { index, label -> menu.add(0, index, index, label) }
setOnMenuItemClickListener { item ->
if (item.itemId == 0) loadStep097V4Golden() else controlStep097V4Golden(item.itemId)
true
}
show()
}
}
private fun loadStep097V4Golden() {
if (!styleReady || !enabled || !hostSubmissionMode || realWeatherMode) {
Log.i(TAG, "STEP097_A2_V4_REJECT reason=SELECT_HOST_FIELD_FIRST styleReady=$styleReady")
return
}
step097V4GoldenReady = false
try {
val runtime = weatherRuntime ?: WeatherRuntime(maplibreMap,
WeatherRuntime.Config(PARTICLE_SOURCE_ID, WEATHER_COLOR_LAYER_ID, PARTICLE_LAYER_ID))
.also { weatherRuntime = it }
Step097V4GoldenFixture.load(assets, runtime)
// The RN Golden QBIN covers Japan; default world center (0,0)
// would leave the valid field outside this device's viewport.
maplibreMap.cameraPosition = CameraPosition.Builder()
.target(LatLng(36.2, 137.5)).zoom(4.8).build()
step097V4GoldenReady = true
timelineState = "V4 READY"
status.text = statusText()
} catch (error: Exception) {
step097V4GoldenReady = false
timelineState = "V4 ERROR"
status.text = statusText()
Log.e(TAG, "STEP097_A2_V4_ERROR reason=GOLDEN_LOAD", error)
}
}
private fun controlStep097V4Golden(action: Int) {
if (!styleReady || !step097V4GoldenReady) {
Log.i(TAG, "STEP097_A2_V4_REJECT reason=LOAD_GOLDEN_FIRST action=$action")
return
}
val runtime = weatherRuntime ?: return
val result = Step097V4GoldenFixture.command(runtime, action)
if (action == 7 && result == WeatherRuntime.CommandResult.ACCEPTED) step097V4GoldenReady = false
if (result == WeatherRuntime.CommandResult.ACCEPTED) {
timelineState = when (action) {
1 -> "V4 PLAY"; 2 -> "V4 PAUSE"; 3 -> "V4 25%"; 4 -> "V4 75%"
5 -> "V4 2x"; 6 -> "V4 1x"; 7 -> "V4 CLEARED"; else -> timelineState
}
status.text = statusText()
}
Log.i(TAG, "STEP097_A2_V4_COMMAND action=$action result=$result targetLabel=$timelineState")
}
private fun controlTimeline(command: Int, value: Float) {
if (!styleReady || !enabled || !timeWindowMode) { Log.i(TAG, "ParticleTimeline: event=REJECTED reason=STYLE_NOT_READY"); return }
val runtime = weatherRuntime
@@ -1087,6 +1145,7 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
}
private fun loadValidationStyle(active: Boolean, enabled: Boolean, reason: String = "STYLE_CHANGE") {
step097V4GoldenReady = false
if (pureParticleMode) {
loadPureParticleStyle(active, enabled, reason)
return
@@ -1657,6 +1716,7 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
purePbfMode -> "PURE PBF"
navSeaPbfMode -> "NAVSEA PBF"
realWeatherMode -> "REAL WEATHER"
step097V4GoldenReady -> "V4 GOLDEN"
hostSubmissionMode -> "HOST"
productionFeedMode -> "PRODUCTION"
else -> "FIXTURE"

View File

@@ -0,0 +1,46 @@
package org.maplibre.android.testapp.activity.particle
import android.content.res.AssetManager
import android.util.Log
import org.maplibre.android.maps.WeatherRuntime
/** STEP-097 A2 test-only ingress. Uses the existing public Android V4 API. */
internal object Step097V4GoldenFixture {
const val KEY = "fixture.wind"
const val T0_MS = 1_789_239_600_000L
const val T1_MS = 1_789_243_200_000L
const val MID_MS = 1_789_241_400_000L
private const val ROOT = "integration/step097-v4/wind/"
private const val TAG = "ParticleValidation"
fun load(assets: AssetManager, runtime: WeatherRuntime) {
val contract = assets.open(ROOT + "contract.json").bufferedReader().use { it.readText() }
val clear = runtime.clearAllEncodedFields()
val color = runtime.setEncodedColorBinding(KEY, 1, 1, 1, 1)
val particle = runtime.setEncodedParticleBinding(KEY, 0, 1, 1, 2, 1, 0, 0, 1)
val t0 = runtime.submitEncodedField(KEY, "fixture-wind", 1L, 1L,
contract, assets.open(ROOT + "T0.qbin").use { it.readBytes() })
val t1 = runtime.submitEncodedField(KEY, "fixture-wind", 2L, 2L,
contract, assets.open(ROOT + "T1.qbin").use { it.readBytes() })
val time = runtime.setEncodedForecastTime(MID_MS)
Log.i(TAG, "STEP097_A2_V4_SUBMIT clear=$clear color=$color particle=$particle t0=$t0 t1=$t1 time=$time")
check(clear == WeatherRuntime.CommandResult.ACCEPTED &&
color == WeatherRuntime.CommandResult.ACCEPTED &&
particle == WeatherRuntime.CommandResult.ACCEPTED &&
t0 == WeatherRuntime.EncodedFieldSubmitResult.ACCEPTED_INSERTED &&
t1 == WeatherRuntime.EncodedFieldSubmitResult.ACCEPTED_INSERTED &&
time == WeatherRuntime.CommandResult.ACCEPTED) { "V4 golden ingress rejected" }
Log.i(TAG, "STEP097_A2_V4_READY fieldKey=$KEY T0=$T0_MS T1=$T1_MS target=$MID_MS")
}
fun command(runtime: WeatherRuntime, action: Int): WeatherRuntime.CommandResult = when (action) {
1 -> runtime.setEncodedForecastPlaybackState(true)
2 -> runtime.setEncodedForecastPlaybackState(false)
3 -> runtime.setEncodedForecastTime(T0_MS + 900_000L)
4 -> runtime.setEncodedForecastTime(T0_MS + 2_700_000L)
5 -> runtime.setEncodedForecastPlaybackSpeed(2.0f)
6 -> runtime.setEncodedForecastPlaybackSpeed(1.0f)
7 -> runtime.clearAllEncodedFields()
else -> WeatherRuntime.CommandResult.REJECTED
}
}