For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Pipe series (sizes with outside/inside diameters and walls, plus the fittings sold for them with their dimensions) live in the project. A built-in catalog of 22 series (Brazil, Europe, US) and series files can be imported. Pipe types point to a series row, the templates use series, older files are linked on load (format 29), and sizing uses real inside diameters within the run’s series.
Spec: docs/superpowers/specs/2026-11-16-pipe-catalog-design.md (this plan covers its “Plan shape” item 1; fittings matching, IFC and the app are stages 2 and 3).
Data: already in the worktree. crates/cc_core/assets/pipes/*.json is 22 series in file format 1 (mm), and assets/pipes/notes/{br,eu,us}.md holds the research notes. The data is not edited by this plan except to fix what the validation test finds; any fix is recorded in the notes.
D:\constructcad-pipes (branch feat/pipe-catalog, from origin/main at 1300ebe5). Never touch D:\constructcad or other worktrees.gh, never merge.git commit -s, with no Claude attribution and no Co-Authored-By.unwrap, expect, panic!, unreachable!, todo! or unimplemented!, and no unsafe. Files are hostile input, so reading is bounded and errors are values.assets/i18n/*.ftl files (pt-BR is the reference).crates/cc_engine/src/registry.rs.cargo run -q -p cc_cli -- reference > docs/commands.md.crates/cc_engine/tests/ needs mod x; in tests/main.rs.cargo nextest run -p <crate> <filter>, with --test main for integration tests.cargo check --tests -p <crate>.cargo fmt --all (max_width 120).cargo clippy --workspace --all-targets -- -D warnings.PipeSeries. File values are millimeters, converted on read and write.cc_core::pipe_series:
PipeSeries, PipeSize, CatalogFitting, FittingRowKind (Elbow, Tee, Wye, Cross, Coupling, Reducer), PipeMaterial, PipeUse, PipeJoint, SeriesSource;PipeSeriesId (id_type!(PipeSeriesId, "PS") in ids.rs);Project::pipe_series: BTreeMap<PipeSeriesId, PipeSeries> (serde default, skip_serializing_if empty);EditCtx::pipe_series_mut.cc_core::pipe_file: SeriesFile (the serde form, mm), read_series(text) -> Result<PipeSeries, PipeFileError>, write_series(&PipeSeries) -> String, FILE_FORMAT = 1.cc_core::pipe_catalog:
BuiltIn { code, name_key, region: Region (Brazil, Europe, Us), file }, BUILT_IN: &[BuiltIn];series(code) -> Option<&'static PipeSeries> (parsed once, OnceLock), all() -> &'static [(…)].cc_engine::commands::pipes: PipeCatalog, PipeSeriesList, PipeSeriesGet, PipeSeriesImport, PipeSeriesExport, PipeSeriesDelete, PipeTypeCreate.PipeSeries { id, uid: Uid, code, name, short, standard, material, use_: PipeUse (serde rename "use"), joint, pressure: String, sources: Vec<SeriesSource>, pipes: Vec<PipeSize>, fittings: Vec<CatalogFitting> }.PipeSize { size: String, de, e, di }.CatalogFitting { kind, angle: Option<f64>, size, size2: Option<String>, socket, socket2, z, z2, z3, od: Option<f64>, derived: String }.PipeSeries::row(size) -> Option<&PipeSize>.| constant | value |
|---|---|
MAX_SERIES |
200 |
MAX_SIZES |
100 |
MAX_FITTINGS |
2000 |
MAX_TEXT |
200 chars |
MAX_SOURCES |
50 |
MAX_FILE_BYTES |
2 MB |
de |
1 mm to 2 m, and 0 < e < de/2 |
| fitting lengths | 0 to 2 m |
| angles | 1–180 |
di must be within 1 mm of de − 2e (the reader refuses otherwise); the built-in test is tighter, 0.15 mm.TypeData::Pipe gains:
#[serde(default, skip_serializing_if = "Option::is_none")] series: Option<PipeSeriesId>#[serde(default, skip_serializing_if = "String::is_empty")] size: String#[serde(default, skip_serializing_if = "Option::is_none")] inside: Option<f64>Two methods read it:
Project::pipe_row(&TypeData) -> Option<(&PipeSeries, &PipeSize)>.ElementType::inside_diameter(&Project) -> Option<f64>: the row’s di, else inside, else None. Sizing then falls back to its table.EditCtx::finish → sync_pipe_series runs first, before sync_profiles. It runs when settings changed or a pipe type changed:
diameter = de (written only when it differs);diameter and drops series and size;series and size.repair_pipe_series (in Project::repair):
-2;diameter from the rows.pipe-series-<code lowercased>, for example pipe-series-br-pvc-sold.name, translated. Translate the generic words, keep the standard codes.pipe_series_import:
code (built-in), path or text.on_clash (default skip), when a series with the same code exists:
skip keeps the project’s series;replace overwrites its rows while keeping its id and uid, so the types re-sync;rename imports it with the code suffixed.sizes: absent means no types; ["all"] or a list of labels means types too."{name} {size}"; an existing type of that name is reused and linked, not duplicated.{series: id, created: [type ids], linked: [type ids]}.20 mm, 25 mm, 32 mm;DN 40, DN 50, DN 75, DN 100.1/2", 3/4", 1"; US-PVC-DWV 1-1/2", 2", 3", 4".tpl-* keys. The cached diameter becomes the row’s de, for example DN 100 → 101.6 mm and 1/2” → 21.34 mm. Tests pinned to the old diameters are updated, with the reason noted in the commit.template_spec. The pipe tuples gain the series code and size label. The (key, diameter) pairs stay, for the projects that predate building services (project.rs:653).template_spec tests. The tests that scan imperial sizes for round numbers skip pipe types of a series: their sizes are the standard’s, not rounded.FORMAT_VERSION = 29. On load of a file before 29:
translate, the same one used for title blocks), for either system;cc_geom::sizing)inside(outside) becomes inside_of(project, type): the type’s inside_diameter, else the table, else ×0.88.required is the de of the smallest row of the run’s series whose di keeps speed ≤ MAX_SPEED (else the largest row). Runs with no series keep the WATER_PIPES table.de ≥ DN − 2 mm.PipeSizing gains size: Option<String>, the row’s label.mep_size_applyFor a run of a series:
"{name} {size}" in the same undo step;created.Runs without a series keep pipe_type_for, restricted to types without a series.
pipe_catalog:
series: {series: [{code, name (translated), region, material, use, joint, pressure, standard, sizes, fittings}]};series: also pipes (mm) and fittings (mm).pipe_series_list: the project’s series.pipe_series_get: one, by id, code or name, in the file form plus id and types (type ids using it).pipe_series_export: series plus path writes the file; with no path, returns text.pipe_series_delete: series, detach (bool). Refused with in_use while types use it, unless detach.pipe_type_create:
series (project series, else built-in code), size, optional name, material;{id, series}.type_set on a pipe type:
series takes a code or name, null to detach, resolved before the merge;size is checked against the series (unknown_size).element_get/type_get of a pipe type: derived gains inside_diameter, wall, series_code and size.pipe-series-<code> for the 22 built-in codes:
pipe-region-brazil, pipe-region-europe, pipe-region-us.tx-pipe-series-import, tx-pipe-series-delete, tx-pipe-type-create.Check before adding error messages: if the engine’s existing error messages are English literals rather than keys, follow that.
Files:
crates/cc_core/src/pipe_series.rs, pipe_file.rs, pipe_catalog.rs;lib.rs, ids.rs, project.rs (field), document.rs (pipe_series_mut);Cargo.toml (add serde_json as a workspace dependency if it is not in cc_core);the spec, this plan and assets/pipes/** committed.
PipeSeries::check() -> Result<(), PipeFileError> is shared by the reader and repair.pipe_file:
read_series refuses format != 1, too large, unknown enums and bad numbers, giving errors with a row index;write_series writes the same JSON style as the assets (one row per line).pipe_catalog: the 22 include_str! entries, OnceLock<Vec<PipeSeries>>, skipping (and in debug, test-failing) a file that does not read.|di − (de − 2e)| ≤ 0.15 mm;de NaN as a string, an unknown kind, size2 missing, e ≥ de/2 are each refused with the right row.assets/pipes/notes/*.md.Files: types.rs (TypeData::Pipe), project.rs (template, pipe_row), template_spec.rs, document.rs (sync_pipe_series in finish), repair.rs, persist.rs, new pipe_series_project.rs (the impl Project helpers and tests).
pipe_row, inside_diameter. Update the two TypeData::Pipe { diameter, material } constructors.sync_pipe_series and repair_pipe_series as decided.
de in one edit changes its types’ diameter in the same transaction, and undo restores both; a deleted series detaches its types; repair drops dangling rows and references.de; imperial template checks still pass with the decided exemption.25 mm, the second is free, and the series is copied once.cargo nextest run -p cc_core and fix fallout across the workspace (cargo check --tests --workspace), including tests pinned to old diameters.mep_size_apply)sizing.rs as decided, PipeSizing::size.
di 57.0 (no 0.88 fallback). For a flow where the BR table would choose 60 mm, an EU series run chooses d63. Drain DN 100 (de 101.6) satisfies 100.mep_size_apply keeps the series and creates a missing type, in one step with created.
crates/cc_engine/tests/pipes.rs.Files: new crates/cc_engine/src/commands/pipes.rs, commands/mod.rs, registry.rs, commands/types.rs (type_set series and size; derived), refs.rs (pipe_series by id, code or name), i18n, docs/commands.md.
tests/pipes.rs:
sizes: ["all"] creates the types, and a second import with skip creates nothing;replace keeps ids;text (a written series round trip) and from a bad text gives an error with no undo step;rename;detach keeps the types;pipe_type_create from a built-in code imports the series once;type_set series/size resizes, and an unknown size is refused;mep_sizing shows size.docs/commands.md. Add the i18n keys in all 12 languages.AGENTS.md: a “Pipe series” bullet next to MEP (model, file format, catalog, sync, format 29, sizing, commands). docs/automation.md and docs/automacao.md: a short section with an import example.cargo fmt --all, clippy, cargo nextest run --workspace, cargo test --workspace --doc. All green.FittingKind::Wye, matching, fitting geometry, cut lengths, mep_fittings names, schedules and IFC.