meta.book.browser_serve

The sage-meta serve <port> command validates and renders the selected model before serving its snapshot on the loopback interface. It reports the local URL and serves until stopped. The port must be an integer from 1 through 65535; an optional model path selects the input. Invalid arguments, model errors, and binding failures produce a failing exit status with a diagnostic. Opening the reported URL provides the specified browser without another serving command.

For example, cargo run -p sage-meta -- serve 3001 serves the snapshot at http://127.0.0.1:3001/. cargo run -p sage-meta -- browse writes a standalone HTML snapshot. The commands are ways to deliver the browser specified here.

Read in specification context · design/meta/book.md

Implementation

TODO crates/sage-meta/tests/spec_plan.rs:189–196

sage_meta::todo · test:spec_plan

TODO: Combine argument/model/binding failure cases with a live-server check of its reported URL, selected model, snapshot, and shutdown.

#![allow(unused)]
fn main() {
    // {anchor}`meta.book.browser_serve`<<
    #[test]
    #[sage::test(meta.book.browser_serve)]
    fn browser_serve_validates_and_hosts_on_loopback() {
        // TODO: Combine argument/model/binding failure cases with a live-server
        // check of its reported URL, selected model, snapshot, and shutdown.
    }
    // >>

}

See more source ↗

Tests and review

Indexed tests and the implementation-completeness and test-adequacy review; no test run is implied.

TODO sage_meta::todo::browser_serve_validates_and_hosts_on_loopback

crates/sage-meta/tests/spec_plan.rs · test:spec_plan

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(meta.book.browser_serve)]
    fn browser_serve_validates_and_hosts_on_loopback() {
        // TODO: Combine argument/model/binding failure cases with a live-server
        // check of its reported URL, selected model, snapshot, and shutdown.
    }
}

See more source ↗

Review: Accepted · anchor_094 fresh final review.

Reviewed the complete browser_serve claim, the associated spec_plan.rs implementation region and its complete test function. Both registered entries are explicitly TODO: todo::browser_serve_validates_and_hosts_on_loopback contains no assertions and requests combined argument/model/binding failures plus live-server URL, selected-model, snapshot and shutdown checks. There are no registered ordinary or N/A entries. An empty placeholder passing is not proof of this command behavior.

Captured current foundations through main.rs command handling, server.rs, browser.rs rendering entry path, workspace.rs model-root/loading helpers and the existing unassociated serve argument test. The full claim decomposes into: serve <port> with optional model directory; integer range 1..65535; validate/render before listening; loopback-only serving; report the working local URL; continue serving until stopped; argument/model/bind failures yield non-success and diagnostic; accessing the URL directly delivers the browser; browse emits standalone HTML. All remain represented by the declared implementation/test deferral, rather than silently treated as complete by this review.

Source inspection shows main parses a u16 and rejects zero, missing/non-UTF8 port, malformed or overflowing numbers and excess arguments. It selects the optional model root after the port, otherwise the configured book source's design/crates directory. load_documents recursively reads sorted .sage sources, skips symlinks and errors on empty inputs; parsing/loading errors propagate. main calls model validation and prints diagnostics, then returns an error when invalid. The shared browser renderer validates again, rejects empty models, serializes the model and embeds assets before server::serve is called. The explicit root is canonicalized for workspace discovery. The serve branch passes the rendered HTML to the server instead of writing a browser file; the browse branch writes its .html snapshot and reports its canonical path.

server::serve binds specifically to 127.0.0.1 and the supplied port, propagating binding/runtime/server errors through main's Result return. Only after binding does it print the listener's actual URL and startup-snapshot/Ctrl-C guidance. Axum routes / and /sage-browser.html return the captured HTML with no-store, and its awaited serving future uses Ctrl-C graceful shutdown. This explains how the example port 3001 becomes http://127.0.0.1:3001/ without a second command and how source/rendering precede listener startup. These are inspected source paths, not an observed live server, network-interface check, browser session or proof of shutdown behavior.

The captured unassociated serve_rejects_missing_invalid_or_extra_arguments test directly asserts unsuccessful child status and a port/usage stderr diagnostic for missing, nonnumeric, zero, overflow and excess arguments. It supplies useful partial evidence without covering successful boundary ports, alternate model selection, semantic-model failure, occupied ports, actual loopback requests, persistent serving or shutdown. Its semantic selector did not resolve because it is not in the annotated inventory; a bounded source read then captured the complete function. No behavioral test failed in this review.

The TODO is justified as unfinished command integration coverage. Completing it needs a subprocess fixture with a known model, controlled occupied/free loopback ports, readiness/URL capture, bounded HTTP requests and reliable child cleanup/shutdown; tests must exercise invalid model and argument cases as well as exact served selected snapshot. Existing source foundations and the small argument test do not remove that prerequisite. This report preserves the TODO implementation and TODO test status and does not claim production completion. No additional source associations or behavior edits are needed merely to accept that explicit deferral. Commands in this pass were review start/read/record and inspection only; no suites or live server were run, per central-suite coordination. Captured dependencies are complete for this assessment; no requested edits.

Browse meta anchors

116 anchors

Specification anchors and declared coverage
AnchorImplementationTests
meta (116)102 Implemented24 TODO103 Implemented36 TODO
meta.anchors (22)22 Implemented21 Implemented12 TODO
anchor_pagesImplementedImplementedTODO
book_explorerImplementedImplementedTODO
canonical_sourcesImplementedImplementedTODO
meta.anchors.content (7)7 Implemented7 Implemented
blocksImplementedImplemented
explicit_endImplementedImplemented
headingImplementedImplemented
literal_syntaxImplementedImplemented
next_anchorImplementedImplemented
source_endImplementedImplemented
unmatched_endImplementedImplemented
context_navigationImplementedImplementedTODO
evidence_statusImplementedImplementedTODO
explorer_navigationImplementedTODO
implementation_coverageImplementedImplementedTODO
implementation_referencesImplementedImplementedTODO
placeholder_statusImplementedImplementedTODO
point_excerptsImplementedImplementedTODO
region_balanceImplementedImplemented
region_excerptsImplementedImplementedTODO
test_coverageImplementedImplemented
test_referencesImplementedImplemented
unique_namesImplementedImplementedTODO
meta.book (21)10 Implemented18 TODO12 Implemented18 TODO
anchor_movesImplementedTODOImplementedTODO
authorityImplementedTODOImplementedTODO
browser_deliveryTODOImplementedTODO
browser_dependenciesTODOTODO
browser_rust_sourceTODOTODO
browser_searchTODOTODO
browser_serveTODOTODO
browser_structureTODOTODO
chapter_namesImplementedTODOImplementedTODO
crate_ownershipImplementedImplemented
crates_landingImplementedImplemented
entity_linksTODOTODO
index_groupsImplementedTODOImplementedTODO
index_namespace_pagesImplementedImplemented
index_rowsImplementedTODOImplementedTODO
index_statusImplementedTODOImplementedTODO
rfd_changesTODOTODO
sage_chaptersTODOImplementedTODO
self_descriptionTODOTODO
shared_modelImplementedTODOImplementedTODO
source_rolesTODOTODO
meta.contracts (4)4 Implemented3 TODO4 Implemented3 TODO
cache_invocationsImplementedTODOImplementedTODO
correspondenceImplementedImplemented
observation_coverageImplementedTODOImplementedTODO
validated_sessionImplementedTODOImplementedTODO
meta.language (39)39 Implemented39 Implemented
meta.language.calls (2)2 Implemented2 Implemented
declaredImplementedImplemented
forbiddenImplementedImplemented
meta.language.classes (3)3 Implemented3 Implemented
abstract_completeImplementedImplemented
override_signatureImplementedImplemented
single_inheritanceImplementedImplemented
meta.language.contexts (1)1 Implemented1 Implemented
inheritanceImplementedImplemented
meta.language.envelopes (7)7 Implemented7 Implemented
class_callsImplementedImplemented
createsImplementedImplemented
direct_callsImplementedImplemented
leafImplementedImplemented
permissionsImplementedImplemented
readsImplementedImplemented
receiver_callsImplementedImplemented
meta.language.fields (2)2 Implemented2 Implemented
context_stateImplementedImplemented
kindsImplementedImplemented
meta.language.methods (2)2 Implemented2 Implemented
kindsImplementedImplemented
proseImplementedImplemented
meta.language.model (3)3 Implemented3 Implemented
forbidden_pathsImplementedImplemented
inherited_prohibitionsImplementedImplemented
virtual_dispatchImplementedImplemented
meta.language.types (19)19 Implemented19 Implemented
argument_arityImplementedImplemented
declaration_proseImplementedImplemented
enum_variantsImplementedImplemented
field_proseImplementedImplemented
generic_parametersImplementedImplemented
member_commasImplementedImplemented
name_resolutionImplementedImplemented
opaque_representationImplementedImplemented
preludeImplementedImplemented
qualified_namesImplementedImplemented
recursive_valuesImplementedImplemented
struct_fieldsImplementedImplemented
tuplesImplementedImplemented
type_expressionsImplementedImplemented
unique_fieldsImplementedImplemented
unique_parametersImplementedImplemented
unique_variantsImplementedImplemented
unknown_namesImplementedImplemented
variant_proseImplementedImplemented
meta.reviews (27)27 Implemented27 Implemented
claim_textImplementedImplemented
complete_test_setImplementedImplemented
decisionsImplementedImplemented
fragment_associationsImplementedImplemented
fragment_formatImplementedImplemented
fragment_freshnessImplementedImplemented
gateImplementedImplemented
input_formatImplementedImplemented
input_fragmentsImplementedImplemented
output_formatImplementedImplemented
preparationImplementedImplemented
record_requiredImplementedImplemented
recorded_readsImplementedImplemented
recordingImplementedImplemented
review_delegationImplementedImplemented
review_diagnosticsImplementedImplemented
review_instructionsImplementedImplemented
review_scopeImplementedImplemented
selector_claimImplementedImplemented
selector_line_rangeImplementedImplemented
selector_testImplementedImplemented
selector_whole_fileImplementedImplemented
source_representationImplementedImplemented
stalenessImplementedImplemented
summary_formatImplementedImplemented
test_sourceImplementedImplemented
validation_layoutImplementedImplemented
meta.validation (3)3 TODO3 TODO
claim_specific_evidenceTODOTODO
independent_inspectionTODOTODO
review_packetsTODOTODO