@@ -197,7 +197,7 @@ export function collectManifestObjectNames(manifest: any): string[] {
197197 * Stable sort by `order` (unset reads as `0`), by reference when no action
198198 * sets one — the rule `defineStack()` applies to each object's merged actions
199199 * (`sortActionsByOrder` in `@objectstack/spec`'s stack builder, which is
200- * internal there), so an attached action sorts exactly as a same-stack one .
200+ * internal there), applied here to the attached actions among themselves .
201201 */
202202function sortActionsByOrder < T extends { order ?: number } > ( actions : T [ ] ) : T [ ] {
203203 if ( ! actions . some ( ( a ) => a ?. order !== undefined ) ) return actions ;
@@ -3506,6 +3506,11 @@ export class SchemaRegistry {
35063506 * before rung 2). A target no package registers is refused at boot, not
35073507 * here — see {@link findUnboundActionTargets}.
35083508 *
3509+ * The object's own `actions` keep their order exactly — re-sorting them by
3510+ * `order` here would reorder an object no package bound anything to the
3511+ * moment one did. The attached actions follow, stable-sorted among
3512+ * themselves by `order`.
3513+ *
35093514 * Returns `body` by reference when nothing attaches.
35103515 */
35113516 private attachBoundActions < T > ( body : T ) : T {
@@ -3524,7 +3529,9 @@ export class SchemaRegistry {
35243529 fresh . push ( action ) ;
35253530 }
35263531 if ( fresh . length === 0 ) return body ;
3527- return { ...body , actions : sortActionsByOrder ( [ ...base , ...fresh ] ) } ;
3532+ // The object's own actions keep their served order, untouched; the
3533+ // attached ones follow, ordered among themselves by `order`.
3534+ return { ...body , actions : [ ...base , ...sortActionsByOrder ( fresh ) ] } ;
35283535 }
35293536
35303537 /**
0 commit comments