Skip to content

feat: allow reclassifying commit headlines in batches - #1438

Merged
paulinevos merged 2 commits into
productionfrom
feat/reclassify-commit-headlines
Nov 3, 2026
Merged

paulinevos merged 2 commits into
productionfrom
feat/reclassify-commit-headlines

Conversation

@paulinevos

@paulinevos paulinevos commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The headline backfill command skips commits once they have been classified, so it cannot revisit existing results after classification changes. Add an opt-in --reclassify flag:

php artisan commits:link-headlines --reclassify --batch-size=20

Without the flag, incremental processing stays unchanged.

Changes

  • Include already-classified eligible approved, nonempty root commits when reclassification is requested, including commits previously classified without headlines.
  • Replace each commit's headline assignments transactionally after obtaining its new result; clear recaps for headlines gaining or losing a link, including existing destinations; preserve retained and unrelated recaps. Preserve eligibility and stale-content checks.
  • Retain existing assignments when provider processing fails before that commit receives a replacement. Processing remains incremental, not atomic across the entire command.
  • Keep pre-deployment queued jobs compatible by giving the new flag a genuine property default. Add legacy-payload regression coverage alongside command replacement and failure coverage.

Validation

All checks passed locally on the final revision:

  • vendor/bin/pint --dirty --format agent
  • composer test:lint — passed; existing warnings in unchanged frontend files remain.
  • composer test:types — passed.
  • composer test:type-coverage — 100%.
  • bun run test:unit — 223 tests passed.
  • php artisan test --compact tests/Feature/Commands/LinkCommitHeadlinesTest.php tests/Unit/Actions/UpdateCommitHeadlinesTest.php tests/Unit/Jobs/ProcessCommitHeadlinesTest.php tests/Unit/Jobs/LinkCommitHeadlinesTest.php — 52 tests, 199 assertions passed.
  • php -d memory_limit=-1 vendor/bin/pest --parallel --ci --coverage --exactly=100.0 --passthru-php="'-d' 'memory_limit=-1'" — 5,499 tests, 29,796 assertions passed; 100% coverage.
  • Recap invalidation regression reproduced the stale destination recap before the fix; afterward, removed and added headlines lose their recaps while retained and unrelated headlines preserve them.
  • Legacy-payload regression cases reproduced uninitialized-property failures before the compatibility fix and pass afterward.
  • git diff --check — passed.

Visual and device verification are inapplicable: no UI or mobile interactions changed. No live AI-provider or production processing was performed.

Independent review

Independent read-only reviewer: PASS, with no unresolved blockers, for base 3c79473a and head 77e13c7d.

Review covered the full eight-file diff, correctness, regressions, architecture, transaction/concurrency behavior, and test value. An initial queued-payload compatibility finding was fixed and re-reviewed. The reviewer inspected code and test evidence rather than rerunning the suite; the implementer completed the final full coverage run after review without further code changes. Visual review is inapplicable.

Limitations

The minor review finding about pivot creation timestamps is deliberately unchanged; this update addresses only CodeRabbit’s major recap-invalidation finding.

The flag revisits all eligible commits, not a selected date range or batch identifier. Reclassification reuses the existing shared headline pool and can make AI-provider requests for every eligible commit. Successful per-commit updates are retained if a later commit or batch fails. Hosted CI results are separate from the local validation above.

Summary by CodeRabbit

  • New Features
    • Added an option to reclassify eligible commits, replacing their existing headline assignments and clearing their summaries before applying new ones.
    • Reclassification can be run across batches; without the option, existing processing behavior is unchanged.

Copilot AI balanced review requested due to automatic review settings November 3, 2026 13:24
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Walkthrough

The headline-linking command adds an opt-in reclassification mode. The option passes through batch and per-commit jobs to the update action, which can replace existing headline assignments. Tests cover reclassification results, failure behavior, and compatibility with older serialized jobs.

Changes: Commit headline reclassification

Layer / File(s) Summary
Batch selection and dispatch
app/Console/Commands/LinkCommitHeadlinesCommand.php, app/Jobs/ProcessCommitHeadlines.php, tests/Unit/Jobs/ProcessCommitHeadlinesTest.php
The command adds --reclassify. When enabled, the command and processing job omit the unclassified and no-headlines filters. The flag passes to each per-commit job. A regression test covers a serialized processing job without the new flag.
Replace headline assignments
app/Actions/UpdateCommitHeadlines.php, app/Jobs/LinkCommitHeadlines.php, tests/Feature/Commands/LinkCommitHeadlinesTest.php, tests/Unit/Jobs/LinkCommitHeadlinesTest.php
The per-commit job passes the flag to the update action. When enabled, the action clears summaries and summary timestamps on existing associated headlines, detaches the associations, and applies the supplied names. Tests cover replacement, failure behavior, and older serialized job payloads.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant LinkCommitHeadlinesCommand
  participant ProcessCommitHeadlines
  participant LinkCommitHeadlines
  participant UpdateCommitHeadlines
  LinkCommitHeadlinesCommand->>ProcessCommitHeadlines: Dispatch batch with reclassify flag
  ProcessCommitHeadlines->>LinkCommitHeadlines: Dispatch commit with reclassify flag
  LinkCommitHeadlines->>UpdateCommitHeadlines: Update commit with reclassify flag
