Skip to content

Commit 16f435f

Browse files
bokelleyclaude
andcommitted
fix(decisioning): inline env var literal + drop INVALID_REQUEST backticks (#423 fix-pack)
The docstring-vs-code consistency test (#424, just merged) caught two issues in this PR: 1. The strict-mode env-var read used os.environ.get(_STRICT_VALIDATE_ENV) indirection, which the consistency test's regex doesn't follow. Inline the literal 'ADCP_DECISIONING_STRICT_VALIDATE_PLATFORM' string so the test sees the read. 2. The docstring wrapped 'INVALID_REQUEST' in backticks on lines near env-var context keywords, tripping the test's SCREAMING_CASE heuristic (it treats backtick-wrapped uppercase tokens as candidate env vars). INVALID_REQUEST is a spec error code, not an env var — drop the backticks so it's plain prose. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 63c0320 commit 16f435f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/adcp/decisioning/dispatch.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,10 @@
383383

384384
def _strict_validate_platform() -> bool:
385385
"""True when the strict-validate env var is set to ``"1"``."""
386-
return os.environ.get(_STRICT_VALIDATE_ENV, "") == "1"
386+
# Inline the literal name so docstring-vs-code consistency tests can
387+
# match it via plain regex (the test scans for ``os.environ.get("FOO")``
388+
# patterns and doesn't follow the indirection through ``_STRICT_VALIDATE_ENV``).
389+
return os.environ.get("ADCP_DECISIONING_STRICT_VALIDATE_PLATFORM", "") == "1"
387390

388391

389392
# ---------------------------------------------------------------------------
@@ -502,14 +505,14 @@ def validate_platform(platform: DecisioningPlatform) -> None:
502505
3. Each claimed specialism's required methods are implemented
503506
on the platform subclass. Unknown specialisms emit
504507
``UserWarning`` (forward-compat with v6.x+ specs); known
505-
specialisms missing methods raise ``AdcpError("INVALID_REQUEST")``.
508+
specialisms missing methods raise an INVALID_REQUEST error.
506509
4. Each claimed specialism's *recommended* methods (the v6.0 rc.1
507510
staging set in :data:`RECOMMENDED_METHODS_PER_SPECIALISM` —
508511
sales-* surface broadening per DX-423) are implemented on the
509512
platform subclass. Misses emit one ``UserWarning`` per
510513
method (deduped across overlapping specialisms). Setting
511514
``ADCP_DECISIONING_STRICT_VALIDATE_PLATFORM=1`` flips the soft
512-
warning into a hard ``AdcpError("INVALID_REQUEST")``.
515+
warning into a hard INVALID_REQUEST error.
513516
5. **Governance opt-in fail-fast (D15 round-4):** if any claimed
514517
specialism is in :data:`GOVERNANCE_SPECIALISMS` AND
515518
``capabilities.governance_aware`` is False AND the platform

0 commit comments

Comments
 (0)