Skip to content

perf: reuse schemas during artifact validation - #23

Merged
TonisOrmisson merged 1 commit into
mainfrom
cleanup/remove-unreachable-spec-check
Sep 9, 2026
Merged

TonisOrmisson merged 1 commit into
mainfrom
cleanup/remove-unreachable-spec-check

Conversation

@TonisOrmisson

@TonisOrmisson TonisOrmisson commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Reuse the five JSON Schema objects already validated during one validate_contract_artifacts(root) call.

  • Preserve existing first-load order and all manifest/reference/case validation.
  • Pass one invocation-local schema map through the three private consumers.
  • No public API, schemas, manifests, documentation, dependencies, configuration, or validator/global cache changes.

Verification

  • Commit ede51bb: one production file; tests unchanged.
  • External real-repository probe: JSON reads 27 → 12; actual schema loads/meta-validation 20 → 5.
  • Inventory unchanged: Plan {0.1: 4, 0.2: 26}, Frontend declared {0.1: 13, 0.2: 44, 0.3: 35}, Frontend effective {0.1: 13, 0.2: 44, 0.3: 90}, Binding {0.1: 6, 0.2: 11}.
  • Probe also confirmed first-load order, exact precedence errors, schema immutability, same-process call isolation, and edited-root freshness.
  • tests/test_contract_artifacts.py + tests/test_dolt_declarations.py: 57 passed; full pytest: 57 passed.
  • tools/validate_repository.py: passed; git diff --check: passed.
  • Independent read-only local review: no findings.
  • All 3 GitHub checks successful, merge state CLEAN. CodeRabbit report 5600394104 had no actionable comments/minimal risk; its generic docstring-coverage warning was not added as boilerplate. Codex was requested at 5600393133, but usage-limit messages 5600392086/5600395111 prevented a review; no Codex result is claimed. No auto-merge.

Scope proof

The map is created inside each public validation call and no object escapes into ArtifactInventory. Repeated references return the already checked mapping only after its initial registration point, so Plan validation and all frontend schema registration still occur in the original order. Between-call file changes remain observable.

The earlier PHP journal/catalogue-preparation candidate was explicitly stopped: its duplicate ownership check is coupled to failure ordering, migration states, and MySQL implicit-DDL behavior, so it remains unchanged.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@TonisOrmisson

Copy link
Copy Markdown
Contributor Author

@codex review

@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 730a9940-c18e-4765-804e-224b4f82abec

📥 Commits

Reviewing files that changed from the base of the PR and between 864e844 and ede51bb.

📒 Files selected for processing (1)
  • src/openstatspec_specification/artifacts.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Schema loading now uses a shared per-invocation cache. Contract validation and frontend plan resolution pass this cache through all schema lookup paths.

Changes

Schema cache propagation

Layer / File(s) Summary
Schema cache implementation
src/openstatspec_specification/artifacts.py
_schema returns cached schemas by relative path and stores each loaded, validated schema.
Validation path cache wiring
src/openstatspecification/artifacts.py
Validation helpers, frontend plan resolution, and validate_contract_artifacts pass one shared schema cache to all schema lookups.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to ede51

Contract validation now reuses schemas within a single validation call, reducing repeated reads while preserving validation behavior and isolation between calls. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: reusing schemas during artifact validation to improve performance.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cleanup/remove-unreachable-spec-check

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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@TonisOrmisson
TonisOrmisson merged commit 930345b into main Sep 9, 2026
3 checks passed
@TonisOrmisson
TonisOrmisson deleted the cleanup/remove-unreachable-spec-check branch September 9, 2026 10:40
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