Skip to content

Claude/review ticket refactor p tfgk - #6

Merged
Quiterion merged 2 commits into
mainfrom
claude/review-ticket-refactor-PTfgk
Jan 6, 2026
Merged

Quiterion merged 2 commits into
mainfrom
claude/review-ticket-refactor-PTfgk

Conversation

@Quiterion

Copy link
Copy Markdown
Owner

No description provided.

claude added 2 commits January 6, 2026 06:10
This commit implements the refactoring described in specs/ticket-refactor-ideas.md:

## Ticket Type Configuration
- Add lib/ticket_types.sh module for configurable ticket states and transitions
- Add defaults/ticket_types.json with default state machine configuration
- Support custom ticket types, states, and transition hooks via JSON config
- Fallback to hardcoded defaults when config/jq unavailable

## Hook Invocation from ticket_transition()
- Move hook invocation from git post-receive hook to ticket_transition()
- Support pre-transition hooks (can block transition)
- Support post-transition hooks (run asynchronously after sync)
- Add --no-hooks flag to skip hook invocation
- Set WIGGUM_PREV_STATE, WIGGUM_NEW_STATE, WIGGUM_HOOK_PHASE env vars

## Bare Repo Hooks Removed
- Remove pre-receive and post-receive hooks from bare repo (now no-op)
- Validation now done in ticket_transition() using ticket_types
- Main clone auto-sync handled by ticket_sync_push()

## Data Layer Invariants Enforced
- Create proper CRUD API in ticket.sh with clear invariants
- Only CRUD functions may access $TICKETS_DIR directly
- All operations sync before read and push after write
- Add _ticket_ensure_sync() for idempotent sync within operations
- Update hooks.sh to use clone via read_ticket_content()

## Tests
- Add tests/test_ticket_types.sh for ticket type configuration
- Add tests/test_hooks_transition.sh for hook invocation from transition
- Update tests/test_distributed.sh to verify no bare repo hooks

78/80 tests pass (2 pre-existing failures in tmux spawn tests)
- Remove --no-sync flag from ticket_transition (sync is mandatory)
- Make frontmatter utils internal (_get_frontmatter_value, _set_frontmatter_value)
- Add CRUD wrappers: get_ticket_field(), set_ticket_field()
- Update pane.sh to use CRUD API instead of direct $TICKETS_DIR access
- Fix shellcheck warning in hooks.sh (SC2155)
- Update specs to document:
  - Pre/post transition hook model
  - Configurable state machine via ticket_types.json
  - Mandatory sync invariants
- Fix test framework to disable GPG signing (prevents CI failures)

All 80 tests pass.
@Quiterion
Quiterion merged commit 8b339de into main Jan 6, 2026
1 of 2 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.

2 participants