A component boundary needs two contracts: what data the child accepts, and what intent it reports to its caller. Making a record visible does not transfer ownership of that record to the child. In this lesson an Aster summary card receives parent-owned data and emits an edit request; the parent chooses what state changes. You will break a public input name and an event payload, then repair the actual callers without hiding the compiler diagnostics.
Use the existing macOS 15.7.9/arm64/zsh workspace and local Node 24.19.0/npm 12.2.1 from lessons02–03. The API can stay stopped; these records are local synthetic inputs. Allow 40–60 minutes including the independent repairs. No new package, account or global CLI is required. The reference app retains strict TypeScript and template checking. Later lessons develop signal state, provider scopes and HTTP decoding; this lesson establishes their component contract boundary.
Preserve the existing workspace before replacing source
Stop your own client/API foreground launches. Restore the existing path/tool variables from lesson 02. The verified fixture/common source from lesson 03 is needed for root checks, although its server is not started. A live or stale API descriptor refuses checkpoint operations; use the already-taught identity/recovery procedure.
Download Aster checkpoint tools and Aster component labs from this lesson's Practice files panel. Compare each ZIP's SHA-256 with its current panel digest before extracting. The component packet grows only as its lessons are authored; the named checkpoint/variant below identifies this lesson's inputs.
shasum -a 256 "$HOME/Downloads/aster-checkpoint-tools.zip" \
"$HOME/Downloads/aster-component-labs.zip"
After both match, choose a new owned input directory. An existing directory is not permission to overwrite it; choose another name if needed:
ASTER_COMPONENT_INPUTS="$ASTER_STUDY/component-inputs"
mkdir "$ASTER_COMPONENT_INPUTS" &&
ditto -x -k "$HOME/Downloads/aster-checkpoint-tools.zip" "$ASTER_COMPONENT_INPUTS" &&
ditto -x -k "$HOME/Downloads/aster-component-labs.zip" "$ASTER_COMPONENT_INPUTS" &&
ASTER_CHECKPOINT_TOOL="$(cd "$ASTER_COMPONENT_INPUTS/aster-checkpoint-tools" && pwd -P)/checkpoint.mjs" &&
ASTER_COMPONENT_PACKET="$(cd "$ASTER_COMPONENT_INPUTS/aster-component-labs" && pwd -P)"
These connected commands stop on a failed extraction. From the resolved app root, select the complete guided variant and preview its writes:
cd "$ASTER_LAB"
ASTER_LESSON=standalone-component-contracts
ASTER_VARIANT=guided
"$ASTER_NODE" "$ASTER_CHECKPOINT_TOOL" preview --root "$ASTER_LAB" \
--packet "$ASTER_COMPONENT_PACKET" --lesson "$ASTER_LESSON" --variant "$ASTER_VARIANT"
"$ASTER_NODE" "$ASTER_CHECKPOINT_TOOL" preserve --root "$ASTER_LAB" \
--packet "$ASTER_COMPONENT_PACKET" --lesson "$ASTER_LESSON" --variant "$ASTER_VARIANT"
Inspect the root/targets before preservation. The generated snapshot UUID is an identifier for a bounded backup, not an authentication credential. Record your own output's value:
ASTER_BACKUP='<UUID from your preserve output>'
"$ASTER_NODE" "$ASTER_CHECKPOINT_TOOL" apply --root "$ASTER_LAB" \
--packet "$ASTER_COMPONENT_PACKET" --lesson "$ASTER_LESSON" --variant "$ASTER_VARIANT" \
--backup "$ASTER_BACKUP"
"$ASTER_NODE" "$ASTER_CHECKPOINT_TOOL" check --root "$ASTER_LAB" \
--packet "$ASTER_COMPONENT_PACKET" --lesson "$ASTER_LESSON" --variant "$ASTER_VARIANT"
The tool verifies the known lesson 03 helper bytes before importing its root/path
checks. It accepts only packet-declared lesson/variant definitions and complete
hashed replacements. It snapshots current src/, fixture source and named root
configuration/markers under .aster-learning-snapshots/<UUID>. Dependencies,
outputs, runtime/control tokens and unlisted personal notes are excluded; unlisted
files are untouched rather than backed up. New or edited source after preserve
requires another snapshot. A symlink or an unknown path/capability refuses.
The bounded source scan accepts ordinary .ts, .mjs, .html, .css, .json
and .md files, at most 200 files and 256,000 bytes per file. Keep manual backup
copies and personal notes in a separate identified folder outside src/ and
fixture/; a suffix such as .ts.bak inside those trees refuses preservation.
If this happens, inspect the named entry and retain your own copy outside the
scanned trees before requesting a fresh preview/snapshot. Never delete an
unidentified file or bypass the bounds to force an apply.
Each replacement is staged and renamed;.aster-feature.json is written last.
The whole batch is not a transaction. After interruption, preserve the current
partial state again before applying the intended checkpoint. Old snapshots stay.
Only declared files are replaced; unused files from an earlier variant may remain.
The base package/lock/marker are retained. The base doctor still identifies its
toolchain as workspace-02; the feature receipt and page identify contracts-04.
An input-check success is not compilation or behavior proof: broken variants
intentionally contain validly identified source that fails the next check.
Describe accepted data separately from emitted intent
The complete src/app/request-model.ts defines the local contract:
export type Queue = 'hardware' | 'network';
export interface RequestSummary {
readonly id: string;
readonly title: string;
readonly queue: Queue;
}
export interface EditRequest { readonly requestId: string; }
The queue is a closed union for this synthetic scenario. readonly prevents
assigning these fields through this TypeScript interface; it neither decodes
arbitrary HTTP JSON nor freezes a nested object at runtime. EditRequest
reports the stable identifier the parent needs, rather than handing the child
permission to mutate the canonical record. A different application could
choose another payload, provided every producer and caller agrees on its meaning.
The complete src/app/request-summary.ts is:
import {Component, input, output} from '@angular/core';
import {EditRequest, RequestSummary} from './request-model';
@Component({
selector: 'aster-request-summary',
standalone: true,
template: `
<article>
<h2>{{ request().title }}</h2>
<p>{{ request().id }} · {{ request().queue }}</p>
<button type="button" (click)="requestEdit()">Edit {{ request().id }}</button>
</article>
`,
})
export class RequestSummaryCard {
readonly request = input.required<Readonly<RequestSummary>>();
readonly editRequested = output<EditRequest>();
requestEdit(): void {
this.editRequested.emit({requestId: this.request().id});
}
}
standalone: true lets the card be imported directly. Its request property is
an InputSignal: call request() to read the current supplied value. It has no
public set method for the child. input.required has no default and the
compiler requires a template binding. Read the value after Angular supplies it,
as this template and click handler do, not eagerly in a field initializer that
assumes a parent value already exists. Input/output declarations belong in
component property initializers; they are not dynamic functions to call later
to add another runtime input.
output<EditRequest>() returns an emitter whose emit argument must match
that type. The button handler emits a small object containing the current ID.
It does not edit the title or save anything to a server. Angular component
outputs do not bubble through the DOM: an ancestor receives this intent only
through an explicit binding or a deliberate re-emission boundary.
Make the caller's dependency and update policy visible
The parent's decorator imports RequestSummaryCard into its standalone template
scope. A TypeScript import alone does not make a selector usable in that scope.
The relevant maintained template block is:
@for (request of requests; track request.id) {
<aster-request-summary [request]="request" (editRequested)="editRequest($event)" />
}
[request] evaluates the parent's row expression. (editRequested) handles
the output, and $event is its EditRequest payload, not a browser MouseEvent.
Names are case-sensitive. The built-in @for tracks each synthetic row by its
unique ID; no CommonModule import is needed for this built-in control-flow block.
Tracking is not permission to change an ID or a guarantee about every future
rendering/performance outcome.
The parent holds three flat records. It explicitly freezes the array and each
record in this worked example;Object.freeze is shallow, so a future nested
object would need its own ownership policy. The parent handler sets only
selectedRequestId. Its separate Replace first request button creates a
new frozen record/array with a revised title. This establishes two observable
paths: an edit intent reaches the parent without changing titles, and a deliberate
parent replacement reaches the child through the input.
From the identified app root, build with the selected tools:
PATH="$ASTER_NODE_HOME/bin:$PATH" "$ASTER_NODE" "$ASTER_NPM_CLI" --cache "$ASTER_CACHE" run build
Then use lesson 02's checked foreground launch at your chosen unused port. Require Aster request summaries, contracts-04 and three cards. Click Edit REQ-101, then Edit REQ-102: the status should name that ID while the titles remain unchanged. Click Replace first request: the first heading becomes Keyboard request revised by parent, with three cards still present. A build exit alone would not establish those paths.
Repair changed contracts using their actual diagnostics
Stop your own app before switching a source checkpoint. For every variant,
set ASTER_VARIANT, preview, preserve, and apply using the newly returned backup
UUID with the complete commands above. Keep your draft/snapshots; do not reuse
an old backup after changing the current file set.
Task 1: the internal member kept its name, but the public input changed
Apply broken-input-alias and build. The card now declares:
readonly request = input.required<Readonly<RequestSummary>>({alias: 'summary'});
The parent still binds [request]. Predict the failure, then repair the caller
while preserving the child member request() and the existing event behavior.
Verify the same browser checks after the repair. The provided
solution-input-alias checkpoint is a complete reference repair.
Hint 1: an input alias changes the binding name visible to the template caller. Hint 2: compare the required public name with the parent's square-bracket binding.
Answer and reasoning
The observed reference build reports NG8002 for the unknown request binding
and NG8008 for the missing required summary input. Change the parent binding
to [summary]="request"; the child's internal member stays request, so its
own reads remain request(). The handler/output contract did not change.
A similar unknown-selector/input diagnostic can also come from a missing
standalone import, so inspect both the declared contract and caller scope.
Adding NO_ERRORS_SCHEMA, turning off strict templates or casting values does
not repair this Angular component's API.
Task 2: an output now emits a string into an object-shaped handler
Apply broken-output-payload. Its emitter/emit call use a string, but the
parent still expects EditRequest. Build and locate the mismatch. Under this
exercise's requirement, keep the object-shaped public event and parent-owned data.
Hint 1: trace $event from the child's output generic to the parent's parameter.
Hint 2: the payload shape must be corrected at the producer as well as its type.
Answer and reasoning
The reference build reports TS2345: the string is not assignable to EditRequest.
Restore output<EditRequest>() and emit {requestId: this.request().id}, as in
guided. A string contract could be valid if every caller and requirement
were deliberately changed; an assertion pretending the string is an object
would leave the current handler with the wrong runtime shape. Retest ID selection
and unchanged titles, not merely the compiler exit.
Read a small NgModule bridge without confusing ownership
The optional module-bridge variant imports/exports the standalone card through this complete file:
import {NgModule} from '@angular/core';
import {RequestSummaryCard} from './request-summary';
@NgModule({imports: [RequestSummaryCard], exports: [RequestSummaryCard]})
export class RequestCardsModule {}
The standalone App imports RequestCardsModule instead of the card directly.
The module exports make the card available to the caller's template. A
standalone component belongs in this module's imports, not its declarations.
The variant builds and preserves the same browser input/event behavior. New
code can import standalone dependencies directly; this bridge explains an
existing NgModule boundary. Provider instance sharing is a separate lesson.
Resume and finish with the source identity intact
A new terminal needs the existing local tool/root variables and your actual
checkpoint-tool/component-packet paths. Read .aster-feature.json and choose
the recorded variant;check detects edited declared inputs but does not claim
they are incorrect learner work. Preserve such edits before a deliberate switch.
Keep the base/fixture/tool/component inputs and snapshots for the next lesson.
Stop only your own foreground launch with Ctrl+C and inspect its port; never kill
an unfamiliar listener. Optional generated-output cleanup uses the guarded
lesson 02 procedure after all owned app/API/build activity stops. It preserves
source/snapshots/tools; the next client resume then needs the locked install.
References
- Components and standalone use, inputs, outputs.
- input API, output API, NgModule interoperability.
- Node file operations and hashes/identifiers support the explained bounded checkpoint tool.
- TypeScript strict checking. The actual Angular 22.2.3/TypeScript 6.0.3 builds and browser checks qualify this selected reference; they do not assess learner competence or deploy a feature.