Skip to content

fix: sync trusted lifecycle artifacts for quant monitor - #105

Merged
Pigbibi merged 1 commit into
mainfrom
codex/lifecycle-artifact-sync-20260730
Jul 30, 2026
Merged

fix: sync trusted lifecycle artifacts for quant monitor#105
Pigbibi merged 1 commit into
mainfrom
codex/lifecycle-artifact-sync-20260730

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • select only recent main schedule/workflow-dispatch lifecycle artifacts with a successful preflight_backtests job
  • validate archive paths, file types, sizes, backtest/return contracts, provenance, and cached hashes before atomic activation
  • isolate lifecycle data from code clones and refresh performance snapshots before drift detection
  • fail closed per domain with sanitized, deduplicated monitor alerts

Validation

  • python3 -m pytest ops/quant-monitor/tests -q (41 passed)
  • Python compile + shell syntax + git diff --check
  • downloaded and validated current CN, US, and crypto artifacts
  • local QPK integration: 9 snapshots/drifts across CN, US, and crypto; HK producer bundle cross-check adds 2, for 11 total

Co-Authored-By: Codex <noreply@openai.com>
@Pigbibi

Pigbibi commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

Reopening once to retrigger required checks; the initial PR event produced no workflow runs.

@Pigbibi Pigbibi closed this Jul 30, 2026
@Pigbibi Pigbibi reopened this Jul 30, 2026
@Pigbibi
Pigbibi merged commit ac2ebda into main Jul 30, 2026
4 checks passed
@Pigbibi
Pigbibi deleted the codex/lifecycle-artifact-sync-20260730 branch July 30, 2026 07:59

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f18d2e62ea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +748 to +753
except LifecycleArtifactError as exc:
statuses[domain] = {
"status": "error",
"code": exc.code,
"error_type": type(exc).__name__,
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Invalidate failed domains for the daily briefing

When a previously activated domain later fails synchronization because its artifact expired, GitHub is unavailable, or a replacement is invalid, this handler only records the error and leaves its consumer symlinks pointing at the prior data. daily_briefing.sh does not run this synchronizer, and daily_briefing_builder.py:47-98 neither reads status.json nor refreshes snapshots, so it can publish and dispatch a data_status: ready report from data that the new trust policy has rejected. Invalidate failed-domain links or gate the daily briefing on the artifact status.

AGENTS.md reference: ops/quant-monitor/AGENTS.md:L28-L32

Useful? React with 👍 / 👎.

Comment on lines +567 to +568
artifact_id = int(artifact["id"])
version_dir = artifacts_root / "versions" / config["domain"] / str(artifact_id)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Prune inactive lifecycle artifact versions

Whenever a producer publishes a new artifact ID, the extracted bundle is permanently stored under versions/<domain>/<artifact_id>, while cleanup only removes temporary staging paths. Because the monitor runs indefinitely across four domains and each retained archive may contain up to 256 MiB of extracted data, these immutable versions accumulate without bound and can eventually exhaust the VPS disk; retain only the active version plus a small rollback window.

Useful? React with 👍 / 👎.

Comment on lines +300 to +302
if previous_date and date_value <= previous_date:
raise LifecycleArtifactError("return matrix dates must be strictly increasing")
previous_date = date_value

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Compare parsed matrix dates instead of raw strings

datetime.strptime accepts non-zero-padded dates, but the ordering check compares their original strings. Consequently, a matrix containing 2026-10-01 followed by the earlier 2026-7-10 passes validation, while the chronologically increasing reverse order is rejected. Compare the parsed date objects or require a canonical zero-padded representation so out-of-order returns cannot reach drift calculations.

Useful? React with 👍 / 👎.

Comment on lines +244 to +246
for key in ("sharpe_ratio", "max_drawdown", "cagr", "volatility"):
try:
value = float(payload[key])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject booleans in lifecycle metric fields

For a malformed artifact containing a JSON boolean in sharpe_ratio, max_drawdown, cagr, or volatility, float(payload[key]) converts it to 1.0 or 0.0, and the finite-value check then accepts it as a valid metric. This can activate nonsensical backtest results and corrupt health or drift calculations; explicitly reject bool values as is already done for the integer fields.

Useful? React with 👍 / 👎.

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