Keep FLM learning when review history fills up

This commit is contained in:
firestar5683
2026-11-14 16:15:09 +00:00
parent a468bb75b9
commit fc7cf1b64c
12 changed files with 350 additions and 10 deletions
+71 -4
View File
@@ -104,7 +104,7 @@ class AssessmentCache:
self._write(digest + '.json', raw)
return digest
def _capacity(self, size):
def _capacity(self, size, files=1):
total = count = 0
for p in self.directory.iterdir():
if p.name in ('latest.json', 'inputs.json'):
@@ -115,10 +115,75 @@ class AssessmentCache:
if not stat.S_ISREG(s.st_mode) or s.st_uid != os.geteuid():
raise ValueError('Foreign assessment file')
total += s.st_size
count += 1
if count >= MAX_FILES or total + size > MAX_TOTAL:
# Consumed-start markers must survive retirement; they are not assessments.
count += not (p.name.startswith('trial-') and len(p.name) == 75 and not p.name[6:-5].strip('0123456789abcdef'))
if count + files > MAX_FILES or total + size > MAX_TOTAL:
raise ValueError('Assessment cache full')
def retire(self, protected, *, authorized):
"""Parked-only retirement of unreferenced derived documents, never trial claims."""
self._owned()
try:
self._capacity(4 * MAX_DOCUMENT, files=4)
return 0
except ValueError as error:
if str(error) != 'Assessment cache full':
raise
for digest in protected:
self.get(digest)
documents = {}
for path in self.directory.iterdir():
if len(path.name) == 69 and path.suffix == '.json' and not path.stem.strip('0123456789abcdef'):
documents[path.stem] = path.lstat()
def references(value):
if type(value) is str:
return {value} if value in documents else set()
if type(value) is dict:
return set().union(*(references(v) for v in value.values()), set())
if type(value) is list:
return set().union(*(references(v) for v in value), set())
return set()
keep = references(list(protected)) | references(self.checkpoints())
# Keep recent reports available even if newer resource failures filled the checkpoints.
ordered = sorted(documents, key=lambda name: (documents[name].st_mtime_ns, name), reverse=True)
keep.update(ordered[:MAX_CHECKPOINTS])
pending = list(keep)
while pending:
linked = references(self.get(pending.pop())) - keep
keep.update(linked)
pending.extend(linked)
removed = 0
for digest in reversed(ordered):
try:
self._capacity(4 * MAX_DOCUMENT, files=4)
break
except ValueError as error:
if str(error) != 'Assessment cache full':
raise
if digest in keep:
continue
self.get(digest) # Only retire intact immutable documents.
if not authorized():
raise ValueError('Assessment retirement no longer permitted')
self._owned()
path = self.directory / (digest + '.json')
current, before = path.lstat(), documents[digest]
fields = ('st_dev', 'st_ino', 'st_mode', 'st_uid', 'st_size', 'st_mtime_ns')
if any(getattr(current, field) != getattr(before, field) for field in fields):
raise ValueError('Assessment changed before retirement')
path.unlink()
removed += 1
if removed:
fd = os.open(self.directory, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW)
try:
os.fsync(fd)
finally:
os.close(fd)
self._capacity(4 * MAX_DOCUMENT, files=4)
return removed
def claim_trial(self, digest, session):
"""Durably consume one provisional start; any previous claim refuses."""
if (
@@ -133,7 +198,9 @@ class AssessmentCache:
self._owned()
name = 'trial-' + digest + '.json'
raw = json.dumps({'analysis_sha256': digest, 'vehicle_session': session}, sort_keys=True, separators=(',', ':')).encode()
self._capacity(len(raw))
if os.path.lexists(self.directory / name):
return False
self._capacity(len(raw), files=0)
try:
fd = os.open(self.directory / name, os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o600)
except FileExistsError:
@@ -614,6 +614,11 @@ class OffroadWorker:
self.skipped_routes = []
if not self.permitted():
raise ValueError('Offroad analysis not permitted')
saved, readable = read_saved(self.params, KEY, MAX_BYTES)
if not readable:
raise ValueError('Unreadable automatic tuning history')
protected = [row['analysis_sha256'] for row in decode(saved).get(NAMESPACE, {}).values()]
self.cache.retire(protected, authorized=lambda: self.permitted() and read_saved(self.params, KEY, MAX_BYTES) == (saved, True))
self.pending_logger = logger_marker(self.params)
latest = latest_route(self.params, self.root, permitted=self.permitted, inventory_only=True, on_skip=self._skip_route)
if logger_marker(self.params) != self.pending_logger:
@@ -98,7 +98,7 @@ class TestOffroadCache(unittest.TestCase):
for session in ('', 'e' * 31, 'z' * 32):
with self.subTest(session=session), self.assertRaises(ValueError):
self.cache.claim_trial('d' * 64, session)
with patch('openpilot.starpilot.flm.offroad_cache.MAX_FILES', 0), self.assertRaises(ValueError):
with patch('openpilot.starpilot.flm.offroad_cache.MAX_TOTAL', 0), self.assertRaises(ValueError):
self.cache.claim_trial('e' * 64, 'f' * 32)
self.cache.directory.chmod(0o777)
with self.assertRaises(ValueError):
@@ -0,0 +1,76 @@
"""Retiring derived reports must never erase saved proofs or consumed starts."""
import os
from pathlib import Path
import tempfile
import unittest
from unittest.mock import patch
from openpilot.starpilot.flm.offroad_cache import AssessmentCache, MAX_FILES
class TestCacheRetention(unittest.TestCase):
def setUp(self):
temporary = tempfile.TemporaryDirectory()
self.addCleanup(temporary.cleanup)
self.cache = AssessmentCache(Path(temporary.name) / 'cache')
def fill(self):
return [self.cache.put({'kind': 'completed_assessment', 'unit': index}) for index in range(MAX_FILES)]
def test_full_cache_releases_room_preserving_saved_proof_dependency_and_checkpoints(self):
linked = self.cache.put({'kind': 'next_drive_trial'})
saved = self.cache.put({'kind': 'next_drive_outcome', 'trial_analysis_sha256': linked})
checkpoint = self.cache.put({'kind': 'completed_assessment', 'unit': 'checkpoint'})
self.cache.checkpoint({'input_fingerprint': 'f' * 64, 'result': {'status': 'collecting', 'reason': 'unit', 'assessment_sha256': checkpoint}})
for index in range(MAX_FILES - 3):
self.cache.put({'kind': 'completed_assessment', 'unit': index})
with self.assertRaisesRegex(ValueError, 'Assessment cache full'):
self.cache.put({'unit': 'new'})
self.assertEqual(self.cache.retire([saved], authorized=lambda: True), 4)
for digest in (saved, linked, checkpoint):
self.cache.get(digest)
for index in range(4):
self.cache.put({'unit': 'new', 'index': index})
def test_consumed_claim_survives_retired_trial_and_does_not_consume_document_slot(self):
digests = self.fill()
self.assertTrue(self.cache.claim_trial(digests[0], 'a' * 32))
claim = self.cache.directory / ('trial-' + digests[0] + '.json')
raw = claim.read_bytes()
self.cache.retire([], authorized=lambda: True)
self.assertFalse((self.cache.directory / (digests[0] + '.json')).exists())
self.assertEqual(claim.read_bytes(), raw)
self.assertFalse(self.cache.claim_trial(digests[0], 'b' * 32))
def test_recent_documents_are_kept_and_repeated_maintenance_is_idle(self):
digests = self.fill()
for index, digest in enumerate(digests):
os.utime(self.cache.directory / (digest + '.json'), ns=(index + 1, index + 1))
self.cache.retire([], authorized=lambda: True)
for digest in digests[-8:]:
self.cache.get(digest)
self.assertEqual(self.cache.retire([], authorized=lambda: True), 0)
def test_permission_loss_missing_saved_proof_and_foreign_contents_preserve_files(self):
self.fill()
before = set(self.cache.directory.iterdir())
with self.assertRaisesRegex(ValueError, 'no longer permitted'):
self.cache.retire([], authorized=lambda: False)
self.assertEqual(set(self.cache.directory.iterdir()), before)
with self.assertRaises(FileNotFoundError):
self.cache.retire(['f' * 64], authorized=lambda: True)
(self.cache.directory / 'unknown.bin').write_bytes(b'unit')
with self.assertRaisesRegex(ValueError, 'Unexpected'):
self.cache.retire([], authorized=lambda: True)
self.assertTrue(before.issubset(set(self.cache.directory.iterdir())))
def test_byte_limit_still_counts_consumed_markers(self):
digest = self.cache.put({'unit': True})
self.cache.claim_trial(digest, 'a' * 32)
with patch('openpilot.starpilot.flm.offroad_cache.MAX_TOTAL', 1), self.assertRaisesRegex(ValueError, 'Assessment cache full'):
self.cache._capacity(1)
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,76 @@
"""Small, read-only support download; no raw routes, CarParams, GPS or credentials."""
import json
import re
from openpilot.starpilot.flm.offroad_cache import AssessmentCache, directory_for_params
from openpilot.starpilot.flm.offroad_store import KEY, MAX_BYTES, NAMESPACE
from openpilot.starpilot.flm.learned_lifecycle import decode
from openpilot.starpilot.saved_source import read_saved
def _reason(value):
text = str(value)[:512]
text = re.sub(r'https?://\S+|/(?:data|home|Users|tmp)/\S+', '[private location]', text)
return re.sub(r'(?i)(?:token|password|secret|authorization)[=: ]+\S+', '[private credential]', text)
def _result(value):
result = {key: value[key] for key in ('status', 'configuration_changed', 'configuration_state', 'saved_adjustments',
'analysis_counts', 'actual_application_proven', 'recommendation_count', 'route_skipped') if key in value}
result['reason'] = _reason(value.get('reason', 'not_reported'))
skipped = value.get('skipped_routes')
result['skipped_drives'] = [{'recording': _reason(row[0])[:180], 'reason': _reason(row[1])}
for row in (skipped[:16] if type(skipped) is list else ()) if type(row) is list and len(row) == 2]
return result
def diagnostics(report, params):
current = report.get('current') or {}
details = current.get('details') or {}
result = {'version': 1, 'privacy': 'No raw route data, location, VIN, dongle ID or credentials included.',
'current': {key: current[key] for key in ('fresh', 'ageSeconds', 'enabled', 'status', 'progress', 'fit', 'application') if key in current},
'preference': report.get('preference'), 'history': report.get('history', []), 'checkpoints': [], 'saved_profiles': []}
result['current']['reason'] = _reason(current.get('reason', 'learner_report_unavailable'))
result['current']['analysis'] = {key: details[key] for key in (
'Recorded steering observations', 'Retained control windows', 'Retained tracking windows', 'Recorded drive coverage',
'Drives in steering evidence history', 'Saved route adjustment count', 'Saved route configuration state',
'Recorded coordinate recommendations', 'Controller and encoder check windows', 'Automatic tune refusal reasons') if key in details}
result['current']['skipped_drives'] = _result({'skipped_routes': details.get('Skipped recorded drives', [])})['skipped_drives']
if params is None:
result['storage'] = {'status': 'unavailable'}
return result
for key in ('GitCommit', 'GitBranch'):
raw, readable = read_saved(params, key, 128)
if readable and raw is not None and re.fullmatch(rb'[\w./-]{1,128}', raw):
result[key] = raw.decode('ascii')
try:
raw, readable = read_saved(params, KEY, MAX_BYTES)
if not readable:
raise ValueError('saved_profiles_unreadable')
for row in decode(raw).get(NAMESPACE, {}).values():
result['saved_profiles'].append({'state': row['state'], 'sequence': row['sequence'],
'adjustments': sum(value != 0 for value in row['values'].values()),
'evidence_drives': len(row['route_sha256s'])})
directory = directory_for_params(params)
if not directory.exists():
result['storage'] = {'status': 'not_created', 'documents': 0, 'bytes': 0}
else:
cache = AssessmentCache(directory)
files = list(directory.iterdir())
result['storage'] = {'status': 'readable', 'documents': len(files), 'bytes': sum(path.lstat().st_size for path in files)}
result['checkpoints'] = [_result(row['result']) for row in cache.checkpoints()]
except (OSError, ValueError, TypeError, KeyError) as error:
result['storage'] = {'status': 'unavailable', 'reason': _reason(error)}
return result
def download(report, params):
def clean(value):
if type(value) is dict:
return {key: clean(item) for key, item in value.items()}
if type(value) is list:
return [clean(item) for item in value]
return _reason(value) if type(value) is str else value
return 'starpilot-flm-logs.json', json.dumps(clean(diagnostics(report, params)), indent=2, allow_nan=False).encode()
@@ -53,3 +53,8 @@ class FlmTrainingResults:
return {'version': 1, 'valid': True, 'enabled': choice.enabled, 'parked': parked, 'vehicle': vehicle}
except (OSError, RuntimeError, AttributeError, TypeError, ValueError, OverflowError, KjException):
return unknown
def download(self):
from openpilot.starpilot.galaxy.flm_diagnostics import download
return download(self.snapshot(), self.params)
+9
View File
@@ -1349,6 +1349,15 @@ def make_server(*, port=8082, host='127.0.0.1', monitor=None, owner=None, crashe
else:
if self.require_session():
self.json(200, result)
elif path == '/api/flm/logs/download':
if not self.require_session():
return
if urlsplit(self.path).query:
self.json(400, {'error': 'Unexpected FLM log query'})
return
filename, body = training_results_source.download()
if self.require_session():
self.attachment(filename, body, 'application/json; charset=utf-8')
elif path == '/api/flm/training-results':
if not self.require_session():
return
@@ -0,0 +1,92 @@
"""Support export remains useful when learning fails, without exporting private logs."""
import http.client
import json
from pathlib import Path
import tempfile
import threading
from types import SimpleNamespace
import unittest
from unittest.mock import patch
from openpilot.starpilot.flm.offroad_cache import AssessmentCache, directory_for_params
from openpilot.starpilot.galaxy.access import GalaxyAccessOwner
from openpilot.starpilot.galaxy.flm_diagnostics import download
from openpilot.starpilot.galaxy.flm_training_results import FlmTrainingResults
from openpilot.starpilot.galaxy.server import make_server
class TestDiagnostics(unittest.TestCase):
def test_failed_reviews_skips_counts_and_version_survive_without_private_payloads(self):
with tempfile.TemporaryDirectory() as temporary:
root = Path(temporary)
params = SimpleNamespace(get_param_path=lambda key: str(root / key))
(root / 'GitCommit').write_text('a' * 40)
(root / 'CarParams').write_text('private-vin')
(root / 'AccessToken').write_text('private-token')
cache = AssessmentCache(directory_for_params(params))
cache.checkpoint({'input_fingerprint': 'b' * 64, 'result': {'status': 'unavailable', 'reason': 'Assessment cache full',
'skipped_routes': [['00000049--1b13f9d9d3', 'incomplete or trailing zstd frame']],
'analysis_counts': {'recorded_tracking': 83433}}})
name, body = download({'current': {'status': 'unavailable', 'reason': 'Assessment cache full', 'details': {
'CarParams': 'private-vin', 'Recorded steering observations': 83433}}, 'history': [
{'status': 'paused', 'reason': 'password=private-secret https://example.invalid/private-token'}]}, params)
result = json.loads(body)
self.assertEqual(name, 'starpilot-flm-logs.json')
self.assertEqual(result['GitCommit'], 'a' * 40)
self.assertEqual(result['current']['reason'], 'Assessment cache full')
self.assertEqual(result['checkpoints'][0]['skipped_drives'][0]['reason'], 'incomplete or trailing zstd frame')
self.assertEqual(result['current']['analysis']['Recorded steering observations'], 83433)
self.assertNotIn(b'private-vin', body)
self.assertNotIn(b'private-token', body)
self.assertNotIn(b'private-secret', body)
def test_export_does_not_create_an_absent_cache_or_restore_a_tune(self):
with tempfile.TemporaryDirectory() as temporary:
root = Path(temporary) / 'params'
root.mkdir()
params = SimpleNamespace(get_param_path=lambda key: str(root / key))
before = list(root.parent.iterdir())
_, body = download({}, params)
self.assertEqual(json.loads(body)['storage']['status'], 'not_created')
self.assertEqual(list(root.parent.iterdir()), before)
self.assertEqual(list(root.iterdir()), [])
def test_authenticated_attachment_and_query_refusal(self):
with tempfile.TemporaryDirectory() as temporary:
root = Path(temporary)
owner = GalaxyAccessOwner(root / 'access')
self.assertTrue(owner.configure('password123', lambda: True))
source = FlmTrainingResults(root / 'absent-report')
server = make_server(port=0, owner=owner, training_results=source, parked=lambda: True)
thread = threading.Thread(target=server.serve_forever, kwargs={'poll_interval': .01}, daemon=True)
thread.start()
def request(path, cookie=None, *, method='GET', body=None):
connection = http.client.HTTPConnection('127.0.0.1', server.server_port, timeout=3)
try:
headers = {'Forwarded': 'for=203.0.113.8', 'Origin': f'http://127.0.0.1:{server.server_port}', 'Content-Type': 'application/json'}
if cookie:
headers['Cookie'] = cookie
connection.request(method, path, body, headers)
response = connection.getresponse()
return response.status, dict(response.getheaders()), response.read()
finally:
connection.close()
try:
with patch.object(source, 'download', wraps=source.download) as reader:
self.assertEqual(request('/api/flm/logs/download')[0], 401)
reader.assert_not_called()
status, headers, _ = request('/api/auth/login', method='POST', body=json.dumps({'password': 'password123'}))
self.assertEqual(status, 200)
cookie = headers['Set-Cookie'].split(';')[0]
self.assertEqual(request('/api/flm/logs/download?path=secret', cookie)[0], 400)
status, headers, body = request('/api/flm/logs/download', cookie)
self.assertEqual(status, 200)
self.assertIn('starpilot-flm-logs.json', headers['Content-Disposition'])
self.assertEqual(json.loads(body)['current']['reason'], 'learner_report_unavailable')
finally:
server.shutdown()
thread.join(timeout=2)
server.server_close()
@@ -35,6 +35,12 @@ assert.match(ideaExplanation({ target: null }), /did not support the same change
assert.match(ideaExplanation(route.suggestions[1]), /more evidence/)
assert.equal(reviewModel({ ...route, suggestions: [] }).count, 0)
assert.equal(reviewModel(null).count, 0)
const failedReview = FlmPage.computed.review.call({ offroad: route, current: { status: 'unavailable', reason: 'Assessment cache full' } })
assert.equal(failedReview.title, 'Drive review could not finish')
assert.match(failedReview.description, /latest analysis could not be saved/)
assert.doesNotMatch(failedReview.description, /No new change was saved/)
assert.match(FlmPage.template, /Latest review incomplete/)
assert.match(FlmPage.template, /v-if="!bluetooth"[^>]*href="\.\/api\/flm\/logs\/download"/)
assert.equal(reviewModel({ ...route, configurationState: 'ready_for_next_drive' }).tone, 'saved')
assert.equal(reviewModel({ ...route, configurationState: 'rolled_back' }).title, 'Your previous tune was restored')
assert.equal(reviewModel({ ...route, saved: true }).title, 'A configuration change was reported')
@@ -239,6 +239,7 @@ const REASONS = {
accepted_target_currently_acknowledged: "The controller acknowledged the accepted correction.",
}
export function learningReason(reason) {
if (reason === "Assessment cache full") return "FLM ran out of space in its review history. The latest analysis could not be saved; this does not mean your saved tune was erased."
if (Object.hasOwn(REASONS, reason)) return REASONS[reason]
const pattern = /^observed_(understeer|oversteer|late_turn_in|early_turn_in|unwind_too_slow|unwind_too_fast|low_speed_unwillingness|center_chatter|notchy_mid_curve)_(left|right|center)$/.exec(reason)
if (pattern) {
+7 -4
View File
@@ -5,6 +5,7 @@ import { SettingsFeed, settingsBusy } from "./settings.js"
import { GalaxySettingRow, settingControl } from "./galaxy-setting-row.js"
import { PollTimer, connectionError } from "./polling.js"
import { requestJson } from "./startup.js"
import { bluetoothConnection } from "./bluetooth-notice.js"
import { PlotGraph, PlotsPage, chartGeometry } from "./plots.js"
import { validTrainingResults, readable, detailText, surfaceRows, coordinateText, trackingView, measurementText, validTrackingValues, trackingPlotView, sourceSeconds, validLearningPreference, SURFACE_GROUPS, tunerStatus, learningReason, sourceCaptureCounts, historyTitle, offroadView, FRICTION_NAMES, offroadCoordinateEvidence, recommendationText } from "./flm-training-results.js"
@@ -45,7 +46,7 @@ export const FlmPage = {
components: { GxState, GxNotice, GxDialog, PlotGraph, PlotsPage, GalaxySettingRow },
props: { initialView: { type: String, default: "overview" }, mode: { type: String, required: true }, unauthorized: { type: Function, required: true },
go: { type: Function, default: path => { window.location.hash = path } } },
data: () => ({ report: null, error: "", loading: false, request: null, receivedAt: 0, now: 0,
data: () => ({ report: null, error: "", loading: false, request: null, receivedAt: 0, now: 0, bluetooth: bluetoothConnection(),
manualState: { status: "idle", data: null, pending: null, error: "" }, manualResetRequested: false, manualWrite: null,
headerOffset: 88, view: "overview", group: "balance", showAllHistory: false, groups: SURFACE_GROUPS }),
watch: {
@@ -132,6 +133,8 @@ export const FlmPage = {
description: otherVehicle ? 'These findings do not match your current vehicle. Waiting for its own completed-drive report.' :
'An analysis was reported, but it is missing information needed for a complete drive review. Waiting for the full report.' }
}
if (this.current?.status === 'unavailable') return { ...result, title: 'Drive review could not finish', tone: 'neutral',
description: learningReason(this.current.reason), next: 'This is an analysis problem, not a report that your saved tune was erased. Download FLM logs in Activity for details.' }
if (!this.offroad && this.current) return { ...result, title: this.state.title, description: this.state.description }
return result
},
@@ -316,7 +319,7 @@ export const FlmPage = {
<section v-if="view === 'overview'" id="tuner-panel-overview" role="tabpanel" aria-labelledby="tuner-tab-overview" class="gx-tuner__panel">
<section class="gx-card gx-tuner__drive" :data-tone="review.tone" aria-label="Drive review">
<div class="gx-tuner__drive-mark" aria-hidden="true"><i class="bi" :class="review.tone === 'saved' ? 'bi-check2-circle' : review.count ? 'bi-lightbulb' : 'bi-steering-wheel'"></i></div>
<div class="gx-tuner__drive-copy"><p class="gx-tuner__eyebrow">COMPLETED DRIVE REVIEW</p><h3>{{ review.title }}</h3><p>{{ review.description }}</p><p class="gx-tuner__summary"><template v-if="offroad?.evidenceDrives > 1">{{ offroad.evidenceDrives }} drives in your steering history · </template>{{ review.count }} {{ review.count === 1 ? 'finding' : 'findings' }} · <template v-if="offroad">{{ savedSummary }}</template><template v-else-if="trackingValues">{{ amount(acceptedCount) }} accepted · saving not confirmed</template><template v-else>Saved tune not reported</template></p><p v-if="offroad?.earlierDrive" class="gx-tuner__caption" data-role="retained-drive-findings">These suggestions come from an earlier drive. Newer driving is reviewed separately.</p></div>
<div class="gx-tuner__drive-copy"><p class="gx-tuner__eyebrow">COMPLETED DRIVE REVIEW</p><h3>{{ review.title }}</h3><p>{{ review.description }}</p><p class="gx-tuner__summary"><template v-if="current?.status === 'unavailable'">Latest review incomplete · </template><template v-else><template v-if="offroad?.evidenceDrives > 1">{{ offroad.evidenceDrives }} drives in your steering history · </template>{{ review.count }} {{ review.count === 1 ? 'finding' : 'findings' }} · </template><template v-if="offroad">{{ savedSummary }}</template><template v-else-if="trackingValues">{{ amount(acceptedCount) }} accepted · saving not confirmed</template><template v-else>Saved tune not reported</template></p><p v-if="offroad?.earlierDrive" class="gx-tuner__caption" data-role="retained-drive-findings">These suggestions come from an earlier drive. Newer driving is reviewed separately.</p></div>
<div class="gx-tuner__drive-actions"><button v-if="review.saved.length" type="button" class="gx-btn gx-btn--tonal" @click="selectView('tune')">{{ review.historical ? 'View earlier saved values' : 'View saved change' }}<i class="bi bi-arrow-right" aria-hidden="true"></i></button><button v-if="review.count" type="button" class="gx-btn gx-btn--tonal gx-tuner__review-button" data-action="view-findings" @click="selectView('tune')">{{ review.saved.length ? 'View other findings' : 'View ' + review.count + (review.count === 1 ? ' finding' : ' findings') }}<i class="bi bi-arrow-right" aria-hidden="true"></i></button></div>
</section>
<div class="gx-tuner__overview-grid"><section class="gx-card gx-tuner__section gx-tuner__response"><div class="gx-tuner__section-heading"><div><p class="gx-tuner__eyebrow">STEERING RESPONSE</p><h3>How your car followed the steering request</h3></div><span class="gx-tuner__pill">{{ trackingPlot ? 'Completed window' : offroad?.observed ? 'One recorded section · ' + recordedDuration + 's' : offroad ? 'Recorded drive' : 'Waiting for samples' }}</span></div>
@@ -366,10 +369,10 @@ export const FlmPage = {
</section></div>
</section>
<section v-show="view === 'plots'" id="tuner-panel-plots" role="tabpanel" aria-labelledby="tuner-tab-plots" class="gx-tuner__panel"><PlotsPage :mode="mode" :unauthorized="unauthorized" :active="view === 'plots'" embedded /></section>
<section v-if="view === 'activity'" id="tuner-panel-activity" role="tabpanel" aria-labelledby="tuner-tab-activity" class="gx-tuner__panel"><section class="gx-card gx-tuner__section"><div class="gx-tuner__section-heading"><div><p class="gx-tuner__eyebrow">LEARNING ACTIVITY</p><h3>What the tuner found</h3></div><span class="gx-tuner__pill">Reported observations</span></div>
<section v-if="view === 'activity'" id="tuner-panel-activity" role="tabpanel" aria-labelledby="tuner-tab-activity" class="gx-tuner__panel"><section class="gx-card gx-tuner__section"><div class="gx-tuner__section-heading"><div><p class="gx-tuner__eyebrow">LEARNING ACTIVITY</p><h3>What the tuner found</h3></div><a v-if="!bluetooth" class="gx-btn gx-btn--tonal" href="./api/flm/logs/download" download="starpilot-flm-logs.json"><i class="bi bi-download" aria-hidden="true"></i>Download FLM logs</a><span v-else class="gx-tuner__caption">Connect over Wi-Fi to download FLM logs.</span></div>
<template v-if="offroad"><h4>{{ review.title }}</h4><p>{{ review.description }}</p><div class="gx-tuner__area-tags"><span v-for="area in review.areas" :key="area">{{ area }}</span></div><button type="button" class="gx-btn gx-btn--tonal" @click="selectView('tune')">View drive findings</button><details class="gx-tuner__disclosure"><summary>Analysis details</summary><p>{{ offroad.retained || offroad.earlierDrive ? 'Earlier analyzed drive' : 'Completed drive' }} {{ offroad.route }}</p><p>{{ learningReason(offroad.reason) }}</p><p v-if="offroad.checks">{{ offroad.checks.passed }} / {{ offroad.checks.required }} controller and encoder windows passed.</p></details></template>
<ol v-if="historyRows.length" class="gx-tuner__timeline"><li v-for="(row, index) in historyRows" :key="index"><span class="gx-tuner__timeline-dot" :class="{ 'gx-tuner__timeline-dot--applied': row.applied }"></span><div><strong>{{ historyTitle(row.status) }}</strong><p>{{ learningReason(row.reason) }}</p><small>{{ row.time }}<template v-if="row.applied"> · Applied at that time</template></small></div></li></ol>
<div v-else-if="!offroad" class="gx-tuner__empty"><i class="bi bi-clock-history" aria-hidden="true"></i><h4>No findings reported yet</h4><p>This will show real collection, trial and rollback events as the learner reports them.</p></div>
<div v-else-if="!offroad" class="gx-tuner__empty"><i class="bi bi-clock-history" aria-hidden="true"></i><h4>{{ current?.status === 'unavailable' ? 'Drive review could not finish' : 'No findings reported yet' }}</h4><p>{{ current?.status === 'unavailable' ? learningReason(current.reason) : 'This will show real collection, trial and rollback events as the learner reports them.' }}</p></div>
<button v-if="(report?.history.length || 0) > 6" type="button" class="gx-btn gx-btn--tonal" @click="showAllHistory = !showAllHistory">{{ showAllHistory ? 'Show recent activity' : 'Show all reported activity' }}</button>
</section>
<details class="gx-card gx-tuner__section gx-tuner__disclosure"><summary>Diagnostics &amp; source details</summary><dl class="gx-tuner__diagnostics"><template v-if="tracking"><dt>Live learner state</dt><dd>{{ tracking.status }}</dd><dt>Live learner reason</dt><dd>{{ tracking.reason }}</dd></template><template v-if="trackingProgress"><dt>Paired inputs retained</dt><dd>{{ amount(trackingProgress.readyPairs) }}</dd></template><dt>Legacy collector state</dt><dd>{{ readable(current?.status) }}</dd><dt>Legacy collector reason</dt><dd>{{ readable(current?.reason) }}</dd><dt>Legacy retained blocks</dt><dd>{{ amount(current?.progress?.blocks) }}</dd><template v-if="current?.fit"><dt>Latest legacy fit</dt><dd>{{ readable(current.fit.status) }} · {{ readable(current.fit.reason) }}</dd><dt>Training / held-out windows</dt><dd>{{ amount(current.fit.trainWindows) }} / {{ amount(current.fit.heldoutWindows) }}</dd></template><template v-if="losses"><dt>Baseline / candidate loss</dt><dd>{{ losses.baseline.toPrecision(5) }} / {{ losses.learned.toPrecision(5) }}</dd></template><template v-for="[key, value] in details" :key="key"><dt>{{ detailLabel(key) }}</dt><dd>{{ detailText(value) }}</dd></template></dl>
+1 -1
View File
@@ -1 +1 @@
{"protected_inventory_sha256": "a2135cc530bdaa6fdb759c7641c4cca606f13e88b59244414bbb14e217e7565b", "schema_version": 1}
{"protected_inventory_sha256": "b7f4bdfcb5acb29ea8eb1776fc93b2f2a4c9d42165ce46b185399802d384eaca", "schema_version": 1}