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.integration.symposium_skill_hook.incomplete_setup

Requirements index · View definition

evidence Valid

Example

In a project that lists habeas under [dev-dependencies] but has no habeas.css in its book source directory, the agent context starts with the skill sentence, followed by the advisory saying Habeas Codicem is not fully configured and suggesting habeas setup. test requirements.integration.symposium_skill_hook.setup_state

Rationale

The example is covered by tests/setup.rs#fn[session_start_puts_the_skill_sentence_before_the_setup_advisory]. That test carries a {test} reference to requirements.integration.symposium_skill_hook.incomplete_setup. I judged this by reading the test and its helpers; I did not run it, and I did not read src/hook.rs to confirm the hook’s behaviour.

Setup. fixture() builds a project with a Cargo.toml, a book.toml with src = "md", and md/SUMMARY.md. The test appends [dev-dependencies] habeas = "0.2" to the manifest. It asserts md/habeas.css does not exist. That matches “lists habeas under [dev-dependencies] but has no habeas.css in its book source directory”.

Run. session_start() runs the real habeas hook session-start binary with a SessionStart JSON on stdin and parses its stdout.

Expected outcomes, each asserted:

  • One agent context. event.len() == 1, and additionalContext is read from it as a string.
  • Skill sentence first. context.strip_prefix(SKILL_SENTENCE) must succeed. The constant is the full skill sentence, so the context starts with it.
  • Advisory follows. After trimming leading whitespace, the remainder must start with “Habeas Codicem is not fully configured”.
  • Suggests habeas setup. The advisory must contain “habeas setup”.
  • Only one skill pointer. “habeas skill” must occur exactly once in the context.

The sibling tests session_start_advises_only_when_setup_is_incomplete and session_start_points_to_the_habeas_skill_once_setup_is_complete add contrast cases. They are not needed for this example.

Inputs

Tests

Input 2: outline tests/setup.rs fn[session_start_puts_the_skill_sentence_before_the_setup_advisory]
  • File: tests/setup.rs
  • Selector: fn[session_start_puts_the_skill_sentence_before_the_setup_advisory]
  • Kind: fn
  • tests/setup.rs:641–674
// {test}`requirements.integration.symposium_skill_hook`
// {test}`requirements.integration.symposium_skill_hook.setup_state`
// {test}`requirements.integration.symposium_skill_hook.incomplete_setup`
#[test]
fn session_start_puts_the_skill_sentence_before_the_setup_advisory() {
    let temp = fixture();
    let project = temp.path();
    let manifest = fs::read_to_string(project.join("Cargo.toml")).unwrap();
    fs::write(
        project.join("Cargo.toml"),
        format!("{manifest}\n[dev-dependencies]\nhabeas = \"0.2\"\n"),
    )
    .unwrap();
    assert!(!project.join("md/habeas.css").exists());

    let response = session_start(project, project);
    let event = response["SessionStart"].as_object().unwrap();
    assert_eq!(event.len(), 1, "one agent context: {response}");
    let context = event["additionalContext"].as_str().unwrap();
    let advisory = context
        .strip_prefix(SKILL_SENTENCE)
        .unwrap_or_else(|| panic!("the skill sentence must come first: {context:?}"));
    let advisory = advisory.trim_start();
    assert!(
        advisory.starts_with("Habeas Codicem is not fully configured"),
        "{advisory:?}"
    );
    assert!(advisory.contains("habeas setup"), "{advisory:?}");
    assert_eq!(
        context.matches("`habeas` skill").count(),
        1,
        "exactly one sentence points to the skill: {context:?}"
    );
}

Other sources

Input 1: requirements selection requirements.integration.symposium_skill_hook.incomplete_setup
:::{example} symposium_skill_hook.incomplete_setup
In a project that lists `habeas` under `[dev-dependencies]` but has no `habeas.css` in its book source directory, the agent context starts with the skill sentence, followed by the advisory saying Habeas Codicem is not fully configured and suggesting `habeas setup`. {test}`requirements.integration.symposium_skill_hook.setup_state`
:::