Skip to content

fix: grow the PlanTimer grid and report failures in the settings header push - #1791

Merged
renemadsen merged 2 commits into
stablefrom
claude/5602-eform-angular-timeplanning-plugin
Nov 13, 2026
Merged

renemadsen merged 2 commits into
stablefrom
claude/5602-eform-angular-timeplanning-plugin

Conversation

@renemadsen

Copy link
Copy Markdown
Member

Bug

Saving the time-planning settings runs GoogleSheetHelper.PushToGoogleSheet, which appends a - timer/- tekst header pair to the PlanTimer sheet for every active worker that has none. This plugin's copy never got the fixes made to the same push in eform-backendconfiguration-plugin (fd3b5b7, 9a7512a, 628ddd8):

  • New headers were written from existingHeaders.Count, i.e. after the last non-empty cell of row 1, without growing the sheet's grid. A write beyond the grid's last column is refused by the Sheets API.
  • The exception was only logged with LogError (not sent to Sentry), and the settings save reported success, so a worker silently got no columns.
  • A column with a blank header but data or a formula below it could be written over.

Regression test

TimePlanning.Pn.Test/PlanTimerSheetColumnsTests.cs (already in CI shard b), mirroring the backendconfiguration tests:

  • PlanAppends_TwoWorkersFormulaColumnAndStrayCell_AppendsInTheFirstFreePairAfterTheLastWorker (the scenario: two workers, a formula under a blank header right after them, a stray cell far out; the new pair goes in the first free pair after the last worker and ColumnsToAdd reports the missing grid column)
  • PlanAppends_StrayCellFarOutInTheHeaderRow_AppendsRightAfterTheLastWorker, PlanAppends_UnsuffixedLabelFarOut_IsNotTakenForTheLastWorker, PlanAppends_BlankHeaderWithDataUnderIt_IsSkipped, PlanAppends_FormulaUnderABlankHeader_IsSkipped, PlanAppends_NoFreePairInsideTheRow_AppendsAfterTheLastUsedColumn
  • ColumnsToAdd_GrowsTheGridOnlyWhenTheHeadersDoNotFit

Without the fix these do not compile (PlanAppends takes no data rows, ColumnsToAdd does not exist), and the old placement (existingHeaders.Count) gives the wrong first column.

Fix

  • PlanTimerSheetColumns: port PlanAppends(…, dataRows), LastWorkerColumn, FirstFreeColumns and ColumnsToAdd verbatim from backendconfiguration.
  • GoogleSheetHelper.PushToGoogleSheet:
    • FirstOrDefault on the GoogleSheetId setting; return when no sheet is configured.
    • MissingCredentials warning (log + Sentry) when a sheet is configured but PRIVATE_KEY_ID is not set.
    • Read the whole sheet as FORMULA only when columns must be placed, and plan with those rows.
    • EnsureColumnsAsync grows the grid with AppendDimension before Values.Update.
    • SentrySdk.CaptureException in the catch; the dead inner try block is removed.
    • The #5489 retirement guard and the existing authentication are unchanged.

Testing

dotnet build eFormAPI/Plugins/TimePlanning.Pn/TimePlanning.Pn.sln succeeds locally. Tests run only in CI: shard b should show the new PlanTimerSheetColumnsTests passing.

Kanban card #5602

🤖 Generated with Claude Code

Claude implement bot and others added 2 commits November 13, 2026 10:27
Add regression tests for PlanTimerSheetColumns.PlanAppends and
ColumnsToAdd, mirroring the ones in eform-backendconfiguration-plugin.
A stray cell far out in the header row, or a blank-header column that
holds data or a formula, must not decide where a new worker's
"- timer"/"- tekst" pair is written, and a full grid must be grown
before the write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port the header-push fixes from eform-backendconfiguration-plugin to
GoogleSheetHelper.PushToGoogleSheet, which the time-planning settings
update runs. New worker columns written beyond the sheet's grid were
refused by the Sheets API, and the error was only logged, so workers
silently got no columns.

- Plan appends from the first free pair after the last worker, reading
  the whole sheet as formulas only when columns must be placed.
- Grow the grid with AppendDimension before writing the headers.
- Send failures to Sentry; warn when a sheet is configured but the
  service account key is missing.
- Read GoogleSheetId with FirstOrDefault and drop the dead inner try.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 13, 2026 09:28

Copilot AI 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.

🟢 Approval recommended

No active review issues were identified for the worker-header placement, grid expansion, and push-failure reporting changes.

No open issues 🎉

What changed in this PR

This PR makes the time-planning settings push place new worker headers safely in PlanTimer, grow the sheet grid when needed, and report push failures through Sentry.

Changes:

  • Find free columns after the last worker while preserving columns containing data or formulas.
  • Expand the grid before writing headers, skip unconfigured sheets, and report missing credentials and exceptions.
  • Add regression tests for header placement and grid growth.
File Description
eFormAPI/​Plugins/​TimePlanning.Pn/​TimePlanning.Pn/​Infrastructure/​Helpers/​PlanTimerSheetColumns.cs Adds data-aware header placement and grid-growth calculation.
eFormAPI/​Plugins/​TimePlanning.Pn/​TimePlanning.Pn/​Infrastructure/​Helpers/​GoogleSheetHelper.cs Reads formulas before placement, expands the grid, and reports failures to Sentry.
eFormAPI/​Plugins/​TimePlanning.Pn/​TimePlanning.Pn.Test/​PlanTimerSheetColumnsTests.cs Tests placement around occupied columns and required grid expansion.

Review effort: Balanced

@renemadsen
renemadsen merged commit f04d1dd into stable Nov 13, 2026
45 checks passed
@renemadsen
renemadsen deleted the claude/5602-eform-angular-timeplanning-plugin branch November 13, 2026 09:44
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