Skip to content

feat(diagnostics): add strict writing diagnostic contract - #249

Draft
seonghobae wants to merge 26 commits into
design/llm-writing-diagnosticsfrom
feat/writing-diagnostics-contract
Draft

feat(diagnostics): add strict writing diagnostic contract#249
seonghobae wants to merge 26 commits into
design/llm-writing-diagnosticsfrom
feat/writing-diagnostics-contract

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Scope

Stacked Task 1 implementation lane for PR #248's writing-diagnostics plan. The PR remains Draft and targets design/llm-writing-diagnostics; #248 is the governing dependency-root authority.

Current exact stack authority

The branch was synchronized non-destructively through a two-parent commit over the exact current #248 tree. Fresh comparison resolves merge base to exact parent, reports behind_by=0, and leaves exactly this lane's seven paths changed. No force push or destructive rebase was used.

Test-first behavior

The contract was developed RED→GREEN before production implementation and provides provider-neutral diagnostics/provenance types, bounded priorities/resources/strings/selectors, exact own-data-property validation, hostile-reflection rejection, duplicate-ID rejection, exact revision/projection binding, deeply detached/frozen accepted values, stable redacted failures, and root plus React-free exports.

It performs no semantic language judgment, keyword/regex/phrase fallback, model/provider/network/database/credential access, stale-text repair, decoration, document mutation or send gate.

Exact-current-head evidence

Current exact head e80545e6a85b628d624f43d60259f16c6b2244d6 has no qualifying current-head PR workflow runs returned by the live workflow-run query yet. Therefore predecessor focused TDD success is historical only and current-head CI/security/SAST/package/browser/coverage evidence remains non-passing until freshly produced. Formal submitted reviews and unresolved inline threads are currently zero.

Remaining gates

Do not self-approve, transfer predecessor evidence, weaken gates, bypass dependency order or synthesize release identity.


Open in Devin Review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b84f2ebc-d1bd-4e3e-8d54-ffd13de3fd7f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@opencode-agent opencode-agent Bot added area: api API, protocol, event, or external contract priority: medium Normal-priority or P2 work status: draft Draft pull request type: feature New or expanded product capability labels Aug 22, 2026
@seonghobae
seonghobae marked this pull request as ready for review August 25, 2026 13:33
@seonghobae

Copy link
Copy Markdown
Contributor Author

Marking ready for review: this is the base of the writing-diagnostics stack (#249#254#256#257#266#280#281#282#285). Exact-head checks are green at this head; requesting central review evidence so the stack can integrate bottom-up.

@devin-ai-integration devin-ai-integration 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.

Devin Review found 2 potential issues.

Open in Devin Review

Comment on lines +8 to +12
export {
DEFAULT_WRITING_DIAGNOSTIC_LIMITS,
WritingDiagnosticError,
validateWritingDiagnostics,
} from '../writingDiagnostics.js';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 New writing-diagnostics subpath not published in package exports

This framework-independent public surface has no matching ./writing-diagnostics entry in package.json exports, no vite build config, and no verify script, unlike every sibling subpath. It is never emitted to dist, so consumers importing @contextualwisdomlab/cwl-editor/writing-diagnostics hit a module-resolution failure. The exports test passes only because it resolves source, not the packed artifact.

Prompt for agents
The new public subpath src/writing-diagnostics/index.ts is not wired into the package the way every other subpath is. To make `@contextualwisdomlab/cwl-editor/writing-diagnostics` resolvable from the published package, mirror the existing text-position-selector subpath setup: (1) add a `./writing-diagnostics` entry to the `exports` map in package.json pointing at the built dist files (types + import + require); (2) add a vite build config (e.g. vite.writing-diagnostics.config.ts) that builds src/writing-diagnostics/index.ts as a React-free library entry and emits its d.ts, and add it to the `build` script; (3) add a packed-artifact verification script (like scripts/verify-text-position-selector-subpath-package.mjs) and reference it from `verify:package`, per the AGENTS.md rule to validate public package behavior from packed artifacts rather than source imports alone.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Verified against current #249 head b878721bf1c085612f8aea889081f0322e62a2ae and the existing downstream package owner #282 head 03e626e57c9b85d5f6cc9b616249b09bdf1669e2.

#249 is intentionally Task 1's source-level, React-free contract. Its executable export test is explicitly named writing diagnostic public source exports and imports ./writing-diagnostics/index.js from source. Package publication is not owned by this branch.

Existing Draft #282 (feat(diagnostics): publish framework-neutral package subpath) is the sole package-surface writer. On its exact current head, package.json already contains ./writing-diagnostics types/import/require exports, adds vite.writing-diagnostics.config.ts to build, and adds verify-writing-diagnostics-subpath-package.mjs to verify:package; that PR also owns the packed-package verification/build files. Moving those package files into #249 would create a competing writer and break the accepted dependency split.

Therefore the reported module-resolution problem is valid as a downstream package-publication requirement, but it is not a defect in #249's bounded source-contract scope. Package resolvability remains acceptance work on #282 and cannot be claimed from #249 alone.

Comment thread src/writingDiagnostics.ts
Comment on lines +509 to +519
let prototype: object | null;
let keys: PropertyKey[];
try {
prototype = Object.getPrototypeOf(value);
keys = Reflect.ownKeys(value);
} catch {
throw new WritingDiagnosticError(errorCode);
}
if (prototype !== Object.prototype && prototype !== null) {
throw new WritingDiagnosticError(errorCode);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 100% coverage gate requires every defensive branch to be exercised

The repo enforces 100% branch coverage across src/**. writingDiagnostics.ts adds many defensive branches (the prototype === null path in readExactObject, the try/catch redaction paths). Any single one left unexercised fails pnpm coverage. The focused tests appear thorough, but full branch coverage is worth confirming.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@seonghobae
seonghobae marked this pull request as draft August 25, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: api API, protocol, event, or external contract priority: medium Normal-priority or P2 work status: draft Draft pull request type: feature New or expanded product capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant