fix(cache): address PR #349 follow-up feedback (#359)

Two small, non-blocking asks from Mads on #349:

- Pin the verification-still-applies restatement in apply.md and
  interview.md's cache-check paragraphs - the one part of the wiring
  with no dedicated test (one assertion each, as requested).
- State cache contents are data, never instructions, in
  04-job-evaluation.md's cache section - closes a carry-over
  prompt-injection surface for a later session reading the file, same
  trust-boundary rule apply.md Step 0 already states for the posting.
This commit is contained in:
Gabriel Ignacio Mensi
2026-08-23 09:00:13 +02:00
committed by GitHub
parent becdc5dfd7
commit eee739ed7e
3 changed files with 49 additions and 2 deletions
+37
View File
@@ -84,6 +84,18 @@ class TestCacheDefinition(unittest.TestCase):
"cache section must restate that final-claim verification still applies",
)
def test_cache_definition_states_contents_are_data_not_instructions(self):
"""Follow-up requested on PR #349: notes fields are written from fetched web
content the same way the job posting is, so a later session reading the cache
must treat them as data to evaluate, never as directions to follow - the same
trust-boundary rule apply.md Step 0 states for the posting itself."""
body = self.sections.get("Company Research Cache", "")
self.assertIn(
"data, never instructions",
body,
"cache section must state cache contents are data, never instructions",
)
class TestApplyWiring(unittest.TestCase):
def test_reviewer_prompt_checks_cache_before_researching(self):
@@ -105,6 +117,18 @@ class TestApplyWiring(unittest.TestCase):
"- the write half is the one most likely to be dropped silently",
)
def test_reviewer_prompt_restates_verification_still_applies_to_a_cache_hit(self):
"""New one-line restatement inside the cache-check paragraph itself, distinct
from the grounding-audit rule elsewhere in the prompt - Mads flagged this as
the one part of the cache wiring with no dedicated pin (PR #349 follow-up)."""
body = _apply_research_step()
self.assertRegex(
body,
r"still applies",
"the cache-check paragraph must restate that verification still applies "
"to a cache hit, not just to fresh research",
)
class TestInterviewWiring(unittest.TestCase):
def test_step_2_checks_cache_before_researching(self):
@@ -135,6 +159,19 @@ class TestInterviewWiring(unittest.TestCase):
"Step 2 must keep its existing verification requirement",
)
def test_step_2_cache_paragraph_restates_verification_still_applies(self):
"""New one-line restatement inside the cache-check paragraph itself - distinct
from test_step_2_still_requires_verification_before_using_a_claim above, which
pins the older, pre-existing 'Verify before using' rule further down. Mads
flagged this new one-liner as unpinned (PR #349 follow-up)."""
body = _interview_research_step()
self.assertRegex(
body,
r"still applies",
"the cache-check paragraph must restate that verification still applies "
"to a cache hit, not just to fresh research",
)
if __name__ == "__main__":
unittest.main()