Repository navigation
Take the daemon's supported extension ids from build_shared_services - #3624
Conversation
Pragmatic Code Review: PR #3624Review Type: Initial Review. There were no earlier reviews or comments, and the PR is one commit ( Code Review SummaryThis is a small, well-targeted change and a clear net positive. It replaces the
There are no blockers. Three cheap improvements are worth making before the follow-up PRs grow this type. Requirements CheckThese are the parts of #3414's "Typed subtypes and edge fields" section that this PR claims.
Project rules (CLAUDE.md): all met.
Test isolation (env vars under nextest): safe when run the way the repo runs it.
One caveat applies to plain FindingsCritical IssuesNone. Suggested Improvements🟡 1. Mark New variants are already planned:
As written, this is a public, exhaustive enum, and the watched fixture names its variant. Adding a variant later breaks any exhaustive
Principle: Open/Closed. Design a versioned error type for growth you already know is coming. 🟡 2. Make This is fine under nextest. Under plain
The model-path window is narrow, because it is the synchronous start of The precedent, Fix (a few lines): inside Principle: defensive test isolation. "No test can load the real model" should not depend on which runner is used when making it unconditional is this cheap. 🟡 3. Exercise the hook's whole public surface in the watched fixture, or make it smaller ADR-082 §8 relies on fixtures that "use every Rust extension point with its full signature", so that a rename or retype trips the version gate.
Both unused methods are Either fix closes the gap:
Principle: the version gate only protects what the fixtures exercise. Nitpicks🟢 Nit: duplicate ids in the supported list 🟢 Nit: duplicated helper 🟢 Suggestion for the follow-up PRs: reserve core's edge keys in the bucket-name rule 🟢 Suggestion for later: where the version constant lives If the Pro daemon crate wants its own compile-time check, consider moving the constant to a crate both already depend on, such as RecommendationAPPROVE. The change is correct, minimal, and a clear improvement: the test-only split in the guard is gone, and the hook matches ADR-082 §5 and §8 and ADR-083 §2. Findings 1–3 do not block merging, and all are cheap. Finding 1 is worth doing in this PR, before the follow-ups add variants. As the PR body notes, coordinate the 2.3 bump with #3622: whichever lands second bumps to 2.4. Automated pragmatic code review (medium depth). Read-only: nothing was built or run. |
mstomar125
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
1d293d0 to
26f9fcb
Compare
Address review (round 1)I addressed the APPROVE review's three 🟡 findings and two of its nits in ✅ Addressed
⏭️ Deferred
Mutation check of the new and changed assertions
Local runs after the rebase
Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: The changes are an attribute, a three-line dedupe and test-only hardening. They are low-risk and add no new design. 🤖 Generated with Claude Code |
26f9fcb to
657470c
Compare
build_shared_services takes a DaemonExtensions value. Its supported_extension(id) declares an extension id the daemon supports, so a database whose settings node lists that id in required_extensions opens. DaemonExtensions::none() is core's own daemon and supports none, as before. - SharedContext carries the value as `extensions`, replacing the test-only supported set; the open guard reads it. - build_shared_services checks the value before it builds or reads anything, and refuses an id that is not a lowercase letter followed by lowercase letters, digits, '-' or '_'. The rule is nodespace_core::extensions:: is_extension_id. - A fixture in the daemon's integration tests drives the hook through build_shared_services with an isolated home and no embedding model; it is added to WATCHED_PATHS. - EXTENSION_API_VERSION 2.3: a new daemon hook (minor). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- DaemonExtensionsError is non_exhaustive, so a later hook can add a way to be refused as a minor change. - supported_extension keeps one entry per id, as its doc says. - The fixture's environment guard holds a process-wide lock, so tests that share a process (plain cargo test) cannot resolve the model path from an environment another test is restoring. - The fixture checks DaemonExtensions::check, supported_extensions and SharedContext::extensions, and that a marked database closed cleanly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main reached 2.3 with the host API's nodes.updateNode, which took the minor this change first claimed. The daemon hook is a further minor change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
657470c to
f265d30
Compare
Part of #3414 (the "Typed subtypes and edge fields" section, ADR-082 §2 and §5). This is the first of three PRs. The next ones add subtype behaviours and edge fields to the same
DaemonExtensionsvalue.What changes
build_shared_servicesnow takes aDaemonExtensionsvalue. This replaces the open guard's fixed, empty supported set (ADR-083 §2) with a hook a composing build fills in.DaemonExtensions(packages/daemon/src/services/extensions.rs):none();supported_extension(id);supported_extensions();check().DaemonExtensions::none()is core's daemon, and the fournodespacedentry points pass it.SharedContext::extensionscarries the value and replaces the#[cfg(test)]field. The guard inunsupported_required_extensionsreads it, so every open checks it:get_or_open, the boot default, andcreate.Startup check.
build_shared_serviceschecks the value first, before it reads settings or resolves the model, and returnsDaemonExtensionsErrorto stop startup.-or_.nodespace_core::extensions::is_extension_id, which lives in core because the edge-field PR names edge-property buckets with the same ids.Comments.
extension_names.rsno longer says the build "supports none" unconditionally.With
DaemonExtensions::none(), behaviour is unchanged: the supported set is empty, exactly as the non-test branch of the removedsupported_extensions()returned.Acceptance mapping (#3414, typed subtypes and edge fields)
build_shared_servicestakes the supported extension ids, replacing the step-3 guard's fixed empty set. A database that lists a supported id opens.extension_points_fixture::a_database_requiring_a_supported_extension_opens).Tests
packages/daemon/tests/it/extension_points_fixture.rsis new and added toWATCHED_PATHS. It drives the hook throughbuild_shared_servicesitself.NODESPACE_HOMEat a temp dir andNODESPACED_MODEL_PATHat a file that does not exist. No test reads the user's state or loads a model, even under a mutant that skips the check.a_database_requiring_a_supported_extension_opens:["fixture"]opens, and["fixture","other"]is refused forotheralone.core_refuses_a_database_requiring_any_extension:DaemonExtensions::none()refuses["fixture"].an_invalid_extension_id_stops_startup.Unit tests:
services::extensions::tests::check_rejects_the_first_invalid_supported_id;nodespace_core::extensions::tests::an_extension_id_is_….The existing
required_extensions_testsnow build their contexts throughDaemonExtensions::supported_extension.Mutation check. Every new test was checked against at least one mutant, and all 10 mutants were killed:
build_shared_servicesstoresnone()instead of the caller's valuea_database_requiring_a_supported_extension_opensan_invalid_extension_id_stops_startupa_database_requiring_…_openscore_refuses_…,a_database_requiring_…_openscheck()accepts every idcheck_rejects_…,an_invalid_extension_id_stops_startupcheck()looks at only the first idcheck_rejects_…an_extension_id_is_…(daemon, then again after the move to core)an_extension_id_is_…(daemon, then again after the move to core)Local runs (crate-scoped, under the machine slot):
cargo clippy -p nodespace-core -p nodespace-daemon -p nodespace-cli -p nodespace-proto --all-targets -- -D warnings -D clippy::unused-async;cargo nextest run -p nodespace-daemon extension_points_fixture required_extensions services::extensions: 11/11 pass;cargo nextest run -p nodespace-core --lib extensions:: required_extensions: 16/16 pass;cargo fmt --check,check-pro-boundary,check-node-type-literals,check-extension-api-version, andbun test scripts/check-extension-api-version.test.ts(30/30);src/tests/extension-apiVitest suite: 47/47.Extension API
2.3 → 2.4 (minor). This adds a daemon hook (ADR-082 §8: a new hook is minor).
657470c0.app-lib/src/extensions/fixture_tests.rs, the TypeScript constant, and the re-recorded surface snapshot. Onlyversionchanged there.WATCHED_PATHS, and the script's test expects it.build_shared_services(): it now takes an argument, so passDaemonExtensions::none().SharedContexthas a new required field,extensions. ADR-082 §5 lists both as unversioned library API.Repo-wide checks after rebasing onto #3622:
bun test scripts/: 1441/1441;src/tests/extension-apisuite: 50/50.Documentation
Companion docs PR: NodeSpaceAI/nodespace-docs#109, branch
issue-3414-typed-subtypes(architecture/extension-points.md). It adds a Daemon section, the startup-refusal row, the watched fixture and version 2.3, and narrows the "Not built yet" item. It grows with the next two PRs.🤖 Generated with Claude Code