chore: add chittytrack tail consumer and observability#14
chore: add chittytrack tail consumer and observability#14chitcommit wants to merge 3 commits intomainfrom
Conversation
Adds standard ChittyOS branding header with tier badge, org badge, and accurate service description to README.md. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds tail_consumers binding and observability flag to route Worker logs to chittytrack, closing the gap identified during wrangler audit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
chittyid | f4c56d2 | Apr 13 2026, 10:09 AM |
📝 WalkthroughWalkthroughUpdated README badges; enabled observability and added a tail consumer in Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
wrangler.jsonc (1)
11-13:⚠️ Potential issue | 🔴 CriticalDuplicate
observabilitykey will cause undefined behavior or override issues.The
observabilityblock already exists at lines 11-13. Adding it again at line 73 creates a duplicate key at the same JSON object level. Most JSON parsers silently take the last occurrence, but this is likely unintentional and violates JSON best practices (RFC 8259 recommends unique keys).Remove the duplicate at line 73 since the existing block at lines 11-13 already enables observability.
🐛 Proposed fix: Remove duplicate observability key
"DRAND_BEACON_URL": "https://api.drand.sh/public/latest" - }, - "observability": { "enabled": true }, - "tail_consumers": [{ "service": "chittytrack" }] + }, + "tail_consumers": [{ "service": "chittytrack" }] }Also applies to: 72-74
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@wrangler.jsonc` around lines 11 - 13, Remove the duplicate "observability" object: keep the original "observability" block already present and delete the second occurrence (the repeated "observability": { "enabled": true } block), then fix any trailing commas or surrounding commas so the JSON remains valid after removal; ensure only one unique "observability" key exists in the top-level object.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@wrangler.jsonc`:
- Around line 11-13: Remove the duplicate "observability" object: keep the
original "observability" block already present and delete the second occurrence
(the repeated "observability": { "enabled": true } block), then fix any trailing
commas or surrounding commas so the JSON remains valid after removal; ensure
only one unique "observability" key exists in the top-level object.
Replace "Identity Substrate" with "idenTitY", "Verified Yesterday" with "connectiVitY", "Reach and Authority" with "authoRitY". Per canonical doctrine in chittycanon://gov/governance. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/services/trust-client.js`:
- Around line 153-164: The block in src/services/trust-client.js that currently
checks only data.ty must validate all three DRL components before using them:
ensure data.ty, data.vy, and data.ry are present and are finite numbers (e.g.,
using Number.isFinite or safe parse+isFinite) before computing composite,
trustLevel, or calling toFixed; if any component is missing or invalid, skip the
chittyscore branch (return null or fall back) to avoid NaN/toFixed errors, and
also guard data.confidence when setting verified; update the logic in the
function that contains this branch so the composite/trustLevel/reason/verified
lines only run when all three numeric components are valid.
- Around line 156-165: The returned object in src/services/trust-client.js
currently sets verified: data.confidence > 0.5 which conflates soft confidence
with a hard identity/authorization flag; change it so verified remains driven by
the original identity assertion logic (e.g., an explicit identity check or a
separate boolean like data.isVerified) and keep data.confidence (or a new field
like confidence) for scoring; update the return in the function that builds the
trust object (the object with level, source, score, ty, vy, ry, reason,
verified) so verified is not derived from data.confidence and ensure the
confidence value is preserved separately (e.g., confidence: data.confidence) so
downstream consumers like pipeline.js and chittyrouter-gateway.js continue to
treat verified as an authoritative flag while still using confidence for
scoring.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3125feed-a5c0-480f-94b6-ab5c790d8ac4
📒 Files selected for processing (1)
src/services/trust-client.js
| if (data.ty !== undefined) { | ||
| const composite = (data.ty + data.vy + data.ry) / 3; | ||
| const trustLevel = Math.min(5, Math.floor(composite * 5)); | ||
| return { | ||
| level: data.data.trustLevel, | ||
| level: trustLevel, | ||
| source: 'chittyscore', | ||
| score: data.data.compositeScore, | ||
| dimensions: data.data.dimensions, | ||
| reason: `6D composite score: ${data.data.compositeScore}`, | ||
| verified: true | ||
| score: composite, | ||
| ty: data.ty, | ||
| vy: data.vy, | ||
| ry: data.ry, | ||
| reason: `TY/VY/RY reckoning: ${data.ty.toFixed(2)}/${data.vy.toFixed(2)}/${data.ry.toFixed(2)}`, | ||
| verified: data.confidence > 0.5 |
There was a problem hiding this comment.
Validate all three DRL components before using them.
Line 153 only guards data.ty, but Lines 154-164 assume data.vy and data.ry are present numbers too. A partial or differently-typed payload here will either produce NaN or throw on toFixed(), and the catch path silently collapses the lookup to null.
Proposed hardening
const data = await response.json();
- if (data.ty !== undefined) {
- const composite = (data.ty + data.vy + data.ry) / 3;
+ const ty = Number(data.ty);
+ const vy = Number(data.vy);
+ const ry = Number(data.ry);
+ if ([ty, vy, ry].every(Number.isFinite)) {
+ const composite = (ty + vy + ry) / 3;
const trustLevel = Math.min(5, Math.floor(composite * 5));
return {
level: trustLevel,
source: 'chittyscore',
score: composite,
- ty: data.ty,
- vy: data.vy,
- ry: data.ry,
- reason: `TY/VY/RY reckoning: ${data.ty.toFixed(2)}/${data.vy.toFixed(2)}/${data.ry.toFixed(2)}`,
+ ty,
+ vy,
+ ry,
+ reason: `TY/VY/RY reckoning: ${ty.toFixed(2)}/${vy.toFixed(2)}/${ry.toFixed(2)}`,
verified: data.confidence > 0.5
};
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/services/trust-client.js` around lines 153 - 164, The block in
src/services/trust-client.js that currently checks only data.ty must validate
all three DRL components before using them: ensure data.ty, data.vy, and data.ry
are present and are finite numbers (e.g., using Number.isFinite or safe
parse+isFinite) before computing composite, trustLevel, or calling toFixed; if
any component is missing or invalid, skip the chittyscore branch (return null or
fall back) to avoid NaN/toFixed errors, and also guard data.confidence when
setting verified; update the logic in the function that contains this branch so
the composite/trustLevel/reason/verified lines only run when all three numeric
components are valid.
| return { | ||
| level: data.data.trustLevel, | ||
| level: trustLevel, | ||
| source: 'chittyscore', | ||
| score: data.data.compositeScore, | ||
| dimensions: data.data.dimensions, | ||
| reason: `6D composite score: ${data.data.compositeScore}`, | ||
| verified: true | ||
| score: composite, | ||
| ty: data.ty, | ||
| vy: data.vy, | ||
| ry: data.ry, | ||
| reason: `TY/VY/RY reckoning: ${data.ty.toFixed(2)}/${data.vy.toFixed(2)}/${data.ry.toFixed(2)}`, | ||
| verified: data.confidence > 0.5 | ||
| }; |
There was a problem hiding this comment.
Keep verified separate from score confidence.
Line 164 turns verified into data.confidence > 0.5, but downstream code treats verified as a hard identity/authorization signal, not a soft quality score. src/services/pipeline.js:320-330 adds 30 trust points from it, and src/integrations/chittyrouter-gateway.js:1048-1060 denies access when it is false. This change will downgrade low-confidence reckonings into “unverified user” decisions instead of “verified user with weaker evidence.”
Suggested direction
return {
level: trustLevel,
source: 'chittyscore',
score: composite,
+ confidence: data.confidence ?? null,
ty: data.ty,
vy: data.vy,
ry: data.ry,
reason: `TY/VY/RY reckoning: ${data.ty.toFixed(2)}/${data.vy.toFixed(2)}/${data.ry.toFixed(2)}`,
- verified: data.confidence > 0.5
+ verified: true
};🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/services/trust-client.js` around lines 156 - 165, The returned object in
src/services/trust-client.js currently sets verified: data.confidence > 0.5
which conflates soft confidence with a hard identity/authorization flag; change
it so verified remains driven by the original identity assertion logic (e.g., an
explicit identity check or a separate boolean like data.isVerified) and keep
data.confidence (or a new field like confidence) for scoring; update the return
in the function that builds the trust object (the object with level, source,
score, ty, vy, ry, reason, verified) so verified is not derived from
data.confidence and ensure the confidence value is preserved separately (e.g.,
confidence: data.confidence) so downstream consumers like pipeline.js and
chittyrouter-gateway.js continue to treat verified as an authoritative flag
while still using confidence for scoring.
Summary
tail_consumers: [{ service: "chittytrack" }]to wrangler configobservability: { enabled: true }(was missing)Test plan
chittytrackreceives tail events🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
Chores
New Features