From 6014f42eb91165d95b036deee308820091477d6e Mon Sep 17 00:00:00 2001 From: mavrick Date: Sun, 22 Nov 2026 14:13:48 -0600 Subject: [PATCH 1/3] test(engine): snapshot of command ids and parameters crates/engine/command-surface.txt lists every registered command id with its parameter keys and optional marks. An engine test fails, naming each command removed, added or reshaped, until the file is regenerated with `cargo xtask commands`, so a removed or renamed command or parameter is always a deliberate change. Removes the roadmap line this lands. --- AGENTS.md | 5 + CONTRIBUTING.md | 3 +- ROADMAP.md | 2 - crates/engine/command-surface.txt | 601 ++++++++++++++++++++++ crates/engine/examples/command_surface.rs | 23 + crates/engine/src/lib.rs | 1 + crates/engine/src/surface.rs | 91 ++++ xtask/src/main.rs | 16 +- 8 files changed, 737 insertions(+), 5 deletions(-) create mode 100644 crates/engine/command-surface.txt create mode 100644 crates/engine/examples/command_surface.rs create mode 100644 crates/engine/src/surface.rs diff --git a/AGENTS.md b/AGENTS.md index cad3c3bddc..c24fdcb942 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -152,6 +152,11 @@ the pull request which of these it reaches and why the rest don't apply: `cargo xtask ci` (fmt, clippy -D warnings, tests, layers) before every commit. `cargo xtask test-hygiene` (also in CI) requires `// test-wait: reason` on timer waits in tests and `#[ignore = "reason"]` on ignored tests; prefer completion or progress signals. +The engine test `command_surface_matches_the_snapshot` fails on any difference between the registered +commands and `crates/engine/command-surface.txt` (each command id with its parameter keys and optional +marks, not the help text): a pull request that adds, removes or renames a command +or a parameter runs `cargo xtask commands` and commits the file. A removal or rename is a +coordinate-first change. `cargo xtask memory` (in CI on Linux) fails when a command line workflow's peak memory grows past its limit in `xtask/memory-limits.txt`; a change that lowers one commits the lower limit with it. `cargo xtask rows` (also in CI) fails when code outside `rustgis-data` uses a layer's rows directly diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b9420a1756..fdaede175f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,7 +44,8 @@ something on the roadmap (or not on it) interests you, propose it and open a pul - changes the data model (`Feature`, `Coord`, `Renderer`); - adds a dependency or a crate; - changes the `.rgis` project format, or an existing command's id or parameters (the CLI, - Python, MCP and saved scripts call commands by id); + Python, MCP and saved scripts call commands by id; `crates/engine/command-surface.txt` lists + them, and a test fails until a pull request that changes one commits the new file); - changes the plugin interface; - falls under _Exploratory_ in the roadmap. diff --git a/ROADMAP.md b/ROADMAP.md index 81fba75c7a..34bccc9c70 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -111,8 +111,6 @@ features build on. already are refused, [#1364](https://github.com/opengeos/RustGIS/pull/1364)); packages (`.rgispkg`) that hold everything or say what stayed linked; projects written to disk as they save, not built in memory first. -- A snapshot test of command ids and parameters, so a removal is always deliberate (the project - file's JSON Schema, its fixtures and the files past releases saved are checked today). - A compressed encoding of today's project JSON, read one release before it is written. _Coordinate first_: an issue is needed. - A system for the data a project refers to: named connections, copies that remember their diff --git a/crates/engine/command-surface.txt b/crates/engine/command-surface.txt new file mode 100644 index 0000000000..90f6a2cf81 --- /dev/null +++ b/crates/engine/command-surface.txt @@ -0,0 +1,601 @@ +analysis.interpolate layer field crs? cellSize? power? neighbors? name? ran? +analysis.lineOfSight layer from to band? observerHeight? targetHeight? name? +analysis.neighborhood lon lat radius layers? select? +analysis.route layer from to costField? snapDistance? name? +analysis.simulate layer count? seed? field? rate? name? +analysis.suitability criteria name? ran? +analysis.viewshed layer lon lat band? height? radius? heights? name? ran? +animation.add seconds? +animation.export path fps? width? height? +animation.remove index? all? +arcgis.cancelSignIn +arcgis.signIn portal? clientId? port? +arcgis.signOut portal? +arcgis.status +arcgis.token url token +bookmark.add name? description? map? +bookmark.describe name description map? +bookmark.go name map? pan? +bookmark.import path? text? data? +bookmark.move name to map? +bookmark.remove name map? +bookmark.rename name newName map? +bookmark.save path +bookmark.update name map? +boundaries.add country level? name? text? +boundaries.countries +cache.auto on? +cache.cancel +cache.empty +cache.emptyIndexes +cache.fill +catalog.search url query? bbox? start? text? connection? +connection.browse id node? probe? answer? documents? +connection.cancelToken id +connection.duplicate id name? +connection.edit id name? group? address? options? auth? user? keyName? kind? +connection.forgetLogin id +connection.forgetPassword id +connection.forgetSavedKeys id +connection.generateToken id tokenEndpoint password remember? +connection.list kind? group? +connection.login id password? apiKey? token? expiresAt? allowInsecure? accessKeyId? secretAccessKey? sessionToken? remember? +connection.logout id +connection.new kind address? name? group? options? auth? user? keyName? +connection.readSde path? data? +connection.remove id +connection.resolveS3 source id +connection.test id? kind? name? group? address? options? auth? user? keyName? password? apiKey? allowInsecure? accessKeyId? secretAccessKey? sessionToken? probe? answer? +connection.tokenStatus id +copernicus.login username password totp? remember? +copernicus.logout +copernicus.status +cube.catalog theme? bbox? query? +cube.open id bbox? start? end? maxCloud? range? name? +cube.reduce cube? variable? index? crs? asset? mask? bbox? maxCloud? cellSize? resampling? band? dates? stat order? above? classes? by? start? end? months? minValid? name? +cube.trend cube? url? asset? mask? bbox? maxCloud? cellSize? resampling? band? dates? start? end? months? test? seasons? alpha? minValid? per? name? ran? +data.archive layer? on? +data.archiveHistory layer? +data.archiveRestore layer? time +data.attributeRule layer? name kind field? expression remove? +data.contingentValues layer? name fields combos remove? +data.convert layer? format path? nameField? +data.domain layer? field coded? min? max? clear? force? +data.explore layer? fields? bins? +data.profile layer? +data.relate name origin originKey destination destinationKey remove? +data.related name? select? +data.similar layer? row? fields? count? select? +data.subtypes layer? field subtypes symbolize? clear? +dl.classify layer model? training? classField? bands? hidden? epochs? name? ran? +dl.import path? data? +dl.package model? path +dl.remove model +dl.train layer training classField bands? hidden? epochs? model? +earthdata.collections keyword? shortName? cloudHosted? limit? page? answer? +earthdata.granules collection? shortName? bbox? view? start? end? limit? page? footprints? name? answer? +earthdata.login token remember? +earthdata.logout +earthdata.status +edit.addBox layer? box attributes? template? +edit.addCircle layer? circle attributes? template? +edit.addFeature layer? table? geometry attributes? template? +edit.addField layer? table? name type +edit.applyShapeConversion preview confirm +edit.boxInfo layer? row +edit.calculateField layer? table? field expression +edit.calculateGeometry layer? field create overwrite property unit epsg? scope +edit.circleInfo layer? row +edit.convertField layer? table? field type format? pivotYear? +edit.copy +edit.cut +edit.cutPolygon line +edit.delete +edit.deleteBox layer? row featureId? +edit.deleteCircle layer? row featureId? +edit.deleteField layer? table? field +edit.elevation mode z? units? surface? +edit.enable on? +edit.explode +edit.flip +edit.groundToGrid on? scale? rotation? +edit.merge +edit.move dx dy units? +edit.moveSharedVertex layer? row part? ring? index lon lat +edit.paste layer? text? +edit.pasteSpecial name? text? +edit.previewShapeConversion layer? row featureId? kind request? image? frame? +edit.redo +edit.reshape line +edit.rotate angle +edit.scale factor +edit.setGeometry layer? row geometry +edit.setValue layer? table? row field value +edit.settings showVertices? +edit.snap lon lat +edit.snapping on? tolerancePx? vertex? edge? end? +edit.split lon lat +edit.status +edit.template layer? name defaults? description? remove? +edit.tools +edit.trace from to layer? row? tolerancePx? +edit.traverse layer? start units? legs +edit.undo +edit.updateBox layer? row featureId? box +edit.updateCircle layer? row featureId? circle +edit.vertex layer? row action part? ring? index lon? lat? +embeddings.add dataset url? year? bands? stretch? dimension? bbox? name? ran? +embeddings.addCube dataset bbox? start? end? bands? stretch? name? found? complete? +embeddings.change dataset from? to? bbox? cellSize? name? ran? +embeddings.datasets +embeddings.search dataset year? bbox? footprints? +embeddings.similarity dataset point? points? year? bbox? cellSize? name? ran? +extension.disable id +extension.enable id enabled? +extension.list +fieldsOfTheWorld.add year? draw? minScore? +gp.batch tool inputs? folder? param? batch_param? outputPattern? output_pattern? params? +gp.bufferPoint lon lat distance units? name? +gp.clearHistory +gp.env extent? crs? cellSize? +gp.fileDelivered id error? +gp.finish id +gp.gallery kind +gp.geolibre +gp.historyCode run as? +gp.historyScript +gp.importGeolibreLanguage path +gp.installGeolibre +gp.installGeolibreLanguage locale +gp.package path +gp.run tool params +gp.setGeolibre path? +gp.spatialJoin target join match? distance? units? distanceField? operation? keepAll? merge? prefix? output? +gp.threads threads? +gp.tools +gp.uninstallGeolibre +gp.uninstallGeolibreLanguage locale +gp.zonalStats raster polygons bands? stats? prefix? output? +gpkg.addLayer path table? limit? name? +gpkg.discardEdits layer? +gpkg.pendingEdits layer? +gpkg.saveEdits layer? +graphics.add shape points layer? text? fill? outline? width? size? fontSize? bold? italic? align? letterSpacing? image? path? +graphics.edit layer row points? text? fontSize? bold? italic? align? letterSpacing? fill? outline? width? size? +graphics.keepTool on? +graphics.newLayer name? +graphics.style fill? outline? width? size? fontSize? bold? italic? align? letterSpacing? text? +group.add name? parent? layers? +group.expand group on? +group.indent group +group.move group to +group.outdent group +group.remove group +group.scaleRange group min? max? +group.set group name? visible? transparency? +group.setParent group parent before? +group.ungroup group +identify lon lat tolerancePx? mode? +identify.featureInfo layer lon? lat? text? url? capabilities? request? +imagery.hostedImagery layer path minZoom? maxZoom? +imagery.mesh layer path? step? +imagery.mosaic name ran? +imagery.workspace kind name? images crs? cellSize? method? +imagery.workspaceOptions name crs? cellSize? method? +info.commands +info.databaseTables database password? +info.diagnostics +info.fileColumns path delimiter? layer? crs? +info.fileLayers path crs? +info.infographic layer? +info.project nameFilter? includeFields? +job.new name description? assigned? viewExtent? +job.remove job +job.update job status? assigned? description? +labels.by layer? class? text? size? color? angle? +labels.class.add layer? name where? from? +labels.class.clear layer? +labels.class.move layer? class to +labels.class.remove layer? class +labels.class.rename layer? class name +labels.class.update layer? class? where? visible? +labels.convert layer? name? +labels.distanceRange layer? class? closest? farthest? clear? +labels.enable layer? on? +labels.field layer? class? field +labels.fonts search? +labels.lock on? +labels.move layer? class? feature to +labels.pause on? +labels.placement layer? class? position? to? side? offset? repeat? lineOffset? otherPositions? fit? abbreviations? showAll? callout? guide? +labels.resetMoved layer? class? all? +labels.scaleRange layer? class? min? max? clear? +labels.style layer? class? size? color? halo? haloColor? haloWidth? spacing? stretch? bold? italic? font? background? wrapChar? wrapLength? lineAlign? +labels.viewUnplaced on? +layer.addData path name? layer? paperSpace? blocks? stream? as? crs? x? y? wkt? delimiter? +layer.addDataBytes fileName data zoom? layer? name? x? y? wkt? crs? delimiter? paperSpace? blocks? stream? as? +layer.addDataText fileName text name? x? y? wkt? crs? delimiter? layer? paperSpace? blocks? +layer.addDatabase database password? layer? crs? name? stream? +layer.addDownload id url name? layer? zoom? x? y? wkt? crs? delimiter? paperSpace? blocks? stream? as? service? bounds? coverage? drawingInfo? geolibreProject? geolibreLayer? geolibreZarr? connection? anonymous? request? window? +layer.addEncodedPolyline polyline precision? name? +layer.addLayerFile path? text? data? +layer.addPhotos paths? folder? name? +layer.addSample name +layer.addSql sql name? database? password? crs? stream? ran? +layer.addUrl url bytes? format? name? layer? zoom? x? y? wkt? crs? delimiter? paperSpace? blocks? stream? as? whole? cog? bbox? cellSize? cube? start? end? unit? interval? dates? connection? service? bounds? from? fromDocument? anonymous? request? +layer.addZarr path variable? index? cells? crs? name? time? start? end? ran? summary? +layer.aggregation layer? shape size? +layer.blend layer? mode +layer.classStyle layer? value? index? other? color? outline? label? +layer.clearDiagram layer? +layer.color layer? color +layer.copy layer? group? +layer.copyPath layer? +layer.defineProjection layer? crs +layer.definitionQuery layer? where +layer.diagram layer? kind fields size? startAngle? labels? background? outline? +layer.diagramInfo layer? +layer.displayFilters layer? filters +layer.expand layer? on? +layer.extrusion layer? type field? height? factor? +layer.extrusionBase layer? field? base? +layer.faces layer? culling? lighting? +layer.fields layer? +layer.fillLayers layer? value? fills +layer.geocode table? layer? address provider? url? name? places? +layer.group layer? group before? +layer.indent layer? +layer.invertRamp layer? +layer.lightShadow layer? lighting? shadows? +layer.lineStrokes layer? strokes value? index? other? +layer.loadAll layer? +layer.marker layer? shape? char? font? image? size? +layer.markerRotation layer? field counterclockwise? +layer.mask layer? mask +layer.move layer? to +layer.moveDown layer? +layer.moveUp layer? +layer.noFill layer? +layer.outdent layer? +layer.outline layer? color? width? +layer.paste map? group? to? +layer.priority layer? value +layer.ramp layer? ramp +layer.referenceScale layer? scale +layer.reloadData layer? discardEdits? +layer.remove layer? +layer.rename layer? name +layer.repairSource layer? path table? +layer.restoreFill layer? +layer.save layer? path +layer.scaleRange layer? min? max? +layer.select layer? mode? +layer.selectable layer? on? +layer.sizeBy layer? field? min? max? minSize? maxSize? scaling? +layer.strokeLevels layer? on +layer.swipe layer? position? off? +layer.symbolBy layer? size? fill? stroke? strokeWidth? angle? +layer.symbology layer? type field? expression? classes? method? breaks? ramp? +layer.template template name? +layer.transparency layer? value +layer.visibility layer? visible? +layer.zoomTo layer? +layout.activate name +layout.addElement layout? kind frame? of? text? size? color? bold? italic? align? letterSpacing? rotation? wrap? font? fallback? title? allClasses? hideOther? showNoData? exclude? columns? textSize? orientation? ticks? tickSide? reverse? fill? width? radius? dash? dir? head? angle? length? image? path? layer? field? label? group? statistic? order? bars? other? stack? values? decimals? barColor? classes? labelAlign? rows? step? type? crs? short? mgrs? labels? style? tickLength? format? hemisphere? edges? labelOrientation? labelSize? off? outline? units? divisions? x? y? w? h? background? +layout.addFrame layout? shape? points? map? x? y? w? h? +layout.arrange layout? element to +layout.arrangement favourite? save? arrangement? remove? +layout.close +layout.duplicate name? layout? newName? +layout.duplicateElement layout? element dx? dy? +layout.export layout? path dpi? allPages? georeference? pdf? +layout.frameZoom layout? element? frame? to? layer? +layout.guides layout? x? y? clear? +layout.import path? text? +layout.new name? page? orientation? width? height? template? +layout.page layout? page? orientation? width? height? decimal? +layout.publication profile? extent? name? title? subtitle? sources? reference? note? author? headings? locator? decimal? colorbar? veil? contextInLegend? northArrow? legendBox? style? accent? arrangement? coverage? +layout.remove name? layout? +layout.removeElement layout? element +layout.rename name? layout? newName +layout.save layout? path +layout.series layout? layer nameField? frame? margin? off? +layout.seriesPage layout? page +layout.seriesRefresh layout? +layout.update layout? element x? y? w? h? name? visible? locked? text? size? color? bold? italic? align? letterSpacing? rotation? wrap? font? fallback? title? allClasses? hideOther? showNoData? exclude? labels? columns? textSize? orientation? ticks? tickSide? reverse? style? fill? outline? radius? width? dash? dir? head? angle? length? units? divisions? map? scale? center? bearing? pitch? grid? extentIndicator? border? layer? field? label? group? statistic? order? bars? other? stack? values? decimals? barColor? classes? labelAlign? rows? background? +locator.find locator? text limit? zoom? +map.activate name +map.addTiles url kind? name? bounds? attribution? minZoom? maxZoom? tileSize? singleImage? tms? subdomains? layers? styleLayers? opacity? blend? overlay? top? replace? id? view? start? end? unit? interval? dates? legend? connection? +map.basemap name keepTiles? color? +map.bodies +map.body name? basemap? +map.camera lon? lat? scale? +map.clipping mode distance? +map.colorVision mode +map.convertPosition lon lat position? digits? +map.displayType mode +map.drawingMode mode +map.duplicate map? name? +map.effects sunTime? weather? vignette? edges? stars? tiltShift? grain? brightness? contrast? saturation? sepia? reset? +map.expandTiles name? on? +map.exportBlock path texture? +map.exportOrbit path frames? turn? width? height? dpi? speed? +map.extent +map.findPlace query provider? url? limit? go? +map.goToLink url +map.goToXY lon lat position? scale? bearing? pitch? +map.graticule on? type? crs? onTop? color? +map.import path +map.link +map.navigation mode +map.navigator on? +map.new name? +map.nextExtent +map.package path mobile? tolerance? +map.popupMode mode +map.prevExtent +map.projection type? lon_0? lat_1? lat_2? +map.projections +map.reloadTiles name +map.reloadWebLayers +map.remove name +map.removeTiles name? index? id? +map.rename name map? +map.repairTiles name? path +map.resetNorth +map.route from to via? mode? avoid? imperial? language? url? addLayer? zoom? answer? route? +map.save path map? +map.search query limit? go? +map.selectTiles name? +map.setBearing bearing +map.setPitch pitch +map.setScale scale +map.setTiles name? visible? opacity? blend? move? to? rename? bands? range? dequantize? legend? hiddenLayers? singleImage? tileSize? +map.terrain layer? encoding? exaggeration? block? water? off? +map.thumbnail create? image? path? clear? +map.tiles +map.viewMode mode +map.walk forward? right? up? +map.zoomFull +map.zoomIn +map.zoomOut +map.zoomToExtent extent +map.zoomToTiles name? +map.zoomWorld +model.export name? graph? path? +model.import path? text? data? +model.new name? graph? steps? fromHistory? imported? +model.remove name +model.run name? graph? +model.save name graph rename? imported? +model.validate name? graph? +nationalMap.add service name? +nationalMap.services +nldi.basin comid? lon? lat? name? answer? +nldi.comid lon lat +nldi.flowline lon lat direction? name? answer? snapped? +nldi.navigate comid? lon? lat? mode? distance? source? name? answer? +nldi.sources comid? lon? lat? mode? answer? +notebook.activate notebook +notebook.addCell notebook? kind? source? at? +notebook.editCell notebook? cell source +notebook.new name? +notebook.open path? text? data? +notebook.remove notebook? +notebook.removeCell notebook? cell +notebook.run notebook? cell? +notebook.save notebook? path +offline.bringBack path? data? legacyArea? +offline.download name? extent? +offline.keepRows +offline.open name +offline.package path name? extent? legacyReturn? +offline.remove name +offline.sync name +osm.download bbox? view? preset? tags? url? name? answer? +overture.add theme type? release? bbox? tiles? files? +pg.addLayer table where? limit? name? crs? +pg.connect connection? host? port? database? user? password? sslmode? +pg.discardEdits layer? +pg.disconnect +pg.pendingEdits layer? +pg.saveEdits layer? +pg.status +pg.tables schema? +plugin.enable id enabled? +plugin.install path +plugin.installFromRegistry id url? +plugin.list +plugin.panel id values? refresh? +plugin.prepare id +plugin.registry url? +plugin.uninstall id +portal.add url use? variable? index? layer? name? portal? +portal.files dataset portal? url? +portal.search query? portal? url? org? type? dataset? bbox? view? limit? +presentation.activate presentation +presentation.blankPage presentation? title? text? background? at? +presentation.export presentation? path dpi? +presentation.imagePage presentation? path? image? data? title? caption? at? +presentation.import path? text? data? +presentation.mapPage presentation? map? lon? lat? widthM? title? at? +presentation.new name? title? +presentation.remove presentation? +presentation.removePage presentation? page +presentation.save presentation? path +presentation.updatePage presentation? page title? text? caption? notes? seconds? background? moveTo? +presentation.videoPage presentation? source poster? posterImage? title? caption? at? +profile.alongLine layer samples? lines row? +profile.alongSelected layer samples? lines +profile.autoComplete layer samples? points +profile.create layer points samples? +profile.crossSection layer samples? points at? width? +project.addFolder path +project.clearLog +project.connections +project.coordinateSystem crs? fromFirstLayer? +project.exportLog path format? +project.fromTemplate path? text? data? name? +project.importGeolibre path? url? text? data? dir? +project.importQgis path? text? data? dir? +project.log since? until? command? failed? limit? +project.logCommands on? +project.new name? +project.newTemplate path name? +project.open path +project.openText text fileName? package? +project.package path +project.removeFolder path +project.rename name +project.sample +project.save path? +project.saveAs path +project.saveTemplate path name? +project.thumbnail create? image? path? clear? +ramp.add path? text? data? file? format? name? kind? +ramp.remove name +ramp.save path +raster.bands layer? red? green? blue? preset? +raster.change before after band? method? name? ran? +raster.classify layer classes? bands? name? ran? +raster.classifySupervised layer training classField bands? name? ran? +raster.dra layer? on? +raster.editPixels layer polygon value? band? +raster.enhance layer? brightness? contrast? gamma? +raster.function layer function units? band? expression? ranges? value? keep? nir? red? azimuth? altitude? zFactor? target? name? ran? +raster.functionChain layer steps name? ran? +raster.gcpFit points transform? compare? leaveOneOut? +raster.georeference layer points? extent? transform? pointsCrs? crs? resampling? cellSize? name? path? +raster.imageGrid layer? +raster.index layer index red? green? blue? nir? swir? name? ran? +raster.info layer? +raster.mask layer? values? min? max? inside? clear? +raster.measure layer? kind points base? +raster.measurements clear? +raster.mosaic inputs name? path? +raster.process layer operation extent? polygon? selectedOnly? factor? name? ran? +raster.project layer crs? cellSize? origin? extent? grid? resampling? name? path? +raster.rasterize layer field? value? nodata? crs? cellSize? origin? extent? grid? name? path? +raster.resampling layer? type +raster.rotation layer? angle +raster.setDefaultStyle fromLayer? layer? ramp? invert? stretch? low? high? n? resampling? reset? +raster.spectral layer lon? lat? points? zone? +raster.stretch layer? type low? high? n? min? max? like? +raster.symbology layer? type band? ramp? invert? classes? method? azimuth? altitude? zFactor? shadow? sky? fill? ambient? balanced? rock? grey? +raster.zarrInfo path bbox? variable? +report.activate report +report.attachments report? field +report.autofill report? +report.chart report? category value? +report.dynamicPicture report? field +report.existingTemplate report? layout? path? text? data? end? +report.export report? path dpi? +report.field report? field remove? +report.group report? field remove? +report.new layer? name? title? fields? where? selectedOnly? groups? sort? descending? page? orientation? +report.newTemplate report? name? page? orientation? template? end? +report.open path? text? data? layer? +report.relatedReport report? related +report.remove report? +report.removeSection report? index +report.save report? path +report.saveTemplate report? path +report.statistics report? field kind? remove? +report.subreport report? relationship fields? +report.supplementalPage report? title? text? end? +report.update report? name? title? layer? where? selectedOnly? sort? descending? page? orientation? width? height? +s3.connect name? endpoint? region? buckets? accessKeyId? secretAccessKey? sessionToken? profile? anonymous? environment? +s3.connections +s3.disconnect name +s3.list url? bucket? prefix? connection? limit? +script.run script +select.all layer? +select.atPoint lon lat tolerancePx? mode? +select.byAttributes layer? where mode? +select.byPolygon points mode? +select.byRadius lon lat radius mode? +select.byRect minLon minLat maxLon maxLat mode? +select.clear +select.layerFromSelection layer? +select.rows layer? rows mode? +select.switch layer? +select.zoomTo +service.add url type? layer name? time? text? documents? source_url? describe? tiles? bbox? where? connection? +service.coverage url type? layer text? documents? source_url? describe? bbox? connection? anonymous? +service.group group? layer? name? expanded? visible? remove? +service.groupPlan url? type? name? group? layer? sourceOnly? text? documents? connection? anonymous? +service.import url type? name? text? documents? responses? connection? anonymous? +service.layers url type? text? documents? connection? filter? +service.refresh group? layer? text? documents? responses? connection? anonymous? +share.dataStore name? path? remove? +share.export3d layer? path heightField? height? zScale? +share.exportLayer layer? path crs? mode? tableName? +share.exportMap path width? height? dpi? fit? cog? +share.exportRaster layer? path band? cog? tiles? bbox? zoom? +share.exportTable table path mode? tableName? sort? limit? +share.geodataService map? path? +share.jobs +share.linkChart relationship? path? +share.locator layer? fields? path? +share.replaceWebLayer item? layer? +share.saveWebLinkChart item? relationship? +share.saveWebMap item? map? +share.saveWebScene item? map? +share.upload path store? +share.webLayer layer? path? +share.webMap map? path? +share.webScene map? path? +share.webStyle layer? path? +share.webTool model? path? +source.publish layer? +source.syncState layer? +sourcecoop.list account product path? token? +sourcecoop.products account? +sources.favourite kind address name? extra? on? +sources.list +sources.remove list kind address +sources.save kind address name? extra? +sql.query sql database? password? limit? +sql.schema database password? +stac.addAsset item asset? name? connection? +stac.addBands item combination? red? green? blue? bbox? cellSize? name? ran? +stac.addCube url? collection asset bbox? start end maxCloud? range? name? attribution? connection? +stac.addFootprints footprints name? +stac.addIndex item index bbox? cellSize? name? ran? +stac.area path? layer? buffer? unit? +stac.collections url? connection? +stac.search url? collections? bbox? intersects? layer? buffer? unit? datetime? limit? maxCloud? sortby? phase? properties? footprints? connection? +style.add path? text? data? +style.apply layer? name +style.import path? text? data? +style.importQgis layer? path? text? data? +style.new layer? name? +style.remove name +style.save path +table.close +table.open layer? +table.remove table +table.statistics layer? field selected? +task.addStep task? title instructions? command params? +task.editStep task? step title? instructions? +task.import path? text? data? +task.moveStep task? step to +task.new name? description? steps? fromHistory? imported? +task.remove task +task.removeStep task? step +task.run task? step? +task.save task? path +time.bind layer? field? start? end? unit? interval? show? +time.export path width? height? speed? from? to? +time.fields layer? +time.goTo date +time.info +time.set start? end? date? unit? interval? dates? show? before? after? cumulative? speed? loop? format? off? +time.step by? wrap? +time.unbind layer? +tool.set tool +topology.rules add? remove? clear? +topology.validate toleranceM? +view.linkViews on? +zarr.reduce layer? variable? index? stat above? start? end? months? minValid? name? crs? +zarr.series lon lat layer? variable? index? start? end? crs? diff --git a/crates/engine/examples/command_surface.rs b/crates/engine/examples/command_surface.rs new file mode 100644 index 0000000000..6a32809d74 --- /dev/null +++ b/crates/engine/examples/command_surface.rs @@ -0,0 +1,23 @@ +//! Writes the command surface snapshot (`rustgis_engine::surface::PATH`) from the registry. +//! Run through `cargo xtask commands`. + +use std::path::Path; +use std::process::ExitCode; + +use rustgis_engine::{cmd, surface}; + +/// Rewrites the snapshot file; fails when it can't be written. +fn main() -> ExitCode { + let path = Path::new(env!("CARGO_MANIFEST_DIR")).join("../..").join(surface::PATH); + let commands = cmd::all(); + match std::fs::write(&path, surface::text(&commands)) { + Ok(()) => { + println!("wrote {} ({} commands)", surface::PATH, commands.len()); + ExitCode::SUCCESS + } + Err(e) => { + eprintln!("{}: {e}", surface::PATH); + ExitCode::FAILURE + } + } +} diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index df455d2b99..719637c785 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -43,6 +43,7 @@ pub mod schema; pub mod service_logins; pub mod service_tokens; pub mod sources; +pub mod surface; #[cfg(test)] mod tests; mod undo_memory; diff --git a/crates/engine/src/surface.rs b/crates/engine/src/surface.rs new file mode 100644 index 0000000000..6ff5e9dfa6 --- /dev/null +++ b/crates/engine/src/surface.rs @@ -0,0 +1,91 @@ +//! The command surface: every registered command id with the parameters it names, kept in +//! [`PATH`] so a removed or renamed command or parameter is a deliberate change in a pull request. +//! The command line, Python, the Assistant and MCP, saved scripts and plugins call commands by id +//! and by parameter key, and a change there breaks them without a compile error. +//! +//! The registry is checked against the file by `command_surface_matches_the_snapshot` (an engine +//! test, so it runs in `cargo xtask ci`); `cargo xtask commands` rewrites the file. + +use crate::{CommandSpec, param_list}; + +/// Where the snapshot is kept, from the repository's root. +pub const PATH: &str = "crates/engine/command-surface.txt"; + +/// The snapshot of `commands`: one line per command, sorted by id, `id key key? …`. A key ends in +/// `?` when it may be left out. The declared types are left out: they are prose (`power?: 2`, +/// `"name": the layer's name`), so rewording a description would change the file. Neither is the +/// help text. A command that takes no parameters, or describes them without keys, is its id alone. +pub fn text(commands: &[CommandSpec]) -> String { + let mut lines: Vec = commands.iter().map(line).collect(); + lines.sort(); + let mut out = lines.join("\n"); + out.push('\n'); + out +} + +/// One command's line of the snapshot. +fn line(c: &CommandSpec) -> String { + let mut line = c.id.to_string(); + for p in param_list(c.params).unwrap_or_default() { + line.push(' '); + line.push_str(p.key); + if p.optional { + line.push('?'); + } + } + line +} + +/// The differences between two snapshots, one message per command that was removed, added or +/// whose parameters changed (empty when they agree). +pub fn differences(saved: &str, current: &str) -> Vec { + let id = |line: &str| line.split(' ').next().unwrap_or("").to_string(); + let by_id = |text: &str| text.lines().map(|l| (id(l), l.to_string())).collect::>(); + let (saved, current) = (by_id(saved), by_id(current)); + let mut out = Vec::new(); + for (id, line) in &saved { + match current.get(id) { + None => out.push(format!("removed: {line}")), + Some(now) if now != line => out.push(format!("changed: was `{line}`, now `{now}`")), + Some(_) => {} + } + } + out.extend(current.iter().filter(|(id, _)| !saved.contains_key(*id)).map(|(_, line)| format!("added: {line}"))); + out +} + +#[cfg(test)] +mod tests { + use super::*; + + /// A removed, renamed or reshaped command or parameter fails here, so it is a decision in the + /// pull request that makes it: the command line, Python, MCP, saved scripts and plugins call + /// commands by id and key. An added command fails too, so the file never goes stale. + #[test] + fn command_surface_matches_the_snapshot() { + let diff = differences(include_str!("../command-surface.txt"), &text(&crate::cmd::all())); + assert!( + diff.is_empty(), + "the registered commands differ from {PATH}:\n{}\nIf that is intended, run `cargo xtask commands` and commit the file (a removal or rename \ + breaks scripts, the command line and plugins that call it)", + diff.join("\n") + ); + } + + /// The differences name what moved: a command gone, a key gone, a key made required and a command new. + #[test] + fn differences_name_each_change() { + let saved = "a.gone x\na.keep x y?\na.keys x y\na.required x y?\n"; + let now = "a.keep x y?\na.keys x\na.new\na.required x y\n"; + assert_eq!( + differences(saved, now), + [ + "removed: a.gone x", + "changed: was `a.keys x y`, now `a.keys x`", + "changed: was `a.required x y?`, now `a.required x y`", + "added: a.new" + ] + ); + assert!(differences(saved, saved).is_empty()); + } +} diff --git a/xtask/src/main.rs b/xtask/src/main.rs index a71f008c54..bfbd4b8874 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -1,4 +1,4 @@ -//! `cargo xtask ci | changed [--list] [base] | layers | memory [--cli ] [--update] | rows [--update] [--list] | test-hygiene | notices [--check] | schema [--check] | web-pwa ` +//! `cargo xtask ci | changed [--list] [base] | layers | memory [--cli ] [--update] | rows [--update] [--list] | commands | test-hygiene | notices [--check] | schema [--check] | web-pwa ` //! //! - `layers`: enforces the crate layering (nothing below L6 may depend on egui/eframe/rfd). //! - `memory [--cli ] [--update]`: the command line's peak memory on generated data, per @@ -6,6 +6,9 @@ //! (Linux; see `memory.rs`). //! - `rows [--update] [--list]`: direct uses of a layer's rows outside `rustgis-data`, which //! may not rise above the count in `xtask/row-uses.txt` (see `rows.rs`). +//! - `commands`: writes the snapshot of command ids and parameters +//! (`crates/engine/command-surface.txt`) from the registry; an engine test fails when the +//! committed file and the registry disagree. //! - `test-hygiene`: timer waits in tests need same-line reasons; ignored tests need reasons. //! - `ci`: test hygiene, fmt, clippy -D warnings, tests, layering, direct row uses and the //! project schema check. @@ -202,6 +205,14 @@ fn schema(check: bool) -> Result<(), String> { cargo(&args) } +/// Writes the command surface snapshot from the registry (`crates/engine/command-surface.txt`). +/// The engine's `command_surface_matches_the_snapshot` test, which `cargo xtask ci` runs, is the +/// check. +fn commands() -> Result<(), String> { + cargo(&["run", "-q", "--locked", "-p", "rustgis-engine", "--example", "command_surface"]) +} + +/// Runs the task named by the first argument (the list at the top of this file). fn main() -> ExitCode { let task = std::env::args().nth(1).unwrap_or_default(); let r = match task.as_str() { @@ -209,6 +220,7 @@ fn main() -> ExitCode { "test-hygiene" => test_hygiene::run(&root()), "rows" => rows::run(&root(), &std::env::args().skip(2).collect::>()), "memory" => memory::run(&root(), &std::env::args().skip(2).collect::>()), + "commands" => commands(), "ci" => ci(), "changed" => changed::run(&root(), &std::env::args().skip(2).collect::>()), "notices" => { @@ -234,7 +246,7 @@ fn main() -> ExitCode { Some(other) => Err(format!("unknown argument {other}: usage: cargo xtask schema [--check]")), }, "web-pwa" => web_pwa(std::env::args().nth(2)), - _ => Err("usage: cargo xtask ci | changed [--list] [base] | layers | memory [--cli ] [--update] | rows [--update] [--list] | test-hygiene | notices [--check] | schema [--check] | web-pwa ".into()), + _ => Err("usage: cargo xtask ci | changed [--list] [base] | layers | memory [--cli ] [--update] | rows [--update] [--list] | commands | test-hygiene | notices [--check] | schema [--check] | web-pwa ".into()), }; match r { Ok(()) => ExitCode::SUCCESS, From 5be711e094bc363fcbd48924569ebf81c3b0e397 Mon Sep 17 00:00:00 2001 From: mavrick Date: Sun, 22 Nov 2026 15:05:13 -0600 Subject: [PATCH 2/3] Record every key of an alternative in the command snapshot, and fail on a repeated id --- crates/engine/command-surface.txt | 60 +++++++++++++++---------------- crates/engine/src/surface.rs | 33 +++++++++++------ 2 files changed, 52 insertions(+), 41 deletions(-) diff --git a/crates/engine/command-surface.txt b/crates/engine/command-surface.txt index 90f6a2cf81..8508787267 100644 --- a/crates/engine/command-surface.txt +++ b/crates/engine/command-surface.txt @@ -41,7 +41,7 @@ connection.generateToken id tokenEndpoint password remember? connection.list kind? group? connection.login id password? apiKey? token? expiresAt? allowInsecure? accessKeyId? secretAccessKey? sessionToken? remember? connection.logout id -connection.new kind address? name? group? options? auth? user? keyName? +connection.new kind address? name? group? options? auth? arcgis user? keyName? connection.readSde path? data? connection.remove id connection.resolveS3 source id @@ -52,8 +52,8 @@ copernicus.logout copernicus.status cube.catalog theme? bbox? query? cube.open id bbox? start? end? maxCloud? range? name? -cube.reduce cube? variable? index? crs? asset? mask? bbox? maxCloud? cellSize? resampling? band? dates? stat order? above? classes? by? start? end? months? minValid? name? -cube.trend cube? url? asset? mask? bbox? maxCloud? cellSize? resampling? band? dates? start? end? months? test? seasons? alpha? minValid? per? name? ran? +cube.reduce cube? layers? layer? path? url? collection variable? index? crs? asset? mask? bbox? maxCloud? cellSize? resampling? band? dates? stat order? above? classes? by? start? end? months? minValid? name? +cube.trend cube? layers? layer? collection url? asset? mask? bbox? maxCloud? cellSize? resampling? band? dates? start? end? months? test? seasons? alpha? minValid? per? name? ran? data.archive layer? on? data.archiveHistory layer? data.archiveRestore layer? time @@ -203,7 +203,7 @@ labels.convert layer? name? labels.distanceRange layer? class? closest? farthest? clear? labels.enable layer? on? labels.field layer? class? field -labels.fonts search? +labels.fonts search? fonts indexing? labels.lock on? labels.move layer? class? feature to labels.pause on? @@ -223,7 +223,7 @@ layer.addPhotos paths? folder? name? layer.addSample name layer.addSql sql name? database? password? crs? stream? ran? layer.addUrl url bytes? format? name? layer? zoom? x? y? wkt? crs? delimiter? paperSpace? blocks? stream? as? whole? cog? bbox? cellSize? cube? start? end? unit? interval? dates? connection? service? bounds? from? fromDocument? anonymous? request? -layer.addZarr path variable? index? cells? crs? name? time? start? end? ran? summary? +layer.addZarr path url variable? index? cells? bbox? crs? name? time? start? end? ran? summary? layer.aggregation layer? shape size? layer.blend layer? mode layer.classStyle layer? value? index? other? color? outline? label? @@ -234,14 +234,14 @@ layer.copyPath layer? layer.defineProjection layer? crs layer.definitionQuery layer? where layer.diagram layer? kind fields size? startAngle? labels? background? outline? -layer.diagramInfo layer? +layer.diagramInfo layer? kind fields size startAngle? labels background? outline layer.displayFilters layer? filters layer.expand layer? on? layer.extrusion layer? type field? height? factor? layer.extrusionBase layer? field? base? layer.faces layer? culling? lighting? layer.fields layer? -layer.fillLayers layer? value? fills +layer.fillLayers layer? value? index? other? fills layer.geocode table? layer? address provider? url? name? places? layer.group layer? group before? layer.indent layer? @@ -280,7 +280,7 @@ layer.template template name? layer.transparency layer? value layer.visibility layer? visible? layer.zoomTo layer? -layout.activate name +layout.activate name layout layout.addElement layout? kind frame? of? text? size? color? bold? italic? align? letterSpacing? rotation? wrap? font? fallback? title? allClasses? hideOther? showNoData? exclude? columns? textSize? orientation? ticks? tickSide? reverse? fill? width? radius? dash? dir? head? angle? length? image? path? layer? field? label? group? statistic? order? bars? other? stack? values? decimals? barColor? classes? labelAlign? rows? step? type? crs? short? mgrs? labels? style? tickLength? format? hemisphere? edges? labelOrientation? labelSize? off? outline? units? divisions? x? y? w? h? background? layout.addFrame layout? shape? points? map? x? y? w? h? layout.arrange layout? element to @@ -312,20 +312,20 @@ map.body name? basemap? map.camera lon? lat? scale? map.clipping mode distance? map.colorVision mode -map.convertPosition lon lat position? digits? +map.convertPosition lon x lat y position? digits? map.displayType mode map.drawingMode mode map.duplicate map? name? map.effects sunTime? weather? vignette? edges? stars? tiltShift? grain? brightness? contrast? saturation? sepia? reset? -map.expandTiles name? on? +map.expandTiles name? index? id? on? map.exportBlock path texture? map.exportOrbit path frames? turn? width? height? dpi? speed? map.extent map.findPlace query provider? url? limit? go? map.goToLink url -map.goToXY lon lat position? scale? bearing? pitch? +map.goToXY lon x lat y position? scale? bearing? pitch? map.graticule on? type? crs? onTop? color? -map.import path +map.import path text data map.link map.navigation mode map.navigator on? @@ -336,22 +336,22 @@ map.popupMode mode map.prevExtent map.projection type? lon_0? lat_1? lat_2? map.projections -map.reloadTiles name +map.reloadTiles name index id map.reloadWebLayers map.remove name map.removeTiles name? index? id? map.rename name map? -map.repairTiles name? path +map.repairTiles name? index? id? path map.resetNorth map.route from to via? mode? avoid? imperial? language? url? addLayer? zoom? answer? route? map.save path map? map.search query limit? go? -map.selectTiles name? -map.setBearing bearing -map.setPitch pitch +map.selectTiles name? index? id? +map.setBearing bearing by +map.setPitch pitch by map.setScale scale -map.setTiles name? visible? opacity? blend? move? to? rename? bands? range? dequantize? legend? hiddenLayers? singleImage? tileSize? -map.terrain layer? encoding? exaggeration? block? water? off? +map.setTiles name? index? id? visible? opacity? blend? move? to? rename? bands? range? dequantize? legend? hiddenLayers? singleImage? tileSize? +map.terrain layer? tiles? encoding? exaggeration? block? water? off? map.thumbnail create? image? path? clear? map.tiles map.viewMode mode @@ -360,7 +360,7 @@ map.zoomFull map.zoomIn map.zoomOut map.zoomToExtent extent -map.zoomToTiles name? +map.zoomToTiles name? index? id? map.zoomWorld model.export name? graph? path? model.import path? text? data? @@ -438,7 +438,7 @@ project.exportLog path format? project.fromTemplate path? text? data? name? project.importGeolibre path? url? text? data? dir? project.importQgis path? text? data? dir? -project.log since? until? command? failed? limit? +project.log since? until? command? failed? limit? entries count total on project.logCommands on? project.new name? project.newTemplate path name? @@ -482,7 +482,7 @@ raster.setDefaultStyle fromLayer? layer? ramp? invert? stretch? low? high? n? re raster.spectral layer lon? lat? points? zone? raster.stretch layer? type low? high? n? min? max? like? raster.symbology layer? type band? ramp? invert? classes? method? azimuth? altitude? zFactor? shadow? sky? fill? ambient? balanced? rock? grey? -raster.zarrInfo path bbox? variable? +raster.zarrInfo path url bbox? variable? report.activate report report.attachments report? field report.autofill report? @@ -520,7 +520,7 @@ select.layerFromSelection layer? select.rows layer? rows mode? select.switch layer? select.zoomTo -service.add url type? layer name? time? text? documents? source_url? describe? tiles? bbox? where? connection? +service.add url type? layer name? time? text? documents? source_url? describe? tiles? bbox? full where? connection? service.coverage url type? layer text? documents? source_url? describe? bbox? connection? anonymous? service.group group? layer? name? expanded? visible? remove? service.groupPlan url? type? name? group? layer? sourceOnly? text? documents? connection? anonymous? @@ -557,12 +557,12 @@ sources.remove list kind address sources.save kind address name? extra? sql.query sql database? password? limit? sql.schema database password? -stac.addAsset item asset? name? connection? +stac.addAsset item url asset? name? connection? stac.addBands item combination? red? green? blue? bbox? cellSize? name? ran? stac.addCube url? collection asset bbox? start end maxCloud? range? name? attribution? connection? stac.addFootprints footprints name? stac.addIndex item index bbox? cellSize? name? ran? -stac.area path? layer? buffer? unit? +stac.area path? layer? buffer? unit? intersects positions ignored stac.collections url? connection? stac.search url? collections? bbox? intersects? layer? buffer? unit? datetime? limit? maxCloud? sortby? phase? properties? footprints? connection? style.add path? text? data? @@ -574,8 +574,8 @@ style.remove name style.save path table.close table.open layer? -table.remove table -table.statistics layer? field selected? +table.remove table at +table.statistics layer? field index selected? task.addStep task? title instructions? command params? task.editStep task? step title? instructions? task.import path? text? data? @@ -588,7 +588,7 @@ task.save task? path time.bind layer? field? start? end? unit? interval? show? time.export path width? height? speed? from? to? time.fields layer? -time.goTo date +time.goTo date step time.info time.set start? end? date? unit? interval? dates? show? before? after? cumulative? speed? loop? format? off? time.step by? wrap? @@ -597,5 +597,5 @@ tool.set tool topology.rules add? remove? clear? topology.validate toleranceM? view.linkViews on? -zarr.reduce layer? variable? index? stat above? start? end? months? minValid? name? crs? -zarr.series lon lat layer? variable? index? start? end? crs? +zarr.reduce layer? path url variable? index? stat above? start? end? months? minValid? name? crs? +zarr.series lon lat layer? path url variable? index? start? end? crs? diff --git a/crates/engine/src/surface.rs b/crates/engine/src/surface.rs index 6ff5e9dfa6..35fd729878 100644 --- a/crates/engine/src/surface.rs +++ b/crates/engine/src/surface.rs @@ -6,7 +6,7 @@ //! The registry is checked against the file by `command_surface_matches_the_snapshot` (an engine //! test, so it runs in `cargo xtask ci`); `cargo xtask commands` rewrites the file. -use crate::{CommandSpec, param_list}; +use crate::{CommandSpec, param_entries}; /// Where the snapshot is kept, from the repository's root. pub const PATH: &str = "crates/engine/command-surface.txt"; @@ -23,16 +23,17 @@ pub fn text(commands: &[CommandSpec]) -> String { out } -/// One command's line of the snapshot. +/// One command's line of the snapshot: every key the description names, as `param_keys` reads +/// them, so `"lon" | "x": degrees` records both. fn line(c: &CommandSpec) -> String { let mut line = c.id.to_string(); - for p in param_list(c.params).unwrap_or_default() { + param_entries(c.params, |key, optional| { line.push(' '); - line.push_str(p.key); - if p.optional { + line.push_str(key); + if optional { line.push('?'); } - } + }); line } @@ -63,15 +64,25 @@ mod tests { /// commands by id and key. An added command fails too, so the file never goes stale. #[test] fn command_surface_matches_the_snapshot() { - let diff = differences(include_str!("../command-surface.txt"), &text(&crate::cmd::all())); + let (saved, current) = (include_str!("../command-surface.txt"), text(&crate::cmd::all())); + let diff = differences(saved, ¤t); + // Equal ids and keys but another text: a repeated id, or lines out of order. assert!( - diff.is_empty(), - "the registered commands differ from {PATH}:\n{}\nIf that is intended, run `cargo xtask commands` and commit the file (a removal or rename \ - breaks scripts, the command line and plugins that call it)", - diff.join("\n") + saved == current, + "the registered commands differ from {PATH}:\n{}\nIf that is intended, run `cargo xtask commands` and commit the file (a removal or \ + rename breaks scripts, the command line and plugins that call it)", + if diff.is_empty() { "the same ids and keys, but a repeated id or another order".to_string() } else { diff.join("\n") } ); } + /// A key written as an alternative (`"lon" | "x": degrees`) is in the snapshot like any other. + #[test] + fn alternative_keys_are_recorded() { + let spec = + crate::CommandSpec::new("a.go", "Go", "", |_, _| Ok(Default::default())).params(r#"{"lon" | "x": degrees, "n"?: number}"#); + assert_eq!(line(&spec), "a.go lon x n?"); + } + /// The differences name what moved: a command gone, a key gone, a key made required and a command new. #[test] fn differences_name_each_change() { From 1e82479e8a21f547f536cb5dee9f1c9594f0f32d Mon Sep 17 00:00:00 2001 From: mavrick Date: Sun, 22 Nov 2026 17:18:25 -0600 Subject: [PATCH 3/3] AGENTS.md: restore the file and add the snapshot test's paragraph once; drop a stray doc comment --- AGENTS.md | 93 ----------------------------------------------- xtask/src/main.rs | 1 - 2 files changed, 94 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 4e8132df10..d20cb51a31 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -157,99 +157,6 @@ The engine test `command_surface_matches_the_snapshot` fails on any difference b commands and `crates/engine/command-surface.txt` (each command id with its parameter keys and optional marks, not the help text): a pull request that adds, removes or renames a command or a parameter runs `cargo xtask commands` and commits the file. A removal or rename is a coordinate-first change. -`cargo xtask memory` -measures. -- Memory follows what an operation changes or produces: an Undo step, a version, a sync base or a - cache holds only the changed rows or shares storage with the original. New work adds no second - full copy of a layer or raster; #2431 measured what one costs. -- Work that grows with its input goes in pieces (chunks, tiles, slices) that it doesn't keep, or - sizes its limit with `memory::planned` and refuses past it with a way out, such as filtering or - clipping first. Running out of memory partway counts as a crash. - -## Architecture -| Layer | Crate | Job | -|---|---|---| -| L0 | `geom` | coordinates, extents, projections, geodesic measurement | -| L1 | `data` | features and attributes, file formats, database providers (PostGIS and MySQL through pure-Rust clients, desktop only; GeoPackage in the browser through a pure-Rust `sqlite` reader), queries, rasters; GDAL and DuckDB through their programs | -| L2 | `map`, `analysis`, `tiles`, `keychain` | layers and symbology; geoprocessing tools; web map tiles; the system's secret store | -| L3 | `render`, `plugins`, `geolibre` | map rendering and export; WebAssembly plugins; the GeoLibre tool suite (its program natively, its WASI runner in the browser) | -| L4 | `engine` | `Session`, undo, the command registry, the sample project | -| L5 | `assistant` | the AI Assistant (sans I/O); file, network and plugin commands wait for approval | -| L6 | `ui-egui` | ribbon, panes, map view, attribute table, dialogs | -| L7 | `ui-touch` | the phone interface around `ui-egui`'s map view | -| apps | `rustgis`, `rustgis-cli`, `rustgis-web`, `rustgis-python`, `rustgis-mobile` | desktop, command line, browser, Python package, Android and iOS | - -- **Everything is a command**: a `CommandSpec` in `crates/engine/src/cmd/*.rs`. UI-only - commands (`ui.*`) live in `crates/ui-egui/src/lib.rs`. The ribbon, shortcuts, command search - and CLI dispatch by id. Commands never open dialogs. -- **`.view()` leaves the layers as they are**: a command that adds, removes or reorders layers - mutates, even when it fails part way. Declared `.view()`, it leaves no Undo step when it runs by - itself. Only Undo, Redo (`Effect::History`) and a project replaced (`Effect::Replaces`) may. - The engine's unit and integration tests fail a registered command declared wrong (the check in - `invoke`, `policy/dispatch.rs`, feature `declaration-check`), but only on the paths they run. -- **Command ingress**: root `Session::run` is trusted native User dispatch. Assistant, MCP, - plugin, imported-item and continuation adapters carry their named opaque policy scope; - scopes inherit or narrow, and `with_scope` rejects nested ingress. Peer project text uses - `open_peer_text`. See [embedding-page limitations](SECURITY.md#embedding-page-command-boundary) - when changing web message handlers. -- **Ribbon placement** follows the - [ribbon guidelines](docs/contributing.md#ribbon-guidelines): the tab's purpose, one button per - destination, labels that say what happens, and what a ribbon pull request states. -- **Never break wasm**: everything below `apps/` must build for `wasm32-unknown-unknown` - (CI runs `cargo build --target wasm32-unknown-unknown -p rustgis-web` with warnings as errors; - the Zstandard decoder in `rustgis-data` is C, so this needs clang). Use `web_time`, not - `std::time`; file access goes through `Services` on the web. In the browser, GeoLibre tools run - asynchronously (`external_start` → `Services::geolibre_run` → `gp.finish`), never as a blocking - call. Code only the desktop calls is - dead code in the browser build and fails it: put it behind `#[cfg(not(target_arch = "wasm32"))]` - and check as CI does, with - `RUSTFLAGS='-D warnings' cargo build --locked --target wasm32-unknown-unknown -p rustgis-web`. -- **Interface text is translatable**: wrap user-visible literals in `tl!("…")`, use - `i18n::fmt("… {name} …", &[("name", …)])` instead of `format!` for messages, and pass labels to - the ribbon widgets (they translate). Pull requests don't need to add the new strings to the - catalogs in `crates/ui-egui/src/i18n/*.tsv`: a missing entry shows in English, and the - maintainer translates them before each release (format in `docs/i18n.md`). Command ids, data - and the CLI are never translated. -- **Layering** is enforced by `cargo xtask layers`: nothing below L6 depends on egui/eframe/rfd. -- **The expression language has one vocabulary**: a new function, variable or keyword goes in - the catalogs in `crates/data/src/query.rs` (`Func::spec`, `VARS`, `Kw`), which the parser - reads, and in `docs/user-guide/expressions.md`; the `query` tests fail when the guide misses - a signature, unit, variable or keyword, or names a function that doesn't exist. -- **A parameter that takes an expression says so**: a command's key gives its type as `sql` or - `expression` in its params (`"where": sql`, `"size"?: expression|null`), and a tool's - parameter is `ParamKind::Expression`, so it can be told from plain text. Another language (a - database's, a service's) is described in quoted prose instead. - -## Reach every surface -A change that works where you tried it is often missing elsewhere. Before calling it done, say in -the pull request which of these it reaches and why the rest don't apply: -- the desktop app, the browser (file access through `Services`), the command line, Python, the - phone (the touch interface, `ui-touch`); -- the ribbon, shortcuts and command search; the Assistant and MCP (do their tool descriptions - show the new option?); plugins; -- the way back: what you add can be undone, removed or reopened. - -## Assets -- No third-party vendor icons, images, styles, fonts, help text or code. Icons are drawn in - code (`icons.rs`). Every asset file has a row in `ATTRIBUTION.md`. -- Never copy or translate code from GPL, LGPL or other copyleft projects (such as GRASS, QGIS or - GEOS) into RustGIS, by hand or with an AI tool. Implementing a published algorithm is fine: cite - the paper or standard. Name in the pull request any project whose code you followed (see - [CONTRIBUTING.md](CONTRIBUTING.md#where-code-comes-from)). -- Screenshots and other images are not committed here: they live in - [opengeos/rustgis-assets](https://github.com/opengeos/rustgis-assets) (WebP, served at - `https://assets.rustgis.app/images/…`) and docs link to them by URL. - -## Quality gates -`cargo xtask ci` (fmt, clippy -D warnings, tests, layers) before every commit. -`cargo xtask test-hygiene` (also in CI) requires `// test-wait: reason` on timer waits in tests and -`#[ignore = "reason"]` on ignored tests, and refuses an `assert_eq!` or `assert_ne!` (or `debug_assert_*`) -whose two sides are the same tokens; prefer completion or progress signals, and a fixed expected value. -The engine test `command_surface_matches_the_snapshot` fails on any difference between the registered -commands and `crates/engine/command-surface.txt` (each command id with its parameter keys and optional -marks, not the help text): a pull request that adds, removes or renames a command -or a parameter runs `cargo xtask commands` and commits the file. A removal or rename is a -coordinate-first change. `cargo xtask memory` (in CI on Linux) fails when a command line workflow's peak memory grows past its limit in `xtask/memory-limits.txt`; a change that lowers one commits the lower limit with it. `cargo xtask rows` (also in CI) fails when code outside `rustgis-data` uses a layer's rows directly diff --git a/xtask/src/main.rs b/xtask/src/main.rs index bfbd4b8874..c0dd063eee 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -212,7 +212,6 @@ fn commands() -> Result<(), String> { cargo(&["run", "-q", "--locked", "-p", "rustgis-engine", "--example", "command_surface"]) } -/// Runs the task named by the first argument (the list at the top of this file). fn main() -> ExitCode { let task = std::env::args().nth(1).unwrap_or_default(); let r = match task.as_str() {