Skip to content

fix: wire schema staleness check into audit workflow (#800) - #904

Merged
Sinity merged 1 commit into
masterfrom
feature/fix/scope-gaps-batch-3
May 7, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/fix/scope-gaps-batch-3

Conversation

@Sinity

@Sinity Sinity commented May 7, 2026

Copy link
Copy Markdown
Owner

Add check_schema_staleness wired into audit_provider. 2 files +38.

Add check_schema_staleness that verifies x-polylogue-generated-at
timestamp is present, parseable, and within 90 days. Wired into
audit_provider workflow alongside existing checks.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
Copilot AI review requested due to automatic review settings May 7, 2026 10:15
@Sinity
Sinity merged commit 694bd75 into master May 7, 2026
@Sinity
Sinity deleted the feature/fix/scope-gaps-batch-3 branch May 7, 2026 10:15
@coderabbitai

coderabbitai Bot commented May 7, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Sinity has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 54 minutes and 38 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0d14514a-02e8-4e1c-8eb2-45084a7a7773

📥 Commits

Reviewing files that changed from the base of the PR and between dc22e1e and 79c614e.

📒 Files selected for processing (2)
  • polylogue/schemas/audit/checks.py
  • polylogue/schemas/audit/workflow.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/scope-gaps-batch-3

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@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: 79c614ecaa

ℹ️ 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 +203 to +205
gen_time = datetime.fromisoformat(generated_at.replace("Z", "+00:00"))
age_days = (datetime.now(UTC) - gen_time).days
except ValueError:

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 Guard naive generated-at timestamps before age arithmetic

If x-polylogue-generated-at is a valid ISO string without timezone info (for example 2026-03-16T12:23:13), datetime.fromisoformat(...) returns a naive datetime, and subtracting it from datetime.now(UTC) raises TypeError. Because only ValueError is handled here, check_schema_staleness can raise and abort the audit workflow instead of returning a warning for malformed/ambiguous timestamps.

Useful? React with 👍 / 👎.

Copilot AI 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.

Pull request overview

Wires a new schema “staleness” audit check into the schema audit workflow so provider audits can warn when committed schemas are old or missing a generated-at timestamp.

Changes:

  • Adds check_schema_staleness() audit check based on x-polylogue-generated-at.
  • Runs the staleness check as part of audit_provider().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
polylogue/schemas/audit/workflow.py Adds the staleness check into the per-provider audit sequence.
polylogue/schemas/audit/checks.py Implements check_schema_staleness() and updates module exports.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"check_annotation_coverage",
"check_cross_provider_consistency",
"check_privacy_guards",
"check_schema_drift",
Comment on lines +190 to +206
def check_schema_staleness(schema: Mapping[str, object] | SchemaNode) -> CheckResult:
"""Check whether the committed schema is stale via its generated-at timestamp."""
from datetime import UTC, datetime

root = json_document(schema)
generated_at = root.get("x-polylogue-generated-at")
if not generated_at or not isinstance(generated_at, str):
return CheckResult(
name="schema_staleness",
status=OutcomeStatus.WARNING,
summary="Schema has no x-polylogue-generated-at timestamp",
)
try:
gen_time = datetime.fromisoformat(generated_at.replace("Z", "+00:00"))
age_days = (datetime.now(UTC) - gen_time).days
except ValueError:
return CheckResult(
Sinity added a commit that referenced this pull request May 7, 2026
Closes the remaining schema-audit gap from #800. PR #921 landed
the structural-role exemption and `detect_drift()` wiring; the
staleness check still had no audit-side caller.

- `polylogue/schemas/audit/checks.py`: adds
  `check_schema_staleness()` reading the committed package
  manifest dates against the live archive observations.
- `polylogue/schemas/audit/workflow.py`: `audit_provider()`
  invokes the new check inline so `devtools schema-audit`
  surfaces stale schemas as part of its normal report.

Refs #800
Sinity added a commit that referenced this pull request May 7, 2026
Closes the remaining schema-audit gap from #800. PR #921 landed
the structural-role exemption and `detect_drift()` wiring; the
staleness check still had no audit-side caller.

- `polylogue/schemas/audit/checks.py`: adds
  `check_schema_staleness()` reading the committed package
  manifest dates against the live archive observations.
- `polylogue/schemas/audit/workflow.py`: `audit_provider()`
  invokes the new check inline so `devtools schema-audit`
  surfaces stale schemas as part of its normal report.

Refs #800
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.

2 participants