Skip to content

fix: module_map.py docstring, ParseError context, and constant comment#251

Merged
fazxes merged 1 commit intomainfrom
fix/module-map-followups
Apr 9, 2026
Merged

fix: module_map.py docstring, ParseError context, and constant comment#251
fazxes merged 1 commit intomainfrom
fix/module-map-followups

Conversation

@fazxes
Copy link
Copy Markdown
Member

@fazxes fazxes commented Apr 9, 2026

Summary

Three small follow-up fixes from the PR #250 code review, all in nightshift/infra/module_map.py:

Test plan

  • New test test_parse_error_includes_subpackage_context verifies that a broken file in core/broken.py reports as core/broken.py and a broken top-level broken.py reports as broken.py -- two distinct entries with no collision
  • All 27 existing test_module_map.py tests still pass (including existing parse-error tests that rely on bare filename format for top-level files)
  • make check passes: ruff, mypy, 1165 pytest tests, dry-runs, ASCII check

Three follow-up fixes from PR #250 code review -- all in module_map.py:
- Update _dependency_order docstring to accurately describe slash-key tracking for subpackage entries (was incorrectly saying subpackage imports "are ignored")
- Fix ParseError.module to include subpackage path context (e.g. core/broken.py instead of bare broken.py) when package_dir is provided; add test verifying two files with the same name in different subpackages produce distinct error entries
- Add comment above _SUBPACKAGE_DIRS explaining why it stays in module_map.py (single consumer, encodes package layout not a tunable threshold)
@fazxes fazxes merged commit c32e527 into main Apr 9, 2026
7 checks passed
@fazxes fazxes deleted the fix/module-map-followups branch April 9, 2026 07:47
fazxes added a commit that referenced this pull request Apr 9, 2026
Replace sed with awk for role extraction to eliminate metacharacter injection
risk from agent-controlled log content. Add tr -cd 'a-z-' to restrict the
extracted string to safe characters only, then validate against the known role
list (build|review|oversee|strategize|achieve|security-check|evolve|audit|brain),
defaulting to 'unknown' for any unrecognised value.

Evidence of the original vulnerability: session 20260409-020609 had role
'.*'"$LOG_FILE"2>/d' in the session index due to crafted ROLE DECISION content.
fazxes added a commit that referenced this pull request Apr 9, 2026
fix(#251): harden daemon.sh role extractor against sed metacharacters
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.

1 participant