Skip to content

docs: establish canonical settlement architecture and 7-step Next Clean Sequence#70

Open
flyingrobots wants to merge 26 commits into
mainfrom
cycle/optic-based-briefing
Open

docs: establish canonical settlement architecture and 7-step Next Clean Sequence#70
flyingrobots wants to merge 26 commits into
mainfrom
cycle/optic-based-briefing

Conversation

@flyingrobots

Copy link
Copy Markdown
Owner

Unites Xyph's category shift as a sovereign settlement runtime with a concrete technical RFC (14 invariants, portable witness envelope, immutable evidence binding) and the definitive 7-step Next Clean Sequence.

…neService, and SubmissionReadService, decouple FSM random
… compile-time mocks via Dependency Injection
@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@flyingrobots, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 28 minutes and 30 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b259e5b5-d2a7-4b5d-a127-5566dceb3123

📥 Commits

Reviewing files that changed from the base of the PR and between dcb6bd3 and f1981db.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (71)
  • AGENTS.md
  • README.md
  • bad-code/vi-mock-decoupling.md
  • design/cycles/0029-policy-definitions.md
  • design/cycles/0030-optic-based-briefing.md
  • design/cycles/README.md
  • design/rfc-programmable-optics.md
  • docs/SETTLEMENT_FRONT_DOOR.md
  • docs/SETTLEMENT_RUNTIME_VISION.md
  • docs/TS_STANDARDS.md
  • package.json
  • src/cli/commands/agent.ts
  • src/cli/commands/analyze.ts
  • src/cli/commands/artifact.ts
  • src/cli/commands/dashboard.ts
  • src/cli/commands/doctor.ts
  • src/cli/commands/intake.ts
  • src/cli/commands/show.ts
  • src/cli/commands/submission.ts
  • src/cli/commands/suggestions.ts
  • src/cli/commands/traceability.ts
  • src/cli/commands/wizards.ts
  • src/cli/context.ts
  • src/domain/models/dashboard.ts
  • src/domain/services/AgentActionService.ts
  • src/domain/services/AgentBriefingService.ts
  • src/domain/services/ControlPlaneService.ts
  • src/domain/services/GraphSnapshotFilter.ts
  • src/domain/services/MutationKernelService.ts
  • src/domain/services/OrchestrationFSM.ts
  • src/domain/services/QuestCompletionEvaluator.ts
  • src/domain/services/RecordService.ts
  • src/domain/services/SubmissionReadService.ts
  • src/domain/services/SubmissionService.ts
  • src/infrastructure/ObservedGraphProjection.ts
  • src/infrastructure/adapters/SystemClockAdapter.ts
  • src/infrastructure/adapters/WarpGraphAdapter.ts
  • src/infrastructure/adapters/WarpIntakeAdapter.ts
  • src/infrastructure/adapters/WarpObservationAdapter.ts
  • src/infrastructure/adapters/WarpRoadmapAdapter.ts
  • src/infrastructure/adapters/WarpSubmissionAdapter.ts
  • src/infrastructure/adapters/WorldlineObservedProjectionAdapter.ts
  • src/infrastructure/warp/optics/WarpCampaignPolicyCommandAdapter.ts
  • src/infrastructure/warp/optics/WarpCampaignPolicyReadAdapter.ts
  • src/infrastructure/warp/optics/WarpQuestReadAdapter.ts
  • src/infrastructure/warp/optics/WarpSubmissionReadAdapter.ts
  • src/ports/CampaignPolicyCommandPort.ts
  • src/ports/CampaignPolicyReadPort.ts
  • src/ports/ClockPort.ts
  • src/ports/GraphPort.ts
  • src/ports/QuestReadPort.ts
  • src/ports/ReadTypes.ts
  • src/ports/SubmissionReadPort.ts
  • src/tui/render-status.ts
  • test/acceptance/cycles/0003-case-driven-governance/AgentCaseFlow.test.ts
  • test/helpers/cliContext.ts
  • test/integration/WarpCampaignPolicyAdapter.test.ts
  • test/integration/WarpQuestReadAdapter.test.ts
  • test/integration/WarpSubmissionReadAdapter.test.ts
  • test/unit/AgentActionService.test.ts
  • test/unit/AgentBriefingService.test.ts
  • test/unit/AgentCommands.test.ts
  • test/unit/AnalyzeCommands.test.ts
  • test/unit/ControlPlaneService.test.ts
  • test/unit/DashboardAuditSovereigntyCommand.test.ts
  • test/unit/DashboardTraceCommand.test.ts
  • test/unit/DoctorCommands.test.ts
  • test/unit/GraphSnapshotFilter.test.ts
  • test/unit/IntakeCommands.test.ts
  • test/unit/QuestCompletionEvaluator.test.ts
  • test/unit/ShowCommands.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cycle/optic-based-briefing

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f1981db83f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const evaluator = new QuestCompletionEvaluator();
const coneResult = await questReader.getQuestCone(quest.id);
if (coneResult) {
quest.computedCompletion = evaluator.evaluate(coneResult.value);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Refuse settlement completion from truncated cones

When a quest cone exceeds WarpQuestReadAdapter's 100-node budget, getQuestCone() returns only a prefix with completeness: 'truncated', but this line still computes and stores a normal completion verdict from that partial data. For governed quests with more than ~100 linked requirements/criteria/evidence, omitted failing or missing criteria can be ignored, causing SettlementGateService to treat the quest as complete and allow seal/merge based on an incomplete read; the code should avoid assigning a complete verdict, or fall back to the full traceability data, when the cone is truncated.

Useful? React with 👍 / 👎.

Comment on lines +430 to +432
requirements,
criteria,
evidence,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Populate completion before briefing semantics

When getQuestCone() returns criteria/evidence, these arrays become non-empty but the quest object passed to buildQuestWorkSemantics() still has no computedCompletion. In this context, and in the mirrored detail built in buildQuestCandidates, WorkSemanticsService has no failing/missing/linked sets, so it marks criteria as unknown and then reports the evidence summary as satisfied whenever criteria exist, hiding failing or missing evidence from briefing/next packets. Compute the cone completion and attach it to the quest before building semantics.

Useful? React with 👍 / 👎.

);

// Merge governing campaign policies
const policy = cone.policies[0];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Stabilize governing policy selection

When a campaign or milestone has multiple governs edges, cone.policies comes from graph neighbor order and is not sorted before this first element is used as the only policy. The previous projection path sorted policy IDs before choosing one, so the same graph can evaluate completion against different policies after materialization or replica ordering changes, especially if one policy is lenient and another is strict. Sort or otherwise resolve all applicable policies deterministically before computing completion.

Useful? React with 👍 / 👎.

id: evId,
kind: evProps['kind'] as 'test' | 'benchmark' | 'manual' | 'screenshot',
result: evProps['result'] as 'pass' | 'fail' | 'linked',
producedAt: typeof evProps['produced_at'] === 'number' ? evProps['produced_at'] : Date.now(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject evidence without recorded timestamps

For evidence nodes missing numeric produced_at, this read path fabricates the current wall-clock time instead of ignoring the invalid evidence. In a criterion with an older recorded fail and a malformed pass missing produced_at, the fabricated timestamp makes the pass look newest on every read, so computed completion can flip to satisfied and unblock governed settlement based on invalid graph data. Preserve deterministic reads by skipping or rejecting evidence without a valid timestamp.

Useful? React with 👍 / 👎.

Comment on lines +93 to +98
const requirement = new Requirement({
id: reqId,
description: typeof reqProps['description'] === 'string' ? reqProps['description'] : '',
kind: reqProps['kind'] as 'functional' | 'non-functional',
priority: reqProps['priority'] as 'must' | 'should' | 'could' | 'wont',
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Skip malformed requirement nodes in quest cones

When a linked requirement node is legacy or only partially written, these unchecked values are passed directly into the Requirement constructor, which throws on missing/short descriptions or invalid kind/priority. This path now runs while building briefing/next packets and quest-detail completion, whereas the old projection skipped invalid requirement nodes, so one bad linked requirement can make the whole read fail instead of degrading. Validate and continue before constructing the domain object.

Useful? React with 👍 / 👎.

Comment on lines +65 to +68
return new Policy({
id,
coverageThreshold: typeof props['coverage_threshold'] === 'number' ? props['coverage_threshold'] : undefined,
requireAllCriteria: typeof props['require_all_criteria'] === 'boolean' ? props['require_all_criteria'] : undefined,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Default invalid policy thresholds before construction

When an existing policy has a numeric coverage_threshold outside [0, 1] or NaN from an older/manual patch, this constructs Policy directly and throws. ObservedGraphProjection now reads policies through this adapter, while the previous code range-checked and defaulted invalid values, so a single malformed policy on a campaign can break show/trace dashboard reads for governed quests. Preserve the prior fallback behavior before creating the domain object.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant