You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Mark as Found" creates a Log row (type "Found it"/"Attended", finder = the
configured username) when a cache is manually marked found. "Mark as Not
Found" currently clears cache.found/cache.found_date but deliberately
leaves that Log row in place — see the comment in cache_table.py's found/not-found handler:
It deliberately does NOT touch existing Log rows though: deleting/
rewriting log history risks destroying real, imported found logs (e.g. a
genuine earlier find from before this cache was re-marked), and there's
no reliable way to tell "the log this feature created" apart from "a real
imported log" well enough to safely delete just the former.
That caution turned out to matter beyond just the UI: #766 (found status not
surviving GPX round-trips) had to add an explicit guard so a stale log left
behind by an unmark doesn't get misread as "found" again on re-export/
re-import. The guard fixes the symptom, but the stale log itself is still
sitting in the database, which is confusing (a cache correctly showing "not
found" that still has a "Found it" log entry if you open its Logs tab) and
still slightly fragile (e.g. it would appear in the log list / log count
displayed elsewhere in the UI).
Proposed Improvement
The "no reliable way to tell them apart" concern turns out to be solvable
without a schema change: Log.log_id is only ever None for logs created
by this feature. Every import path — GPX (importer/__init__.py) and
GSAK database (gsak_importer.py) — always sets a real log_id (the GC.com
log GUID, or f"{gc_code}_{lLogId}" for GSAK-DB imports). "Mark as Found"
is the only code path that creates a Log row with log_id left unset
(see cache_table.py, the session.add(Log(...)) call — no log_id is
passed).
So "Mark as Not Found" can safely delete the found-type log it's clearing,
as long as it also checks log_id is None — i.e. only delete a log that:
matches the current user (finder_id/finder against gc_finder_id/gc_username, same matching already used elsewhere), AND
has log_type in FOUND_LOG_TYPES, AND
has log_id is None (proof it was created by this feature, not imported).
Any real imported found log — which always has a log_id — is left
untouched, even if it happens to belong to the current user. This should
fully resolve the original concern without needing to guess.
Notes
found_log_count should be decremented (not just left stale) when the
log is removed, mirroring the increment that happens on creation.
Once this ships, the GPX export/import does not preserve "found" status (sym never set to "Geocache Found") #766sym is None-only fallback guard technically
becomes less likely to ever see a stale log in practice for OpenSAK's own
exports — but it should stay in place regardless, since third-party GPX
sources (GSAK, etc.) can still legitimately omit <sym> and it's cheap
insurance either way.
Current State
"Mark as Found" creates a Log row (type "Found it"/"Attended", finder = the
configured username) when a cache is manually marked found. "Mark as Not
Found" currently clears
cache.found/cache.found_datebut deliberatelyleaves that Log row in place — see the comment in
cache_table.py's found/not-found handler:That caution turned out to matter beyond just the UI: #766 (found status not
surviving GPX round-trips) had to add an explicit guard so a stale log left
behind by an unmark doesn't get misread as "found" again on re-export/
re-import. The guard fixes the symptom, but the stale log itself is still
sitting in the database, which is confusing (a cache correctly showing "not
found" that still has a "Found it" log entry if you open its Logs tab) and
still slightly fragile (e.g. it would appear in the log list / log count
displayed elsewhere in the UI).
Proposed Improvement
The "no reliable way to tell them apart" concern turns out to be solvable
without a schema change:
Log.log_idis only everNonefor logs createdby this feature. Every import path — GPX (
importer/__init__.py) andGSAK database (
gsak_importer.py) — always sets a reallog_id(the GC.comlog GUID, or
f"{gc_code}_{lLogId}"for GSAK-DB imports). "Mark as Found"is the only code path that creates a
Logrow withlog_idleft unset(see
cache_table.py, thesession.add(Log(...))call — nolog_idispassed).
So "Mark as Not Found" can safely delete the found-type log it's clearing,
as long as it also checks
log_id is None— i.e. only delete a log that:finder_id/finderagainstgc_finder_id/gc_username, same matching already used elsewhere), ANDlog_typeinFOUND_LOG_TYPES, ANDlog_id is None(proof it was created by this feature, not imported).Any real imported found log — which always has a
log_id— is leftuntouched, even if it happens to belong to the current user. This should
fully resolve the original concern without needing to guess.
Notes
found_log_countshould be decremented (not just left stale) when thelog is removed, mirroring the increment that happens on creation.
sym is None-only fallback guard technicallybecomes less likely to ever see a stale log in practice for OpenSAK's own
exports — but it should stay in place regardless, since third-party GPX
sources (GSAK, etc.) can still legitimately omit
<sym>and it's cheapinsurance either way.
Expected Benefits
No response