Skip to content

Commit 28c4f91

Browse files
afflomclaude
andcommitted
ADR-060 cleanup: remove refactor leftovers flagged by pre-release review
- codegen: drop the now-dead per-category input-type column from the three resolver-emission tables (resolver_traits / null_resolvers / absent_impls) and the two `let _ = input_ty;` silencers — ADR-060 made every resolver's resolve() uniformly TermValue<'a, INLINE_BYTES> in/out. - codegen: fix the self-referential per-ψ-stage carrier-fn doc (now names the stage, e.g. "Nerve (ψ_1)") and refresh the crate-level run example (drop DefaultHostBounds; show the INLINE_BYTES turbofish) + a stale internal comment + witness-scaffold doc string. - smoke.rs: remove the obsolete 16 MB-stack ψ-chain workaround (frames are now INLINE_BYTES-sized, not 4096) and the dead &[u8] append_marker. - behavior_catamorphism_evaluator: refresh stale TERM_VALUE_MAX_BYTES pin. - scaling test: wrap the two const-valued asserts in const { } blocks. - endpoint_coverage: drop the redundant route_output_payload mapping that reused the already-exempt GroundingProgramRun symbol. All gates green: fmt, clippy --all-targets -D warnings, workspace tests, conformance 546/0, foundation publish dry-run, regen + lean stable. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 5a0fa0a commit 28c4f91

9 files changed

Lines changed: 99 additions & 122 deletions

File tree

codegen/src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -921,8 +921,8 @@ fn generate_lib_rs(ontology: &Ontology) -> String {
921921
// carry `<const FP_MAX: usize>` / `<const TR_MAX: usize>` parameters.
922922
// Applications selecting a different `HostBounds` impl populate each
923923
// parameter with `<MyBounds as HostBounds>::CONST` at instantiation sites.
924-
// Type-level defaults (`Hasher<const FP_MAX: usize = 32>`, etc.) match
925-
// `DefaultHostBounds` so callers using the canonical defaults never write
924+
// Type-level defaults (`Hasher<const FP_MAX: usize = 32>`, etc.) carry the
925+
// conventional 32-byte width so callers using those defaults never write
926926
// turbofish. The wiki's example syntax `[u8; H::FINGERPRINT_MAX_BYTES]`
927927
// requires nightly `generic_const_exprs`, which the stable workspace does
928928
// not enable.
@@ -1218,10 +1218,13 @@ impl Hasher for Blake3Hasher {{
12181218
fn initial() -> Self {{ /* ... */ }}
12191219
fn fold_byte(self, b: u8) -> Self {{ /* ... */ }}
12201220
fn fold_bytes(self, bytes: &[u8]) -> Self {{ /* ... */ }}
1221-
fn finalize(self) -> [u8; 32] {{ /* `<DefaultHostBounds>::FINGERPRINT_MAX_BYTES` */ }}
1221+
fn finalize(self) -> [u8; 32] {{ /* width = your `HostBounds::FINGERPRINT_MAX_BYTES` */ }}
12221222
}}
12231223
1224-
let grounded = run::<MyShape, _, Blake3Hasher>(validated_unit)?;
1224+
// ADR-060: `run` carries the `const INLINE_BYTES` carrier width as its final
1225+
// generic; instantiate it from your `HostBounds` via
1226+
// `pipeline::carrier_inline_bytes::<MyBounds>()`.
1227+
let grounded = run::<MyShape, _, Blake3Hasher, INLINE_BYTES>(validated_unit)?;
12251228
```
12261229
12271230
The recommended production substrate is BLAKE3: fast, cryptographically

codegen/src/pipeline.rs

Lines changed: 32 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2794,52 +2794,45 @@ fn emit_resolver_tuple(f: &mut RustFile) {
27942794

27952795
// Eight resolver category traits. Per the user's directive, generic
27962796
// over <H> (no Hasher bound) — the seal is the gate.
2797-
// ADR-041: each resolver after ψ_1 takes the prior ψ-stage's typed
2798-
// carrier as input; `NerveResolver` retains `&[u8]` input because
2799-
// its source is the per-value bytes (not a ψ-stage emission).
2800-
let resolver_traits: &[(&str, &str, &str)] = &[
2797+
// ADR-060: every resolver's `resolve` uniformly takes and returns
2798+
// `TermValue<'a, INLINE_BYTES>` (the prior ψ-stage's emission flows in as a
2799+
// `TermValue`); the per-category typed-input newtypes of ADR-041 are no
2800+
// longer part of the signature.
2801+
let resolver_traits: &[(&str, &str)] = &[
28012802
(
28022803
"NerveResolver",
28032804
"ψ_1 — per-value bytes → SimplicialComplex per ADR-035.",
2804-
"&[u8]",
28052805
),
28062806
(
28072807
"ChainComplexResolver",
28082808
"ψ_2 — SimplicialComplex → ChainComplex per ADR-035.",
2809-
"SimplicialComplexBytes<'_>",
28102809
),
28112810
(
28122811
"HomologyGroupResolver",
28132812
"ψ_3 — ChainComplex → HomologyGroups per ADR-035.",
2814-
"ChainComplexBytes<'_>",
28152813
),
28162814
(
28172815
"CochainComplexResolver",
28182816
"ψ_5 — ChainComplex → CochainComplex per ADR-035.",
2819-
"ChainComplexBytes<'_>",
28202817
),
28212818
(
28222819
"CohomologyGroupResolver",
28232820
"ψ_6 — CochainComplex → CohomologyGroups per ADR-035.",
2824-
"CochainComplexBytes<'_>",
28252821
),
28262822
(
28272823
"PostnikovResolver",
28282824
"ψ_7 — SimplicialComplex → PostnikovTower per ADR-035.",
2829-
"SimplicialComplexBytes<'_>",
28302825
),
28312826
(
28322827
"HomotopyGroupResolver",
28332828
"ψ_8 — PostnikovTower → HomotopyGroups per ADR-035.",
2834-
"PostnikovTowerBytes<'_>",
28352829
),
28362830
(
28372831
"KInvariantResolver",
28382832
"ψ_9 — HomotopyGroups → KInvariants per ADR-035.",
2839-
"HomotopyGroupsBytes<'_>",
28402833
),
28412834
];
2842-
for (trait_name, doc, _input_ty) in resolver_traits {
2835+
for (trait_name, doc) in resolver_traits {
28432836
f.doc_comment(&format!("ADR-036 resolver trait: {doc}"));
28442837
f.line("///");
28452838
f.doc_comment("Parameterized by the model's H-axis (`H: Hasher` per ADR-022 D5) so");
@@ -2953,56 +2946,40 @@ fn emit_resolver_tuple(f: &mut RustFile) {
29532946
f.line("}");
29542947
f.blank();
29552948

2956-
// Eight Null<Category>Resolver impls. Each per-category null impl
2957-
// takes the ADR-041 typed-coordinate carrier for its resolver-trait
2958-
// input. NerveResolver retains `&[u8]` (per-value bytes); the other
2959-
// seven take their typed predecessor-stage carrier.
2960-
let null_resolvers: &[(&str, &str, &str, &str)] = &[
2961-
("NullNerveResolver", "NerveResolver", "Nerve", "&[u8]"),
2949+
// Eight Null<Category>Resolver impls. ADR-060: every `resolve` uniformly
2950+
// takes/returns `TermValue<'a, INLINE_BYTES>`, so the per-category typed
2951+
// input is no longer carried here.
2952+
let null_resolvers: &[(&str, &str, &str)] = &[
2953+
("NullNerveResolver", "NerveResolver", "Nerve"),
29622954
(
29632955
"NullChainComplexResolver",
29642956
"ChainComplexResolver",
29652957
"ChainComplex",
2966-
"SimplicialComplexBytes<'_>",
29672958
),
29682959
(
29692960
"NullHomologyGroupResolver",
29702961
"HomologyGroupResolver",
29712962
"HomologyGroup",
2972-
"ChainComplexBytes<'_>",
29732963
),
29742964
(
29752965
"NullCochainComplexResolver",
29762966
"CochainComplexResolver",
29772967
"CochainComplex",
2978-
"ChainComplexBytes<'_>",
29792968
),
29802969
(
29812970
"NullCohomologyGroupResolver",
29822971
"CohomologyGroupResolver",
29832972
"CohomologyGroup",
2984-
"CochainComplexBytes<'_>",
2985-
),
2986-
(
2987-
"NullPostnikovResolver",
2988-
"PostnikovResolver",
2989-
"Postnikov",
2990-
"SimplicialComplexBytes<'_>",
29912973
),
2974+
("NullPostnikovResolver", "PostnikovResolver", "Postnikov"),
29922975
(
29932976
"NullHomotopyGroupResolver",
29942977
"HomotopyGroupResolver",
29952978
"HomotopyGroup",
2996-
"PostnikovTowerBytes<'_>",
2997-
),
2998-
(
2999-
"NullKInvariantResolver",
3000-
"KInvariantResolver",
3001-
"KInvariant",
3002-
"HomotopyGroupsBytes<'_>",
30032979
),
2980+
("NullKInvariantResolver", "KInvariantResolver", "KInvariant"),
30042981
];
3005-
for (null_ty, resolver_trait, category, input_ty) in null_resolvers {
2982+
for (null_ty, resolver_trait, category) in null_resolvers {
30062983
f.doc_comment(&format!(
30072984
"ADR-036 Null `{resolver_trait}` impl. `resolve` always emits the"
30082985
));
@@ -3028,7 +3005,6 @@ fn emit_resolver_tuple(f: &mut RustFile) {
30283005
"impl<H: crate::enforcement::Hasher> __sdk_seal::Sealed for {null_ty}<H> {{}}"
30293006
));
30303007
f.blank();
3031-
let _ = input_ty;
30323008
f.line(&format!(
30333009
"impl<const INLINE_BYTES: usize, H: crate::enforcement::Hasher> {resolver_trait}<INLINE_BYTES, H> for {null_ty}<H> {{"
30343010
));
@@ -3063,67 +3039,60 @@ fn emit_resolver_tuple(f: &mut RustFile) {
30633039
// reasons" commitment: applications can default to NullResolverTuple in
30643040
// tests/smoke contexts and recover RESOLVER_ABSENT at runtime via
30653041
// `Term::Try`.
3066-
// Each tuple element: resolver_trait, marker, accessor, category,
3067-
// input_type (per ADR-041 typed-coordinate carrier).
3068-
let absent_impls: &[(&str, &str, &str, &str, &str)] = &[
3042+
// Each tuple element: resolver_trait, marker, accessor, category.
3043+
// ADR-060: every `resolve` uniformly takes/returns
3044+
// `TermValue<'a, INLINE_BYTES>`, so no per-category input type is carried.
3045+
let absent_impls: &[(&str, &str, &str, &str)] = &[
30693046
(
30703047
"NerveResolver",
30713048
"HasNerveResolver",
30723049
"nerve_resolver",
30733050
"Nerve",
3074-
"&[u8]",
30753051
),
30763052
(
30773053
"ChainComplexResolver",
30783054
"HasChainComplexResolver",
30793055
"chain_complex_resolver",
30803056
"ChainComplex",
3081-
"SimplicialComplexBytes<'_>",
30823057
),
30833058
(
30843059
"HomologyGroupResolver",
30853060
"HasHomologyGroupResolver",
30863061
"homology_group_resolver",
30873062
"HomologyGroup",
3088-
"ChainComplexBytes<'_>",
30893063
),
30903064
(
30913065
"CochainComplexResolver",
30923066
"HasCochainComplexResolver",
30933067
"cochain_complex_resolver",
30943068
"CochainComplex",
3095-
"ChainComplexBytes<'_>",
30963069
),
30973070
(
30983071
"CohomologyGroupResolver",
30993072
"HasCohomologyGroupResolver",
31003073
"cohomology_group_resolver",
31013074
"CohomologyGroup",
3102-
"CochainComplexBytes<'_>",
31033075
),
31043076
(
31053077
"PostnikovResolver",
31063078
"HasPostnikovResolver",
31073079
"postnikov_resolver",
31083080
"Postnikov",
3109-
"SimplicialComplexBytes<'_>",
31103081
),
31113082
(
31123083
"HomotopyGroupResolver",
31133084
"HasHomotopyGroupResolver",
31143085
"homotopy_group_resolver",
31153086
"HomotopyGroup",
3116-
"PostnikovTowerBytes<'_>",
31173087
),
31183088
(
31193089
"KInvariantResolver",
31203090
"HasKInvariantResolver",
31213091
"k_invariant_resolver",
31223092
"KInvariant",
3123-
"HomotopyGroupsBytes<'_>",
31243093
),
31253094
];
3126-
for (resolver_trait, marker, accessor, category, input_ty) in absent_impls {
3095+
for (resolver_trait, marker, accessor, category) in absent_impls {
31273096
f.doc_comment(&format!(
31283097
"ADR-036: NullResolverTuple satisfies `{resolver_trait}<H>` directly so"
31293098
));
@@ -3132,7 +3101,6 @@ fn emit_resolver_tuple(f: &mut RustFile) {
31323101
));
31333102
f.doc_comment("The `resolve` method emits the `RESOLVER_ABSENT` shape violation —");
31343103
f.doc_comment("recoverable via `Term::Try`'s default-propagation handler (ADR-022 D3 G9).");
3135-
let _ = input_ty;
31363104
f.line(&format!(
31373105
"impl<const INLINE_BYTES: usize, H: crate::enforcement::Hasher> {resolver_trait}<INLINE_BYTES, H> for NullResolverTuple {{"
31383106
));
@@ -4705,44 +4673,54 @@ fn emit_prism_model(f: &mut RustFile) {
47054673
// resolver-owned scratch (the `Borrowed` carrier's backing). Each width is
47064674
// an application-declared structural count × a foundation-fixed per-element
47074675
// wire width — never a contrived literal.
4708-
let psi_stage_carriers: &[(&str, &str)] = &[
4676+
let psi_stage_carriers: &[(&str, &str, &str)] = &[
47094677
(
47104678
"nerve_carrier_bytes",
4679+
"Nerve (ψ_1)",
47114680
"PSI_STAGE_HEADER_BYTES + B::NERVE_SITES_MAX * SITE_DESCRIPTOR_BYTES + B::NERVE_CONSTRAINTS_MAX * CONSTRAINT_DESCRIPTOR_BYTES",
47124681
),
47134682
(
47144683
"chain_complex_carrier_bytes",
4684+
"ChainComplex (ψ_2)",
47154685
"PSI_STAGE_HEADER_BYTES + B::BETTI_DIMENSION_MAX * (SITE_DESCRIPTOR_BYTES + BETTI_ELEMENT_BYTES)",
47164686
),
47174687
(
47184688
"homology_groups_carrier_bytes",
4689+
"HomologyGroups (ψ_3)",
47194690
"PSI_STAGE_HEADER_BYTES + B::BETTI_DIMENSION_MAX * BETTI_ELEMENT_BYTES",
47204691
),
47214692
(
47224693
"cochain_complex_carrier_bytes",
4694+
"CochainComplex (ψ_5)",
47234695
"PSI_STAGE_HEADER_BYTES + B::BETTI_DIMENSION_MAX * (SITE_DESCRIPTOR_BYTES + BETTI_ELEMENT_BYTES)",
47244696
),
47254697
(
47264698
"cohomology_groups_carrier_bytes",
4699+
"CohomologyGroups (ψ_6)",
47274700
"PSI_STAGE_HEADER_BYTES + B::BETTI_DIMENSION_MAX * BETTI_ELEMENT_BYTES",
47284701
),
47294702
(
47304703
"postnikov_tower_carrier_bytes",
4704+
"PostnikovTower (ψ_7)",
47314705
"PSI_STAGE_HEADER_BYTES + B::BETTI_DIMENSION_MAX * (SITE_DESCRIPTOR_BYTES + BETTI_ELEMENT_BYTES)",
47324706
),
47334707
(
47344708
"homotopy_groups_carrier_bytes",
4709+
"HomotopyGroups (ψ_8)",
47354710
"PSI_STAGE_HEADER_BYTES + B::BETTI_DIMENSION_MAX * BETTI_ELEMENT_BYTES",
47364711
),
47374712
(
47384713
"k_invariants_carrier_bytes",
4714+
"KInvariants (ψ_9)",
47394715
"carrier_inline_bytes::<B>()",
47404716
),
47414717
];
4742-
for (fn_name, body) in psi_stage_carriers {
4718+
for (fn_name, stage, body) in psi_stage_carriers {
47434719
f.doc_comment(&format!(
4744-
"ADR-060: app-facing carrier-width helper for the ψ-stage backing `{fn_name}`."
4720+
"ADR-060: app-facing carrier-width helper for the {stage} ψ-stage. An"
47454721
));
4722+
f.doc_comment("application's resolver impl uses it to size its resolver-owned scratch");
4723+
f.doc_comment("(the `Borrowed` carrier's backing) for this stage.");
47464724
f.doc_comment("Structural-element-count × foundation-fixed per-element wire width.");
47474725
f.line("#[must_use]");
47484726
f.line(&format!(

codegen/src/witness_scaffolds.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -684,9 +684,8 @@ pub fn generate_primitives_modules(ontology: &Ontology) -> Vec<(String, String)>
684684
/// `no_std` + `const`-friendly and avoids the host-supplied\n\
685685
/// `Hasher` dependency that the production mint paths use.\n\
686686
///\n\
687-
/// Buffer width is 32 — the `<DefaultHostBounds as HostBounds>`\n\
688-
/// `FINGERPRINT_MAX_BYTES` value, matching `ContentFingerprint`'s\n\
689-
/// default const-generic.\n\
687+
/// Buffer width is 32 — the conventional `FINGERPRINT_MAX_BYTES`\n\
688+
/// value, matching `ContentFingerprint`'s default const-generic.\n\
690689
fn fingerprint_for_identity(iri: &str) -> ContentFingerprint {\n\
691690
\x20 let mut buf = [0u8; 32];\n\
692691
\x20 let bytes = iri.as_bytes();\n\

conformance/endpoint_coverage.toml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -486,14 +486,12 @@ behavior = "behavior_catamorphism_evaluator"
486486
# ADR-028 commits the Grounded<T> to carry the catamorphism's evaluation
487487
# result as an output payload alongside the metadata fingerprint. ADR-060
488488
# replaced the fixed `ROUTE_OUTPUT_BUFFER_BYTES` ceiling with the
489-
# source-polymorphic `TermValue<'a, INLINE_BYTES>` carrier whose inline
490-
# width is derived by `carrier_inline_bytes::<B>()` (collapsed to the
491-
# `const fn` symbol in the snapshot). The output payload now rides the
492-
# `Grounded` carrier directly. The behavior test is exercised via the
493-
# `Grounded` / `const fn` mappings above.
494-
[coverage.route_output_payload]
495-
symbols = ["GroundingProgramRun"]
496-
behavior = "behavior_route_output_payload"
489+
# source-polymorphic `TermValue<'a, INLINE_BYTES>` carrier whose inline width
490+
# is derived by `carrier_inline_bytes::<B>()` (the `const fn` snapshot symbol).
491+
# No coverage entry is needed here: the `behavior_route_output_payload` test's
492+
# surface is `Grounded` (covered below) and `carrier_inline_bytes` (the
493+
# `const fn` symbol), both already mapped — adding a stale/duplicate symbol
494+
# here would be the inconsistency this audit guards against.
497495

498496
# ─── Mapping: closure-body grammar fold-unroll (wiki ADR-026 G14) ──────
499497
# ADR-026 G14 specifies the `fold_n` lowering rule: counts at or below

foundation/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,13 @@ impl Hasher for Blake3Hasher {
163163
fn initial() -> Self { /* ... */ }
164164
fn fold_byte(self, b: u8) -> Self { /* ... */ }
165165
fn fold_bytes(self, bytes: &[u8]) -> Self { /* ... */ }
166-
fn finalize(self) -> [u8; 32] { /* `<DefaultHostBounds>::FINGERPRINT_MAX_BYTES` */ }
166+
fn finalize(self) -> [u8; 32] { /* width = your `HostBounds::FINGERPRINT_MAX_BYTES` */ }
167167
}
168168
169-
let grounded = run::<MyShape, _, Blake3Hasher>(validated_unit)?;
169+
// ADR-060: `run` carries the `const INLINE_BYTES` carrier width as its final
170+
// generic; instantiate it from your `HostBounds` via
171+
// `pipeline::carrier_inline_bytes::<MyBounds>()`.
172+
let grounded = run::<MyShape, _, Blake3Hasher, INLINE_BYTES>(validated_unit)?;
170173
```
171174

172175
The recommended production substrate is BLAKE3: fast, cryptographically

0 commit comments

Comments
 (0)