Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
cb5b4a7
test: pin rich Markdown preview routing
stone16 Aug 1, 2026
bce91d8
feat: hand v3-only inline Markdown to scan
stone16 Aug 1, 2026
3a1fd98
docs: extend rich Markdown console handoff
stone16 Aug 1, 2026
cfa818b
refactor: centralize rich Markdown recognition
stone16 Aug 1, 2026
daadf3d
test: reject mixed malformed rich Markdown
stone16 Aug 1, 2026
6dc4047
fix: keep malformed rich previews generic
stone16 Aug 1, 2026
0359a9a
test: reject malformed link handoffs
stone16 Aug 1, 2026
da1605c
fix: validate rich inline handoff grammar
stone16 Aug 1, 2026
f17d7c8
test: reject malformed structured handoffs
stone16 Aug 1, 2026
2f4b73a
fix: inspect rich inline structural payloads
stone16 Aug 1, 2026
2544dbb
test: reject malformed fenced handoffs
stone16 Aug 1, 2026
211e1a6
fix: validate rich fenced handoff shape
stone16 Aug 1, 2026
9c54a23
test: cover structural rich inline handoffs
stone16 Aug 1, 2026
41c6c9d
fix: recognize rich rule structure
stone16 Aug 1, 2026
bc49e0d
test: reject malformed angle handoffs
stone16 Aug 1, 2026
e2a5038
fix: validate rich angle handoff shape
stone16 Aug 1, 2026
332cc79
test: preserve accepted angle handoff
stone16 Aug 1, 2026
2834955
fix: preserve rich angle literal precedence
stone16 Aug 1, 2026
d0d4f40
test: pin honest rich Markdown boundaries
stone16 Aug 1, 2026
796c1e8
fix: keep rich handoffs honest
stone16 Aug 1, 2026
6e9af65
docs: qualify rich handoff contract
stone16 Aug 1, 2026
50ae822
fix: reject indented fence handoffs
stone16 Aug 1, 2026
3f05e80
fix: align rich block handoff shape
stone16 Aug 1, 2026
7a02780
fix: bound rich HTML handoff blocks
stone16 Aug 1, 2026
365517a
fix: reject control-bearing rich handoffs
stone16 Aug 1, 2026
0bee808
fix: bound rich handoff token shapes
stone16 Aug 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ content. This activates no pi consumer, MCP Adapter, `Continue`, dogfood

| ADR | Activates |
|---|---|
| [0090](./docs/decisions/0090-admit-a-co-resident-local-evidence-console.md), [0093](./docs/decisions/0093-activate-leased-rich-markdown-and-revision-link-graph.md) | Explicitly authenticated server-rendered loopback UI, private File citation reopening, and separately Control-authorized source/import/Article jobs through schema-hidden typed HTTP carriers while OpenAPI v0 remains frozen; link-bearing imports receive a content-free handoff to the activated File scan and exact leased worker path |
| [0090](./docs/decisions/0090-admit-a-co-resident-local-evidence-console.md), [0093](./docs/decisions/0093-activate-leased-rich-markdown-and-revision-link-graph.md) | Explicitly authenticated server-rendered loopback UI, private File citation reopening, and separately Control-authorized source/import/Article jobs through schema-hidden typed HTTP carriers while OpenAPI v0 remains frozen; imports satisfying ADR-0093's closed v1-refusal and whole-document rich-syntax checks receive a content-free handoff to the activated File scan and exact leased worker path |

Feedback persists through the current Runtime identity and exact ContextRun
binding, with no Control or release-publication authority. Numeric Hit Test scores
Expand Down
39 changes: 28 additions & 11 deletions adapters/http/ui_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
MarkdownCompilerConfig,
ParsedDocument,
UnsupportedConstruct,
contains_rich_markdown_link,
contains_only_accepted_rich_markdown_inline,
)

_PREVIEW_TTL: Final = timedelta(minutes=10)
Expand All @@ -65,15 +65,24 @@
_MAX_SIGNED_BIGINT: Final = (1 << 63) - 1


def _contains_rich_markdown_link(source: bytes) -> bool:
def _decode_rich_markdown(source: bytes) -> str | None:
try:
decoded = source.removeprefix(b"\xef\xbb\xbf").decode(
return source.removeprefix(b"\xef\xbb\xbf").decode(
"utf-8",
errors="strict",
)
except UnicodeDecodeError:
return None


def _contains_only_accepted_rich_markdown_inline(
source: bytes,
construct: UnsupportedConstruct,
) -> bool:
decoded = _decode_rich_markdown(source)
if decoded is None:
return False
return contains_rich_markdown_link(decoded)
return contains_only_accepted_rich_markdown_inline(decoded, construct)


class UiApiUnavailable(RuntimeError):
Expand Down Expand Up @@ -806,14 +815,22 @@ def preview_import(
)
except (LookupError, RuntimeError, TypeError, ValueError):
raise UiApiUnavailable from None
requires_scan_handoff = (
(
type(outcome) is CompilationFailure
and outcome.code is CompilationFailureCode.UNSUPPORTED_CONSTRUCT
and outcome.construct is UnsupportedConstruct.LINK_OR_IMAGE
)
or _contains_rich_markdown_link(raw)
requires_scan_handoff = _contains_only_accepted_rich_markdown_inline(
raw,
UnsupportedConstruct.LINK_OR_IMAGE,
)
if (
type(outcome) is CompilationFailure
and outcome.code is CompilationFailureCode.UNSUPPORTED_CONSTRUCT
and outcome.construct is not None
):
requires_scan_handoff = (
requires_scan_handoff
or _contains_only_accepted_rich_markdown_inline(
raw,
outcome.construct,
)
)
if requires_scan_handoff:
source_arguments = (
"--organization-id "
Expand Down
5 changes: 2 additions & 3 deletions adapters/parsers/ragflow_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
StructuralPath,
UnsupportedConstruct,
is_markdown_control_character,
rich_markdown_token_count,
unsupported_rich_markdown_inline,
)
from third_party.ragflow.deepdoc.parser.markdown_parser import MarkdownElementExtractor
Expand Down Expand Up @@ -83,9 +84,7 @@ def _is_table_separator_row(self, line: str) -> bool: ...
def rich_token_count(value: str) -> int:
"""Count deterministic representation tokens for the v3 hard bound."""

if type(value) is not str:
raise TypeError("rich Markdown token counting requires exact text")
return sum(1 for _ in _TOKEN.finditer(value))
return rich_markdown_token_count(value)


def _failure(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: adr-0093-activate-leased-rich-markdown-and-revision-link-graph
version: "1.0.1"
version: "1.0.3"
description: >
Activate rich Markdown v3 behind the exact File-import WorkerLease, persist
immutable content-free Revision link edges, and admit one authorized graph
Expand Down Expand Up @@ -43,13 +43,15 @@ ADR-0075 requires.
are not reinterpreted or backfilled. The co-resident local evidence console's
exact preview flow remains pinned to v1 because it has no durable import job
or WorkerLease redemption authority with which to select the v3 child. Issue
#203 ships the compatibility resolution: when v1's closed refusal is exactly
`LINK_OR_IMAGE`, or the exact source contains any accepted rich link syntax
not classified as such by v1, the console returns a content-free actionable
handoff to the existing source `scan` plus independent worker-dispatch path;
every other compilation refusal remains generically unavailable. The worker
honors a redeemed, exact v1 preview binding only for the console's successful
v1 preview/confirm flow; all scan-scheduled imports use active v3.
#203 and #207 ship the compatibility resolution: when v1's closed refusal is
exactly `LINK_OR_IMAGE`, `EMPHASIS`, `INLINE_CODE`, or `STRIKETHROUGH` and the
exact source matches that accepted v3 inline syntax, or when the source
contains accepted rich link syntax not classified as such by v1, the console
returns a content-free actionable handoff to the existing source `scan` plus
independent worker-dispatch path. Malformed syntax and every other compilation
refusal remain generically unavailable. The worker honors a redeemed, exact
v1 preview binding only for the console's successful v1 preview/confirm flow;
all scan-scheduled imports use active v3.
2. A File import redeems and durably verifies its exact WorkerLease before
selecting the rich compiler subprocess. The child is a pure transform that
receives source bytes, the closed configuration version, and token ceiling
Expand Down Expand Up @@ -139,8 +141,9 @@ an operating-system sandbox.

## Consequences

- Rich link-bearing File notes can now publish without changing v1/v2 bytes or
historical Revision meaning.
- File notes whose frozen-v1 preview outcome satisfies the closed accepted
rich-link, emphasis, inline-code, or strikethrough handoff checks can now
publish without changing v1/v2 bytes or historical Revision meaning.
- Outgoing links and backlinks are reproducible from immutable v3 Revision
lineage, but the graph itself grants no access and exposes no content.
- A denied neighbour is indistinguishable from an absent or irrelevant
Expand Down
4 changes: 4 additions & 0 deletions engine/supply/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
StructuralPath,
UnsupportedConstruct,
canonicalize_parsed_document,
contains_accepted_rich_markdown_construct,
contains_only_accepted_rich_markdown_inline,
contains_rich_markdown_link,
deserialize_parsed_document,
)
Expand Down Expand Up @@ -175,6 +177,8 @@
"WorkerLeaseToken",
"generate_worker_lease_nonce",
"canonicalize_parsed_document",
"contains_accepted_rich_markdown_construct",
"contains_only_accepted_rich_markdown_inline",
"contains_rich_markdown_link",
"deserialize_parsed_document",
"worker_lease_digest",
Expand Down
Loading
Loading