ES /docs

PreprocessorService::updateCaptureMarkMeta | error - {

Validation: 63cc1cee-f4e5-42d3-9456-1e85c876dabd

Verdict: APPROVED#

Completeness#

# Plan Item Status Evidence
1 Add update_meta_bulk action in metable_controller.rb — merges top-level JSON keys into @model.meta and saves once PASS app/controllers/concerns/metable_controller.rb: lines 71-93 in diff add update_meta_bulk method with JSON.parse of request body, Hash validation (parsed_meta.is_a?(Hash)), per-key merge into @model.meta[key], and single @model.save call
2 Add put 'meta/bulk', action: :update_meta_bulk route in config/routes.rb between put 'meta' and get 'meta/*meta_key' PASS config/routes.rb: line 319 in diff inserts put 'meta/bulk', action: :update_meta_bulk directly after put 'meta' (line 318) and before get 'meta/*meta_key' (line 320)

Acceptance Criteria#

# Criterion Status Evidence
1 PUT /captures/:id/meta/bulk endpoint added in MetableController PASS app/controllers/concerns/metable_controller.rb: lines 71-93 define update_meta_bulk action; config/routes.rb: line 319 maps put 'meta/bulk' to this action within the :metable concern (which is used by captures resources)
2 Request body validated as Hash, each key merged into @model.meta[key], single save PASS app/controllers/concerns/metable_controller.rb: line 77 parses JSON via JSON.parse(request.raw_post), line 78 raises ARG10004 unless parsed_meta.is_a?(Hash), lines 80-82 iterate keys and assign @model.meta[key] = value, line 84 calls @model.save once
3 Existing update_meta_by_key and update_meta endpoints unchanged (backward compatible) PASS Diff shows no modifications to existing update_meta, update_meta_by_key, or show_meta_by_key methods in metable_controller.rb; routes for put 'meta', get 'meta/*meta_key', and put 'meta/*meta_key' are untouched in config/routes.rb
4 meta/bulk route defined before meta/*meta_key wildcard for correct matching PASS config/routes.rb: line 319 (put 'meta/bulk') precedes line 320 (get 'meta/*meta_key') and line 321 (put 'meta/*meta_key'), ensuring the literal path matches before the wildcard glob
5 Rubocop lint / srb tc passes CANNOT VERIFY Cannot verify from diff -- requires runtime check. No obvious style violations observed (standard Ruby idioms, proper indentation, consistent error class usage).

Issues Found#

No blocking issues found.

Observations#

  1. Permission check pattern: The permission guard in update_meta_bulk (lines 72-74) follows the same !@model.updatable_by?(current_user) && (@review.present? && !@review.updatable_by?(current_user)) pattern used in existing actions like update_meta_by_key, maintaining consistency with the codebase.

  2. skip_entrypoint_flush guard: Line 83 conditionally sets @model.skip_entrypoint_flush = true only if the model responds to it (respond_to?(:skip_entrypoint_flush)). This mirrors the existing convention in the controller and avoids NoMethodError for models that lack this attribute.

  3. Error codes: The method reuses existing error codes (ARG10004 for parameter errors, PERM10000 for permission denied), consistent with the rest of the codebase.

  4. Client-side change required: The preprocessor agent will need a corresponding update to call PUT meta/bulk instead of individual PUT meta/*meta_key calls for the lock contention reduction to take effect. This is outside the scope of this diff but necessary for the full fix to be realized.