Skip to content

Refuse databases that require an unsupported extension, on every surface (ADR-083 §2) - #3426

Merged
mstomar125 merged 12 commits into
mainfrom
issue-3413-requires-extension-guard
Oct 1, 2026
Merged

mstomar125 merged 12 commits into
mainfrom
issue-3413-requires-extension-guard

Conversation

@mstomar125

@mstomar125 mstomar125 commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Part of #3413

Slice S6 of the required-extensions refusal (ADR-081 step 3, ADR-083 §2): required_extensions, the daemon's open guard, the refusal through the proto, daemon, routing layer, CLI, tray and app-lib, and the single display-name module. The app's refusal view is slice S7, which codes against the contract below.

Database reset: REQUIRED. The database-settings schema gains required_extensions, and core seeds schemas only when they are missing. No backfill.

Contract for S7 (app-lib → frontend)

A request routed to a refused database fails with a CommandError:

{
  "message": "<refusal message>",          // from extension_names::refusal_message
  "code": "REQUIRES_EXTENSION",
  "details": "FailedPrecondition",
  "requiresExtension": {
    "unsupportedExtensions": ["pro"],
    "message": "<refusal message>",
    "downloadLabel": "<download label>",   // extension_names::DOWNLOAD_LABEL
    "downloadUrl": "https://nodespace.ai"  // extension_names::DOWNLOAD_URL
  }
}
  • requiresExtension is present only on REQUIRES_EXTENSION (skip_serializing_if), and conflictData is absent on it. The Rust field is Option<Box<RequiresExtensionPayload>>: boxed only to keep Result<_, CommandError> small (clippy result_large_err); the JSON is exactly the shape above.
  • Every CommandError command checks for the refusal first: status_to_command_error (nodes, conflicts, …), the agent-session mapper (whose own FAILED_PRECONDITION arm would otherwise say AGENT_NOT_READY), and the commands with codes of their own (collections, schemas, methodology, embeddings, chat models, local agent) through refusal_or. So whichever of these loads first, the frontend sees REQUIRES_EXTENSION.
  • The routed commands that report failures as plain strings, import_markdown_file[s], get_local_identity, set_local_identity and should_prompt_identity_backfill, return the refusal message itself through status_message, not tonic's debug text. They carry no code; their error shape is unchanged.
  • list_databases: a refused database has status: "requires_extension" (status_str). The DTO's key set is unchanged; the ids and text come from the error payload.
  • The registry commands in commands/database.rs (list, create, register, set default, rename, remove) never open a database, so none of them can return the refusal. create refuses an existing path, and a new file requires nothing.

Acceptance (quoted from the slice) and where each is met

  1. The database-settings schema declares required_extensions: a list of strings, empty by default, stored in the base bucket so it survives a retype to a subtype. core_schemas.rs (array of string, default [], Core protection); DatabaseSettingsNodeBehavior::validate rejects anything but a list of strings.
  2. The daemon's shared services take the set of supported extension ids, which is empty in core. SharedContext::supported_extensions(), fixed empty in core. Only this crate's unit tests set a fixture set, through a #[cfg(test)] field. build_shared_services gains no parameter (Pro rebuild (after core release): finish core's extension points for typed subtypes, edge fields and Pro UI (ADR-082) #3414's versioned hook).
  3. On every database open, before any seeding or write, the daemon reads the settings singleton's required_extensions. If any entry is unsupported: the open fails with FAILED_PRECONDITION, reason requires_extension, and the unsupported ids; nothing is written to the file (a test checks the file is byte-identical); the daemon keeps serving other databases, including when the refused database is the registry default. The guard is the first statement of build_database_services, before the directory step and SqliteStore::new, so get_or_open, create, the boot default and library callers all pass through it. A refused boot default no longer stops nodespaced: unrouted_services_if_default_refused gives the router an unrouted service set (below).
  4. This is not a security control, and the code comments say so: the file is plain SQLite. core/src/db/required_extensions.rs, assembly.rs (DatabaseRequiresExtensions, the guard).
  5. CLI: any command routed to such a database exits non-zero with the same message, and nodespace db list marks the database. nodespace_cli::run rewrites an error whose chain carries the refusal into refusal_message plus DOWNLOAD_LABEL: DOWNLOAD_URL. database list shows requires_extension and appends (needs …); --json adds unsupported_extensions and refusal.
  6. Tray: the Databases menu marks the database. database_menu_entries appends extension_names::requirement(ids). The entry stays selectable, because the app it opens shows the refusal and its download link.
  7. Skill guidance: SKILL.md / references/cli.md describe the new CLI error and the db list marker. They tell the agent not to retry, move or edit the file, and to tell the user the database needs [the paid product]. The SKILL.md drift check passes. Both branches of SKILL.md's failure-recovery table (shell and MCP) and the CLI reference's database section tell the agent to relay the CLI's message verbatim, download line included, which names what the database needs; the skill itself never spells out the product name. They also say not to retry or touch the file, and to offer another database. They describe requires_extension and the JSON's unsupported_extensions/refusal. skill:gen changes no generated region; skill:check and build:skill pass.
  8. The extension-id display names (pro → "NodeSpace Pro") and the download-link constant live in one module, which is the only entry in scripts/check-pro-boundary.ts's allowlist. It exempts only that string. The module is packages/proto/src/extension_names.rs, and ALLOWLIST holds exactly { file: "packages/proto/src/extension_names.rs", exempt: "NodeSpace Pro" }. No other marker or rule in the checker changed.
  9. Unit tests pin the mailto and download-link constants … you add the download-link pin. extension_names::tests::the_download_link_is_pinned.
  10. Look the singleton up by its fixed id …; immutable=1 only when no -wal file exists, otherwise mode=ro; never SqliteStore; … immediately before SqliteStore::new … runs before the table-shape check. read_required_extensions (it uses json_type, so a stored string is never mistaken for an array's text).
  11. db list and the tray learn the refused state at listing time … never write databases.toml or a marker. Proto: DATABASE_STATUS_REQUIRES_EXTENSION = 3, repeated string unsupported_extensions = 11. DatabaseManager::list copies the snapshot under its locks and probes each closed database outside them. The probe is not cached: the optional mtime cache was left out.
  12. FAILED_PRECONDITION with binary metadata x-requires-extension-bin = JSON {"reason":"requires_extension","unsupported_extensions":[...]} … status message = the module-rendered refusal text … CLI, tray and app-lib each render message, label and DOWNLOAD_URL from their own linked copy of the module. nodespace_proto::requires_extension::{status, unsupported_extensions}: one builder and one parser, gated on the code and the reason.
  13. app-lib mapping. See the contract above.
  14. The supported set is fixed and empty in the public API … a pub(crate) / #[cfg(test)] seam, with the test inside the daemon crate. services/required_extensions_tests.rs.

A refused default keeps the daemon serving

The same holds when the guard cannot read the default's list (a damaged file, or a value that is not a list of strings): RequiredExtensionsUnreadable fails that open closed, and the boot fallback accepts it like a refusal. A node table of an unknown shape is left to the store's own table-shape check, so a database from another version still reaches the incompatible-database flow.

build_base_router takes concrete service values, which nodespaced took from the default's set. Behind DbManagerLayer, every per-database handler resolves its database through the manager. The handlers that don't route (daemon version and memory, PTY sessions, the shared model catalog) serve only process-global state. So when the default is refused, build_unrouted_services builds those values over a private, uniquely named in-memory SQLite (file:…?mode=memory&cache=shared) with the shared PTY manager and local agent, and starts no background work. The default stays closed and its requests get the refusal; other databases, Create and the process-global handlers keep working. This differs from the table-shape refusal, which still stops the daemon. open_default_database now takes its registry and marker paths, so a main.rs test can drive it in a temp directory.

Tests (each mutation-checked)

# Test Where
1, 2 refused with FAILED_PRECONDITION, reason and ids; the directory holding the file is byte-identical (nothing seeded, no marker, no rename). Moving the guard after seeding fails the byte check daemon/src/services/required_extensions_tests.rs::a_database_requiring_an_unsupported_extension_is_refused_untouched; reader-level the_list_is_read_from_the_settings_bucket_and_nothing_is_written
3 singleton retyped through handle_create_schema + update_node to a fixture subtype is refused …::a_singleton_retyped_to_a_subtype_is_still_refused, reader a_retyped_singleton_is_found_by_its_id
4 value only in an un-checkpointed WAL is refused, main file untouched …::a_requirement_only_in_the_wal_is_refused, reader a_value_only_in_the_wal_is_read_without_touching_the_file
5 refused boot default: daemon serves other DBs, Create, process-global RPCs; default byte-identical; no marker daemon/tests/it/required_extensions_e2e.rs, main.rs::open_default_database_tests
6 context {fixture} opens a DB requiring fixture, refuses [fixture, other] naming only other …::a_supported_extension_opens_and_an_unsupported_one_is_refused
7 default [] in the base bucket, survives a retype, non-strings rejected core/tests/it/required_extensions_field_test.rs, behaviors unit tests, core_schemas pin
8 closed, never-opened refused DB marked in the listing and the tray …::a_closed_never_opened_database_is_marked_in_the_listing, tray::tests::a_database_requiring_an_extension_is_marked, database_service::tests::listing_to_info_carries_the_refusal
9 the compiled nodespace binary exits non-zero with exactly the module text; database list and --json mark the DB cli/tests/it/requires_extension.rs, lib.rs::refusal_tests
10 status_str, status_to_command_error payload JSON, refusal_or, status_message, agent-session mapping app-lib commands::{nodes,database,agent_session}::tests
— an unreadable database is refused untouched and does not stop the daemon as the default; an unknown node shape is left to the shape check; Windows drive, verbatim and UNC URI paths …::an_unreadable_database_is_refused_and_does_not_stop_the_daemon, reader a_node_table_of_another_shape_requires_nothing, windows_drive_and_share_paths_become_uri_paths
11 display name, refusal text and download label/URL pins; status round-trip and gating proto/src/extension_names.rs, proto/src/requires_extension.rs
12 the ALLOWLIST is that one entry; the module counts without it; in the module any other marker still counts (bare word, cloud wording, a command name); the entry applies to no other file. Fixture runs of the copied checker start from an empty allowlist, because a fixture repo has no display-name module scripts/check-pro-boundary.test.ts (real-repo hard ban)

Absence checks build their expected text from the module (refusal_message, requirement), never a literal.

Ratchet

bun run scripts/check-pro-boundary.ts exits 0 with every marker at 0. The productName and proWording hits in packages/proto/src/extension_names.rs, where the product name appears in display_name, DOWNLOAD_LABEL and their pins, are hidden only by the one ALLOWLIST entry. Without the entry there are 7 hits for each marker; no other file in the diff hits any marker.

🤖 Generated with Claude Code

@mstomar125 mstomar125 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated pragmatic-code-review: REQUEST CHANGES (narrow; posted as a comment because GitHub blocks self-approval).

Review Type: Initial Review

Requirements Check

# Item Status
1 required_extensions on database-settings: list of strings, default [], base bucket, survives retype ✅
2 Shared services carry a supported set that is empty in core ✅ (SharedContext::supported_extensions(), fixed &[] outside cfg(test))
3 Guard before any seed or write; FAILED_PRECONDITION with reason and ids; file byte-identical; daemon keeps serving (refused default included) ✅
4 "Not a security control" comments ✅
5 CLI exits non-zero with the module text; db list marks the database ✅
6 Tray marks the database ✅
7 Skill guidance deferred to S5, out of scope
8 One display-name module ✅ module. The ALLOWLIST half is deferred to S5
9 Download-link pin ✅
10 Lookup by fixed id; immutable=1 vs mode=ro; no SqliteStore; guard before SqliteStore::new and the shape check ✅ (placed even earlier, before the directory create/chmod)
11 Listing-time probe, no registry write; proto enum 3 and field 11 ✅ (no mtime cache, which the spec made optional)
12 x-requires-extension-bin payload, status message from the module ✅
13 app-lib mapping ⚠️ Partial: status_str, the status_to_command_error arm and the requiresExtension JSON are exact; "any database command … maps it the same way" is not met (finding 1)
14 No new pub parameter; #[cfg(test)] seam, test inside the daemon crate ✅
Tests 1–11 ✅
Test 12 deferred to S5

Checked and sound:

  • Guard placement. It is the first statement of build_database_services, so every open path passes through it. A refused open touches nothing on disk or in the registry.
  • Unrouted set. With DbManagerLayer installed, every routed adapter resolves through the manager. The handlers that do not route touch only process-global state. Nothing is spawned.
  • list() locks. Same order as before (registry, then open set); probes run with no lock held.
  • SQLite details. SQLITE_USE_URI is compiled into libsql-ffi, and a READONLY connection cannot checkpoint.
  • Ratchet. Every product-name hit is in extension_names.rs.

Findings

🟡 Important: some routed app-lib commands still turn the refusal into a raw tonic string
📁 app-lib/src/commands/import.rs:186-195, 247-256; app-lib/src/commands/onboarding.rs:416-420, 439-447, 529-533

  • These commands (import_markdown_file[s], get/set_local_identity, should_prompt_identity_backfill) route to the active database. They return Result<_, String> through .map_err(|e| e.to_string()).
  • For a refused database the frontend therefore gets tonic's Display form, status: FailedPrecondition, message: "…", details: [], metadata: …. That is neither REQUIRES_EXTENSION nor the module message.
  • Recommendation: render the module message at these sites, and correct the PR body's "every command" claim. Principle: one rendering path; ADR-083 §2 says every surface shows the same refusal.

🟢 Suggestion: an unreadable list on the boot default stops the daemon instead of refusing one database
📁 daemon/src/services/assembly.rs:356-367, 648-660

  • A malformed required_extensions fails the reader, and that error is not a DatabaseRequiresExtensions, so nodespaced exits non-zero and its service manager restarts it in a loop.
  • Low likelihood: core validates the value on write, so it takes an extension bug or a manual edit.

🟢 Suggestion: Windows UNC paths break the guard
📁 core/src/db/required_extensions.rs:146-172

  • \\server\share\x.db becomes file://server/share/x.db, and SQLite reads server as the URI authority.
  • The \\?\UNC\ prefix is not handled either.
  • Add a test for the drive-letter and UNC forms.

🟢 Suggestion: repeated probe cost

  • info_for runs a full list() after every create, register, rename and set-default.
  • A refused database is re-probed on every routed request.
  • The app's 2s token-stream retry loop keeps probing while a refused database is active. Each probe is cheap.

🟢 Nit: "writes nothing" is slightly overstated. mode=ro may create the -shm wal-index, though never the database or its WAL.

🟢 Nit: the unrouted set is public API that is only safe behind the routing layer. The doc comment states this precondition; consider making it structural.

🟢 Nit: dependency direction. REQUIRED_EXTENSIONS_FIELD lives in db:: but models::core_schemas and behaviors import it.

ℹ️ The slice's https://nodespace\.ai VERIFY grep matches pre-existing install.sh URLs that this diff did not introduce.

Recommendation: REQUEST CHANGES (narrow). Fix finding 1 and correct the PR body; the 🟢 items are optional.

@mstomar125

Copy link
Copy Markdown
Contributor Author

Address review (3c5066d)

Fixed

  • 🟡 Routed commands with string errors.
    • The seven sites in import.rs and onboarding.rs now go through nodes::status_message. It returns the shared refusal message for the refusal and the status's text otherwise.
    • These commands keep their String error shape, so S7's TS sees no change there.
    • The PR body's contract now names them separately from the CommandError commands.
    • The remaining String-error gRPC calls in app-lib (settings.rs capture and model configs, database.rs registry) go to unrouted, process-global services and cannot meet the refusal.
  • 🟢 An unreadable list on the boot default.
    • A guard read failure is now RequiredExtensionsUnreadable, and unrouted_services_if_default_refused accepts it like a refusal. A damaged or malformed default leaves the daemon serving the other databases.
    • Fixing this surfaced a related risk. A database from another version whose node table lacks id or properties would have failed the guard before the store's table-shape check, so it would never reach the incompatible-database marker flow. The reader now returns "nothing required" for an unknown node shape and leaves it to that check.
  • 🟢 Windows UNC paths.
    • The URI now uses an empty authority (file:// + path).
    • uri_path handles drive paths, \\?\ verbatim paths and UNC paths (\\server\share and \\?\UNC\… both become //server/share/…).
    • It takes the platform as a parameter, so the Windows forms are tested on every platform.
  • 🟢 Nit: "writes nothing". Reworded to "never writes the database or its WAL; like any WAL reader it may create the -shm index".
  • 🟢 Nit: dependency direction. REQUIRED_EXTENSIONS_FIELD now lives in models::core_schemas, next to the declaration; the reader and the behavior import it from there.

New tests, each mutation-checked:

  • an_unreadable_database_is_refused_and_does_not_stop_the_daemon fails when the fallback rejects the error, and when the guard error is not wrapped.
  • a_node_table_of_another_shape_requires_nothing fails without the shape check.
  • windows_drive_and_share_paths_become_uri_paths fails without the UNC handling.
  • status_message_renders_the_refusal_as_the_shared_message fails when it returns the raw status.

Not changed

  • 🟢 Probe cost.
    • Each probe is one read-only open and two indexed reads of a closed database. info_for runs it after explicit registry mutations only.
    • The 2s token-stream retry belongs to the app's subscription loop. Making REQUIRES_EXTENSION terminal there is a frontend-state decision for S7's refusal view.
    • I'd revisit with a per-entry listing_for(id) if a registry grows large enough for this to measure.
  • 🟢 Unrouted set as public API. It must stay pub because the nodespaced binary builds its router from it, and its doc comment states the routing-layer precondition. Taking a DatabaseManager would not prove the layer is installed either.

Re-review needed: yes. The change adds an error type and changes the reader and the boot fallback.

@mstomar125 mstomar125 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated pragmatic-code-review: REQUEST CHANGES (narrow; posted as a comment because GitHub blocks self-approval).

Review Type: Re-Review (3c5066d)

Previous Review Summary: 7 recommendations.

  • Addressed (5): the string-error commands, the unreadable boot default, Windows UNC, the "writes nothing" wording, and the constant's dependency direction.
  • Declined with reason (2):
    • Probe cost. The reasoning holds.
    • Unrouted set as public API. Mostly holds, but see Nit 4.
  • New issues: 1 🟡, 1 🟢 suggestion, 2 🟢 nits.

Verified correct:

  • status_message is used at all seven routed sites. The other string-error sites go to unrouted services.
  • RequiredExtensionsUnreadable::find_in works through the get_or_open context. A transient failure is not sticky, and routed reporting is unchanged.
  • The shape check opens no hole: any node table missing id or properties is a SchemaMismatch before any DDL.
  • The Windows URI forms match SQLite's own (file:////host/path for UNC). Tests are isolated, and no marker was added.

Findings

🟡 Important: the empty-authority file:// URI breaks relative paths on unix (a regression from this commit)
📁 packages/core/src/db/required_extensions.rs:153-182

  • rel/x.db becomes file://rel/x.db?immutable=1, which SQLite rejects: invalid uri authority: rel.
  • Relative paths reach this code through NODESPACED_DB_PATH, NODESPACE_HOME and create --path.
  • Such a database now fails closed as RequiredExtensionsUnreadable.
  • Recommendation: use std::path::absolute(db_path) before building the URI, and add a relative-path test. Principle: a fail-closed guard must not fail on valid input.

🟢 Suggestion: a damaged default is now a steady state with an opaque error
📁 packages/daemon/src/db_routing.rs:74-78

  • e.to_string() gives clients only "opening database ".
  • Recommendation: include the cause chain for the unreadable case.

🟢 Nit: the docs of build_database_services, build_unrouted_services and open_default_database name only the extension refusal as the reason the default stays closed.

🟢 Nit: build_unrouted_services has no caller outside assembly.rs. Make it private and drop it from the re-exports.

Recommendation: REQUEST CHANGES (narrow). Only the 🟡 needs fixing.

@mstomar125

Copy link
Copy Markdown
Contributor Author

Address re-review (3bbf307)

Fixed

  • 🟡 Relative paths.
    • read_only_uri runs std::path::absolute before building the file:// URI.
    • New test a_relative_path_is_read_from_the_working_directory (unix) reads a real database through a path relative to the working directory and checks the URI starts with file:///. It fails when the resolution is removed.
  • 🟢 Opaque error for an unreadable database.
    • The routing layer now sends the whole cause chain ({e:#}) in the INTERNAL status, for RequiredExtensionsUnreadable only.
    • an_unreadable_database_is_refused_and_does_not_stop_the_daemon now also asserts the routed status names the reason. It fails with the old e.to_string().
  • 🟢 Nit: docs. build_database_services, build_unrouted_services and open_default_database now name both reasons the default stays closed.
  • 🟢 Nit: least exposure. build_unrouted_services is private and gone from the re-exports. unrouted_services_if_default_refused, which needs a refusal error, is the only public way to it.

Not changed: nothing.

Re-review needed: yes, a narrow one, because the URI path resolution and the routed message changed.

@mstomar125 mstomar125 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated pragmatic-code-review: APPROVE (posted as a comment because GitHub blocks self-approval).

Review Type: Re-Review (3bbf307 only)

Previous Review Summary: 4 recommendations, all 4 addressed. New: 0 blocking, 2 🟢 nits.

  • Relative paths: resolved. std::path::absolute comes before the URI is built.
    • It is lexical and needs no file access beyond current_dir().
    • On Windows (GetFullPathNameW) every result has a drive, UNC or verbatim prefix, and uri_path handles each.
    • The new test is isolated (it only builds a path string, never changes the working directory) and fails without the fix.
  • Opaque INTERNAL error: resolved. Only the RequiredExtensionsUnreadable branch uses {e:#}, and the refusal branch is still checked first.
    • The content is the user's own path and SQLite text, sent over the owner-only socket (ADR-052).
  • Docs: resolved.
  • Exposure: resolved. build_unrouted_services is private and has no other reference.

Findings

🟢 Nit: 📁 packages/core/src/db/required_extensions.rs:202

  • use std::path::PathBuf; is used only by the #[cfg(unix)] test, so a Windows test build warns unused_imports.

🟢 Nit: 📁 packages/daemon/src/services/assembly.rs:679

  • The public unrouted_services_if_default_refused links the now-private build_unrouted_services, which triggers rustdoc::private_intra_doc_links.

Recommendation: APPROVE

@mstomar125

Copy link
Copy Markdown
Contributor Author

Address re-review (approve, with 2 nits)

Both nits are fixed in the latest commit:

  • The relative-path test writes std::path::PathBuf in place, and the module-level use is gone, so a non-unix test build has no unused import.
  • The public unrouted_services_if_default_refused doc names build_unrouted_services in plain backticks, not as an intra-doc link.

Neither changes logic, so no re-review is needed. The remaining work, the skill guidance and the ALLOWLIST entry with its checker test, waits for S5 (#3420) and will get its own review round.

@mstomar125
mstomar125 force-pushed the issue-3413-requires-extension-guard branch from 49169d4 to 6c3eb2d Compare October 1, 2026 11:45

@mstomar125 mstomar125 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated pragmatic-code-review: APPROVE (posted as a comment because GitHub blocks self-approval).

Review Type: Re-Review: c146769 (ALLOWLIST and checker test) and 6c3eb2d (skill guidance), the scope the previous approval deferred until after #3420.

Requirements Check

  • ✅ Acceptance 7.
    • Rows in both SKILL.md branches and in references/cli.md tell the agent to relay the CLI message verbatim with its download line, not to retry, never to touch the file, and to offer another database. No product name appears.
    • The text matches render_refusal/refusal_text, status_str, requirement_note and info_to_json, and the MCP passthrough's stripping of the "Error:" prefix.
    • Both edits sit outside the GENERATED regions.
  • ✅ Acceptance 8. ALLOWLIST is exactly {file: "packages/proto/src/extension_names.rs", exempt: "NodeSpace Pro"}, and no other marker or rule changed.
  • ✅ Test 12.
    • The entry is pinned, and the module counts without it.
    • In the module, a bare Pro, cloud wording and a command name still count; a broader exempt would fail.
    • The entry applies to no other file.
    • runInFixture starting from an empty allowlist weakens nothing: the base's ALLOWLIST was []. The declaration regex fails closed.

Findings

  1. 🟢 references/cli.md: database use changes the default for every client. Tell the agent to ask first, or drop the clause.
  2. 🟢 references/cli.md: the JSON refusal field has the message only, without the download line. Say so.
  3. 🟢 Nit: SKILL.md Branch 1 and Branch 2 verb lists differ ("copy").
  4. 🟢 Nit: source.replace(declaration, replaced) interprets $ patterns. Use () => replaced.
  5. ℹ️ The slice's https://nodespace\.ai VERIFY grep matches five pre-existing install/website links (also on main).

Recommendation: APPROVE

@mstomar125

Copy link
Copy Markdown
Contributor Author

Address review (ALLOWLIST and skill round), 5188f78

Fixed

  • 🟢 database use in references/cli.md. The agent now asks the user first, because it changes the default for every client, the desktop app included. --database stays the suggested way to keep working.
  • 🟢 JSON refusal field. The paragraph says it carries the message alone. When relaying from a listing, the agent says the download link comes with the error of any command run against that database.
  • 🟢 Nit: $ in the replacement. source.replace(declaration, () => replaced).

Superseded

  • 🟢 Nit: the Branch 1/2 verb lists. The test:changed run after 6c3eb2d failed skill_md_body_is_within_spec_size_recommendations (SKILL.md body at ~5140 tokens, over 5000). 95bdf1d shortened both rows to the essentials and points at references/cli.md, which keeps the full wording, so the lists no longer diverge. The body is now ~4990 tokens.

Not changed

  • ℹ️ The https://nodespace\.ai VERIFY grep: the coordinator has been told about the five pre-existing install/website links.

Checks after the change

  • test:changed passed on 95bdf1d: scripts, skill, and Rust nextest.
  • After 5188f78 (prose and a test helper only): bun run test:scripts (1103 pass), test:skill (132 pass), the CLI skill_md_generation tests (12 pass), skill:check, eslint/tsc, and check-pro-boundary.ts exits 0.

Re-review needed: no. No logic changed.

@mstomar125
mstomar125 marked this pull request as ready for review October 1, 2026 11:50
mstomar125 and others added 12 commits October 1, 2026 13:56
…ts wire form

packages/core/src/db/required_extensions.rs reads a database's
required_extensions through a read-only SQLite URI (immutable=1 without a
-wal file, mode=ro with one) and never opens a SqliteStore. The proto crate
gains extension_names (display names, refusal message, download label and
URL) and requires_extension (the FAILED_PRECONDITION status and its
x-requires-extension-bin payload), and database_service.proto gains
DATABASE_STATUS_REQUIRES_EXTENSION and DatabaseInfo.unsupported_extensions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…mon opens it

build_database_services reads the settings singleton's required_extensions
through the read-only reader before it creates the directory or opens the
store, and returns DatabaseRequiresExtensions for any id the context does
not support. The supported set is empty in core; this crate's unit tests
set a fixture set through a test-only SharedContext field.

The routing layer turns the refusal into FAILED_PRECONDITION with the
x-requires-extension-bin payload. DatabaseManager::list probes each closed
database and reports DatabaseStatus::RequiresExtension with the unsupported
ids, which DatabaseService carries as DATABASE_STATUS_REQUIRES_EXTENSION and
unsupported_extensions, and the tray marks the entry. A refused default no
longer stops the daemon: unrouted_services_if_default_refused builds the
router's service values over a private in-memory store so the other
databases stay served.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tabases in database list

run() rewrites an error whose chain carries the daemon's refusal into the
shared refusal message and the download link, so every command routed to a
refused database exits non-zero with the same text the app shows.
database list prints the requires_extension status and what the database
needs, and its JSON gains unsupported_extensions and the refusal message.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…top app's commands

CommandError gains requires_extension, serialized as requiresExtension
{ unsupportedExtensions, message, downloadLabel, downloadUrl } and rendered
by the shared display-name module. status_to_command_error maps the
daemon's refusal to code REQUIRES_EXTENSION, and every command that maps
statuses to codes of its own (collections, schemas, methodology,
embeddings, chat models, local agent, agent sessions) takes it first
through refusal_or. status_str reports DATABASE_STATUS_REQUIRES_EXTENSION as
requires_extension.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The database-settings schema declares required_extensions, an array of
strings defaulting to [] and stored in the base bucket, so a seeded
singleton carries an empty list and the value stays in place when the
singleton is retyped to a subtype. DatabaseSettingsNodeBehavior rejects any
value that is not a list of strings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…an unreadable default from stopping the daemon

- import and identity commands, which report failures as strings, show the
  shared refusal message through status_message instead of tonic's text.
- A guard read failure is RequiredExtensionsUnreadable, and the boot
  fallback accepts it as it accepts a refusal, so a damaged or malformed
  default leaves the other databases served.
- The reader leaves a node table of an unknown shape to the store's
  table-shape check instead of failing on a missing column, so a database
  from another version still reaches the incompatible-database flow.
- The read-only URI uses an empty authority and handles Windows drive,
  verbatim and UNC paths, tested on every platform.
- REQUIRED_EXTENSIONS_FIELD moves next to the schema that declares it, and
  the reader's doc says it may create the -shm index like any WAL reader.

Not changed: listing probes stay uncached (each is one read-only open of a
closed database), and the unrouted service set stays public because the
nodespaced binary builds it; its doc states the routing-layer precondition.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and report an unreadable database's cause

- read_only_uri makes the path absolute first: a relative path in a URI with
  an empty authority reads as the authority, which SQLite refuses.
- A routed request to a database whose requirements cannot be read gets the
  whole cause chain in its INTERNAL status, since the daemon keeps running
  with that database closed.
- build_unrouted_services is private; unrouted_services_if_default_refused
  is the only way to it.
- The docs of the open path, the unrouted set and open_default_database name
  both reasons the default stays closed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ALLOWLIST gains its one entry (ADR-081 section 8): the product name in
packages/proto/src/extension_names.rs, and nothing else in that file.
The checker tests pin the entry, show the module counts without it, show
every other marker in the module still counts, and that the entry applies
to no other file. Fixture runs of the copied checker start from an empty
allowlist, since a fixture repository has no display-name module.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…extension

SKILL.md's failure-recovery tables (shell and MCP branches) and the CLI
reference describe the refusal the CLI prints and the requires_extension
status database list shows: relay the message verbatim with its download
line, do not retry, never move or edit the file, and offer another
database. The guidance never names the product; the CLI's message does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ecommendation

The body test caps SKILL.md at ~5000 tokens; the rows now point to the CLI
reference, which carries the detail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he download line comes from

- references/cli.md: the agent asks the user before database use, which
  changes the default for every client, and knows the JSON refusal field
  carries the message without the download line.
- The checker test's declaration replacement takes a function, so a
  dollar sign in an entry is never read as a replacement pattern.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mstomar125
mstomar125 force-pushed the issue-3413-requires-extension-guard branch from 5188f78 to 24572c9 Compare October 1, 2026 11:56
@mstomar125
mstomar125 merged commit 33ed106 into main Oct 1, 2026
@mstomar125
mstomar125 deleted the issue-3413-requires-extension-guard branch October 1, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant