Skip to content

Deduplicate workflow parsing and CLI argument handling - #1868

Merged
mergify[bot] merged 1 commit into
mainfrom
lean178/575-src-dedupe-config
Nov 26, 2026
Merged

mergify[bot] merged 1 commit into
mainfrom
lean178/575-src-dedupe-config

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Deduplicate workflow parsing and CLI argument handling

Refs #575.

Context and goal

  • Context: This follows Deduplicate candidate and workflow policy handling #1845's source dedupe and stays within the workflow parser and projection guard.
  • Problem: Local and trusted workflow loading repeat parsing and diagnostics. The CLI wraps the standard Path constructor unnecessarily.
  • Goal: Remove the redundant source while preserving configuration selection, validation, diagnostics and CLI behavior.

Acceptance

  • Remove at least 15 net source lines, targeting 25, within the requested config, eligibility, CLI parser, and types files. Keep existing test files the same size.
  • Keep local and trusted workflow selection, byte decoding, validation order, diagnostics, and exception cause behavior.
  • Preserve CLI argument types, validation, help, and delivery-module lazy loading.
  • Preserve review evidence checks, including fail-closed paths and state ordering.
  • Pass a full slotted check, independent primary review, and readiness before landing.

Notes

Base f227668. Changes touch config validation and review evidence. Keep the same trusted inputs, validation boundaries, and fail-closed outcome checks. Compare malformed workflow diagnostics against base separately from the existing tests.

Per-removal behavior

  • Local files and trusted Git blobs share UTF-8/TOML parsing and validation. Missing local files keep their bootstrap message. Trusted TOML and validation failures keep their fetch hint and suppressed cause; local TOML errors and all decoding errors still chain the original exception.
  • Trusted workflow selection performs the same maximum of two reads. The first may redirect to its declared base; the second must agree with that branch.
  • Mergify validates the queue inside the Mergify branch, with the same missing-name, invalid-name, and unexpected-name errors. Sandbox trees already reject their exact root through is_relative_to, so only / and /home need a separate exact-match check.
  • Resource limits validate in dataclass field order as before and use the same dataclass defaults for omitted values.
  • The CLI uses Path directly for --config. The prior wrapper returned Path with no additional behavior. Argument values, help text, and lazy delivery imports remain unchanged.
  • Projection shape checks share their invalid result. The same tests run in the same short-circuit order before marker/projection decoding.

Validation

Recorded for 2b3e62d52dc2 (unverified, run loopzero check)

  • uv run --group dev ruff check src tests: exit 0
  • uv run --group dev tach check: exit 0
  • uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0
  • scripts/size_budget.sh: exit 0
  • uv run --group dev pytest -q: exit 0

The size gate measured 8,090 to 8,075 source lines (minus 15), with tests unchanged at 13,704 and no complexity regressions. Nineteen base/candidate comparisons verified local and real-Git trusted workflow values, errors and causes. Ten CLI comparisons verified parsed results, help, version and errors.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Review

  • primary, claude, 2b3e62d, approve

Architecture-Review: unchanged; local and trusted workflow inputs retain their validation rules and errors, and review evidence checks keep the same order.
Co-Authored-By: Codex <noreply@openai.com>

@loopzero-feder-positronics loopzero-feder-positronics Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loopzero primary review by claude on 2b3e62d52dc2c1c0f21712957a4beba8070a9842, 24.4s: approve (0 critical, 0 important, 2 suggestion)

Settings per native call (launch configuration and CLI claims, not backend attestation):

  • Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)

Native Claude output is retained in the restricted local review receipt.

Comment thread src/loopzero/config.py
@@ -18,7 +18,6 @@
# Host locations that must never be exposed to the sandbox, even read-only, because they

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Sandbox comment now sits above the wrong constant

The diff removed FORBIDDEN_RO, but its three-line comment ("Host locations that must never be exposed to the sandbox… Subpaths of /home are allowed…") stayed in place. It now sits directly above _ENV_NAME, the env-name regex, so a reader would think the comment describes that regex. The rule it explains is now the inline ("/", "/home") check in _host_paths (line ~293) together with FORBIDDEN_RO_TREES. Smallest fix: move _ENV_NAME above the comment so the comment sits on FORBIDDEN_RO_TREES, and optionally note in the comment that / and /home are rejected only as exact matches in _host_paths. This adds no lines.

Comment thread src/loopzero/config.py
except (tomllib.TOMLDecodeError, ConfigError) as exc:
invalid_toml = isinstance(exc, tomllib.TOMLDecodeError)
message = f"invalid TOML: {exc}" if invalid_toml else str(exc)
raise ConfigError(f"{source}: {message}{hint}") from (exc if invalid_toml and not hint else None)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Whether the original exception is chained now depends on whether a hint is passed

from (exc if invalid_toml and not hint else None) reproduces the base behavior exactly. Local TOML errors chain the original exception. Trusted TOML errors and all validation errors suppress it. Decoding errors always chain through the separate except branch. The catch is that the rule rests on an unrelated fact: an empty hint stands for "local file". If a future caller passes a hint for a local source, or calls this without one for a trusted blob, the cause behavior silently flips. This is non-blocking, but an explicit keyword (for example chain_toml: bool), or a short comment saying an empty hint means a local file, would keep the cause rules from drifting apart.

@eowca
eowca marked this pull request as ready for review November 26, 2026 12:12
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Merged into main as 8761b03 at 12:19 UTC

6 min in the queue, 5 min of it CI.

So far

  • ✅ Entered the queue Thu 26 Nov, 12:13 · rule main · triggered by @eowca with the @mergifyio queue command
  • ✅ Passed · draft #1874
  • ✅ Merged 12:19 · 8761b03 · squash
3 merge conditions met
  • github-review-approved · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = checks
    • check-neutral = checks
    • check-skipped = checks
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = Loop-zero Eligibility
    • check-neutral = Loop-zero Eligibility
    • check-skipped = Loop-zero Eligibility

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot added the queued label Nov 26, 2026
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

No description provided.

@mergify
mergify Bot merged commit 8761b03 into main Nov 26, 2026
16 checks passed
@mergify mergify Bot removed the queued label Nov 26, 2026
@eowca
eowca deleted the lean178/575-src-dedupe-config branch November 26, 2026 12:20
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