Skip to content

test(oetf): KIND-safe workflow-labels scenario (D1) - #1254

Open
jiaenren wants to merge 7 commits into
jiaenr/osmo-6501-b9-label-uifrom
jiaenr/osmo-6501-d1-label-oetf
Open

test(oetf): KIND-safe workflow-labels scenario (D1)#1254
jiaenren wants to merge 7 commits into
jiaenr/osmo-6501-b9-label-uifrom
jiaenr/osmo-6501-d1-label-oetf

Conversation

@jiaenren

@jiaenren jiaenren commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Issue - None

Track D1 of the workflow-labels split (from #1194). Adds the OETF label scenario, based on B9 (#1227) — the current stack tip — so its KIND gate validates the whole label stack (B5–B9) end to end.

test/scenarios/workflow_labels.py is the KIND-safe subset, verified purely through the OSMO API (a sandboxed OETF test has no in-cluster kubeconfig):

  • policy gate off / warn / enforce via validation-only submits (no rows, nothing schedules): warn surfaces warnings, enforce rejects with 400 and leaves no row, off accepts anything;
  • label-syntax rejection: nested value, invalid key, empty value;
  • list filtering: exact label, glob, and no_label;
  • end to end: one real labeled workflow runs to COMPLETED, and its labels survive submit → persistence → workflow API + list filtering.

Tagged kind, so it runs in the oetf:deploy_and_run --env kind gate (which --build-locals the whole stack and deploys it to KIND in DB mode). Serial + exclusive because the policy tests mutate labels_config; each restores the baseline in tearDown, and mutation tests skipTest in ConfigMap mode.

Scope note (pod-object verification)

A literal in-cluster pod-label assertion is not reachable from the gate: OETF scenarios run via bazel test with only OETF_URL + auth + OETF_POOL forwarded, so the test can't reach the KIND cluster with kubectl. The end-to-end test therefore verifies the label through the API (submit → run → persisted labels echoed + filterable). The actual pod stamping (apply_workflow_labels) is covered by unit tests (B4) and dev/Orin runs. A true pod-object check would need kubeconfig forwarded into the OETF test env — a small runner change we can add later if wanted.

The heavier lifecycle + ConfigMap-fixture matrix (the prototype's test_ppp_enforcement_matrix) runs on dev/Orin and is out of scope for this KIND smoke.

Verification

  • bazel build //test/scenarios:workflow-labels and //test/scenarios:workflow-labels-pylint pass locally.
  • Full-stack KIND gate: triggered on this branch via workflow_dispatch (the Local KIND Deployment workflow auto-triggers only on PRs to main; this PR is stacked on B9, so the gate is dispatched manually until the stack retargets main).

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

🤖 Generated with Claude Code

@jiaenren
jiaenren requested a review from a team as a code owner July 29, 2026 23:46
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

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

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

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 295872dc-83c8-413f-8191-b2a0d3c15cc1

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

Comment @coderabbitai help to get the list of available commands.

@jiaenren
jiaenren force-pushed the jiaenr/osmo-6501-d1-label-oetf branch from cde9d2d to bd4f40b Compare July 30, 2026 18:25
@jiaenren
jiaenren force-pushed the jiaenr/osmo-6501-d1-label-oetf branch from bd4f40b to 890fb80 Compare July 30, 2026 22:31
@jiaenren
jiaenren force-pushed the jiaenr/osmo-6501-d1-label-oetf branch from 890fb80 to 1048b3f Compare July 30, 2026 23:47
@jiaenren
jiaenren force-pushed the jiaenr/osmo-6501-d1-label-oetf branch from 1048b3f to 72c2698 Compare July 31, 2026 22:02
jiaenren and others added 7 commits July 31, 2026 15:07
Adds test/scenarios/workflow_labels.py, the KIND-runnable subset of the
label feature verified through the OSMO API (the only channel a sandboxed
OETF test has):

- policy gate off/warn/enforce via validation-only submits (no rows,
  nothing schedules), asserting warn surfaces warnings and enforce
  rejects with 400 and leaves no row;
- label-syntax rejection (nested value, invalid key, empty value);
- list filtering by label, glob, and no_label;
- one real end-to-end labeled workflow that runs to COMPLETED, whose
  labels survive submit -> persistence -> API surface + list filtering.

Tagged `kind` so it runs in the `oetf:deploy_and_run --env kind` gate,
which builds the whole stack locally and deploys it. Serial + exclusive
because the policy tests mutate labels_config; each restores the baseline
in tearDown, and mutation tests skip in ConfigMap mode. The heavier
lifecycle and ConfigMap-fixture matrix runs on dev/Orin, not here.

Based on B9 (#1227), the current stack tip, so the KIND gate validates
the full label stack end to end.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Tagging a scenario `kind` is necessary but not sufficient — the KIND
gate runs an explicit, cost-narrowed target-pattern allowlist (smoke +
templates + mount-validation). Add //test/scenarios:workflow-labels so
the label policy gate, filters, and one real labeled end-to-end run are
covered on every full-stack KIND deployment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pass label/policy submit kwargs explicitly instead of **splatting a
dict[str, str] into typed parameters, and narrow the rejection path with
a single _expect_rejected helper (assertIsNotNone does not narrow for
mypy; the try/except + self.fail idiom does).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
oetf_scenario_test runs the file as __main__ (main = src). Without an
`if __name__ == "__main__": unittest.main()` block the py_test imported
the module and exited 0 without executing any test method — a hollow
pass. Add the standard entry point (matching every other scenario).
Three fixes found by actually running the tests on the KIND gate:
- _set_policy compares only key/enforcement/allow_list; the LabelPolicy
  model carries extra fields (assert_message) that default in on
  read-back, so an exact-dict compare was wrong.
- list-filter assertions use the workflow id returned by submit (which
  carries the "-<job>" suffix the list echoes), not the base name.
- the end-to-end test asserts the label round-trip (submit -> persist ->
  workflow API + list filter) instead of run-to-completion: the PR-gate
  KIND does not run workflows to completion (only validation scenarios
  are gated), and pod stamping is covered by unit tests.
The label scenario is green (Ran 6 tests, OK); restore the upload step's
if: failure() guard now that the diagnostic served its purpose.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jiaenren
jiaenren force-pushed the jiaenr/osmo-6501-d1-label-oetf branch from 72c2698 to dbd9d4c Compare July 31, 2026 22:07
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