Skip to content

Comments

Add naming conventions guide for descriptive variables and functions#2

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/suggest-variable-function-names
Draft

Add naming conventions guide for descriptive variables and functions#2
Copilot wants to merge 3 commits intomainfrom
copilot/suggest-variable-function-names

Conversation

Copy link

Copilot AI commented Jan 8, 2026

Repository lacked guidance on writing descriptive variable and function names. Added comprehensive documentation to establish naming standards.

Changes

  • Added NAMING_CONVENTIONS.md (548 lines)

    • General principles: clarity, consistency, context-awareness, pronounceability
    • Variable patterns: descriptive nouns, units, boolean prefixes, collections, constants
    • Function patterns: verb-noun structure, action words, boolean returns
    • Language-specific conventions: Python (snake_case), JavaScript/TypeScript (camelCase), Java, C#, Go
    • Anti-patterns: Hungarian notation, redundant context, abbreviations, magic numbers
    • Real-world examples: authentication, e-commerce carts, API handlers, data processing
  • Updated README.md

    • Added documentation section linking to naming guide

Example

# Before
def auth(u, p):
    r = db.get(u)
    if r and r['pw'] == hash(p):
        return True
    return False

# After
def authenticate_user(username, password):
    user_record = database.get_user_by_username(username)
    hashed_password = hash_password(password)
    
    if user_record and user_record['password_hash'] == hashed_password:
        return True
    return False
Original prompt

Suggest more descriptive variable and function names


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 8, 2026 10:41
Co-authored-by: giwaov <132751591+giwaov@users.noreply.github.com>
Co-authored-by: giwaov <132751591+giwaov@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor variable and function names for clarity Add naming conventions guide for descriptive variables and functions Jan 8, 2026
Copilot AI requested a review from giwaov January 8, 2026 10:44
Copy link
Owner

giwaov commented Jan 10, 2026

@copilot feat: Save conversation history to disk and reload on startup


Summary

Implements simple JSON-based conversation history persistence as requested in #985.

Changes

src/providers/llm_history_manager.py

  • Added json and os imports for file operations
  • Added HISTORY_FILE_PATH constant pointing to config/memory/conversation_history.json
  • Added _load_history() method - loads conversation history from JSON file on startup
  • Added _save_history() method - saves history to disk using atomic write (temp file + rename) to prevent corruption
  • Added clear_history() method - clears history from both memory and disk
  • Modified __init__ to set history_file_path and call _load_history() on initialization
  • Added _save_history() calls after each history append in the update_history decorator
  • Added _save_history() call after summarization completes

tests/providers/test_llm_history_manager.py

Added 8 new tests:

  • test_save_history_creates_file - Verifies JSON file creation
  • test_load_history_restores_messages - Verifies history restoration on startup
  • test_load_history_handles_missing_file - Graceful handling of missing file
  • test_load_history_handles_invalid_json - Graceful handling of corrupted JSON
  • test_load_history_handles_malformed_messages - Skips invalid messages
  • test_clear_history_removes_file - Verifies file cleanup
  • test_save_history_atomic_write - Verifies atomic write pattern (no temp files left)

Implementation Details

  • History is stored as a simple JSON array of {role, content} objects
  • Uses atomic write pattern (write to .tmp file, then os.replace()) to prevent corruption on crash
  • Loads existing history on LLMHistoryManager initialization
  • Auto-saves after each message is added to history
  • Gracefully handles missing files, invalid JSON, and malformed messages
  • No additional dependencies required

Closes #985

Copy link
Author

Copilot AI commented Jan 10, 2026

@copilot feat: Save conversation history to disk and reload on startup

--- ...

This comment appears to be for a different repository or PR. The current PR adds naming conventions documentation to a repository that contains only README.md and NAMING_CONVENTIONS.md files.

The requested feature (conversation history persistence with src/providers/llm_history_manager.py) would require a completely different codebase structure. Could you clarify if this comment was intended for a different PR or repository?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants