Skip to content

Add bootstrap command, domain/service, dogfood mock, and tests#3

Open
danielbdyer wants to merge 1 commit into
mainfrom
codex/create-onboarding-application-service
Open

Add bootstrap command, domain/service, dogfood mock, and tests#3
danielbdyer wants to merge 1 commit into
mainfrom
codex/create-onboarding-application-service

Conversation

@danielbdyer
Copy link
Copy Markdown
Owner

Motivation

  • Provide a deterministic, end-to-end local bootstrap workflow to auto-generate canonical onboarding artifacts from a live site without relying on external services.
  • Enable agents to validate substantial workflow/compiler changes via a self-hosted dogfood pass and surface provenance for emitted artifacts.

Description

  • Add domain types and validation for bootstrap input in lib/domain/bootstrap.ts with branded value objects and crawl bounds validation.
  • Implement the bootstrap application service and saga in lib/application/bootstrap/service.ts and an ingress adapter in lib/application/bootstrap/ingress.ts to emit scenarios, screen knowledge, surfaces, metadata, and provenance.
  • Wire a new bootstrap CLI command and rich argument parsing into bin/tesseract.ts and expose a bootstrap npm script in package.json.
  • Add a dogfood helper scripts/dogfood-mock.js, documentation updates (README.md and AGENTS.md), and automated tests in tests/bootstrap.spec.ts to validate deterministic outputs and idempotency.

Testing

  • Built the project with npm run build which completed successfully.
  • Ran the test suite with npm test, which executed the new tests/bootstrap.spec.ts and passed.

Codex Task

danielbdyer pushed a commit that referenced this pull request Apr 20, 2026
…ss + observation memo + seam test

The retirement commit (step-4b.retirement) landed the actual
migration. This commit updates the doctrine text that described the
composite bridge as a live runtime construct — it's deleted, so the
text needs to stop referring to it as present-tense.

- AGENTS.md Reasoning-port section: adapter priority #3 changed
  from "createCompositeReasoning({ translation, agent }) wrapping
  the legacy v1 providers" to "createReasoning({ translation,
  agent }) composing the backend strategies." The "Note on
  retirement" paragraph replaced with a description of the internal
  backend contract layout: TranslationProvider / AgentInterpreterPort
  are implementation-detail shapes inside adapters/, not public APIs.
- docs/v2-readiness.md §9.4 step 4b.5: renamed from "Cleanup +
  deprecation" to "Documentation + retirement"; LOC count updated
  to reflect the actual -1350/+300 delta; description names the
  retirement-commit facts (factories moved, error classes deleted,
  composite deleted, createReasoning in index.ts).
- workshop/observations/step-4b-reasoning-port.md: the "Why this
  is a proposal, not a retirement" section renamed to "Retirement
  status" and reframed to describe the completed retirement rather
  than the pending one. Pointer list drops the "composite bridge
  retires" line (already retired).
- product/domain/resolution/model.ts: AgentInterpreterPort docstring
  reframes to describe the current internal use by adapter layer,
  not the pending deletion.
- product/tests/architecture/seam-enforcement.laws.spec.ts:
  RULE_3_GRANDFATHERED comment updated to reflect the graduation+
  retirement together (files renamed into adapters/ subdirectory).

## Verification

- npm run build: baseline preserved (10 TS errors, all pre-existing
  in workshop/orchestration/dogfood.ts).

https://claude.ai/code/session_01NX7KnDHBnWp9dqzMxg7quJ
danielbdyer pushed a commit that referenced this pull request Apr 25, 2026
Seven moves in one atomic wave, synthesized from a 5-agent
audit (algebra / naming / type-discipline / doctrine-vs-code /
append-only). Wave-1 focus: fix self-introduced gaps + strip
Traditional-Web dead code (Reactive is the rung-4 target) +
align CLAUDE.md with actual repo state.

