Fix Bulgarian boundary input and scope Phase-A watchdogs - #8
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR is a follow-up to #7 that (1) makes post-commit rewrites explicitly opt-in to prevent Bulgarian boundary corruptions, and (2) scopes Phase-A sweep/watchdog attribution to an exact (run_id, synthetic) campaign so foreign/synthetic runs can’t “cover” a real campaign.
Changes:
- Add
post_commit_autocorrect(default off) and tighten transliteration safety to prevent lossy Bulgarian word rewrites at word boundaries. - Attach campaign provenance (
run_id+ real/synthetic scope) to Phase‑A sweeps, and scope analysis/watchdog coverage checks to the selected campaign. - Add regression tests around provenance scoping, legacy sweep migration behavior, and raw-event watchdog presence counting.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_o1_phasea.py | Adds campaign provenance + legacy migration regression tests for sweeps/watchdog coverage. |
| phase_a/validity.py | Extends row selection to enforce (run_id, synthetic) scope and adds sweep-row scoping helper. |
| phase_a/sweep.py | Scopes sweeps/watchdog to selected campaign; records provenance in sweeps; adds --run-id. |
| phase_a/selftest.py | Updates selftest sweep simulation and alarm handling to include campaign provenance. |
| phase_a/paths.py | Makes watchdog alarm files campaign/scope-specific (hashed) while keeping a legacy fallback path. |
| phase_a/harness.py | Migrates legacy sweeps schema to add provenance columns and enforce it via trigger/index. |
| phase_a/corpus_replay.py | Enforces synthetic-only replay and stamps sweeps with the replay run_id. |
| phase_a/analyze.py | Scopes analysis watchdog-coverage checks + alarm detection to campaign/scope. |
| crates/smartkey-core/src/input.rs | Adds opt-in post-commit autocorrect and prevents lossy BG transliteration rewrites; updates docs/tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+176
to
+177
| selected_ts = _add_campaign(db, "real-selected", synthetic=False) | ||
| foreign_ts = _add_campaign(db, "real-foreign", synthetic=False) |
Comment on lines
+144
to
148
| af = alarm_file(selected_run_id, synthetic=synthetic) | ||
| if af.exists(): | ||
| af.unlink() | ||
| (receipts_dir() / f"sweep-{today}.txt").write_text(receipt + "\n", encoding="utf-8") | ||
| return receipt |
Comment on lines
+1326
to
1331
| if other_word.is_empty() | ||
| || other_word.chars().count() < 2 | ||
| || other_word.chars().count() != word.chars().count() | ||
| { | ||
| return None; | ||
| } |
| window, | ||
| synthetic=synthetic, | ||
| ) | ||
| selected_run_id = selection.campaign_run_id |
RMANOV
pushed a commit
that referenced
this pull request
Aug 3, 2026
Close SmartKey input safety audit Merged with git rather than `gh pr merge` because the gh credential store (KDE wallet) was locked and every API call hung; SSH was unaffected. Same merge commit shape GitHub would have produced: --no-ff of 8ef48dc into master at 8838643. Verified before pushing, against the MERGE RESULT rather than either parent: the bg-letter work master carries via #8 survives (its regression test bg_punctuation_position_letters_commit_exact_words is present), post_commit_autocorrect is intact, and the audit's own additions (_cancel_safe, do_set_content_type, latency_sample_count) are present.
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.
What
Follow-up to #7 with three post-merge corrections:
чакаandзащоat word boundaries by default; legacy boundary autocorrect remains explicit opt-in and replacement lengths stay character-safeaccept_ghost_completion()documentation with the Tab-only contractrun_id+ real/synthetic scope to Phase-A sweeps and filter analysis/watchdog coverage to the exact campaignThe watchdog also fails closed for an explicit unknown campaign and counts raw in-scope events even when calibration validity excludes them.
Why
PR #7 was squash-merged before two review findings and the live Bulgarian boundary regression were fully closed. Without campaign provenance, a synthetic or foreign sweep could incorrectly credit a live campaign. Without raw-event presence counting, a campaign whose stored rows were all excluded could look healthy.
Verification
Head:
7de283b(same tree as next-levelc1752c7)