Skip to content

Add tier2_enabled: bool field to Metadata schema (epic #150 Phase 1.6) #155

@dackclup

Description

@dackclup

Context

Tracker issue for epic #150 Phase 1.6 — the deferred-fix item carried forward from closed issue #117 (verify-helper Section B post-PR-#79 stale expectations, closed by PR #149).

Issue #117's acceptance criteria item 4 reads:

Add a regression-guard sanity check — IF _EIGHT_K_DEFENSES_ENABLED ever flips back to False at compute time, fires SHOULD be 0; the helper should read the enabled-flag state from the compute output (e.g., a tier2_enabled: bool metadata field if available, else inferred from tier2_coverage_pct)

PR #149 shipped the soft-warning-band Section B fix but deferred the schema-side tier2_enabled surfacing for a separate PR (would have required a schema bump → out-of-scope for the verify-helper-only PR). This issue is that deferred work, now tracked explicitly.

Why a dedicated field

Today verify-production-output/helper.py infers Tier-2 enablement implicitly from tier2_coverage_pct > 0. That works only while at least one 8-K defense is wired ON — if a future PR flips compute/scoring/tier2._EIGHT_K_DEFENSES_ENABLED = False (e.g., emergency disable during an EDGAR outage), the helper would silently expect 0 fires AND get 0 fires, masking the disablement event in Section A-H output.

An explicit tier2_enabled: bool field in Metadata:

  1. Lets the verifier print "Tier-2 8-K defenses: DISABLED (compute-time flag)" as a top-line state, not a derived inference
  2. Makes the compute-time flag self-documenting in frontend/public/data/metadata.json (auditable from the static site without grepping source)
  3. Pairs with the regression-guard logic from PR fix(verify-output): Section B Tier-2 post-PR-#79 stale expectations (closes #117) #149 Section B (helper reads flag → expected fires conditional on flag)

Acceptance criteria

  • Add tier2_enabled: bool to compute/output/schemas.py::Metadata (default True for back-compat with old snapshots)
  • Source value from compute/scoring/tier2._EIGHT_K_DEFENSES_ENABLED at writer time in compute/output/writer.py
  • Mirror in frontend/lib/types.ts::Metadata
  • Regenerate frontend/lib/schema-snapshot.json (python -m compute.output.schema_check --update-snapshot)
  • Update verify-production-output/helper.py Section B to read metadata["tier2_enabled"] and short-circuit expected-fires logic when False
  • Tests:
  • Bump schema version (current 0.9.2-phase4h.2 → next; coordinate with epic Foundation reconciliation roadmap — process + analytical scrutinize findings (2 rounds) #150 Phase 2's planned 0.10.0 bump so we don't burn two version numbers)
  • CLAUDE.md + AGENTS.md lockstep diff

Coordination notes

  • Epic #150 Phase 3.4 also lists "Implement tier2_enabled: bool metadata field (from 1.6)" — this issue is the tracker for the work; the implementation PR can land under either Phase 1 (cheap-and-cheerful) or Phase 3 (bundled with structural changes). Owner's discretion.
  • If implemented in Phase 1 (before Phase 2's 0.9.2 → 0.10.0 bump), use a minor patch version (e.g., 0.9.3-phase4h.3) to avoid a wasted major schema bump.
  • If implemented in Phase 3, fold into the 0.10.0 schema bump alongside the valuation_methods_applicable: int field from Phase 2.1.

Out of scope

  • Generalizing to per-flag enablement metadata ({flag_name: bool} map) — overkill for a single feature flag; revisit if more compute-time feature flags appear
  • Frontend UI surfacing — purely metadata; the static site doesn't need to render an "8-K defenses: DISABLED" banner

Severity

Low — informational hygiene + observability. The current implicit inference works correctly under all currently-shipped compute paths; this is forward-looking robustness for the regression case where a future PR disables Tier-2.


Filed via Claude Code closing out epic #150 Phase 1.6.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions