Harden MAP harness context gates#141
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the MAP harness’ “context gates” by (1) keeping generated/cache artifacts out of shipped templates and installs, (2) re-priming essential workflow context after compaction, and (3) tightening evidence-first requirements for dismissal verdicts across MAP review/check agents and skills.
Changes:
- Add template hygiene guardrails (build/package excludes, sync cleanup, installer ignores, and a regression test to prevent shipping generated artifacts).
- Enhance workflow context injection and post-compaction re-prime context with hard constraints, acceptance/validation tags, and “source authority” reminders.
- Enforce “evidence-first” dismissal verdict requirements across multiple agents/skills, with new contract tests.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_workflow_context_injector.py | Updates reminder truncation tests to use REMINDER_LIMIT and verifies constraints/tags/authority hints appear. |
| tests/test_template_sync.py | Adds a hygiene test to prevent generated/cache artifacts from being tracked under shipped templates. |
| tests/test_skills.py | Adds regression tests enforcing evidence-backed dismissal verdict contracts and source authority language. |
| tests/test_post_compact_context.py | Adds tests for post-compaction re-prime context emission and silence when artifacts are absent. |
| tests/conftest.py | Disables bytecode writing during tests to avoid generating __pycache__ / .pyc artifacts. |
| src/mapify_cli/templates/skills/map-review/SKILL.md | Adds “source authority” guidance and evidence-first dismissal gate language. |
| src/mapify_cli/templates/skills/map-check/SKILL.md | Adds “source authority” guidance and evidence-first dismissal gate language. |
| src/mapify_cli/templates/hooks/workflow-context-injector.py | Raises reminder cap, injects hard constraints + acceptance tags, and adds source-authority hint. |
| src/mapify_cli/templates/hooks/post-compact-context.py | Adds re-prime block after compaction with workflow state, constraints/tags, retry rejection summary, and authority reminder. |
| src/mapify_cli/templates/agents/predictor.md | Adds evidence-first dismissal gate guidance to predictor agent prompt. |
| src/mapify_cli/templates/agents/monitor.md | Adds evidence-first dismissal gate guidance to monitor agent prompt. |
| src/mapify_cli/templates/agents/final-verifier.md | Adds source-authority + evidence-first dismissal requirements to final verifier instructions. |
| src/mapify_cli/templates/agents/evaluator.md | Adds evidence-first dismissal gate requirement to evaluator instructions. |
| src/mapify_cli/templates/agents/documentation-reviewer.md | Adds source-authority + evidence-first dismissal requirements for documentation verdicts. |
| src/mapify_cli/delivery/file_copier.py | Adds copy-time ignore filter to prevent installing __pycache__/.pyc/.DS_Store from dirty template trees. |
| src/mapify_cli/delivery/codex_copier.py | Extends codex template copier to skip __pycache__, .DS_Store, and .pyc/.pyo files. |
| scripts/sync-templates.sh | Cleans generated artifacts during sync and excludes cache artifacts during rsync/copy. |
| pytest.ini | Excludes slow tests by default; adds asyncio loop scope setting. |
| pyproject.toml | Adds hatch build excludes for __pycache__, .pyc/.pyo, and .DS_Store. |
| .claude/skills/map-review/SKILL.md | Mirrors shipped template updates for evidence-first dismissal and source authority rules. |
| .claude/skills/map-check/SKILL.md | Mirrors shipped template updates for evidence-first dismissal and source authority rules. |
| .claude/hooks/workflow-context-injector.py | Mirrors shipped template updates for reminder cap, constraints/tags, and source-authority hint. |
| .claude/hooks/post-compact-context.py | Mirrors shipped template updates for post-compaction re-prime context. |
| .claude/agents/predictor.md | Mirrors shipped template updates for evidence-first dismissal gate language. |
| .claude/agents/monitor.md | Mirrors shipped template updates for evidence-first dismissal gate language. |
| .claude/agents/final-verifier.md | Mirrors shipped template updates for source authority + evidence-first dismissal requirements. |
| .claude/agents/evaluator.md | Mirrors shipped template updates for evidence-first dismissal gate language. |
| .claude/agents/documentation-reviewer.md | Mirrors shipped template updates for source authority + evidence-first dismissal requirements. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -1,10 +1,11 @@ | |||
| [pytest] | |||
| asyncio_default_fixture_loop_scope = function | |||
Comment on lines
+64
to
+68
| project_root = templates_root.parents[2] | ||
| result = subprocess.run( | ||
| ["git", "ls-files", "src/mapify_cli/templates"], | ||
| cwd=project_root, | ||
| capture_output=True, |
Comment on lines
+64
to
+77
| project_root = templates_root.parents[2] | ||
| result = subprocess.run( | ||
| ["git", "ls-files", "src/mapify_cli/templates"], | ||
| cwd=project_root, | ||
| capture_output=True, | ||
| text=True, | ||
| check=True, | ||
| timeout=5, | ||
| ) | ||
| offenders = [ | ||
| Path(path).relative_to("src/mapify_cli/templates") | ||
| for path in result.stdout.splitlines() | ||
| if _is_disallowed_template_artifact(Path(path)) | ||
| ] |
Comment on lines
1
to
+7
| [pytest] | ||
| asyncio_default_fixture_loop_scope = function | ||
| testpaths = tests | ||
| python_files = test_*.py | ||
| python_classes = Test* | ||
| python_functions = test_* | ||
| addopts = -v --tb=short --strict-markers | ||
| addopts = -v --tb=short --strict-markers -m "not slow" |
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
Validation