Bring in parent TypeScript, Jest snapshot, Cypress, and Playwright
selector fixes for the compass-ui Button migration.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Refresh failing channels snapshots that still expected Bootstrap btn*
classes, and close the graph-attribute menu before asserting Create
channel so getByRole is not blocked by floating focus aria-hiding.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Update enterprise e2e specs that still targeted Bootstrap btn-* classes
or disabled classes on compass-ui label spans. Prefer GenericModal__button,
role+name, and the button disabled attribute instead.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Replace null onNavigationConfirmed mocks with undefined, wrap the
system users Filters Button for Floating UI refs, and update Playwright
Cancel selectors to target role=button instead of Bootstrap link/btn classes.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Replace Bootstrap btn/btn-tertiary/btn-primary class selectors with
role+name and GenericModal classes, and update Cancel from link to
button where SaveChangesPanel/BlockableButton now renders a button.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
- Use undefined instead of null for onNavigationConfirmed mock state
- Wrap Filters Button so Floating UI can set a reference without relying on unsupported Button ref typing
- Update new_channel_modal and permission scheme tests to query compass-ui button markup
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Align denim linkColor with the Compass primary button blue and refresh the custom theme chooser snapshot.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Reorder padding before gap and overflow before justify-content to satisfy
stylelint-config-idiomatic-order in the compass-ui button migration styles.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Use compass-ui Icon + leadingIcon instead of nesting PlusIcon in
Button children so the header CTA matches the Section C icon-slot
pattern and aligns correctly with the label.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Bring in ESLint import/order and related parent fixes. Resolve Button
import placement conflicts in simulate_access_modal and upload_license_modal
to match parent import/order.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Reorder @mattermost/compass-ui imports before @mattermost/components, fix
import group blank lines, remove unused JSX type import, and correct
jsx-indent-props on channel access rules confirm modal.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Bring the compass-ui Button migration branch up to date with latest master.
Resolved permission_policy_details.tsx by keeping this PR's BlockableButton
cancel control and destructive={true} GenericModal API, while taking master's
Burn-on-Read permission policy additions.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Bring in Section C leadingIcon/trailingIcon updates. Resolve overlapping
admin files in favor of the parent icon-slot versions.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Refresh Jest snapshots for leadingIcon wiring and remove unused
.btn-primary .icon overrides that no longer apply to compass-ui Button.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Wire compass-ui Button iconography through leadingIcon + Icon glyph
instead of nested font-icon children, and migrate remaining Section C
admin call sites from shared Button with size/destructive updates.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Repair a corrupted logs.tsx import left by the bulk rewrite, update
graph_values tests for compass-ui emphasis class names, and refresh
admin_console snapshots after the Button migration.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Move in-page admin console Button call sites from @mattermost/shared
onto @mattermost/compass-ui, remapping sizes (xs/sm/md/lg →
x-small/small/medium/large) and destructive/inverted variants.
Convert clear buttonClassNames CTAs that are real buttons, and retarget
SCSS that depended on Bootstrap .btn / .btn+.btn spacing to flex gap
and custom class selectors.
Leave link-styled navigation, menu triggers, and ToggleModalButton
buttonClassNames for a later wave.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Compass-ui Buttons no longer get Bootstrap .btn + .btn margins; add
gap: 8px on the AdminUserCard__footer flex container instead.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Prior SaveChangesPanel-only fix left many .admin-console-save footers
using BlockableLink + shared buttonClassNames (btn-tertiary/quaternary
on <a>). Rewrite unused BlockableButton as a compass-ui Button with
navigation blocking, use it for cancelLink and every remaining save-bar
Cancel, and migrate system_user_detail Cancel/Buttons to compass-ui.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Pass selected glyphs via leadingIcon/trailingIcon with compass-ui Icon
instead of rendering font icons as Button children.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Save and Cancel in .admin-console-save are compass-ui Buttons, so the
legacy .save-button / .cancel-button height, color, and hover overrides
no longer apply. Keep flex/gap bar chrome and error-message styles; drop
the dead IP Filtering .btn.btn-primary:disabled override as well.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Replace Cancel/Done Links styled with buttonClassNames (.btn) with
@mattermost/compass-ui Button in integrations and emoji backstage
form footers. Add flex gap: 8px on .backstage-form__footer so Cancel
and SpinnerButton keep 8px spacing without Bootstrap .btn+.btn margins.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Cancel with cancelLink was still a BlockableLink using shared
buttonClassNames (quaternary), so it did not match Save and misaligned.
Use compass-ui Button emphasis=tertiary for both cancel paths, preserve
unsaved-changes deferral via deferNavigation + getHistory, and align
controls with flex gap on .admin-console-save.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
* Recommend Aurora reader endpoint for DataSourceReplicas
Hardcoded reader instance endpoints go stale when readers are added or removed and don't work with Aurora Replica Auto Scaling. Default to the cluster reader endpoint with a short ConnMaxLifetimeMilliseconds, keep instance endpoints as an alternative, and clarify that pool limits apply per DataSourceReplicas entry.
* Present both Aurora replica configurations with pros and cons
Update User Groups Create Group and View User Group header CTAs
(Add people / Restore Group) from emphasis secondary to tertiary.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Replace the shared Button in the Browse Channels modal header (and shared
empty-state helper) with @mattermost/compass-ui Button. Header CTA uses
small size and tertiary emphasis; empty-state keeps primary/medium.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Compass-ui Buttons no longer get Bootstrap .btn + .btn margins; add
gap: 8px on the flex button container instead.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
InvitationModal views were skipped in the Phase 2 modal migration
because their filenames do not contain "modal". Move Copy invite
link, Invite, Invite More, and Done buttons onto compass-ui Button,
and drop the redundant InviteView footer .btn font-weight override
(compass Button already uses semibold).
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
* Add new feature flag and abac permission policy for BoR
* Rename HasPermissionToFileAction to more general HasPermissionToChannelAction
* Added feature flag for BoR Permission Action, added front-end controls for adding BoR actions to policy
* Added enforcement of BurnOnRead for ABAC at request time
* Added webapp client-side rendering of create BoR permission
* Additional server tests to ensure proper error response for rejected burn-on-read
* When BoR is disabled, disable send button for remaining BoR drafts and reschedule/edit/sendNow buttons for scheduled BoR posts
* Added e2e tests for general feature coverage
* Disable send and schedule buttons in the client in the draft row for lingering BoR drafts when ABAC BoR is revoked
* Update e2e test for BoR control to be isVisible vs Attached for better coverage
* Properly disable BoR from wysiwyg editor
* Style fix
* Fix scheduled_post_test to verify post type cannot be changed
* Removed Feature Flag for ABAC BurnOnRead
* Updated documentation for Burn-On-Read permission policy
* coderabbit feedback - minor test improvements
* make keyboard submission consistent for BoR
* fixed broken unit test
* Add required feature flag for testing BoR ABAC Channel Policy
* added clarity in documentation to behavior of burn-on-read policy being revoked
* Added disclaimer about ABAC permission policies and where they apply and do not
* Added requirement for channel permission policies in documentation - based on review feedback
* Added translation description to new error message
* Renamed merged-in method calls to HasPermissionToFileAction
* Added missing descriptions to webapp/en.json
* Fix typo in mock
* minor typo fix in docs
* Add missing label for BoR action in Policy Table
* Update en.json with updated description text
* Update e2e test to fix updated permission policy description text
Use flex gap on .multi-select__container instead of Bootstrap .btn
margin-left so the search field and Go button keep an 8px gap when
SaveButton uses compass-ui Button without the .btn class.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Bootstrap 3 ::before/::after clearfix pseudos were participating in
.modal-footer flex layout and adding extra 8px gap spacing. Hide them
so only real footer buttons receive the gap.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Replace Bootstrap .btn+.btn margin with flex gap on .modal-footer so
compass-ui Buttons keep the 8px horizontal spacing. Drop the redundant
ChannelNotificationModal nested footer so buttons are direct flex children.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Continue the leaf-first Button migration by moving GenericModal,
standalone modal leaves, SaveChangesPanel/SaveButton, SpinnerButton,
and the component library demo onto @mattermost/compass-ui Button.
Replace confirmButtonVariant with a destructive boolean on ConfirmModal
and GenericModal, and update agent/style docs to prefer compass-ui for
new and migrated call sites.
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
* MM-70812: Lock plugin-managed channel attribute values in the channel RHS
The Channel Attributes panel in Channel Info decided a row was editable from
permission_values alone. The server refuses every session write to a field
whose values an integration owns -- attrs.protected with a source_plugin_id,
or a non-empty attrs.owners list -- before permission_values is consulted, so
a channel admin was offered a dropdown that could only end in "Couldn't save".
Mirror that gate client-side and show the row's padlock, so the attribute
reads as deliberately read-only rather than broken.
Co-authored-by: mattermost-code <matty-code@mattermost.com>
* Tidy comments and typing in the source-managed attribute lock
Name the gate source-managed rather than plugin-managed, since it also
covers ldap/saml sync, drop a comment that repeated the hook's own doc,
annotate the ownership table instead of asserting its type, and wrap the
new spec's objective to match the ones beside it.
* Format the new channel attribute spec to prettier's liking
Co-authored-by: mattermost-code <matty-code@mattermost.com>
* Add the MM-70812 walkthrough artifacts and ticket link
The PR description could not be amended after it was opened, so the
before/after evidence and the ticket link live here instead.
Ticket: https://mattermost.atlassian.net/browse/MM-70812
Reproduced on a real server against a protected channel attribute created
by a purpose-built plugin (the only caller the server lets set
attrs.protected), holding the value NOFORN on Town Square. Before, the
value opened an option menu and the save came back 403
app.property.access_denied.app_request. After, it is a read-only chip
behind a padlock.
Side-by-side crop:
https://cursor-plugin-pr-assets.s3.amazonaws.com/cursor/cursor/jira-bug-fix-agent-workflow-5926/before-after-comparison.png
Before, save failed:
https://cursor-plugin-pr-assets.s3.amazonaws.com/cursor/cursor/jira-bug-fix-agent-workflow-5926/before-save-failed.webp
Before, full walkthrough:
https://cursor-plugin-pr-assets.s3.amazonaws.com/cursor/cursor/jira-bug-fix-agent-workflow-5926/before-protected-attr-editable.mp4
After, locked read-only chip:
https://cursor-plugin-pr-assets.s3.amazonaws.com/cursor/cursor/jira-bug-fix-agent-workflow-5926/after-readonly-chip.webp
After, full walkthrough:
https://cursor-plugin-pr-assets.s3.amazonaws.com/cursor/cursor/jira-bug-fix-agent-workflow-5926/after-protected-attr-readonly.mp4
Co-authored-by: mattermost-code <matty-code@mattermost.com>
* e2e: set MM-T622 override flags via config patch
The admin-console Save control stays disabled when the radios already
match leftover Integration Management config. Patch the two override
flags and store a stable hook-level icon instead.
Co-authored-by: mattermost-code <matty-code@mattermost.com>
* e2e: align Session Attributes type labels with String/Boolean/Enum
The listing Type column is getDisplayType (String | Boolean | Enum).
IP/Version labels were removed from the product.
Co-authored-by: mattermost-code <matty-code@mattermost.com>
* e2e: stage dirty-nav via Enable instead of the TTL submenu
The nested Time-to-live submenu is racy under MUI. Staging Enable is
enough to dirty the page, and enable() now waits for the menu to close.
Co-authored-by: mattermost-code <matty-code@mattermost.com>
* Address PR feedback: 0 answered, 2 resolved, 0 declined
Revert unrelated e2e test changes flagged by reviewer:
- disallow_username_profile_override_spec.js (incoming webhook icon setup)
- session_attributes.spec.ts + session_attributes.ts helper (dirty-check tweak)
These were unrelated to the channel-attributes locking fix (MM-70812) and
are restored to their master state.
* Add the translator description for the large-emoji processing error
Enterprise i18n extract writes a description for every en.json entry. The new emoji processing error was missing one, so the check failed.
Co-authored-by: maria.nunez <maria.nunez@mattermost.com>
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: mattermost-code <matty-code@mattermost.com>
Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
* Honor Attribute Management page disabled state on the listing
Wire the schema isDisabled prop through GlobalAttributes so non-sysadmins
see a disabled New attribute button, View instead of Edit, and a disabled
Delete action. Also align the Classification row license gate with the
Classification Markings route (Enterprise Advanced).
Co-authored-by: Julien Tant <JulienTant@users.noreply.github.com>
* Point Attribute-Based Access help links at Attribute Management
The old system_attributes/user_attributes URLs only redirect now. Update
the ABAC enable help text and related empty-state CTAs to manage_attributes
and rename the link label to Attribute Management.
Co-authored-by: Julien Tant <JulienTant@users.noreply.github.com>
* Cascade template LDAP/SAML sync source edits to linked Users fields
LDAP sync reads attrs.ldap/attrs.saml on the Users field, which were only
copied from the template at create time. When Save updates the template
sync source, also PATCH the already-linked Users field so existing sync
mappings stay in sync.
Co-authored-by: Julien Tant <JulienTant@users.noreply.github.com>
* Add Playwright coverage for Attribute Management admin fixes
Cover the non-sysadmin read-only listing, ABAC help link to
Attribute Management, and cascading LDAP sync-source edits onto
already-linked Users fields.
Co-authored-by: Julien Tant <JulienTant@users.noreply.github.com>
* Fix Prettier formatting in attribute_management_link e2e spec
Co-authored-by: Julien Tant <JulienTant@users.noreply.github.com>
* Add JSDoc @objective to attribute_management_link e2e spec
lint:test-docs requires a preceding JSDoc with @objective for tagged
test() declarations; the file-level comment was not attached to the test.
Co-authored-by: Julien Tant <JulienTant@users.noreply.github.com>
* Remove low-value ABAC help-link Playwright e2e
The href change is a static admin_definition/i18n string; listing
permissions and sync-source cascade remain covered by e2e.
Co-authored-by: Julien Tant <JulienTant@users.noreply.github.com>
* Hide Classification row when Classification Markings is unreachable
Below Enterprise Advanced (or with the flag off), do not show the
Classification template as an ordinary Edit/Delete row — hide it.
Co-authored-by: Julien Tant <JulienTant@users.noreply.github.com>
* Fix ABAC help link navigation to Attribute Management
Use React Router Link with an absolute admin_console path so the
help-text control navigates inside the SPA instead of a relative
plain anchor that did not reliably change the route.
Co-authored-by: Julien Tant <JulienTant@users.noreply.github.com>
* Fill missing i18n description for emoji too-large-to-process error
Enterprise Check i18n fails when extract adds an empty description for
api.emoji.upload.large_image.too_large_to_process.app_error (introduced
without one in #38716). Add a translator-facing description so extract
stays clean.
Co-authored-by: Julien Tant <JulienTant@users.noreply.github.com>
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Julien Tant <JulienTant@users.noreply.github.com>
Turn PropertyFieldGraph and ResourceAttributesInPolicies on in
FeatureFlags.SetDefaults so new servers enable graph attributes and
channel resource attributes in access policies without an explicit flag.
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* Format the admin console exact-time tooltip as one message
The tooltip spliced a translated "at" into a moment format string, so a locale
that needs no connecting word had no way to say so: "" falls back to the
English, and zh-CN had settled on " ". It is now a single message formatting the
date and time for the reader's locale, and translators can reorder or drop the
connecting word.
Each existing translation of "at" is carried into the new message as it
rendered before; ja's was untranslated English and is left to fall back.
* Remove the whitespace-only server translations
438 entries across es, fr, it and ja held " " in place of a full English
sentence, mostly error messages. go-i18n renders that as-is, so the user saw a
blank message where a missing id would at least have fallen back to English.
Removed with `mmgotool i18n clean-empty`.
* Report a blank translation the way a missing one is reported
Both runtimes treat an empty translation as missing: react-intl falls back to
the English, and go-i18n returns the id. A whitespace-only one is worse: it
renders, and the user sees nothing. Both checkers now report either as a missing
key, under the same --warn-missing-keys / --warn-missing-ids flags, and
`mmgotool i18n clean-empty` removes both.
clean-empty also now writes the two-space indent the catalogs use.
* Correct the connecting word in six exact-time translations
The carried-over "at" was wrong in ko, pl, ru, nl, tr and zh-TW: Korean
attaches 에 to the date, Polish, Russian and Dutch take o, в and om before a
clock time, and Turkish "zaman" and the spaced zh-TW 於 read as noise, so both
drop the word as zh-CN already does.
* [MM-70902] Attach leader diagnostics with per-section errors to health snapshot
GetSupportPacketDiagnostics now returns a NodeDiagnostics envelope whose
Errors map records every node section, with each collection failure also
set on its section. The support packet still marshals only the
diagnostics, so diagnostics.yaml and warning.txt are unchanged.
BuildHealthSnapshot attaches the envelope to the leader node only.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* Drop unreachable nil check on the diagnostics envelope
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Allow background cluster publishes in the leader-diagnostics test
Setup's config-change publishes can reach the strict cluster mock and panic
the test binary intermittently.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Install the three-node cluster at setup instead of swapping it
SetCluster on a running server races with background config publishes.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Allow background cluster publishes in the section-errors cluster subtest
The strict cluster mock rejected Setup's config-change publish from a
PlatformService.Go goroutine, which exited without decrementing the
goroutine count and hung Shutdown until the package timed out.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* [MM-70882] Add live health snapshot provider
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* Simplify live snapshot provider and serialize latest-version cache tests
The snapshot tests clear the global latest-version cache, which the parallel
TestGetLatestVersion also writes, so they no longer run in parallel.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Document leader-only precondition of BuildHealthSnapshot
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* test: add typed support packet golden fixtures
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* refactor: return typed support packet collector structs
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* Move support packet golden tests into the platform package
The golden test imported the server module from public/model, which is a
separate module that must not depend on the server, and it compared against
a copy of the diagnostics comment map instead of the real one. The golden
files are moved byte-for-byte. A marshal failure now yields no file rather
than an empty one.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Resolve support packet golden files from the package path
The platform test main changes the working directory, so a relative
testdata path does not resolve under CI.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Record job and permission goldens in UTC
Job, Role and Scheme render their timestamps in server-local time, so the
jobs.yaml and permissions.yaml goldens recorded on a +01:00 machine failed
under CI's UTC. Both were regenerated from the pre-refactor golden commit
(df2d9a7479) with TZ=UTC; the diff is timestamp strings only, and the other
five goldens came out byte-identical. Those two cases skip when the process
zone is not UTC.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Merge support packet file helpers into support_packet.go
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Test support packet wiring against goldens and format timestamps in UTC
Each section's filename and encoding now lives in a named function that both
GenerateSupportPacket and the golden tests call, so wiring changes can no longer
pass the goldens unnoticed. App-level goldens move to the app package, which is
the only one that can reach its wiring.
Job, role and scheme timestamps are formatted in UTC, so support packets no
longer depend on the server's local time zone and the golden tests no longer
skip outside UTC.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Keep support packet timestamps in server-local time
Reverts the UTC formatting in timeutils.FormatMillis and restores the UTC-only
skip for the jobs and permissions goldens.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* [MM-70880] Pointerize SupportPacketStats and add Stat accessor
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* Cover private channel query failure in stats test
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Rename shadowed test helper in stats subtests
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* Add aggregate size and depth limits to archive and Slack import extraction
- Add ExtractionBudget to docextractor interface; thread shared byte budget
and max depth through all extractors so nested archives share one pool
- Cap archive walk at 1000 entries per level and maxArchiveDepth levels
- Cap Slack import at 500MB total decompressed across all ZIP entries
* Add depth-limit and aggregate-size tests
Add TestArchiveExtractorDepthLimit to verify that nested archive
extraction stops at maxDepth levels. Add TestSlackImportTotalSizeLimit
to verify that the aggregate byte cap halts Slack import entry
processing once the limit is reached.
Convert slackImportMaxTotalSize from const to var so tests can lower
the threshold without creating multi-hundred-megabyte fixtures.
* Cap subtext to remaining budget before appending
* Restore Ctx field in ExtractSettings for API compatibility
* Honor caller context cancellation in extractWithTimeout
ExtractSettings.Ctx was restored for API compatibility but was never
observed by extractWithTimeout. A cancelled request context could wait
for the full extraction timeout (or forever when Timeout <= 0).
Now, when Ctx is set, extractWithTimeout runs on a goroutine and selects
on resultCh, timer.C (if Timeout > 0), and ctx.Done() — returning a
cancellation error as soon as the caller context is cancelled. A nil
channel for timer.C means the timeout case simply never fires when
Timeout <= 0. The fast synchronous path is retained for the common case
where neither Ctx nor Timeout is set.
Adds TestExtractContextCancellation covering: already-cancelled context,
mid-extraction cancellation, and ctx vs timeout race (ctx wins first).
* Update pdf.go to use github.com/mattermost/pdf fork
The go.mod was updated upstream to replace github.com/ledongthuc/pdf
with the Mattermost fork github.com/mattermost/pdf. The pdf.go import
was not updated during the rebase because git kept our version of the
file. Also pass context.Background() to GetPlainText, which the fork
extended to take a context.Context.
* Don't log archive entry path in extraction error
Entry paths from user-uploaded archives should not appear in
error messages, per the pattern established in #37987.
* Restore ctx to Extractor interface alongside budget
Adds context.Context back as the first parameter to Extractor.Extract,
alongside the existing ExtractionBudget parameter. This restores
Alejandro's MM-69725 fix: pdfExtractor passes the context down to
GetPlainText(ctx), so when extractWithTimeout returns (timeout or parent
cancellation), the derived context is cancelled and the PDF goroutine
stops at the next page rather than running to completion.
mmPreviewExtractor also gains context propagation via
http.NewRequestWithContext so its outbound HTTP call can be cancelled.
Context-unaware extractors (document, plain) accept and ignore it.
* Fix test extractors to implement updated Extractor interface
* Fix remaining test extractors to implement updated Extractor interface
---------
Co-authored-by: Edgar <edgar.bellotmico@mattermost.com>