Skip to content

feat(schema): Epic #150 Phase 1.6 — explicit tier2_enabled metadata field (closes #155)#160

Merged
dackclup merged 1 commit into
mainfrom
claude/session-close-audit-wrap-QkvFz
May 20, 2026
Merged

feat(schema): Epic #150 Phase 1.6 — explicit tier2_enabled metadata field (closes #155)#160
dackclup merged 1 commit into
mainfrom
claude/session-close-audit-wrap-QkvFz

Conversation

@dackclup
Copy link
Copy Markdown
Owner

@dackclup dackclup commented May 20, 2026

Summary

Implements the deferred AC item from issue #117 / PR #149 — surfaces compute/scoring/tier2._EIGHT_K_DEFENSES_ENABLED into Metadata.tier2_enabled so the verifier branches on the explicit flag instead of inferring it.

  • Schema bump 0.9.2-phase4h.20.9.3-phase4h.3
  • Metadata.tier2_enabled: bool = True added (Pydantic default for legacy back-compat)
  • compute/main.py writer sources from _EIGHT_K_DEFENSES_ENABLED at run time
  • frontend/lib/types.ts mirrors as tier2_enabled?: boolean | null (optional + nullable so the stale static metadata.json snapshot still casts cleanly through lib/data.ts)
  • frontend/lib/schema-snapshot.json regenerated
  • verify-production-output/helper.py Section B reads metadata["tier2_enabled"] when present; falls back to the prior coverage-based heuristic (tier2_coverage_pct > 5%) on legacy snapshots
  • FAIL/OK messages now report disabled_reason (tier2_enabled=False vs tier2_coverage_pct=X%) for precision

Why

The pre-1.6 helper inferred Tier-2 enablement from tier2_coverage_pct > 5%. That works only while at least one 8-K defense is wired ON — if a future PR flips _EIGHT_K_DEFENSES_ENABLED = False (e.g., emergency disable during an EDGAR outage), the verifier would silently expect 0 fires AND get 0 fires, masking the disablement event. The explicit flag closes that gap.

Tests

  • tests/test_output/test_writer.py: 2 round-trip cases (default-True + explicit-False)
  • tests/test_verify_helper.py: 2 new branches — tier2_enabled=False overrides coverage=99 → FAIL with tier2_enabled=False in message; tier2_enabled=True with coverage=0 → no fires-but-disabled diagnostic
  • tests/test_config.py: schema version assertion bumped

Full offline suite: 938 passed, 7 skipped (ipca / qlib not installed), 18 deselected (network). 3 pre-existing collection errors (openassetpricing not installed in this CI env, unrelated to this PR).

Test plan

  • ruff check . clean
  • python -m compute.output.schema_check in sync
  • python -m pytest tests/ -m "not network" — 938 passed (excluding pre-existing collection errors)
  • cd frontend && npx --no -- tsc --noEmittier2_enabled-specific TS errors resolved (pre-existing missing-node_modules errors in this env are unrelated)
  • Section A-J + Section I Playwright spot-check on workflow_dispatch green (post-merge)

Notes

https://claude.ai/code/session_01Nj5sMzisnqDmF46g5ckEJn


Generated by Claude Code

…ield (closes #155)

Surfaces compute/scoring/tier2._EIGHT_K_DEFENSES_ENABLED into
Metadata.tier2_enabled so verify-production-output/helper.py Section B
branches on the explicit flag instead of inferring from
tier2_coverage_pct > 5%. A future emergency-disable PR will now show up
in the verifier output instead of silently masking itself.

Schema bump 0.9.2-phase4h.2 → 0.9.3-phase4h.3. Pydantic default True
for back-compat with legacy snapshots; TypeScript side optional+nullable
so the stale frontend/public/data/metadata.json snapshot still casts
cleanly. Helper falls back to coverage-based inference when the key is
absent. 3 new regression tests (writer round-trip + Section B explicit-
flag-overrides-coverage matrix).

Closes the last open AC item carried forward from issue #117 (PR #149
deferred). Phase 1 of epic #150 fully closed.

