Compare commits

...
Author SHA1 Message Date
dasemu 4d0df9c0a2 Merge pull request #11 from Dasemu/hotfix/tft-render-diagnostics
Improve TFT map failure diagnostics and preserve incident onset
2026-10-13 16:00:33 +02:00
dasemu 21dc71a450 Merge pull request #10 from Dasemu/hotfix/imported-route-rejoin
hotfix: resume GPX guidance when rejoining after a detour
2026-10-13 15:28:09 +02:00
Darío Sevilla 93a20d35d7 fix: retain actionable TFT SDK diagnostics and prolonged failure onset 2026-10-13 13:19:27 +00:00
Darío Sevilla 21023d229c test: prevent false arrival when rejoining a closed GPX trace 2026-10-13 13:18:46 +00:00
Darío Sevilla bdd5b4f1ab fix: resume imported GPX guidance after a confirmed detour 2026-10-13 13:14:19 +00:00
dasemu b109ea8633 Merge pull request #7 from Dasemu/hotfix/branch-version-policy
Enforce hotfix, fix and feature PR version policy
2026-10-13 11:59:36 +02:00
Darío Sevilla d0ea978209 docs: preserve repository branching rules for contributors 2026-10-13 09:55:30 +00:00
Darío Sevilla 018cd3834e ci: enforce feature fix and hotfix branch version policy 2026-10-13 09:54:56 +00:00
17 changed files with 408 additions and 25 deletions

No files matched your search

+56
View File
@@ -0,0 +1,56 @@
name: PR branch and version policy
on:
pull_request_target:
types: [opened, synchronize, reopened, edited, labeled, unlabeled]
branches: [main, development]
permissions:
contents: read
issues: read
jobs:
policy:
name: Branch and version policy
runs-on: ubuntu-latest
steps:
# Run only the trusted base policy. Never execute code from the PR head.
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}
persist-credentials: false
- name: Test the trusted policy
run: python3 -m unittest discover -s scripts/tests -v
- name: Check explicit owner approval for a major bump
id: approval
uses: actions/github-script@v7
with:
script: |
const label = 'major-version-approved';
const pr = context.payload.pull_request;
let approved = false;
if (pr.labels.some(item => item.name === label)) {
const events = await github.paginate(github.rest.issues.listEvents, {
...context.repo, issue_number: pr.number, per_page: 100
});
const latest = events.filter(event =>
['labeled', 'unlabeled'].includes(event.event) && event.label?.name === label
).at(-1);
approved = latest?.event === 'labeled' &&
latest.actor?.login === context.repo.owner;
}
core.setOutput('approved', String(approved));
- name: Fetch PR snapshots and validate versions
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
HEAD_BRANCH: ${{ github.event.pull_request.head.ref }}
PR_NUMBER: ${{ github.event.pull_request.number }}
MAJOR_APPROVED: ${{ steps.approval.outputs.approved }}
run: |
set -euo pipefail
# Public read-only fetch; checkout credentials are not persisted.
git fetch --no-tags origin "$BASE_SHA" "refs/pull/$PR_NUMBER/head"
args=()
if [[ "$MAJOR_APPROVED" == true ]]; then args+=(--major-approved); fi
python3 scripts/check_version_policy.py \
--base-ref "$BASE_SHA" --head-ref "$HEAD_SHA" \
--base-branch "$BASE_BRANCH" --head-branch "$HEAD_BRANCH" "${args[@]}"
+11
View File
@@ -0,0 +1,11 @@
# Repository contribution policy
- Branch new features as `feat/*` and open their PRs against `development`.
- Branch ordinary fixes as `fix/*` and open their PRs against `development`.
- Branch urgent production fixes as `hotfix/*` and open their PRs against `main`.
- Each `feat/*` or `fix/*` PR into `development`, and each `hotfix/*` PR into `main`, increments only the third versionName component: `x.y.(z+1)` relative to its destination.
- A promotion PR from `development` into `main` increments only the second component: `x.(y+1).z`. Do not reset the third component.
- Change the first component only when the repository owner explicitly requests it. Follow the owner-applied approval label procedure in `docs/ANDROID_RELEASES.md`.
- Increase the committed Android versionCode with every PR. Keep versionName changes in the PR for review, alongside the corresponding README version.
- Read `docs/ANDROID_RELEASES.md` for the workflow and run the version policy tests when changing it.
- Do not merge PRs on the owner's behalf unless explicitly asked; the owner reviews and merges them.
+1 -1
View File
@@ -6,7 +6,7 @@ NavFrame is an experimental Android navigation app that renders its own 480×240
The owner has confirmed static and synthetic NavFrame frames on a Xiaomi 11 Lite 5G NE running Android 14 and a 2026 Yamaha MT-07, and the bundled Asturias map working offline on the phone. On 2026-10-12, the owner reported that the latest version displayed the map on the TFT for about 20 minutes, then showed `Mapa no disponible` in La Corredoria (Oviedo) for the rest of the trip while the phone map continued working. An offline map was installed. The exact installed build, diagnostic code and background state were not recorded; the cause is under investigation. This establishes a successful map display followed by a persistent failure, not sustained TFT reliability.
The current checkout is version 0.13.4. The 0.13 series adds voice/routing language selection for Spanish, English, German, French, and Italian, plus a system-language option; unsupported system locales resolve to English. Speech still depends on the Android TextToSpeech engine and its installed voice data. The app includes offline map and place data for Asturias, plus installable regional packages. Worldwide regions can be discovered and built on demand through the [regional package workflow](docs/GLOBAL_OFFLINE.md); this is not complete worldwide coverage. Installed packages currently provide map and local place/camera data. Offline route calculation, global camera completeness, and complete worldwide font coverage are not provided.
The current checkout is version 0.13.6. The 0.13 series adds voice/routing language selection for Spanish, English, German, French, and Italian, plus a system-language option; unsupported system locales resolve to English. Speech still depends on the Android TextToSpeech engine and its installed voice data. The app includes offline map and place data for Asturias, plus installable regional packages. Worldwide regions can be discovered and built on demand through the [regional package workflow](docs/GLOBAL_OFFLINE.md); this is not complete worldwide coverage. Installed packages currently provide map and local place/camera data. Offline route calculation, global camera completeness, and complete worldwide font coverage are not provided.
Route calculation and address search use configurable online services. Spoken output uses the selected language when Android provides voice data; voice availability and offline behavior depend on the device's TextToSpeech engine. Physical validation of route guidance, voice playback, camera alerts, sustained TFT map rendering, and a 30-minute screen-off session remains pending unless a newer test report says otherwise.
+2 -2
View File
@@ -15,8 +15,8 @@ android {
applicationId = "dev.navframe.app"
minSdk = 26
targetSdk = 35
versionName = "0.13.4"
versionCode = 20
versionName = "0.13.6"
versionCode = 22
}
if (hasReleaseSigning) {
signingConfigs.create("production") {
@@ -33,17 +33,30 @@ internal data class MapDiagnosticEvent(
val connection: ConnectionState,
val androidApi: Int,
val appVersion: String = BuildConfig.VERSION_NAME,
val errorClass: String = "SDK_CALLBACK",
val sdkEvidence: String = "",
val firstTimestampMs: Long = timestampMs,
val occurrences: Int = 1,
val screenInteractive: Boolean? = null,
val lowMemory: Boolean? = null,
val availableMemoryMb: Long? = null,
) {
init {
require(timestampMs >= 0 && durationMs >= 0 && retryMs >= 0 && attempts in 1..4)
require(androidApi > 0 && appVersion.matches(Regex("[0-9]+(?:\\.[0-9]+){1,3}")))
require(availableMemoryMb == null || availableMemoryMb >= 0)
require(firstTimestampMs in 0..timestampMs && occurrences > 0)
require(errorClass.matches(Regex("[A-Za-z0-9_$]{1,80}")))
require(sdkEvidence.isEmpty() || sdkEvidence.matches(Regex("[A-Z_]{1,256}")))
require(httpStatus == null || httpStatus in 400..599)
require((kind == MapDiagnosticKind.FAILURE) == (failure != null))
}
fun reportLine(): String = "${Instant.ofEpochMilli(timestampMs)} · ${kind.name} · NavFrame $appVersion · Android $androidApi · MapLibre 13.5.2\n" +
"${source.name} · red ${network.name} · ${failure?.name ?: "OK"}/${stage.name} · ${resource.name}/${reason.name}${httpStatus?.let { "/HTTP_$it" } ?: ""}\n" +
"$durationMs ms · intento $attempts · reintento $retryMs ms · ${mode.name} · ${navigation.name} · TFT ${connection.name}"
"${source.name} · red ${network.name} · ${failure?.name ?: "OK"}/${stage.name} · ${resource.name}/${reason.name}${httpStatus?.let { "/HTTP_$it" } ?: ""}/$errorClass${if (sdkEvidence.isEmpty()) "" else "/WORDS_$sdkEvidence"}\n" +
"$durationMs ms · intento $attempts · reintento $retryMs ms · ${mode.name} · ${navigation.name} · TFT ${connection.name}" +
"\nPantalla ${screenInteractive?.let { if (it) "ENCENDIDA" else "APAGADA" } ?: "UNKNOWN"} · memoria baja ${lowMemory ?: "UNKNOWN"} · disponible ${availableMemoryMb ?: "UNKNOWN"} MiB" +
if (occurrences == 1) "" else "\nAgrupado: $occurrences fallos · primero ${Instant.ofEpochMilli(firstTimestampMs)} · último ${Instant.ofEpochMilli(timestampMs)} · estados del último fallo"
fun toJson(): JSONObject = JSONObject().put("kind", kind.name).put("timestampMs", timestampMs)
.put("source", source.name).put("network", network.name).put("stage", stage.name)
@@ -51,6 +64,10 @@ internal data class MapDiagnosticEvent(
.put("httpStatus", httpStatus ?: JSONObject.NULL).put("durationMs", durationMs).put("attempts", attempts)
.put("retryMs", retryMs).put("mode", mode.name).put("navigation", navigation.name)
.put("connection", connection.name).put("androidApi", androidApi).put("appVersion", appVersion)
.put("errorClass", errorClass).put("sdkEvidence", sdkEvidence)
.put("firstTimestampMs", firstTimestampMs).put("occurrences", occurrences)
.put("screenInteractive", screenInteractive ?: JSONObject.NULL).put("lowMemory", lowMemory ?: JSONObject.NULL)
.put("availableMemoryMb", availableMemoryMb ?: JSONObject.NULL)
companion object {
fun fromJson(value: JSONObject) = MapDiagnosticEvent(
@@ -64,6 +81,12 @@ internal data class MapDiagnosticEvent(
mode = NavigationMode.valueOf(value.getString("mode")), navigation = NavigationStatus.valueOf(value.getString("navigation")),
connection = ConnectionState.valueOf(value.getString("connection")), androidApi = value.getInt("androidApi"),
appVersion = value.getString("appVersion"),
errorClass = value.optString("errorClass", "SDK_CALLBACK"), sdkEvidence = value.optString("sdkEvidence", ""),
firstTimestampMs = value.optLong("firstTimestampMs", value.getLong("timestampMs")),
occurrences = value.optInt("occurrences", 1),
screenInteractive = if (value.isNull("screenInteractive")) null else value.getBoolean("screenInteractive"),
lowMemory = if (value.isNull("lowMemory")) null else value.getBoolean("lowMemory"),
availableMemoryMb = if (value.isNull("availableMemoryMb")) null else value.getLong("availableMemoryMb"),
)
}
}
@@ -78,7 +101,17 @@ internal class MapDiagnosticHistory(private val directory: File) {
try {
// An unreadable history cannot supply diagnostic text; the next event starts a clean history.
val previous = try { readEvents() } catch (_: Exception) { emptyList() }
val events = (previous + event).takeLast(MAX_EVENTS)
val last = previous.lastOrNull()
// Keep the initial retries, then summarize identical saturated retries without losing onset.
val repeated = last != null && event.kind == MapDiagnosticKind.FAILURE && last.kind == event.kind &&
last.attempts == 4 && event.attempts == 4 && event.timestampMs >= last.timestampMs &&
last.source == event.source && last.failure == event.failure && last.stage == event.stage &&
last.resource == event.resource && last.reason == event.reason && last.httpStatus == event.httpStatus &&
last.errorClass == event.errorClass && last.sdkEvidence == event.sdkEvidence &&
last.mode == event.mode && last.appVersion == event.appVersion && last.androidApi == event.androidApi
val events = if (repeated) previous.dropLast(1) + event.copy(
firstTimestampMs = last!!.firstTimestampMs, occurrences = (last.occurrences.toLong() + 1).coerceAtMost(Int.MAX_VALUE.toLong()).toInt()
) else (previous + event).takeLast(MAX_EVENTS)
val bytes = JSONArray(events.map { it.toJson() }).toString().toByteArray(Charsets.UTF_8)
check(bytes.size <= MAX_BYTES)
val output = atomic.startWrite()
@@ -94,7 +94,9 @@ class MapLibreTftRenderer(context: Context, private val source: MapDataSource, p
})
}
}
phase(MapRenderStage.CAMERA_UPDATE)
current.setCameraPosition(cameraPosition)
phase(MapRenderStage.ROUTE_UPDATE)
(current.getSource("navframe-route") as? GeoJsonSource)?.setGeoJson(routeGeoJson(state.route))
continuation.invokeOnCancellation {
// An old callback must not be delivered into a new capture: discard after cancellation/error.
@@ -103,6 +105,7 @@ class MapLibreTftRenderer(context: Context, private val source: MapDataSource, p
}
try {
phase(if (current.getSource("navframe-route") == null) MapRenderStage.STYLE_LOADING else MapRenderStage.STYLE_READY)
phase(MapRenderStage.SNAPSHOT_REQUESTED)
current.start({ snapshot ->
if (continuation.isActive && !closed && snapshotter === current) phase(MapRenderStage.SNAPSHOT_READY)
val bitmap = snapshot.bitmap
@@ -120,7 +123,7 @@ class MapLibreTftRenderer(context: Context, private val source: MapDataSource, p
main.post {
current.cancel()
if (snapshotter === current) snapshotter = null
if (continuation.isActive) continuation.resumeWithException(MapRenderException(classifyMapRenderFailure(reason), stage, mapErrorDetail(reason)))
if (continuation.isActive) continuation.resumeWithException(MapRenderException(classifyMapRenderFailure(reason), stage, mapErrorDetail(reason, "SnapshotterErrorCallback")))
}
})
} catch (error: Exception) {
@@ -1,24 +1,26 @@
package dev.navframe.app
/** Only fixed labels cross this boundary; SDK messages can contain coordinates, URLs and access tokens. */
enum class MapRenderStage { INITIALIZE, STYLE_LOADING, STYLE_READY, SNAPSHOT_READY, COMPOSE }
enum class MapRenderStage { INITIALIZE, STYLE_LOADING, STYLE_READY, CAMERA_UPDATE, ROUTE_UPDATE, SNAPSHOT_REQUESTED, SNAPSHOT_READY, COMPOSE }
enum class MapRenderFailure { TIMEOUT, NETWORK, STYLE, GPU, BITMAP, SDK }
enum class MapResourceKind { GLYPH, SPRITE, TILE, GEOJSON, STYLE, BITMAP, UNKNOWN }
enum class MapFailureReason { DNS, FORBIDDEN, NOT_FOUND, CONTEXT_LOST, EGL, MEMORY, PARSE, CONNECTION, UNKNOWN }
data class MapErrorDetail(val resource: MapResourceKind = MapResourceKind.UNKNOWN, val reason: MapFailureReason = MapFailureReason.UNKNOWN, val httpStatus: Int? = null, val errorClass: String = "SDK_CALLBACK") {
fun safeText(): String = "${resource.name}/${reason.name}${httpStatus?.let { "/HTTP_$it" } ?: ""}/${errorClass.takeIf { it.matches(Regex("[A-Za-z0-9_$]{1,80}")) } ?: "OTHER"}"
enum class MapResourceKind { GLYPH, SPRITE, TILE, GEOJSON, STYLE, BITMAP, PMTILES, FILE, UNKNOWN }
enum class MapFailureReason { DNS, FORBIDDEN, NOT_FOUND, CONTEXT_LOST, EGL, MEMORY, PARSE, CONNECTION, IO, CANCELLED, EMPTY, UNSUPPORTED, UNKNOWN }
data class MapErrorDetail(val resource: MapResourceKind = MapResourceKind.UNKNOWN, val reason: MapFailureReason = MapFailureReason.UNKNOWN, val httpStatus: Int? = null, val errorClass: String = "SDK_CALLBACK", val sdkEvidence: String = "") {
fun safeText(): String = "${resource.name}/${reason.name}${httpStatus?.let { "/HTTP_$it" } ?: ""}/${errorClass.takeIf { it.matches(Regex("[A-Za-z0-9_$]{1,80}")) } ?: "OTHER"}${if (sdkEvidence.isEmpty()) "" else "/WORDS_${sdkEvidence}"}"
}
class MapRenderException(val failure: MapRenderFailure, val stage: MapRenderStage, val detail: MapErrorDetail = MapErrorDetail()) : Exception("${failure.name}:${stage.name}:${detail.safeText()}")
internal fun mapErrorDetail(message: String?, errorClass: String = "SDK_CALLBACK"): MapErrorDetail {
val text = message.orEmpty().lowercase(java.util.Locale.ROOT)
val status = Regex("\\b(?:http(?: status| error)?|status(?: code)?|server returned)\\D{0,12}([45]\\d{2})\\b").find(text)?.groupValues?.get(1)?.toIntOrNull()
val text = safeSdkEvidence(message).lowercase(java.util.Locale.ROOT).replace('_', ' ')
val status = Regex("\\b(?:http(?: status| error)?|status(?: code)?|server returned)\\D{0,12}([45]\\d{2})\\b").find(message.orEmpty().lowercase(java.util.Locale.ROOT))?.groupValues?.get(1)?.toIntOrNull()
val resource = when {
text.contains("pmtiles") -> MapResourceKind.PMTILES
listOf("glyph", "font").any(text::contains) -> MapResourceKind.GLYPH
text.contains("sprite") -> MapResourceKind.SPRITE
text.contains("geojson") -> MapResourceKind.GEOJSON
text.contains("tile") || text.contains(".pbf") -> MapResourceKind.TILE
text.contains("style") || text.contains("json") -> MapResourceKind.STYLE
text.contains("bitmap") || text.contains("canvas") -> MapResourceKind.BITMAP
text.contains("file") || text.contains("archive") -> MapResourceKind.FILE
else -> MapResourceKind.UNKNOWN
}
val reason = when {
@@ -30,12 +32,16 @@ internal fun mapErrorDetail(message: String?, errorClass: String = "SDK_CALLBACK
text.contains("memory") -> MapFailureReason.MEMORY
text.contains("parse") -> MapFailureReason.PARSE
text.contains("connection") || text.contains("socket") -> MapFailureReason.CONNECTION
text.contains("cancel") -> MapFailureReason.CANCELLED
text.contains("unsupported") || text.contains("not supported") -> MapFailureReason.UNSUPPORTED
text.contains("no such file") || text.contains("permission denied") || text.contains("read error") || text.contains("failed read") || text.contains("failed to read") || text.contains("failed open") || text.contains("failed to open") || text.contains("cannot read") || text.contains("cannot open") || text.contains("i/o") -> MapFailureReason.IO
message.isNullOrBlank() -> MapFailureReason.EMPTY
else -> MapFailureReason.UNKNOWN
}
return MapErrorDetail(resource, reason, status, errorClass)
return MapErrorDetail(resource, reason, status, errorClass, safeSdkEvidence(message))
}
internal fun classifyMapRenderFailure(message: String?): MapRenderFailure {
val text = message.orEmpty().lowercase(java.util.Locale.ROOT)
val text = safeSdkEvidence(message).lowercase(java.util.Locale.ROOT).replace('_', ' ')
return when {
listOf("egl", "opengl", "framebuffer", "shader", "gl context", "gl_context", "graphics context", "gpu").any(text::contains) -> MapRenderFailure.GPU
mapErrorDetail(message).httpStatus != null || listOf("resolve", "dns", "network", "connection", "socket", "server returned", "request failed", "failed to load resource", "failed to load tile", "failed to load glyph", "download").any(text::contains) -> MapRenderFailure.NETWORK
@@ -44,3 +50,16 @@ internal fun classifyMapRenderFailure(message: String?): MapRenderFailure {
else -> MapRenderFailure.SDK
}
}
/** Preserve only known diagnostic vocabulary, never arbitrary SDK text or identifiers. */
internal fun safeSdkEvidence(message: String?): String {
if (message.isNullOrBlank()) return "EMPTY"
val allowed = setOf("failed", "failure", "error", "exception", "load", "loading", "loaded", "style", "map", "snapshot", "snapshotter", "render", "rendering", "fully", "tile", "tiles", "data", "no", "not", "missing", "empty", "invalid", "corrupt", "unsupported", "resource", "request", "cancelled", "canceled", "cancel", "timeout", "timed", "out", "file", "archive", "pmtiles", "read", "write", "open", "permission", "denied", "such", "directory", "end", "unexpected", "parse", "parsing", "json", "geojson", "glyph", "glyphs", "font", "sprite", "image", "bitmap", "memory", "allocation", "context", "lost", "egl", "opengl", "framebuffer", "shader", "gpu", "network", "connection", "socket", "resolve", "dns", "http", "status", "code", "server", "returned", "forbidden", "found", "active", "already", "started", "finished", "destroyed", "source", "sources", "size", "dimensions", "download", "unable", "cannot", "could", "compression", "compressed", "gzip", "zstd", "protobuf", "decode", "decoding", "truncated", "eof", "i", "o", "to", "of", "is", "been", "has", "was", "be", "gl", "graphics", "canvas", "layer", "supported")
// Strip entire URLs, paths and quoted payloads before vocabulary extraction.
val stripped = message.lowercase(java.util.Locale.ROOT)
.replace(Regex("""[a-z][a-z0-9+.-]*://\S+"""), " ")
.replace(Regex("""[/\\]\S+"""), " ")
.replace(Regex("""["'][^"']*["']"""), " ")
val words = Regex("[a-z]+").findAll(stripped).map { it.value }.filter { it in allowed }.take(24).toList()
return if (words.isEmpty()) "UNCLASSIFIED" else words.joinToString("_").uppercase(java.util.Locale.ROOT).take(240).trimEnd('_')
}
@@ -825,13 +825,16 @@ class TftService : Service() {
mutableMapDiagnostic.value = "TFT MAP · ${error.failure.name} · ${error.stage.name} · ${SystemClock.elapsedRealtime() - mapRenderStarted} ms · ${error.detail.safeText()} · intento $mapFailures · reintento ${retryMs / 1000} s"
lastMapFailureDiagnostic = mutableMapDiagnostic.value + " · " + if (mapSource().uri.startsWith("file:")) "LOCAL" else "ONLINE"
mutableNavigationInfo.value = "MAPA TFT NO DISPONIBLE · ${error.failure.name} · reintento ${retryMs / 1000} s"
android.util.Log.w("NavFrame", "MAP_UNAVAILABLE code=${error.failure.name} stage=${error.stage.name} retryMs=$retryMs") // No URLs, API tokens or coordinates.
android.util.Log.w("NavFrame", "MAP_UNAVAILABLE code=${error.failure.name} stage=${error.stage.name} detail=${error.detail.safeText()} retryMs=$retryMs") // No URLs, API tokens or coordinates.
recordMapEvent(MapDiagnosticKind.FAILURE, state, mode, source, retryMs, error)
return MapFrameComposer().compose(null, null, state, mode, source.attribution, unavailable = true, failureCode = error.failure.name).also { unavailableMapFrame = it }
}
private suspend fun recordMapEvent(kind: MapDiagnosticKind, state: NavigationState, mode: NavigationMode, source: TileSource, retryMs: Long, error: MapRenderException? = null) {
val network = mapRenderer?.networkConnected ?: lastMapNetworkConnected
val memory = android.app.ActivityManager.MemoryInfo()
val memoryAvailable = runCatching { getSystemService(android.app.ActivityManager::class.java).getMemoryInfo(memory) }.isSuccess
val interactive = runCatching { getSystemService(android.os.PowerManager::class.java).isInteractive }.getOrNull()
val event = MapDiagnosticEvent(
kind = kind, timestampMs = System.currentTimeMillis(),
source = if (source.uri.startsWith("file:")) MapDiagnosticSource.LOCAL else MapDiagnosticSource.ONLINE,
@@ -839,6 +842,10 @@ class TftService : Service() {
stage = error?.stage ?: MapRenderStage.COMPOSE, failure = error?.failure,
resource = error?.detail?.resource ?: MapResourceKind.UNKNOWN, reason = error?.detail?.reason ?: MapFailureReason.UNKNOWN,
httpStatus = error?.detail?.httpStatus?.takeIf { it in 400..599 },
errorClass = error?.detail?.errorClass?.takeIf { it.matches(Regex("[A-Za-z0-9_$]{1,80}")) } ?: "OTHER",
sdkEvidence = error?.detail?.sdkEvidence.orEmpty(),
screenInteractive = interactive, lowMemory = if (memoryAvailable) memory.lowMemory else null,
availableMemoryMb = if (memoryAvailable) (memory.availMem / (1024 * 1024)).coerceAtLeast(0) else null,
durationMs = (SystemClock.elapsedRealtime() - mapRenderStarted).coerceAtLeast(0), attempts = mapFailures,
retryMs = retryMs, mode = mode, navigation = state.navigationStatus, connection = mutableState.value,
androidApi = Build.VERSION.SDK_INT,
@@ -43,7 +43,8 @@ class MapDiagnosticHistoryTest {
@Test fun committedFailuresAndRecoverySurviveNewStoreInstancesWithoutNativeMessages() {
val raw = "Failed to load glyph https://private.example/fonts?token=secret HTTP status 403 at 43.361234,-5.856789"
val detail = mapErrorDetail(raw)
val failure = event().copy(failure = classifyMapRenderFailure(raw), resource = detail.resource, reason = detail.reason, httpStatus = detail.httpStatus)
val failure = event().copy(failure = classifyMapRenderFailure(raw), resource = detail.resource, reason = detail.reason, httpStatus = detail.httpStatus,
sdkEvidence = detail.sdkEvidence, errorClass = "SDK_CALLBACK", screenInteractive = false, lowMemory = true, availableMemoryMb = 42)
assertTrue(store.record(failure))
assertTrue(store.record(event(kind = MapDiagnosticKind.RECOVERED)))
val reopened = MapDiagnosticHistory(context)
@@ -72,6 +73,38 @@ class MapDiagnosticHistoryTest {
assertFalse(store.file.exists())
}
@Test fun repeatedSaturatedFailuresPreserveOnsetAndRecoveryInsteadOfEvictingIt() {
for (index in 1..3) assertTrue(store.record(event(timestamp = index.toLong()).copy(attempts = index)))
for (index in 4..204) assertTrue(store.record(event(timestamp = index.toLong()).copy(attempts = 4)))
assertTrue(store.record(event(timestamp = 205, kind = MapDiagnosticKind.RECOVERED).copy(attempts = 4)))
val report = MapDiagnosticHistory(context).report()
assertTrue(report.contains("(5/100)"))
assertTrue(report.contains("1970-01-01T00:00:00.001Z"))
assertTrue(report.contains("Agrupado: 201 fallos"))
assertTrue(report.contains("primero 1970-01-01T00:00:00.004Z"))
assertTrue(report.contains("último 1970-01-01T00:00:00.204Z"))
assertTrue(report.contains("RECOVERED"))
assertTrue(store.record(event(timestamp = 206)))
assertTrue(store.report().contains("(6/100)"))
}
@Test fun legacyHistoryRemainsReadableAndNewEvidenceIsPersisted() {
val json = event().toJson()
for (key in listOf("errorClass", "sdkEvidence", "firstTimestampMs", "occurrences", "screenInteractive", "lowMemory", "availableMemoryMb")) json.remove(key)
store.file.parentFile!!.mkdirs()
store.file.writeText(org.json.JSONArray().put(json).toString())
assertTrue(store.report().contains("TIMEOUT/STYLE_READY"))
val raw = "Snapshot failed no tile data https://private.example?token=secret"
val detail = mapErrorDetail(raw)
assertTrue(store.record(event(timestamp = 1_792_000_000_001).copy(sdkEvidence = detail.sdkEvidence,
screenInteractive = false, lowMemory = true, availableMemoryMb = 42)))
val report = MapDiagnosticHistory(context).report()
assertTrue(report.contains("WORDS_SNAPSHOT_FAILED_NO_TILE_DATA"))
assertTrue(report.contains("Pantalla APAGADA"))
assertTrue(report.contains("disponible 42 MiB"))
assertFalse(store.file.readText().contains("private.example"))
}
@Test fun interruptedAtomicReplacementLeavesTheLastCommittedHistoryReadable() {
assertTrue(store.record(event()))
val previous = store.report()
@@ -25,7 +25,7 @@ class MapRenderDiagnosticsTest {
val raw = "Failed to load style glyph https://private.example/fonts.pbf?token=secret: HTTP status 403; location 43.361234,-5.856789"
assertEquals(MapRenderFailure.NETWORK, classifyMapRenderFailure(raw))
val detail = mapErrorDetail(raw)
assertEquals("GLYPH/FORBIDDEN/HTTP_403/SDK_CALLBACK", detail.safeText())
assertTrue(detail.safeText().startsWith("GLYPH/FORBIDDEN/HTTP_403/SDK_CALLBACK/WORDS_"))
assertEquals(MapRenderFailure.NETWORK, classifyMapRenderFailure("Failed to load style: could not resolve private-host"))
assertFalse(detail.safeText().contains("private"))
assertFalse(detail.safeText().contains("secret"))
@@ -36,4 +36,17 @@ class MapRenderDiagnosticsTest {
assertEquals("TIMEOUT:STYLE_READY:UNKNOWN/UNKNOWN/SDK_CALLBACK", failure.message)
assertNotEquals(MapRenderFailure.NETWORK, failure.failure)
}
@Test fun unknownCallbackRetainsOnlyDiagnosticVocabulary() {
val raw = "Snapshot failed: no tile data private-address 43.361234,-5.856789 https://private.example/style?token=secret /data/user/0/private-map.pmtiles"
val detail = mapErrorDetail(raw)
assertEquals("SNAPSHOT_FAILED_NO_TILE_DATA", detail.sdkEvidence)
assertEquals("EMPTY", mapErrorDetail(null).sdkEvidence)
assertEquals(MapFailureReason.EMPTY, mapErrorDetail("").reason)
assertEquals("UNCLASSIFIED", mapErrorDetail("private-secret-name").sdkEvidence)
assertEquals(MapFailureReason.IO, mapErrorDetail("Cannot read PMTiles archive: permission denied").reason)
assertEquals(MapResourceKind.PMTILES, mapErrorDetail("Cannot read PMTiles archive: permission denied").resource)
assertTrue(safeSdkEvidence("failed ".repeat(1000)).length <= 240)
assertEquals("FAILED", safeSdkEvidence("failed \"private map tile\" https://host/map/tile/43 /private/map/file"))
}
}
@@ -32,6 +32,9 @@ class RouteGuidanceTracker(private val route: RouteResult, private val config: G
private var lastTimestamp: Long? = null
private val outside = SustainedFixes()
private val arrival = SustainedFixes()
private val rejoin = SustainedFixes()
private var importedDeviation = false
private var rejoinProgress: Double? = null
private var arrived = false
private var needsRecovery = false
private var lastState: NavigationState? = null
@@ -45,7 +48,7 @@ class RouteGuidanceTracker(private val route: RouteResult, private val config: G
fix.accuracyMeters.isFinite() && fix.accuracyMeters in 0f..config.maxAccuracyMeters &&
(lastNow == null || nowMs >= lastNow!!)
if (!usable) {
outside.reset(); arrival.reset()
outside.reset(); arrival.reset(); rejoin.reset(); rejoinProgress = null
needsRecovery = lastPoint != null
return remember(base.copy(speed = 0f, navigationStatus = NavigationStatus.GPS_LOST))
}
@@ -54,7 +57,7 @@ class RouteGuidanceTracker(private val route: RouteResult, private val config: G
if (arrived) return remember(base.copy(speed = 0f, remainingDistanceMeters = 0,
etaEpochMillis = if (route.imported) null else epochMs, navigationStatus = NavigationStatus.ARRIVED))
if (needsRecovery || lastNow?.let { nowMs - it > config.maxFixAgeMs } == true) {
outside.reset(); arrival.reset()
outside.reset(); arrival.reset(); rejoin.reset(); rejoinProgress = null
needsRecovery = false
acquired = false
lastPoint = fix.position
@@ -71,11 +74,30 @@ class RouteGuidanceTracker(private val route: RouteResult, private val config: G
lastNow = nowMs
lastTimestamp = fix.timestampMs
if (jumped) {
outside.reset(); arrival.reset()
outside.reset(); arrival.reset(); rejoin.reset(); rejoinProgress = null
return remember(base.copy(speed = 0f, navigationStatus = NavigationStatus.GPS_LOST))
}
val projection = line.project(fix.position, progress, forwardAllowance)
var projection = line.project(fix.position, progress, forwardAllowance)
val outsideThreshold = max(config.offRouteMeters, fix.accuracyMeters * 2.0)
if (route.imported && importedDeviation) {
// A detour may rejoin anywhere on the original trace, including behind progress.
// Require stable fresh fixes before widening the normal crossing-safe progress window.
val candidate = line.project(fix.position, 0.0, line.total)
val candidateProgress = candidate.local
val stable = candidateProgress != null && candidate.localDistance <= outsideThreshold &&
(rejoinProgress == null || abs(candidateProgress - rejoinProgress!!) <= movementAllowance)
val confirmed = rejoin.observe(stable, distinct, nowMs, 3, 2_000)
rejoinProgress = candidateProgress.takeIf { stable }
if (!confirmed) {
arrival.reset()
return remember(base.copy(navigationStatus = NavigationStatus.OFF_ROUTE))
}
progress = requireNotNull(candidateProgress)
acquired = true
importedDeviation = false
outside.reset(); rejoin.reset(); rejoinProgress = null
projection = candidate
}
val offRoute = outside.observe(projection.localDistance > outsideThreshold, distinct, nowMs,
config.offRouteFixes, config.offRouteDurationMs)
// Freeze progress during inaccurate projection, so driving parallel to the road does not advance turns.
@@ -84,6 +106,7 @@ class RouteGuidanceTracker(private val route: RouteResult, private val config: G
acquired = true
}
if (offRoute) {
if (route.imported) importedDeviation = true
arrival.reset()
return remember(base.copy(navigationStatus = NavigationStatus.OFF_ROUTE))
}
@@ -2,6 +2,7 @@ package dev.navframe.core
import org.junit.Assert.*
import org.junit.Test
import kotlin.math.abs
class RouteGuidanceTest {
// Equatorial segments are ~111.2m each; original route duration is 30 seconds.
@@ -220,6 +221,82 @@ class RouteGuidanceTest {
assertEquals(initial.remainingDistanceMeters, reversed.remainingDistanceMeters)
}
private val importedTrace = RouteResult(
listOf(GeoPoint(0.0, 0.0), GeoPoint(0.0, 0.02)), emptyList(), 2224, 0, imported = true)
private fun deviatedImportedTracker(): RouteGuidanceTracker {
val tracker = RouteGuidanceTracker(importedTrace)
tracker.update(fix(lon = 0.005), 0, 0)
tracker.update(fix(lat = -0.0007, lon = 0.005, time = 2), 3_000, 0)
tracker.update(fix(lat = -0.0007, lon = 0.005, time = 3), 6_000, 0)
val deviated = tracker.update(fix(lat = -0.0007, lon = 0.005, time = 4), 9_000, 0)
assertEquals(NavigationStatus.OFF_ROUTE, deviated.navigationStatus)
assertSame(importedTrace, deviated.route)
return tracker
}
@Test fun `imported detour rejoins ahead or behind frozen progress without replacing trace`() {
for (longitude in listOf(0.012, 0.002)) {
val tracker = deviatedImportedTracker()
// The isolated relocation is rejected. Stable fixes then reacquire the original trace.
assertEquals(NavigationStatus.GPS_LOST,
tracker.update(fix(lon = longitude, time = 5), 10_000, 0).navigationStatus)
for (i in 6L..7L) {
assertEquals(NavigationStatus.OFF_ROUTE,
tracker.update(fix(lon = longitude, time = i), (i + 5) * 1_000, 0).navigationStatus)
}
val resumed = tracker.update(fix(lon = longitude, time = 8), 13_000, 0)
assertEquals(NavigationStatus.NAVIGATING, resumed.navigationStatus)
assertTrue(abs(((0.02 - longitude) * 111_195) - resumed.remainingDistanceMeters!!) < 1)
assertSame(importedTrace, resumed.route)
assertNull(resumed.nextManeuver)
assertNull(resumed.etaEpochMillis)
}
}
@Test fun `repeated stale and inaccurate fixes cannot confirm imported rejoin`() {
val tracker = deviatedImportedTracker()
tracker.update(fix(lon = 0.012, time = 5), 10_000, 0)
val candidate = fix(lon = 0.012, time = 6)
assertEquals(NavigationStatus.OFF_ROUTE, tracker.update(candidate, 11_000, 0).navigationStatus)
assertEquals(NavigationStatus.OFF_ROUTE, tracker.update(candidate, 14_000, 0).navigationStatus)
assertEquals(NavigationStatus.GPS_LOST,
tracker.update(fix(lon = 0.012, time = 7, accuracy = 40f), 15_000, 0).navigationStatus)
assertEquals(NavigationStatus.GPS_LOST,
tracker.update(fix(lon = 0.012, time = 8), 16_000, 0, 15_001).navigationStatus)
tracker.update(fix(lon = 0.012, time = 9), 17_000, 0)
tracker.update(fix(lon = 0.012, time = 10), 18_000, 0)
tracker.update(fix(lon = 0.012, time = 11), 19_000, 0)
assertEquals(NavigationStatus.NAVIGATING,
tracker.update(fix(lon = 0.012, time = 12), 20_000, 0).navigationStatus)
}
@Test fun `closed imported trace rejoin at shared start and finish cannot falsely arrive`() {
val loop = importedTrace.copy(geometry = listOf(GeoPoint(0.0, 0.0), GeoPoint(0.0, 0.002),
GeoPoint(0.002, 0.002), GeoPoint(0.002, 0.0), GeoPoint(0.0, 0.0)))
val tracker = RouteGuidanceTracker(loop)
tracker.update(fix(lon = 0.0005), 0, 0)
for (i in 2L..4L) tracker.update(fix(lat = -0.0007, lon = 0.0005, time = i), (i - 1) * 3_000, 0)
for (i in 5L..9L) {
val state = tracker.update(fix(time = i), (i + 5) * 1_000, 0)
assertNotEquals(NavigationStatus.ARRIVED, state.navigationStatus)
if (i >= 7) {
assertEquals(NavigationStatus.NAVIGATING, state.navigationStatus)
assertTrue(state.remainingDistanceMeters!! > 800)
}
}
}
@Test fun `imported crossing preserves progress until deviation is sustained`() {
val crossing = importedTrace.copy(geometry = listOf(GeoPoint(0.0, 0.0), GeoPoint(0.0, 0.002),
GeoPoint(0.002, 0.002), GeoPoint(0.002, 0.0), GeoPoint(0.0, 0.0), GeoPoint(0.0, -0.002)))
val tracker = RouteGuidanceTracker(crossing)
val initial = tracker.update(fix(), 0, 0)
val next = tracker.update(fix(lon = -0.00005, time = 2), 1_000, 0)
assertEquals(initial.remainingDistanceMeters, next.remainingDistanceMeters)
assertEquals(NavigationStatus.NAVIGATING, next.navigationStatus)
}
@Test fun `maneuver arrows use type rather than translated prose`() {
assertEquals(ManeuverDirection.LEFT, maneuverDirection(15))
assertEquals(ManeuverDirection.RIGHT, maneuverDirection(10))
+19
View File
@@ -2,6 +2,25 @@
The Android workflow verifies the debug build, unit tests and lint for pull requests and pushes to `main` or `development`. A manual Actions run is also available. Pull requests never receive production signing secrets or publish releases.
## Pull request routing and version policy
Commit the version change in the PR itself. `PR branch and version policy` checks the proposed `app/build.gradle.kts` against the destination branch snapshot:
| PR source | Destination | Required versionName |
| --- | --- | --- |
| `feat/*` | `development` | `x.y.(z+1)` |
| `fix/*` | `development` | `x.y.(z+1)` |
| `hotfix/*` | `main` | `x.y.(z+1)` |
| `development` | `main` | `x.(y+1).z` |
Features and ordinary fixes must go through `development`; urgent production fixes use `hotfix/*` into `main`. Other source/destination combinations fail. Components not being incremented are preserved: promotion from `0.13.8` requires `0.14.8`, not `0.14.0`. Every PR also increases the committed Android `versionCode`; the production build override remains independent.
The major component only changes on the owner's explicit request. For that exceptional PR, the repository owner must personally apply the `major-version-approved` label; the workflow verifies the most recent label event actor. The expected version then becomes `(x+1).y.z`, while branch routing still applies. Remove the label when the exception is no longer authorized.
The policy uses `pull_request_target` with read-only permissions and executes only the base branch's trusted script. It reads PR version declarations with `git show` without building or executing PR code, and never uses production secrets. The existing Android checks continue using the ordinary `pull_request` event. Enable **Branch and version policy** as a required status check in branch protection/rulesets for both destinations to prevent merging a failed policy check. Install this policy on both branches before relying on it for development PRs. If another PR changes the destination version, update the branch/version and rerun the check before merging.
CI validates the committed bump rather than pushing version commits with privileged tokens. This keeps the exact app version reviewable in the PR and works for fork contributions as well.
## Branch outputs
| Event | Output after checks pass |
+1 -1
View File
@@ -14,7 +14,7 @@ Files are limited to 5 MiB, 10,000 trace points and 64 XML nesting levels. Coord
The original coordinates are retained locally in memory and drawn on the phone and TFT. GPX import does not send the file or its coordinates to a routing server. It works with the installed offline map; online background tiles still require a connection when no offline map is selected. Standard trace points do not establish legal roads, surface quality, reliable turns or travel time.
The display says **Sigue el trazado GPX**. It shows progress, remaining distance, sustained deviations and arrival using the existing GPS guidance policy. It does not invent turn instructions, speak turn announcements, show an ETA, or automatically reroute away from the imported trace. On a deviation, return to the trace using the map and road signs. Manual recalculation also preserves the trace.
The display says **Sigue el trazado GPX**. It shows progress, remaining distance, sustained deviations and arrival using the existing GPS guidance policy. It does not invent turn instructions, speak turn announcements, show an ETA, or automatically reroute away from the imported trace. On a deviation, return to the trace using the map and road signs. Manual recalculation also preserves the trace. After a confirmed deviation, three fresh, stable GPS fixes spanning at least two seconds automatically resume progress at the nearest point of the original trace, whether you rejoin ahead of or behind the previous position. GPS jumps and inaccurate fixes cannot confirm a rejoin.
The imported route is not persisted across process death or device reboot: reload the original document to resume. The document remains in its selected provider; the app does not request long-term file access or copy the GPX into its own storage. Map diagnostics do not include route coordinates, document paths or route names.
+3 -1
View File
@@ -14,11 +14,13 @@ Each event contains its UTC timestamp, app version, Android API level, MapLibre
The backoff attempt is capped at four, like the renderer's existing retry policy. Repeated failures continue to create separate timestamped records after that limit. Only the first successful render following failures creates a recovery record; normal successful frames are not logged.
From 0.13.6, diagnostics also retain the callback/exception class, a bounded sequence of allowlisted SDK diagnostic words (`WORDS_...`), screen interactive state, low-memory status and available system memory. Render stages distinguish camera updates, route GeoJSON updates and snapshot requests; native snapshot failure callbacks carry `SnapshotterErrorCallback` rather than the generic `SDK_CALLBACK`. URL/path/quoted payloads are removed before extracting known diagnostic words. An empty callback is distinguished from an unclassified nonempty message. This exposes messages such as snapshot/failed/no/tile/data without copying arbitrary SDK text. These fields are evidence, not proof that memory or screen state caused the failure.
Raw SDK messages, stack traces, URLs, tokens, coordinates, route geometry, destinations, search text, and Bluetooth identifiers are excluded. The history contains fixed labels and numbers, not a copy of Logcat. Network state is diagnostic context: a disconnected network does not itself explain a failure of a selected local map.
## Storage and limits
The history is a private app file named `tft-map-diagnostics.json` in Android's `noBackupFilesDir`. No storage permission is required; the app does not upload it automatically, and it is excluded from backup/device transfer. The file retains the latest 100 failure/recovery events and is bounded at 128 KiB. Older events are discarded when the limit is reached.
The history is a private app file named `tft-map-diagnostics.json` in Android's `noBackupFilesDir`. No storage permission is required; the app does not upload it automatically, and it is excluded from backup/device transfer. The file retains up to 100 failure/recovery records and is bounded at 128 KiB. Starting with 0.13.6, consecutive identical failures at the maximum retry backoff are grouped into one record with an occurrence count and first/last UTC timestamps. Initial retries and recovery records remain separate; the aggregate shows the latest navigation, network and TFT states. Changes in error classification, source, mode or app version start a new record. This prevents a long stream of identical failures from immediately erasing its onset. Older records are discarded when the limit is reached. Existing 0.13.2–0.13.5 files remain readable; previously evicted events cannot be recovered.
File operations run on an IO dispatcher. Writes are synced and replaced atomically, so an interrupted replacement preserves the previous completed history. A failure that occurs while a shutdown interrupts its write may not be retained. Clearing app data or uninstalling NavFrame deletes the history.
+52
View File
@@ -0,0 +1,52 @@
#!/usr/bin/env python3
"""Validate PR routing and committed Android versions without executing PR code."""
import argparse
import re
import subprocess
def version_at(ref):
content = subprocess.check_output(
['git', 'show', f'{ref}:app/build.gradle.kts'], text=True
)
names = re.findall(r'^\s*versionName\s*=\s*"(\d+)\.(\d+)\.(\d+)"\s*$', content, re.M)
codes = re.findall(r'^\s*versionCode\s*=\s*(\d+)\s*$', content, re.M)
if len(names) != 1 or len(codes) != 1:
raise ValueError('Expected one literal x.y.z versionName and one versionCode')
return tuple(map(int, names[0])), int(codes[0])
def validate(base_branch, head_branch, old, new, old_code, new_code, major_approved=False):
if base_branch == 'main' and head_branch == 'development':
expected = (old[0], old[1] + 1, old[2])
elif base_branch == 'main' and head_branch.startswith('hotfix/'):
expected = (old[0], old[1], old[2] + 1)
elif base_branch == 'development' and head_branch.startswith(('feat/', 'fix/')):
expected = (old[0], old[1], old[2] + 1)
else:
raise ValueError('PRs must be feat/* or fix/* -> development, hotfix/* -> main, or development -> main')
if major_approved:
expected = (old[0] + 1, old[1], old[2])
if new != expected:
raise ValueError(f'Expected version {".".join(map(str, expected))}, found {".".join(map(str, new))}')
if new_code <= old_code or not 1 <= new_code <= 2_100_000_000:
raise ValueError('Committed versionCode must increase and remain within Android limits')
def main():
parser = argparse.ArgumentParser(description=__doc__)
for name in ('base-ref', 'head-ref', 'base-branch', 'head-branch'):
parser.add_argument(f'--{name}', required=True)
parser.add_argument('--major-approved', action='store_true')
args = parser.parse_args()
old, old_code = version_at(args.base_ref)
new, new_code = version_at(args.head_ref)
try:
validate(args.base_branch, args.head_branch, old, new, old_code, new_code, args.major_approved)
except ValueError as error:
raise SystemExit(str(error)) from error
print(f'Version policy passed: {old} -> {new}, versionCode {old_code} -> {new_code}')
if __name__ == '__main__':
main()
+35
View File
@@ -0,0 +1,35 @@
import unittest
from scripts.check_version_policy import validate
class VersionPolicyTest(unittest.TestCase):
def test_allowed_transitions(self):
for base, head, new in [('main', 'development', (0, 14, 4)),
('main', 'hotfix/map', (0, 13, 5)),
('development', 'feat/routes', (0, 13, 5)),
('development', 'fix/map', (0, 13, 5))]:
with self.subTest(base=base, head=head):
validate(base, head, (0, 13, 4), new, 20, 21)
def test_reject_invalid_routes_and_versions(self):
for base, head, new, code in [('main', 'feat/routes', (0, 13, 5), 21),
('main', 'fix/map', (0, 13, 5), 21),
('development', 'hotfix/map', (0, 13, 5), 21),
('main', 'other', (0, 13, 5), 21),
('other', 'fix/map', (0, 13, 5), 21),
('main', 'development', (0, 14, 0), 21),
('main', 'hotfix/map', (1, 13, 4), 21),
('development', 'feat/routes', (0, 13, 4), 21),
('main', 'hotfix/map', (0, 13, 5), 20)]:
with self.subTest(base=base, head=head, new=new, code=code):
with self.assertRaises(ValueError):
validate(base, head, (0, 13, 4), new, 20, code)
def test_explicit_major_approval(self):
validate('main', 'hotfix/major', (0, 13, 4), (1, 13, 4), 20, 21, True)
with self.assertRaises(ValueError):
validate('main', 'feat/major', (0, 13, 4), (1, 13, 4), 20, 21, True)
if __name__ == '__main__':
unittest.main()