fix(confluence): surface unverified restriction checks instead of failing open silently - #61
Merged
Merged
Conversation
…ling open silently _user_can_update returned True on any API exception, so a transient Confluence error, an auth problem, or an unexpected response shape looked identical to a confirmed "page is unrestricted" result and the push proceeded unnoticed. Keep the fail-open behaviour (an outage must not block all publishing) but stop it being silent: log a warning with the underlying exception, thread a restriction_check_unverified flag through ManagedClassification, and count it on SyncSummary so a bulk sync's run summary and commit message both show how many pages were pushed without a completed restriction check. Fixes #53 Co-Authored-By: lsimons-bot <bot@leosimons.com> Assisted-by: Claude:claude-sonnet-5
…es vs advisory S26 read as though all five detection layers were equally strict, but layer 5 (page restrictions) is a network call that can fail while layers 1-4 are local config comparisons that can't. State the guarantee/advisory split explicitly, the fail-open rationale for layer 5 (an outage must not block all publishing), and the new visibility mechanism (warning log + sync run summary count) that keeps a failed check from looking identical to a confirmed pass. Co-Authored-By: lsimons-bot <bot@leosimons.com> Assisted-by: Claude:claude-sonnet-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_user_can_updatereturnedTrueon any exception. It is the last layer ofthe managed-elsewhere cascade — the one that asks Confluence whether page
restrictions make a page read-only for you — so a transient API error, an auth
problem, or an unexpected response shape produced "you may update this page" and
the push proceeded.
Four of the five cascade layers are local comparisons against configuration and
are genuine guarantees. The fifth is a network call that degraded to permission.
Restrictions are precisely the mechanism protecting pages somebody actively
does not want overwritten, so the check most likely to matter was the one that
could silently stop applying — and an unverified check was indistinguishable
from a clean pass.
Approach: still fails open, no longer silent
Failing closed would mean a Confluence outage blocks all publishing, which is
worse. So the behaviour is unchanged and the visibility is fixed.
_user_can_updatenow returnsbool | None, whereNonemeans the API callraised; it logs a warning at that point, with the exception in scope, rather
than guessing.
ManagedClassificationcarries a newrestriction_check_unverifiedflag, andSyncSummarycarries a count.The flag lives on the classification rather than in an out-parameter because
every call site — the bulk sync path and the four single-page CLI paths
(
mutate.py,update.py,export.py,publish_office.py) — already receives aManagedClassificationback fromclassify_page. A collector would have neededplumbing into paths that have no
SyncSummaryat all.What an operator now sees
Warning log:
Sync summary:
And a matching section in the generated commit message.
The
except Exceptionis deliberately not narrowed: the point is that anyfailure becomes visible, not that some do.
Spec
docs/spec/S26-managed-elsewhere.mdread as though all five layers were equallystrict guarantees. It now states the guarantee/advisory split, the fail-open
rationale, and the new visibility mechanism, and the "no override mechanism"
section gained a clarifying sentence so it does not read as contradicting the
fail-open language (that section is about overriding a confirmed match — a
different axis).
Tests
test_api_error_is_unverified_not_allowed,test_classify_fails_open_and_reports_unverified_on_api_error,test_classify_logs_warning_on_restriction_api_error,test_classify_unrestricted_page_not_flagged_unverified,test_classify_restricted_page_still_refused_when_check_succeeds, plus summaryformatting and
record_managed_skipcoverage intests/confluence/sync/test_types.pyandtest_events.py.Follow-up in a separate PR
docs/guide/04-safety.mdshould carry the same guarantee/advisory split. It isowned by the in-flight blacklist-enforcement change (#50) to avoid two PRs
editing the same file, and will be updated there.
Fixes #53
Co-Authored-By: lsimons-bot bot@leosimons.com