Skip to content

ADR-253: Add ReviewComment/ReviewThread dataclasses, extend PipelineContext, add parse_json_list_output - #5

Merged
jodavis merged 6 commits into
mainfrom
dev/claude/ADR-253-add-reviewcomment-reviewthread-datacl
Jun 3, 2026
Merged

ADR-253: Add ReviewComment/ReviewThread dataclasses, extend PipelineContext, add parse_json_list_output#5
jodavis merged 6 commits into
mainfrom
dev/claude/ADR-253-add-reviewcomment-reviewthread-datacl

Conversation

@jodavis-claude

Copy link
Copy Markdown
Collaborator

Work item: ADR-253

Add the pure data-model and serialization layer that the subsequent pipeline-step changes in ADR-254 depend on: ReviewComment/ReviewThread dataclasses, PipelineContext field changes (review_threads, first_push_done, base_branch; removal of pr_url), base_branch computation in main(), and the parse_json_list_output() helper.

Changes

  • plugins/dev-team/scripts/dev_team.py — Added ReviewComment and ReviewThread dataclasses; added review_threads, first_push_done, base_branch fields to PipelineContext; removed pr_url; updated save()/load() for all new/removed fields; added parse_json_list_output(); added base_branch computation block with guard in main()
  • plugins/dev-team/scripts/test_dev_team.py — New file; 34 unit tests covering all exit criteria (dataclass fields, serialization round-trips, camelCase JSON wire format, parse_json_list_output() edge cases)
  • plugins/dev-team/scripts/validate-tests.cmd — Updated from no-op stub to invoke pytest with PYTHONPATH pointing at the scripts directory
  • plugins/dev-team/scripts/validate-tests.sh — Same update for Linux/macOS

Design decisions

  • review_threads section is written unconditionally even when the list is empty ([]), to avoid stale values on resume — same rationale applied to review_notes
  • base_branch "prefer main on tie" is implemented by initialising best_candidate = "main" and only updating on strict count < best_count, so main wins ties without extra logic
  • pr_details removal was a no-op — confirmed absent from the current file (never ported from AdaptiveRemote or removed in ADR-265)
  • Removing pr_url intentionally leaves broken ctx.pr_url references in ReviewStep, SignoffStep, and FixPrStep; ADR-254 fixes those step classes
  • parse_json_list_output() tries fenced code blocks first (from the end), then bare lines — the reverse of parse_json_output(), per spec intent

ElwoodMoves and others added 3 commits June 2, 2026 23:39
…ontext, add parse_json_list_output

- Add ReviewComment and ReviewThread dataclasses
- Add PipelineContext fields: review_threads, first_push_done, base_branch
- Remove pr_url from PipelineContext (moves to sidecar; ADR-254 fixes step references)
- save(): first_push_done as lowercase true/false; review_threads as camelCase JSON unconditionally; review_notes unconditionally
- load(): deserialise all new fields; review_threads camelCase→snake_case
- Add parse_json_list_output(): fenced blocks first, then bare lines, returns [] on failure
- main(): compute base_branch via git before pipeline run, guarded against recomputation on resume
- Add test_dev_team.py with 34 unit tests covering all round-trips and edge cases
- Update validate-tests.cmd/.sh to invoke pytest

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
%~dp0 / SCRIPT_DIR resolves to scripts/ (repo root), but test_dev_team.py
lives in plugins/dev-team/scripts/. Point both the PYTHONPATH and the pytest
target at the correct plugin subdirectory.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@jodavis-claude jodavis-claude left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ADR-253 Review

Overall the implementation is clean and matches the spec. One correctness gap in the load() exception handler, noted below.

Exit criteria verified:

  • ReviewComment and ReviewThread dataclasses with correct fields
  • review_threads serialises/deserialises via <!-- section:Review Threads --> as camelCase JSON
  • first_push_done serialises to/from frontmatter as lowercase true/false
  • pr_url removed from PipelineContext; pr_details was already absent (no action needed)
  • base_branch populated in main() with guard (if not ctx.base_branch:), correct tie-break (main wins), and ctx.save() called immediately after
  • parse_json_list_output() tries fenced blocks first, then bare lines, returns [] on failure
  • ✅ Tests cover round-trips, camelCase serialisation, and parse_json_list_output edge cases
  • ✅ Validate scripts correctly moved to scripts/ (where run_validate_script already looks)

Comment thread plugins/dev-team/scripts/dev_team.py
If the Review Threads section contained valid JSON that was not a list
(null, string, dict — e.g. from file corruption), json.loads would
succeed but `for t in threads_data` would raise TypeError, crashing
load() on pipeline resume. Added TypeError to the except tuple and a
test covering null, dict, and string cases.
@jodavis
jodavis marked this pull request as ready for review June 3, 2026 07:02

@jodavis-claude jodavis-claude left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign-off Review — ADR-253

Sign-off result: Approved

Prior review thread

  • [P1 — Correctness] Missing TypeError in review_threads exception handler — Resolved. The developer added TypeError to the except tuple on line 294 and added three test cases covering null, dict, and string JSON values. All three cases now produce [] as expected. Thread is resolved on GitHub.

Files scanned (modified since first review)

  • plugins/dev-team/scripts/dev_team.py — single-line fix, correct
  • plugins/dev-team/scripts/test_dev_team.py — one new test added, all 35 tests pass
  • scripts/validate-tests.cmd, scripts/validate-tests.sh — path fix is correct; local copies under plugins/dev-team/scripts/ correctly removed to avoid duplication
  • _spec_DevTeamPortability.md — minor wording update only, no logic impact

No new issues found

All exit criteria are met:

  • ReviewComment / ReviewThread dataclasses present with correct fields
  • review_threads serialises as camelCase JSON under <!-- section:Review Threads --> (unconditionally, even when empty)
  • first_push_done serialises as lowercase true/false in frontmatter
  • pr_url and pr_details absent from PipelineContext
  • base_branch computed in main() with guard and saved before DevTeamPipeline.run()
  • parse_json_list_output() exists, fenced-block-first, returns [] on failure
  • 35/35 unit tests pass

@jodavis-claude
jodavis-claude requested a review from jodavis June 3, 2026 07:05
Comment thread .claude/settings.json Outdated
@jodavis
jodavis merged commit 2bac194 into main Jun 3, 2026
@jodavis
jodavis deleted the dev/claude/ADR-253-add-reviewcomment-reviewthread-datacl branch June 3, 2026 18:46
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.

3 participants