Repository navigation
MEC-569: idempotent migration runner, systemd profile, just demo target - #53
Merged
Merged
Conversation
… scorecards _eval_reference_sql ran the predicate SQL against live ClickHouse and put the result rows verbatim into predicate_detail, which score.py copies straight into the committed scorecard. ssdf#24 hand-scrubbed the 22 existing files but did nothing to stop the scorer from doing it again on the next sovereign run. For a sovereign-tier manifest, reference_sql predicates now emit only counts, an overlap count, and a sha256 of the sorted reference set (or a bare within_tolerance bool for numeric_tolerance) instead of the raw agent/ reference values, and drop live numbers from the pass/fail reason text. The unredacted detail is preserved as PredicateResult.raw_detail and, when present, written by the CLI to a new gitignored results/.detail/ sidecar for local debugging -- never next to the committed scorecard. Also adds a CI guard (test_results_no_live_ips.py) that fails if any committed services/evals/results/*.json contains a non-RFC5737 IPv4 address, and a regression test that scores a synthetic sovereign manifest against a fake ClickHouse client returning 10.0.0.1 and asserts it never reaches the scorecard (only the sidecar). Both fail against pre-fix score.py. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Companion doc update for the predicate-detail redaction fix: explains what a committed scorecard now withholds for tier: sovereign and where the raw values (if needed for debugging) end up instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- scripts/run_migrations.py: idempotent ClickHouse migration runner - infra/clickhouse/021_migrations_tracking.sql: tracking table DDL - infra/clickhouse/ssdf-clickhouse.service: ClickHouse systemd unit - infra/clickhouse/ssdf-single-host.service: combined ClickHouse+MCP profile - infra/clickhouse/README.md: documentation for ClickHouse setup - scripts/MIGRATION_RUNNER.md: runner usage guide - justfile: added 'fmt-check', 'migrate', and 'demo' targets The runner applies all pending migrations in numeric order and records applied migrations in ssdf.migrations_applied table. Safe to rerun. The systemd profile starts ClickHouse and all SSDF services for single-host deployment without mandatory SaaS dependency. Refs #28
…st profile Addresses review findings on the migration runner (MEC-569): substitutes per-migration credential placeholders before anything is sent to the database and fails closed if a required one is missing, creates its tracking table directly instead of as a numbered migration so a fresh install can bootstrap, refuses to run on a migration-number collision, treats database errors while checking applied migrations as fatal instead of assuming nothing is applied, stops passing the database password on the command line, and corrects the client port default. Also replaces the single-host systemd service with a target plus a bounded, credential-backed migration unit, and hardens the ClickHouse unit's capabilities and resource limits. Adds unit tests for the runner's placeholder substitution, fail-closed error paths, collision refusal, and password handling. Refs #28 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…gration secrets file Fixes two gaps from PR review (MEC-1672) that stopped the single-host systemd profile from completing a fresh install: - ssdf-migrate.service's ExecStartPre readiness probe ran without a password, so it always failed once the admin user required auth. It now loads the same credential as ExecStart and authenticates. - The profile had no way to supply the per-migration *_PW / VIEW_PSEUDONYM_KEY_* variables the migrations reference, so a fresh install aborted at the first one. Adds EnvironmentFile= plus README documentation of every required variable, backed by a regression test that keeps the two in sync. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Member
Author
|
Addressed the two remaining correctness findings from the MEC-1672 re-review (
Finding C (stale pre-squash commits from #39 already on main) is not addressed on this branch: the task scope for this fix explicitly excludes opening a new PR, and fixing it the way the reviewer suggested (fresh single-commit PR) would require that. Flagging for Kay to decide whether it's worth a follow-up given the content is a no-op duplicate of code already on main. Verified:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
infra/clickhouse/*.sql, applies pending migrations in numeric order, records each inssdf.migrations_applied, and is a no-op on rerun. Fails closed on an unresolved placeholder, a migration-number collision, or a ClickHouse client error.After=/Before=/Requires=rather than a wrapper process.fmt-check,migrate, anddemotargets.Acceptance Criteria
--baselineUsage
See
infra/clickhouse/README.mdfor the systemd single-host profile andscripts/MIGRATION_RUNNER.mdfor full runner usage.Testing
uv run pytest tests/test_run_migrations.py -q(services/mcp-query): all tests passuvx ruff@0.12.4 check/format --check: cleanReferences
just demowith synthetic data #28Closes #28