Skip to content

Refactor R2: extract workflow pacing and team cap into email-pacing #315

Closed

Description

@Silthus

Part of #291

Question

Refactor slice R2 from the accepted brief: extract email-pacing.ts with WorkflowPacing and TeamSendingCap (both SendPacer), the retry-delay math and the cap tables. Direct tests only for the pure policy functions (seam S3, C9). Behavior-preserving. Fix the stale claimUpTo name in its comment.

Activity

  1. Silthus commented on Oct 6, 2026

    @Silthus
    OwnerAuthor

    Runtime: T3 delegate_task (app-owned child of the conductor thread)
    Task: wf291-implement-315-r1
    Cast: codex / gpt-6.1-sol, reasoning high (behavior-preserving refactor); review: claude -p claude-opus-5-5, or qa-swarm if merge-risk names a danger area
    Branch: refactor/workflows-email-pacing (stacked on refactor/workflows-email-service-deps, PostHog#112885)
    CodeRabbit slot: 1 of 3
    Cap: 150 min wall time from 20:25 UTC

  2. self-assigned this
    on Oct 6, 2026
  3. Silthus commented on Oct 6, 2026

    @Silthus
    OwnerAuthor

    Note

    🤖 GPT-6.1 Sol responding on behalf of Michael

    Draft PR: #112897, stacked on PostHog#112885 and targeting master.
    The proof bundle includes green before and after, unchanged assertions, S3 policy proof and the passing pre-push hook. QA panel and read-only Opus review follow.

  4. Silthus commented on Oct 6, 2026

    @Silthus
    OwnerAuthor

    Note

    🤖 GPT-6.1 Sol responding on behalf of Michael

    Implemented R2 in draft #112897, stacked on PostHog#112885 and targeting master. Reviewed and shipped head: 7938ae5dfd556818b61a65517d40410eac511411. The branch carries the parent stack until it merges; no parent branches or PRs were changed.

    • WorkflowPacing and TeamSendingCap implement SendPacer in email-pacing.ts, with the unchanged retry math, cap tables and metrics. EmailService constructs both internally and retains its public interface and helper exports. Queue writes and both payload comments stay for R3; the stale claim name is fixed and the real why comments remain.
    • Green before: 588 tests passed on parent 3737711a04b8e0e21243d129598759598fd0f280. Green after: the same S1, S2 and email suites plus 34 S3 cases, 622 passed on the final tree, none skipped. S2 includes the real AWS SDK through the local SES fake and persisted retry round-trip.
    • Assertion comparison: all 19 existing test files and 1,151 expect expressions are unchanged. No direct pacing-policy tests existed to move. Policy comparison confirms the seven moved pure functions and metric/table initializers are unchanged. S3 mutation proof catches seven realistic arithmetic/configuration faults.
    • Touched-file hogli test, full Node.js lint/typecheck and strict preflight, and the final pre-push hook pass. No hook bypass. The existing SES service was healthy; no Docker services were restarted or stopped.
    • Merge risk is medium, a one-way door: incorrect pacing could send emails too early or delay them, and a sent email cannot be unsent. That real-send danger triggered qa-swarm. Three read-only T3 GPT-6.1 Sol lanes, correctness, risk and design, reported no findings. Two read-only awaited claude -p --model claude-opus-5-5 reviews covered the extraction and config fix. The first config-duplication finding is fixed through EmailServiceConfig extends TeamEmailCapConfig; the requested narration and import-style changes were rejected with code and rule evidence. The second review confirmed the config finding closed. The final doc-only correction was checked against the extracted class, without a third panel.
    • CodeRabbit CLI was skipped because it is signed out. Its GitHub bot reviewed the stacked diff: the stale documentation pointer is fixed, the description now identifies the increment and inherited parent changes, and the missing-headers finding is rejected because current service sends always set headers and unrelated inbox writers are filtered before validation. All calls, exact task IDs, findings and outcomes are recorded in the proof bundle and bot replies.
    • Gaps: CodeRabbit's final incremental review was requested but returned no new report before handoff; its initial findings are resolved and Opus reviewed the config fix. Upstream fork CI awaits maintainer approval and was not used as a handoff gate. GitHub denied assigning the PR and adding skip-inkeep-docs. Strict local preflight passes with inherited tooling advisories; tooling feedback was sent through hogli. Required proof/model-review artifacts are complete and no decision is pending.
    • Proposed follow-up tickets: none. The remaining reschedule-writing/comment cleanup is already R3 scope.

    Closing #315 with the draft ready for Michael's review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions