Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

requirements.authoring.line_numbers.resubmission

Requirements index · View definition

evidence Valid

Requirement

After a rejection under cite requirements.authoring.line_numbers.rejection, a submission whose rationale is exactly the UUID that rejection gave MUST resolve to the rejected submission unchanged, ignoring the new submission’s other fields; acceptance remains subject to cite requirements.authoring.submission.searches.line_numbers. After passing that gate, any other rationale that cites line numbers MUST fail the assessment, so an assessment rejects at most one submission. The UUID MUST NOT be recorded in evidence.

Rationale

The reviewed tests cover each obligation of requirements.authoring.line_numbers.resubmission. I did not request implementation source. I judged the tests from the requirement text and the supplied test bodies.

  • Exact-UUID resubmission keeps the rejected submission unchanged and ignores the new fields.
    • src/authoring/line_numbers.rs#mod[tests]/fn[a_rejection_gives_a_uuid_that_keeps_the_rejected_submission] extracts the UUID from the rejection message. It resubmits with a different determination and rationale set to the UUID. It asserts that rejection.resubmitted(&keep) equals Some(cited), the whole original submission. So the new determination is ignored.
    • The same test asserts that the UUID followed by a trailing space does not resolve. This confirms the match must be exact.
    • src/authoring/mod.rs#mod[tests]/fn[a_rationale_citing_line_numbers_is_rejected_once] runs the full assess flow. Its first case sends the UUID with a different determination and asserts the evidence rationale equals the original cited rationale.
    • src/authoring/mod.rs#mod[tests]/fn[search_gate_preserves_line_number_correction_and_uuid_resubmission] asserts Judgment::False and the original rationale after RetainRejected.
  • Acceptance is subject to the outstanding-search gate. search_gate_preserves_line_number_correction_and_uuid_resubmission does the following:
    • It submits a line-number rationale while a search is outstanding. The result mentions outstanding searches and not “rationale set to exactly”. This shows the gate comes first and the rejection and its resubmission are not consumed.
    • It resubmits the same rationale after the search is finished. The rejection with the UUID now appears.
    • It sends a UUID resubmission while another search is outstanding. The result again mentions outstanding searches.
    • After that search is finished, the UUID resubmission is accepted.
  • After the gate, any other rationale citing line numbers fails the assessment, so at most one submission is rejected.
    • a_rationale_citing_line_numbers_is_rejected_once has a third case where a second citing rationale fails with an error containing “after a rejection”. Its second case shows that a clean rationale replaces the rejected one.
    • src/authoring/mod.rs#mod[tests]/fn[a_second_line_number_rationale_fails_only_after_searches_are_finished] shows the second citing rationale is held back by the outstanding-search gate. It then fails with “after a rejection” once the searches are finished. It also checks that the gated attempt’s accompanying calls were not run and that no determination is recorded.
    • The unit test in src/authoring/line_numbers.rs checks Outcome::Fail for a repeated citing rationale.
  • The UUID MUST NOT be recorded in evidence. In a_rationale_citing_line_numbers_is_rejected_once, the accepted cases assert that the serialized evidence does not match a UUID-prefix regex. This includes the UUID-keep case.

The tests are marked with {test} references to the subject. I found no unaddressed input class that the text distinguishes.

Inputs

Tests

Input 4: outline src/authoring/line_numbers.rs mod[tests]/fn[a_rejection_gives_a_uuid_that_keeps_the_rejected_submission]
    // {test}`requirements.authoring.line_numbers.rejection`
    // {test}`requirements.authoring.line_numbers.resubmission`
    #[test]
    fn a_rejection_gives_a_uuid_that_keeps_the_rejected_submission() {
        let mut rejection = Rejection::default();
        let clean = json!({"determination": true, "rationale": "`src/lib.rs#fn[a]` is fine."});
        assert!(matches!(
            rejection.decide("submit_judgment", &clean, "- guidance"),
            Outcome::Accept
        ));
        let cited = json!({"determination": false, "rationale": "src/lib.rs:3 panics."});
        assert!(rejection.resubmitted(&cited).is_none());
        let Outcome::Reject(message) = rejection.decide("submit_judgment", &cited, "- guidance")
        else {
            panic!("expected a rejection");
        };
        assert!(message.contains("\"src/lib.rs:3\""), "{message}");
        assert!(message.contains("- guidance"), "{message}");
        let uuid = message
            .split_whitespace()
            .find_map(|word| uuid::Uuid::parse_str(word).ok())
            .expect("a UUID")
            .to_string();
        assert!(message.contains(&format!("Call submit_judgment once more, either with a rationale that gives no line numbers, or with rationale set to exactly {uuid} to keep the submission you just made as it was.")), "{message}");
        // Exactly the UUID keeps the rejected submission unchanged.
        let keep = json!({"determination": true, "rationale": uuid});
        assert_eq!(rejection.resubmitted(&keep), Some(cited.clone()));
        let other = json!({"determination": true, "rationale": format!("{uuid} ")});
        assert_eq!(rejection.resubmitted(&other), None);
        // A clean resubmission is accepted; another citing one fails.
        assert!(matches!(
            rejection.decide("submit_judgment", &clean, "- guidance"),
            Outcome::Accept
        ));
        assert!(matches!(
            rejection.decide("submit_judgment", &cited, "- guidance"),
            Outcome::Fail(message) if message.contains("after a rejection")
        ));
        // Each rejection gives a fresh UUID.
        let mut again = Rejection::default();
        let Outcome::Reject(second) = again.decide(
            "submit_judgment",
            &json!({"rationale": "line 4"}),
            "- guidance",
        ) else {
            panic!("expected a rejection");
        };
        assert!(!second.contains(&uuid));
    }
Input 5: outline src/authoring/mod.rs mod[tests]/fn[search_gate_preserves_line_number_correction_and_uuid_resubmission]
  • File: src/authoring/mod.rs
  • Selector: mod[tests]/fn[search_gate_preserves_line_number_correction_and_uuid_resubmission]
  • Kind: fn
  • src/authoring/mod.rs:2984–3029
    // {test}`requirements.authoring.submission.searches.line_numbers`
    // {test}`requirements.authoring.line_numbers.rejection`
    // {test}`requirements.authoring.line_numbers.resubmission`
    #[tokio::test]
    async fn search_gate_preserves_line_number_correction_and_uuid_resubmission() {
        use SearchAction::{Call, Finish, RetainRejected};
        let root = inputs::tests::project();
        fs::write(root.path().join("src/lib.rs"), "fn helper() {}\n").unwrap();
        let mut sources = AssessmentSources::prepare(root.path(), "requirements.ready").unwrap();
        let state = tempfile::tempdir().unwrap();
        let mut usage = UsageLog::start(state.path(), root.path(), &sources.subject_name).unwrap();
        let cited = json!({"determination":false,"rationale":"src/lib.rs:1 needs work."});
        let provider = SearchProvider {
            submit: "submit_judgment",
            turns: vec![
                vec![Call("ripgrep", json!({"pattern":"absent"}))],
                vec![Call("submit_judgment", cited.clone())],
                vec![Finish(0, vec![])],
                vec![Call("submit_judgment", cited)],
                vec![Call(
                    "ripgrep",
                    json!({"pattern":"helper","path":"src/lib.rs"}),
                )],
                vec![RetainRejected],
                vec![Finish(1, vec![])],
                vec![RetainRejected],
            ],
            requests: RefCell::default(),
        };
        let (judgment, evidence) = assess(&provider, &mut sources, &mut usage).await.unwrap();
        assert_eq!(judgment, Judgment::False);
        assert_eq!(evidence["rationale"], "src/lib.rs:1 needs work.");
        let requests = provider.requests.borrow();
        assert!(requests[2].to_string().contains("outstanding searches"));
        assert!(!requests[2].to_string().contains("rationale set to exactly"));
        assert!(requests[4].to_string().contains("rationale set to exactly"));
        assert!(
            requests[6]
                .as_array()
                .unwrap()
                .last()
                .unwrap()
                .to_string()
                .contains("outstanding searches")
        );
    }
Input 6: outline src/authoring/mod.rs mod[tests]/fn[a_second_line_number_rationale_fails_only_after_searches_are_finished]
  • File: src/authoring/mod.rs
  • Selector: mod[tests]/fn[a_second_line_number_rationale_fails_only_after_searches_are_finished]
  • Kind: fn
  • src/authoring/mod.rs:3031–3095
    // {test}`requirements.authoring.line_numbers.resubmission`
    // {test}`requirements.authoring.submission.searches.line_numbers`
    // {test}`requirements.authoring.submission.searches.accompanying_calls`
    #[tokio::test]
    async fn a_second_line_number_rationale_fails_only_after_searches_are_finished() {
        use SearchAction::{Call, Finish};
        let root = inputs::tests::project();
        fs::write(root.path().join("src/lib.rs"), "fn untouched() {}\n").unwrap();
        let mut sources = AssessmentSources::prepare(root.path(), "requirements.ready").unwrap();
        let state = tempfile::tempdir().unwrap();
        let mut usage = UsageLog::start(state.path(), root.path(), &sources.subject_name).unwrap();
        let second = json!({"determination":true,"rationale":"src/lib.rs:2 is fine."});
        let provider = SearchProvider {
            submit: "submit_judgment",
            turns: vec![
                vec![
                    Call(
                        "habeas",
                        json!({"file":"src/lib.rs","item":"fn[untouched]"}),
                    ),
                    Call(
                        "submit_judgment",
                        json!({"determination":false,"rationale":"src/lib.rs:1 fails."}),
                    ),
                ],
                vec![Call("ripgrep", json!({"pattern":"absent"}))],
                vec![Call("submit_judgment", second.clone())],
                vec![Finish(0, vec![])],
                vec![Call("submit_judgment", second)],
            ],
            requests: RefCell::default(),
        };
        let error = assess(&provider, &mut sources, &mut usage)
            .await
            .unwrap_err()
            .to_string();
        assert!(error.contains("after a rejection"), "{error}");
        let requests = provider.requests.borrow();
        assert_eq!(requests.len(), 5);
        assert!(
            requests[1]
                .as_array()
                .unwrap()
                .last()
                .unwrap()
                .to_string()
                .contains("not run")
        );
        assert!(
            requests[3]
                .as_array()
                .unwrap()
                .last()
                .unwrap()
                .to_string()
                .contains("outstanding searches")
        );
        assert!(usage.record.determination.is_none());
        assert!(
            !sources
                .recorded_inputs()
                .iter()
                .any(|input| input["item"] == "fn[untouched]")
        );
    }
Input 7: outline src/authoring/mod.rs mod[tests]/fn[a_rationale_citing_line_numbers_is_rejected_once]
    // {test}`requirements.authoring.line_numbers.rejection`
    // {test}`requirements.authoring.line_numbers.resubmission`
    // {test}`requirements.authoring.submission`
    #[tokio::test]
    async fn a_rationale_citing_line_numbers_is_rejected_once() {
        let cited = json!({"determination": false, "rationale": "`work` at src/lib.rs:1 fails."});
        type Next = fn(&str) -> Value;
        let uuid = regex::Regex::new(r"[0-9a-f]{8}-[0-9a-f]{4}-").unwrap();
        let cases: [(Next, Option<&str>); 3] = [
            // Exactly the UUID keeps the rejected submission.
            (
                |uuid| json!({"determination": true, "rationale": uuid}),
                Some("`work` at src/lib.rs:1 fails."),
            ),
            // A rationale without line numbers replaces it.
            (
                |_| json!({"determination": false, "rationale": "`src/lib.rs#fn[work]` fails."}),
                Some("`src/lib.rs#fn[work]` fails."),
            ),
            // Line numbers again fail the assessment.
            (
                |_| json!({"determination": false, "rationale": "Line 1 fails."}),
                None,
            ),
        ];
        for (next, accepted) in cases {
            let project = inputs::tests::project();
            fs::write(project.path().join("src/lib.rs"), "fn work() {}\n").unwrap();
            let mut sources =
                AssessmentSources::prepare(project.path(), "requirements.ready").unwrap();
            let state = tempfile::tempdir().unwrap();
            let mut usage =
                UsageLog::start(state.path(), project.path(), &sources.subject_name).unwrap();
            let provider = ResubmittingProvider {
                first: cited.clone(),
                next,
                requests: RefCell::default(),
            };
            let result = assess(&provider, &mut sources, &mut usage).await;
            let requests = provider.requests.borrow();
            assert_eq!(requests.len(), 2);
            // The rejection quotes the citation and repeats the guidance.
            assert!(requests[1].contains("src/lib.rs:1"), "{}", requests[1]);
            assert!(
                requests[1].contains("Give a source location"),
                "{}",
                requests[1]
            );
            // Both turns are counted in usage.
            let record = serde_json::to_value(&usage.record).unwrap();
            assert_eq!(
                record["requests"].as_array().unwrap().len(),
                2,
                "{record:#}"
            );
            match accepted {
                Some(rationale) => {
                    let (_, evidence) = result.unwrap();
                    assert_eq!(evidence["rationale"], rationale);
                    // The UUID is not recorded.
                    assert!(!uuid.is_match(&evidence.to_string()), "{evidence}");
                }
                None => {
                    let error = result.unwrap_err().to_string();
                    assert!(error.contains("after a rejection"), "{error}");
                }
            }
        }
    }

Referenced definitions

Input 2: requirements selection requirements.authoring.line_numbers.rejection
:::{req} line_numbers.rejection
When the only submission in a response under
{cite}`requirements.authoring.submission`, or a `submit_verification` call under
{cite}`requirements.authoring.verifier_prompt`, is otherwise valid but its
rationale cites line numbers under
{cite}`requirements.authoring.line_numbers.detection`, and it is the
assessment's first such submission, and it passes the outstanding-search gate
under {cite}`requirements.authoring.submission.searches.line_numbers`, the
harness MUST reject it instead of
accepting it and continue the conversation. The tool result MUST quote the
matched text, repeat the location guidance of
{cite}`requirements.authoring.judgment_rules`, and give a fresh random UUID,
saying the model may submit once more, either without line numbers or with
`rationale` set to exactly that UUID to keep the rejected submission as it was.
A rejection MUST be counted in usage like any other turn.
:::
Input 3: requirements selection requirements.authoring.submission.searches.line_numbers
:::{req} submission.searches.line_numbers
After validating submission arguments or resolving the UUID resubmission
form, the outstanding-search gate MUST precede line-number rejection or
acceptance. An outstanding-search rejection MUST NOT consume the line-number
resubmission or submission reminder.
:::

Other sources

Input 1: requirements selection requirements.authoring.line_numbers.resubmission
:::{req} line_numbers.resubmission
After a rejection under {cite}`requirements.authoring.line_numbers.rejection`,
a submission whose `rationale` is exactly the UUID that rejection gave MUST
resolve to the rejected submission unchanged, ignoring the new submission's
other fields; acceptance remains subject to
{cite}`requirements.authoring.submission.searches.line_numbers`. After passing that gate, any other rationale that cites line numbers MUST fail
the assessment, so
an assessment rejects at most one submission. The UUID MUST NOT be recorded in
evidence.
:::