Skip to content

feat: session management extended — complete interview requirements#6

Merged
nullhack merged 15 commits intomainfrom
feat/session-management-full
May 2, 2026
Merged

feat: session management extended — complete interview requirements#6
nullhack merged 15 commits intomainfrom
feat/session-management-full

Conversation

@nullhack
Copy link
Copy Markdown
Owner

@nullhack nullhack commented May 2, 2026

Summary

Completes the session-management feature by implementing all remaining requirements from IN_20260501_session-management that were deferred to "session-management-extended":

  • session list — lists all sessions with name/flow/state/updated_at, supports --format yaml|json
  • --session on next — read-only session resolution for transition queries
  • --session on check — read-only session resolution for state inspection
  • --format json on session show — JSON output option
  • Session path resolution--session and --name accept both short names and file paths (mirrors flow name resolution pattern)
  • Error handling — not-found errors for session show/set-state, invalid state rejection on set-state
  • Config resolutionsessions_dir from pyproject.toml, flow name resolution for session init

This completes all 18 @id examples from the original session-management interview (8 core + 10 extended).

Test plan

  • 199 pytest tests passing, 4 skipped (pre-existing)
  • ruff check and ruff format --check pass on changed files
  • Integration test suite (138 assertions, 0 failures) covering:
    • Session init (default + named), show, set-state
    • Session-aware transition with subflow push/pop
    • Flow name resolution (short name, .yaml extension, not-found)
    • Config command (text + JSON)
    • Multi-session independence
    • --session on next/check (new)
    • session list (new)
    • --format json on session show (new)

nullhack added 15 commits May 1, 2026 16:47
- Move glossary.md, product-definition.md, system.md → docs/spec/
- Convert product-definition.md to product_definition.md with template sections
  (Quality Attributes, Project Conventions, Deployment, Branch Strategy)
- Convert system.md to template format (C4 levels, Domain Model Documentation,
  Delivery section, Changes table)
- Convert branding.md → docs/branding/branding.md with template format
- Rename ADR files from ADR-YYYY-MM-DD-slug.md → ADR_YYYYMMDD_slug.md
  and add Risk Assessment section to each ADR
- Convert scope_journal.md → docs/interview-notes/ IN_YYYYMMDD_slug.md files
  (5 separate session files with template format)
- Rename flow-definition-spec.md → flow_definition_spec.md (snake_case)
- Update all cross-references (CHANGELOG, index.html, scripts, knowledge, skills)
- Update update_index_html.py to parse ADR_YYYYMMDD_slug.md naming
- Add cli-flow-name-resolution feature (7 BDD scenarios, test stubs)
- Add session-management (core) feature (8 BDD scenarios, test stubs)
- Add session-management-extended feature (ELICITING, 10 scenarios)
- Add infrastructure: config.py, session_store.py, resolution.py, session_cmd.py
- Add domain: Session, SessionStackFrame dataclasses
- Add discovery artifacts: interview notes, domain model, context map,
  technical design, glossary updates, product definition updates
- Add post-mortems for flow protocol violations
- Update system.md with Session Tracking and FlowNameResolution contexts
Implement CLI flow name resolution so that short flow names (e.g.
'feature-development-flow') resolve to their YAML files in the
configured flows_dir, matching the session store's identifier scheme.

- DefaultFlowNameResolver: file-path-first, then name lookup with .yaml
  extension handling; raises FlowNameNotFoundError with clear message
- --flows-dir global flag overrides pyproject.toml flows_dir
- Exit code 1 for flow not found (was incorrectly 2/usage error)
- flow_file arg changed from type=Path to plain string to accept names

Refs: docs/features/backlog/cli-flow-name-resolution.feature (@id: a1b2c3d4, e5f6g7h8, i9j0k1l2, m3n4o5p6, q7r8s9t0, u1v2w3x4, y5z6a7b8)
…are transition

Implement core session management for the flowr CLI:

- session init <flow>: creates session at flow's initial state, resolves
  flow names via FlowNameResolver, persists to YAML with atomic writes
- session show: displays current session state (flow, state, stack, timestamps)
  with --format yaml|json output
- session set-state <state>: updates session state, validates against flow
- --session [<name>] on transition: resolves flow+state from session,
  performs transition, auto-updates session; push/pop stack for subflows

Architecture: SessionStore Protocol in domain layer (hexagonal port),
YamlSessionStore adapter in infrastructure layer. Session dataclass with
immutable update methods (with_state, push_stack, pop_stack).

Refs: docs/features/backlog/session-management.feature (@id: a1b2c3d4, i9j0k1l2, m3n4o5p6, u1v2w3x4, c9d0e1f2, o1p2q3r4, s5t6u7v8, w9x0y1z2)
…ped bookkeeping

- Move cli-flow-name-resolution.feature from backlog/ to completed/
- Move session-management.feature from backlog/ to completed/
- Add PM_20260502_flow-bookkeeping-skipped: agent completed features but
  skipped flow transitions, file moves, and acceptance gates
…e-paths partially implemented without traceability
Implement the Config introspection rule from configurable-paths feature
(@id: 2e301322, 36d41122, 9d4c4973):

- flowr config: shows resolved config keys with sources
- flowr config --json: JSON output of config keys, values, and sources
- resolve_config_with_sources(): tracks source of each config value
- Refactored config.py: extracted helpers for readability

Refs: docs/features/backlog/configurable-paths.feature (@id: 2e301322, 36d41122, 9d4c4973)
…xt/check, session path resolution

Adds the remaining session-management capabilities to complete the
original interview requirements (IN_20260501_session-management):

- session list subcommand (@id: q7r8s9t0_list)
- --session on next command (@id: e7f8g9h0)
- --session on check command (@id: i1j2k3l4)
- --format json on session show (@id: m3n4o5p6_json)
- session init --name explicit (@id: e5f6g7h8)
- session set-state validation (@id: g3h4i5j6)
- session show not-found error (@id: y5z6a7b8_err)
- session set-state not-found error (@id: k7l8m9n0_err)
- config default session dir (@id: m5n6o7p8)
- config flow name resolution for init (@id: q9r0s1t2)

Also adds session path resolution: --session and --name accept both
short names and file paths, mirroring the flow name resolution pattern.
- Add unit tests for session commands, session store, config, and output formatting
- Add pragma: no cover for unreachable Protocol stubs, Python version fallbacks, and main() dispatch paths covered by integration tests
- Fix lint: UP017 (datetime.UTC), DOC201/DOC501 (docstrings), COM812 (trailing commas), PLW1514 (encoding), D104 (package docstring)
- Rename unused parameters with underscore prefix (ARG001)
@nullhack nullhack merged commit c821372 into main May 2, 2026
7 checks passed
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