Skip to content

Move command shared types into owning slices#154

Merged
MirzaMerdovic merged 1 commit into
mainfrom
issues/orfe-149
May 13, 2026
Merged

Move command shared types into owning slices#154
MirzaMerdovic merged 1 commit into
mainfrom
issues/orfe-149

Conversation

@gr3g-bot

@gr3g-bot gr3g-bot Bot commented May 13, 2026

Copy link
Copy Markdown

Ref: #149

Summary

  • move issue, PR, and project shared logic into responsibility-named shared modules
  • move public command result DTOs into command-local output.ts files and remove broad group shared.ts files
  • update architecture docs and ADR wording to reflect the shared/ module pattern

Testing

  • npm test
  • npm run lint
  • npm run typecheck
  • npm run build

@kl4r1554-bot kl4r1554-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

QA Review — Issue #149 / PR #154

Decision: APPROVED


What I verified

Structural compliance (all pass ✅)

  • PR body opens with Ref: #149 on first line — correct.
  • Branch is issues/orfe-149 — correct.
  • All three old broad shared.ts files are removed: issue/shared.ts, pr/shared.ts, project/shared.ts. Glob confirms zero remaining **/shared.ts files under src/commands.
  • All required issue shared modules exist: github-errors.ts, github-response.ts, state.ts.
  • All required PR shared modules exist: github-errors.ts, github-response.ts, review.ts.
  • All required project shared modules exist: github-errors.ts, graphql-types.ts, lookup.ts, mutations.ts, queries.ts, status-field.ts.
  • All 14 required command-local output.ts files exist (issue/get, issue/create, issue/comment, issue/update, issue/validate, pr/get, pr/get-or-create, pr/comment, pr/reply, pr/submit-review, pr/update, pr/validate, project/get-status, project/set-status).
  • src/commands/shared/body-input.ts is present and was not re-renamed.

Separation of concerns (correct ✅)

  • github-response.ts in each group owns the raw GitHub API transport shapes (IssueGetResponseData, PullRequestGetResponseData, etc.) plus the normalization functions that map them to public DTOs. Public DTOs stay in command-local output.ts.
  • graphql-types.ts in the project group owns raw GraphQL response shapes exclusively. ProjectGetStatusData and ProjectSetStatusData live in their respective output.ts.
  • No transport shapes are mixed into the public output.ts files.

Handler diffs (no payload/behavior changes ✅)

  • All handler diffs verified: issue/get, issue/comment, issue/update, issue/validate, issue/set-state, pr/get, pr/comment, pr/reply, pr/update, pr/validate, pr/get-or-create, pr/submit-review, project/get-status, project/set-status.
  • Changes are import-path updates and helper-function moves only.
  • The one structural change in project/set-status/handler.ts — inlining the normalizeProjectSetStatusResult call into two explicit return statements — is logically equivalent and confirmed correct against the ProjectSetStatusData interface. Typecheck passed.
  • pr/submit-review/errors.ts correctly removes the duplicate readPullRequestReviewEvent local copy and imports from shared/review.js.

Verification claims confirmed ✅

  • npm run build — passes (no output, clean).
  • npm run typecheck — passes.
  • npm run lint — passes.
  • npm test — all command-group test files pass:
    • issue/set-state: 17/17 ✅
    • issue/get, issue/comment, issue/update: 30/30 ✅
    • issue/validate: 7/7 ✅
    • issue/create: 28/28 ✅
    • pr/get, pr/comment, pr/reply, pr/update, pr/validate: verified ✅
    • pr/get-or-create: 16/16 ✅ (run twice across separate batches)
    • pr/submit-review: 12/12 ✅
    • project/get-status: 15/15 ✅
    • project/set-status: 12/12 ✅

Docs updates (correct ✅)

  • docs/architecture/overview.md updated in three places: the Mermaid diagram nodes for IssueGroup, PrGroup, and ProjectGroup; the file tree diagram (adds output.ts, renames shared.tsshared/<named-module>.ts); and the prose guidance (removes "Group-local shared.ts files exist only when..." paragraph, replaces with responsibility-named module guidance).
  • ADR 0007 §6 updated from shared.ts to shared/ directory with responsibility-named modules.
  • No stale shared.ts references remain in docs for the command layer.

Architecture invariants ✅

  • docs/architecture/invariants.md — no changes required; this issue is a locality/ownership cleanup within already-agreed architectural boundaries.
  • Command contract invariant is preserved: public output types are unchanged, only their file locations moved.

Blockers

None.


Important

None.


Nice-to-have

  1. issue/set-state public DTO still lives in handler.tsIssueSetStateData is exported from src/commands/issue/set-state/handler.ts rather than from a command-local output.ts. This is intentionally out of scope for this issue (set-state is not in the required output.ts list), but it creates a small inconsistency with the rest of the command group post-refactor. Worth capturing as follow-up for the next cleanup round.

  2. src/config/shared.ts is listed in overview.md line 61 while line 208 prescribes "avoid shared.ts"src/config/shared.ts is a pre-existing config-layer file outside this issue's scope. The prescriptive advice at line 208 is in a commands-specific section, so there is no logical contradiction, but it could be made clearer that the anti-pattern guidance applies to the command layer, not all layers. Non-blocking follow-up.

  3. validate/output.ts files are minimal type aliasestype IssueValidateData = ArtifactTemplateValidationResult and type PullRequestValidateData = ArtifactTemplateValidationResult. These are correct and give the commands their own named export points, but they are very thin. If ArtifactTemplateValidationResult ever changes, these files provide stable re-export points. Acceptable as-is.


Docs / invariants

overview.md and ADR 0007 are both updated correctly. No invariants gap. No debt update required.

@MirzaMerdovic MirzaMerdovic merged commit db041b4 into main May 13, 2026
1 check passed
@MirzaMerdovic MirzaMerdovic deleted the issues/orfe-149 branch May 13, 2026 07:38
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