https://claude.ai/code/session_01Nj5sMzisnqDmF46g5ckEJn
@vercel
Copy link
Copy Markdown

vercel Bot commented May 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
quantrank Ready Ready Preview, Comment May 20, 2026 6:35pm

@dackclup dackclup marked this pull request as ready for review May 20, 2026 18:38
@dackclup dackclup merged commit 8fcb7cc into main May 20, 2026
4 checks passed
@dackclup dackclup deleted the claude/session-close-audit-wrap-QkvFz branch May 20, 2026 18:39
dackclup pushed a commit that referenced this pull request May 21, 2026
Second deliverable from the 14-subagent full self-audit (2026-05-21).
Doc drift surfaced by `docs-reviewer` + `methodology-scientist` against
the actual production state on `a16c887` (2026-05-20 cron) + the schema
version on `compute/config.py:30`.

Five reconciles in lockstep:

(a) PHASE_STATUS.md §Current state — schema `0.9.2-phase4h.2` →
    `0.9.4-phase4h.4`; defense layer headline 17 declared → 27 emitted
    flags (per PR #154 reconcile); skill inventory 38 → 42; subagent
    inventory added (14 in 4 tiers); active-vetoes list explicit
    (7 named); recently-merged block refreshed from PR #146-back to
    PRs #148-#169 (~20 PRs since `v1.2.0-phase4.5`); next-deliverables
    list updated to drop the PR-#148-closed Epic #125 Item 3 entry
    and add the `loss_avoidance_pattern` size-invariant follow-up.

(b) SKILL.md schema-version table — 2 missing rows added:
    `0.9.3-phase4h.3` (PR #160, explicit `Metadata.tier2_enabled` field,
    closes #117/#155) and `0.9.4-phase4h.4` (PR #161, additive
    `valuation_methods_applicable` field on `StockDetail` and nested
    in `fair_price` dict, additive only — no consumer migration).

(c) WORKFLOW.md Phase 4.5d `loss_avoidance_pattern` task — threshold
    description `$5M / $0.05` → `$50M / $0.50` (PR #163 Phase 2.4
    10× rescale). Adds the Phase 4 size-invariant follow-up note
    (NI / TotalAssets) carried from CLAUDE.md §Gotchas since the
    rescale still fires 0% on production.

(d) docs/METHODOLOGY.md — Active vetoes 4 → 7 rows: adds
    `beneish_manipulation_veto` (Beneish 1999 *FAJ*),
    `dechow_manipulation_veto` (Dechow 2011 *CAR* Model 1), and
    `data_quality_input_corruption` (with the dual-path rule —
    `risk_overlay.py` snapshot-level TBVPS guard + `ensemble.py`
    output-level guard). Known-calibration-drift block refreshed:
    `value_trap_risk` (Issue #11 closed via PR #166),
    `going_concern_disclosure` (FP rate now 1.0% within Mayew band —
    verified 5/502 on production cron),
    `loss_avoidance_pattern` (still 0% after Phase 2.4 rescale,
    follow-up to size-invariant), `restatement_history` (Phase 2.2
    high-confidence complement via PR #165).

(e) README.md §Honest Limitations — adds Phase 2.2
    `restatement_high_confidence` and Issue #11 closure (PR #166)
    entries; mentions PR #163's 10× rescale on the
    `loss_avoidance_pattern` line.

CLAUDE.md §Phase status + AGENTS.md §Phase + version state — matching
"Phase 2 in flight" entries per §Conventions "ship with every PR" rule.

Deferred to a follow-up Phase 2.x PR (too large for this scope):
METHODOLOGY.md annotate-only section full refresh (7 → 14+ flags) +
missing citation blocks (full Hennes-Leone-Miller 2008 *TAR*,
Cohen-Malloy-Pomorski 2012, etc.) — needs `methodology-scientist`
sign-off per the new-defense-flow rule.

Pre-commit verification:
- docs-reviewer NEEDS-CLARITY-PASS → fixed `data_quality_input_corruption`
  rule description in METHODOLOGY.md to cover both veto paths
  (snapshot-level `risk_overlay.py` + output-level `ensemble.py`).
- methodology-scientist findings: data_quality veto classification
  CONFIRMED via dual-surface emission; value_trap / loss_avoidance /
  restatement_history all CLEAN.
- phase-coordinator Mode A: COLLISION-RISK with PR #170 (Phase 1
  ops hardening on `claude/enable-subagents-standby-7lMN4`) on
  CLAUDE.md + AGENTS.md §Phase status block — both PRs append to
  the tail. Strategy: PR #170 merges first, then this branch rebases
  onto updated main; conflict is mechanical 2-paragraph merge.

No compute / schema / output / dep change. Lint passes (no Python /
TypeScript edited).

https://claude.ai/code/session_01HtcGy4F59TaawNQ7V1Eysc

Co-authored-by: Claude <noreply@anthropic.com>
dackclup added a commit that referenced this pull request May 21, 2026
…ion (#171)

Second deliverable from the 14-subagent full self-audit (2026-05-21).
Doc drift surfaced by `docs-reviewer` + `methodology-scientist` against
the actual production state on `a16c887` (2026-05-20 cron) + the schema
version on `compute/config.py:30`.

Five reconciles in lockstep:

(a) PHASE_STATUS.md §Current state — schema `0.9.2-phase4h.2` →
    `0.9.4-phase4h.4`; defense layer headline 17 declared → 27 emitted
    flags (per PR #154 reconcile); skill inventory 38 → 42; subagent
    inventory added (14 in 4 tiers); active-vetoes list explicit
    (7 named); recently-merged block refreshed from PR #146-back to
    PRs #148-#169 (~20 PRs since `v1.2.0-phase4.5`); next-deliverables
    list updated to drop the PR-#148-closed Epic #125 Item 3 entry
    and add the `loss_avoidance_pattern` size-invariant follow-up.

(b) SKILL.md schema-version table — 2 missing rows added:
    `0.9.3-phase4h.3` (PR #160, explicit `Metadata.tier2_enabled` field,
    closes #117/#155) and `0.9.4-phase4h.4` (PR #161, additive
    `valuation_methods_applicable` field on `StockDetail` and nested
    in `fair_price` dict, additive only — no consumer migration).

(c) WORKFLOW.md Phase 4.5d `loss_avoidance_pattern` task — threshold
    description `$5M / $0.05` → `$50M / $0.50` (PR #163 Phase 2.4
    10× rescale). Adds the Phase 4 size-invariant follow-up note
    (NI / TotalAssets) carried from CLAUDE.md §Gotchas since the
    rescale still fires 0% on production.

(d) docs/METHODOLOGY.md — Active vetoes 4 → 7 rows: adds
    `beneish_manipulation_veto` (Beneish 1999 *FAJ*),
    `dechow_manipulation_veto` (Dechow 2011 *CAR* Model 1), and
    `data_quality_input_corruption` (with the dual-path rule —
    `risk_overlay.py` snapshot-level TBVPS guard + `ensemble.py`
    output-level guard). Known-calibration-drift block refreshed:
    `value_trap_risk` (Issue #11 closed via PR #166),
    `going_concern_disclosure` (FP rate now 1.0% within Mayew band —
    verified 5/502 on production cron),
    `loss_avoidance_pattern` (still 0% after Phase 2.4 rescale,
    follow-up to size-invariant), `restatement_history` (Phase 2.2
    high-confidence complement via PR #165).

(e) README.md §Honest Limitations — adds Phase 2.2
    `restatement_high_confidence` and Issue #11 closure (PR #166)
    entries; mentions PR #163's 10× rescale on the
    `loss_avoidance_pattern` line.

CLAUDE.md §Phase status + AGENTS.md §Phase + version state — matching
"Phase 2 in flight" entries per §Conventions "ship with every PR" rule.

Deferred to a follow-up Phase 2.x PR (too large for this scope):
METHODOLOGY.md annotate-only section full refresh (7 → 14+ flags) +
missing citation blocks (full Hennes-Leone-Miller 2008 *TAR*,
Cohen-Malloy-Pomorski 2012, etc.) — needs `methodology-scientist`
sign-off per the new-defense-flow rule.

Pre-commit verification:
- docs-reviewer NEEDS-CLARITY-PASS → fixed `data_quality_input_corruption`
  rule description in METHODOLOGY.md to cover both veto paths
  (snapshot-level `risk_overlay.py` + output-level `ensemble.py`).
- methodology-scientist findings: data_quality veto classification
  CONFIRMED via dual-surface emission; value_trap / loss_avoidance /
  restatement_history all CLEAN.
- phase-coordinator Mode A: COLLISION-RISK with PR #170 (Phase 1
  ops hardening on `claude/enable-subagents-standby-7lMN4`) on
  CLAUDE.md + AGENTS.md §Phase status block — both PRs append to
  the tail. Strategy: PR #170 merges first, then this branch rebases
  onto updated main; conflict is mechanical 2-paragraph merge.

No compute / schema / output / dep change. Lint passes (no Python /
TypeScript edited).

https://claude.ai/code/session_01HtcGy4F59TaawNQ7V1Eysc

Co-authored-by: Claude <noreply@anthropic.com>
dackclup pushed a commit that referenced this pull request May 24, 2026
Addresses release-captain BLOCKED-ON-PRE-FLIGHT blocker #3 from
the v1.3.0 tag attempt — PHASE_STATUS.md / SKILL.md / WORKFLOW.md
were 3 days + ~32 PRs stale (last touched PR #171, 2026-05-21).
Brings all three docs current to main HEAD 1ff6c11 so the
release-captain ladder can re-attempt cleanly.

PHASE_STATUS.md
- Header date 2026-05-21 → 2026-05-24
- Current state table: schema 0.9.4-phase4h.4 → 0.10.2-phase4.5e;
  defense layer 27 → 32 emitted flags; subagent inventory 14 → 18
  (named tier roster — 4 opus / 14 sonnet); skill inventory 42 → 43;
  production run a16c8879015748 (cron #3 2026-05-23); release-
  tag line annotated with v1.3.0 target pending
- Recently-merged block: refreshed to PR #170 → PR #237 (~36
  entries with commit shas, chronological), drops the stale PR
  #147-#169 block
- Next-deliverables list: 5 items updated — Phase 4.5e PR 5
  cluster weight promotion / Issue #67 sector-CoE flip / v1.3.0
  release tag gate / Phase 4i.1-4j.1-4k.1 factor integrations /
  Phase 5 ML meta-learner
- Open issues line: drops resolved #155 (closed via PR #160),
  refreshes #41 (15 open advisories, zero exploitability on
  static-export), refreshes #67 (data-collection merged PR #204)

SKILL.md
- Schema-version table: 7 new rows added in reverse-chronological
  order (matches existing 0.9.x convention) for `0.9.5` → `0.9.6`
  → `0.9.7` → `0.9.8` → `0.10.0` → `0.10.1` → `0.10.2` covering
  PRs #180/#181/#183/#204/#205/#222/#224. Each row carries PR #
  + 1-line scope + backward-compat note + literature anchor.

WORKFLOW.md
- Phase Overview table 4.5 row marked ✅ DONE 2026-05-23 + 10b5-1
  filter scope note
- SEC Filing Roadmap Form 4 row flipped "planned" → "active" with
  4-PR ladder reference (#167/#205/#222/#224 + 100% coverage on
  cron #3)
- Phase 4.5e task list — 5 items flipped `[ ]` → `[x]` with per-PR
  commits + methodology-scientist Mode B verdicts inline + Aboody
  et al. 2010 §3.2 weight-promotion gate noted
- Phase 4.5 Acceptance Criteria — all 9 items flipped to `[x]`
  with completion evidence (cron #3 / methodology verdicts /
  PR refs)
- Phase 4.5f tag item — flipped `[ ]` → `[x]` (`v1.2.0-phase4.5`
  cut 2026-05-17 at 6d414a9)

PHASE_STATUS_INFLIGHT.md
- Append new "(this PR)" entry under In-flight section per the
  PR #237 side-file convention. Documents the doc-refresh scope
  + cross-refs to release-captain blockers 1/2/4/5 still pending.

Lockstep
- PR #237's PHASE_STATUS_INFLIGHT.md side-file pattern handles
  the §Conventions "ship with every PR" rule for this doc-only PR
- No CLAUDE.md / AGENTS.md substantive change required — the
  in-flight entry lives in the side-file per the new convention
- No compute / schema / scoring / valuation / frontend / Python /
  TypeScript code change
- Unblocks v1.3.0 tag blocker #3; blockers 1 (wrong-branch),
  2 (pyproject.toml 0.3.0 → 1.3.0), 4 (production output 1 cron
  cycle behind code), and 5 (release notes draft scope) still
  need resolution before tag cut
dackclup pushed a commit that referenced this pull request May 24, 2026
Addresses release-captain BLOCKED-ON-PRE-FLIGHT blocker #3 from
the v1.3.0 tag attempt — PHASE_STATUS.md / SKILL.md / WORKFLOW.md
were 3 days + ~32 PRs stale (last touched PR #171, 2026-05-21).
Brings all three docs current to main HEAD 1ff6c11 so the
release-captain ladder can re-attempt cleanly.

PHASE_STATUS.md
- Header date 2026-05-21 → 2026-05-24
- Current state table: schema 0.9.4-phase4h.4 → 0.10.2-phase4.5e;
  defense layer 27 → 32 emitted flags; subagent inventory 14 → 18
  (named tier roster — 4 opus / 14 sonnet); skill inventory 42 → 43;
  production run a16c8879015748 (cron #3 2026-05-23); release-
  tag line annotated with v1.3.0 target pending
- Recently-merged block: refreshed to PR #170 → PR #237 (~36
  entries with commit shas, chronological), drops the stale PR
  #147-#169 block
- Next-deliverables list: 5 items updated — Phase 4.5e PR 5
  cluster weight promotion / Issue #67 sector-CoE flip / v1.3.0
  release tag gate / Phase 4i.1-4j.1-4k.1 factor integrations /
  Phase 5 ML meta-learner
- Open issues line: drops resolved #155 (closed via PR #160),
  refreshes #41 (15 open advisories, zero exploitability on
  static-export), refreshes #67 (data-collection merged PR #204)

SKILL.md
- Schema-version table: 7 new rows added in reverse-chronological
  order (matches existing 0.9.x convention) for `0.9.5` → `0.9.6`
  → `0.9.7` → `0.9.8` → `0.10.0` → `0.10.1` → `0.10.2` covering
  PRs #180/#181/#183/#204/#205/#222/#224. Each row carries PR #
  + 1-line scope + backward-compat note + literature anchor.

WORKFLOW.md
- Phase Overview table 4.5 row marked ✅ DONE 2026-05-23 + 10b5-1
  filter scope note
- SEC Filing Roadmap Form 4 row flipped "planned" → "active" with
  4-PR ladder reference (#167/#205/#222/#224 + 100% coverage on
  cron #3)
- Phase 4.5e task list — 5 items flipped `[ ]` → `[x]` with per-PR
  commits + methodology-scientist Mode B verdicts inline + Aboody
  et al. 2010 §3.2 weight-promotion gate noted
- Phase 4.5 Acceptance Criteria — all 9 items flipped to `[x]`
  with completion evidence (cron #3 / methodology verdicts /
  PR refs)
- Phase 4.5f tag item — flipped `[ ]` → `[x]` (`v1.2.0-phase4.5`
  cut 2026-05-17 at 6d414a9)

PHASE_STATUS_INFLIGHT.md
- Append new "(this PR)" entry under In-flight section per the
  PR #237 side-file convention. Documents the doc-refresh scope
  + cross-refs to release-captain blockers 1/2/4/5 still pending.

Lockstep
- PR #237's PHASE_STATUS_INFLIGHT.md side-file pattern handles
  the §Conventions "ship with every PR" rule for this doc-only PR
- No CLAUDE.md / AGENTS.md substantive change required — the
  in-flight entry lives in the side-file per the new convention
- No compute / schema / scoring / valuation / frontend / Python /
  TypeScript code change
- Unblocks v1.3.0 tag blocker #3; blockers 1 (wrong-branch),
  2 (pyproject.toml 0.3.0 → 1.3.0), 4 (production output 1 cron
  cycle behind code), and 5 (release notes draft scope) still
  need resolution before tag cut
dackclup added a commit that referenced this pull request May 24, 2026
…239)

Addresses release-captain BLOCKED-ON-PRE-FLIGHT blocker #3 from
the v1.3.0 tag attempt — PHASE_STATUS.md / SKILL.md / WORKFLOW.md
were 3 days + ~32 PRs stale (last touched PR #171, 2026-05-21).
Brings all three docs current to main HEAD 1ff6c11 so the
release-captain ladder can re-attempt cleanly.

PHASE_STATUS.md
- Header date 2026-05-21 → 2026-05-24
- Current state table: schema 0.9.4-phase4h.4 → 0.10.2-phase4.5e;
  defense layer 27 → 32 emitted flags; subagent inventory 14 → 18
  (named tier roster — 4 opus / 14 sonnet); skill inventory 42 → 43;
  production run a16c8879015748 (cron #3 2026-05-23); release-
  tag line annotated with v1.3.0 target pending
- Recently-merged block: refreshed to PR #170 → PR #237 (~36
  entries with commit shas, chronological), drops the stale PR
  #147-#169 block
- Next-deliverables list: 5 items updated — Phase 4.5e PR 5
  cluster weight promotion / Issue #67 sector-CoE flip / v1.3.0
  release tag gate / Phase 4i.1-4j.1-4k.1 factor integrations /
  Phase 5 ML meta-learner
- Open issues line: drops resolved #155 (closed via PR #160),
  refreshes #41 (15 open advisories, zero exploitability on
  static-export), refreshes #67 (data-collection merged PR #204)

SKILL.md
- Schema-version table: 7 new rows added in reverse-chronological
  order (matches existing 0.9.x convention) for `0.9.5` → `0.9.6`
  → `0.9.7` → `0.9.8` → `0.10.0` → `0.10.1` → `0.10.2` covering
  PRs #180/#181/#183/#204/#205/#222/#224. Each row carries PR #
  + 1-line scope + backward-compat note + literature anchor.

WORKFLOW.md
- Phase Overview table 4.5 row marked ✅ DONE 2026-05-23 + 10b5-1
  filter scope note
- SEC Filing Roadmap Form 4 row flipped "planned" → "active" with
  4-PR ladder reference (#167/#205/#222/#224 + 100% coverage on
  cron #3)
- Phase 4.5e task list — 5 items flipped `[ ]` → `[x]` with per-PR
  commits + methodology-scientist Mode B verdicts inline + Aboody
  et al. 2010 §3.2 weight-promotion gate noted
- Phase 4.5 Acceptance Criteria — all 9 items flipped to `[x]`
  with completion evidence (cron #3 / methodology verdicts /
  PR refs)
- Phase 4.5f tag item — flipped `[ ]` → `[x]` (`v1.2.0-phase4.5`
  cut 2026-05-17 at 6d414a9)

PHASE_STATUS_INFLIGHT.md
- Append new "(this PR)" entry under In-flight section per the
  PR #237 side-file convention. Documents the doc-refresh scope
  + cross-refs to release-captain blockers 1/2/4/5 still pending.

Lockstep
- PR #237's PHASE_STATUS_INFLIGHT.md side-file pattern handles
  the §Conventions "ship with every PR" rule for this doc-only PR
- No CLAUDE.md / AGENTS.md substantive change required — the
  in-flight entry lives in the side-file per the new convention
- No compute / schema / scoring / valuation / frontend / Python /
  TypeScript code change
- Unblocks v1.3.0 tag blocker #3; blockers 1 (wrong-branch),
  2 (pyproject.toml 0.3.0 → 1.3.0), 4 (production output 1 cron
  cycle behind code), and 5 (release notes draft scope) still
  need resolution before tag cut

Co-authored-by: Claude <noreply@anthropic.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.

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

2 participants