requirements.integration.symposium_skill_hook.not_applicable
Requirements index · View definition
Requirement
When a session starts outside every Cargo and mdBook project, or within one whose manifest does not list
habeasunder[dev-dependencies], the hook MUST provide no agent context.
Rationale
The code and test satisfy requirements.integration.symposium_skill_hook.not_applicable; I found no gaps.
Obligation: the hook provides no agent context in two cases.
- The session starts outside every Cargo and mdBook project.
- The session starts inside a project whose manifest does not list
habeasunder[dev-dependencies].
Code: src/hook.rs#fn[session_start] carries the {impl} reference and calls session_start_response. That function returns {"SessionStart": {}}, with no additionalContext, in these situations:
- No project found:
setup::find_project_rootreturnsNone. It looks throughcwd.ancestors()for a directory with bothCargo.tomlandbook.toml. A directory outside any Cargo and mdBook project therefore gets no context. - No dev-dependency:
setup::project_depends_on_habeasis false. It parsesCargo.tomland passes only if[dev-dependencies]containshabeas, viahas_habeas_dev_dependency. Ahabeasentry under[dependencies]or[build-dependencies], or an unparseable manifest, therefore gets no context. - No
SessionStartinput: the function returns the same empty object. The requirement does not address this case, and the output is just the no-context response.
Both helpers are reachable from the {impl} item, so they need no reference of their own.
Test: tests/setup.rs#fn[session_start_gives_no_context_outside_habeas_projects] carries {test} references to this requirement and to the runtime_dependency_only example. It runs the real habeas hook session-start binary through the session_start helper. It asserts the empty SessionStart response in each of these cases:
- a directory outside any project;
- a project without
habeas, started from a nested working directory; habeasonly under[dependencies];habeasonly under[build-dependencies];- a
[dev-dependencies]entry but nobook.toml, so not an mdBook project.
The runtime_dependency_only example adds no obligation beyond these. The same test covers its [dependencies]-only case.
Inputs
Implementation
Input 3: outline src/hook.rs fn[session_start]
- File:
src/hook.rs - Selector:
fn[session_start] - Kind:
fn src/hook.rs:12–20
// {impl}`requirements.integration.symposium_skill_hook`
// {impl}`requirements.integration.symposium_skill_hook.setup_state`
// {impl}`requirements.integration.symposium_skill_hook.not_applicable`
pub(crate) fn session_start() -> Result<(), Box<dyn Error>> {
let input: Value = serde_json::from_reader(io::stdin()).unwrap_or(Value::Null);
let response = session_start_response(&input, &std::env::current_dir()?);
serde_json::to_writer(io::stdout().lock(), &response)?;
Ok(())
}
Tests
Input 2: requirements selection requirements.integration.symposium_skill_hook.runtime_dependency_only
requirements.integration.symposium_skill_hook.runtime_dependency_only:md/requirements/integration.md:80–82
:::{example} symposium_skill_hook.runtime_dependency_only
A Cargo and mdBook project that lists `habeas` only under `[dependencies]` gets no session-start agent context, neither the skill sentence nor a setup advisory. {test}`requirements.integration.symposium_skill_hook.not_applicable`
:::
Input 4: outline tests/setup.rs fn[session_start_gives_no_context_outside_habeas_projects]
- File:
tests/setup.rs - Selector:
fn[session_start_gives_no_context_outside_habeas_projects] - Kind:
fn tests/setup.rs:676–721
// {test}`requirements.integration.symposium_skill_hook.not_applicable`
// {test}`requirements.integration.symposium_skill_hook.runtime_dependency_only`
#[test]
fn session_start_gives_no_context_outside_habeas_projects() {
let no_context = json!({"SessionStart": {}});
let outside = TempDir::new().unwrap();
assert_eq!(
session_start(outside.path(), outside.path()),
no_context,
"a directory outside every Cargo and mdBook project"
);
let temp = fixture();
let project = temp.path();
let manifest = fs::read_to_string(project.join("Cargo.toml")).unwrap();
let nested = project.join("src/nested");
fs::create_dir_all(&nested).unwrap();
assert_eq!(
session_start(project, &nested),
no_context,
"a project that does not list Habeas"
);
for table in ["dependencies", "build-dependencies"] {
fs::write(
project.join("Cargo.toml"),
format!("{manifest}\n[{table}]\nhabeas = \"0.2\"\n"),
)
.unwrap();
assert_eq!(
session_start(project, project),
no_context,
"a project listing Habeas only under [{table}]"
);
}
// A Habeas dev dependency outside an mdBook project is not applicable either.
fs::write(
project.join("Cargo.toml"),
format!("{manifest}\n[dev-dependencies]\nhabeas = \"0.2\"\n"),
)
.unwrap();
fs::remove_file(project.join("book.toml")).unwrap();
assert_eq!(session_start(project, project), no_context);
}
Other sources
Input 1: requirements selection requirements.integration.symposium_skill_hook.not_applicable
requirements.integration.symposium_skill_hook.not_applicable:md/requirements/integration.md:76–78
:::{req} symposium_skill_hook.not_applicable
When a session starts outside every Cargo and mdBook project, or within one whose manifest does not list `habeas` under `[dev-dependencies]`, the hook MUST provide no agent context.
:::