CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

adobe/aem-cloud-service

All AEM as a Cloud Service skills: component development, Workflow model design, development, triggering, launchers, debugging, and triaging, Dispatcher config authoring, advisory, incident response, performance tuning, and security hardening, Rapid Development Environment (RDE) deployment, log inspection, snapshots, and troubleshooting via `aio aem rde`, Jackrabbit Oak query/index tuning (property, Lucene index definitions), and extracting/inventorying JCR queries (XPath, SQL2, QueryBuilder) across a codebase.

Quality

85%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Low

Low-risk findings worth noting

Overview
Quality
Evals
Security
Files

event-migration.jsskills/migration/scripts/validate-migration/check/patterns/

'use strict';

const { FAILURE_CLASSES } = require('../../failure-classes.js');
const { jarDsDescriptors } = require('../lib/jar.js');
const { descriptorProperty, topicFromDescriptor, componentContractFromDescriptor, sourceContractFailure, componentName, dsDescriptorFor } = require('../lib/descriptor.js');
const { getBundleDiagnosis } = require('../lib/diagnosis.js');
const { bundleGate, componentGate } = require('../lib/runtime-gate.js');

module.exports = {
  describe: 'OSGi EventHandler → Sling JobConsumer',
  discover: (jar, args) => {
    // Migrated code declares a JobConsumer with job.topics property.
    // When the caller pins a class, read that component's descriptor so the
    // topic check still runs instead of being silently skipped.
    if (args && args.fqcn) {
      const xml = dsDescriptorFor(jar, args.fqcn);
      return { fqcn: args.fqcn, topic: topicFromDescriptor(xml), contract: componentContractFromDescriptor(xml, 'event-migration') };
    }
    for (const [, xml] of jarDsDescriptors(jar)) {
      if (!descriptorProperty(xml, 'job.topics').present) continue;
      const fqcn = componentName(xml);
      if (fqcn) return { fqcn, topic: topicFromDescriptor(xml), contract: componentContractFromDescriptor(xml, 'event-migration') };
    }
    return null;
  },
  async verify({ bundleBSN, discovered, args }) {
    const contractFailure = sourceContractFailure(discovered);
    if (contractFailure) return contractFailure;
    const diagnosis = await getBundleDiagnosis({ bundleBSN, args });
    const bundleFailure = bundleGate(diagnosis, bundleBSN);
    if (bundleFailure) return bundleFailure;
    const component = componentGate(diagnosis, discovered.contract?.componentName || discovered.fqcn);
    if (component.failure) return component.failure;

    // job.topics is read at discovery time from the built DS descriptor
    // (offline), so no Felix property lookup is needed.
    if (!discovered.topic) {
      return {
        result: 'fail',
        failure_class: FAILURE_CLASSES.CONTRACT_MISMATCH,
        bundle_state: 'Active', component_state: 'Active',
        evidence: 'JobConsumer contract missing job.topics property in DS descriptor',
      };
    }
    return {
      result: 'pass', bundle_state: 'Active', component_state: 'Active',
      checks: { ...discovered.contract?.checks, topic: discovered.topic },
      restricted: true,
      restricted_reason: 'effective JobConsumer properties not exposed by diagnose-osgi-bundle; job processing and business effects not tested',
    };
  },
};

skills

migration

README.md

SKILL.md

README.md

tile.json