Loading

Possibly related PRs

Suggested reviewers: mnapoli

Merge Risk: Moderate · previous review a937d

Reclassification can show an outdated headline recap and retain an expired headline longer than intended. Correct both replacement effects before merging.

Security architecture risk: Low · up to a937d

The operation remains opt-in and transactional, but repeated runs can extend the lifetime of existing headlines even when classification does not change.

Retained concerns

  • Low · architecture · inferred: Reclassification detaches every existing assignment and recreates returned assignments, including unchanged ones. Because pivot creation timestamps control headline expiry, repeating a full reclassification can indefinitely postpone pruning without any genuinely new assignment. This changes the effective retention lifecycle. Operator opt-in and processing locks limit reachability and concurrency hazards, but do not preserve the original link age.
Security review details

Security Blast Radius

  • inferred — A single operator-invoked run can revisit all eligible approved nonempty root commits in the application's database and invalidate recaps on their shared headlines. Batch size bounds each processing batch, not the total affected population. No tenant or environment-wide security isolation conclusion follows from the inspected queries.

Trust Boundaries and Controls

  • observed — Existing content-creation and approval paths call dispatchFor, which constructs jobs without enabling reclassification. In the inspected application callers, the new replacement authority originates from the explicit CLI option rather than a user-submitted content field.
  • observed — Existing recap controls remain relevant: publication rechecks source bodies and the recap timestamp under a headline-row lock, while display suppresses recent recaps when currently linked approved threads are hidden or muted for the viewer. These controls do not establish complete privacy coverage.

Resilience and Maintainability Implications

  • inferred — Per-commit transactions contain interrupted or failed replacement writes, but reclassification is not lifecycle-idempotent: repeating the same result recreates link timestamps and clears prior recaps again. Recovery therefore preserves assignment atomicity without preserving link age.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding batch reclassification for commit headlines.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 6 functions across 7 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e06236e0-6f14-4937-a604-49ca5b35e735
Commits

Reviewing files that changed from the base of the PR and between 3c79473 and a937dfc.

Files selected for processing: 7
  • app/Actions/UpdateCommitHeadlines.php
  • app/Console/Commands/LinkCommitHeadlinesCommand.php
  • app/Jobs/LinkCommitHeadlines.php
  • app/Jobs/ProcessCommitHeadlines.php
  • tests/Feature/Commands/LinkCommitHeadlinesTest.php
  • tests/Unit/Jobs/LinkCommitHeadlinesTest.php
  • tests/Unit/Jobs/ProcessCommitHeadlinesTest.php

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread app/Actions/UpdateCommitHeadlines.php Resolved
Comment thread app/Actions/UpdateCommitHeadlines.php Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unconditional detachment recreates retained headline links with fresh timestamps, incorrectly extending their fourteen-day pruning window despite no new linked commits.

1 open issue
What changed in this PR

Adds opt-in batch reclassification to the headline backfill command while preserving its default incremental behavior.

Changes:

  • Introduces --reclassify and passes it through the headline-processing jobs.
  • Replaces eligible commits’ headline assignments transactionally and clears affected recaps.
  • Adds replacement, provider-failure, and legacy queued-payload regression coverage.
File Description
tests/​Unit/​Jobs/​ProcessCommitHeadlinesTest.php Tests processing of legacy queued batches.
tests/​Unit/​Jobs/​LinkCommitHeadlinesTest.php Tests idempotency with current and legacy payloads.
tests/​Feature/​Commands/​LinkCommitHeadlinesTest.php Covers batch replacement and preservation on provider failure.
app/​Jobs/​ProcessCommitHeadlines.php Includes classified commits when requested and forwards the flag.
app/​Jobs/​LinkCommitHeadlines.php Passes the flag to the action with a legacy-safe default.
app/​Console/​Commands/​LinkCommitHeadlinesCommand.php Adds the flag and adjusts batch selection.
app/​Actions/​UpdateCommitHeadlines.php Replaces assignments and clears recaps within the transaction.

Review effort: Balanced

Comment thread app/Actions/UpdateCommitHeadlines.php Resolved
@paulinevos
paulinevos merged commit 088c0f3 into production Nov 3, 2026
12 of 14 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