Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(frontend): derive table rules from durable fixtures
Josué794f680de68e
diff --git a/scripts/style-rules/README.md b/scripts/style-rules/README.mdindex 246560c87..fbce99816 100644--- a/scripts/style-rules/README.md+++ b/scripts/style-rules/README.md@@ -19,16 +19,17 @@ as `scripts/prettier/run-on-staged.mjs` — chosen because:Scope: `desktop-app/ui/**` plus the shared table-system boundary for productionsource under `control-ui/**` and `profile-ui/**`.-| Rule ID | Severity | What it catches |-| ------------------------------ | -------- | --------------------------------------------------------------------------------------------------- |-| `da-no-hex-in-css` | error | `color: #abc` / `border: 1px solid #fff` outside `tokens.css` and the 3 legacy files. |-| `da-no-raw-font-size` | error\* | `font-size: 14px` / `font-size: 1rem` outside `tokens.css`. Use `var(--font-size-*)`. |-| `da-no-new-component-css` | error | New `.css` files under `desktop-app/ui/src/` other than the 5 allowlisted ones. |-| `da-no-hover-motion` | error | Hover states that move, scale, or filter controls. Use background/border/text/shadow token changes. |-| `da-no-hex-in-tsx` | warn | Hex literals in TS/TSX strings. Reviewer judgment for genuinely dynamic cases. |-| `da-no-static-inline-style` | warn | JSX `style={{...}}` not containing `--da-grid-cols` or whitelisted runtime values. |-| `web-no-app-local-table` | error | Raw production `<table>` shells in Control UI or Profile UI instead of the shared table system. |-| `web-no-retired-table-pattern` | error | Production references to retired app-local table, row-action, tab, or expansion families. |+| Rule ID | Severity | What it catches |+| --------------------------------- | -------- | --------------------------------------------------------------------------------------------------- |+| `da-no-hex-in-css` | error | `color: #abc` / `border: 1px solid #fff` outside `tokens.css` and the 3 legacy files. |+| `da-no-raw-font-size` | error\* | `font-size: 14px` / `font-size: 1rem` outside `tokens.css`. Use `var(--font-size-*)`. |+| `da-no-new-component-css` | error | New `.css` files under `desktop-app/ui/src/` other than the 5 allowlisted ones. |+| `da-no-hover-motion` | error | Hover states that move, scale, or filter controls. Use background/border/text/shadow token changes. |+| `da-no-hex-in-tsx` | warn | Hex literals in TS/TSX strings. Reviewer judgment for genuinely dynamic cases. |+| `da-no-static-inline-style` | warn | JSX `style={{...}}` not containing `--da-grid-cols` or whitelisted runtime values. |+| `web-no-app-local-table` | error | Raw production `<table>` shells in Control UI or Profile UI instead of the shared table system. |+| `web-no-app-local-table-viewport` | error | Direct application authorship of `eft-table-viewport` instead of shared `TableViewport`. |+| `web-no-retired-table-pattern` | error | Production references to retired app-local table, row-action, tab, or expansion families. |\*`da-no-raw-font-size` is downgraded to `warn` for the 3 legacy CSS filesto allow boy-scout migration without forcing one big-bang cleanup.@@ -76,6 +77,11 @@ the shared package implementation itself. They enforce the documentedapplication boundary without banning semantic table markup inside the sharedsystem or legitimate non-table disclosure controls.+Rule-unit tests use synthetic source fixtures. Repository-wide conformance is+covered separately by `npm run style-rules` and its strict variant, so deleting+or renaming valid production screens cannot stale a manually maintained test+manifest.+## Why not Stylelint?Considered and skipped intentionally. Notes:diff --git a/scripts/style-rules/rules.mjs b/scripts/style-rules/rules.mjsindex 7553b18b1..54a33d818 100644--- a/scripts/style-rules/rules.mjs+++ b/scripts/style-rules/rules.mjs@@ -145,6 +145,28 @@ export const rules = [return violations},},+ {+ id: 'web-no-app-local-table-viewport',+ severity: 'error',+ description:+ 'Control UI and Profile UI production views must render standardized table viewports through TableViewport.',+ applies(file) {+ return isWebProductionSource(file)+ },+ check({ lines }) {+ const violations = []+ lines.forEach((line, i) => {+ if (/\beft-table-viewport(?:--[a-z0-9-]+)?\b/.test(line)) {+ violations.push({+ line: i + 1,+ message:+ 'direct viewport-class authorship bypasses the shared boundary — use @clerum/frontend-components TableViewport',+ })+ }+ })+ return violations+ },+ },{id: 'web-no-retired-table-pattern',severity: 'error',diff --git a/scripts/style-rules/rules.test.mjs b/scripts/style-rules/rules.test.mjsindex cb0fabaf1..8651e7e9f 100644--- a/scripts/style-rules/rules.test.mjs+++ b/scripts/style-rules/rules.test.mjs@@ -14,31 +14,6 @@ function violationsFor(file, content) {)}-const PRIMARY_RECORD_TABLES = [- 'control-ui/app/outputs/page.tsx',- 'control-ui/app/shared-filesystems/page.tsx',- 'control-ui/components/CodexSubscriptionHub/index.tsx',- 'control-ui/components/CommunicationChannelsTable.tsx',- 'control-ui/components/ContextTable.tsx',- 'control-ui/components/ControlAdminsPanel/index.tsx',- 'control-ui/components/GuardrailHooksTable.tsx',- 'control-ui/components/HostTable.tsx',- 'control-ui/components/LlmDiscoveryPanel/index.tsx',- 'control-ui/components/LlmModelTable.tsx',- 'control-ui/components/LlmPriceTable.tsx',- 'control-ui/components/MarketplaceOrgImages/index.tsx',- 'control-ui/components/McpServerTable.tsx',- 'control-ui/components/ProfileAdminHome.tsx',- 'control-ui/components/PublisherView/GrantedToMe.tsx',- 'control-ui/components/PublisherView/OwnedEntries.tsx',- 'control-ui/components/RecipesTab.tsx',- 'control-ui/components/RegistryApiKeysPanel.tsx',- 'control-ui/components/RegistryCatalog.tsx',- 'control-ui/components/SecretsTable.tsx',- 'control-ui/components/TokenBudgetTable.tsx',- 'profile-ui/app/members/page.tsx',-]-test('rejects raw production tables in Control UI and Profile UI', () => {assert.equal(violationsFor('control-ui/app/agents/page.tsx', '<table><tbody /></table>').length,@@ -56,6 +31,17 @@ test('allows shared table composition and test fixtures', () => {assert.deepEqual(violationsFor('packages/frontend-components/src/DataTable.tsx', fixture), [])})+test('requires the shared viewport boundary in application production source', () => {+ const direct = '<div className="eft-table-viewport eft-table-viewport--embedded" />'+ const shared = '<TableViewport embedded><DataTable /></TableViewport>'++ assert.equal(violationsFor('control-ui/components/Results.tsx', direct).length, 1)+ assert.equal(violationsFor('profile-ui/app/members/page.tsx', direct).length, 1)+ assert.deepEqual(violationsFor('control-ui/components/Results.tsx', shared), [])+ assert.deepEqual(violationsFor('packages/frontend-components/src/index.tsx', direct), [])+ assert.deepEqual(violationsFor('control-ui/components/__tests__/Results.test.tsx', direct), [])+})+test('rejects retired production table and expansion families', () => {const examples = [['control-ui/components/McpServerTable.tsx', 'className="cu-expandable-table"'],@@ -118,29 +104,3 @@ test('shared table typography uses each web app contract', () => {assert.match(profileCss, /--eft-table-header-font-weight:\s*600/)assert.match(profileCss, /--eft-table-cell-font-size:\s*0\.9rem/)})--test('ordinary web record tables keep an explicit sorting model', () => {- for (const file of PRIMARY_RECORD_TABLES) {- const source = readFileSync(file, 'utf8')- assert.match(source, /useTableSort|sortKey/, `${file} must declare its sorting model`)- assert.match(source, /onSort/, `${file} must expose sortable headers`)- }-})--test('primary record tables keep headers mounted through data states', () => {- for (const file of PRIMARY_RECORD_TABLES) {- const source = readFileSync(file, 'utf8')- const tableBodies = [- ...source.matchAll(/<DataTable\b[\s\S]*?<tbody(?:\s[^>]*)?>([\s\S]*?)<\/tbody>/g),- ]-- assert.ok(tableBodies.length > 0, `${file} must render a shared DataTable`)- for (const [, body] of tableBodies) {- assert.match(- body,- /<Table(?:State|Empty)Row/,- `${file} must keep each DataTable mounted with an in-body state row`- )- }- }-})