Skip to content

Fix TC message log write failure preventing collection from opening (BL-16772) - #8255

Merged
StephenMcConnel merged 1 commit into
Version6.4from
BL-16772-tc-log-crash
Aug 31, 2026
Merged

Fix TC message log write failure preventing collection from opening (BL-16772)#8255
StephenMcConnel merged 1 commit into
Version6.4from
BL-16772-tc-log-crash

Conversation

@andrew-polk

@andrew-polk andrew-polk commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Problem: A user whose Team Collection's local folder contains read-only files could not open their collection at all. Bloom reported a raw UnauthorizedAccessException ("Access to the path ...log.txt is denied") and gave up, even though the TC code has a disconnected-mode fallback (added for BL-16227) designed to let the collection open with Team Collection features degraded.

Cause: When TC initialization failed (a sync write to the unwritable folder threw), the recovery path in the TeamCollectionManager constructor built a DisconnectedTeamCollection and then wrote an error message via TeamCollectionMessageLog.WriteMessage — which appends to log.txt in the same unwritable folder. That second exception escaped the constructor uncaught, killed the Autofac resolve, and prevented the whole ProjectContext from being created.

Fix: TeamCollectionMessageLog.WriteMessage now catches a failure to persist a message to log.txt, logs it via the SIL Logger, and continues. The message is already in the in-memory list and the Logger before the file write, so the current session still shows it; it just won't survive a restart. A regression test makes the log file read-only and verifies WriteMessage doesn't throw and keeps the message in memory. The PR targets Version6.4 directly (the affected user is on 6.4 Beta); the change is deliberately minimal. Version6.4 merges forward to 6.5/master per the usual flow.

Ref: https://issues.bloomlibrary.org/youtrack/issue/BL-16772

Devin review


This change is Reviewable


Devin review

@greptile-apps

greptile-apps Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR prevents a Team Collection message-log persistence failure from aborting collection startup.

  • Retains the message in memory and reports file-write failures through the SIL logger.
  • Adds regression coverage using a read-only Team Collection log file.

Important Files Changed

Filename Overview
src/BloomExe/TeamCollection/TeamCollectionMessageLog.cs Handles message-log persistence failures without disrupting Team Collection initialization.
src/BloomTests/TeamCollection/TeamCollectionMessageLogTests.cs Adds regression coverage confirming an unwritable log does not discard the in-memory message or throw.

Reviews (2): Last reviewed commit: "Fix BL-16772 TC message log write failur..." | Re-trigger Greptile

@andrew-polk

Copy link
Copy Markdown
Contributor Author

[Claude Fable 5] Consulted Devin on 2026-08-28 ~19:25 UTC up to commit 1798dbf. Result: no bugs, no Investigate flags; 1 informational note (confirming the message survives in memory/Logger when the file write fails). Nothing to mirror.

…pening

https://issues.bloomlibrary.org/youtrack/issue/BL-16772

When the local collection folder is not writable (e.g. read-only files),
TeamCollectionMessageLog.WriteMessage threw while the TeamCollectionManager
constructor was reporting a TC initialization failure. The exception escaped
the constructor and the collection failed to open entirely, instead of
opening with the Team Collection in disconnected mode (the BL-16227
fallback). Now a failure to persist a message is logged and swallowed;
the message is still shown in the current session.

Tests: added WriteMessage_LogFileNotWritable_DoesNotThrowAndKeepsMessageInMemory;
all 203 BloomTests.TeamCollection tests pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@andrew-polk
andrew-polk force-pushed the BL-16772-tc-log-crash branch from 1798dbf to da662d8 Compare August 28, 2026 20:59
@andrew-polk
andrew-polk changed the base branch from master to Version6.4 August 28, 2026 20:59
@andrew-polk

Copy link
Copy Markdown
Contributor Author

[Claude Fable 5] Consulted Devin on 2026-08-28 ~20:20 UTC up to commit da662d8 (branch rebuilt on Version6.4). Result: no bugs, no Investigate flags; the same single informational note as before. Nothing to mirror.

@andrew-polk
andrew-polk marked this pull request as ready for review August 28, 2026 21:18

@StephenMcConnel StephenMcConnel 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.

@StephenMcConnel reviewed 2 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on andrew-polk).

@StephenMcConnel
StephenMcConnel merged commit 524ca2d into Version6.4 Aug 31, 2026
3 checks passed
@StephenMcConnel
StephenMcConnel deleted the BL-16772-tc-log-crash branch August 31, 2026 16:40
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