Retain verified neutral tunes and continue automatic learning

This commit is contained in:
firestar5683
2026-11-15 05:42:03 -06:00
parent 06d25fc158
commit 50f281b816
11 changed files with 274 additions and 31 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ class StatusReport:
previous = {key: self.previous[key] for key in fields if key in self.previous}
if previous:
previous['retained_decision'] = self.previous.get('retained_decision', self.previous.get('reason', 'waiting_for_completed_drive'))
if self.previous.get('configuration_state') in ('ready_for_next_drive', 'accepted', 'accepted_after_drive', 'rolled_back'):
if self.previous.get('configuration_state') in ('ready_for_next_drive', 'accepted', 'accepted_after_drive', 'retained_after_drive', 'rolled_back'):
for key in ('configuration_state', 'configured_values', 'saved_adjustments', 'qualification_summary'):
if key in self.previous:
previous[key] = self.previous[key]
+6 -5
View File
@@ -125,7 +125,7 @@ def validate_row(row):
or row['completed_wall_ns'] <= 0
or type(row['sequence']) is not int
or not 1 <= row['sequence'] <= 1_000_000
or row['state'] not in ('ready_for_next_drive', 'accepted_after_drive', 'rolled_back')
or row['state'] not in ('ready_for_next_drive', 'accepted_after_drive', 'retained_after_drive', 'rolled_back')
):
raise ValueError('Route provenance/sequence required')
return scope
@@ -213,7 +213,7 @@ class RouteStorage:
doc = decode(expected)
row = doc.get(NAMESPACE, {}).get(scope.key())
if row is None or validate_row(row) != scope or row['state'] != 'ready_for_next_drive':
if row is None or validate_row(row) != scope or row['state'] not in ('ready_for_next_drive', 'retained_after_drive'):
return False
# Exact prior accepted map; no fit or synthetic new route is performed.
previous = dict(row['previous'])
@@ -230,15 +230,16 @@ class RouteStorage:
"""A distinct drive resolves a trial or records one bounded retry."""
from openpilot.starpilot.flm.learned_lifecycle import decode, encode
if outcome not in ('accepted_after_drive', 'rolled_back', 'pending') or not _hash(route_sha256) or not _hash(analysis_sha256):
if (outcome not in ('accepted_after_drive', 'retained_after_drive', 'rolled_back', 'pending')
or not _hash(route_sha256) or not _hash(analysis_sha256)):
raise ValueError('Explicit assessed next-drive outcome required')
doc = decode(expected)
row = doc.get(NAMESPACE, {}).get(scope.key())
if (
row is None
or validate_row(row) != scope
or row['state'] not in ('ready_for_next_drive', 'accepted_after_drive')
or row['state'] == 'accepted_after_drive'
or row['state'] not in ('ready_for_next_drive', 'accepted_after_drive', 'retained_after_drive')
or row['state'] in ('accepted_after_drive', 'retained_after_drive')
and outcome != 'rolled_back'
or route_sha256 in row['route_sha256s']
or type(completed_wall_ns) is not int
+67 -12
View File
@@ -4,7 +4,7 @@ A stored proposal is explicitly provisional. It never means live confirmation,
a native permission, physical causal proof, or a thirty-parameter identification.
"""
from dataclasses import replace
from dataclasses import asdict, replace
import hashlib
import json
import math
@@ -384,6 +384,27 @@ def assess_next_drive(trial, assessment, scope, *, trial_started=True, recorded_
}
def neutral_native_review(outcome, checks):
"""A comparable, verified drive can finish a review without proving benefit.
Missing comparisons and mere elapsed drives never count. The original
regression predicates and both actual-map/prior-map native checks remain
required; the worker separately deduplicates original recording bytes.
"""
comparisons = outcome.get('comparisons', ())
if outcome['outcome'] != 'pending' or not comparisons or not checks or not all(r['qualified'] for r in checks):
return False
if any(type(c.get('independent')) is not list or len(c['independent']) != 2 for c in comparisons):
return False
return all(
r.get('worse') is False and r.get('input_standardized') is True and r.get('residual_input_comparable') is True
and (r.get('no_smoothness_regression') is True if r.get('kind') == 'uncommanded_residual_v1' else
r.get('fit_supported') is True and all(r.get(key) is True for key in
('no_oscillation_regression', 'no_overshoot_regression', 'no_peak_error_regression')))
for comparison in comparisons for r in comparison['independent']
)
def recorded_recommendations(assessment, previous, report):
"""Publish original candidates independently of automatic qualification.
@@ -529,7 +550,7 @@ def recent_findings(cache, results, display):
from openpilot.starpilot.flm.offroad_surface import route_bounds, route_values
latest = results[0]
if latest.get('status') not in ('collecting', 'ready_for_next_drive', 'accepted_after_drive', 'rolled_back'):
if latest.get('status') not in ('collecting', 'ready_for_next_drive', 'accepted_after_drive', 'retained_after_drive', 'rolled_back'):
return display
def source(value):
@@ -1050,9 +1071,16 @@ class OffroadWorker:
selected_profile_windows = 0
actual_drive = getattr(assessment, 'single_drive', None)
actual_drive = actual_drive if type(actual_drive) is CompletedAssessment else assessment
retained_comparison = None
if row is not None and row['state'] == 'retained_after_drive':
retained_comparison = assess_next_drive(
trial_document(self.cache, row['analysis_sha256']), actual_drive, scope, recorded_backlog=route != latest,
previous_segments=trial_segment_history(self.cache, row['analysis_sha256']),
)
if row is not None and assessment.receipt.source_sha256 in row['route_sha256s']:
reason = 'this_completed_drive_already_assessed'
elif row is not None and (row['state'] == 'ready_for_next_drive' or quality_withdrawn(actual_drive, scope, row['values'])):
elif row is not None and (row['state'] == 'ready_for_next_drive' or quality_withdrawn(actual_drive, scope, row['values'])
or retained_comparison is not None and retained_comparison['outcome'] == 'rolled_back'):
trial_sha256, trial = trial_origin(self.cache, row['analysis_sha256'])
observed_checks = []
if not quality_withdrawn(actual_drive, scope, row['values']):
@@ -1068,12 +1096,26 @@ class OffroadWorker:
{'qualified': actual['qualified'] and contribution['qualified'], 'actual_recorded_map': actual, 'compared_with_prior_map': contribution}
)
started = os.path.lexists(self.cache.directory / ('trial-' + row['analysis_sha256'] + '.json'))
attempts = self.cache.get(row['analysis_sha256']).get('inconclusive_drives', 0)
previous_review = self.cache.get(row['analysis_sha256'])
attempts = previous_review.get('inconclusive_drives', 0)
if type(attempts) is not int or not 0 <= attempts <= 2**53 - 1:
raise ValueError('Valid inconclusive trial count required')
neutral_drives = previous_review.get('neutral_native_drives', 0)
if type(neutral_drives) is not int or not 0 <= neutral_drives <= 2:
raise ValueError('Valid verified neutral drive count required')
neutral_reviews = previous_review.get('neutral_native_reviews', [])
if (type(neutral_reviews) is not list or len(neutral_reviews) != neutral_drives
or any(type(d) is not str for d in neutral_reviews) or len(set(neutral_reviews)) != len(neutral_reviews)):
raise ValueError('Source-bound neutral review receipts required')
neutral_reviews = list(neutral_reviews)
for digest in neutral_reviews:
proof = self.cache.get(digest)
if proof.get('kind') != 'neutral_native_drive_review' or proof.get('trial_analysis_sha256') != trial_sha256:
raise ValueError('Neutral review belongs to another trial')
segments, history_complete = trial_source_history(self.cache, row['analysis_sha256'])
outcome = assess_next_drive(trial, actual_drive, scope, trial_started=started, recorded_backlog=route != latest,
previous_segments=segments)
outcome = (retained_comparison if retained_comparison is not None else
assess_next_drive(trial, actual_drive, scope, trial_started=started, recorded_backlog=route != latest,
previous_segments=segments))
history_limited = not history_complete and outcome['outcome'] != 'rolled_back' and outcome.get('counts_as_new_drive', True)
if history_limited:
outcome = dict(outcome, outcome='pending', reason='trial_source_history_capacity_reached', counts_as_new_drive=False)
@@ -1088,17 +1130,28 @@ class OffroadWorker:
'causal_road_benefit_proven': False,
'comparisons': outcome['comparisons'],
}
from openpilot.starpilot.flm.offroad_route import original_segment_hashes
for receipt in (report['route'], *report.get('evidence_sources', ())):
segments.update(original_segment_hashes(receipt.get('segments', ())))
history_complete &= len(segments) <= MAX_TRIAL_SEGMENTS
if (started and counts_as_new_drive and history_complete and len(actual_drive.evidence_sources) <= 1
and original_segment_hashes(actual_drive.receipt.segments)
and neutral_native_review(outcome, observed_checks)):
neutral_reviews.append(self.cache.put({
'kind': 'neutral_native_drive_review', 'trial_analysis_sha256': trial_sha256,
'source_receipt': asdict(actual_drive.receipt), 'comparisons': outcome['comparisons'],
'all_actual_next_drive_checks': observed_checks,
}))
neutral_drives = min(neutral_drives + 1, 2)
if neutral_drives == 2:
outcome = dict(outcome, outcome='retained_after_drive', reason='independent_actual_tracking_stable')
if outcome['outcome'] == 'pending' and (not started or not counts_as_new_drive and not history_limited):
status, reason = 'ready_for_next_drive', outcome['reason']
report['unused_recording_review'] = outcome
report['recorded_tracking'] = trial.get('assessment', {}).get('recorded_tracking')
else:
from openpilot.starpilot.flm.offroad_route import original_segment_hashes
for receipt in (report['route'], *report.get('evidence_sources', ())):
segments.update(original_segment_hashes(receipt.get('segments', ())))
# shortcut: beyond 4096 source segments retain the tune; require a new trial before crediting more evidence.
history_complete &= len(segments) <= MAX_TRIAL_SEGMENTS
record = {
'kind': 'next_drive_outcome',
'policy': POLICY,
@@ -1108,6 +1161,8 @@ class OffroadWorker:
'assessment': report,
'all_actual_next_drive_checks': observed_checks,
'inconclusive_drives': attempts,
'neutral_native_drives': neutral_drives,
'neutral_native_reviews': neutral_reviews,
**outcome,
}
digest = self.cache.put(record)
@@ -1305,7 +1360,7 @@ class OffroadWorker:
result = {
'status': status,
'reason': reason,
'configuration_changed': saved,
'configuration_changed': saved and status != 'retained_after_drive',
'policy': POLICY,
'completed_route': assessment.receipt.route_id,
'source_is_latest': assessment.receipt.route_id == latest['routeId'],
@@ -60,17 +60,19 @@ class TestEarlySteeringSuggestions(unittest.TestCase):
class TestRetainedTrialSources(unittest.TestCase):
def drive(self, fixture, params, cache, directory, digit, *, groups=(), stops=()):
def drive(self, fixture, params, cache, directory, digit, *, groups=(), stops=(), qualified=True, source_digit=None, pooled=False):
runner, inventory = fixture.worker(params, cache, directory, digit)
original_assessor = runner.assessor
def assess(*args, **kwargs):
result = original_assessor(*args, **kwargs)
return replace(result, receipt=replace(result.receipt, segments=((digit, digit * 64, 1),)),
stable_groups=groups, quality_stop_markers=stops)
segments = () if source_digit == '' else ((digit, (source_digit or digit) * 64, 1),)
return replace(result, receipt=replace(result.receipt, segments=segments),
stable_groups=groups, quality_stop_markers=stops,
evidence_sources={'first': result, 'second': result} if pooled else {})
runner.assessor = assess
runner.checker = lambda *args, **kwargs: {'qualified': True} # Declared unit qualification, no native/road claim.
runner.checker = lambda *args, **kwargs: {'qualified': qualified} # Declared unit qualification, no native/road claim.
row = decode(read_saved(params, KEY, MAX_BYTES)[0])['routeSurfaces'][scope().key()]
self.assertTrue(cache.claim_trial(row['analysis_sha256'], digit * 32))
with patch.object(worker, 'latest_route', return_value=inventory):
@@ -192,6 +194,171 @@ class TestRetainedTrialSources(unittest.TestCase):
restored = decode(read_saved(params, KEY, MAX_BYTES)[0])['routeSurfaces'][scope().key()]
self.assertEqual(restored['values'], accepted['values'], 'A later trial restores its immediate prior tune, not the first baseline')
@staticmethod
def neutral_groups():
original, observed = fixtures.TestComparableNextDriveOutcomes.documents()
group, = observed.stable_groups
for role in ('training', 'heldout'):
current = group['cohorts'][0][role]
group['cohorts'][0][role] = dict(original['before'][role], windows=current['windows'], source_sha256=current['source_sha256'])
return observed.stable_groups
def test_two_verified_neutral_drives_finish_review_without_changing_values_or_claiming_improvement(self):
from openpilot.starpilot.flm.offroad_quality import from_configuration
from openpilot.starpilot.flm.offroad_runtime import configure
fixture = fixtures.TestBoundedInconclusiveTrialLifecycle()
with tempfile.TemporaryDirectory() as directory:
params, cache, original, root = fixture.saved_trial(directory)
for digit, expected in (('2', 'ready_for_next_drive'), ('3', 'retained_after_drive')):
result = self.drive(fixture, params, cache, directory, digit, groups=self.neutral_groups())
self.assertEqual(result['status'], expected)
raw = read_saved(params, KEY, MAX_BYTES)[0]
row = decode(raw)['routeSurfaces'][scope().key()]
self.assertEqual(row['values'], original['values'])
self.assertEqual(row['previous'], original['previous'])
self.assertEqual(cache.get(root), original)
review = cache.get(row['analysis_sha256'])
self.assertEqual(review['neutral_native_drives'], 2)
proofs = [cache.get(digest) for digest in review['neutral_native_reviews']]
self.assertEqual({p['source_receipt']['source_sha256'] for p in proofs}, {'2' * 64, '3' * 64})
self.assertTrue(all(p['trial_analysis_sha256'] == root for p in proofs))
self.assertTrue(all(not r['improved'] and not r['worse'] for c in review['comparisons'] for r in c['independent']))
self.assertFalse(result['road_improvement_confirmed'])
self.assertFalse(result['configuration_changed'], 'Completing a neutral review is not another adjustment')
with patch('openpilot.starpilot.flm.offroad_runtime.configuration_data', return_value=(scope(), (), ())):
owner, _ = configure(None, None, SimpleNamespace(), params, manual_status='not_configured')
self.assertIsNotNone(owner)
self.assertFalse(owner.frame_allowed, 'A retained store still cannot supply actual frame permission')
with patch.object(worker, '_current_scope', return_value=scope()):
guard = from_configuration(None, params, cache.directory, vehicle_session='f' * 32)
self.assertIsNone(guard.stopped)
self.assertEqual(guard.baseline, tuple(original['gross_baseline']), 'The original gross-regression guard remains')
self.assertTrue(RouteStorage(params).rollback(scope=scope(), expected=raw, authorized=lambda: True))
self.assertEqual(decode(read_saved(params, KEY, MAX_BYTES)[0])['routeSurfaces'][scope().key()]['values'], original['previous'])
def test_missing_unverified_easier_or_copied_drives_cannot_finish_neutral_review(self):
fixture = fixtures.TestBoundedInconclusiveTrialLifecycle()
for case in ('missing', 'native_refused', 'different_input', 'copied', 'no_segments', 'pooled'):
with self.subTest(case=case), tempfile.TemporaryDirectory() as directory:
params, cache, _, _ = fixture.saved_trial(directory)
self.drive(fixture, params, cache, directory, '2', groups=self.neutral_groups())
group = self.neutral_groups()
if case == 'different_input':
for role in ('training', 'heldout'):
group[0]['cohorts'][0][role]['reference_rms'] = 1.2
result = self.drive(fixture, params, cache, directory, '3', groups=() if case == 'missing' else group,
qualified=case != 'native_refused', source_digit='2' if case == 'copied' else '' if case == 'no_segments' else None,
pooled=case == 'pooled')
self.assertEqual(result['status'], 'ready_for_next_drive')
row = decode(read_saved(params, KEY, MAX_BYTES)[0])['routeSurfaces'][scope().key()]
self.assertEqual(cache.get(row['analysis_sha256'])['neutral_native_drives'], 1)
def test_genuine_regression_and_safety_rollback_win_over_a_prior_neutral_drive(self):
from openpilot.starpilot.flm.offroad_surface import stop_marker
fixture = fixtures.TestBoundedInconclusiveTrialLifecycle()
for cause in ('measurement', 'safety'):
with self.subTest(cause=cause), tempfile.TemporaryDirectory() as directory:
params, cache, original, _ = fixture.saved_trial(directory)
self.drive(fixture, params, cache, directory, '2', groups=self.neutral_groups())
groups = self.neutral_groups()
groups[0]['cohorts'][0]['heldout']['error_reversal_hz'] = 2.
stops = ({'reason': stop_marker(scope().key(), original['values'], 'gross_tracking_or_oscillation_worse')},) if cause == 'safety' else ()
result = self.drive(fixture, params, cache, directory, '3', groups=groups, stops=stops)
self.assertEqual(result['status'], 'rolled_back')
self.assertEqual(result['configured_values'], original['previous'])
def test_later_measured_regression_or_safety_still_rolls_back_a_finished_neutral_review(self):
from openpilot.starpilot.flm.offroad_surface import stop_marker
fixture = fixtures.TestBoundedInconclusiveTrialLifecycle()
for cause in ('measurement', 'safety'):
with self.subTest(cause=cause), tempfile.TemporaryDirectory() as directory:
params, cache, original, _ = fixture.saved_trial(directory)
for digit in '23':
self.drive(fixture, params, cache, directory, digit, groups=self.neutral_groups())
groups = self.neutral_groups()
groups[0]['cohorts'][0]['heldout']['error_reversal_hz'] = 2.
stops = ({'reason': stop_marker(scope().key(), original['values'], 'gross_tracking_or_oscillation_worse')},) if cause == 'safety' else ()
result = self.drive(fixture, params, cache, directory, '4', groups=groups, stops=stops)
self.assertEqual(result['status'], 'rolled_back')
self.assertEqual(result['configured_values'], original['previous'])
def test_a_finished_neutral_review_allows_a_new_checked_knob_and_its_own_rollback(self):
from openpilot.starpilot.flm.offroad_processor import CompletedAssessment, window_demand
from openpilot.starpilot.flm.offroad_route import RouteReceipt, SelectedSourceReceipt
from openpilot.starpilot.flm.offroad_prior_inputs import PriorOriginals
from openpilot.starpilot.flm.offroad_evidence import RouteWindow, window_identity, tracking_metrics
from openpilot.starpilot.flm.offroad_store import startup_row
from openpilot.starpilot.flm.tests.test_pid_coordinate_proposals import center_acceleration_windows
fixture = fixtures.TestBoundedInconclusiveTrialLifecycle()
with tempfile.TemporaryDirectory() as directory:
params, cache, original, _ = fixture.saved_trial(directory)
for digit in '23':
self.drive(fixture, params, cache, directory, digit, groups=self.neutral_groups())
def originals(route):
result = []
for segment, window in enumerate(center_acceleration_windows(6)):
offset = segment * 4_000_000_000
points = tuple(replace(p, route=route, segment=segment, mono_ns=p.mono_ns + offset,
control_header_ns=p.control_header_ns + offset, output_header_ns=p.output_header_ns + offset)
for p in window.points)
result.append(RouteWindow(window_identity(points), points))
return tuple(result)
current, prior_windows = originals('declared-new-knob'), originals('declared-independent-knob')
cohort, = analyze(current, {n: original['values'][n] for n in NAMES})['cohorts']
target = dict(original['values'], **cohort['proposal']['values'])
metadata = dict(original['original_metadata'], route_values=tuple(original['values'].items()))
spans = [{'identity': w.identity, 'route': w.points[0].route, 'segment': w.points[0].segment,
'start_ns': w.points[0].mono_ns, 'end_ns': w.points[-1].mono_ns,
'metrics': tracking_metrics(w.points), 'demand': window_demand(w)} for w in current]
group = {'original_metadata': metadata, 'original_context_sha256': 'f' * 64,
'cohorts': [cohort], 'selected_original_windows': spans}
receipt = RouteReceipt('declared-new-knob', '4' * 64, (('current', '6' * 64, 1),), scope().cp_sha256, 1, 2, 105, ())
inventory = {'routeId': receipt.route_id}
cp = SimpleNamespace(carFingerprint='declared-unit-car')
assessment = CompletedAssessment(receipt, (group,), {}, cp, (), inventory)
prior = PriorOriginals(cp, SelectedSourceReceipt('declared-independent-knob', '5' * 64,
(('prior', '7' * 64, 1),), scope().cp_sha256, 1, 2, 104, (), (0,)), {},
tuple({'identity': w.identity, 'original_metadata': metadata} for w in prior_windows), prior_windows)
calls = []
def assessed(params, root, previous, *, permitted):
self.assertEqual(previous(assessment.cp), original['values'])
return assessment
def native_protocol(actual, source, ids, values, root, *, permitted):
# Declared native protocol only. Real statistical estimation,
# independent-drive selection, validation and storage run unchanged.
calls.append((actual.receipt.route_id, tuple(ids)))
return [{'window': wid, 'qualified': True, 'numerical': {'qualified': True, 'changed_frames': 1},
'registered_encoder': {'qualified': True, 'candidate_changed_emissions': 1}} for wid in ids]
runner = worker.OffroadWorker(params, directory, cache, permitted=lambda: True, assessor=assessed,
prior_provider=lambda *args, **kwargs: prior, scope_for=lambda cp, params: scope())
with patch.object(worker, 'latest_route', return_value=inventory), \
patch('openpilot.starpilot.flm.offroad_checks._original_results', native_protocol), \
patch('openpilot.starpilot.flm.runtime_adapter_registry.car_params_digest', return_value=scope().cp_sha256):
result = runner.run_once()
self.assertEqual([r for r, _ in calls], ['declared-new-knob', 'declared-independent-knob'])
self.assertTrue(all(len(ids) == 6 for _, ids in calls), 'All original training and independent validation rows remain required')
self.assertEqual(result['configuration_state'], 'ready_for_next_drive')
self.assertEqual(result['configured_values'], target)
fresh, _ = startup_row(params, scope())
self.assertEqual(fresh['values'], target)
self.assertEqual(fresh['previous'], original['values'])
self.assertEqual(set(fresh['route_sha256s']), {'4' * 64, '5' * 64})
proof = cache.get(fresh['analysis_sha256'])['native_training_feasibility']
self.assertEqual(proof['validation_evaluations'], 1)
self.assertTrue(proof['independent_tracking']['qualified'])
raw = read_saved(params, KEY, MAX_BYTES)[0]
self.assertTrue(RouteStorage(params).rollback(scope=scope(), expected=raw, authorized=lambda: True))
self.assertEqual(decode(read_saved(params, KEY, MAX_BYTES)[0])['routeSurfaces'][scope().key()]['values'], original['values'])
class TestLegacyInconclusiveRejection(unittest.TestCase):
def legacy(self, cache, *, reason='trial_inconclusive_drive_limit', comparisons=None, markers=()):
@@ -57,7 +57,7 @@ const updating = reviewModel(route, true, true)
assert.equal(updating.description, review.description, 'Background progress must not alternate the drive explanation')
assert.doesNotMatch(updating.description, /Refresh|Reconnect/)
assert.equal(updating.next, review.next)
for (const state of ['ready_for_next_drive', 'accepted', 'accepted_after_drive', 'rolled_back']) {
for (const state of ['ready_for_next_drive', 'accepted', 'accepted_after_drive', 'retained_after_drive', 'rolled_back']) {
const savedRoute = { ...route, configurationState: state, savedValues: { highway_center_taper_max: .005 } }
const completed = reviewModel(savedRoute)
const inProgress = reviewModel(savedRoute, true, true)
@@ -123,6 +123,14 @@ configured.current.details['Saved route configuration state'] = 'ready_for_next_
assert.equal(tunerStatus(configured, true, true).title, 'Tune saved for the next drive')
assert.equal(configured.current.application.applied, false, 'Saving is not current application')
assert.notEqual(tunerStatus(configured, false, true).title, 'Tune saved for the next drive', 'Old reports cannot assert current saved state')
const retained = structuredClone(configured)
retained.current.details['Saved route configuration state'] = 'retained_after_drive'
retained.current.details['Analysis decision'] = 'independent_actual_tracking_stable'
assert.equal(offroadView(retained).configurationState, 'retained_after_drive')
assert.equal(tunerStatus(retained, true, true).title, 'Completed drive analyzed')
assert.match(tunerStatus(retained, true, true).description, /adjustments are kept/)
assert.doesNotMatch(tunerStatus(retained, true, true).description, /improv|proven|uncertain/i)
assert.equal(retained.current.application.applied, false, 'Retained disk values do not establish current application')
const fitting = structuredClone(completed)
fitting.current.status = 'fitting'; fitting.current.reason = 'analyzing_last_completed_drive'
assert.equal(tunerStatus(fitting, true, true).title, 'Analyzing your drive')
@@ -22,7 +22,7 @@ const hints = [['highway_center_taper_max', .005], ['friction_threshold_low', .0
['friction_threshold_mid', .004], ['friction_threshold_fast', .005], ['friction_threshold_highway', .006]]
function report() {
if (scenario === 'empty') return { version: 1, history: [], current: null }
const saved = ['saved', 'saved-retained', 'inconclusive', 'applied'].includes(scenario)
const saved = ['saved', 'saved-retained', 'inconclusive', 'neutral-reviewed', 'applied'].includes(scenario)
const application = scenario === 'applied'
const rows = SURFACE_NAMES.map(name => [name, saved && name === 'highway_center_taper_max' ? .005 : 0])
const start = 1_000_000_000, points = Array.from({ length: 24 }, (_, i) =>
@@ -47,6 +47,11 @@ function report() {
value.current.details['Analysis decision'] = value.current.reason
value.current.details['Automatic configuration changed'] = false
}
if (scenario === 'neutral-reviewed') {
value.current.status = 'retained_after_drive';value.current.reason = 'independent_actual_tracking_stable'
Object.assign(value.current.details, { 'Analysis decision': value.current.reason,
'Saved route configuration state': 'retained_after_drive', 'Automatic configuration changed': false })
}
if (application) value.current.details['Actual full surface coordinates'] = rows
if (scenario === 'stale') { value.current.fresh = false; value.current.ageSeconds = 20 }
if (scenario === 'retained' || scenario === 'saved-retained') {
@@ -271,8 +276,14 @@ try {
}
}
await viewport(416);await execute('document.documentElement.dataset.theme="dark"')
for (const name of ['none', 'empty', 'saved', 'inconclusive', 'rollback', 'recent-rollback', 'conflict', 'contradictory', 'stale', 'retained', 'earlier-drive', 'wrong-car', 'incomplete', 'unknown-change']) {
for (const name of ['none', 'empty', 'saved', 'inconclusive', 'neutral-reviewed', 'rollback', 'recent-rollback', 'conflict', 'contradictory', 'stale', 'retained', 'earlier-drive', 'wrong-car', 'incomplete', 'unknown-change']) {
await change(name);await layout(`state/${name}`);await capture(name)
if (name === 'neutral-reviewed') {
assert(await execute('return window.flm.review.title === "Your learned tune is saved" && window.flm.offroad.savedCount === 1'))
assert(await execute('return !window.flm.report.current.application.applied && !window.flm.offroad.saved'))
assert(await execute('return !/improv|uncertain|not proven/i.test(window.flm.review.description)'))
checks.push('neutral-review/saved-values-without-new-adjustment-or-benefit-claim')
}
if (name === 'inconclusive') {
assert.equal(await execute('return window.flm.offroad.savedValues.highway_center_taper_max'), .005)
assert.equal(await execute('return window.flm.currentApplied'), false)
@@ -61,20 +61,20 @@ export function reviewModel(route, historical = false, updating = false) {
description = 'The trial was rolled back. Any other ideas below are separate from the restored tune.'
tone = 'neutral'
next = 'The restored values are listed in Your tune. Other findings are separate ideas.'
} else if (['accepted', 'accepted_after_drive'].includes(route.configurationState)) {
} else if (['accepted', 'accepted_after_drive', 'retained_after_drive'].includes(route.configurationState)) {
title = 'Your learned tune is saved'
description = 'Your learned values are saved. In-use status is reported separately during driving.'
tone = 'saved'
next = 'The learned values are saved. The controller reports their use separately during driving.'
}
if (route.saved && !['ready_for_next_drive', 'accepted', 'accepted_after_drive', 'rolled_back'].includes(route.configurationState)) {
if (route.saved && !['ready_for_next_drive', 'accepted', 'accepted_after_drive', 'retained_after_drive', 'rolled_back'].includes(route.configurationState)) {
title = 'A configuration change was reported'
description = 'The report does not identify its saved state. Check the latest report before treating it as ready for the next drive.'
tone = 'neutral'
next = 'Wait for a complete saved-state report before treating the change as ready.'
}
if (historical && !updating) {
if (saved.length || ['ready_for_next_drive', 'accepted', 'accepted_after_drive'].includes(route.configurationState)) {
if (saved.length || ['ready_for_next_drive', 'accepted', 'accepted_after_drive', 'retained_after_drive'].includes(route.configurationState)) {
tone = 'neutral'
title = 'Previously saved tune'
description = 'These saved values come from an earlier report. Current use is shown separately during driving.'
@@ -204,6 +204,7 @@ const REASONS = {
recorded_provisional_suggestion: "Your drive produced this steering suggestion. Review the setting while parked.",
conflicting_recorded_candidates: "Different windows suggested different settings. No single setting is recommended.",
trial_started_waiting_for_comparable_drive: "Your saved steering adjustments are kept for the next drive.",
independent_actual_tracking_stable: "Your saved steering adjustments are kept. Auto Learn continues reviewing your drives.",
trial_measurement_inconclusive: "Your saved steering adjustments are kept for the next drive.",
trial_inconclusive_drive_limit: "Three trial drives did not establish an improvement. The prior tune was restored.",
next_drive_observed_tracking_worse: "Comparable driving showed a steering regression, so the prior tune was restored.",
@@ -324,7 +325,7 @@ export function offroadView(report) {
Array.isArray(refused) && refused.length <= 36 && refused.every(r => Array.isArray(r) && r.length === 2 && text(r[0]) && stamp(r[1])) ?
{ passed: checked[0], required: checked[1], refusals: refused.map(([reason, count]) => ({ reason, count })) } : null
const configurationState = details['Saved route configuration state'] ?? null
const stored = ['ready_for_next_drive', 'accepted', 'accepted_after_drive', 'rolled_back'].includes(configurationState)
const stored = ['ready_for_next_drive', 'accepted', 'accepted_after_drive', 'retained_after_drive', 'rolled_back'].includes(configurationState)
const savedSurface = stored ? fullCoordinates(details['Full surface coordinates']) : null
const savedFriction = stored ? frictionCoordinates(details['Saved friction-curve adjustments']) : null
return { route: details['Completed drive analyzed'], samples: details['Recorded steering observations'],
+1 -1
View File
@@ -139,7 +139,7 @@ export const FlmPage = {
return result
},
savedSummary() {
if (this.offroad?.saved && !['ready_for_next_drive', 'accepted', 'accepted_after_drive', 'rolled_back'].includes(this.offroad.configurationState)) return 'Saved state not confirmed'
if (this.offroad?.saved && !['ready_for_next_drive', 'accepted', 'accepted_after_drive', 'retained_after_drive', 'rolled_back'].includes(this.offroad.configurationState)) return 'Saved state not confirmed'
return this.acceptedCount === null ? 'Saved count not reported' : this.amount(this.acceptedCount) + ' saved'
},
savedAdjustments() { return Object.entries(this.offroad?.savedValues || {}).filter(([, value]) => value !== 0).map(([name, value]) => ({ name, value })) },
+1 -1
View File
@@ -1 +1 @@
{"protected_inventory_sha256": "9fe21e83a7eee961aa630bc8786f5fd824f1786a8f651142aa4940af85312e63", "schema_version": 1}
{"protected_inventory_sha256": "05cf3d1a3f907e2194510a299e1d24048071757c53790f4faebb3bccbdf075db", "schema_version": 1}