Skip to content

feat(cli,types): serve UI reads the declared title, and the secret detector stops flagging docs - #115

Merged
ABB65 merged 2 commits into
mainfrom
fix/serve-ui-and-content
Aug 13, 2026
Merged

feat(cli,types): serve UI reads the declared title, and the secret detector stops flagging docs#115
ABB65 merged 2 commits into
mainfrom
fix/serve-ui-and-content

Conversation

@ABB65

@ABB65 ABB65 commented Aug 13, 2026

Copy link
Copy Markdown
Member

Two things this repository needed once title_field shipped, plus what fixing
them exposed in its own content.

serve-ui was still guessing

Its column list called Object.keys(desc.fields) under a comment claiming
that preserved definition order. It does not — model JSON is written with
canonically sorted keys, so it was alphabetical. That is the exact problem
order exists to fix: on a sixteen-field article model, author first and
title fifteenth, each column headed by its raw key (body_public,
is_category_hero).

  • columns order by orderedFieldNames — a declared order wins, fields
    without one keep today's alphabetical fallback
  • headers render resolveFieldLabel; the raw key stays as the title
    attribute so the underlying field is still discoverable
  • default visible columns lead with title_field when the model declares one.
    The existing required-plus-simple-type heuristic fills the remaining slots
    and still covers models that predate the property

Both helpers come from @contentrain/types, so serve-ui and any other consumer
resolve them identically instead of each reimplementing the fallback chain.
serve-ui takes a workspace dependency on types — it is private and bundled, and
types is pure with no Node imports, so it bundles for the browser cleanly.

The secret detector was flagging documentation about secrets

SECRET_PATTERNS matched bare prefixes:

value matched is it a secret
task_id sk_ no
risk_level sk_ no
Authorization: Bearer <token> Bearer no
postgres://localhost:5432/mydb postgres:// no
The api_key parameter is required api_key no

Seven of this repository's twelve validation errors were this — it stores
its own documentation as content, so every page explaining Bearer auth was a
finding. Same shape as the doctor --usage fix: a check firing correctly and
burying what matters.

Each pattern now matches a credential-shaped value rather than prose about
credentials — prefixes need their key body, a bearer token needs an actual
token rather than <token> / $TOKEN / {{token}} / YOUR_TOKEN, an api key
needs to be assigned one, a connection string needs embedded credentials.
18 cases are pinned in tests, taken from this repo's own docs.

Two pre-existing assertions changed rather than being worked around, because
they asserted the false positive: my_api_key_value and
mongodb://localhost/test are no longer reported. Both carry a comment saying
why. A check that fires on the wrong thing is not a strict check; it is one
people learn to scroll past.

What that exposed

Validation on this repo went 12 errors → 5, and the five are real. Running
validate --fix created the four missing tr.json files, which then surfaced
10 genuinely untranslated entries underneath. MCP correctly refuses to invent a
translation, so those stay reported.

The empty tr.json files are the right state: the locale is declared in
config, so the file should exist, and "these entries are untranslated" is more
actionable than "the file is missing".

The branch also carries [contentrain] validate: auto-fix — the transaction
advances the checked-out branch via update-ref alongside the content branch,
which is the documented design. The working tree was never touched.

Incidentally: the contentrain branch had all 11 models without title_field
and is now fully migrated, because every transaction merges base into its
worktree first. Worth knowing for the project migrations — a stale content
branch heals on the first write, it does not need separate handling.

pnpm lint, typecheck, vue-tsc, build, 1650+ tests, plugin:build,
release:check — all green.

🤖 Generated with Claude Code

Contentrain and others added 2 commits August 14, 2026 00:48
…tector stops flagging docs

Two things this project needed once title_field shipped.

**serve-ui was still guessing.** Its column list called
`Object.keys(desc.fields)` under a comment claiming that preserved definition
order. It does not — model JSON is written with canonically sorted keys, so it
was alphabetical, which is the exact problem `order` exists to fix. Columns now
use `orderedFieldNames`, headers use `resolveFieldLabel` (raw key kept in the
`title` attribute so nothing becomes undiscoverable), and the default visible
columns lead with `title_field`. Both helpers come from @contentrain/types so
every consumer resolves them identically. serve-ui gains a workspace dependency
on types; it is private and bundled, and types is pure with no Node imports.

**The secret detector was flagging documentation about secrets.** Bare-prefix
matching meant `task_id` and `risk_level` tripped `sk_`, every page documenting
`Authorization: Bearer <token>` tripped `Bearer `, and a local
`postgres://localhost:5432/mydb` tripped the connection-string rule. Seven of
this repository's twelve validation errors were that — same shape as the
doctor --usage finding: a check firing correctly and burying what matters.

Patterns now match a credential-shaped value: prefixes need their key body, a
bearer token needs a token rather than `<token>`/`$TOKEN`/`{{token}}`, an api
key needs to be assigned one, a connection string needs embedded credentials.
18 cases pinned in tests, from this repo's own docs.

Two pre-existing assertions changed rather than worked around, because they
asserted the false positive: `my_api_key_value` and `mongodb://localhost/test`
are no longer secrets. Both are called out in the test with the reason.

Result on this repo: 12 errors -> 5, and the 5 are real. Running
`validate --fix` then created the four missing tr.json files, which exposed 10
genuine untranslated entries underneath — MCP correctly refuses to invent a
translation. The content branch also advanced and now carries all 11 migrated
models; the working tree was untouched throughout, as the transaction design
intends.
@netlify

netlify Bot commented Aug 13, 2026

Copy link
Copy Markdown

Deploy Preview for contentrain-ai ready!

Name Link
🔨 Latest commit d04947f
🔍 Latest deploy log https://app.netlify.com/projects/contentrain-ai/deploys/6a7e3df6b00a4600095103c3
😎 Deploy Preview https://deploy-preview-115--contentrain-ai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ABB65
ABB65 merged commit 425385c into main Aug 13, 2026
6 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 13, 2026
@ABB65
ABB65 deleted the fix/serve-ui-and-content branch August 13, 2026 22:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant