Skip to content

feat(robot): allow conditional no-status-rc#634

Draft
axisrow wants to merge 2 commits into
robotcodedev:mainfrom
axisrow:ao/robotcode-4/conditional-no-status-rc
Draft

feat(robot): allow conditional no-status-rc#634
axisrow wants to merge 2 commits into
robotcodedev:mainfrom
axisrow:ao/robotcode-4/conditional-no-status-rc

Conversation

@axisrow

@axisrow axisrow commented Jul 12, 2026

Copy link
Copy Markdown

Summary

Allow no-status-rc to accept the existing Condition form, enabling branch-dependent status-code behavior without duplicating profiles:

default-profiles = ["ci"]

[profiles.ci]
enabled = { if = "environ.get('CI') == 'true'" }
no-status-rc = { if = "environ.get('CI_COMMIT_REF_NAME') == 'main'" }

A failing Robot run now returns 0 on main and preserves the failure status on feature branches. Existing true, false, on, off, and default behavior remains unchanged.

Fixes #482.

Design choice

I prototyped both designs raised in the issue against the same 12 behavioral cases:

  • Reuse Condition { if = ... }.
  • Add a public BoolExpression { expr = ... } type.

Both produced the required boolean flag behavior. I kept Condition because it matches the requested syntax, reuses the existing safe evaluation path, and avoids another public model and schema definition. The conditional form resolves to true or false; static default remains available through the existing literal form.

Because Condition is now shared by profile fields and a flag field, the schema generator also avoids attaching a context-specific documentation link to its shared if property.

Type of change

  • Bug fix
  • New feature
  • Refactor / internal change
  • Documentation
  • Build / CI / tooling
  • Breaking change

Checklist

  • I have read the Contribution Guide and the AI and Automated Contribution Policy.
  • The change is focused on a single concern (no unrelated refactors or formatting noise).
  • Tests for the change have been added or updated, and hatch run test:test passes locally (RF matrix against the default Python) — or N/A for documentation-only / non-code changes. See Running Tests for faster iteration options and the full matrix.
  • hatch run lint:all passes (also enforced by the pre-commit hooks if installed) — or N/A for documentation-only / non-code changes.
  • Documentation has been updated where relevant (user docs, code comments, README).
  • Generated files (if any) were regenerated with the documented script, not edited by hand.
  • Commits follow Conventional Commits and are cryptographically signed (git commit -S, GPG/SSH).

AI / tooling disclosure

  • No AI/automation was used beyond ordinary editor autocomplete.
  • AI/automation was used; tool(s): OpenAI Codex through Agent Orchestrator
    • I reviewed the generated output manually, understand it, and verified it locally.

AI/tooling disclosure: This contribution was prepared with assistance from OpenAI Codex through Agent Orchestrator. I manually reviewed the diff, understand the implementation, verified it locally, and confirm that I have the right to submit it under the project license.

Additional notes

Acceptance proof

The end-to-end test uses the configuration shown above, selects the single ci profile through default-profiles, and runs a deliberately failing Robot suite through a real RobotCode subprocess without -p:

  • CI=true, CI_COMMIT_REF_NAME=main: --nostatusrc, exit code 0.
  • CI=true, CI_COMMIT_REF_NAME=feature/example: --statusrc, exit code 1.

The same test fails on unmodified main while parsing profiles.ci.no_status_rc because the conditional table is not accepted there.

Verification

  • hatch run test:test: passed across rf50, rf60, rf61, and rf70 through rf74; the final rf74 run reported 3933 passed, 22 skipped, and 2 xfailed.
  • Focused matrix: 28 tests passed in each of the eight Robot Framework environments.
  • Ruff check and formatting stages: passed; 413 files already formatted.
  • JSON Schema Draft 7 validation: passed.
  • Generator idempotence: repeated model and schema generation produced identical hashes.
  • git diff --check: passed.

A fresh hatch run lint:all reaches one mypy 2.2.0 comparison-overlap error in the untouched packages/plugin/src/robotcode/plugin/__init__.py:352. The same error reproduces on unmodified main; Ruff and all feature-related tests pass. The lint checklist remains intentionally unchecked.

Generated artifacts

The model and schema were regenerated with:

hatch run test.rf74:python scripts/generate_rf_options.py
hatch run test.rf74:ruff format packages/robot/src/robotcode/robot/config/model.py
hatch run test.rf74:python scripts/create_robot_toml_json_schema.py

The updated no-status-rc documentation matches the generated model output. Generator compatibility adjustments preserve existing field aliases, the existing max-error-lines = "NONE" example, and generated-block spacing so regeneration does not introduce unrelated output drift.

Allow no-status-rc to reuse the existing Condition model while
preserving the current boolean and ON/OFF/DEFAULT flag semantics.

Add behavioral coverage for root, profile, and rebot configuration,
and regenerate the public model documentation and JSON schema.

Fixes robotcodedev#482
AI-Assisted-By: OpenAI Codex via Agent Orchestrator

Signed-off-by: axisrow <axisrow@users.noreply.github.com>
Exercise the exact issue configuration through a real RobotCode run so main suppresses the failing status and feature branches preserve it. Keep the shared Condition schema free of a misleading context-specific documentation link.

AI-Assisted-By: OpenAI Codex via Agent Orchestrator
Signed-off-by: axisrow <axisrow@users.noreply.github.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.

[ENHANCEMENT, robot.toml] Make no-status-rc accept conditions (like enabled does)

1 participant