**W1.1 — Collapse duplicate SurfaceVisibility (Agent C #4).**
The type was declared twice with convention-equivalence
comments — workshop/substrate/surface-spec.ts:130 and
workshop/substrate-study/domain/snapshot-record.ts:58. Risk:
silent drift across the two declarations. Consolidated:
canonical site is workshop/substrate/surface-spec.ts (added
SURFACE_VISIBILITY_VALUES + compile-time exhaustiveness witness
+ foldSurfaceVisibility); snapshot-record.ts re-exports.

**W1.2 — Add foldParityDivergenceAxis (Agent C #3).** The
union was claimed closed by comment at
workshop/probe-derivation/parity-failure.ts:34-36 but had no
compile-time guard. Added PARITY_DIVERGENCE_AXIS_VALUES
runtime enumeration + exhaustiveness witness + fold.

**W1.3 — Reactive-only variant classifier + trimmed types
(my A/B/C).** After the 2026-04-24 Reactive-is-target
clarification, the dead-on-arrival branches for Traditional /
Mobile detection were removed:
  - VariantClassifierVerdict: 5 kinds → 3
    (reactive | not-reactive | ambiguous). Dropped
    traditional, mobile, not-os dead branches.
  - classifyVariant: simpler rule set; ambiguity gate
    preserved for the osui-* + __OSVSTATE conflict case.
  - ClassPrefixFamily: 9 families → 2 (osui | app-specific).
    Traditional-Web families (os PascalCase, theme-grid,
    menu, epa-taskbox, feedback, fa, rich-widgets) removed.
  - DataAttrValue: discriminated union collapsed to raw
    `Record<string, string>`. The cardinality partition
    (observed-token / unobserved / high-cardinality) was
    YAGNI at v1 — no corpus means every value was
    unobserved-cardinality placeholder. Deferred to Z11g.d.1.
  - VariantClassifierSignals: dropped osPascalClassCount +
    mobileMarkerPresent dead signals.

**W1.4 — Trim survey doc Traditional sections (my D).**
docs/v2-substrate-source-survey.md: 1180 → 802 lines.
§§3-7 (400 lines of Traditional-Web findings) compacted
into a single 60-line appendix marked "informational only;
see scope note." Findings retained as negative-check guidance
(things a Reactive detector should NOT see). Methodology +
observation-axes (§§11) preserved — those are Reactive-
relevant.

**W1.5 — Archive Z11b + update CLAUDE.md pointer (my G).**
docs/v2-executed-test-cohort-plan.md → docs/archive/; added
retirement header with rationale. CLAUDE.md "fresh agent
session" pointer now points at the active substrate-ladder
plan instead of the stale post-Z11a handoff.

**W1.6 — Delete WorldConfig residue (Agent B #4).** The
source file workshop/substrate/world-config.ts was deleted
at commit a38a82b per verdict-06; only stale doc-header
comments remained in workshop/substrate/world-shape.ts
claiming it was retained as a legacy shim. Cleaned.

**W1.7 — CLAUDE.md + coding-notes corrections
(Agent D #1, #9).** Trust policy doctrine stale: the
evaluator lives at product/application/policy/trust-policy.ts,
thresholds at .tesseract/policy/trust-policy.yaml — not
workshop/policy/. Fixed both references. Also swept 27
`lib/` path references in docs/coding-notes.md to their v2
equivalents (product/domain, product/application,
product/composition, product/runtime, product/instruments,
product/generated).

**Tests**: 3969 passing / 10 skipped (was 3977 pre-wave-1).
Net −8 tests: the removed dead-branch variant-classifier tests.
Build ok; manifest drift-check clean.

**Next waves**: W2 (architecture-law backfill) + W3 (algebraic
surfacing — Quotient<T, Tag> abstraction).

https://claude.ai/code/session_01RyCaLypF4TrZqMjuqKpKM6
danielbdyer pushed a commit that referenced this pull request Apr 25, 2026
…nt A's #1)

The highest-leverage single move from the 5-agent audit: name
the "equivalence-by-fingerprint-projection" pattern that already
recurred in four unrelated places (probe-receipt invariantContent,
snapshot-record structuralSignature, cohort key, ado-content
hash). Now first-class in the domain algebra library alongside
Monoid / Lattice / GaloisConnection / Hylomorphism /
Free-Forgetful / ProductFold / ContextualMerge / SliceProjection.

**What changed**:

- product/domain/algebra/quotient.ts: new file. Exports:
    Quotient<T, Tag> — interface { tag, witness, equal }.
    makeQuotient({ tag, project }) — construct a Quotient
      from a pure projection + fingerprint tag. witness and
      equal are derived.
    quotientLaws({ quotient, equivalentSamples,
      distinctSamples }) — law-runner that verifies reflexivity,
      class-equality, distinct-class, and determinism over
      sample batches. Returns violations: readonly string[];
      empty means all laws hold.
  The algebra formalizes an equivalence relation induced by
  projection: t1 ≈ t2 iff project(t1) = project(t2); witness
  is the tagged sha256 of that projection; equal derives from
  witness-equality. Class-equality ⇔ witness-equality holds
  by construction.

- product/domain/algebra/index.ts: export the new module.

- workshop/probe-derivation/probe-receipt.ts: introduce
  probeReceiptInvariantQuotient (Quotient over the
  ProbeReceiptInvariantInput projection bag). computeInvariantContent
  becomes a thin alias over the quotient's witness, preserved
  for backwards compatibility.

- workshop/substrate-study/domain/snapshot-record.ts: introduce
  snapshotStructuralQuotient (Quotient over readonly SnapshotNode[]
  with the sort-by-path + 5-tuple projection). computeStructuralSignature
  becomes a thin alias over the quotient's witness.

- product/tests/architecture/seam-enforcement.laws.spec.ts:
  widen ALWAYS_ALLOWED_PRODUCT_PATHS to include
  product/domain/algebra/. Rationale documented inline: the
  algebra primitives are as domain-neutral as math itself and
  legitimately cross the compartment seam in both directions.
  This is the "shared-contract subtree set" expansion Agent D
  #3 flagged as needing explicit documentation; algebra now
  joins that set.

- tests/algebra/quotient.laws.spec.ts: 11 tests across 4 groups.
    Constructor laws: reflexivity; variant-band collapse;
      distinct-projection distinctness; tag scoping at type
      level.
    quotientLaws helper: green-path + violation detection
      when projection is broken.
    probeReceiptInvariantQuotient instance: satisfies quotient
      laws across invariant/variant samples (5 invariant-band
      axes exercised); tag verification.
    snapshotStructuralQuotient instance: satisfies laws across
      SnapshotNode lists with node-list reordering stable
      (internal sort-by-path); variant-band field changes
      (interaction, textLengthBucket, etc.) do not affect
      the witness; tag verification.

**Algebra amplification**: the pattern previously recurred
ad-hoc in four files with similar-but-not-identical shapes.
Naming it:
  - Forces uniform laws (every instance testable via
    quotientLaws).
  - Prevents silent drift between instances.
  - Makes the "two things compare equal under fingerprint
    projection" algebraic claim executable.

**Tests**: 3980 passing / 10 skipped (was 3969 post-wave-1).
Net +11 tests from quotient laws. Build ok; manifest drift
clean; seam-enforcement clean; architecture-fitness
purity rate unchanged.

**Functional-style note**: quotientLaws was initially
imperative (let-bindings in loops). Rewritten to flatMap
+ slice + spread per the domain-fitness purity floor
(95%/98% letBindings-per-function); the rewrite also reads
more like the algebraic laws it witnesses.

Agent A's finding #4 and top-1 priority. Closes H (my
RecordedArtifact proposal) by going deeper: the abstraction
is at the *projection* layer, not the envelope layer.

https://claude.ai/code/session_01RyCaLypF4TrZqMjuqKpKM6
danielbdyer pushed a commit that referenced this pull request Apr 25, 2026
…LAUDE.md

Agent D's audit finding #3: the seam discipline was doctrinally
narrower than the law enforced. CLAUDE.md referenced the shared-
contract set as "(manifest, logs, ports, manifest invoker,
errors, resilience, observation/dashboard, fitness, improvement,
projection, proposal, handshake, governance, and the CLI
contract)" — a compact list obscuring that ALWAYS_ALLOWED_PRODUCT_PATHS
has grown to 21 entries with per-path rationale.

Expanded the inline list to the full 20-item shared-contract
set with one-line rationale per path, mirroring the structure
of ALWAYS_ALLOWED_PRODUCT_PATHS in the seam-enforcement law
(product/tests/architecture/seam-enforcement.laws.spec.ts:100-237).
Added explicit note: when widening this set, update both the
law AND this list; per-path rationale lives in the law's
inline comments.

Includes the `product/domain/algebra/` path just widened in
W3.1 (to let workshop consume Quotient<T, Tag>).

Tests: 3993 passing / 10 skipped (unchanged, doc-only commit).
Build ok.

https://claude.ai/code/session_01RyCaLypF4TrZqMjuqKpKM6
danielbdyer pushed a commit that referenced this pull request Apr 25, 2026
…onoids

Three small algebra wins (Agent A's #3, #1, #10) named explicitly:

**S — keyedSetMonoid<T, K>**: lifts the recurring "Map-by-key
dedup" pattern into a Monoid<ReadonlyMap<K, T>>. Right-biased
on key collision (mirrors Map.set). Helper `dedupByKey({
items, keyOf })` builds a deduped array via the monoid in one
line. `deriveProbeTargets` (workshop/probe-derivation/probe-
targets.ts) now uses it.

**P — trajectoryMonoid(cohortId)**: names the
TrajectoryEntry-list-concatenation pattern as a free monoid
scoped to a single cohort. empty = empty trajectory; combine
= entries concatenation. Cross-cohort combine throws (cohort-
key mismatch is a programmer error, not a meaningful
operation). Existing `appendTrajectoryEntry` retained for
ergonomic call sites; the monoid is the algebraic
interpretation. Added `emptyTrajectory(cohortId)` helper.

**T — graduationGateMonoid**: names the AND-on-held +
UNION-on-missing-conditions pattern as a Boolean meet-monoid
over `GraduationGateFlag = { held, missingConditions }`.
Identity = (true, []); combine = boolean ∧ on held +
duplicate-free union on missing. Helper
`conditionToGateFlag(c)` lifts a single GraduationCondition
into the monoid for use with `concatAll`. The graduation
report's `holds` + `missingConditions` are now expressible
as `concatAll(graduationGateMonoid, conditions.map(toFlag))`
in one fold.

**Tests**: 4052 passing / 10 skipped (was 4037 post-W2.1.2/W2.2).
+15 from spt-trio.laws.spec.ts:
  S: 5 keyed-set tests (identity × 2 + associativity +
     right-bias + dedupByKey integration)
  P: 5 trajectory-monoid tests (identity × 2 + associativity +
     cohort-guard + emptyTrajectory)
  T: 5 graduation-gate-monoid tests (identity + boolean-meet +
     missing-union + associativity + concatAll integration)

Build ok; manifest drift clean.

https://claude.ai/code/session_01RyCaLypF4TrZqMjuqKpKM6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant