Skip to content

Move worklog aggregation into the submission service and report failures by position - #176

Merged
vesnicancz merged 1 commit into
masterfrom
refactor/worklog-submission-pipeline
Nov 5, 2026
Merged

vesnicancz merged 1 commit into
masterfrom
refactor/worklog-submission-pipeline

Conversation

@vesnicancz

Copy link
Copy Markdown
Owner

The submit dialog's orchestrator held the aggregation, so only the GUI could use it. A failure found its row through the identity of the entry object, with a guess by day and ticket when that didn't work, and three places worked out on their own whether a submission had failed.

What changes

  • Aggregation moves to PluginBasedWorklogSubmissionService. PreviewAsync(period, mode, ct) returns the rows, and the orchestrator only turns them into dialog items.
  • SubmissionPeriod (Day, WeekOf) replaces the six daily and weekly overloads with PreviewAsync and SubmitAsync. A preview and a submission of a period now load their entries in one place. The new methods take a required CancellationToken.
  • Plugin contract: WorklogSubmissionError.Worklog becomes WorklogIndex, the position in the list the plugin was handed. The service translates it back to the list the caller submitted, which can be longer because invalid rows never reach the plugin. TimesheetDayBatch does the same from a day's positions to all of them.
  • SubmissionResult gets HasFailures and FailureCount and becomes immutable. Unused IsSuccess, HasPartialSuccess and EntriesByDate go. SubmissionError drops TicketId and Description, which only the guess read.
  • CLI: send and send week share one flow. Only the preview and the wording differ, and the output stays the same.

Behavior to check

  • A plugin reporting a position outside the list now gets a warning in the log, and no row is marked. The failure still counts in the status message and the CLI exit code. The plugins in this repo don't do this.
  • A retry with such an error no longer reports success. RetryFailedAsync used to look only at the marked rows.
  • Plugins built against the old WorklogSubmissionError have to be rebuilt.

Not in this PR

The CLI still sends in timed mode. The aggregation is available to it now, but a flag for it would be a new feature.

Testing

  • All 1445 tests pass on Windows. The aggregation tests moved to the service, with new cases for positions in TimesheetDayBatch, GoranG3WorklogPlugin and TempoWorklogPlugin.
  • I ran send and send week from the CLI on a throwaway copy of a real database, with a provider that doesn't exist so nothing could be uploaded: the week previewed 36 entries, and the day failed with "not found or not running".
  • Not tried by hand: the submit dialog in a running GUI, and an upload to a real Tempo or Goran G3.

…res by position

The submit dialog's orchestrator held the aggregation, so nothing else could
use it, and a failure found its row through the identity of the entry object,
with a guess by day and ticket when that didn't work. A plugin now reports the
position in the list it was handed, and the guess is gone.

One SubmissionPeriod replaces the six daily and weekly overloads, so a preview
and a submission of a period load the same entries, and the CLI's day and week
commands share one flow. SubmissionResult.HasFailures answers what three places
worked out on their own.
@vesnicancz
vesnicancz merged commit d1b1a35 into master Nov 5, 2026
6 checks passed
@vesnicancz
vesnicancz deleted the refactor/worklog-submission-pipeline branch November 5, 2026 07:56
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