Skip to content

Investigate unreachable temp: key discard in _extract_and_persist_state_delta #122

Description

@Alberto-Codes

Summary

During Story 6.2 implementation, a discovery was made that the temp: key discard logic in _extract_and_persist_state_delta (line ~723 of src/adk_secure_sessions/services/encrypted_session.py) is unreachable dead code.

Details

_trim_temp_delta_state removes temp: prefixed keys before _extract_and_persist_state_delta is called, so the temp: key check in the latter method never triggers. This is defensive dead code in a security-sensitive service.

Why it matters

  • Dead code in a security-critical path is a maintenance smell — it suggests the control flow isn't fully understood
  • Could mask future bugs if the call order changes and the defensive check silently swallows keys that should be persisted
  • Minor cognitive overhead for contributors reading the method

Suggested action

  1. Verify the call order with a test or trace to confirm the code is truly unreachable
  2. If confirmed unreachable, remove the dead branch
  3. If the defensive check is intentional (belt-and-suspenders), add a comment explaining why

Origin

Discovered during Story 6.2 (branch feat/docs-6-2-fix-schema-claims). Logged in dev completion notes but out of scope for that docs-only story.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions