Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

OVCS rc.49: readiness permission-label pre-flight and a plain 403 message (meta#15613) - #4679

Merged
edulix merged 1 commit into
ovcsfrom
meta-15613-readiness-preflight
Dec 3, 2026
Merged

edulix merged 1 commit into
ovcsfrom
meta-15613-readiness-preflight

Conversation

@edulix

@edulix edulix commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Parent issue: https://github.com/sequentech/meta/issues/15613 (rc.49 tracker sequentech/meta#15576)

Problem

On ovcs-server, "Production readiness (signed)" returned a bare 403 "Election outside the user's permission labels" from harvest's authorize_events, because TEST elections carried <LABEL>-TEST labels the admin didn't hold. The dialog then said the response "may have been lost after evidence was recorded", but nothing had been recorded: the refusal happens before any lock or write.

Changes

Pre-flight (harvest + admin portal)

  • readiness_check takes an optional preflight: Boolean (added to actions.graphql; absent or null means the normal check). With preflight: true it opens a read-only transaction, checks tenant, permission and event existence as usual, and returns {preflight: true, unreachable: [{event: official|tested, event_id, election_id, permission_label, external_id?, presentation?}]}. It never locks, compares or records anything.
  • The pre-flight and the check's own refusal call the same unreachable_elections, which uses authorization::elections_outside_permission_labels. That is the rule ensure_elections_permitted applies (from meta#15614), now public, so the two can't disagree.
  • The dialog runs the pre-flight when the tested event is chosen or changes. It lists each unreachable election (alias, event, label) and says what to do: "Ask a user manager to grant {labels} to this admin (Users, Permission labels), then sign out and back in." Run check stays disabled while the list is non-empty. If the pre-flight itself fails, Run check is not blocked, because the server still refuses on its own.

Wording

  • The check's label refusal is now a 403 with code readiness-outside-permission-labels. Its message is Election outside the user's permission labels: ROME, ROME-TEST, naming the missing labels once each. The refusal is also logged through warn_label_refusal (meta#15614).
  • services/readinessPreflight.ts::readinessFailure sorts failures into three kinds:
    • labels: the new code, or the old bare message from an older server. Shows "You don't hold permission labels for: … The check was refused before anything was recorded."
    • refused: Unauthorized, InvalidReadinessCheck or ElectionEventNotFound, all refused before any write. Shows "The server refused the check before recording anything." plus the server's message.
    • ambiguous: network errors, 5xx (including the signed-append stage), unknown codes and unreadable answers. These keep the existing "may have been lost after evidence was recorded" message.
  • Strings are in en, es, tl, fr, cat, gl, eu and nl.

Status check. The read-only label status check is in sequentech/beyond (sequent status), in a separate PR. It flags (a) elections whose label differs from their area's Post label and (b) events no single admin fully covers.

Coordination

Tests

  • harvest (cargo test -p harvest --lib, docker cargo-packages):
    • New: routes::readiness::tests::{a_label_refusal_is_a_403_naming_each_missing_label_once, the_preflight_answer_names_the_event_and_label_of_each_gap, preflight_is_opt_in_and_never_the_signed_check} and services::authorization::permission_label_tests::the_preflight_lists_exactly_what_the_refusal_refuses.
    • The existing readiness and permission-label unit tests pass.
    • Not run locally: the DB-backed readiness_routes integration tests, which need the test Postgres.
  • admin-portal (jest, node:22):
    • New src/services/readinessPreflight.test.ts: parsing, plus the 403 / refused / ambiguous choice.
    • ReadinessCheckButton.test.tsx: new cases for the unreachable list blocking Run, a clean pre-flight allowing it, a failed pre-flight not blocking, the label-403 wording, and the refused-before-write wording. The existing cases are unchanged.
    • 36/36 pass.
    • tsc --noEmit reports nothing new in the touched files (only the pre-existing unbuilt @sequentech/ui-core import).

🤖 Generated with Claude Code

…(meta#15613)

- harvest: `readiness_check` takes `preflight: true`, a read-only answer
  listing each election of either event the caller's permission labels
  don't reach (event, election, label, alias). It and the check's own
  refusal go through one function, so they can't disagree. The refusal
  is now a 403 with code `readiness-outside-permission-labels` naming
  the missing labels.
- admin portal: the readiness dialog runs the pre-flight when the tested
  event is chosen, lists the unreachable elections with the label to
  grant, and disables Run check while any remain. A permission-label
  403 says "You don't hold permission labels for: ..." and that nothing
  was recorded; other refusals before any write say so too. The
  "may have been lost after evidence was recorded" message is kept for
  network, 5xx and unreadable answers only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review: 2

  • release/10.0
  • feat/meta-12767/.*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@edulix
edulix merged commit 23c9bd2 into ovcs Dec 3, 2026
33 of 38 checks passed
@edulix
edulix deleted the meta-15613-readiness-preflight branch December 3, 2026 09:50
edulix added a commit that referenced this pull request Dec 3, 2026
…'s message (meta#15602)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant